Get Channel names after separation with Dial option G


when I use Dial() with option “G” to seperate caller and callee channels, how do I get each other’s channel name?


exten => _0ZX.,1,NoOp(Starting Dialout Procedure)
same => n,Dial(SIP/....@sipout,30,rG(sep,s,1))

exten => s,1,Goto(sep-caller,s,1)
exten => s,2,Goto(sep-callee,s,1)

exten => s,1,NoOp(Channel names: caller=${CDR(channel)} callee=????) 

exten => s,1,NoOp(Channel names: caller=??? callee=${CDR(channel)}) 

The reason why I need the channel name is to set variables iin the other’s channel context:

exten => s,1,Set(SHARED(varname,${CDR(dstchannel)})=value)

this doesn’t work because CDR(dstchannel) is getting lost within the sep context.
If I output this var in line 1 its still set, maybe a bug?

exten => s,1,NoOp(Here it is set.... dstchannel=${CDR(dstchannel)})
exten => s,2,NoOp(Here no more.... dstchannel=${CDR(dstchannel)})

(in this example I refer only to the caller channel context. Why does CDR(dstchannel) gets unset between priority 1 and 2 within the same channel context? This behaviour has changed with version 14.7.6.

  • McJoey

The B side can simply inherit the A side channel from a variable.

I half remember that you can use something like bridge peer or dial peer to get the B side from A side. There was certainly a way of doing it in Asterisk 1.6, but I can’t remember with certainty. Have a look at the source code for app_dial.c, and see what it sets.