[Serusers] SER avpops avp_pushto

Shaun Hofer shaun.hofer at altcall.com
Tue Aug 1 03:19:31 CEST 2006


When I try to use avp_pushto() in one section of ser.cfg it works and in 
another section it doesn't. When I use it to out right forward a call it 
works fine (callfwd). When it's used in the failure_route[1] it doesn't seem 
to push a value onto ruri (I have made sure that avp_db_load() has been 
called/used) . I'm wondering if avp_pushto() one of those methods that can't 
be called from a failed route ?

I get the following error when I use it:
ERROR: t_forward_nonack: no branched for forwarding
ERROR: w_t_relay (failure mode): forwarding failed
ERROR: sl_reply_error used: I'm terribly sorry, server error occurred (1/SL)

I tried taking away voicemail section in  failure_route[1] and made sure I was 
phoning extension with a number instead of 'voicemail' in value column of the 
database. That made no difference. When I tried adding append_branch() after 
avp_pushto() it just ends up ringing the original phone number again.

Thanks in advance
-Shaun

route[1] {
        # ----------------------------------------------------------
        # Default Message Handler
        # ----------------------------------------------------------
        t_on_reply("1");
        if (!t_relay()) {
                if (method=="INVITE" || method=="ACK") {
                        end_media_session();
                };
                sl_reply_error();
        };
}
route[3] {
        # ----------------------------------------------------------
        # INVITE Message Handler
        # ----------------------------------------------------------
        if (!allow_trusted()) {
                if (!proxy_authorize("","subscriber")) {
                        proxy_challenge("","0");
                        break;
                } else if (!check_from()) {
                        sl_send_reply("403", "Use From=ID");
                        break;
                };
                consume_credentials();
        };
        if (client_nat_test("3")) {
                setflag(7);
                force_rport();
                fix_nated_contact();
        };
        lookup("aliases");
        if (uri!=myself) {
                route(4);
                route(1);
                break;
        };
        if (avp_db_load("$ruri/username", "s:callfwd")) {
                setflag(22);
                avp_pushto("$ruri", "s:callfwd");
                route(6);
                break;
        };
        if (!lookup("location")) {
                 if (uri=~"^sip:0[1-9][0-9]{8}") { # Domestic PSTN 
                        route(4);
                        route(5);
                        break;
                };
		sl_send_reply("404", "User Not Found");
                break;
        };
        if (avp_db_load("$ruri/username", "s:fwdnoanswer")) {
                if (!avp_check("s:fwdnoanswer", "eq/$ruri/i")) {
                        setflag(27);

                };
        };
        log(1,"t on fail \n");
        t_on_failure("1");
        route(4);
        route(1);
}
             

route[4] {
        # ----------------------------------------------------------
        # NAT Traversal Section
        # ----------------------------------------------------------
        if (isflagset(6) || isflagset(7) || isflagset(11)) {
                if (!isflagset(8)) {
                         setflag(8);
                         use_media_proxy();
                 };
        };
}

route[6] {
        #  ----------------------------------------------------------
        #  Call Forwarding Handler
        #  ----------------------------------------------------------
        lookup("aliases");
        if (uri!=myself) {
                 if (!isflagset(22)) {
                         append_branch();
                 };
                 route(4);
                 route(1);
                 break;
        };
        if (!lookup("location")) {
                 if (uri=~"^sip:88[0-9]{8}") { # Offline VoIP Network user 
sent to * for voicemail
                       route(4);
                       route(5);
                       break;
                 };
                 sl_send_reply("404", "User Not Found");
                 break;
        };
        route(4);
        route(1);
}

failure_route[1] {
        if (t_check_status("487")) {
                break;
        };
        if (isflagset(26) && t_check_status("408")) {
                if (avp_check("s:fwdnoanswer","eq/voicemail/I")) { 
                        avp_delete("s:fwdnoanswer"); 
                        resetflag(26);
                        revert_uri();
                        rewritehostport("x.x.x.x:5060");#goto voicemail server
                        append_branch();
                        t_relay_to_udp("x.x.x.x", "5060");
                        break;
                } else {
                        avp_pushto("$ruri", "s:fwdnoanswer");
                        avp_delete("s:fwdnoanswer");
                        resetflag(26);
                        route(6);
                        break;
                };
        };
       
        end_media_session();
}





More information about the sr-users mailing list