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 mmarzu...@interfree.it 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:anonym...@anonymous.invalid"); > 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 > Users@lists.opensips.org > http://lists.opensips.org/cgi-bin/mailman/listinfo/users > > _______________________________________________ Users mailing list Users@lists.opensips.org http://lists.opensips.org/cgi-bin/mailman/listinfo/users