[SR-Users] Regex Transformations

Brandon Armstead brandon at cryy.com
Thu Jul 22 22:15:06 CEST 2010


Hello,

    To further add more verbose information -- syslog reports back "no
match" for the assignment followed by no right expression and thus its an
error.  While as the xlog "matches" and prints as it should.  (Same exact
transformation code / regex is used lines and no other mangling is
occurring).  Debugging code is Line by Line.  Thanks!

Sincerely,
Brandon Armstead

On Thu, Jul 22, 2010 at 3:08 PM, Brandon Armstead <brandon at cryy.com> wrote:

> Daniel,
>
>    Too True! haha.
>
> While I've got this topic still open, I am actually having a total freak
> experience going on right now.
>
> I have the following:
>
> xlog("L_INFO", "[$ci] codec / payloads available
> $(rb{re.subst,/^(.*)m=audio ([0-9]+) RTP\/AVP ([0-9
> ]+)\015\012(.*)$/\3/s})");
>
> Which shows the log correctly and parses out / matches the codecs, i.e (log
> result): [YTFkZjJmNmI3ZWQwZGVlOGQ4MThjNmE0Y2JjODA5ZTU.] codec / payloads
> available 107 0 8 18 101
>
> However... when I assign this to a variable like so:
>
> $avp(s:sdp-payloads) = $(rb{re.subst,/^(.*)m=audio ([0-9]+) RTP\/AVP ([0-9
> ]+)\015\012(.*)$/\3/s});
>
> $avp(s:sdp-payloads) is NULL when printing it out?
>
> Any thoughts?
>
> Sincerely,
> Brandon Armstead
>
>
> On Thu, Jul 22, 2010 at 2:53 PM, Daniel-Constantin Mierla <
> miconda at gmail.com> wrote:
>
>>  Hello,
>>
>>
>> On 7/22/10 8:59 PM, Brandon Armstead wrote:
>>
>> Hello,
>>
>>     Sorry it took me so long to respond back..
>>
>>
>> not a problem, I am one that really knows about unavailability due to
>> traveling or other things. Also, many times it happens that obvious things
>> are "invisible".
>>
>> Cheers,
>> Daniel
>>
>>
>>   I am shocked that I did not find/see that.  That was exactly my issue.
>> :embarrassed:.
>>
>> Thank you!
>>
>> Sincerely,
>> Brandon Armstead
>>
>> On Fri, Jul 16, 2010 at 5:26 AM, Daniel-Constantin Mierla <
>> miconda at gmail.com> wrote:
>>
>>> Hello,
>>>
>>> the line you try to match is:
>>>
>>>
>>> m=audio 64192 RTP/AVP 107 0 8 18 101
>>>
>>>  However, the subst does not have rule to match 'RTP/AVP' string:
>>>
>>>
>>> {re.subst,/^(.*)m=audio ([0-9]+) ([0-9 ]+)\015\012(.*)$/\3/s}
>>>
>>>  It is looking for digits and white spaces after m=audio.
>>>
>>> Cheers,
>>> Daniel
>>>
>>>
>>> On 7/5/10 7:38 PM, Brandon Armstead wrote:
>>>
>>> Hello,
>>>
>>>     An example $rb body would be:
>>>
>>> v=0#015#012o=- 5 2 IN IP4 192.168.3.100#015#012s=
>>> CounterPath Bria#015#012c=IN IP4 174.37.XX.XXX#015#012t=0
>>> 0#015#012m=audio 64192 RTP/AVP 107 0 8 18
>>> 101#015#012a=sendrecv#015#012a=rtpmap:107 BV32/16000#015#012a=rtpmap:18
>>> G729/8000#015#012a=fmtp:18 annexb=yes#015#012a=rtpmap:101
>>> telephone-event/8000#015#012a=fmtp:101 0-15#015#012a=nortpproxy:yes#015
>>>
>>> or ngrep version:
>>>
>>> v=0.
>>> o=- 5 2 IN IP4 192.168.3.100.
>>> s=CounterPath Bria.
>>> c=IN IP4 174.37.XX.XXX.
>>> t=0 0.
>>> m=audio 64192 RTP/AVP 107 0 8 18 101.
>>> a=sendrecv.
>>> a=rtpmap:107 BV32/16000.
>>> a=rtpmap:18 G729/8000.
>>> a=fmtp:18 annexb=yes.
>>> a=rtpmap:101 telephone-event/8000.
>>> a=fmtp:101 0-15.
>>> a=nortpproxy:yes.
>>>
>>> Thanks!
>>>
>>>
>>> On Mon, Jul 5, 2010 at 3:51 AM, Daniel-Constantin Mierla <
>>> miconda at gmail.com> wrote:
>>>
>>>> Hello,
>>>>
>>>>
>>>> On 7/4/10 9:23 AM, Brandon Armstead wrote:
>>>>
>>>> Hello,
>>>>
>>>>     I am trying to match a multi-line psuedo variable, i.e. $rb
>>>>
>>>> However I am wishing to pull out the payload values
>>>>
>>>> i.e.
>>>>
>>>> "0 18 101"
>>>>
>>>> "18 101"
>>>>
>>>> etc.. etc...
>>>>
>>>> I am having trouble matching this.  Any help would be appreciated.
>>>>
>>>> One part that is giving me trouble is that it seems xlog prints out \r\n
>>>> as \015\012
>>>>
>>>>  do you print xlogs to syslog or to terminal?
>>>>
>>>>
>>>>
>>>> I am not able to successfully just pull out the "payloads"
>>>>
>>>> I have tried many different variations, however here is one of my
>>>> latest:
>>>>
>>>> xlog("L_INFO", "[$ci] $(rb{re.subst,/^(.*)m=audio ([0-9]+) ([0-9
>>>> ]+)\015\012(.*)$/\3/s})");
>>>>
>>>>
>>>>  Can you paste the body you worked on and the output you got? Will help
>>>> understanding what happens and maybe give some hits, being easy to reproduce
>>>> and test ourselves.
>>>>
>>>> Cheers,
>>>> Daniel
>>>>
>>>>
>>>> Any help / input is greatly appreciated, thank you ahead of time!
>>>>
>>>> Happy 4th of July (for those who celebrate)
>>>>
>>>> Sincerely,
>>>> Brandon Armstead
>>>>
>>>>
>>>> _______________________________________________
>>>> SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing listsr-users at lists.sip-router.orghttp://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
>>>>
>>>>
>>>> --
>>>> Daniel-Constantin Mierlahttp://www.asipto.com/
>>>>
>>>>
>>>
>>> _______________________________________________
>>> SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing listsr-users at lists.sip-router.orghttp://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
>>>
>>>
>>> --
>>> Daniel-Constantin Mierlahttp://www.asipto.com/
>>>
>>>
>>
>> _______________________________________________
>> SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing listsr-users at lists.sip-router.orghttp://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
>>
>>
>> --
>> Daniel-Constantin Mierlahttp://www.asipto.com/
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sip-router.org/pipermail/sr-users/attachments/20100722/72869367/attachment.htm>


More information about the sr-users mailing list