[macro-support]
;Arg1=Extension
;0 "Unknown", Valid, but unknown state
;1 "Not in use", Not used
;2 "In use", In use
;3 "Busy", Busy
;4 "Invalid", Invalid - not known to Asterisk
;5 "Unavailable", Unavailable (not registred)
;6 "Ringing", "Ring, ring, ring"
exten => s,1,ChanIsAvail(SIP/${ARG1}|s)
exten => s,n,NoOp(Channel ${ARG1} has a status of ${AVAILSTATUS})
exten => s,n,Goto(s-${AVAILSTATUS},1)
exten => s-1,1,Macro(stdexten|${Arg1}|SIP/${Arg1})
exten => s-2,1,Answer()
exten => s-2,n,Set(Timeout=30)
exten => s-2,n,Wait(1)
exten => s-2,n,Festival("That user is on the phone")
exten => s-2,n,Festival("Press 1 to wait for that user")
exten => s-2,n,Festival("Press 2 to wait in the support queue and wait for another support technician.")
exten => s-2,n,Festival("Press 3 to leave a voice mail message.")
exten => s-2,n,Festival("Press 4 to induce a high level of voltage from the user's handset directly into their brain, forcing them to hangup so they will be available to take your call.")
exten => s-2,n,Wait(10)
exten => s-3,1,Goto(s-2,1)
exten => s-5,1,Goto(s-2,1)
exten => s-4,1,Playback(somethingiswrong)
exten => s-4,n,Playback(tt-weasels)
exten => s-4,n,Playback(thankyouforcalling)
exten => s-4,n,Playback(goodbye)
exten => s-4,n,Hangup()
exten => s-0,1,Macro(stdexten|${Arg1}|SIP/${Arg1})
exten => 1,1,Queue(q${Arg1})
exten => 2,1,macro(support-tree)
exten => 3,1,Voicemail(u${Arg1})
exten => 3,n,Hangup()
==========Call Attempt
-- Executing Macro("SIP/phone2-bc417db0", "support|phone1") in new stack
-- Executing ChanIsAvail("SIP/phone2-bc417db0", "SIP/phone1|sj") in new stack
== Spawn extension (macro-support, s, 1) exited non-zero on 'SIP/phone2-bc417db0' in macro 'support'
== Spawn extension (macro-support, s, 1) exited non-zero on 'SIP/phone2-bc417db0'