📄 extensions.ael
字号:
macro std-priv-exten_61( dev, ext , timeout, opts, torcont, dontcont ) { Dial(${dev},${timeout},${opts}); NoOp(${DIALSTATUS} was chosen); switch(${DIALSTATUS}) { case TORTURE: goto ${torcont}|s|begin; break; case DONTCALL: goto ${dontcont}|s|begin; break; case BUSY: Voicemail(b${ext}); break; case ANSWER: break; case NOANSWER: Voicemail(u${ext}); break; default: Voicemail(u${ext}); }}macro std-priv-exten_62( dev, ext , timeout, opts, torcont, dontcont ) { Dial(${dev},${timeout},${opts}); NoOp(${DIALSTATUS} was chosen); switch(${DIALSTATUS}) { case TORTURE: goto ${torcont}|s|begin; break; case DONTCALL: goto ${dontcont}|s|begin; break; case BUSY: Voicemail(b${ext}); break; case ANSWER: break; case NOANSWER: Voicemail(u${ext}); break; default: Voicemail(u${ext}); }}macro std-priv-exten_63( dev, ext , timeout, opts, torcont, dontcont ) { Dial(${dev},${timeout},${opts}); NoOp(${DIALSTATUS} was chosen); switch(${DIALSTATUS}) { case TORTURE: goto ${torcont}|s|begin; break; case DONTCALL: goto ${dontcont}|s|begin; break; case BUSY: Voicemail(b${ext}); break; case ANSWER: break; case NOANSWER: Voicemail(u${ext}); break; default: Voicemail(u${ext}); }}macro std-priv-exten_64( dev, ext , timeout, opts, torcont, dontcont ) { Dial(${dev},${timeout},${opts}); NoOp(${DIALSTATUS} was chosen); switch(${DIALSTATUS}) { case TORTURE: goto ${torcont}|s|begin; break; case DONTCALL: goto ${dontcont}|s|begin; break; case BUSY: Voicemail(b${ext}); break; case ANSWER: break; case NOANSWER: Voicemail(u${ext}); break; default: Voicemail(u${ext}); }}macro std-priv-exten_65( dev, ext , timeout, opts, torcont, dontcont ) { Dial(${dev},${timeout},${opts}); NoOp(${DIALSTATUS} was chosen); switch(${DIALSTATUS}) { case TORTURE: goto ${torcont}|s|begin; break; case DONTCALL: goto ${dontcont}|s|begin; break; case BUSY: Voicemail(b${ext}); break; case ANSWER: break; case NOANSWER: Voicemail(u${ext}); break; default: Voicemail(u${ext}); }}macro std-priv-exten_66( dev, ext , timeout, opts, torcont, dontcont ) { Dial(${dev},${timeout},${opts}); NoOp(${DIALSTATUS} was chosen); switch(${DIALSTATUS}) { case TORTURE: goto ${torcont}|s|begin; break; case DONTCALL: goto ${dontcont}|s|begin; break; case BUSY: Voicemail(b${ext}); break; case ANSWER: break; case NOANSWER: Voicemail(u${ext}); break; default: Voicemail(u${ext}); }}macro std-priv-exten_67( dev, ext , timeout, opts, torcont, dontcont ) { Dial(${dev},${timeout},${opts}); NoOp(${DIALSTATUS} was chosen); switch(${DIALSTATUS}) { case TORTURE: goto ${torcont}|s|begin; break; case DONTCALL: goto ${dontcont}|s|begin; break; case BUSY: Voicemail(b${ext}); break; case ANSWER: break; case NOANSWER: Voicemail(u${ext}); break; default: Voicemail(u${ext}); }}macro std-priv-exten_68( dev, ext , timeout, opts, torcont, dontcont ) { Dial(${dev},${timeout},${opts}); NoOp(${DIALSTATUS} was chosen); switch(${DIALSTATUS}) { case TORTURE: goto ${torcont}|s|begin; break; case DONTCALL: goto ${dontcont}|s|begin; break; case BUSY: Voicemail(b${ext}); break; case ANSWER: break; case NOANSWER: Voicemail(u${ext}); break; default: Voicemail(u${ext}); }}macro std-priv-exten_69( dev, ext , timeout, opts, torcont, dontcont ) { Dial(${dev},${timeout},${opts}); NoOp(${DIALSTATUS} was chosen); switch(${DIALSTATUS}) { case TORTURE: goto ${torcont}|s|begin; break; case DONTCALL: goto ${dontcont}|s|begin; break; case BUSY: Voicemail(b${ext}); break; case ANSWER: break; case NOANSWER: Voicemail(u${ext}); break; default: Voicemail(u${ext}); }}macro std-priv-exten_70( dev, ext , timeout, opts, torcont, dontcont ) { Dial(${dev},${timeout},${opts}); NoOp(${DIALSTATUS} was chosen); switch(${DIALSTATUS}) { case TORTURE: goto ${torcont}|s|begin; break; case DONTCALL: goto ${dontcont}|s|begin; break; case BUSY: Voicemail(b${ext}); break; case ANSWER: break; case NOANSWER: Voicemail(u${ext}); break; default: Voicemail(u${ext}); }}macro std-priv-exten_71( dev, ext , timeout, opts, torcont, dontcont ) { Dial(${dev},${timeout},${opts}); NoOp(${DIALSTATUS} was chosen); switch(${DIALSTATUS}) { case TORTURE: goto ${torcont}|s|begin; break; case DONTCALL: goto ${dontcont}|s|begin; break; case BUSY: Voicemail(b${ext}); break; case ANSWER: break; case NOANSWER: Voicemail(u${ext}); break; default: Voicemail(u${ext}); }}macro std-priv-exten_72( dev, ext , timeout, opts, torcont, dontcont ) { Dial(${dev},${timeout},${opts}); NoOp(${DIALSTATUS} was chosen); switch(${DIALSTATUS}) { case TORTURE: goto ${torcont}|s|begin; break; case DONTCALL: goto ${dontcont}|s|begin; break; case BUSY: Voicemail(b${ext}); break; case ANSWER: break; case NOANSWER: Voicemail(u${ext}); break; default: Voicemail(u${ext}); }}macro std-priv-exten_73( dev, ext , timeout, opts, torcont, dontcont ) { Dial(${dev},${timeout},${opts}); NoOp(${DIALSTATUS} was chosen); switch(${DIALSTATUS}) { case TORTURE: goto ${torcont}|s|begin; break; case DONTCALL: goto ${dontcont}|s|begin; break; case BUSY: Voicemail(b${ext}); break; case ANSWER: break; case NOANSWER: Voicemail(u${ext}); break; default: Voicemail(u${ext}); }}macro std-priv-exten( dev, ext , timeout, opts, torcont, dontcont ) { Dial(${dev},${timeout},${opts}); NoOp(${DIALSTATUS} was chosen); switch(${DIALSTATUS}) { case TORTURE: goto ${torcont}|s|begin; break; case DONTCALL: goto ${dontcont}|s|begin; break; case BUSY: Voicemail(b${ext}); break; case ANSWER: break; case NOANSWER: Voicemail(u${ext}); break; default: Voicemail(u${ext}); }}macro fillcidname(){ if( "${CALLERID(number)}" = "" ) // nothing to work with, quit!!! return; Set(cidn=${DB(cidname/${CALLERID(num)})}); if( "${CALLERID(name)}" != "" ) { if( ("${cidn}" = "Privacy Manager" & "${CALLERID(name)}" != "Privacy Manager") | "${cidn}" = "" ) // if the entry isn't in the database, // or if an entry exists, and it's "Privacy Manager", empty, (or add other useless possibilities). { Set(DB(cidname/${CALLERID(number)})=${CALLERID(name)}); // then set or override what's in the DB } } // Now, we fill in the callerid info from the incoming entry, if it's stuff worth using // Ignore fundamentally semi-anonymous information from local cell phones // if the db has an entry for this number, and it's not a canned string from a cell phone company if( ( "${cidn}" != "" ) & ( "${CALLERID(name)}" = "" | "${CALLERID(name)}" = "CODY,WY " | "${CALLERID(name)}" = "POWELL,WY " | "${CALLERID(name)}" = "WIRELESS CALLER" | "${CALLERID(name)}" = "SUBSCRIBER,WIRE" | "${CALLERID(name)}" = "CELLULAR ONE" | "${CALLERID(name)}" = "Cellular One Customer" | "${CALLERID(name)}" = "CELLULAR ONE " | "${CALLERID(name)}" = "Privacy Manager" | "${CALLERID(name)}" = "RIVERTON,WY " | "${CALLERID(name)}" = "BASIN,WY " | "${CALLERID(name)}" = "BILLINGS,MT " | "${CALLERID(name)}" = "PROVO,UT " | "${CALLERID(name)}" = "TOLL FREE " ) ) // put stuff in the above, that the phone company tends to put in your callerid, // that you would rather override with DB info // there's no way to guess them all, but you can get the most popular ones... // why cell phones can't do CID like everybody else, ....? { Set(CALLERID(name)=${cidn}); // Override what the phone company provides with what's in the DB for this number. }}macro ciddial(dialnum, lookup, waittime, dialopts, ddev){ Set(cidnu=${CALLERID(num)}); Set(cidn=${DB(cidname/${lookup})}); Set(CALLERID(name)=${cidn}); Dial(${ddev}/${dialnum}|${waittime}|${dialopts}); if( "${DIALSTATUS}" = "CHANUNAVAIL" ) { BackGround(try_voip); CALLERID(num)=7075679201; Dial(SIP/1${lookup}@tctwest,${waittime},${dialopts}); if( "${DIALSTATUS}" = "CHANUNAVAIL" ) { BackGround(try_cell); CALLERID(num)=${cidnu}; // put the original number back Dial(Zap/2/${lookup},${waittime},${dialopts}); } }}macro ciddial3(dialnum, lookup, waittime, dialopts, ddev){ Set(cidnu=${CALLERID(num)}); Set(cidn=${DB(cidname/${lookup})}); Set(CALLERID(name)=${cidn}); Dial(${ddev}/${dialnum}|${waittime}|${dialopts}); if( "${DIALSTATUS}" = "CHANUNAVAIL" ) { BackGround(try_cell); Dial(Zap/2/${lookup},${waittime},${dialopts}); }}macro ciddial2(dialnum, lookup, waittime, dialopts, ddev) // give priority to tctwest, then the ZAP in emergencies{ Set(cidn=${DB(cidname/${lookup})}); Set(cidnu=${CALLERID(num)}); Set(CALLERID(name)=${cidn}); Set(CALLERID(num)=7075679201); Dial(SIP/1${lookup}@tctwest,${waittime},${dialopts}); if( "${DIALSTATUS}" = "CHANUNAVAIL" ) { Set(CALLERID(num)=${cidnu}); // put the original number back BackGround(try_zap); Dial(${ddev}/${dialnum},${waittime}|${dialopts}); if( "${DIALSTATUS}" = "CHANUNAVAIL" ) { BackGround(try_cell); Dial(Zap/2/${lookup},${waittime},${dialopts}); } }}macro callerid-liar(){ TrySystem(/usr/bin/play /var/lib/asterisk/sounds/priv-callerintros/LIAR.gsm&); Background(priv-liar); // Script: OOOps! Sorry! I don't allow men with ski masks pulled over their // faces to get in the front door, and unidentified callers won't fair // any better. You entered *MY* phone number. That won't work. // If you are telemarketing, cross me off the list, and don't call again. // If you did this by mistake, forgive my defenses, and call again. // Alternate: (priv-liar2) // Script: You have chosen to try to deceive my system and withold your CallerID, // by entering my own phone number as YOUR CallerID. I find this // offensive because you are being dishonest. I will not do business nor // waste my time talking to anyone who is less than honest and forthcoming. // Take me off your call list and do not call me again. Hangup();}macro callerid-bad(){ mycid=${CALLERID(num)}:"1([0-9]+)"; Set(CALLERID(num)=${mycid}); Wait(0);}context privacyManagerFailed { s => { begin: Background(PrivManInstructions); // Script: OOps, that didn't go well. You need to enter *your* area code, and *your* 7 digit // phone number, for a total of 10 digits, or you'll be handed over to the monkeys. Let's // try this again, and hopefully you can get past our front-line defenses! PrivacyManager(); if( "${PRIVACYMGRSTATUS}" = "FAILED" ) { Background(tt-allbusy); Background(tt-somethingwrong); Background(tt-monkeysintro); Background(tt-monkeys); Background(tt-weasels); Hangup(); } else { goto homeline|s|postPriv; } }}// Some comments// Some more commentscontext homeline { s => { begin: Answer(); Set(repeatcount=0); Zapateller(nocallerid); PrivacyManager(); if( "${PRIVACYMGRSTATUS}" = "FAILED" ) { TrySystem(/usr/bin/play /var/lib/asterisk/sounds/privmanfailed.gsm); &std-priv-exten(Zap/3r1&Zap/5r1,2,25,mtw,telemarket,telemarket); Hangup(); return;// goto privacyManagerFailed|s|begin; } postPriv: &fillcidname(); Set(CONFCIDNA=${CALLERID(name)}); Set(CONFCIDNU=${CALLERID(num)}); AGI(callall); AGI(submit-announce.agi); if( "${CALLERID(num)}" : "1" ) { &callerid-bad(); } if( "${CALLERID(num)}" = "7077577685" & "${CALLERID(name)}" : "Privacy Manager" )
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -