[Kamailio-Users] get sdp audio port in a script variable

Daniel-Constantin Mierla miconda at gmail.com
Fri Apr 17 12:04:33 CEST 2009


Hello,


On 04/17/2009 09:03 AM, antonroman wrote:
> Thanks Daniel, 
>  
>   
>> On 04/15/2009 06:01 PM, antonroman wrote:
>>     
>>> Hi all,
>>>
>>> I need to get the INVITE sdp audio port in a script variable to be used
>>> in
>>> an external command.
>>> Is this possible without modifying the source code? I think it can't be
>>> done
>>> with the TEXTOP module, can be?
>>>   
>>>       
>> yes, you can use re.subst transformation to get it:
>> http://www.kamailio.org/dokuwiki/doku.php/transformations:1.5.x#re.subst_expression
>>     
>
> I managed to extract the port value. First I had to remove all cr and nl
> characters from the original content of $rb by using the re.subst
> transformation as many times as lines there are in the sdp, I don't know if
> this can be done in a smarter way with the existing transformations, anyway,
> it works. 
>   
IIRC, you can give flags to subst so the replacement is done globally, 
not only per each line.

You can add your config snippet at:
http://www.kamailio.org/dokuwiki/doku.php/cfg-scripts-bank:main-index

Others can benefit/improve.

Cheers,
Daniel


-- 
Daniel-Constantin Mierla
http://www.asipto.com/





More information about the sr-users mailing list