@@ -18,6 +18,10 @@ async fn assert_text(t: &TestContext, call_id: MsgId, text: &str) -> Result<()>
1818 Ok ( ( ) )
1919}
2020
21+ // Offer and answer examples from <https://www.rfc-editor.org/rfc/rfc3264>
22+ const PLACE_INFO : & str = "v=0\r \n o=alice 2890844526 2890844526 IN IP4 host.anywhere.com\r \n s=\r \n c=IN IP4 host.anywhere.com\r \n t=0 0\r \n m=audio 62986 RTP/AVP 0 4 18\r \n a=rtpmap:0 PCMU/8000\r \n a=rtpmap:4 G723/8000\r \n a=rtpmap:18 G729/8000\r \n a=inactive\r \n " ;
23+ const ACCEPT_INFO : & str = "v=0\r \n o=bob 2890844730 2890844731 IN IP4 host.example.com\r \n s=\r \n c=IN IP4 host.example.com\r \n t=0 0\r \n m=audio 54344 RTP/AVP 0 4\r \n a=rtpmap:0 PCMU/8000\r \n a=rtpmap:4 G723/8000\r \n a=inactive\r \n " ;
24+
2125async fn setup_call ( ) -> Result < CallSetup > {
2226 let mut tcm = TestContextManager :: new ( ) ;
2327 let alice = tcm. alice ( ) . await ;
@@ -32,7 +36,7 @@ async fn setup_call() -> Result<CallSetup> {
3236 // Alice's other device sees the same message as an outgoing call.
3337 let alice_chat = alice. create_chat ( & bob) . await ;
3438 let test_msg_id = alice
35- . place_outgoing_call ( alice_chat. id , "place-info-123" . to_string ( ) )
39+ . place_outgoing_call ( alice_chat. id , PLACE_INFO . to_string ( ) )
3640 . await ?;
3741 let sent1 = alice. pop_sent_msg ( ) . await ;
3842 assert_eq ! ( sent1. sender_msg_id, test_msg_id) ;
@@ -44,7 +48,7 @@ async fn setup_call() -> Result<CallSetup> {
4448 let info = t. load_call_by_id ( m. id ) . await ?;
4549 assert ! ( !info. is_incoming( ) ) ;
4650 assert ! ( !info. is_accepted( ) ) ;
47- assert_eq ! ( info. place_call_info, "place-info-123" ) ;
51+ assert_eq ! ( info. place_call_info, PLACE_INFO ) ;
4852 assert_text ( t, m. id , "Outgoing call" ) . await ?;
4953 }
5054
@@ -61,7 +65,7 @@ async fn setup_call() -> Result<CallSetup> {
6165 let info = t. load_call_by_id ( m. id ) . await ?;
6266 assert ! ( info. is_incoming( ) ) ;
6367 assert ! ( !info. is_accepted( ) ) ;
64- assert_eq ! ( info. place_call_info, "place-info-123" ) ;
68+ assert_eq ! ( info. place_call_info, PLACE_INFO ) ;
6569 assert_text ( t, m. id , "Incoming call" ) . await ?;
6670 }
6771
@@ -90,7 +94,7 @@ async fn accept_call() -> Result<CallSetup> {
9094 } = setup_call ( ) . await ?;
9195
9296 // Bob accepts the incoming call
93- bob. accept_incoming_call ( bob_call. id , "accept-info-456" . to_string ( ) )
97+ bob. accept_incoming_call ( bob_call. id , ACCEPT_INFO . to_string ( ) )
9498 . await ?;
9599 assert_text ( & bob, bob_call. id , "Incoming call" ) . await ?;
96100 bob. evtracker
@@ -99,7 +103,7 @@ async fn accept_call() -> Result<CallSetup> {
99103 let sent2 = bob. pop_sent_msg ( ) . await ;
100104 let info = bob. load_call_by_id ( bob_call. id ) . await ?;
101105 assert ! ( info. is_accepted( ) ) ;
102- assert_eq ! ( info. place_call_info, "place-info-123" ) ;
106+ assert_eq ! ( info. place_call_info, PLACE_INFO ) ;
103107
104108 bob2. recv_msg_trash ( & sent2) . await ;
105109 assert_text ( & bob, bob_call. id , "Incoming call" ) . await ?;
@@ -120,12 +124,12 @@ async fn accept_call() -> Result<CallSetup> {
120124 ev,
121125 EventType :: OutgoingCallAccepted {
122126 msg_id: alice2_call. id,
123- accept_call_info: "accept-info-456" . to_string( )
127+ accept_call_info: ACCEPT_INFO . to_string( )
124128 }
125129 ) ;
126130 let info = alice. load_call_by_id ( alice_call. id ) . await ?;
127131 assert ! ( info. is_accepted( ) ) ;
128- assert_eq ! ( info. place_call_info, "place-info-123" ) ;
132+ assert_eq ! ( info. place_call_info, PLACE_INFO ) ;
129133
130134 alice2. recv_msg_trash ( & sent2) . await ;
131135 assert_text ( & alice2, alice2_call. id , "Outgoing call" ) . await ?;
0 commit comments