Is there any way to access a variable on the parent channel?
I have played with MASTER_CHANNEL and gotten it work, but the problem is MASTER_CHANNEL is 2 levels up. In other words, I have two Dial(Local/…/n)'s inbetween. I only want to go up to the middle one. I looked through the list of functions but I don’t see anything applicable. Most are related to subroutines and accessing variables in the same channel but down the stack.
Basically, here is a simple example that illustrates the concept:
[context-a]
exten => s,1,Set(CDR(myvar)=1)
same => n,Dial(Local/ext@context-b/n,g)
same => n,Hangup()
[context-b]
exten => s,1,Read(digits)
; set CDR(myvar) on the calling channel to {digits}
same => n,Dial(SIP/somethingelse/{digits},g)
same => n,Hangup(${HANGUPCAUSE})
In this case, I am trying to set a CDR variable on the calling channel, and I can’t think of another way to do this as CDR is not accessible after the channel hangs up and returns execution flow to the parent channel. So, how can I access one channel up instead of all the way to the top? Basically, looking for something like PARENT_CHANNEL() instead of MASTER_CHANNEL(), where I could specify the # of channels up to go - similar to the relevant subroutine local peek function.
Any ideas?