[OpenSIPS-Users] Extract value from SIP Content?
Paul Smith
Paul.Smith at ClarityTele.com
Tue Sep 28 14:42:36 CEST 2010
Sorry I replied to "Opensips Cluster thread"... obviously this is unrelated!
I have made a little more progress but the avp_subst is still not
behaving as I expect.
if I use the following code:
# look for "Signal=" and append following character to collected dtmfs
$avp(s:msg)=$rb;
avp_subst("$avp(s:msg)/$avp(s:dtmf)/g","/(^.*Signal=)(.)(.*$)/\2 : /");
xlog("Got an info packet with message buffer : $mb\n\n extracted
character: $avp(s:dtmf)");
I get:
extracted character: * : #012Duration=160
Why is mys avp(s:dtmf) still getting appended with "#012Duration=160" ?
I just want to get the matched character \2.
Thanks
paul
=======================================
original post:
Hi,
I am sure this is trivial... but I'm getting lost again.
I would like to extract and log a value from the Content of a SIP INFO
message... for example during a call I can send DTMF as SIP-INFO
messages, how can I extract the value of the key pressed from the
message? The relevant bit of the message if "1" is pressed I see a SIP
INFO with content including "Signal=1."
I tried:
$avp(s:msg)=$mb;
avp_subst("$avp(s:msg)/$avp(s:dtmf)/g","/(^.*Signal)(=.)(.*$)/\2/g");
xlog("Got an info packet with message buffer : $mb\n\n extracted
character: $avp(s:dtmf)");
and that yielded:
Got an info packet with message buffer : INFO
sip:600 at 192.168.4.129:5060;nat=yes SIP/2.0#015#012Via: SIP/2.0/UDP
y.y.y.y:56709;branch=z9hG4bK-mpz3k73e2wsm;rport#015#012Route:
<sip:x.x.x.x;r2=on;lr=on;did=1db.36f29f36>#015#012Route:
<sip:212.108.76.52;r2=on;lr=on;did=1db.36f29f36>#015#012From: "101"
<sip:101 at my.realm.com>;tag=89sal3htwp#015#012To:
<sip:*600 at my.realm.com>;tag=as01c3f123#015#012Call-ID:
3c2b6cf968d0-cxl5nzv16j4m#015#012CSeq: 3 INFO#015#012Max-Forwards:
69#015#012Contact:
<sip:101 at y.y.y.y:56709>;reg-id=1#015#012User-Agent:
snom360/7.3.30#015#012Content-Type:
application/dtmf-relay#015#012Content-Length:
22#015#012#015#012Signal=7#015#012Duration=160#012#012
extracted character: INFO sip:600 at 192.168.4.129:5060;nat=yes
SIP/2.0#015#012Via: SIP/2.0/UDP
y.y.y.y:56709;branch=z9hG4bK-mpz3k73e2wsm;rport#015#012Route:
<sip:x.x.x.x;r2=on;lr=on;did=1db.36f29f36>#015#012Route:
<sip:212.108.76.52;r2=on;lr=on;did=1db.36f29f36>#015#012From: "101"
<sip:101 at my.realm.com>;tag=89sal3htwp#015#012To:
<sip:*600 at my.realm.com>;tag=as01c3f123#015#012Call-ID:
3c2b6cf968d0-cxl5nzv16j4m#015#012CSeq: 3 INFO#015#012Max-Forwards:
69#015#012Contact:
<sip:101 at y.y.y.y:56709>;reg-id=1#015#012User-Agent:
snom360/7.3.30#015#012Content-Type:
application/dtmf-relay#015#012Content-Length:
22#015#012#015#012=7#012Duration=160
The ngrep of a SIP INFO for a DTMF tone looks like:
U y.y.y.y:54762 -> x.x.x.x:5060
INFO sip:600 at 192.168.4.129:5060;nat=yes SIP/2.0.
Via: SIP/2.0/UDP y.y.y.y:57439;branch=z9hG4bK-v8mow8y2kfhc;rport.
Route: <sip:x.x.x.x;r2=on;lr=on;did=2f.eef579c3>.
Route: <sip:212.108.76.52;r2=on;lr=on;did=2f.eef579c3>.
From: "101" <sip:101 at my.realm.com>;tag=6hud1tlbxx.
To: <sip:*600 at my.realm.com>;tag=as0e050d3f.
Call-ID: 3c2b80578888-2z8ol0vc5860.
CSeq: 3 INFO.
Max-Forwards: 70.
Contact: <sip:101 at y.y.y.y:57439>;reg-id=1.
User-Agent: snom360/7.3.30.
Content-Type: application/dtmf-relay.
Content-Length: 22.
.
Signal=1.
Duration=160
#
U x.x.x.x:5060 -> y.y.y.y:54762
SIP/2.0 200 OK.
Via: SIP/2.0/UDP
y.y.y.y:57439;received=y.y.y.y;branch=z9hG4bK-v8mow8y2kfhc;rport=54762.
From: "101" <sip:101 at my.realm.com>;tag=6hud1tlbxx.
To: <sip:*600 at my.realm.com>;tag=as0e050d3f.
Call-ID: 3c2b80578888-2z8ol0vc5860.
CSeq: 3 INFO.
Server: Asterisk PBX 1.6.2.9.
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO.
Supported: replaces, timer.
Content-Length: 0.
.
_______________________________________________
Users mailing list
Users at lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
More information about the Users
mailing list