[Users] Call forward when no answer

Bogdan-Andrei Iancu bogdan at voice-system.ro
Thu May 17 15:49:15 CEST 2007


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> 





More information about the sr-users mailing list