[Kamailio-Users] rewritehostport

Alex Balashov abalashov at evaristesys.com
Wed May 27 16:13:31 CEST 2009


Andrew Nowrot wrote:
> Hi
> 
> I am having the following problem. Can I use avp variable and
> rewritehostport function in this way:
> 
> exec_avp("pool2domain.py $tU", "$avp(s:domainport)");
> rewritehostport("$avp(s:domainport)");
> 
> Script called from exec_avp returns the string sample.sip.domain:port
> and it is written to avp variable. Can I use this variable in
> rewritehospport function because kamailio does not rewrite the host
> and the port number
> 
> If  I can not use it in this way is there any other solution.

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);

Cheers,

-- Alex

-- 
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