[asterisk-users] Variable inheritance with dialplan command Originate

Naomi Rosenberg naomi at dmcip.com
Fri Apr 8 10:57:27 CDT 2011


Thanks. That's as I thought (feared). Dial is not an option in this case but I have come up with a workaround involving using a reference number as the extension and then doing a database call. Not pretty but it works!

Naomi 
----- Original Message -----
From: "Sherwood McGowan" <sherwood.mcgowan at gmail.com>
To: asterisk-users at lists.digium.com
Sent: Friday, 8 April, 2011 4:35:43 PM
Subject: Re: [asterisk-users] Variable inheritance with dialplan command Originate

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


--
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
New to Asterisk? Join us for a live introductory webinar every Thurs:
http://www.asterisk.org/hello

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
http://lists.digium.com/mailman/listinfo/asterisk-users



More information about the asterisk-users mailing list