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;
}
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 >
>
> 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>");
> 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>");
> 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>");
> resetflag(2);
> route(1);
>
> }
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Users mailing list
> Users@openser.org
> http://openser.org/cgi-bin/mailman/listinfo/users
>