[asterisk-users] Non-global variable that follows channel?

Richard Mudgett rmudgett at digium.com
Sun Nov 27 12:27:57 CST 2016


On Sun, Nov 27, 2016 at 11:13 AM, Jonathan H <lardconcepts at gmail.com> wrote:

> Thanks, Richard - your code does indeed work reliably 100% of the
> time, and thank you for that explanation.
>
> I do think the docs at
> https://wiki.asterisk.org/wiki/display/AST/Asterisk+14+Function_SHARED
> could do with more clarification.
>
> BTW, there were a couple of typos in your code, so for anyone who
> wants to copy/paste, here's Richard's code WITH the curly braces  (
> Set(SHARED(sharedVar,MY_CALLER) should be
> Set(SHARED(sharedVar,${MY_CALLER}) )
>
> [svtest1]
> exten => s,1,Answer()
>     same => n,Verbose(1,Answered channel:${CHANNEL})
>     same => n,Set(__MY_CALLER=${CHANNEL(name)})
>     same => n,Dial(Local/s at svtest2,,g)
>     same => n,Verbose(1,***In channel:${CHANNEL}
> sharedVar:${SHARED(sharedVar)})
>     same => n,Hangup()
>
> [svtest2]
> exten => s,1,NoOp()
>     same => n,Set(SHARED(sharedVar,${MY_CALLER})="I have been set in
> svtest2 by ${CHANNEL(name)}")
>     same => n,Verbose(1,***In channel:${CHANNEL} sharedVar:
> ${SHARED(sharedVar,Local/s at svtest2)})
>     same => n,Answer()
>     same => n,Hangup()
>
> Thanks again.
>
> (BTW, looking forward to the day when Asterisk gets some kind of
> asynchronous dialplan application - all this "dialling a local
> channel" is just to get via music on hold so there's not silence while
> a long operation happening, as per
> http://lists.digium.com/pipermail/asterisk-users/2016-November/290384.html
> :) )
>

Have you looked into ARI [1]?  I think it would be a closer fit to what you
want
to do.

Richard

[1] https://wiki.asterisk.org/wiki/pages/viewpage.action?pageId=29395573
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-users/attachments/20161127/5bcb3342/attachment.html>


More information about the asterisk-users mailing list