[Asterisk-Users] Variable Inheritance - Set in Child, Read by Parent

Peter Beckman beckman at purplecow.com
Wed May 17 13:24:32 MST 2006


Thanks for the fast reply, Kevin!

On Wed, 17 May 2006, Kevin P. Fleming wrote:

> Peter Beckman wrote:
>
>>     1. Can I modify variables set in the parent context in the child
>>        context and read them again in the parent context?
>
> Not 'context', 'channel'. The macro you are supplying is running on an
> outbound channel created by the Dial() application, so the simple answer
> is no, there is no way for the code running on that channel to modify
> variables owned by the channel that created it.

  Can I set a channel variable in say IAX2/100104 from IAX2/100105?  Is
  there potentially another way, other than say writing a file to disk in
  the macro and reading that file in the parent?  That's the best I could
  come up with... :-(

  I guess I could also set a Global variable called FOO_${CHANNEL}, pass
  that name to the macro, have it set the Global variable, then destroy it
  once I read it in the parent.

  I was hoping for a cleaner option...

>>     2. Is there a better way to hand back "status" of a Macro executed by
>>        the Dial() command?
>
> It's possible that MACRO_RESULT might get passed back, I'm not sure.

  But MACRO_RESULT must be CONTINUE in order for the Macro to hang up on the
  dialed party and continue through the parent context; if I set it to 1, 2,
  3 or 4, when the Macro reaches its end, the Macro will connect the call,
  which is not the intended action.

  I've poured over the docs, README.variables, some of the doxygen docs, the
  wiki, and it doesn't seem there is an easy way to do this.

  Thanks for the quick reply Kevin!

Beckman
---------------------------------------------------------------------------
Peter Beckman                                                  Internet Guy
beckman at purplecow.com                             http://www.purplecow.com/
---------------------------------------------------------------------------



More information about the asterisk-users mailing list