Extension help

Hello,

I would like to tell an extension to ring a a user for 30secs then if there is no answer goto the user’s mailbox.

So far I’ve figured out how to make it dial the extension as shown below

[iax-inbound]
exten => 777777,1,Dial(SIP/1000)

but essentially what I would like to do is: (please correct me if I’m wrong)
[iax-inbound]
exten => 777777,n,if(Dial(SIP/1000)=noanswer)
exten => 777777,n,go to USER 1000 voice mail

I don’t know how to put this into the correct code for asterisk to respond accordingly.

Thank you for any help I receive.

heres how i do it…

exten => _XXX,n,Dial(SIP/${EXTEN},20,r)
exten => _XXX,n,Goto(s-${DIALSTATUS},1)

exten => s-CONGESTION,1,Voicemail(u${ARG1}@default)
exten => s-NOANSWER,1,Voicemail(u${ARG1}@default)
exten => s-CHANUNAVAIL,1,Voicemail(u${ARG1}@default)
exten => s-BUSY,1,Voicemail(b${ARG1}@default)
exten => _s-.,1,Voicemail(u${ARG1}@default)

Dial the exten for 20 seconds (and provide the ring)… If a no go on that goto the dialstatus section…

@default is what i setup at the voicemail context…

clear as mud?

I tried it with my context but doesn’t go to voicemail

I will have multiple numbers so have to pass the for the extension.

Here’s the full context

[iax-inbound]
exten => 704222,n,Dial(SIP/1002,20,r)
exten => 704422,n,Goto(s-${DIALSTATUS},1)

exten => 704398,1,Dial(SIP/1003)
exten => 704427,1,Dial(SIP/1001)
exten => 704500,1,Dial(SIP/1004)

exten => s-CONGESTION,1,Voicemail(u${ARG1}@default)
exten => s-NOANSWER,1,Voicemail(u${ARG1}@default)
exten => s-CHANUNAVAIL,1,Voicemail(u${ARG1}@default)
exten => s-BUSY,1,Voicemail(b${ARG1}@default)
exten => _s-.,1,Voicemail(u${ARG1}@default)

We have this implemented as a macro shown below. Works just fine. Can you post the console output please?

[macro-stdext]
exten => s,1,Dial(SIP/${MACRO_EXTEN},15,rtT)
exten => s,n,Goto(s-${DIALSTATUS},1)
exten => s-NOANSWER,1,VoiceMail(${MACRO_EXTEN}@${MACRO_CONTEXT},us)
exten => s-BUSY,1,VoiceMail(${MACRO_EXTEN}@${MACRO_CONTEXT},bs)
exten => s-ANSWER,1,Hangup()
exten => _s-.,1,Goto(s-NOANSWER,1)
;

And it is called like this:

exten => XXXXXXXXXX,1,Macro(stdext)

Just to check it worked without any variables

here’s what I did and it worked

[iax-inbound]
exten => 704422,1,Dial(SIP/1002,20,r)
exten => 704422,2,Goto(s-${DIALSTATUS},1)

exten => s-CONGESTION,1,Voicemail(u1002@default)
exten => s-NOANSWER,1,Voicemail(u1002@default)
exten => s-CHANUNAVAIL,1,Voicemail(u1002@default)
exten => s-BUSY,1,Voicemail(b1002@default)
exten => _s-.,1,Voicemail(u1002@default)

Now your idea of the macro is actually sounding great to me

How could I put the about into a macro

for e.g.

exten => 704422,1,Macro(try-user, 1002, 704422)

in which the “try-user” is the name of the macro, “1002” is the extension I want to pass in to the macro, and “704422” what needs to be matched for ${dialstatus}

Thanks guys, really appreciate it.

[macro-iaxdial]
exten => s,1,Dial(SIP/${ARG1},20,r)
exten => s,2,Goto(s-${DIALSTATUS},1)
exten => s-CONGESTION,1,Voicemail(u${ARG1}@default)
exten => s-NOANSWER,1,Voicemail(u{$ARG1}@default)
exten => s-CHANUNAVAIL,1,Voicemail(u${ARG1}@default)
exten => s-BUSY,1,Voicemail(b${ARG1}@default)
exten => _s-.,1,Voicemail(u${ARG1}@default)
;

[iax-inbound]
exten => 704422,1,Macro(iaxdial,1002)

;
; Thanks guys, it’s encouraged me to read the asterisk syntax documentation. I’ll refer to documentation in future as I think it’s a good idea to understand the language that asterisk uses. Thank both of you for pointing me in the right direction, couldn’t have achieved the result without your help. very much appreciated.
;
;

Here’s good reference site:

http://www.the-asterisk-book.com/unstable/bk01-toc.html