Hi

This seems to work for me, with SIPp 1.1rc6 (description below)
----------------------
  <recv request="INVITE" crlf="true">
    <action>
      <ereg regexp="([^,]*),([^,]*),([^,]*),([^,]*),([^,]*),([^,]*),([^,]*)" 
search_in="hdr" header="Record-Route: " assign_to="1,2,3,4,5,6,7,8"/>
    </action>
  </recv>

  <send retrans="500">
    <![CDATA[

      SIP/2.0 200 OK
      [last_Via:]
      [last_From:]
      [last_To:];tag=[call_number]
      [last_Call-ID:]
      [last_CSeq:]
      Record-Route: [$8]
      Record-Route: [$7]
      Record-Route: [$6]
      Record-Route: [$5]
      Record-Route: [$4]
      Record-Route: [$3]
      Record-Route: [$2]
      Contact: <sip:[local_ip]:[local_port];transport=[transport]>
      Content-Type: application/sdp
      Content-Length: [len]

      v=0
      o=user1 53655765 2353687637 IN IP[local_ip_type] [local_ip]
      s=-
      c=IN IP[media_ip_type] [media_ip]
      t=0 0
      m=audio [media_port] RTP/AVP 0
      a=rtpmap:0 PCMU/8000

    ]]>
  </send>
-------------------
When receiving INVITE, we split the Record-Route header into several 
subexpressions, using parentheses () and assign them to variables 
1,2,3,4,5,6,7,8.

Variable 1 gets the whole expression, because SIPp works this way, and we 
ignore it. Variables 2-8 get all the parts. Each part is [^,]* which means: 
any character other than comma, repeated any number of times.

Using record-route from your example:
<sip:10.106.5.219:5060;lr>;term,<sip:[EMAIL 
PROTECTED]:5060;lr>;term,<sip:[EMAIL PROTECTED]:5060;lr>...

variable 2 gets value: <sip:10.106.5.219:5060;lr>;term
variable 3: <sip:[EMAIL PROTECTED]:5060;lr>;term
etc.

Then we use the variables 2-8 in reverse order to construct the record-route 
in 200 OK (the expressions [$8] etc)

Note that we assume that your Record-Route always has 7 parts. It would be 
more complex (impossible?) to make a regular expression accepting any number 
of parts.

I've got this output, using this regular expression and the Record-route from 
your example:

Record-Route: <sip:10.106.5.219:5060;lr>;orig
Record-Route: <sip:[EMAIL PROTECTED]:5060;lr>
Record-Route: <sip:[EMAIL PROTECTED]:5060;lr>
Record-Route: <sip:[EMAIL PROTECTED]:5060;lr>;term
Record-Route: <sip:[EMAIL PROTECTED]:5060;lr>
Record-Route: <sip:[EMAIL PROTECTED]:5060;lr>;term
Record-Route: <sip:10.106.5.219:5060;lr>;term

I'm not sure if you want the words "Record-route" on each line, but you can 
simply remove them from the lines "Record-Route: [$8]" etc. Similarly you can 
add comma at the end of each line if you want it (as in your post).

Best regards
-- 
Tomasz Radziszewski
Senior Software Engineer
Ericpol Telecom sp. z o.o.
Madalinskiego 9, 30-303 Krakow, Poland
e-mail: [EMAIL PROTECTED]
tel: +48 (12) 295 48 16
mobile: +48 663 426 706
http://www.ericpol.pl/

> HI
>
> I am running a scenario where A calling user B and after media path is
> established. B is putting A on hold where c=0.0.0.0.
>
> I need to extract Record route from the Invite that was recieved from the
> Invite by B. This can be used by using Regexp. i have tried with diffrent
> combination.when i tried with a regexp that works in regexp calculator but
> its not working in the xml script because sipp parser is unable to parse
> the script.
>
> This is what i am getting in the Invite
>
> Record-Route: <sip:10.106.5.219:5060
> ;lr>;term,<sip:[EMAIL PROTECTED]:5060
> ;lr>;term,<sip:[EMAIL PROTECTED]:5060
> ;lr>,<sip:[EMAIL PROTECTED]:5060
> ;lr>;term,<sip:[EMAIL PROTECTED]:5060
> ;lr>,<sip:[EMAIL PROTECTED]:5060;lr>,<sip:10.106.5.219:5060
> ;lr>;orig
>
>  when i want to send in the invite it should get reversed and all the
> record route should be in diffrent line.
>
> <sip:10.106.5.219:5060;lr>;orig
> <sip:[EMAIL PROTECTED]:5060;lr>,
> <sip:[EMAIL PROTECTED]:5060;lr>,
> <sip:[EMAIL PROTECTED]:5060;lr>;term,
> <sip:[EMAIL PROTECTED]:5060;lr>,
> <sip:[EMAIL PROTECTED]:5060;lr>;term,
> <sip:10.106.5.219:5060;lr>;term,
>
>
> this is the format what i need to send in Invite because it is the format
> what the soft phone sends
>
> until i send in this format , this message is not getting routed and i am
> getting 500 error message "unable to process Invite"
>
> So need help regarding this!!!!!!!!!!!!
>
>
> Its very Urgent



-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
Sipp-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sipp-users

Reply via email to