[Asterisk-Users] Menu/IVR and transfering to an extension after pressing an option number.

Rich Adamson radamson at routers.com
Wed Oct 19 04:35:09 MST 2005


> 
> Here's what I'm trying to accomplish:
> 
> Press 1 to transfer to extension
> Press 2 for Directory
> Press 0 for Operator
> 
> Got directory and operator working. My problem is with transfering to an 
> extension after pressing 1. Asterisk keeps adding the 1 to the extension 
> that I need to transfer to (extension 500 would be 1500 to asterisk 
> rathern than 500). I've tried ${EXTEN}, ${EXTEN:1},2,3,4 etc..No luck.
> 
> This is what I have currently:
> 
> [MainMenu]
> include => extensions
> 
> exten => s,1,Answer
> exten => s,2,SetMusicOnHold(default)
> exten => s,3,Set(TIMEOUT(digit)=5)
> exten => s,4,Set(TIMEOUT(response)=10)
> exten => s,5,Background(danner) ; Play Welcome to companyname greeting
> exten => i,1,Playback(invalid)
> exten => i,2,GoTo(MainMenu,s,1)
> 
> 
> ; Dial an extension
> exten => 1,1,Dial(SIP/${EXTEN:1})
> 
> 
> ; Go to the sales department
> exten => 2,1,Directory(extensions) ;
> 
> ; Leave; a voicemail for the operator
> exten => 0,1,Dial(${P100}&${P103},30,t) ;
> 
> 
> Can anybody be of any assistance?

The above should work with a couple of small changes (I'm using basically
the same thing).

Change your greating message to say something like "... or if you know
the extension, you may dial it at any time".  Then, dumpt the press "1"
stuff.

Change your logic to something like this:
[bus-ivr-main]                                                                  
exten => s,1,Wait,1    
exten => s,2,Answer         
exten => s,3,Set(TIMEOUT(digit)=5)                                              
exten => s,4,Set(TIMEOUT(response)=15)

exten => s,5,Background(npi-greeting)  ; "Thanks for calling press 1 for"       
exten => s,6,WaitExten                       
exten => s,7,Goto(bus-ivr-main|s|3)    
include => local-calls
include => local-extns

exten => 1,1,Goto(local-extns|3026|1) ; Sales
exten => 8,1,Goto(abclist|s|1)        ; Company directory list
exten => 0,1,Goto(local-extns|3000|1) ; Operator
exten => *,1,Goto(vm|s|1)	; go to voicemail menu
exten => #,1,Background(vm-goodbye)

The above essentially allows the caller to press 1, 8, 0, *, or # (as an 
example only); and if they know the extension, the "include => local-extns"
send other key-presses through the local-extns context.

The key statement about is the "WaitExten", allowing asterisk to pick up
one or more key presses.





More information about the asterisk-users mailing list