[Kamailio-Devel] How does Kamailio match an ACK for a stateless [3456]XX replied by Kamailio itself?

Daniel-Constantin Mierla miconda at gmail.com
Mon Dec 15 12:44:19 CET 2008


Hello,

the filtering is on to-tag, and it is done by sl if the reply was sent 
with this module, or by tm.

On 12/15/08 13:35, Iñaki Baz Castillo wrote:
> El Lunes, 15 de Diciembre de 2008, Alex Balashov escribió:
>   
>> No, Klaus is right.  It's something in the to-tag:
>>
>> Check out sl_filter_ACK() in modules/sl/sl_funcs.c:
>>
>>          if (msg->to) {
>>                  tag_str = &(get_to(msg)->tag_value);
>>                  if ( tag_str->len==TOTAG_VALUE_LEN )
>>                  {
>>                          /* calculate the variable part of to-tag */
>>                          calc_crc_suffix(msg, tag_suffix);
>>                          /* test whether to-tag equal now */
>>                          if (memcmp(tag_str->s,sl_tag.s,sl_tag.len)==0) {
>>                                  LM_DBG("local ACK found -> dropping
>> it!\n");
>>                                  if_update_stat( sl_enable_stats,
>> rcv_acks, 1);
>>                                  run_sl_callbacks( SLCB_ACK_IN, msg, 0,
>> 0, 0, 0 );
>>                                  return 0;
>>                          }
>>                  }
>>          }
>>
>>
>> calc_crc_suffix() is defined in tags.h.
>>     
>
>
> Thanks a lot for pointintg it out, but I don't understant why "To_tag" is 
> preferred over "branch".
> During a dialog between alice and bob, alice could send several re-INVITE's 
> and for any reason the proxy could reject them stateless with a 403. All the 
> re-INVITE have the same "To_tag" so matching an ACK based on the "To_tag" 
> could be wrong, it could occur the following:
>
> alice         proxy      bob
>
> INVITE ----->
>               INVITE ----->
>                <--------- 200
> <--------- 200
> ACK -------->
>                ACK ------->
>
> re-INVITE(1) ---->
>         X--- 403
>
> re-INVITE(2) ---->
> <----------- 403
> ACK(2)----------->
>
>
> So here, which re-INVITE is confirming ACK(2): re-INVITE(1) or re-INVITE(2)? 
> (both have same To_tag).
>
> What about if the 403 for re-INVITE(1) arrives to alice *after* 403 for 
> re-INVITE(2)? Then alice will send two ACK with same To_tag but, of course, 
> different "branch". If just the To_tag is matched, the second ACK will not 
> match its re-INVITE.
>
> Am I wrong?
>   
via branch is taken in consideration when the tag is generated. So if 
the branches are different, then the tags should be different.

Cheers,
Daniel

-- 
Daniel-Constantin Mierla
http://www.asipto.com




More information about the Devel mailing list