[SR-Users] Kamailio Transformation Assignment to an AVP
Daniel-Constantin Mierla
miconda at gmail.com
Thu Jul 29 10:32:41 CEST 2010
Hello,
On 7/28/10 5:32 PM, Brandon Armstead wrote:
> Daniel,
>
> When I take your example with the modified regex it works. I
> wonder if there is any association to using / as delimiter versus |
> and the () match references?
hmm, might the / versus | in the way that you may need to use \\/ to
escape it -- just try and let me know if solves something. I used |
because I try to avoid escaping inside subst expressions and it works to
use any character you want (same like in sed tool - the character used
on first position is considered delimiter and has to be escaped when is
not).
Cheers,
Daniel
>
> Sincerely,
> Brandon Armstead
>
> On Wed, Jul 28, 2010 at 3:23 AM, Daniel-Constantin Mierla
> <miconda at gmail.com <mailto:miconda at gmail.com>> wrote:
>
> Hello,
>
> I tested with:
>
> xlog("===============================+++: [$rb]\n");
> $var(b) = $rb;
> $var(c) = $(rb{re.subst,|.*m=audio [0-9]+ RTP/AVP ([0-9
> ]+).+|\1|s});
> # $var(c) = $(var(b){re.subst,|.*m=audio [0-9]+ RTP/AVP ([0-9
> ]+).+|\1|s});
> xlog("===============================+++: [$rb]\n");
> xlog("==================================: [$var(c)]\n");
>
> and everything looked fine. Could be something specific for your
> config or environment, what is content-length of your invite?
>
> Cheers,
> Daniel
>
>
>
> On 7/27/10 9:44 PM, brandon at cryy.com <mailto:brandon at cryy.com> wrote:
>> Daniel,
>>
>> I've also tried with script vars. I think it has something to do
>> with the actual dynamic psuedo variable $rb. Var assignment and
>> mangling does not work for me either. I.e. Keep everything the
>> same except $var(test) = $rb and so on. Let me know if this makes
>> sense.
>>
>> Sincerely,
>> Brandon Armstead
>>
>> *Forgot to reply to ALL (resending)
>>
>> Sent from my Verizon Wireless BlackBerry
>>
>> ------------------------------------------------------------------------
>> *From: * Daniel-Constantin Mierla <miconda at gmail.com>
>> <mailto:miconda at gmail.com>
>> *Date: *Tue, 27 Jul 2010 11:50:36 +0200
>> *To: *Brandon Armstead<brandon at cryy.com> <mailto:brandon at cryy.com>
>> *Cc: *<users at lists.kamailio.org>
>> <mailto:users at lists.kamailio.org>; <devel at lists.kamailio.org>
>> <mailto:devel at lists.kamailio.org>
>> *Subject: *Re: [SR-Users] Kamailio Transformation Assignment to
>> an AVP
>>
>> Hello,
>>
>> interesting, when I troubleshooted before your previous report, I
>> used this piece of cfg:
>>
>> xlog("==================================\n");
>> $var(b) =
>> "v=0\r\n"
>> "o=- 5 2 IN IP4 192.168.3.100\r\n"
>> "s=CounterPath Bria\r\n"
>> "c=IN IP4 174.37.XX.XXX\r\n"
>> "t=0 0\r\n"
>> "m=audio 64192 RTP/AVP 107 0 8 18 101\r\n"
>> "a=sendrecv\r\n"
>> "a=rtpmap:107 BV32/16000\r\n"
>> "a=rtpmap:18 G729/8000\r\n"
>> "a=fmtp:18 annexb=yes\r\n"
>> "a=rtpmap:101 telephone-event/8000\r\n"
>> "a=fmtp:101 0-15\r\n"
>> "a=nortpproxy:yes\r\n";
>>
>> $var(c) = $(var(b){re.subst,|.*m=audio [0-9]+ RTP/AVP ([0-9
>> ]+).+|\1|s});
>> xlog("==================================: [$var(c)]\n");
>>
>> And the xlog printed properly the value of $var(c) - meaning that
>> it was assigned the right value. I will test with avps next time
>> I have a chance.
>>
>> Cheers,
>> Daniel
>>
>>
>> On 7/26/10 9:11 PM, Brandon Armstead wrote:
>>> Hello,
>>>
>>> I have the following transformation on the SDP Body:
>>>
>>> $(rb{re.subst,/^(.*)m=audio ([0-9]+) RTP\/AVP ([0-9
>>> ]+)\015\012(.*)$/\3/s})
>>>
>>> However when I assign this to an AVP, i.e.
>>>
>>> $avp(s:sdp-payloads) = $(rb{re.subst,/^(.*)m=audio ([0-9]+)
>>> RTP\/AVP ([0-9 ]+)\015\012(.*)$/\3/s});
>>>
>>> I receive back a NULL result / transformation "regex does not
>>> match" is what I receive with high verbose syslog on kamailio.
>>>
>>> HOWEVER.
>>>
>>> When I do something like this:
>>>
>>> xlog("L_INFO", "Payloads Available: $(rb{re.subst,/^(.*)m=audio
>>> ([0-9]+) RTP\/AVP ([0-9 ]+)\015\012(.*)$/\3/s})");
>>>
>>> It executes properly -- transformation regex matches and the
>>> payloads are displayed as expected.
>>>
>>> If anyone can provide any insight as to what I may be doing
>>> wrong it would be greatly appreciated.
>>>
>>> P.S. Kamailio SVN Revision # 2:5906M (1.5.2-notls).
>>>
>>> Also I CC'ed devel list (as I do believe this may be a bug).
>>>
>>> Thanks!
>>>
>>> Sincerely,
>>> Brandon Armstead
>>>
>>>
>>> _______________________________________________
>>> SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
>>> sr-users at lists.sip-router.org <mailto:sr-users at lists.sip-router.org>
>>> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
>>>
>>
>> --
>> Daniel-Constantin Mierla
>> http://www.asipto.com/
>>
>>
>>
>> _______________________________________________
>> SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
>> sr-users at lists.sip-router.org <mailto:sr-users at lists.sip-router.org>
>> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
>>
>
> --
> Daniel-Constantin Mierla
> http://www.asipto.com/
>
>
>
--
Daniel-Constantin Mierla
http://www.asipto.com/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sip-router.org/pipermail/sr-users/attachments/20100729/ad43df7f/attachment.htm>
More information about the sr-users
mailing list