[OpenSIPS-Devel] CANCELs and negative ACKs are constructed from the outgoing INVITE ?

Bogdan-Andrei Iancu bogdan at voice-system.ro
Fri Oct 10 08:42:52 CEST 2008


Hi Noman,

You should not just change some headers in the messages, because you 
break the call - there are headers (cseq, callid, from , to) that define 
the call and they should not be changed.

With uac_replace_from() (available from 1.2) you can change FROM header 
in a very save way.

Regards,
Bogdan

Noman Siddiqui wrote:
> Hi Bogdan,
>
> I am basically just using the subst to replace the IP in the To and 
> From header before sending it out.
>
> e.g.
>                $avp(snd_hdr) = $hdr(From);
>                
> avp_subst("$avp(snd_hdr)","/192.168.10.10/$avp(wan_ip)/ig");
>                subst('/From:.*/From: $avp(snd_hdr)\r/i');
>
> and similarly for To header.
>
> I am currently using 1.3.X and hence don't have access to 
> uac_replace_from(). Out of curiosity in 1.4 version, do we have 
> similar function for replacing To header as well, otherwise To headers 
> will still have the same issue, right ?
>
> Thanks,
> Noman
>
>
> ----Original Message Follows----
> From: Bogdan-Andrei Iancu <bogdan at voice-system.ro>
> To: Noman Siddiqui <nomansi at hotmail.com>
> CC: devel at lists.opensips.org
> Subject: Re: [OpenSIPS-Devel] CANCELs and negative ACKs are 
> constructed from the outgoing INVITE ?
> Date: Thu, 09 Oct 2008 18:23:21 +0300
>
> Hi Noman,
>
> How do you change the FROM and TO headers ? because you need to 
> preserve the transaction integrity....
>
> For From header, OpenSIPS offers uac_replace_from() - 
> http://www.opensips.org/html/docs/modules/1.4.x/uac.html - which does 
> a proper job.
>
> Regards,
> Bogdan
>
> Noman Siddiqui wrote:
>> Hi Bogdan,
>>
>> Thanks for looking into this. Yes, the problem is when the From and 
>> To headers are changed in the outgoing INVITE and the CANCEL comes in 
>> and we try to send the CANCEL out using t_relay, it picks up the To 
>> and From headers from the original incoming INVITE. Trying to change 
>> the headers in the CANCEL also doesn't work as the outgoing CANCEL is 
>> getting built locally afterwards:
>> cancel_branch(t, branch )
>> .. build_cancel(t, branch, &len)
>> ..... build_local( Trans, branch, len,CANCEL, CANCEL_LEN, &Trans->to )
>>
>> In case of negative ACK To Header is updated but the From header is not.
>>
>> Thanks,
>> Noman
>>
>> ----Original Message Follows----
>> From: Bogdan-Andrei Iancu <bogdan at voice-system.ro>
>> To: Noman Siddiqui <nomansi at hotmail.com>
>> CC: devel at lists.opensips.org
>> Subject: Re: [OpenSIPS-Devel] CANCELs and negative ACKs are 
>> constructed from the    outgoing INVITE ?
>> Date: Thu, 09 Oct 2008 12:05:51 +0300
>>
>> Hi Noman,
>>
>> There is no similar functionality because there is no need - the 
>> CANCELs and local ACKs are build based on the received INVITEs, but 
>> taking into consideration the changes that were applied on the INVITE 
>> (like changing FROM hdr, ROUTE headers, etc).
>>
>> Have you spotted a functionality bug - some info that is not updated?
>>
>> Regards,
>> Bogdan
>>
>> Noman Siddiqui wrote:
>>> Hi All,
>>>
>>> Does anyone know if the support for reparse_invite tm configuration 
>>> and tm_relay_cancel is present in openSER-1.3.1 or later releases.
>>>
>>> I found the related patch SER-212 
>>> (http://lists.iptel.org/pipermail/serdev/2007-May/010212.html) to 
>>> fix the issue with CANCEL and negative ACK being built using the 
>>> incoming INVITE instead of outgoing INVITE. However, I searched 
>>> through the 1.3.1 openSER codebase and couldn't find this or similar 
>>> feature. If its covered through some other feature then kindly 
>>> provide more details. If its not already there then is there any 
>>> enhancement request already in place to cover this or does it 
>>> require new feature request to be opened ?
>>>
>>> Here is the pacth detail of SER-212:
>>> http://lists.iptel.org/pipermail/serdev/2007-May/010212.html
>>> ===================
>>>   SER CVS Repository
>>>
>>>   Modified files:
>>>     modules/tm           t_cancel.c t_fwd.c t_fwd.h t_msgbuilder.c
>>>                          t_msgbuilder.h t_reply.c tm.c
>>>   Added files:
>>>     modules/tm           lw_parser.c lw_parser.h
>>>   Log:
>>>   CANCELs and negative ACKs are constructed from the INVITE which 
>>> was sent out
>>>   instead of building them from the received one. The disadvantage is
>>>   that the outgoing INVITE has to be partially reparsed, the 
>>> advantage is that
>>>   the CANCEL/ACK is always RFC-compliant, it always contains the 
>>> same route-set
>>>   as the INVITE message. (closes SER-212)
>>>
>>>   build_local_reparse() function can be used to construct a CANCEL 
>>> or ACK, it
>>>   reparses the outgoing INVITE and applies the modifications 
>>> specified by the RFC.
>>>
>>>   new module parameters:
>>>    - reparse_invite: set it to 0 in order to revert to the old 
>>> behaviour)
>>>    - ac_extra_hdrs: prefix for additional headers which are kept by 
>>> build_local_reparse()
>>>
>>>   new script function:
>>>    - t_relay_cancel() - can be used to catch CANCEL requests at the 
>>> beginning of the script
>>>                         and bypass the rest of the script processing:
>>>
>>>   if (!t_relay_cancel()) {  # implicit drop if relaying was successful,
>>>                             # nothing to do
>>>
>>>           # corresponding INVITE transaction found but error occurred
>>>           sl_reply("500", "Internal Server Error");
>>>           drop;
>>>   }
>>>   # bad luck, corresponding INVITE transaction is missing,
>>>   # do the same as for INVITEs
>>>   ...
>>>
>>>   Revision  Changes    Path
>>>   1.1       +258 -0    sip_router/modules/tm/lw_parser.c (new)
>>> http://cvs.berlios.de/cgi-bin/viewcvs.cgi/ser/sip_router/modules/tm/lw_parser.c?rev=1.1&content-type=text/plain 
>>>
>>>
>>>   1.1       +46 -0     sip_router/modules/tm/lw_parser.h (new)
>>> http://cvs.berlios.de/cgi-bin/viewcvs.cgi/ser/sip_router/modules/tm/lw_parser.h?rev=1.1&content-type=text/plain 
>>>
>>>
>>>   1.23      +12 -3     sip_router/modules/tm/t_cancel.c
>>> http://cvs.berlios.de/cgi-bin/viewcvs.cgi/ser/sip_router/modules/tm/t_cancel.c.diff?r1=1.22&r2=1.23 
>>>
>>>
>>>   1.87      +64 -2     sip_router/modules/tm/t_fwd.c
>>> http://cvs.berlios.de/cgi-bin/viewcvs.cgi/ser/sip_router/modules/tm/t_fwd.c.diff?r1=1.86&r2=1.87 
>>>
>>>
>>>   1.15      +2 -1      sip_router/modules/tm/t_fwd.h
>>> http://cvs.berlios.de/cgi-bin/viewcvs.cgi/ser/sip_router/modules/tm/t_fwd.h.diff?r1=1.14&r2=1.15 
>>>
>>>
>>>   1.46      +161 -1    sip_router/modules/tm/t_msgbuilder.c
>>> http://cvs.berlios.de/cgi-bin/viewcvs.cgi/ser/sip_router/modules/tm/t_msgbuilder.c.diff?r1=1.45&r2=1.46 
>>>
>>>
>>>   1.18      +7 -1      sip_router/modules/tm/t_msgbuilder.h
>>> http://cvs.berlios.de/cgi-bin/viewcvs.cgi/ser/sip_router/modules/tm/t_msgbuilder.h.diff?r1=1.17&r2=1.18 
>>>
>>>
>>>   1.140     +14 -3     sip_router/modules/tm/t_reply.c
>>> http://cvs.berlios.de/cgi-bin/viewcvs.cgi/ser/sip_router/modules/tm/t_reply.c.diff?r1=1.139&r2=1.140 
>>>
>>>
>>>   1.153     +23 -1     sip_router/modules/tm/tm.c
>>> http://cvs.berlios.de/cgi-bin/viewcvs.cgi/ser/sip_router/modules/tm/tm.c.diff?r1=1.152&r2=1.153 
>>>
>>>
>>> =============================
>>>
>>> Thanks and appreciate your help.
>>>
>>>
>>>
>>> _______________________________________________
>>> Devel mailing list
>>> Devel at lists.opensips.org
>>> http://lists.opensips.org/cgi-bin/mailman/listinfo/devel
>>>
>>>
>>
>>
>>
>
>
>




More information about the Devel mailing list