<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Hi Bogdan,<br>
Thanks for all the support, should I raise a bug report somewhere?<br>
<br>
<br>
Paul.<br>
<br>
Bogdan-Andrei Iancu wrote:
<blockquote cite="mid:4CA21002.8030802@voice-system.ro" type="cite">
<pre wrap="">Hi Paul,
Paul Smith wrote:
</pre>
<blockquote type="cite">
<pre wrap="">Hi Bogdan,
There is something else going on. I tried the match you suggested and
see the same result as previously in my log:
extracted character: 1 : #012Duration=160
In my substitution I am appending " : " to \2, and in my resulting
$avp(s:dtmf) I see the string is made up of \2 + " : " + \3. Why is \3
in there at all?
</pre>
</blockquote>
<pre wrap=""><!---->hmm....good question....it shouldn't be there....
</pre>
<blockquote type="cite">
<pre wrap="">Is this something to do with search across lines and the #015#012
characters.... Still confused.
Als0 [0-9] does not match * or # which are also passed as DTMF
Signals... but I'll work that out if I can get it extract a digit properly.
</pre>
</blockquote>
<pre wrap=""><!---->well, make it [\#\*0-9] to include the 2 chars also.... :)
Regards,
Bogdan
</pre>
<blockquote type="cite">
<pre wrap="">Regards,
Paul
Bogdan-Andrei Iancu wrote:
</pre>
<blockquote type="cite">
<pre wrap="">Hi Paul,
the subst is too permissive and the string to the end is matched by the
second token.
try:
avp_subst("$avp(s:msg)/$avp(s:dtmf)/g","/(^.*Signal=)([0-9]+)(.*$)/\2 : /");
Regards,
bogdan
Paul Smith wrote:
</pre>
<blockquote type="cite">
<pre wrap="">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
<a class="moz-txt-link-abbreviated" href="mailto:sip:600@192.168.4.129:5060;nat=yes">sip:600@192.168.4.129:5060;nat=yes</a> 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"
<a class="moz-txt-link-rfc2396E" href="mailto:sip:101@my.realm.com"><sip:101@my.realm.com></a>;tag=89sal3htwp#015#012To:
<a class="moz-txt-link-rfc2396E" href="mailto:sip:*600@my.realm.com"><sip:*600@my.realm.com></a>;tag=as01c3f123#015#012Call-ID:
3c2b6cf968d0-cxl5nzv16j4m#015#012CSeq: 3 INFO#015#012Max-Forwards:
69#015#012Contact:
<a class="moz-txt-link-rfc2396E" href="mailto:sip:101@y.y.y.y:56709"><sip:101@y.y.y.y:56709></a>;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 <a class="moz-txt-link-abbreviated" href="mailto:sip:600@192.168.4.129:5060;nat=yes">sip:600@192.168.4.129:5060;nat=yes</a>
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"
<a class="moz-txt-link-rfc2396E" href="mailto:sip:101@my.realm.com"><sip:101@my.realm.com></a>;tag=89sal3htwp#015#012To:
<a class="moz-txt-link-rfc2396E" href="mailto:sip:*600@my.realm.com"><sip:*600@my.realm.com></a>;tag=as01c3f123#015#012Call-ID:
3c2b6cf968d0-cxl5nzv16j4m#015#012CSeq: 3 INFO#015#012Max-Forwards:
69#015#012Contact:
<a class="moz-txt-link-rfc2396E" href="mailto:sip:101@y.y.y.y:56709"><sip:101@y.y.y.y:56709></a>;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 <a class="moz-txt-link-abbreviated" href="mailto:sip:600@192.168.4.129:5060;nat=yes">sip:600@192.168.4.129:5060;nat=yes</a> 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" <a class="moz-txt-link-rfc2396E" href="mailto:sip:101@my.realm.com"><sip:101@my.realm.com></a>;tag=6hud1tlbxx.
To: <a class="moz-txt-link-rfc2396E" href="mailto:sip:*600@my.realm.com"><sip:*600@my.realm.com></a>;tag=as0e050d3f.
Call-ID: 3c2b80578888-2z8ol0vc5860.
CSeq: 3 INFO.
Max-Forwards: 70.
Contact: <a class="moz-txt-link-rfc2396E" href="mailto:sip:101@y.y.y.y:57439"><sip:101@y.y.y.y:57439></a>;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" <a class="moz-txt-link-rfc2396E" href="mailto:sip:101@my.realm.com"><sip:101@my.realm.com></a>;tag=6hud1tlbxx.
To: <a class="moz-txt-link-rfc2396E" href="mailto:sip:*600@my.realm.com"><sip:*600@my.realm.com></a>;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
<a class="moz-txt-link-abbreviated" href="mailto:Users@lists.opensips.org">Users@lists.opensips.org</a>
<a class="moz-txt-link-freetext" href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a>
_______________________________________________
Users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Users@lists.opensips.org">Users@lists.opensips.org</a>
<a class="moz-txt-link-freetext" href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a>
</pre>
</blockquote>
<pre wrap="">
</pre>
</blockquote>
<pre wrap="">_______________________________________________
Users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Users@lists.opensips.org">Users@lists.opensips.org</a>
<a class="moz-txt-link-freetext" href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a>
</pre>
</blockquote>
<pre wrap=""><!---->
</pre>
</blockquote>
</body>
</html>