Dear List,
I'd like to get help regarding my case.
I have the following script where many thanks to Daniel has helped me in
if (is_method("INVITE"))
{
if (!load_gws(1, $rU, $fu)) {
sl_send_reply("502", "Unable To lOad GatEwAyS");
exit;}
if(!next_gw()){
sl_send_reply("503", "Unable To fInD a gateWaY");
exit;}
while(next_gw()){
km_append_branch(); }
sl_send_reply("302","Moved Temporary");
exit;
}
The problem am facing is that the call is rerouting from the first gateway to the next gateway successfully when I have two gateways. BUT when I have three gateways, and the first two gateways are off, the call is not rerouted to the third gateway. It keeps hitting the seconds gateway and gives request time out at the end
Why is that?
Thanks in advance,
F Chahrour
Dears,
I've changed the script to the following:
if (is_method("INVITE"))
{
if (!load_gws(1, $rU, $fu)) {
sl_send_reply("502", "Unable To lOad GatEwAyS");
exit; }
else while(next_gw()) {
km_append_branch(); }
sl_send_reply("300","Multiple Choices");
exit;
}
In Lcr_gw table I have:
1, 1, 'S1', '192.168.111.195', '192.168.111.195', 5060, '', 1, 1, 0, '0', 0, 0, '111'
2, 1, 'S2', '192.168.111.11', '192.168.111.11', 5060, '', 1, 1, 0, '0', 0, 0, ''
3, 1, 'S3', '192.168.111.19', '192.168.111.19', 5060, '', 1, 1, 0, '0', 0, 0, ''
4, 1, 'S4', '192.168.111.17', '192.168.111.17', 5060, '', 1, 1, 0, '0', 0, 0, ''
5, 1, 'S5', '192.168.111.18', '192.168.111.18', 5060, '', 1, 1, 0, '0', 0, 0, ''
I can see in the sip trace that contacts redirected correctly but starting from the last gateway(192.168.111.18) then to 192.168.111.195, etc.;
SIP/2.0 300 Multiple Choices
Via: SIP/2.0/UDP 192.168.111.124:5060;branch=z9hG4bKma7723109gaqmv94j2g1.1
From: "test1" sip:192.168.52.139;tag=7076feef33
To: sip:333961300007@192.168.111.123;tag=b27e1a1d33761e85846fc98f5f3a7e58.5998
Call-ID: 3C8C90D4D2CC44E9AABE3171F0DA0A810xc0a8348b
CSeq: 1 INVITE
Contact: sip:333961300007@192.168.111.18, sip:111333961300007@192.168.111.195, sip:333961300007@192.168.111.11, sip:333961300007@192.168.111.19, sip:333961300007@192.168.111.17, sip:333961300007@192.168.111.18
Server: kamailio (3.2.2 (i386/linux))
Content-Length: 0
Please help me to know what can I do so that Contacts in the redirect starts from my first gateway?
Thanks,
F Chahrour
From: sr-users-bounces@lists.sip-router.org [mailto:sr-users-bounces@lists.sip-router.org] On Behalf Of Fatima Chahrour~Vanrise Support Sent: Thursday, October 18, 2012 3:19 PM To: 'SIP Router - Kamailio (OpenSER) and SIP Express Router (SER) - Users Mailing List' Cc: sr-users@lists.sip-router.org Subject: [SR-Users] Kamailio- Redirect message 300 with LCR reroute
Dear List,
I'd like to get help regarding my case.
I have the following script where many thanks to Daniel has helped me in
if (is_method("INVITE"))
{
if (!load_gws(1, $rU, $fu)) {
sl_send_reply("502", "Unable To lOad GatEwAyS");
exit;}
if(!next_gw()){
sl_send_reply("503", "Unable To fInD a gateWaY");
exit;}
while(next_gw()){
km_append_branch(); }
sl_send_reply("302","Moved Temporary");
exit;
}
The problem am facing is that the call is rerouting from the first gateway to the next gateway successfully when I have two gateways. BUT when I have three gateways, and the first two gateways are off, the call is not rerouted to the third gateway. It keeps hitting the seconds gateway and gives request time out at the end
Why is that?
Thanks in advance,
F Chahrour
Dears,
Any helping idea regarding the below?!
Thanks in advance.
From: sr-users-bounces@lists.sip-router.org [mailto:sr-users-bounces@lists.sip-router.org] On Behalf Of Fatima Chahrour~Vanrise Support Sent: Friday, October 19, 2012 2:12 PM To: 'SIP Router - Kamailio (OpenSER) and SIP Express Router (SER) - Users Mailing List' Subject: Re: [SR-Users] Kamailio- Redirect message 300 with LCR reroute
Dears,
I've changed the script to the following:
if (is_method("INVITE"))
{
if (!load_gws(1, $rU, $fu)) {
sl_send_reply("502", "Unable To lOad GatEwAyS");
exit; }
else while(next_gw()) {
km_append_branch(); }
sl_send_reply("300","Multiple Choices");
exit;
}
In Lcr_gw table I have:
1, 1, 'S1', '192.168.111.195', '192.168.111.195', 5060, '', 1, 1, 0, '0', 0, 0, '111'
2, 1, 'S2', '192.168.111.11', '192.168.111.11', 5060, '', 1, 1, 0, '0', 0, 0, ''
3, 1, 'S3', '192.168.111.19', '192.168.111.19', 5060, '', 1, 1, 0, '0', 0, 0, ''
4, 1, 'S4', '192.168.111.17', '192.168.111.17', 5060, '', 1, 1, 0, '0', 0, 0, ''
5, 1, 'S5', '192.168.111.18', '192.168.111.18', 5060, '', 1, 1, 0, '0', 0, 0, ''
I can see in the sip trace that contacts redirected correctly but starting from the last gateway(192.168.111.18) then to 192.168.111.195, etc.;
SIP/2.0 300 Multiple Choices
Via: SIP/2.0/UDP 192.168.111.124:5060;branch=z9hG4bKma7723109gaqmv94j2g1.1
From: "test1" sip:192.168.52.139;tag=7076feef33
To: sip:333961300007@192.168.111.123;tag=b27e1a1d33761e85846fc98f5f3a7e58.5998
Call-ID: 3C8C90D4D2CC44E9AABE3171F0DA0A810xc0a8348b
CSeq: 1 INVITE
Contact: sip:333961300007@192.168.111.18, sip:111333961300007@192.168.111.195, sip:333961300007@192.168.111.11, sip:333961300007@192.168.111.19, sip:333961300007@192.168.111.17, sip:333961300007@192.168.111.18
Server: kamailio (3.2.2 (i386/linux))
Content-Length: 0
Please help me to know what can I do so that Contacts in the redirect starts from my first gateway not the last one?
Thanks,
F Chahrour
From: sr-users-bounces@lists.sip-router.org [mailto:sr-users-bounces@lists.sip-router.org] On Behalf Of Fatima Chahrour~Vanrise Support Sent: Thursday, October 18, 2012 3:19 PM To: 'SIP Router - Kamailio (OpenSER) and SIP Express Router (SER) - Users Mailing List' Cc: sr-users@lists.sip-router.org Subject: [SR-Users] Kamailio- Redirect message 300 with LCR reroute
Dear List,
I'd like to get help regarding my case.
I have the following script where many thanks to Daniel has helped me in
if (is_method("INVITE"))
{
if (!load_gws(1, $rU, $fu)) {
sl_send_reply("502", "Unable To lOad GatEwAyS");
exit;}
if(!next_gw()){
sl_send_reply("503", "Unable To fInD a gateWaY");
exit;}
while(next_gw()){
km_append_branch(); }
sl_send_reply("302","Moved Temporary");
exit;
}
The problem am facing is that the call is rerouting from the first gateway to the next gateway successfully when I have two gateways. BUT when I have three gateways, and the first two gateways are off, the call is not rerouted to the third gateway. It keeps hitting the seconds gateway and gives request time out at the end
Why is that?
Thanks in advance,
F Chahrour
Fatima Chahrour~Vanrise Support writes:
I can see in the sip trace that contacts redirected correctly but starting from the last gateway(192.168.111.18) then to 192.168.111.195, etc.;
Please help me to know what can I do so that Contacts in the redirect starts from my first gateway not the last one?
you can adjust the order by lcr_rule_target priority field.
-- juha
Hi Juha,
The priority field is already set correctly in lcr_rule_target but though the call is starting by last gw instead of the first.
Herby more details: In Lcr_gw table I have: 1, 1, 'S1', '192.168.111.195', '192.168.111.195', 5060, '', 1, 1, 0, '0', 0, 0, '111' 2, 1, 'S2', '192.168.111.11', '192.168.111.11', 5060, '', 1, 1, 0, '0', 0, 0, '' 3, 1, 'S3', '192.168.111.19', '192.168.111.19', 5060, '', 1, 1, 0, '0', 0, 0, '' 4, 1, 'S4', '192.168.111.17', '192.168.111.17', 5060, '', 1, 1, 0, '0', 0, 0, '' 5, 1, 'S5', '192.168.111.18', '192.168.111.18', 5060, '', 1, 1, 0, '0', 0, 0, ''
In lcr_rule_target: 1, 1, 1, 1, 1, 1 2, 1, 1, 2, 2, 1 3, 1, 1, 3, 3, 1 4, 1, 1, 4, 4, 1 5, 1, 1, 5, 5, 1
Thanks, F Chahrour
-----Original Message----- From: sr-users-bounces@lists.sip-router.org [mailto:sr-users-bounces@lists.sip-router.org] On Behalf Of Juha Heinanen Sent: Tuesday, October 30, 2012 12:24 PM To: SIP Router - Kamailio (OpenSER) and SIP Express Router (SER) - Users Mailing List Subject: Re: [SR-Users] Kamailio- Redirect message 300 with LCR reroute
Fatima Chahrour~Vanrise Support writes:
I can see in the sip trace that contacts redirected correctly but starting from the last gateway(192.168.111.18) then to 192.168.111.195, etc.;
Please help me to know what can I do so that Contacts in the redirect
starts
from my first gateway not the last one?
you can adjust the order by lcr_rule_target priority field.
-- juha
_______________________________________________ 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 Juha,
Isn't putting priority 1 for gateway 1 means take this gateway of id 1 as first choice in routing? I have sent you my tables' content to pinpoint my mistake if it exist in the table and not in the script, are they wrong? Do you see that my routing script is fine?
Thanks, F Chahrour -----Original Message----- From: sr-users-bounces@lists.sip-router.org [mailto:sr-users-bounces@lists.sip-router.org] On Behalf Of Juha Heinanen Sent: Tuesday, October 30, 2012 4:36 PM To: SIP Router - Kamailio (OpenSER) and SIP Express Router (SER) - Users Mailing List Subject: Re: [SR-Users] Kamailio- Redirect message 300 with LCR reroute
Fatima Chahrour~Vanrise Support writes:
The priority field is already set correctly in lcr_rule_target but though the call is starting by last gw instead of the first.
depends how you define "correct". set priorities so that you get what you want.
-- juha
_______________________________________________ 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
Fatima Chahrour~Vanrise Support writes:
Isn't putting priority 1 for gateway 1 means take this gateway of id 1 as first choice in routing?
smaller priority value means higher priority. but if i remember correctly, in your script you used append_branch, which may be appending each new branch in front of the previous one. if so, the priority order that next_gw() function returns the gateways, get reversed.
-- juha
Hi
We are trying to set up route advance for lcr in our kamailio config so that when 1 gateway fails the next one is attempted.
Seems like we are tackling the same issue. Did you ever find a satisfactory way to set this up so they run in the right order?
Thanks very much in advance.
All the best
Will Ferrer
-- View this message in context: http://sip-router.1086192.n5.nabble.com/Kamailio-Redirect-message-300-with-L... Sent from the Users mailing list archive at Nabble.com.
willf1976 writes:
We are trying to set up route advance for lcr in our kamailio config so that when 1 gateway fails the next one is attempted.
Seems like we are tackling the same issue. Did you ever find a satisfactory way to set that up so they run in the right order?
if you are using lcr module, in lcr_rule_target column you set priority field value according to your needs. then first next_gw() call will give you the gw pointed to by larger priority value rule target and second with smaller one.
-- juha
Hi Juha
Thank you so much for the write back.
So I take it then that the method described in this thread will work for making fall back routes for lcr that will run in the order of their priority, instead of in reverse order as some folks were saying in the thread?
I also am planning on switching to using append_branch instead of km_append_branch -- I thought I would mention this in case there was some reason that km_append_branch is being used instead. So in the end my script would look something much like this:
if (is_method("INVITE"))
{
if (!load_gws(1, $rU, $fu)) {
sl_send_reply("502", "Unable to load gateways");
exit;}
if(!next_gw()){
sl_send_reply("503", "Unable To find a gateway");
exit;}
while(next_gw()){
append_branch(); }
sl_send_reply("302","Moved temporary");
exit;
}
I greatly appreciate the assistance and hope this message finds you well.
All the best.
Will Ferrer
-- View this message in context: http://sip-router.1086192.n5.nabble.com/Kamailio-Redirect-message-300-with-L... Sent from the Users mailing list archive at Nabble.com.
willf1976 writes:
So I take it then that the method described in this thread will work for making fall back routes for lcr that will run in the order of their priority, instead of in reverse order as some folks were saying in the thread?
read what lcr readme tells about priority. if it does not work as described, file a bug report.
I also am planning on switching to using append_branch instead of km_append_branch -- I thought I would mention this in case there was some reason that km_append_branch is being used instead. So in the end my script would look something much like this:
if (is_method("INVITE"))
{ if (!load_gws(1, $rU, $fu)) { sl_send_reply("502", "Unable to load gateways"); exit;} if(!next_gw()){ sl_send_reply("503", "Unable To find a gateway"); exit;} while(next_gw()){ append_branch(); } sl_send_reply("302","Moved temporary"); exit; }
you should call append_branch() after next_gw(). also, the above calls next_gw() twice. at some point you should call t_relay() to send the message.
-- juha
Hi Juha
Thanks so much for the response.
The method I posted was a slightly modified version of the method already posted in this thread.
What I believe the script is meant to do is as follows:
1) load gateways as per usual:
if (!load_gws(1, $rU, $fu)) {
sl_send_reply("502", "Unable to load gateways");
exit;}
2) Rewrite the current request uri to the first gateway or return an error if no gateways were found
if(!next_gw()){
sl_send_reply("503", "Unable To find a gateway");
exit;}
3) Add all the other gateways that were found as additional end points to be tried after the first
while(next_gw()){
append_branch(); }
The reason that I thought it might reverse the order of the gateways was because of something you said previously in the thread in response to the original poster:
" smaller priority value means higher priority. but if i remember correctly, in your script you used append_branch, which may be appending each new branch in front of the previous one. if so, the priority order that next_gw() function returns the gateways, get reversed. "
No one responded to your last post in the thread so I wasn't sure if it was determined if this method would reverse the order or not.
Thinking over this script a bit more I believe it is flawed or at the very least an incomplete example. It would cause all the branches to be contacted at once instead of in sequence. What really seems like it's needed here is something like the serial forking example found here: http://kamailio.org/docs/modules/3.1.x/modules/tm.html#tm.serial_forking
I went with trying the above method of doing the route advance because it was the only method my google search turned up.
Perhaps something very simple like a failure route that calls next_gw would do the trick instead:
failure_route["lcr_failure"] { if (!next_gw()) { t_reply("503", "Service not available - No more gateways"); exit; }; t_relay(); }
What I am trying to accomplish is having kamailio contact my next lcr gateways in sequence if the first attempt failed. Do either of these methods: either serial forking of branches generated in a while loop with next_gw or calling next_gw() in a failure route, seem like the right way to proceed?
Thanks again for your assistance.
I hope this message finds you well.
All the best
Will Ferrer
jh wrote
willf1976 writes:
So I take it then that the method described in this thread will work for making fall back routes for lcr that will run in the order of their priority, instead of in reverse order as some folks were saying in the thread?
read what lcr readme tells about priority. if it does not work as described, file a bug report.
I also am planning on switching to using append_branch instead of km_append_branch -- I thought I would mention this in case there was some reason that km_append_branch is being used instead. So in the end my script would look something much like this:
if (is_method("INVITE"))
{ if (!load_gws(1, $rU, $fu)) { sl_send_reply("502", "Unable to load gateways"); exit;} if(!next_gw()){ sl_send_reply("503", "Unable To find a gateway"); exit;} while(next_gw()){ append_branch(); } sl_send_reply("302","Moved temporary"); exit; }
you should call append_branch() after next_gw(). also, the above calls next_gw() twice. at some point you should call t_relay() to send the message.
-- juha
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@.sip-router
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
-- View this message in context: http://sip-router.1086192.n5.nabble.com/Kamailio-Redirect-message-300-with-L... Sent from the Users mailing list archive at Nabble.com.
Hi All
For the record, putting in the failure route worked for me. Very simple solution.
All the best.
Will Ferrer
-- View this message in context: http://sip-router.1086192.n5.nabble.com/Kamailio-Redirect-message-300-with-L... Sent from the Users mailing list archive at Nabble.com.