Hey,
Thank you in advanced for the time taken on my question!
I have an environment phone---sbc---kamailio---gw1, gw2
I am using kamailio 4.2.0, quite basic config, using dispatcher module to route to the gw and to monitor them with options. I have a file dispatcher.list with the two gw ips: # $Id$ # dispatcher destination sets #
# line format # setit(int) destination(sip uri) flags(int,opt) priority(int,opt) attributes(str,opt)
# gateways 1 sip:10.X.X.38:5060 IP 1 sip:10.X.X.39:5060 AP
I have to modify the TO header, it must be prefixed and gw ip must be placed there (gw requirements)
I use on the routing function ds_select_domain("1", "8") t_on_failure("RTF_DISPATCH");
and just before the ROUTE(RELAY) I have:
# Add profix to gw: 0199 subst_uri('/^sip:(.*)/sip:0199\1/i'); # add prefix to RURI subst_hf("To", "/(.*):(.*)@(.*)$/\1:0199\2@$rd>/", "a"); #add prefix to TO, modify ip on TO use ruri ip
It works fine if the first gw is available, but if the first option (which is the last gw on the list) is not accessible, it waits for the 30s and then tries the second one, but the ip on the TO header is not correct anymore, since it is the first gw and not the second.
Question: why does it wait until the timeout if it is monitoring it with option and seeing it is not reachable?
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.
Thanks again for your time
Helena
Helena Garcia-Nieto de Mir Morodo Group VoIP Department E-mail: helena.gnieto@morodo.co.uk Morodo Limited voip@morodo.co.uk / www.mo-call.com Place of Registration: Companies House, England & Wales / Registered Office: 7 Breasy Place, 9 Burroughs Gardens Hendon, London NW4 4AU
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_replace_t...
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.
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_replace_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.
2014-02-13 13:40 GMT+01:00 Helena Garcia-Nieto helena.gnieto@morodo.co.uk:
Would you do it any other way that could be better?
changing $du?
Hi Victor,
Could you please tell me a bit more about that?
I am not using du, and actually the variable is empty (I tried to use it to modify the TO in first instance but It came empty)
I tried using $tU and $td. But when I do
$td = $rd Inside the failure routing I get a td that is "gw1gw2", this command is appending new rd to the existing td. How can I erese previous content of td and then write rd on td?
Thanks again
Helena
-----Original Message----- From: sr-users-bounces@lists.sip-router.org [mailto:sr-users-bounces@lists.sip-router.org] On Behalf Of Victor Seva Sent: jueves, 13 de febrero de 2014 14:42 To: Kamailio (SER) - Users Mailing List Subject: Re: [SR-Users] modify To header, prefix + ip, using dispacher module.
2014-02-13 13:40 GMT+01:00 Helena Garcia-Nieto helena.gnieto@morodo.co.uk:
Would you do it any other way that could be better?
changing $du?
_______________________________________________ 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
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 helena.gnieto@morodo.co.uk:
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_replace_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
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 helena.gnieto@morodo.co.uk:
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_rep 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
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 helena.gnieto@morodo.co.uk:
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_rep 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
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 helena.gnieto@morodo.co.uk:
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 helena.gnieto@morodo.co.uk:
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_rep 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
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 helena.gnieto@morodo.co.uk:
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_re 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
Ok,
From the uac documentation I can see I can only use it once, but even
modifying the TO header on the first routine (Dispatch) somehow different (subst, subst_hf, $td=$rd..) the outcome is the same, strange TO mixed.
If I cannot modify TO twice, how can I made it equal to the RURI domain in direct routing and in case of failure?
Thanks...
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: lunes, 17 de febrero de 2014 14:14 To: 'Kamailio (SER) - Users Mailing List' Subject: Re: [SR-Users] modify To header, prefix + ip, using dispacher module.
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 helena.gnieto@morodo.co.uk:
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_re 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
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 helena.gnieto@morodo.co.uk:
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_re 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
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