I don’t understand how MASTER_CHANNEL works. If I create this simple dialplan:
[context-test]
exten => _[*0-9]!,1,Dial(PJSIP/1002,30,U(sub-test))
same => n,Hangup()
[sub-test]
exten => s,1,NoOP(channel name is '${CHANNEL(name)}' with state '${CHANNEL(state)}')
same => n,NoOP(master channel name is '${MASTER_CHANNEL(name)}' with state '${MASTER_CHANNEL(state)}' and caller id ${MASTER_CHANNEL(CALLERID)})
same => n,Return()
The result is:
-- Executing [1002@context-test:1] Dial("PJSIP/1001-00000000", "PJSIP/1002,30,U(sub-test)") in new stack
-- Called PJSIP/1002
-- PJSIP/1002-00000001 is ringing
-- PJSIP/1002-00000001 is ringing
-- PJSIP/1002-00000001 answered PJSIP/1001-00000000
-- PJSIP/1002-00000001 Internal Gosub(sub-test,s,1) start
-- Executing [s@sub-test:1] NoOp("PJSIP/1002-00000001", "channel name is 'PJSIP/1002-00000001' with state 'Up'") in new stack
-- Executing [s@sub-test:2] NoOp("PJSIP/1002-00000001", "master channel name is '' with state '' and caller id ") in new stack
-- Executing [s@sub-test:3] Return("PJSIP/1002-00000001", "") in new stack
== Spawn extension (context-test, , 1) exited non-zero on 'PJSIP/1002-00000001'
-- PJSIP/1002-00000001 Internal Gosub(sub-test,s,1) complete GOSUB_RETVAL=
-- Channel PJSIP/1002-00000001 joined 'simple_bridge' basic-bridge <04219b54-0a05-4e2b-a3d7-0a51fb4602dd>
-- Channel PJSIP/1001-00000000 joined 'simple_bridge' basic-bridge <04219b54-0a05-4e2b-a3d7-0a51fb4602dd>
-- Channel PJSIP/1002-00000001 left 'native_rtp' basic-bridge <04219b54-0a05-4e2b-a3d7-0a51fb4602dd>
-- Channel PJSIP/1001-00000000 left 'native_rtp' basic-bridge <04219b54-0a05-4e2b-a3d7-0a51fb4602dd>
== Spawn extension (context-test, 1002, 1) exited non-zero on 'PJSIP/1001-00000000'
As you can see the values for MASTER_CHANNEL are empty whereas I was expecting to see some values. I’m a misunderstanding how this function works?