Hello,
On 28/03/2017 19:50, Yebe diomande Keffa wrote:
Hello
I am new with kamailio, and trying to add prefix to Request URI ($rU).
I use branch_route, for $rU=”prefix”+$rU, i got two time prefix
adding => prefix_prefix_original$rU
This is my code small code:
request_route {
if (is_method("INVITE")) {
$var(ip1)="51.254.245.58";
$var(port1)="33";
if(!t_is_set("branch_route")) route(FWD);
xlog("L_ALERT","Route FWD is executed
from ip:$si to ip:$rd \n");
}
exit;
}
route[FWD] {
t_on_branch("CHECK");
t_relay();
}
branch_route[CHECK] {
$rd=$var(ip1);
$rU=$var(port1)+$rU;
xlog("L_ALERT","dst rewrited: $rU \n");
}
LOG FILES :
Mar 28 19:34:45 ns3033789 systemd[1]: Started LSB: Start the Kamailio
SIP proxy server.
Mar 28 19:34:54 ns3033789 /usr/sbin/kamailio[2859]: ALERT: <script>:
dst rewrited: 3322508983432
Mar 28 19:34:54 ns3033789 /usr/sbin/kamailio[2859]: ALERT: <script>:
Route FWD is executed from ip:51.254.245.57 to ip:5.135.177.203
Mar 28 19:34:54 ns3033789 /usr/sbin/kamailio[2859]: ALERT: <script>:
dst rewrited: 333322508983432
Mar 28 19:34:54 ns3033789 /usr/sbin/kamailio[2859]: ALERT: <script>:
Route FWD is executed from ip:5.135.177.203 to ip:51.254.245.58
the INVITE is sent back to Kamailio, which executes again the routing
blocks and adds again the prefix. Look at your log messages, the second
one for Route FWD shows that source ip is the destination of the
previous log.
You have to update the r-uri domain in order to send to another IP address.
Cheers,
Daniel
--
Daniel-Constantin Mierla
www.twitter.com/miconda --
www.linkedin.com/in/miconda
Kamailio Advanced Training - May 22-24 (USA) -
www.asipto.com
Kamailio World Conference - May 8-10, 2017 -
www.kamailioworld.com