[help] IVR macro implementation - suggestions?

Trying to create a simple IVR macro, and not sure the best way to go about it.

What I want it to do is this:

Someone calls and Asterisk picks up
"Thank you for calling."
“Press 1 for Sales”
“Press 2 for Support”
“Press 3 for Billing”
“Press 411 for the company directory”
“Press 0 to leave a message in our general mailbox.”

So I initially tried something like:

[macro-test-mainline]
exten => s,1,Answer
exten => s,2,Wait,1                                     ; give caller id time
exten => s,3,Playback(thank-you-for-calling)	; "Thank you for calling"
exten => s,4,Playback(for-sales)                        ; "For Sales"
exten => s,5,Background(press-1)                        ; "Press One"
exten => s,6,Playback(for-tech-support)                 ; "For Technical Support"
exten => s,7,Background(press-2)                        ; "Press Two"
exten => s,8,Playback(for-billing)                      ; "For Billing"
exten => s,9,Background(press-3)                        ; "Press Three"
exten => s,10,Playback(for-louie-louie)                 ; For Louie Louie
exten => s,11,Background(digits/4)                      ; Press Four
exten => s,12,Read(RESPONSE,company-dir-411,3)          ;
exten => s,13,Goto(s-${RESPONSE}|1)                     ;
exten => 1,1,Macro(sales)
exten => 2,1,Goto(support|s|1)
exten => 3,1,Dial(SIP/main2,10)
exten => 4,1,Playback(lyrics-louie-louie)               ;
exten => 4,2,Goto(s,1)                          ;
exten => s-411,1,Directory(default,pdx-exten)           ;
exten => s-411,2,Hangup                                 ; should never reach here
exten => s-0,1,Voicemail(3700,u)                        ;
exten => s-0,2,Playback(vm-goodbye)                     ;
exten => s-0,3,Hangup                                   ;

But it seems like what might actually work is to have a pre-recorded greeting with all the options (versus playing them back step-by-step) and use the Background() application, like:

[macro-test-mainline]
exten => s,1,Answer
exten => s,2,Wait,1                                     ; give caller id time
exten => s,3,Playback(thank-you-for-calling)	; "Thank you for calling"
exten => s,4,Background(ivr-greeting)			; Pre-recorded greeting "Press 1 for Sales, 2 for Support, etc..."
exten => 1,1,Macro(sales)
exten => 2,1,Goto(support|s|1)
exten => 3,1,Dial(SIP/main2,10)
exten => 4,1,Playback(lyrics-louie-louie)
exten => 4,2,Goto(s,1)
exten => 411,1,Directory(default,pdx-exten)
exten => 411,2,Hangup
exten => 0,1,Voicemail(3700,u)
exten => 0,2,Playback(vm-goodbye)
exten => 0,3,Hangup

Does that make sense? Is there a better way to go about this that I’m totally missing? Thanks anyone for any insight you can provide!

Here is a sample of what I use

exten => 444,1,Answer()
exten => 444,n,wait(1)
exten => 444,n,Set(Count=0)
exten => 444,n(repeat),Background(‘weasels-eaten-phonesys’)
exten => 444,n,WaitExten(5)
exten => 444,n,Set(Count=$[${Count} + 1])
exten => 444,n,GotoIf($[ ${count} = 3 ]?hang:repeat)
exten => 444,n(hang),Playback(‘goodbye’)
exten => 444,n,Hangup( )
exten => i,1,Playback(pbx-invalid)
exten => i,n,NoOp(${EXTEN})
exten => i,n,goto(default,444,repeat)

In production systems I normally have a “Welcome” message before the repeat, and a more complete IVR menu rather then the weasles message.

[quote=“Matthew_kleinmann”]Here is a sample of what I use

exten => 444,1,Answer()
exten => 444,n,wait(1)
exten => 444,n,Set(Count=0)
exten => 444,n(repeat),Background(‘weasels-eaten-phonesys’)
exten => 444,n,WaitExten(5)
exten => 444,n,Set(Count=$[${Count} + 1])
exten => 444,n,GotoIf($[ ${count} = 3 ]?hang:repeat)
exten => 444,n(hang),Playback(‘goodbye’)
exten => 444,n,Hangup( )
exten => i,1,Playback(pbx-invalid)
exten => i,n,NoOp(${EXTEN})
exten => i,n,goto(default,444,repeat)

In production systems I normally have a “Welcome” message before the repeat, and a more complete IVR menu rather then the weasles message.[/quote]

Ah, cool, thanks!

It looks like you’re not using this as a macro, is that correct?

Actually, I got it to work as a macro like this:

[macro-testmainlinetwo]
exten => s,1,Answer
exten => s,n,Wait,1
exten => s,n,Playback(thank-you-for-calling)
exten => s,n,Read(RESPONSE|ivr-greeting|1)
exten => s,n,Goto(s-${RESPONSE}|1)
exten => s-1,1,Macro(sales)	                                       	            
exten => s-2,1,Goto(support|s|1)
exten => s-3,1,Dial(SIP/main2,10)
exten => s-4,1,Playback(lyrics-louie-louie)
exten => s-4,n,Goto(s,1)
exten => s-5,1,Directory(default,pdx-exten)
exten => s-5,n,Hangup
exten => s-0,1,Voicemail(3700,u)
exten => s-0,n,Playback(vm-goodbye)
exten => s-0,n,Hangup
exten => i,1,Playback(pdx-invalid)
exten => i,n,goto(s,1)

It only gets called for incoming calls so I did not see the usefulness of turning it into a macro. The extensions are all in macros though.

That being said, if it works for you, cool. There are a lot of ways to skin the same cat.

[quote=“Matthew_kleinmann”]It only gets called for incoming calls so I did not see the usefulness of turning it into a macro. The extensions are all in macros though.

That being said, if it works for you, cool. There are a lot of ways to skin the same cat.[/quote]

Ah, well, I inherited this Asterisk config and just wanted to get the IVR part up (pretty much every extension points to a macro, including the main incoming lines). We’re going to be upgrading the server its on soon, and at that point I’ll end up rewriting a lot of the config. :smile: