[asterisk-users] Variable inheritance with dialplan command Originate

Sherwood McGowan sherwood.mcgowan at gmail.com
Fri Apr 8 10:35:43 CDT 2011


On 4/8/2011 4:57 AM, Naomi Rosenberg wrote:
> Hi,
>
> I would have thought that when spawning a channel using the Originate() dialplan command, variables prefixed with two underscores would be preserved.
>
> However this does not work in the following case.
>
> Dialplan code:
>
> [intern]
> exten => 200,1,Set(__myvar="foo")
> exten => 200,n,Originate(Local/123 at test_orig,exten,dummy)
>
> [test_orig]
> exten => 123,1,NoOp(${myvar})
> exten => 123,n,Hangup()
>
> [dummy]
>
> /end dialplan code.
>
> Console output:
>
>     -- Executing [200 at intern:1] Set("SIP/200-00000018", "__myvar="foo"") in new stack
>     -- Executing [200 at intern:2] Originate("SIP/200-00000018", "Local/123 at test_orig,exten,dummy") in new stack
>     -- Executing [123 at test_orig:1] NoOp("Local/123 at test_orig-cbab;2", "") in new stack
>     -- Executing [123 at test_orig:2] Hangup("Local/123 at test_orig-cbab;2", "") in new stack
>
>
> /end console output.
>
> This is in Asterisk 1.8.3.
>
> Is this expected behaviour or a bug, or am I just confused? I would appreciate your thoughts on the matter.
>
> Thank you,
>
> Naomi 

I believe that it's expected behavior because you're not creating a
"child" channel, you're originating a different set. Try using Dial
instead of Originate, and you'll get the inheritance behavior you expected.

-- 
Sherwood McGowan <sherwood.mcgowan at gmail.com>
Carrier, ITSP, Call Center, and PBX Solutions Consultant




More information about the asterisk-users mailing list