Roy Sigurd Karlsbakk wrote:
> hi
>
> the following dialplan is used to setup a ping-pong-test between two  
> boxes to monitor load
>
> exten => _X.,1,Set(i=${SIP_HEADER(x_loopback_test)})
> exten => _X.,n,GotoIf($[${i}>=5]?answer:iterate)
> exten => _X.,n(iterate),Set(i=$[${i}+1])
> exten => _X.,n,SipAddHeader(X-Loopback-Test: ${i})
> exten => _X.,n,Hangup
> exten => _X.,n,Dial(SIP/looptest/${EXTEN})
> exten => _X.,n(answer),Answer
> exten => _X.,n,Echo
>
> this works well on asterisk, but openpbx doesn't understnad the  
> expressions at lines two and three.
>
> can someone help me out here, please
>   

don't know where that header is coming from so i modified the dialplan.
No ping pong here.

exten => _.,1,NoOp(Starting Test)
exten => _.,n,Answer
;This is to check that SIP_HEADER contains something
exten => _.,n,NoOp(${SIP_HEADER(From)})
;set it to an initial value
exten => _.,n,Set(i=1)
exten => _.,n(nextloop),NoOp(_________________________Next loop)
;show value for debugging purposes
exten => _.,n,NoOp(I is equal to ${i})
;check the value
exten => _.,n,GotoIf($[${i}>=5]?answer:iterate)
exten => _.,n(iterate),NoOp(_________________________Iterate)
;increment in the loop
exten => _.,n(iterate),Set(i=$[${i}+1])
;let's restart
exten => _.,n(iterate),Goto(nextloop)
;ok, time to answer and tell royk to check his dialplan
exten => _.,n(answer),NoOp(_________________________Answer)
exten => _.,n(answer),Echo


this gives me:

inxs2*CLI>
   -- Executing NoOp("SIP/523-b248", "Starting Test") in new stack
   -- Executing Answer("SIP/523-b248", "") in new stack
   -- Executing NoOp("SIP/523-b248", 
"<sip:[EMAIL PROTECTED]>;tag=245bf7c0-a0a090a-13c4-26b-737909f6-26b") in 
new stack
   -- Executing Set("SIP/523-b248", "i=1") in new stack
   -- Executing NoOp("SIP/523-b248", "_________________________Next 
loop") in new stack
   -- Executing NoOp("SIP/523-b248", "I is equal to 1") in new stack
   -- Executing GotoIf("SIP/523-b248", "0?answer:iterate") in new stack
   -- Goto (internal,222,8)
   -- Executing NoOp("SIP/523-b248", "_________________________Iterate") 
in new stack
   -- Executing Set("SIP/523-b248", "i=2") in new stack
   -- Executing Goto("SIP/523-b248", "nextloop") in new stack
   -- Goto (internal,222,5)
   -- Executing NoOp("SIP/523-b248", "_________________________Next 
loop") in new stack
   -- Executing NoOp("SIP/523-b248", "I is equal to 2") in new stack
   -- Executing GotoIf("SIP/523-b248", "0?answer:iterate") in new stack
   -- Goto (internal,222,8)
   -- Executing NoOp("SIP/523-b248", "_________________________Iterate") 
in new stack
   -- Executing Set("SIP/523-b248", "i=3") in new stack
   -- Executing Goto("SIP/523-b248", "nextloop") in new stack
   -- Goto (internal,222,5)
   -- Executing NoOp("SIP/523-b248", "_________________________Next 
loop") in new stack
   -- Executing NoOp("SIP/523-b248", "I is equal to 3") in new stack
   -- Executing GotoIf("SIP/523-b248", "0?answer:iterate") in new stack
   -- Goto (internal,222,8)
   -- Executing NoOp("SIP/523-b248", "_________________________Iterate") 
in new stack
   -- Executing Set("SIP/523-b248", "i=4") in new stack
   -- Executing Goto("SIP/523-b248", "nextloop") in new stack
   -- Goto (internal,222,5)
   -- Executing NoOp("SIP/523-b248", "_________________________Next 
loop") in new stack
   -- Executing NoOp("SIP/523-b248", "I is equal to 4") in new stack
   -- Executing GotoIf("SIP/523-b248", "0?answer:iterate") in new stack
   -- Goto (internal,222,8)
   -- Executing NoOp("SIP/523-b248", "_________________________Iterate") 
in new stack
   -- Executing Set("SIP/523-b248", "i=5") in new stack
   -- Executing Goto("SIP/523-b248", "nextloop") in new stack
   -- Goto (internal,222,5)
   -- Executing NoOp("SIP/523-b248", "_________________________Next 
loop") in new stack
   -- Executing NoOp("SIP/523-b248", "I is equal to 5") in new stack
   -- Executing GotoIf("SIP/523-b248", "1?answer:iterate") in new stack
   -- Goto (internal,222,11)
   -- Executing NoOp("SIP/523-b248", "_________________________Answer") 
in new stack
   -- Executing Echo("SIP/523-b248", "") in new stack
 == Spawn extension (internal, 222, 12) exited non-zero on 'SIP/523-b248'
   -- Executing NoOp("SIP/523-b248", "Starting Test") in new stack
   -- Executing Answer("SIP/523-b248", "") in new stack
 == Spawn extension (internal, h, 2) exited non-zero on 'SIP/523-b248'
inxs2*CLI>

It "worksforme" (tm) on rev 2072.

Max



_______________________________________________
Openpbx-dev mailing list
[email protected]
http://lists.openpbx.org/mailman/listinfo/openpbx-dev

Reply via email to