;************* Callback Application ***************************** ; Usage ; Copy to: extensions_custom.conf ; Inbound Routing Custom App: = custom-callback,s,1 ; Replace SIP/broadvoice with your Trunk ; Replace 6459786544 with your CallerID ; Replace 1234 with your Password ; Extract Sound Files to /var/lib/asterisk/sounds/custom/callback ;**************************************************************** [custom-callback] exten => h,1,Hangup exten => hang,1,Playback(vm-goodbye) exten => hang,2,Hangup exten => i,1,Playback(conf-errormenu) exten => i,2,Goto(s,6) exten => s,1,GotoIf($[${DIALSTATUS} = ANSWER]?4) exten => s,2,Answer exten => s,3,Wait(2) exten => s,4,SetVar(LOOPED=1) exten => s,5,Authenticate(1234) exten => s,6,GotoIf($["${CALLERIDNUM}" != ""]?callback-callerid-yes|s|1:callback-callerid-no|s|1) exten => s,7,GotoIf($[${LOOPED} > 3]?hang,1) exten => t,1,SetVar(LOOPED=$[${LOOPED} + 1]) exten => t,2,Goto(s,5) [callback-callerid-yes] exten => 1,1,Goto(callback-callerid,s,1) ;Use CallerID exten => 2,1,Goto(callback-enter,s,1) ;Enter Number exten => 3,1,Goto(s,5) ;Repeat exten => h,1,Hangup exten => hang,1,Playback(vm-goodbye) exten => hang,2,Hangup exten => i,1,Playback(conf-errormenu) exten => i,2,Goto(s,6) exten => s,1,GotoIf($[${DIALSTATUS} = ANSWER]?4) exten => s,2,Answer exten => s,3,Wait(1) exten => s,4,SetVar(LOOPED=1) exten => s,5,GotoIf($[${LOOPED} > 3]?hang,1) exten => s,6,Background(custom/callback/callback-menu1) ;1 Use CallerID, 2 Enter Number, 3 Repeat exten => t,1,SetVar(LOOPED=$[${LOOPED} + 1]) exten => t,2,Goto(s,5) [callback-callerid-no] exten => s,1,Playback(custom/callback/cant-retrieve-callerid) exten => s,2,Goto(callback-enter,s,1) [callback-callerid] exten => 1,1,Macro(createfile,${CALLERIDNUM},SIP/broadvoice ,callback-disa,6459786544) exten => 2,1,Goto(callback-enter,s,1) exten => 3,1,Goto(callback-callerid-yes,s,1) exten => 4,1,Goto(s,5) exten => h,1,Hangup exten => hang,1,Playback(vm-goodbye) exten => hang,2,Hangup exten => i,1,Playback(conf-errormenu) exten => i,2,Goto(s,6) exten => s,1,GotoIf($[${DIALSTATUS} = ANSWER]?4) exten => s,2,Answer exten => s,3,Wait(1) exten => s,4,SetVar(LOOPED=1) exten => s,5,GotoIf($[${LOOPED} > 3]?hang,1) exten => s,6,Background(custom/callback/your-callerid-is) exten => s,7,SayDigits(${CALLERIDNUM}) exten => s,8,Background(custom/callback/callback-menu2) ;1 Correct, 2 Not Correct, 3 Main Menu, 4 Repeat exten => t,1,SetVar(LOOPED=$[${LOOPED} + 1]) exten => t,2,Goto(s,5) [callback-enter] exten => _1NXXNXXXXXX,1,SetVar(MYNUM=${EXTEN}) exten => _1NXXNXXXXXX,2,Playback(you-entered) exten => _1NXXNXXXXXX,3,SayDigits(${EXTEN}) exten => _1NXXNXXXXXX,4,Goto(s,1) exten => 1,1,GotoIf($["${MYNUM}" = ""]?s|1) exten => 1,2,Macro(createfile,${MYNUM},SIP/broadvoice,callback-disa,6459786544) exten => 2,1,SetVar(MYNUM=) exten => 2,2,Goto(s,1) exten => 3,1,Goto(custom-callback,s,6) exten => 4,1,SetVar(MYNUM=) exten => 4,2,Goto(s,5) exten => h,1,Hangup exten => hang,1,Playback(vm-goodbye) exten => hang,2,Hangup exten => i,1,Playback(allison7/you-dialed-wrong-number) exten => i,2,Goto(s,6) exten => s,1,GotoIf($[${DIALSTATUS} = ANSWER]?4) exten => s,2,Answer exten => s,3,Wait(1) exten => s,4,SetVar(LOOPED=1) exten => s,5,GotoIf($[${LOOPED} > 3]?hang,1) exten => s,6,GotoIf($["${MYNUM}" = ""]?10:7) exten => s,7,NoOp(${MYNUM}) exten => s,8,Background(custom/callback/callback-menu4) ;1 Correct, 2 Re-enter, 3 Main menu, 4 Repeat exten => s,9,Goto(11) exten => s,10,Background(custom/callback/callback-menu3) ;Please Enter the Callback Number, 3 Main menu, 4 Repeat exten => s,11,NoOp(${MYNUM}) exten => t,1,SetVar(LOOPED=$[${LOOPED} + 1]) exten => t,2,Goto(s,5) [macro-createfile] exten => s,1,Playback(custom/callback/hangup) exten => s,2,Setvar(NumToCall=${ARG1}) exten => s,3,System(echo channel: ${ARG2}/${NumToCall} > /tmp/${NumToCall}) exten => s,4,System(echo context: ${ARG3} >> /tmp/${NumToCall}) exten => s,5,System(echo extension: ${NumToCall} >> /tmp/${NumToCall}) exten => s,6,System(echo priority: 1 >> /tmp/${NumToCall}) exten => s,7,System(echo callerid: ${ARG4} >> /tmp/${NumToCall}) exten => s,8,System(echo sleep 30 > /tmp/${NumToCall}.2) exten => s,9,System(echo cp /tmp/${NumToCall} /var/spool/asterisk/outgoing >> /tmp/${NumToCall}.2) exten => s,10,System(chmod 775 /tmp/${NumToCall}.2) exten => s,11,System(/tmp/${NumToCall}.2) exten => s,12,Hangup() [callback-disa] exten => h,1,Hangup exten => hang,1,Playback(vm-goodbye) exten => hang,2,Hangup exten => i,1,Playback(conf-errormenu) exten => i,2,Goto(s,6) exten => s,1,GotoIf($[${DIALSTATUS} = ANSWER]?4) exten => s,2,Answer exten => s,3,Wait(2) exten => s,4,SetVar(LOOPED=1) exten => s,5,Authenticate(1234) exten => s,6,DISA(no-password|from-internal) exten => s,7,GotoIf($[${LOOPED} > 3]?hang,1) exten => t,1,SetVar(LOOPED=$[${LOOPED} + 1]) exten => t,2,Goto(s,5) ;************* End Callback Application *******************