OK, this is how I thought it's supposed to work. It just confounded me why the book would say the Playback() and Background() syntax were the same, then in the very next paragraph give an example that belied that claim.

On 6/17/2023 1:46 PM, Doug Lytle wrote:
On 6/17/23 08:47, Steve Matzura wrote:

Both Background()  and WaitExten()  allow the caller to enter DTMF digits. Asterisk then attempts to find an extension in the current context that matches the digits that the caller entered. If Asterisk finds a match, it will send the call to that extension.


My question then is, is "*" a valid exension, as in:


I'd have to assume yes.  I don't use WaitExten() and I set autofallthrough=no in the /etc/asterisk.conf, since that is the way I've always expected Asterisk to work; my dialplan examples are based on that.

The below example shows a call coming into a DID, playing background prompts and excepting input during play.


;****************
;* Auto attendant
;****************

exten => 5175551212,1,Gosub(check-blacklist,s,1)
     same => n,Gosub(check-hours,s,1)
     same => n,Gosub(holiday-check,s,1)
     same => n,Gosub(get-callerid,s,1)
     same => n,Goto(auto-attend,s,1)

[auto-attend]

include => dial-by-extension

;*************
;* Set timeouts
;*************

exten => s,1,Set(TIMEOUT(response)=8)
     same => n,Set(TIMEOUT(digit)=2)
     same => n,Set(LOOPCOUNT=0)

     same => n,GotoIf($["${Holiday}" = "YES"]?HOLIDAY:BEGIN)
     same => n(BEGIN),Answer()
     same => n,Wait(1)

;****************************************************
;* Play the 'Welcome message' and office hours message
;****************************************************

     same => n,Background(${voice}/welcome)
     same => n,Background(${voice}/business_hours)
     same => n,Background(${voice}/8am_5pm)
     same => n(HOLIDAY),Background(${voice}/dial_anytime)
     same => n(DIRECTORY),Background(${voice}/directory_assist)
     same => n,Background(${voice}/press_1)
     same => n,Background(${voice}/to_ring_after_hours)
     same => n,Background(${voice}/press_2)
     same => n,Background(${voice}/absence_delay)
     same => n,Background(${voice}/press_3)

;************************************
;* If 1 is pressed, go to Dial by name
;************************************

exten => 1,1,Goto(directory,s,1)

;***************************************
;* If 2 is pressed, dial the Foyer phone
;***************************************

exten => 2,1,Goto(dial-by-extension,4255,1)

;***********************************************
;* If 3 is pressed, dial absence/delay extension
;***********************************************

exten => 3,1,Gosub(cellphone-callerid,s,1)
exten => 3,n,Voicemail(3888@sip,us)
exten => 3,n,Hangup()

;********************************************
;* If 8# is pressed, go to Voicemail Main menu
;********************************************

exten => 8#,1,VoiceMailMain(@sip)
exten => 8#,2,Hangup()

This is not the complete dialplan; I also have error checking and a loop counter.

Doug

-- 
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

Check out the new Asterisk community forum at: https://community.asterisk.org/

New to Asterisk? Start here:
      https://wiki.asterisk.org/wiki/display/AST/Getting+Started

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users

Reply via email to