You need to have parenthesis to capture just the part after the comma.
Something like.
ereg regexp=,(foo) assign_to=dummy,foovalue /
Charles
Pratap Nath pratapn...@gmail.com
02/02/2009 08:43 AM
To
sipp-users@lists.sourceforge.net
cc
Subject
[Sipp-users] How to extract the second the second string from the VIA:
header
HI All,
I was simulating a conference scenario with Sipp. The Switch sends me a
update message with following Information.
UPDATE sip:5...@148.147.171.54:64478;transport=tcp SIP/2.0
Call-ID: 15_374cb53-41c226674cf7e31...@148.147.171.54
CSeq: 2 UPDATE
From: sip:5...@avaya.com;tag=8038c7bbbebdd17a3497b5ad100
To: sip:5...@avaya.com;tag=-2cee5336498317ae-c_F148.147.171.54
Via: SIP/2.0/TCP
148.147.171.28:5060;branch=z9hG4bK83138303530393F5334001b.0,SIP/2.0/TLS
148.147.171.28:6001;psrrposn=1;received=148.147.171.28;branch=z9hG4bK809229ebbebdd1893497b5ad100
Content-Length: 0
Contact: CONFERENCE 2 sip:148.147.171.28:6001;transport=tls;isfocus
Max-Forwards: 69
User-Agent: Avaya CM/R015x.01.2.416.4
Allow:
INVITE,CANCEL,BYE,ACK,PRACK,SUBSCRIBE,NOTIFY,REFER,OPTIONS,INFO,PUBLISH
Supported: 100rel,timer,replaces,join,histinfo
Min-SE: 180
Session-Expires: 180;refresher=uac
Record-Route: sip:148.147.171.28:5060;transport=tcp;lr
Correct response .
SIP/2.0 200 OK
From: sip:5...@avaya.com;tag=8038c7bbbebdd17a3497b5ad100
To: sip:5...@avaya.com;tag=-2cee5336498317ae-c_F148.147.171.54
Call-ID: 15_374cb53-41c226674cf7e31...@148.147.171.54
CSeq: 2 UPDATE
Via: sip/2.0/tcp
148.147.171.28:5060;branch=z9hG4bK83138303530393F5334001b.0
Via: SIP/2.0/TLS
148.147.171.28:6001;psrrposn=1;received=148.147.171.28;branch=z9hG4bK809229ebbebdd1893497b5ad100
Record-Route: sip:148.147.171.28:5060;transport=tcp;lr
User-Agent: Avaya one-X Deskphone
Content-Length: 0
As Sipp is receiving the UPDATE successfully but While sending the 200OK
for UPDATE the SES does not process the 200OK as it wants that the 200OK
which sipp sends should contains
two separate via headers .
In my case i send 200OK which contains the following dump
SIP/2.0 200 OK
From: sip:5...@avaya.com;tag=8038c7bbbebdd17a3497b5ad100
To: sip:5...@avaya.com;tag=-2cee5336498317ae-c_F148.147.171.54
Call-ID: 15_374cb53-41c226674cf7e31...@148.147.171.54
CSeq: 2 UPDATE
Via: sip/2.0/tcp
148.147.171.28:5060;branch=z9hG4bK83138303530393F5334001b.0,SIP/2.0/TLS
148.147.171.28:6001;psrrposn=1;received=148.147.171.28;branch=z9hG4bK809229ebbebdd1893497b5ad100
Record-Route: sip:148.147.171.28:5060;transport=tcp;lr
User-Agent: Avaya one-X Deskphone
Content-Length: 0
My final approach which i used to send was followed the regular expression
path .
I have used two regular expression commands to separate two strings from
the Via : header
The Regular expression
=
1. ereg regexp= .[^,]+ search_in=hdr header=Via: assign_to =2/
2. ereg regexp=\,([A-Z]{3}/2\.[0-9]/[A-Z]{3}) search_in=hdr
header=Via: assign_to =3/
the variable $2 gets sip/2.0/tcp
148.147.171.28:5060;branch=z9hG4bK83138303530393F5334001b.0
and the variable $3 gets ,SIP/2.0/TLS
148.147.171.28:6001;psrrposn=1;received=148.147.171.28;branch=z9hG4bK809229ebbebdd1893497b5ad100
The problem is i was unable to erase the , (comma) from the string
which is stored in the $3 .
the sample of 200OK is shown below after applying the regular expression :
SIP/2.0 200 OK
From: sip:5...@avaya.com;tag=8038c7bbbebdd17a3497b5ad100
To: sip:5...@avaya.com;tag=-2cee5336498317ae-c_F148.147.171.54
Call-ID: 15_374cb53-41c226674cf7e31...@148.147.171.54
CSeq: 2 UPDATE
Via: sip/2.0/tcp
148.147.171.28:5060;branch=z9hG4bK83138303530393F5334001b.0
Via: ,SIP/2.0/TLS
Via:148.147.171.28:6001;psrrposn=1;received=148.147.171.28;branch=z9hG4bK809229ebbebdd1893497b5ad100
Record-Route: sip:148.147.171.28:5060;transport=tcp;lr
User-Agent: Avaya one-X Deskphone
Content-Length: 0
If somebody has any idea how to get the second string without , .
Please advice .
Thanks
Pratap Nath
--
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
___
Sipp-users mailing list
Sipp-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sipp-users
--
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
___
Sipp-users mailing list
Sipp-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sipp-users