Problem with double field P-Asserted-Identity

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Problem with double field P-Asserted-Identity

mmarzuola

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@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@10.10.45.102:1025>.
Call-ID: B998BB4A-1DD1-11B2-8CD3-D001388A831D@10.10.45.102.
Content-Type: application/sdp.
CSeq: 2 INVITE.
From: "Sjphone laptop_User"<sip:1000@10.10.45.172>;tag=2061433461944847689.
Max-Forwards: 69.
To: <sip:30489@10.10.45.172>.
User-Agent: SJphone/1.60.299a/L (SJ Labs).
P-Asserted-Identity: <sip:003930948@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@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@10.10.45.102:1025>.
Call-ID: B998BB4A-1DD1-11B2-8CD3-D001388A831D@10.10.45.102.
Content-Type: application/sdp.
CSeq: 2 INVITE.
From: "Sjphone laptop_User"<sip:1000@10.10.45.172>;tag=2061433461944847689.
Max-Forwards: 69.
To: <sip:30489@10.10.45.172>.
User-Agent: SJphone/1.60.299a/L (SJ Labs).
P-Asserted-Identity: <sip:003930948@10.10.45.172>.
P-Asserted-Identity: <sip:003930948@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
----------------------------------------------------------------------------


_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: Problem with double field P-Asserted-Identity

Bogdan-Andrei Iancu
Hi Matteo,

Whatever change you in request_route will propagate in all branches -
this is your problem - when you set the PAI for the first destination,
in request_route, the PAI will be present in all future branches.

To avoid this situation, avoid adding "per-branch" info from
request_branch - do it from branch_route; branch_route and failure_route
allows changes per branch (and not global ones).

Do something like:

request_route -> do_routing + arm branch_route
branch_route -> set PAI for the first branch
failure_route -> set PAI for the next branch

Regards,
Bogdan

[hidden email] wrote:

> 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@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@10.10.45.102:1025>.
> Call-ID: B998BB4A-1DD1-11B2-8CD3-D001388A831D@10.10.45.102.
> Content-Type: application/sdp.
> CSeq: 2 INVITE.
> From: "Sjphone laptop_User"<sip:1000@10.10.45.172>;tag=2061433461944847689.
> Max-Forwards: 69.
> To: <sip:30489@10.10.45.172>.
> User-Agent: SJphone/1.60.299a/L (SJ Labs).
> P-Asserted-Identity: <sip:003930948@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@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@10.10.45.102:1025>.
> Call-ID: B998BB4A-1DD1-11B2-8CD3-D001388A831D@10.10.45.102.
> Content-Type: application/sdp.
> CSeq: 2 INVITE.
> From: "Sjphone laptop_User"<sip:1000@10.10.45.172>;tag=2061433461944847689.
> Max-Forwards: 69.
> To: <sip:30489@10.10.45.172>.
> User-Agent: SJphone/1.60.299a/L (SJ Labs).
> P-Asserted-Identity: <sip:003930948@10.10.45.172>.
> P-Asserted-Identity: <sip:003930948@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
> ----------------------------------------------------------------------------
>
>
> _______________________________________________
> Users mailing list
> [hidden email]
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>
>  


_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: Problem with double field P-Asserted-Identity

mmarzuola
In reply to this post by mmarzuola
Hi Bogdan
I tried to follow your directions, but the problem persists.

This is what I did:

In the route where the function do_routing is called I inserted:

########################################################################
# 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_branch("1");
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;
}

In the branch_route:

branch_route[1] {
if(is_present_hf("P-Asserted-Identity")) {
xlog("L_INFO", "Removing P-Asserted-Identity in branches\n");
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")) {
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);
}

########################################################################
# Request route 'clir'
########################################################################
route[14] {
if(isflagset(28) && !isflagset(27)) {
setflag(27);

xlog("L_INFO", "Anonymize caller - M=$rm RURI=$ru F=$fu T=$tu IP=$si ID=$ci\n");
uac_replace_from("Anonymous","sip:[hidden email]");
if(is_present_hf("Privacy")) {
remove_hf("Privacy");
}
append_hf("Privacy: id\r\n");
}
}

########################################################################
# Request route 'base-outbound'
########################################################################
route[2] {
xlog("L_INFO","ARRIVATO NELLA ROUTE 2\n");
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;
}

In the failure_route;

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

if(is_present_hf("P-Asserted-Identity")) {
xlog("L_INFO", "Removing P-Asserted-Identity in failure route\n");
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")) {
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");
#append_hf("Remote-Party-ID: <$avp(s:caller_cli)>;party=caller;privacy=none;screen=yes\r\n");
}
route(14);

t_on_failure("2");
route(2);
}

In the INVITE sent from proxy to the second gateway are still two P-Asserted Idntity fields.
   Where am I wrong?
Thanks in advance.

Matteo Marzuola




>Hi Matteo,

>Whatever change you in request_route will propagate in all branches -
>this is your problem - when you set the PAI for the first destination,
>in request_route, the PAI will be present in all future branches.

>To avoid this situation, avoid adding "per-branch" info from
>request_branch - do it from branch_route; branch_route and failure_route
>allows changes per branch (and not global ones).

>Do something like:

>request_route -> do_routing + arm branch_route
>branch_route -> set PAI for the first branch
>failure_route -> set PAI for the next branch

>Regards,
>Bogdan
 
>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.
 
>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
----------------------------------------------------------------------------

_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: Problem with double field P-Asserted-Identity

mmarzuola
In reply to this post by mmarzuola

Hi Bogdan
I tried to follow your directions, but the problem persists.

This is what I did:

In the route where the function do_routing is called I inserted:

########################################################################
# 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_branch("1");
 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;
}

In the branch_route:

branch_route[1] {
 if(is_present_hf("P-Asserted-Identity")) {
 xlog("L_INFO", "Removing P-Asserted-Identity in branches\n");
 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")) {
 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);
}

########################################################################
# Request route 'clir'
########################################################################
route[14] {
 if(isflagset(28) && !isflagset(27)) {
 setflag(27);

 xlog("L_INFO", "Anonymize caller - M=$rm RURI=$ru F=$fu T=$tu IP=$si ID=$ci\n");
 uac_replace_from("Anonymous","sip:[hidden email]");
 if(is_present_hf("Privacy")) {
 remove_hf("Privacy");
 }
 append_hf("Privacy: id\r\n");
 }
}

########################################################################
# Request route 'base-outbound'
########################################################################
route[2] {
 xlog("L_INFO","ARRIVATO NELLA ROUTE 2\n");
 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;
}

In the failure_route;

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

 if(is_present_hf("P-Asserted-Identity")) {
 xlog("L_INFO", "Removing P-Asserted-Identity in failure route\n");
 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")) {
 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");
 #append_hf("Remote-Party-ID: <$avp(s:caller_cli)>;party=caller;privacy=none;screen=yes\r\n");
 }
 route(14);

 t_on_failure("2");
 route(2);
}

In the INVITE sent from proxy to the second gateway are still two P-Asserted Idntity fields.
Where am I wrong?

Thanks in advance.

Matteo Marzuola




>Hi Matteo,

>Whatever change you in request_route will propagate in all branches -
>this is your problem - when you set the PAI for the first destination,
>in request_route, the PAI will be present in all future branches.

>To avoid this situation, avoid adding "per-branch" info from
>request_branch - do it from branch_route; branch_route and failure_route
>allows changes per branch (and not global ones).

>Do something like:

>request_route -> do_routing + arm branch_route
>branch_route -> set PAI for the first branch
>failure_route -> set PAI for the next branch

>Regards,
>Bogdan

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

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


_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: Problem with double field P-Asserted-Identity

Bogdan-Andrei Iancu
Hi Matteo,

yes because arming the branch_route will be on for all branches of the
transaction - so the branch_route() will be triggered even for the
branch you create in the failure_route -> one PAI in failure route and
one in branch route.

So, you can remove the PAI manipulation from the failure_route() and let
only branch_route to do the job.

Regards,
Bogdan

[hidden email] wrote:

> Hi Bogdan
> I tried to follow your directions, but the problem persists.
>
> This is what I did:
>
> In the route where the function do_routing is called I inserted:
>
> ########################################################################
> # 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_branch("1");
>  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;
> }
>
> In the branch_route:
>
> branch_route[1] {
>  if(is_present_hf("P-Asserted-Identity")) {
>  xlog("L_INFO", "Removing P-Asserted-Identity in branches\n");
>  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")) {
>  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);
> }
>
> ########################################################################
> # Request route 'clir'
> ########################################################################
> route[14] {
>  if(isflagset(28) && !isflagset(27)) {
>  setflag(27);
>
>  xlog("L_INFO", "Anonymize caller - M=$rm RURI=$ru F=$fu T=$tu IP=$si ID=$ci\n");
>  uac_replace_from("Anonymous","sip:[hidden email]");
>  if(is_present_hf("Privacy")) {
>  remove_hf("Privacy");
>  }
>  append_hf("Privacy: id\r\n");
>  }
> }
>
> ########################################################################
> # Request route 'base-outbound'
> ########################################################################
> route[2] {
>  xlog("L_INFO","ARRIVATO NELLA ROUTE 2\n");
>  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;
> }
>
> In the failure_route;
>
> ########################################################################
> # 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");
>
>  if(is_present_hf("P-Asserted-Identity")) {
>  xlog("L_INFO", "Removing P-Asserted-Identity in failure route\n");
>  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")) {
>  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");
>  #append_hf("Remote-Party-ID: <$avp(s:caller_cli)>;party=caller;privacy=none;screen=yes\r\n");
>  }
>  route(14);
>
>  t_on_failure("2");
>  route(2);
> }
>
> In the INVITE sent from proxy to the second gateway are still two P-Asserted Idntity fields.
> Where am I wrong?
>
> Thanks in advance.
>
> Matteo Marzuola
>
>
>
>
>  
>> Hi Matteo,
>>    
>
>  
>> Whatever change you in request_route will propagate in all branches -
>> this is your problem - when you set the PAI for the first destination,
>> in request_route, the PAI will be present in all future branches.
>>    
>
>  
>> To avoid this situation, avoid adding "per-branch" info from
>> request_branch - do it from branch_route; branch_route and failure_route
>> allows changes per branch (and not global ones).
>>    
>
>  
>> Do something like:
>>    
>
>  
>> request_route -> do_routing + arm branch_route
>> branch_route -> set PAI for the first branch
>> failure_route -> set PAI for the next branch
>>    
>
>  
>> Regards,
>> Bogdan
>>    
>
>  
>> 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.
>>    
>
>  
>> 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
> ----------------------------------------------------------------------------
>
>
> _______________________________________________
> Users mailing list
> [hidden email]
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>
>  


_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users