[OpenSIPS-Users] Problem with prefix() during call forwarding

Andrew Pogrebennyk andrew.pogrebennyk at portaone.com
Thu Nov 12 16:35:46 CET 2009


Hi,
I'm trying to put together some configuration for unconditional call 
forwarding. The carrier requires me to send the call with prefix "400" 
in R-URI. Here are the relevant routes:

route[6]
{
         if(avp_db_load("$ru/username","$avp(s:callfwd)")) {
                 avp_pushto("$ru", "$avp(s:callfwd)");
                 xlog("L_INFO", "forwarded to: $avp(s:callfwd)");
                 avp_delete("$avp(s:callfwd)");
                 $avp(i:25) = 20;
         }
         route(7);
}

route[7]
{
	prefix("400");
	rewritehost("XX.YY.ZZ.WW");
	t_on_failure("2");
	xlog("L_INFO", "Request leaving server, D-URI='$du' - M=$rm RURI=$ru 
F=$fu T=$tu IP=$si ID=$ci\n");
	t_relay("XX.YY.ZZ.WW:5060");
	exit;
}

failure_route[2]
{
         # forward on busy
         if(t_check_status("(486)|(408)") && avp_pushto("$ru", 
"$avp(s:callfwd)")) {
                 append_branch();
                 xlog("forwarded on $T_reply_code to: $avp(s:callfwd)");
                 avp_pushto("$du", "$avp(s:callfwd)");
                 avp_delete("$avp(s:callfwd)");
                 $avp(i:25) = 20;
                 route(7);
         }
}

The problem is that while the call is sent to the first call forward 
destination correctly (with prefix 400 in R-URI), it goes to the next 
destination (triggered from failure_route) without the prefix in R-URI! 
There are the following messages in the log file:

Nov 12 21:12:00 sip2 /usr/local/sbin/openser[52971]: forwarded on 408
to: sip:89151793786 at XX.YY.ZZ.WW
Nov 12 21:12:00 sip2 /usr/local/sbin/openser[52971]:  1 avps were removed
Nov 12 21:12:00 sip2 /usr/local/sbin/openser[52971]:
DBG:core:pv_get_dsturi: no destination URI
Nov 12 21:12:00 sip2 /usr/local/sbin/openser[52971]: Request leaving
server, D-URI='<null>' - M=INVITE RURI=sip:40089151793786 at XX.YY.ZZ.WW
F=sip:84957978105 at XX.YY.ZZ.WW T=sip:4953801234 at AA.BB.CC.DD
IP=XX.YY.ZZ.WW ID=470BED43-CECE11DE-B158F4A9-DA974BBF at XX.YY.ZZ.WW


Despite R-URI appears with 400, it is sent without the prefix as I've 
confirmed by the trace.

That "no destination URI" line looked suspicious to me, in fact I would 
expect that prefix() handles destination URI as well. I thought that 
could be the case so I've added explicit "$du = $ru;" after prefix and 
rewritehost. D-URI looks fine now, but it is still sent on the wire 
without 400:

ov 12 21:59:29 sip2 /usr/local/sbin/openser[53183]: forwarded on 408 to: 
sip:89165438934 at XX.YY.ZZ.WW
Nov 12 21:59:29 sip2 /usr/local/sbin/openser[53183]: 
DBG:avpops:ops_pushto_avp: 1 avps were processed
Nov 12 21:59:29 sip2 /usr/local/sbin/openser[53183]:  1 avps were removed
Nov 12 21:59:29 sip2 /usr/local/sbin/openser[53183]: Request leaving 
server, D-URI='sip:40089165438934 at XX.YY.ZZ.WW' - M=INVITE 
RURI=sip:40089165438934 at XX.YY.ZZ.WW F=sip:84957978105 at XX.YY.ZZ.WW 
T=sip:4953801234 at AA.BB.CC.DD IP=XX.YY.ZZ.WW 
ID=E9C3FA8B-CED411DE-B59EF4A9-DA974BBF at XX.YY.ZZ.WW

What is the problem?

-- 
Sincerely,
Andrew Pogrebennyk



More information about the Users mailing list