|
| 1 | + |
| 2 | +[default] |
| 3 | +exten => s,1,Answer() |
| 4 | + same => n,Set(GLOBAL(evalexten)=isreallycool) |
| 5 | + same => n,Set(i=0) |
| 6 | + same => n,While($[${INC(i)}<=11]) |
| 7 | + same => n,Originate(Local/${i}@evalexten,app,Wait,5,,,a) |
| 8 | + same => n,EndWhile() |
| 9 | + same => n,Hangup() |
| 10 | + |
| 11 | +[nothing] |
| 12 | +exten => 0,1,Answer() |
| 13 | + same => n,Wait(10) |
| 14 | + same => n,Hangup() |
| 15 | + |
| 16 | +[evalexten] |
| 17 | +exten => success,1,UserEvent(EvalExtenSuccess,Result: Pass) |
| 18 | + same => n,Hangup() |
| 19 | +exten => fail,1,UserEvent(EvalExtenFailure,Result: Fail ${RECEIVESFSTATUS} ${digits},Reason: ${digits}) |
| 20 | + same => n,Hangup() |
| 21 | +exten => 1,1,GotoIf($["${EVAL_EXTEN(ee-context-1,${EPOCH},1)}"="4545"]?success,1:fail,1) ; make sure evaluated extension is argument, not current dialplan extension |
| 22 | +exten => 2,1,GotoIf($["${EVAL_EXTEN(ee-context-2,${EPOCH},1)}"=""]?success,1:fail,1) ; non-existent evaluation extension |
| 23 | +exten => 3,1,GotoIf($[${EVAL_EXTEN(ee-context-3,${EXTEN},1)}>${EPOCH}]?success,1:fail,1) ; ensure variable substitution occurs correctly |
| 24 | +exten => 4,1,GotoIf($[${EVAL_EXTEN(ee-context-4,212,1)}=200]?success,1:fail,1) ; ensure pattern matching works correctly |
| 25 | +exten => 5,1,GotoIf($[${EVAL_EXTEN(ee-context-4,312,1)}=300]?success,1:fail,1) ; ensure pattern matching works correctly |
| 26 | +exten => 6,1,GotoIf($[${EVAL_EXTEN(ee-context-4,332,1)}=330]?success,1:fail,1) ; ensure pattern matching works correctly |
| 27 | +exten => 7,1,GotoIf($["${EVAL_EXTEN(ee-context-4,332,2)}"="isreallycool"]?success,1:fail,1) ; ensure non-1 priorities work correctly |
| 28 | +exten => 8,1,GotoIf($[${EVAL_EXTEN(100,1)}=50]?success,1:fail,1) ; implicit context |
| 29 | +exten => 9,1,GotoIf($[${EVAL_EXTEN(2)}=60]?success,1:fail,1) ; implicit context and extension |
| 30 | + same => n,Return(60) |
| 31 | +exten => 10,1,GotoIf($["${EVAL_EXTEN(ee-context-5,353,1)}"="353"]?success,1:fail,1) ; EXTEN evaluation |
| 32 | +exten => 11,1,GotoIf($["${EVAL_EXTEN(ee-context-5,354,1)}"="1"]?success,1:fail,1) ; EXTEN evaluation |
| 33 | +exten => 100,1,Return(50) |
| 34 | + |
| 35 | +[ee-context-1] |
| 36 | +exten => 1,1,Return(0) |
| 37 | +exten => _X!,1,Return(4545) |
| 38 | + |
| 39 | +[ee-context-2] |
| 40 | +exten => 0,1,Return(4545) |
| 41 | + |
| 42 | +[ee-context-3] |
| 43 | +exten => 1,1,Return(${EPOCH}) |
| 44 | +exten => 2,1,Return($[${EPOCH}+1]) |
| 45 | +exten => 3,1,Return($[${EPOCH}+2]) |
| 46 | + |
| 47 | +[ee-context-4] |
| 48 | +exten => _2XX,1,Return(200) |
| 49 | +exten => _3XX,1,Return(300) |
| 50 | +exten => _33X,1,Return(330) |
| 51 | + same => n,Return(${evalexten}) |
| 52 | + |
| 53 | +[ee-context-5] |
| 54 | +exten => 353,1,Return(${EXTEN}) |
| 55 | +exten => 354,1,Return($["${EXTEN}"="354"]) |
0 commit comments