[OpenSIPS-Users] Problem with double field P-Asserted-Identity

mmarzuola at interfree.it mmarzuola at interfree.it
Mon Apr 6 12:17:47 CEST 2009


Hi all. In my scenario I try to use dynamic routing and I have a problem with the P-Asserted Identity field. When the proxy tries to send the INVITE to the first gateway selected from DRouting module by the function do_routing, there is only one PAI field, but if that gateway is down, at the second attempt to next gateway, the INVITE contains two PAI fields identicals.

This is a piece of code:

########################################################################
# Request route 'base-outbound'
########################################################################
route[2] {
	if(is_present_hf("P-Asserted-Identity")) {
		remove_hf("P-Asserted-Identity");
	}
	if(is_present_hf("Remote-Party-ID")) {
		remove_hf("Remote-Party-ID");
	}
	if(is_avp_set("$avp(s:caller_cli)/s")) {
		if(!isflagset(28)) {
			xlog("L_INFO", "Set caller CLI '$avp(s:caller_cli)' - M=$rm RURI=$ru F=$fu T=$tu IP=$si ID=$ci\n");
			append_hf("P-Asserted-Identity: <$avp(s:caller_cli)>\r\n");
		}
	}
	
	route(14);
	
	t_on_reply("1");
	
	if(!isflagset(21)) {
		t_on_failure("1");	
	}
	if(is_present_hf("Proxy-Authorization")) {
		consume_credentials();
	}
	
	xlog("L_INFO", "Request leaving server, D-URI='$du' - M=$rm RURI=$ru F=$fu T=$tu IP=$si ID=$ci\n");

	if(!t_relay()) {
		sl_reply_error();
	}
	exit;	
}

########################################################################
# Request route 'invite-to-external'
########################################################################
route[6] {
	if(isflagset(20)) {
		xlog("L_INFO", "Call to foreign domain - M=$rm RURI=$ru F=$fu T=$tu IP=$si ID=$ci\n");
		route(2);
		exit;
	}
	if(!isflagset(23)) {
		# don't allow calls relaying from PSTN to PSTN, if not explicitely forwarded
		if(uri=~ "^sip:[0-9]+@") {
			xlog("L_INFO", "Call to PSTN\n");
                	do_routing();
			xlog("L_INFO", "first attempt is $ru, attributes are $avp(s:drattrs)\n");
			if(!goes_to_gw()) {
				xlog("L_ERR", "No PSTN gateways available - M=$rm RURI=$ru F=$fu T=$tu IP=$si ID=$ci\n");
				sl_send_reply("503", "PSTN Termination Currently Unavailable");
				exit;
			}
			setflag(21);
			t_on_failure("2");
			route(2);
			exit;	
		}
	}
	
	xlog("L_INFO", "Call to unknown user - M=$rm RURI=$ru F=$fu T=$tu IP=$si ID=$ci\n");
	sl_send_reply("404", "User Not Found");
	exit;	
}

########################################################################
# Failure route 'pstn-failover'
########################################################################
failure_route[2] {
	xlog("L_INFO", "Failure route for PSTN entered - M=$rm RURI=$ru F=$fu T=$tu IP=$si ID=$ci\n");
	route(9);

	if(!use_next_gw()) {
		xlog("L_ERR", "Failed to select next PSTN gateway - M=$rm RURI=$ru F=$fu T=$tu IP=$si ID=$ci\n");
		exit;
	}
	xlog("L_INFO", "selected next gateway $ru, attributes are $avp(s:drattrs)\n");
	t_on_failure("2");
	route(2);
}


These are the INVITEs:

U 10.10.45.172:5060 -> 10.10.45.86:5060
INVITE sip:22230489 at 10.10.45.86 SIP/2.0.
Record-Route: <sip:10.10.45.172;lr=on;ftag=2061433461944847689>.
Via: SIP/2.0/UDP 10.10.45.172;branch=z9hG4bK8586.95959e37.0.
Via: SIP/2.0/UDP 10.10.45.102:1025;received=10.10.45.102;rport=1025;branch=z9hG4bK0a0a2d660000001549d9d2ae0ccb24110000004a.
Content-Length: 366.
Contact: <sip:1000 at 10.10.45.102:1025>.
Call-ID: B998BB4A-1DD1-11B2-8CD3-D001388A831D at 10.10.45.102.
Content-Type: application/sdp.
CSeq: 2 INVITE.
From: "Sjphone laptop_User"<sip:1000 at 10.10.45.172>;tag=2061433461944847689.
Max-Forwards: 69.
To: <sip:30489 at 10.10.45.172>.
User-Agent: SJphone/1.60.299a/L (SJ Labs).
P-Asserted-Identity: <sip:003930948 at 10.10.45.172>.
.
v=0.
o=- 3448000814 3448000814 IN IP4 10.10.45.102.
s=SJphone.
c=IN IP4 10.10.45.102.
t=0 0.
a=direction:active.
m=audio 49154 RTP/AVP 3 97 98 110 8 0 101.
a=rtpmap:3 GSM/8000.
a=rtpmap:97 iLBC/8000.
a=rtpmap:98 iLBC/8000.
a=fmtp:98 mode=20.
a=rtpmap:110 speex/8000.
a=rtpmap:8 PCMA/8000.
a=rtpmap:0 PCMU/8000.
a=rtpmap:101 telephone-event/8000.
a=fmtp:101 0-11,16.


U 10.10.45.172:5060 -> 10.10.45.227:5060
INVITE sip:22230489 at 10.10.45.227 SIP/2.0.
Record-Route: <sip:10.10.45.172;lr=on;ftag=2061433461944847689>.
Via: SIP/2.0/UDP 10.10.45.172;branch=z9hG4bK8586.95959e37.1.
Via: SIP/2.0/UDP 10.10.45.102:1025;received=10.10.45.102;rport=1025;branch=z9hG4bK0a0a2d660000001549d9d2ae0ccb24110000004a.
Content-Length: 366.
Contact: <sip:1000 at 10.10.45.102:1025>.
Call-ID: B998BB4A-1DD1-11B2-8CD3-D001388A831D at 10.10.45.102.
Content-Type: application/sdp.
CSeq: 2 INVITE.
From: "Sjphone laptop_User"<sip:1000 at 10.10.45.172>;tag=2061433461944847689.
Max-Forwards: 69.
To: <sip:30489 at 10.10.45.172>.
User-Agent: SJphone/1.60.299a/L (SJ Labs).
P-Asserted-Identity: <sip:003930948 at 10.10.45.172>.
P-Asserted-Identity: <sip:003930948 at 10.10.45.172>.
.
v=0.
o=- 3448000814 3448000814 IN IP4 10.10.45.102.
s=SJphone.
c=IN IP4 10.10.45.102.
t=0 0.
a=direction:active.
m=audio 49154 RTP/AVP 3 97 98 110 8 0 101.
a=rtpmap:3 GSM/8000.
a=rtpmap:97 iLBC/8000.
a=rtpmap:98 iLBC/8000.
a=fmtp:98 mode=20.
a=rtpmap:110 speex/8000.
a=rtpmap:8 PCMA/8000.
a=rtpmap:0 PCMU/8000.
a=rtpmap:101 telephone-event/8000.
a=fmtp:101 0-11,16.

Thanks in advance.

Matteo Marzuola


----------------------------------------------------------------------------
Vuoi essere presente online? 
Vuoi dare voce alla tua attivita`? 
Acquista un dominio su domini.interfree.it.
A partire da 18,59 euro
----------------------------------------------------------------------------




More information about the Users mailing list