From: Olivier J. <oja...@gm...> - 2006-03-29 12:09:04
|
On 3/29/06, Artur Silveira da Cunha <Art...@al...> wr= ote: > Hi, > > A coworker transmits me the following problem with INVITE and CANCEL and > how to resolve VIA headers with sipp. > > The INVITE has several VIA lines in the header > The CANCEL normally has only one VIA header > > He has the following scenario: > > <rcv INVITE> // fullfill the [last_Via] parameter > // regexp Via header with $1, fullfull only one VIA line and the > other VIA lines are lost > <send reply> // VIA can be fulfilled with [last_Via] > > <rcv CANCEL> // fullfill the [last_Via] parameter > <reply 200 OK> // VIA can be fulfilled with [last_Via] > ... > <send BYE> // can't use the [last_Via] because it is the CANCEL > originated, and it don't knows how to store the VIA headers from the > INVITE request > > Has somebody a solution for this problem? Hello Artur, you can use a regexp to store the VIAs headers from the invite, provided that you know which header comes next. Example, with next header being a From: <recv request=3D"INVITE" crlf=3D"true"> <action> <ereg regexp=3D"Via:(.*)From:" search_in=3D"msg" check_it=3D"true" assign_to=3D"1,2" /> </action> </recv> Variable 1 contains the entire Via....From matching regexp. Variable 2 contains only the expression in parenthesis. This is known as "sub-expressions" (see http://sipp.sourceforge.net/doc1.1/reference.html#action_regexp) Then, you re-use the content of variable [$2] when sending the BYE. Note that CRs are still there, so you will have to concatenate [$2] and the next line, like this: Via:[$2]Contact: <sip:[local_ip]:[local_port];transport=3D[transport]= > Content-Length: 0 Let us know if it works, Olivier. |