[asterisk-users] Variable inheritance with dialplan command Originate

Jim Dickenson dickenson at cfmc.com
Fri Apr 8 11:05:00 CDT 2011


Another option is to pass the information in the extension. At times I have an extension like

_[s][o][m][e]-[e][x][a][m][p][l][e].

And call it like some-example:info1:info2 and use cut to extract the info1 and info2 values. Not real pretty but as this is computer generated calls it gets the job done.
-- 
Jim Dickenson
mailto:dickenson at cfmc.com

CfMC
http://www.cfmc.com/



On Apr 8, 2011, at 8:57 AM, Naomi Rosenberg wrote:

> 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
> 
> --
> _____________________________________________________________________
> -- 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