[OpenSIPS-Users] Extract data from AVP
Mickael Hubert
mickael at winlux.fr
Wed Nov 27 11:10:08 EST 2019
Hi all,
I want to extract the channel ID from a line in SDP
(a=channel:d87c363c1b5b4f13 at speechrecog)
I can extract this line, but I don't know how can I have only the ID
(d87c363c1b5b4f13)
Do you have a way for me please ?
thanks in advance
SDP example:
***********
m=application 1544 TCP/MRCPv2 1
a=setup:passive
a=connection:new
a=channel:d87c363c1b5b4f13 at speechrecog
a=cmid:1
m=audio 5002 RTP/AVP 8 101
*************
My conf:
My result: "line in the SDP body is a=channel:d87c363c1b5b4f13 at speechrecog"
I want only: d87c363c1b5b4f13 in specific avp
onreply_route[reply_mrcp]
{
xlog("L_INFO","$avp(startlog) In REPLY ROUTE MRCP - fu : $fu , si : $si ,
rs: $rs\n");
if(has_body_part("application/sdp"))
{
if (search_body("m=application.*TCP\/MRCPv2")) {
if(search_body("a=channel:.*")) {
$var(i) = 0;
$var(whileflag) = 0;
while ($var(i) < 10 && $var(whileflag) != 1)
{
$avp(aline) = $(rb{sdp.line,a,$var(i)});
if($avp(aline)=~"a=channel")
{
xlog("line in the SDP body is $avp(aline)\n");
$var(whileflag) = 1;
}
$var(i) = $var(i) + 1;
}
xlog("var i = $var(i)\n");
}
}
}
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opensips.org/pipermail/users/attachments/20191127/37011116/attachment.html>
More information about the Users
mailing list