Thank you very much Carsten!
It seem to be working on the reduced version I got for testing, I'll try tomorrow on the real test environment, but I think you got the solution.
Thank you again for the continuous help! I've also learned a lot trying the different options!!
Helena
-----Original Message----- From: sr-users-bounces@lists.sip-router.org [mailto:sr-users-bounces@lists.sip-router.org] On Behalf Of Carsten Bock Sent: lunes, 17 de febrero de 2014 17:00 To: Kamailio (SER) - Users Mailing List Subject: Re: [SR-Users] modify To header, prefix + ip, using dispacher module.
Hi Helena,
try the following (simplified):
route[FROMPHONE] { [...] if(!ds_select_domain("1", "8")) { send_reply("404", "No destination"); exit; } t_on_failure("RTF_DISPATCH"); t_on_branch("MODIFY_TO");
subst_uri('/^sip:(.*)/sip:0199\1/i'); # add prefix to URI $avp(s:new_to) = "sip:0199"+$rU+"@"+"$rd";
route(RELAY); exit; }
branch_route[MODIFY_TO] { uac_replace_to("", $avp(s:new_to)); }
failure_route[RTF_DISPATCH] { if (t_is_canceled()) { exit; } if (t_check_status("500") or (t_branch_timeout() and !t_branch_replied())) { if(ds_next_domain()) { t_on_failure("RTF_DISPATCH"); #in case of t_on_branch("MODIFY_TO"); $avp(s:new_to) = "sip:"+$tU+"@"+$td; route(RELAY); exit; } } }
This way, uac_replace_to() gets only called once per destination.
Kind regards, Carsten
2014-02-17 14:14 GMT+01:00 Helena Garcia-Nieto helena.gnieto@morodo.co.uk:
Hi Carsten,
I am sorry, I am not sure if I am understanding you correctly. Thank you very much for all the tips.
I still have the same problem, the second time I try to manipulate the TO it appends the new value instead of substitute it.
My code is at the end (bit different because it is now on a different test environment).
When gw 1(X.X.X.102) is not responding to INVITEs, after the timer the server send the new request to gw2(X.X.X.180), set RURI fine but the TO has strange format (not correct) It is appending the new value to the value set on the DISPATCH route
To: SET_TO <sip:XXXXX69@X.X.X.102SET_TO sip:XXXXXX69@X.X.X.180>
The problem is only when I do it twice (on distich routine and on branch/failure). If I don't touch the TO on the DISPATCH routine, then the uac function on the branch works fine. The problem is that I need that the TO is equal to the RURI on both cases!
Thanks again, Could you tell me if that was not what you meant? Or if I am not using the function properly?
BR
Helena
route[DISPATCH] {
# round robin dispatching on gateways group '1' if(!ds_select_domain("1", "8")) { send_reply("404", "No destination"); exit; }
subst_uri('/^sip:999(.*)/sip:\1/i'); # delete the 00 subst_uri('/^sip:00(.*)/sip:\1/i'); # delete the 00 subst_uri('/^sip:+(.*)/sip:\1/i'); # delete the +
uac_replace_to("SET_TO","sip:$rU@$rd");
t_on_failure("RTF_DISPATCH");
route(RELAY); return; }
branch_route[SET_TO] { uac_replace_to("SET_TO","sip:$rU@$rd"); }
# Sample failure route failure_route[RTF_DISPATCH] { if (t_is_canceled()) { exit; }
#marking the gw as failed and set state proving ds_mark_dst("p"); # next DST - only for 500 or local timeout if (t_check_status("500") or (t_branch_timeout() and !t_branch_replied())) { if(ds_next_domain()) { t_on_failure("RTF_DISPATCH"); t_on_branch("SET_TO"); route(RELAY); exit; } } }
-----Original Message----- From: sr-users-bounces@lists.sip-router.org [mailto:sr-users-bounces@lists.sip-router.org] On Behalf Of Carsten Bock Sent: lunes, 17 de febrero de 2014 10:24 To: Kamailio (SER) - Users Mailing List Subject: Re: [SR-Users] modify To header, prefix + ip, using dispacher module.
Hi Helena,
Just a quick note: If you do a failover from failure_route(), this will also create a new branch and the branch_route() would be executed, too.
Kind regards, Carsten
2014-02-17 10:15 GMT+01:00 Helena Garcia-Nieto
Hey all,
Does any of you have any other idea on how to modify the TO header. Every option I try on failure route is appending the values together instead of replacing it.
Could that be because I am trying to modify the TO header twice? (Once on the normal routing once in the failure routing?)
Is there any parameter I can set so the TO header always copy the RURI domain?
Thanks in advanced!
Helena
-----Original Message----- From: sr-users-bounces@lists.sip-router.org [mailto:sr-users-bounces@lists.sip-router.org] On Behalf Of Helena Garcia-Nieto Sent: viernes, 14 de febrero de 2014 14:24 To: 'Kamailio (SER) - Users Mailing List' Subject: Re: [SR-Users] modify To header, prefix + ip, using dispacher module.
Hi Carsten
Thanks for the info, but I cannot use a branch route, because it is a failure route, and I need to execute the dispatcher funcitonst to set the destination to proving and to select the next destination.
Does anyone know how to set the TO header to use always the same username and domain than the RURI, even on failures?
Thanks in advanced
Helena
-----Original Message----- From: sr-users-bounces@lists.sip-router.org [mailto:sr-users-bounces@lists.sip-router.org] On Behalf Of Carsten Bock Sent: jueves, 13 de febrero de 2014 14:43 To: Kamailio (SER) - Users Mailing List Subject: Re: [SR-Users] modify To header, prefix + ip, using dispacher module.
Hi Helena,
we do it the following way:
In the main route: t_on_branch("some_route");
branch_route[some_route] { uac_replace_to(....); }
This way, the uac_* functions get executed for each branch individually.
Kind regards, Carsten
2014-02-13 13:40 GMT+01:00 Helena Garcia-Nieto
Hi,
Thanks for the tip, but I cannot manage it to work...
I hadn't uac module loaded, I loaded it and added
#MORODO TEST TO MODIFICATION loadmodule "uac.so" modparam("uac","restore_mode","none")
The uac function cannot be used on the failure rutine (it gives an error when restarting) so I chaged the order:
That is the default routing route[FROMPHONE] { [...] if(!ds_select_domain("1", "8")) { send_reply("404", "No destination"); exit; } t_on_failure("RTF_DISPATCH");
#MORODO Add profix to ISKRATEL: 0199 subst_uri('/^sip:(.*)/sip:0199\1/i'); # add prefix to
URI
uac_replace_to("","sip:0199$rU@$rd"); route(RELAY); exit;
}
That is the failure function
failure_route[RTF_DISPATCH] { if (t_is_canceled()) { exit; }
#marking the gw as failed and set state proving, to send options ds_mark_dst("p"); # next DST - only for 500 or local timeout if (t_check_status("500") or (t_branch_timeout() and
!t_branch_replied())) { if(ds_next_domain()) { t_on_failure("RTF_DISPATCH"); #in case of fail again it would try the next option
#MORODO, update IP on TO header subst_hf("To", "/(.*)@(.*)$/\1@$rd>/", "a"); route(RELAY); exit; } }
}
But the result TO header is the same strange thing... mix of what it was on normal routine + what I wanted after the failure...
To: sip:0199XXXXX10@10.X.X.39sip:0199XXXXX10@10.X.X.38
It is like once the TO is modified, It does not modify it ok anymore...
Would you do it any other way that could be better?
Helena
-----Original Message----- From: sr-users-bounces@lists.sip-router.org [mailto:sr-users-bounces@lists.sip-router.org] On Behalf Of Daniel Tryba Sent: miércoles, 12 de febrero de 2014 18:30 To: sr-users@lists.sip-router.org Subject: Re: [SR-Users] modify To header, prefix + ip, using dispacher module.
On Wednesday 12 February 2014 17:37:46 Helena Garcia-Nieto wrote:
I tried modifying again the TO header with: subst_hf("To", "/(.*)@(.*)$/\1@$rd>/", "a")
before the route(relay) on the failure routine, but it does not work properly, I am getting strange TO header like:
To: sip:0199XXXX@10.X.X.39 sip:XXXXXX@10.X.X.38
It looks like it is not parsing the to header it has before but adding a parsed version of the original header at the end of the other
one....
I tried with subst as well but the result is more or less the same.
Probably there is a better way to set the prefix and the correct IP on
the to header... I'll appreciate any help with this issue.
How about just using uac_replace_to()?
http://kamailio.org/docs/modules/stable/modules/uac.html#uac.f.uac_r e p lace_t o%28display,uri%29
4.4. uac_replace_to(display,uri)
Replace in TO header the display name and the URI part.
display and URI parameters can include pseudo-variables.
This function can be used from REQUEST_ROUTE and from BRANCH_ROUTE.
--
POCOS B.V. - Croy 9c - 5653 LC Eindhoven Telefoon: 040 293 8661 - Fax: 040 293 8658 http://www.pocos.nl/ - http://www.sipo.nl/ K.v.K. Eindhoven 17097024
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list sr-users@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list sr-users@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
-- Carsten Bock CEO (Geschäftsführer)
ng-voice GmbH Schomburgstr. 80 D-22767 Hamburg / Germany
http://www.ng-voice.com mailto:carsten@ng-voice.com
Office +49 40 34927219 Fax +49 40 34927220
Sitz der Gesellschaft: Hamburg Registergericht: Amtsgericht Hamburg, HRB 120189 Geschäftsführer: Carsten Bock Ust-ID: DE279344284
Hier finden Sie unsere handelsrechtlichen Pflichtangaben: http://www.ng-voice.com/imprint/
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list sr-users@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list sr-users@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list sr-users@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
-- Carsten Bock CEO (Geschäftsführer)
ng-voice GmbH Schomburgstr. 80 D-22767 Hamburg / Germany
http://www.ng-voice.com mailto:carsten@ng-voice.com
Office +49 40 34927219 Fax +49 40 34927220
Sitz der Gesellschaft: Hamburg Registergericht: Amtsgericht Hamburg, HRB 120189 Geschäftsführer: Carsten Bock Ust-ID: DE279344284
Hier finden Sie unsere handelsrechtlichen Pflichtangaben: http://www.ng-voice.com/imprint/
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list sr-users@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list sr-users@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
-- Carsten Bock CEO (Geschäftsführer)
ng-voice GmbH Schomburgstr. 80 D-22767 Hamburg / Germany
http://www.ng-voice.com mailto:carsten@ng-voice.com
Office +49 40 34927219 Fax +49 40 34927220
Sitz der Gesellschaft: Hamburg Registergericht: Amtsgericht Hamburg, HRB 120189 Geschäftsführer: Carsten Bock Ust-ID: DE279344284
Hier finden Sie unsere handelsrechtlichen Pflichtangaben: http://www.ng-voice.com/imprint/
_______________________________________________ SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list sr-users@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users