123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378 |
- context dialextens
- {
- /*
- 101 thru 123, 149 thru 152
- */
- _10X => Dial(Zap/${EXTEN:2},30,Ttw);
- _1ZX => Dial(Zap/${EXTEN:1},30,Ttw);
- }
- /*
- Due to extenal wiring:
- dialing 125 will ring 101
- dialing 126 will ring 102
- and so on until
- dialing 147 will ring 123
- We can dial out on zap 69 thru 72; and 25-47
- */
- context dialthrus
- {
- /* 369-372; 325-347 */
- _3XX => Dial(Zap/${EXTEN:1},30,Ttw);
- }
- context t1incoming
- {
- includes
- {
- dialextens;
- parkedcalls;
- }
- s => {
- Answer();
- Background(welcome-to-test-machine);
- }
- }
- context t1extension
- {
- includes
- {
- dialextens;
- dialthrus;
- }
- }
- context incoming
- {
- includes
- {
- dialextens;
- parkedcalls;
- }
- s => {
- Answer();
- Background(welcome-to-test-machine);
- }
- }
- context incoming
- {
- s => {
- Answer();
- }
- }
- macro std-priv-exten( dev, ext , timeout, opts, torcont, dontcont )
- {
- // &increment_chosecount();
- dial_again:
- Dial(${dev},${timeout},${opts});
- switch(${DIALSTATUS})
- {
- case TORTURE:
- goto ${torcont}|s|begin;
- break;
- case DONTCALL:
- goto ${dontcont}|s|begin;
- break;
- case BUSY:
- label_busy:
- Read(reply|work-exten-busy|1||2|15);
- if ("${reply}"=="")
- goto label_busy; // infinite loop if Read has probs!!
- switch(${reply})
- {
- case 1:
- Set(time1=${EPOCH});
- label_redial:
- WaitMusicOnHold(5);
- Dial(${dev},${timeout},${opts});
- switch(${DIALSTATUS})
- {
- case BUSY:
- if(${EPOCH}-${time1} >= 20)
- goto label_busy;
- goto label_redial;
- default:
- return;// goto work_line|s|loopback;
- }
- break;
- case 2:
- Voicemail(${ext}|b);
- break;
- case 3:
- return; // goto work_line|s|loopback;
- default:
- Background(invalid);
- goto label_busy;
- }
- break;
- case ANSWER:
- break;
- case NOANSWER:
- noanswer_label:
- Read(reply|work-exten-noanswer|1|skip|2|15);
- switch(${reply})
- {
- case 1:
- switch(${ext})
- {
- case 10:
- Background(no-cell);
- break;
- case 11:
- // &ciddial(2729495,3072729495,30,tw,${GRAMS_TELCO},${WORK_TELCO});
- break;
- case 12:
- // &ciddial(2725560,3072725560,30,tw,${GRAMS_TELCO},${WORK_TELCO});
- break;
- case 13:
- // &ciddial(2720197,3072720197,30,tw,${GRAMS_TELCO},${WORK_TELCO});
- break;
- case 14:
- // &ciddial(2501174,3072501174,30,tw,${GRAMS_TELCO},${WORK_TELCO});
- break;
- case 15:
- Background(no-cell);
- break;
- case 16:
- Background(no-cell);
- break;
- default:
- Background(invalid);
- break;
- }
- goto noanswer_label;
- break;
- case 2:
- Voicemail(${ext}|u);
- break;
- case 3:
- return; // goto work_line|s|loopback;
- default:
- Background(invalid);
- goto noanswer_label;
- }
- Voicemail(${ext}|u);
- break;
- default:
- Voicemail(${ext}|u);
- }
- }
- /* Putting these 3 funcs in extensions.conf!
- macro funcC(a,b)
- {
- Set(Key=);
- menu:
- Read(Key,main-menu,1,n,1,5);
- if("${Key}" = "2")
- goto y,lab1;
- catch y
- { lab1:
- &funcB(${a},${b});
- }
- }
- macro funcB(a,b)
- {
- Set(Key=);
- menu:
- Read(Key,tt-monkeys,1,n,1,5);
- if("${Key}" = "2")
- goto z,lab2;
- catch z
- { lab2:
- &funcC(${a},${b});
- }
- }
- macro funcA()
- {
- &funcB(1,2);
- }
- */
- context extension
- {
- includes
- {
- dialextens;
- dialthrus;
- parkedcalls;
- }
- 5 => {
- Record(recording:wav);
- Background(recording);
- }
- 81 => {
- iterations=1000000;
- Set(time1=${EPOCH});
- for(i=1; ${i}<${iterations}; i=${i}+1)
- {
- NoOp(Hello);
- }
- Set(time2=${EPOCH});
- Verbose(The time diff is $[${time2} - ${time1} ] seconds);
- Verbose(Which means that the priorities/sec = $[4* ${iterations} / (${time2} - ${time1}) ]);
- SayNumber($[4 * ${iterations} / (${time2} - ${time1}) ]);
- }
- 82 => {
- &ndeep(100000);
- Verbose(Finished 100000 levels deep call!);
- }
- 83 => {
- switch (${EXTEN})
- {
- pattern 8X:
- Verbose(do something to prepare it);
- pattern 9X:
- Verbose(handle both 1xx and 2xx calls);
- pattern [4-7]X:
- Verbose(and this too!);
- }
- Set(junky=${RAND(0|99999)});
- Verbose(Here is a random number: ${junky}.);
- }
- 84 => {
- agi(agi://192.168.134.252/|hello|goodbye|whatever|whoknows,hell2,hello3);
- }
- 85 => {
- &std-priv-exten( Zap/50, 150 , 25, mtw, torcont, dontcont );
- }
- 86 => {
- Verbose(The version is: ${VERSION()} );
- Verbose(The versionnum is: ${VERSION(ASTERISK_VERSION_NUM)} );
- Verbose(The user is: ${VERSION(BUILD_USER)} );
- Verbose(The hostname is: ${VERSION(BUILD_HOSTNAME)} );
- Verbose(The machine is: ${VERSION(BUILD_MACHINE)} );
- Verbose(The OS is: ${VERSION(BUILD_OS)} );
- Verbose(The date is: ${VERSION(BUILD_DATE)} );
- Verbose(The kernel is: ${VERSION(BUILD_KERNEL)} );
- Set(vinf=${VERSION()});
- Set(vrand=${RAND()});
- if( ${ISNULL(${vinf})} )
- {
- if( ${ISNULL(${vrand})} )
- Verbose(Version 1.2 or earlier);
- else
- Verbose(Version 1.4!!!);
- }
- else
- Verbose(${vinf} indicates version pre-1.6 or higher);
- }
- 871 => {
- NoOp( 1 1 1 1 1 1 1);
- NoOp( 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6);
- NoOp(012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678890123456789012345678901234567890);
- NoOp(${EXTEN:1:2} ${EXTEN} ${EXTEN:1} 1 1 1 1 1 1 1);
- &dialoutpstn(${TDIRECTCALL-PST}/0${EXTEN},${E${CALLERID(num)}-OPT},${TDIRECTCALL-CID},${TDIRECTCALL-MAX},RotaPadrao) ;
- }
- 872 => {
- Set(ChannelOnly=${CUT(CHANNEL||1)});
- Verbose(ChannelOnly=${ChannelOnly}; neat huh?);
- Set(ChannelOnly=${CUT(CHANNEL,,1)});
- Verbose(ChannelOnly=${ChannelOnly}; neat huh?);
- }
- 873 => {
- NOOP(this is a forkcdr test);
- Set(CALLERID(num)=1234567890);
- Set(CALLERID(name)=before fork);
- Forkcdr(v);
- Set(CALLERID(num)=0987654321);
- Set(CALLERID(name)=after fork);
- Answer();
- Echo();
- Hangup();
- }
- 874 => {
- SayDigits(307-754-5675);
- SayPhoneNumber(307-754-5675);
- SayDigits(--);
- SayPhoneNumber(123-456-7890);
- SayDigits(++);
- SayPhoneNumber(307-754-4454);
- }
- 875 => {
- &funcA();
- &funcD();
- }
- 876 => {
- NoOp(Query resultid ${connid} SELECT var1\, var2 FROM did);
- NoOp($["Query resultid ${connid} SELECT var1\, var2 FROM did"]);
- NoOp($["Query resultid ${connid} SELECT var1, var2 FROM did"]);
- goto test5,s,1;
- }
- 88 => {
- SET(LIMIT_PLAYAUDIO_CALLER=yes);
- SET(LIMIT_PLAYAUDIO_CALLEE=no);
- SET(LIMIT_TIMEOUT_FILE=timeup);
- SET(LIMIT_CONNECT_FILE=limit60);
- SET(LIMIT_WARNING_FILE=almostup);
- Dial(Zap/51,20,L(60000:30000:8000));
- }
- 89 => {
- goto callbackmenu|100|1;
- }
- }
- context income1
- {
- s => {
- Answer();
- Dial(Zap/50,20,m);
- }
- 150 => Dial(Zap/50,20,m);
- }
- context callbackmenu
- {
- _X. => {
- Answer();
- Wait(1);
- Set(TIMEOUT(digit)=5);
- Set(TIMEOUT(response)=30);
- DISA(no-password,callbackdialout);
- }
- }
- context callbackdialout
- {
- _X. => {
- Dial(Zap/51,20,w);
- }
- }
- macro dialoutpstn(something1, something2, something3, something4, something5)
- {
- Verbose(${something1}--- ${something2}--- ${something3}--- ${something4}--- ${something5});
- }
- macro ndeep(level)
- {
- if( ${level} == 0)
- {
- Verbose(2|Got to Level 0);
- return;
- }
- &ndeep($[${level}-1]);
- return;
- }
|