rendered paste body;********************************************************************;;********************************************************************;[macro-GetUser];; Gets information based on dialed extension;;; Arguments:; 1 = Caller's User Context; 2 = Number Dialed;; Info Pulled from the Global Variable named as CONTEXT-EXTEN; e.g. if someone in cytec's context tried to dial "1234"; it would look up from ${cytec-1234}; inbound did's are looked up in the did context; e.g. ${did-1234567890};; The Format of the Variable is as such:; context-dialedExtension=outboundExtension-VoicemailBox-Context-Technology-DialTimeout;; e.g. did-4699160940=4699160940-106-cytec-SIP-20;; this would end up running:; Dial(SIP/4699160940,20); VoiceMail(106@cytec);;; NOTE: any unmatched extensions are routed to context-menu_main (cytec-menu_main,s,1);*******************************************************;; -> Is there a definition for this Number <- ;; ;exten => s,1,NoOp(entry = ${${ARG1}-${ARG2}}) ;exten => s,2,GotoIf($[foo${${ARG1}-${ARG2}} = 'foo']?:4);exten => s,3,Goto(Method,1) ;exten => s,4,Goto(Process,1) ;; ;;*******************************************************;; ;; --> No definition for number <-- ;; ---> Check Method for handling defaults <-- ;; ;;exten => Method,1,NoOp(Method = ${${ARG1}-Method})exten => Method,1,Cut(ThisMethod=${ARG1}-Method,-,1) ;exten => Method,2,GotoIf($[${ThisMethod} = 'Goto']?:4) ;exten => Method,3,Goto(Method_GoTo,1) ;exten => Method,4,GotoIf($[${ThisMethod} = 'Outbound']?:6);exten => Method,5,Goto(Method_Dial,1) ;exten => Method,6,NoOp(Unknown Method: ${${ARG1}-Method})exten => Method,7,Hangup() ;; ;;*******************************************************;;*******************************************************;;*************** Methods ************************;;*******************************************************;; ;; ---> Goto Method <--- ;; ;exten => Method_GoTo,1,Cut(ThisTarget=${ARG1}-Method,-,2) ;exten => Method_GoTo,2,goto(${${ARG1}-Context}-${ThisTarget},s,1); ;;*******************************************************;; ;; ---> Dial Method <--- ;; ;exten => Method_Dial,1,Cut(ThisProvider=${ARG1}-Method,-,2) ;exten => Method_Dial,2,Dial(${${ARG1}-Tech}/${ARG2}@${ThisProvider}); ;;*******************************************************;;*******************************************************;;***************** Process Settings ********************;;*******************************************************;; ;; ---> Get and Set Target Extension <--- ;exten => Process,1,Cut(ThisEXT=${ARG1}-${ARG2},-,1) ;exten => Process,2,GotoIf($[foo${ThisEXT} = 'foo']?:4) ;exten => Process,3,SetVar(ThisEXT=${${ARG1}-EXT}) ;; ;; ---> Get and Set VoiceMail <--- ;; ;exten => Process,4,Cut(ThisVM=${ARG1}-${ARG2},-,2) ;exten => Process,5,GotoIf($[foo${ThisVM} = 'foo']?:7) ;exten => Process,6,SetVar(ThisVM=${${ARG1}-VM}) ;; ;; ---> Get and Set Context <--- ;; ;exten => Process,7,Cut(ThisContext=${ARG1}-${ARG2},-,3) ;exten => Process,8,GotoIf($[foo${ThisContext} = 'foo']?:10)exten => Process,9,SetVar(ThisContext=${${ARG1}-Context}); ;; ---> Get and Set Technology <--- ;; ;exten => Process,10,Cut(ThisTech=${ARG1}-${ARG2},-,4) ;exten => Process,11,GotoIf($[foo${ThisTech} = 'foo']?:13)exten => Process,12,SetVar(ThisTech=${${ARG1}-Tech}) ;exten => Process,13,GotoIf($[${ThisTech} = 'Null']?:16)exten => Process,14,SetVar(ThisTech='')exten => Process,15,Goto(Process,17)exten => Process,16,SetVar(ThisTech=${ThisTech}/); ;; ---> Get and Set Timeout ;; ;exten => Process,17,Cut(ThisTimeout=${ARG1}-${ARG2},-,5);exten => Process,18,GotoIf($[foo${ThisTimeout} = 'foo']?:20)exten => Process,19,SetVar(ThisTimeout=${${ARG1}-Timeout}); ;; ---> Jump to Connect <--- ;; ;exten => Process,20,Goto(Connect,1) ;;exten => Process,16,Macro(ConnectCall,${ThisEXT},${ThisVM},${ThisContext},${ThisTech},${ThisTimeout}); ;;*******************************************************;;[macro-ConnectCall];*******************************************************;;****************** Connect Call ***********************;;*******************************************************;; ;; ;exten => Connect,1,GotoIf($[${ThisEXT} = ${CALLERIDNUM}]?:4)exten => Connect,2,VoicemailMain(${ThisVM}@${ThisContext})exten => Connect,3,Hangup() ;; ;exten => Connect,4,GotoIf($[${ThisTimeout} = '-1']?9) ;; ;exten => Connect,5,Dial(${ThisTech}${ThisEXT},${ThisTimeout})exten => Connect,6,GotoIf($[foo${ThisVM} = 'foo']?8) ;; ;exten => Connect,7,VoiceMail(u${ThisVM}) ;exten => Connect,8,Hangup() ;; ;exten => Connect,9,Dial(${ThisTech}${ThisEXT}) ;exten => Connect,10,Hangup() ;; ;exten => Connect,106,VoiceMail(b${ThisVM}) ;exten => Connect,107,Hangup() ;; ;exten => t,1,NoOp(Timed Out) ;exten => t,2,Hangup() ;exten => i,1,NoOp(Invalid) ;exten => i,2,Hangup() ;; ;;*******************************************************;;[macro-ConnectCall];; Arguments:; 1 = Extension Number; 2 = Voicemail Box; 3 = Voicemail Context; 4 = Technology (SIP, ZAP, ect..); 5 = Ringer Timeout;;exten => s,1,GotoIf($[${ARG1} = ${CALLERIDNUM}]?2:4);exten => s,2,VoicemailMain(${ARG2}@${ARG3});exten => s,3,Hangup();exten => s,4,Dial(${ARG4}/${ARG1},${ARG5});exten => s,5,VoiceMail(u${ARG2});exten => s,6,Hangup();exten => s,105,VoiceMail(b${ARG2});exten => s,106,Hangup();;*********************************************************************;;*********************************************************************;