[Kamailio-Users] rewritehostport

Alex Balashov abalashov at evaristesys.com
Wed May 27 16:30:23 CEST 2009


Iñaki Baz Castillo wrote:

> 2009/5/27 Alex Balashov <abalashov at evaristesys.com>:
>> Some functions accept PV arguments, some don't.
>>
>> The other approach is to rebuild the URI ($ru - it's a mutable
>> pseudovariable) manually.  That is to say:
>>
>>    rewritehostport("$avp(s:domain):$avp(s:port)");
>>
>>    (if it worked)
>>
>> is equivalent to:
>>
>>    $ru = "sip:" + $rU + "@" + $avp(s:domain) + ":" + $avp(s:port);
> 
> Easier (IMHO):
> 
>   $rd = $avp(s:domain);
>   $rp = $avp(s:port);

Oh - I did not realise the components of $ru (except $rU) are mutable 
just as $ru is.  I figured they only exposed parsed components of the 
RURI for reading, but it is necessary to change the whole RURI mutator 
for writing.

I guess that makes sense...

-- 
Alex Balashov
Evariste Systems
Web    : http://www.evaristesys.com/
Tel    : (+1) (678) 954-0670
Direct : (+1) (678) 954-0671
Mobile : (+1) (678) 237-1775




More information about the sr-users mailing list