Application Dial() | Passing Variable

Hi guys.

This is working:
same = n,Dial(PJSIP/123)

This not:
same = n,Set(DialString=PJSIP/123)
same = n,Dial(${DialString})

I need to pass a variable with a build dial string to Dial().
How to get it working?


I don’t understand the question. Can you give an example?

That should work.

What happens when you try?

Have you tried using NoOP() to echo what the value of your variable is set to?

exten => 123,1,NoOP()
 same => n,Set(Device=PJSIP/123)
 same => n,NoOP(Device is ${Device})
 same => n,Dial(${Device})

This is the output when executing:

– Executing [s@call_directly_via_callfile:3] Set(“PJSIP/xy_endpoint-00000010”, “DialString=PJSIP/869&PJSIP/6712&PJSIP/875”) in new stack
– Executing [s@call_directly_via_callfile:4] NoOp(“PJSIP/xy_endpoint-00000010”, “*** DEBUG ***: DialString = PJSIP/869&PJSIP/6712&PJSIP/875”) in new stack
– Executing [s@call_directly_via_callfile:5] Dial(“PJSIP/xy_endpoint-00000010”, “”) in new stack
[Aug 29 21:50:40] WARNING[12452][C-0000000d]: app_dial.c:2247 dial_exec_full: Dial requires an argument (technology/resource)
== Spawn extension (call_directly_via_callfile, s, 5) exited non-zero on ‘PJSIP/xy_endpoint-00000010’

It is about variable dereferencing.
In “working” Dial() is called with a parameter which is accepted by Dial().

In “not working” variable DialString is holding the same value as parameter but is not dialing.

The parameter substitution is done before the command is entered. If it is working for Noop and not for Dial, I would looks for non-printing characters.

Hi guys.

This one was really strange…
I tried several possibilities yesterday without success.

Today, after restarting the asterisk server, it worked. No idea why, nothing changed…

Thank you guys a lot for all your help.