@@ -72,30 +72,22 @@ pub async fn create_test_endpoint() -> crate::Result<crate::transaction::endpoin
7272fn test_dialog_id_eq ( ) {
7373 let dialog_id_1 = DialogId {
7474 call_id : "test-call-id-123" . to_string ( ) ,
75- from_tag : "456" . to_string ( ) ,
76- to_tag : "789" . to_string ( ) ,
75+ local_tag : "456" . to_string ( ) ,
76+ remote_tag : "789" . to_string ( ) ,
7777 } ;
78- assert ! ( "456" < "789" ) ;
79- assert_eq ! ( dialog_id_1. to_string( ) , "test-call-id-123-789-456" ) ;
80- let dialog_id_2 = DialogId {
81- call_id : "test-call-id-123" . to_string ( ) ,
82- from_tag : "789" . to_string ( ) ,
83- to_tag : "456" . to_string ( ) ,
84- } ;
85- assert_eq ! ( dialog_id_2. to_string( ) , "test-call-id-123-789-456" ) ;
86- assert_eq ! ( dialog_id_1, dialog_id_2) ;
78+ assert_eq ! ( dialog_id_1. to_string( ) , "test-call-id-123-456-789" ) ;
8779
88- let dialog_id_3 = DialogId {
80+ let dialog_id_4 = DialogId {
8981 call_id : "mock" . to_string ( ) ,
90- from_tag : "M3wnsBf" . to_string ( ) ,
91- to_tag : "1NyRqPt1" . to_string ( ) ,
82+ local_tag : "M3wnsBf" . to_string ( ) ,
83+ remote_tag : "1NyRqPt1" . to_string ( ) ,
9284 } ;
93- let dialog_id_4 = DialogId {
85+ let dialog_id_5 = DialogId {
9486 call_id : "mock" . to_string ( ) ,
95- from_tag : "1NyRqPt1" . to_string ( ) ,
96- to_tag : "M3wnsBf" . to_string ( ) ,
87+ local_tag : "1NyRqPt1" . to_string ( ) ,
88+ remote_tag : "M3wnsBf" . to_string ( ) ,
9789 } ;
98- assert_eq ! ( dialog_id_3 , dialog_id_4 ) ;
90+ assert_ne ! ( dialog_id_4 , dialog_id_5 ) ;
9991}
10092#[ tokio:: test]
10193async fn test_dialog_state_transitions ( ) -> crate :: Result < ( ) > {
@@ -105,8 +97,8 @@ async fn test_dialog_state_transitions() -> crate::Result<()> {
10597 // Create dialog ID
10698 let dialog_id = DialogId {
10799 call_id : "test-call-id-123" . to_string ( ) ,
108- from_tag : "alice-tag-456" . to_string ( ) ,
109- to_tag : "bob-tag-789" . to_string ( ) ,
100+ local_tag : "alice-tag-456" . to_string ( ) ,
101+ remote_tag : "bob-tag-789" . to_string ( ) ,
110102 } ;
111103
112104 // Create INVITE request
@@ -173,8 +165,8 @@ async fn test_server_dialog_state_transitions() -> crate::Result<()> {
173165 // Create dialog ID
174166 let dialog_id = DialogId {
175167 call_id : "test-call-id-server-123" . to_string ( ) ,
176- from_tag : "alice -tag-456 " . to_string ( ) ,
177- to_tag : "bob -tag-789 " . to_string ( ) ,
168+ local_tag : "bob -tag-789 " . to_string ( ) ,
169+ remote_tag : "alice -tag-456 " . to_string ( ) ,
178170 } ;
179171
180172 // Create INVITE request
@@ -230,8 +222,8 @@ async fn test_dialog_in_dialog_requests() -> crate::Result<()> {
230222 // Create dialog ID
231223 let dialog_id = DialogId {
232224 call_id : "test-call-id-in-dialog-123" . to_string ( ) ,
233- from_tag : "alice-tag-456" . to_string ( ) ,
234- to_tag : "bob-tag-789" . to_string ( ) ,
225+ local_tag : "alice-tag-456" . to_string ( ) ,
226+ remote_tag : "bob-tag-789" . to_string ( ) ,
235227 } ;
236228
237229 // Create initial INVITE request
@@ -329,8 +321,8 @@ async fn test_dialog_termination_scenarios() -> crate::Result<()> {
329321 // Test 1: Termination with error status code
330322 let dialog_id_1 = DialogId {
331323 call_id : "test-call-id-term-1" . to_string ( ) ,
332- from_tag : "alice-tag-456" . to_string ( ) ,
333- to_tag : "bob-tag-789" . to_string ( ) ,
324+ local_tag : "alice-tag-456" . to_string ( ) ,
325+ remote_tag : "bob-tag-789" . to_string ( ) ,
334326 } ;
335327
336328 let invite_req_1 = create_invite_request ( "alice-tag-456" , "" , "test-call-id-term-1" ) ;
@@ -361,8 +353,8 @@ async fn test_dialog_termination_scenarios() -> crate::Result<()> {
361353 // Test 2: Normal termination (BYE)
362354 let dialog_id_2 = DialogId {
363355 call_id : "test-call-id-term-2" . to_string ( ) ,
364- from_tag : "alice-tag-456" . to_string ( ) ,
365- to_tag : "bob-tag-789" . to_string ( ) ,
356+ local_tag : "alice-tag-456" . to_string ( ) ,
357+ remote_tag : "bob-tag-789" . to_string ( ) ,
366358 } ;
367359
368360 let invite_req_2 = create_invite_request ( "alice-tag-456" , "bob-tag-789" , "test-call-id-term-2" ) ;
@@ -404,8 +396,8 @@ async fn test_dialog_sequence_numbers() -> crate::Result<()> {
404396
405397 let dialog_id = DialogId {
406398 call_id : "test-call-id-seq-123" . to_string ( ) ,
407- from_tag : "alice-tag-456" . to_string ( ) ,
408- to_tag : "bob-tag-789" . to_string ( ) ,
399+ local_tag : "alice-tag-456" . to_string ( ) ,
400+ remote_tag : "bob-tag-789" . to_string ( ) ,
409401 } ;
410402
411403 let invite_req = create_invite_request ( "alice-tag-456" , "bob-tag-789" , "test-call-id-seq-123" ) ;
@@ -438,8 +430,8 @@ async fn test_dialog_sequence_numbers() -> crate::Result<()> {
438430async fn test_dialog_state_display ( ) -> crate :: Result < ( ) > {
439431 let dialog_id = DialogId {
440432 call_id : "test-call-id-display" . to_string ( ) ,
441- from_tag : "alice-tag" . to_string ( ) ,
442- to_tag : "bob-tag" . to_string ( ) ,
433+ local_tag : "alice-tag" . to_string ( ) ,
434+ remote_tag : "bob-tag" . to_string ( ) ,
443435 } ;
444436
445437 // Test all state display formats
@@ -464,10 +456,10 @@ async fn test_dialog_state_display() -> crate::Result<()> {
464456async fn test_dialog_id_creation ( ) -> crate :: Result < ( ) > {
465457 // Test from Request
466458 let request = create_invite_request ( "alice-tag-123" , "" , "call-id-456" ) ;
467- let dialog_id = DialogId :: try_from ( & request) ?;
459+ let dialog_id = DialogId :: try_from ( ( & request, TransactionRole :: Client ) ) ?;
468460 assert_eq ! ( dialog_id. call_id, "call-id-456" ) ;
469- assert_eq ! ( dialog_id. from_tag , "alice-tag-123" ) ;
470- assert_eq ! ( dialog_id. to_tag , "" ) ;
461+ assert_eq ! ( dialog_id. local_tag , "alice-tag-123" ) ;
462+ assert_eq ! ( dialog_id. remote_tag , "" ) ;
471463
472464 // Test from Response
473465 let response = create_response (
@@ -476,10 +468,10 @@ async fn test_dialog_id_creation() -> crate::Result<()> {
476468 "bob-tag-789" ,
477469 "call-id-456" ,
478470 ) ;
479- let dialog_id_resp = DialogId :: try_from ( & response) ?;
471+ let dialog_id_resp = DialogId :: try_from ( ( & response, TransactionRole :: Client ) ) ?;
480472 assert_eq ! ( dialog_id_resp. call_id, "call-id-456" ) ;
481- assert_eq ! ( dialog_id_resp. from_tag , "alice-tag-123" ) ;
482- assert_eq ! ( dialog_id_resp. to_tag , "bob-tag-789" ) ;
473+ assert_eq ! ( dialog_id_resp. local_tag , "alice-tag-123" ) ;
474+ assert_eq ! ( dialog_id_resp. remote_tag , "bob-tag-789" ) ;
483475
484476 // Test display
485477 let display_str = dialog_id_resp. to_string ( ) ;
0 commit comments