Hello List.

I have the next situation.  I'm trying to build a "LCR" but using the
information from a Radius Server, so 'im using the  avp_radius module to
obtain the "next_gw" data from my DB.

So far so good, I have been able to retry a failed call with the next
gateway in the list. In my tests I'm using a list of 3 gateways and I'm
seeing the next behavior  : I have all the gateways off-line, so the
call is redirected to the first, second and and finally to the third
gateway, when there is no moer gateways to try I have this statement in
my config file : 

 

if( there is gateways to try on the list... ) {

route(1);

} else {

                sl_send_reply("503", "No more DB routes");

                exit;

}

 

I send the "503 - No more DB routes" but the Kamailio also send a "408
Request Timeout".

What could this be happening?  I even tried with just one gateway on the
list, with the same results.  I was expecting just the "503" message,
and not the "408".

 

Hope that someone could help me.

I'm attaching my kamailio-snnipet.cfg file and a full debug with the
behavior.

 

 

 

Thanks!

Ricardo Martinez

U 10.10.10.220:5060 -> 10.10.10.212:5060
INVITE sip:[EMAIL PROTECTED] SIP/2.0.
Via: SIP/2.0/UDP 10.10.10.220:5060;branch=z9hG4bK1849d16ca4198.
From: <sip:[EMAIL PROTECTED]>;tag=1849d16ca4.
To: <sip:[EMAIL PROTECTED]>.
Call-ID: [EMAIL PROTECTED]
CSeq: 198 INVITE.
Supported: timer, replaces, early-session.
Min-SE: 1800.
Date: Fri, 21 Nov 2008 12:39:52 GMT.
User-Agent: AddPac SIP Gateway.
Contact: <sip:[EMAIL PROTECTED]>.
Accept: application/sdp.
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, UPDATE, REFER, NOTIFY, INFO.
Content-Type: application/sdp.
Content-Length: 265.
Max-Forwards: 70.
.
v=0.
o=7772405000 1227271192 1227271192 IN IP4 10.10.10.220.
s=AddPac Gateway SDP.
c=IN IP4 10.10.10.220.
t=1227271192 0.
m=audio 23412 RTP/AVP 18 4 101.
a=rtpmap:18 G729/8000.
a=rtpmap:4 G723/8000.
a=rtpmap:101 telephone-event/8000.
a=fmtp:101 0-15.
a=ptime:20.


U 10.10.10.212:5060 -> 10.10.10.220:5060
SIP/2.0 100 Giving a try.
Via: SIP/2.0/UDP 10.10.10.220:5060;branch=z9hG4bK1849d16ca4198.
From: <sip:[EMAIL PROTECTED]>;tag=1849d16ca4.
To: <sip:[EMAIL PROTECTED]>.
Call-ID: [EMAIL PROTECTED]
CSeq: 198 INVITE.
Server: Kamailio (1.4.2-notls (i386/linux)).
Content-Length: 0.
.


U 10.10.10.212:5060 -> 10.10.10.197:5061
INVITE sip:[EMAIL PROTECTED]:5061;transport=udp SIP/2.0.
Record-Route: <sip:10.10.10.212;lr=on>.
Via: SIP/2.0/UDP 10.10.10.212;branch=z9hG4bK1fcb.9a6456a1.0.
Via: SIP/2.0/UDP 10.10.10.220:5060;branch=z9hG4bK1849d16ca4198.
From: <sip:[EMAIL PROTECTED]>;tag=1849d16ca4.
To: <sip:[EMAIL PROTECTED]>.
Call-ID: [EMAIL PROTECTED]
CSeq: 198 INVITE.
Supported: timer, replaces, early-session.
Min-SE: 1800.
Date: Fri, 21 Nov 2008 12:39:52 GMT.
User-Agent: AddPac SIP Gateway.
Contact: <sip:[EMAIL PROTECTED]>.
Accept: application/sdp.
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, UPDATE, REFER, NOTIFY, INFO.
Content-Type: application/sdp.
Content-Length: 265.
Max-Forwards: 69.
.
v=0.
o=7772405000 1227271192 1227271192 IN IP4 10.10.10.220.
s=AddPac Gateway SDP.
c=IN IP4 10.10.10.220.
t=1227271192 0.
m=audio 23412 RTP/AVP 18 4 101.
a=rtpmap:18 G729/8000.
a=rtpmap:4 G723/8000.
a=rtpmap:101 telephone-event/8000.
a=fmtp:101 0-15.
a=ptime:20.


U 10.10.10.212:5060 -> 10.10.10.197:5061
INVITE sip:[EMAIL PROTECTED]:5061;transport=udp SIP/2.0.
Record-Route: <sip:10.10.10.212;lr=on>.
Via: SIP/2.0/UDP 10.10.10.212;branch=z9hG4bK1fcb.9a6456a1.0.
Via: SIP/2.0/UDP 10.10.10.220:5060;branch=z9hG4bK1849d16ca4198.
From: <sip:[EMAIL PROTECTED]>;tag=1849d16ca4.
To: <sip:[EMAIL PROTECTED]>.
Call-ID: [EMAIL PROTECTED]
CSeq: 198 INVITE.
Supported: timer, replaces, early-session.
Min-SE: 1800.
Date: Fri, 21 Nov 2008 12:39:52 GMT.
User-Agent: AddPac SIP Gateway.
Contact: <sip:[EMAIL PROTECTED]>.
Accept: application/sdp.
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, UPDATE, REFER, NOTIFY, INFO.
Content-Type: application/sdp.
Content-Length: 265.
Max-Forwards: 69.
.
v=0.
o=7772405000 1227271192 1227271192 IN IP4 10.10.10.220.
s=AddPac Gateway SDP.
c=IN IP4 10.10.10.220.
t=1227271192 0.
m=audio 23412 RTP/AVP 18 4 101.
a=rtpmap:18 G729/8000.
a=rtpmap:4 G723/8000.
a=rtpmap:101 telephone-event/8000.
a=fmtp:101 0-15.
a=ptime:20.


U 10.10.10.212:5060 -> 10.10.10.197:5061
INVITE sip:[EMAIL PROTECTED]:5061;transport=udp SIP/2.0.
Record-Route: <sip:10.10.10.212;lr=on>.
Via: SIP/2.0/UDP 10.10.10.212;branch=z9hG4bK1fcb.9a6456a1.0.
Via: SIP/2.0/UDP 10.10.10.220:5060;branch=z9hG4bK1849d16ca4198.
From: <sip:[EMAIL PROTECTED]>;tag=1849d16ca4.
To: <sip:[EMAIL PROTECTED]>.
Call-ID: [EMAIL PROTECTED]
CSeq: 198 INVITE.
Supported: timer, replaces, early-session.
Min-SE: 1800.
Date: Fri, 21 Nov 2008 12:39:52 GMT.
User-Agent: AddPac SIP Gateway.
Contact: <sip:[EMAIL PROTECTED]>.
Accept: application/sdp.
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, UPDATE, REFER, NOTIFY, INFO.
Content-Type: application/sdp.
Content-Length: 265.
Max-Forwards: 69.
.
v=0.
o=7772405000 1227271192 1227271192 IN IP4 10.10.10.220.
s=AddPac Gateway SDP.
c=IN IP4 10.10.10.220.
t=1227271192 0.
m=audio 23412 RTP/AVP 18 4 101.
a=rtpmap:18 G729/8000.
a=rtpmap:4 G723/8000.
a=rtpmap:101 telephone-event/8000.
a=fmtp:101 0-15.
a=ptime:20.


U 10.10.10.212:5060 -> 10.10.10.198:5060
INVITE sip:[EMAIL PROTECTED]:5060;transport=udp SIP/2.0.
Record-Route: <sip:10.10.10.212;lr=on>.
Via: SIP/2.0/UDP 10.10.10.212;branch=z9hG4bK1fcb.9a6456a1.1.
Via: SIP/2.0/UDP 10.10.10.220:5060;branch=z9hG4bK1849d16ca4198.
From: <sip:[EMAIL PROTECTED]>;tag=1849d16ca4.
To: <sip:[EMAIL PROTECTED]>.
Call-ID: [EMAIL PROTECTED]
CSeq: 198 INVITE.
Supported: timer, replaces, early-session.
Min-SE: 1800.
Date: Fri, 21 Nov 2008 12:39:52 GMT.
User-Agent: AddPac SIP Gateway.
Contact: <sip:[EMAIL PROTECTED]>.
Accept: application/sdp.
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, UPDATE, REFER, NOTIFY, INFO.
Content-Type: application/sdp.
Content-Length: 265.
Max-Forwards: 69.
.
v=0.
o=7772405000 1227271192 1227271192 IN IP4 10.10.10.220.
s=AddPac Gateway SDP.
c=IN IP4 10.10.10.220.
t=1227271192 0.
m=audio 23412 RTP/AVP 18 4 101.
a=rtpmap:18 G729/8000.
a=rtpmap:4 G723/8000.
a=rtpmap:101 telephone-event/8000.
a=fmtp:101 0-15.
a=ptime:20.


U 10.10.10.212:5060 -> 10.10.10.198:5060
INVITE sip:[EMAIL PROTECTED]:5060;transport=udp SIP/2.0.
Record-Route: <sip:10.10.10.212;lr=on>.
Via: SIP/2.0/UDP 10.10.10.212;branch=z9hG4bK1fcb.9a6456a1.1.
Via: SIP/2.0/UDP 10.10.10.220:5060;branch=z9hG4bK1849d16ca4198.
From: <sip:[EMAIL PROTECTED]>;tag=1849d16ca4.
To: <sip:[EMAIL PROTECTED]>.
Call-ID: [EMAIL PROTECTED]
CSeq: 198 INVITE.
Supported: timer, replaces, early-session.
Min-SE: 1800.
Date: Fri, 21 Nov 2008 12:39:52 GMT.
User-Agent: AddPac SIP Gateway.
Contact: <sip:[EMAIL PROTECTED]>.
Accept: application/sdp.
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, UPDATE, REFER, NOTIFY, INFO.
Content-Type: application/sdp.
Content-Length: 265.
Max-Forwards: 69.
.
v=0.
o=7772405000 1227271192 1227271192 IN IP4 10.10.10.220.
s=AddPac Gateway SDP.
c=IN IP4 10.10.10.220.
t=1227271192 0.
m=audio 23412 RTP/AVP 18 4 101.
a=rtpmap:18 G729/8000.
a=rtpmap:4 G723/8000.
a=rtpmap:101 telephone-event/8000.
a=fmtp:101 0-15.
a=ptime:20.


U 10.10.10.212:5060 -> 10.10.10.198:5060
INVITE sip:[EMAIL PROTECTED]:5060;transport=udp SIP/2.0.
Record-Route: <sip:10.10.10.212;lr=on>.
Via: SIP/2.0/UDP 10.10.10.212;branch=z9hG4bK1fcb.9a6456a1.1.
Via: SIP/2.0/UDP 10.10.10.220:5060;branch=z9hG4bK1849d16ca4198.
From: <sip:[EMAIL PROTECTED]>;tag=1849d16ca4.
To: <sip:[EMAIL PROTECTED]>.
Call-ID: [EMAIL PROTECTED]
CSeq: 198 INVITE.
Supported: timer, replaces, early-session.
Min-SE: 1800.
Date: Fri, 21 Nov 2008 12:39:52 GMT.
User-Agent: AddPac SIP Gateway.
Contact: <sip:[EMAIL PROTECTED]>.
Accept: application/sdp.
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, UPDATE, REFER, NOTIFY, INFO.
Content-Type: application/sdp.
Content-Length: 265.
Max-Forwards: 69.
.
v=0.
o=7772405000 1227271192 1227271192 IN IP4 10.10.10.220.
s=AddPac Gateway SDP.
c=IN IP4 10.10.10.220.
t=1227271192 0.
m=audio 23412 RTP/AVP 18 4 101.
a=rtpmap:18 G729/8000.
a=rtpmap:4 G723/8000.
a=rtpmap:101 telephone-event/8000.
a=fmtp:101 0-15.
a=ptime:20.


U 10.10.10.212:5060 -> 10.10.10.220:5060
SIP/2.0 503 No more DB routes.
Via: SIP/2.0/UDP 10.10.10.220:5060;branch=z9hG4bK1849d16ca4198.
From: <sip:[EMAIL PROTECTED]>;tag=1849d16ca4.
To: <sip:[EMAIL PROTECTED]>;tag=33ed0c8cc3fc2cb3288f880711d86b60.e22f.
Call-ID: [EMAIL PROTECTED]
CSeq: 198 INVITE.
Server: Kamailio (1.4.2-notls (i386/linux)).
Content-Length: 0.
.


U 10.10.10.212:5060 -> 10.10.10.220:5060
SIP/2.0 408 Request Timeout.
Via: SIP/2.0/UDP 10.10.10.220:5060;branch=z9hG4bK1849d16ca4198.
From: <sip:[EMAIL PROTECTED]>;tag=1849d16ca4.
To: <sip:[EMAIL PROTECTED]>;tag=080045f684166daf23ca0b8d8f96444d-e22f.
Call-ID: [EMAIL PROTECTED]
CSeq: 198 INVITE.
Server: Kamailio (1.4.2-notls (i386/linux)).
Content-Length: 0.
.


U 10.10.10.220:5060 -> 10.10.10.212:5060
ACK sip:[EMAIL PROTECTED] SIP/2.0.
Via: SIP/2.0/UDP 10.10.10.220:5060;branch=z9hG4bK1849d16ca4198.
From: <sip:[EMAIL PROTECTED]>;tag=1849d16ca4.
To: <sip:[EMAIL PROTECTED]>;tag=33ed0c8cc3fc2cb3288f880711d86b60.e22f.
Call-ID: [EMAIL PROTECTED]
CSeq: 198 ACK.
Content-Length: 0.
Max-Forwards: 70.
.


U 10.10.10.220:5060 -> 10.10.10.212:5060
ACK sip:[EMAIL PROTECTED] SIP/2.0.
Via: SIP/2.0/UDP 10.10.10.220:5060;branch=z9hG4bK1849d16ca4198.
From: <sip:[EMAIL PROTECTED]>;tag=1849d16ca4.
To: <sip:[EMAIL PROTECTED]>;tag=33ed0c8cc3fc2cb3288f880711d86b60.e22f.
Call-ID: [EMAIL PROTECTED]
CSeq: 198 ACK.
Content-Length: 0.
Max-Forwards: 70.
.


U 10.10.10.212:5060 -> 10.10.10.220:5060
SIP/2.0 408 Request Timeout.
Via: SIP/2.0/UDP 10.10.10.220:5060;branch=z9hG4bK1849d16ca4198.
From: <sip:[EMAIL PROTECTED]>;tag=1849d16ca4.
To: <sip:[EMAIL PROTECTED]>;tag=080045f684166daf23ca0b8d8f96444d-e22f.
Call-ID: [EMAIL PROTECTED]
CSeq: 198 INVITE.
Server: Kamailio (1.4.2-notls (i386/linux)).
Content-Length: 0.
.


U 10.10.10.220:5060 -> 10.10.10.212:5060
ACK sip:[EMAIL PROTECTED] SIP/2.0.
Via: SIP/2.0/UDP 10.10.10.220:5060;branch=z9hG4bK1849d16ca4198.
From: <sip:[EMAIL PROTECTED]>;tag=1849d16ca4.
To: <sip:[EMAIL PROTECTED]>;tag=33ed0c8cc3fc2cb3288f880711d86b60.e22f.
Call-ID: [EMAIL PROTECTED]
CSeq: 198 ACK.
Content-Length: 0.
Max-Forwards: 70.
.


U 10.10.10.212:5060 -> 10.10.10.220:5060
SIP/2.0 408 Request Timeout.
Via: SIP/2.0/UDP 10.10.10.220:5060;branch=z9hG4bK1849d16ca4198.
From: <sip:[EMAIL PROTECTED]>;tag=1849d16ca4.
To: <sip:[EMAIL PROTECTED]>;tag=080045f684166daf23ca0b8d8f96444d-e22f.
Call-ID: [EMAIL PROTECTED]
CSeq: 198 INVITE.
Server: Kamailio (1.4.2-notls (i386/linux)).
Content-Length: 0.
.


U 10.10.10.220:5060 -> 10.10.10.212:5060
ACK sip:[EMAIL PROTECTED] SIP/2.0.
Via: SIP/2.0/UDP 10.10.10.220:5060;branch=z9hG4bK1849d16ca4198.
From: <sip:[EMAIL PROTECTED]>;tag=1849d16ca4.
To: <sip:[EMAIL PROTECTED]>;tag=33ed0c8cc3fc2cb3288f880711d86b60.e22f.
Call-ID: [EMAIL PROTECTED]
CSeq: 198 ACK.
Content-Length: 0.
Max-Forwards: 70.
.
....snnipet...

        ## Ruteo a LCR  para determinar destino.
        #

        if (avp_load_radius("caller")) {
                if (uri=~"^sip:$") {
                        sl_send_reply("403","Forbidden => CALL BLOCK 
(SIPQUEST)");
                        xlog("L_INFO", "[$ci] MAIN : LLamada bloqueada desde BD 
ruta 3");
                        exit;
                };
                $avp(i:1)=0;
                route(3);
        } else {
                sl_send_reply("403","Forbidden => CAN'T TRANSLATE");
                xlog("L_INFO", "[$ci] MAIN : Falla avp_load_radius");
                exit;
        };

        #route(3); 
}

#
#
# -- 3 --  Seccion de Rutas
#
#

route[1] {

        # 
        ### Entrego el request al target.
        #
        t_on_failure("1");
        if (!t_relay()) {
                sl_reply_error();
        };
        xlog("L_INFO","[$ci] RUTA1 : $rm t_relay a $ru");
        exit;
}

route[2] {

        #
        ###  Este servidor no maneja REGISTROS.
        #

        sl_send_reply("503","Wrong Method REGISTER, contact your VoIP 
provider");
        exit;
}


route[3] {

        #
        ###  LCR
        #

        $var(nr)=$avp(s:caller_nr);
        $var(rd)=$avp(s:caller_rd);


        if( $avp(i:1) < $var(nr) ) {
                $var(i)=$avp(i:1);

                $avp(s:ruta)=$(var(rd){param.valueat,$var(i)});

                xlog("L_INFO", "[$ci] RUTA3::ruta : avp_ruta = $avp(s:ruta)");
                if( !avp_pushto("$ru/username","$avp(s:ruta)/g") ) {
                        sl_send_reply("403","Forbidden - Problemas BD ruta 3");
                        xlog("L_INFO", "[$ci] RUTA3::ruta : Falla AVP_PUSHTO");
                        exit;
                };

                avp_delete("$avp(i:500)/g");
                $avp(i:500) = $avp(s:ruta);
                avp_delete("$avp(s:ruta)/g");

                if (!load_gws()) {
                        sl_send_reply("503", "Unable to load gateways");
                        exit;
                }
                if (!next_gw())  {
                        sl_send_reply("503", "Unable to find a gateway");
                        exit;
                }
                xlog("L_INFO", "[$ci] RUTA3::ruta : cambiando $ou por $ru");
                $avp(i:1)= $avp(i:1) + 1;
                route(1);
        } else {
                sl_send_reply("503", "NO hay mas rutas BD");
                xlog("L_INFO", "[$ci] RUTA3::ruta : No hay mas rutas desde la 
BD para  $rm:$ou\n");
                exit;
        }
}

failure_route[1] {
        xlog("L_INFO", "[$ci] FAILURE_ROUTE : $rm:$ru failure_route\n");

        if (t_was_cancelled()) {
                xlog("L_INFO", "[$ci] FAILURE_ROUTE::cancelled : $rm:$ru 
t_was_cancelled en failure_route\n");
                exit;
        }


        if (!next_gw()) {
                xlog("L_INFO", "[$ci] FAILURE_ROUTE::lcr : No hay mas gateways 
para $rm:$ou\n");
                update_stat("fail_over_route", "+1");
                route(3);
        } else  {
                xlog("L_INFO", "[$ci] FAILURE_ROUTE::lcr : $rm cambiando $ou 
por $ru en failure_route");
        }

        t_on_failure("1");
        t_relay();
}
_______________________________________________
Users mailing list
Users@lists.kamailio.org
http://lists.kamailio.org/cgi-bin/mailman/listinfo/users

Reply via email to