Steve Matzura
2023-Jun-17 22:47 UTC
[asterisk-users] Expanding my answering-machine system
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 at 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 > >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.digium.com/pipermail/asterisk-users/attachments/20230617/8126ead5/attachment.html>
Joshua C. Colp
2023-Jun-17 23:27 UTC
[asterisk-users] Expanding my answering-machine system
On Sat, Jun 17, 2023 at 7:48 PM Steve Matzura <sm at noisynotes.com> wrote:> 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. >The syntax is the same. They both take a filename. The example gave a filename of "enter-ext-of-person". You could pass that to Playback, though you would be unable to enter an extension. -- Joshua C. Colp Asterisk Project Lead Sangoma Technologies Check us out at www.sangoma.com and www.asterisk.org -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.digium.com/pipermail/asterisk-users/attachments/20230617/dc4215b6/attachment.html>