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.
Cheers Andrew
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
2009/5/27 Alex Balashov abalashov@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);
On 05/27/2009 05:20 PM, Iñaki Baz Castillo wrote:
2009/5/27 Alex Balashov abalashov@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);
or
pv_printf("$ru", "sip:$rU@$avp(s:domain):$avp(s:port)");
Cheers, Daniel
Iñaki Baz Castillo wrote:
2009/5/27 Alex Balashov abalashov@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...
On 05/27/2009 05:30 PM, Alex Balashov wrote:
Iñaki Baz Castillo wrote:
2009/5/27 Alex Balashov abalashov@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.
the PV cookbook should if (hopefully is updated) the variable is R/W: http://www.kamailio.org/dokuwiki/doku.php/pseudovariables:devel
For example: http://www.kamailio.org/dokuwiki/doku.php/pseudovariables:devel#sip_request_...
Cheers, Daniel
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...