@@ -508,7 +508,7 @@ int tm_reply_replicate(struct sip_msg *msg)
508
508
return 1 ;
509
509
}
510
510
511
- static int tm_existing_trans (struct sip_msg * msg )
511
+ static int tm_existing_ack_trans (struct sip_msg * msg )
512
512
{
513
513
struct cell * t = get_t ();
514
514
if (t == T_UNDEFINED ) {
@@ -525,6 +525,28 @@ static int tm_existing_trans(struct sip_msg *msg)
525
525
return 0 ;
526
526
}
527
527
528
+ static int tm_existing_invite_trans (struct sip_msg * msg )
529
+ {
530
+ struct cell * t = get_cancelled_t ();
531
+ if (t == T_UNDEFINED ) {
532
+ /* parse needed hdrs*/
533
+ if (check_transaction_quadruple (msg )== 0 ) {
534
+ LM_ERR ("too few headers\n" );
535
+ return 0 ; /*drop request!*/
536
+ }
537
+ if (!msg -> hash_index )
538
+ msg -> hash_index = tm_hash (msg -> callid -> body ,get_cseq (msg )-> number );
539
+ /* performe lookup */
540
+ t = t_lookupOriginalT (msg );
541
+ }
542
+ if (t ) {
543
+ LM_DBG ("transaction already present here, no need to replicate\n" );
544
+ return 1 ;
545
+ }
546
+ return 0 ;
547
+ }
548
+
549
+
528
550
/**
529
551
* Replicates a message within a cluster
530
552
* Returns:
@@ -550,7 +572,9 @@ int tm_anycast_replicate(struct sip_msg *msg)
550
572
LM_DBG ("message already replicated, shouldn't have got here\n" );
551
573
return -2 ;
552
574
}
553
- if (tm_existing_trans (msg ))
575
+ if (msg -> REQ_METHOD == METHOD_CANCEL && tm_existing_invite_trans (msg ))
576
+ return -1 ;
577
+ if (msg -> REQ_METHOD == METHOD_ACK && tm_existing_ack_trans (msg ))
554
578
return -1 ;
555
579
556
580
/* we are currently doing auto-CANCEL only for 3261 transactions */
@@ -571,7 +595,7 @@ int tm_anycast_cancel(struct sip_msg *msg)
571
595
if (!tm_repl_auto_cancel || !tm_repl_cluster )
572
596
return -1 ;
573
597
574
- if (!tm_existing_trans (msg ))
598
+ if (!tm_existing_invite_trans (msg ))
575
599
return tm_replicate_cancel (msg )? 0 : -2 ;
576
600
else if (t_relay_to (msg , NULL , 0 ) < 0 ) {
577
601
LM_ERR ("cannot handle auto-CANCEL here - send to script!\n" );
0 commit comments