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