[Users] Call forward when no answer

Bill Neely ceo at xantek.cc
Thu May 17 21:16:47 CEST 2007


I am having a very similar problem. Using v1.2.0

 Here is my route:
route[1] {

if(isflagset(2))
    t_on_failure("2");

   
    if (!t_relay()) {
        sl_reply_error();
    };
    exit;
}

failure_route[2]
{
    if ( t_check_status("408"))

    {
        xlog("L_ERR","rrreeeeeeeeeeeeeeeeeecalling froute2 <$rm><$ru>\n");
        avp_pushto("$ruri", "$avp(i:10)");
        prefix("777");
        # route to Asterisk Media Server
        rewritehostport("66.xxx.20.50:5060");
        resetflag(2);
       
        xlog("L_ERR","22222222222222222222calling froute2 <$rm><$ruri>\n");
        route(1);   
   

    }
    exit;
}

Here is error message received:

 1(53165) rrreeeeeeeeeeeeeeeeeecalling froute2 
<INVITE><sip:1020101 at 67.188.xxx.188:35937;rinstance=e867c589f1896b12>
 1(53165) 22222222222222222222calling froute2 
<INVITE><sip:7771020101 at 66.xxx.20.50:5060;rinstance=e867c589f1896b12>
 1(53165) ERROR:tm:t_forward_nonack: no branch for forwarding
 1(53165) ERROR:tm:w_t_relay: t_forward_nonack failed

Bogdan-Andrei Iancu wrote:
> Check with log/xlog prints if it gets to t_on_failure() and  into 
> failure route.
>
> regards,
> Bogdan
>
> Howard Tang wrote:
>> HI Bogdan,
>>  
>> Thank you for your reply. I did that but i forget to include in this 
>> email.
>>  
>>
>> route[1] {
>>        #check for nat flag
>>        if (isflagset(2))
>>        {
>>                fix_nated_contact();
>>                use_media_proxy();
>>        }
>>
>>        t_on_reply("1");
>>        t_on_failure("1");
>>
>>        # send it out now; use stateful forwarding as it works reliably
>>        # even for UDP2TCP
>>        xlog("L_INFO", "Request leaving server - M=$rm RURI=$ru F=$fu 
>> T=$tu IP=$si ID=$ci\n");
>>        if (!t_relay()) {
>>                if(isflagset(2))
>>                        end_media_session();
>>                sl_reply_error();
>>        };
>>        exit;
>> }
>>
>> The voice mail work fine only when someone call in and the UA is 
>> offline (not registered to the openser), if the UA is online, the 
>> call will ring the UA until the caller hang up.
>>  
>> I want to set up some sort of timer, i.e. 60 second and the call will 
>> forwarded to the Voice mail.
>>  
>> Can you suggest me an idea on how i can make this happen please?
>>  
>> Regards,
>> Howard
>>
>>
>>  
>> On 5/17/07, *Bogdan-Andrei Iancu* <bogdan at voice-system.ro 
>> <mailto:bogdan at voice-system.ro>> wrote:
>>
>>     Hi Howard,
>>
>>     I guess you do not arm the failure route - use t_on_failure("1");
>>     before
>>     relaying the request.
>>
>>     regards,
>>     bogdan
>>
>>     Howard Tang wrote:
>>     > Hi All,
>>     >
>>     > I have followed a tutorial and set up Asterisk as a voice mail
>>     server.
>>     >
>>     >
>>     
>> http://www.voip-info.org/wiki/view/Realtime+Integration+Of+Asterisk+With+OpenSER 
>>
>>     >
>>     
>> <http://www.voip-info.org/wiki/view/Realtime+Integration+Of+Asterisk+With+OpenSER 
>>
>>     
>> <http://www.voip-info.org/wiki/view/Realtime+Integration+Of+Asterisk+With+OpenSER>> 
>>
>>     >
>>     > It works fine when the UA is offline. Now, I want a call
>>     forwarded to
>>     > the Voice mail server when there is no answer from the UA after 60
>>     > seconds(UA is registered on the openser).
>>     >
>>     > What should I do? Below is my config (copy from the above link).
>>     >
>>     >
>>     >               # requests for Media server
>>     >               if(is_method("INVITE") && !has_totag() &&
>>     uri=~"sip:\*9") {
>>     >                       route(3);
>>     >                       exit;
>>     >               }
>>     >
>>     >               # mark transaction if user is in voicemail group
>>     >
>>     >               if(is_method("INVITE") && !has_totag()
>>     >                       && is_user_in("Request-URI","voicemail"))
>>     >               {
>>     >                       xdbg("user [$ru] has voicemail redirection
>>     enabled\n");
>>     >
>>     >                       # backup R-URI
>>     >                       avp_write("$ruri", "i:10");
>>     >                       setflag(2);
>>     >               };
>>     >
>>     >               # native SIP destinations are handled using our
>>     USRLOC DB
>>     >               if (!lookup("location")) {
>>     >                       if(isflagset(2)) {
>>     >
>>     >                               # route to Asterisk Media Server
>>     >                               prefix("1");
>>     >                               rewritehostport("10.10.10.11:5060
>>     <http://10.10.10.11:5060> <http://10.10.10.11:5060>");
>>     >                               route(1);
>>     >                       } else {
>>     >                               sl_send_reply("404", "Not Found");
>>     >
>>     >                               exit;
>>     >                       }
>>     >               };
>>     >
>>     > # voicemail access
>>     > # - *98 - listen caller's voice messages, being prompted for pin
>>     > # - *981 - listen voice messages, being promted for mailbox and 
>> pin
>>     > # - *98XXXX - leave voice message to XXXX
>>     >
>>     > #
>>     > route[3] {
>>     >       # direct voicemail
>>     >       if (uri =~ "sip:\*98@" ) {
>>     >               rewriteuser("1");
>>     >               xdbg("voicemail access\n");
>>     >       } else if (uri =~ "sip:\*981@" ) {
>>     >
>>     >               strip(4);
>>     >               rewriteuser("11");
>>     >       } else if (uri =~ "sip:\*98.+@" ) {
>>     >               strip(3);
>>     >               prefix("1");
>>     >       } else {
>>     >               xlog("unknown media extension $rU\n");
>>     >               sl_send_reply("404", "Unknown media service");
>>     >
>>     >               exit;
>>     >       }
>>     >
>>     >       # route to Asterisk Media Server
>>     >       rewritehostport("10.10.10.11:5060
>>     <http://10.10.10.11:5060> < http://10.10.10.11:5060>");
>>     >       route(1);
>>     > }
>>     >
>>     > failure_route[1] {
>>     >       if (t_was_cancelled()) {
>>     >
>>     >               xdbg("transaction was cancelled by UAC\n");
>>     >               return;
>>     >       }
>>     >       # restore initial uri
>>     >       avp_pushto("$ruri", "i:10");
>>     >       prefix("1");
>>     >       # route to Asterisk Media Server
>>     >
>>     >       rewritehostport("10.10.10.11:5060
>>     <http://10.10.10.11:5060> <http://10.10.10.11:5060>");
>>     >       resetflag(2);
>>     >       route(1);
>>     >
>>     > }
>>     >
>>     >
>>     >
>>     
>> ------------------------------------------------------------------------
>>     >
>>     > _______________________________________________
>>     > Users mailing list
>>     > Users at openser.org <mailto:Users at openser.org>
>>     > http://openser.org/cgi-bin/mailman/listinfo/users
>>     >
>>
>>
>>
>>
>>
>>
>> -- 
>> Howard Tang
>> ICQ : 259083
>> MSN : howard615 at hotmail.com <mailto:howard615 at hotmail.com> 
>
>
> _______________________________________________
> Users mailing list
> Users at openser.org
> http://openser.org/cgi-bin/mailman/listinfo/users

-- 
Bill Neely
Xantek, Inc.
1-866-553-3833
1-702-874-3833





More information about the sr-users mailing list