Asterisk Call Flow

I would like to configure my asterisk like, if a person is not available in particular extension asterisk will give the option like " Press 1 to leave a voice message, Press 2 for the main menu, Press 3 to Exit". My Current asterisk extension configuration is like this,

[default]

include => employee

exten => s,1,Wait(1)
exten => s,2,Answer()
exten => s,3,Background(welcome)
exten => s,4,WaitExten(10)
exten => s,5,Background(welcome)
exten => s,6,WaitExten(10)
exten => s,7,Goto(280,1)
exten => s,8,Hangup()


[submenu]
include => default
include => employee

exten => s,1,Wait(1)
exten => s,n,Background(1-main-2-exit)
exten => s,n,WaitExten(10)
exten => s,n,Playback(vm-goodbye)
exten => s,n,Hangup()
exten => 1,1,Goto(default,s,3)
exten => 2,1,PlayBack(vm-goodbye)
exten => 2,1,Hangup()


[employee]

include => submenu

exten => 294,1,Dial(SIP/294,20,rtT)
exten => 294,2,VoiceMail(294@voicemail)
exten => 218,4,Goto(submenu,s,1)


exten => 218,1,Dial(SIP/218,20,rtT)
exten => 218,2,VoiceMail(218@voicemail)
exten => 218,4,Goto(submenu,s,1)


exten => 281,1,Dial(SIP/281,20,rtT)
exten => 281,2,VoiceMail(281@voicemail)
exten => 218,4,Goto(submenu,s,1)


exten => 282,1,Dial(SIP/282,20,rtT)
exten => 282,2,voiceMail(282@voicemail)
exten => 218,4,Goto(submenu,s,1)

Please help me to configure asterisk as my need.

Krishna

Try This:

[default]

include => employee

exten => s,1,Wait(1)
exten => s,2,Answer()
exten => s,3,Background(welcome)
exten => s,4,WaitExten(10)
exten => s,5,Background(welcome)
exten => s,6,WaitExten(10)
exten => s,7,Goto(280,1)
exten => s,8,Hangup()


[employee]
Exten => 294,1,Set(their_exten=294)
exten => 294,2,Dial(SIP/294,20,rtT)
exten => 294,n,Goto(leave-message,s,1)

Exten => 218,1,Set(their_exten=218)
exten => 218,2,Dial(SIP/218,20,rtT)
exten => 218,n,Goto(leave-message,s,1)

Exten => 281,1,Set(their_exten=281)
exten => 281,2,Dial(SIP/281,20,rtT)
exten => 281,n,Goto(leave-message,s,1)

Exten => 282,1,Set(their_exten=282)
exten => 282,2,Dial(SIP/282,20,rtT)
exten => 282,n,Goto(leave-message,s,1)

[leave-message]
Exten => s,1,Background(to-leave-message)

Exten => 1,1,Voicemail(${their_exten})

Exten => 2,1,Goto(default,s,1)

Exten => 3,1,Hangup

When some one dials their extension it sets the value of their extension to the variable ${their_exten}. We then try to call their phone. If they do not pick up, if the phone is on DND etc. it then goes to the leave-message context where they are given their options (you will need to record the file for that message). If the person wants to leave a message we use the ${their_exten} variable to know which mailbox to send the call to.