Here is the dialplan
[from-internal]
; Regular call setup between caller and callee
exten => _5XXX,1,NoOp(Setting up call from ${CALLERID(num)} to ${EXTEN})
same => n,GoSub(blacklist-check,s,1(${CALLERID(num)})) ; Check if the caller is blacklisted
same => n,Set(CONFROOM=${RAND(1000,9999)}) ; Generate a unique conference room ID
same => n,Set(__CALLER_CONFROOM=${CONFROOM}) ; Pass CONFROOM to caller channel
same => n,Set(__CALLEE_CONFROOM=${CONFROOM}) ; Pass CONFROOM to callee channel
same => n,Set(__DIALED_EXT=${EXTEN}) ; Pass dialed extension to both channels
same => n,Set(__DYNAMIC_FEATURES=join_conference) ; Enable the feature code to join the conference
same => n,Dial(PJSIP/${EXTEN},20,tT) ; Regular call between caller and callee
same => n,Hangup()
[conference-setup]
exten => s,1,NoOp(Moving parties to conference room ${CALLER_CONFROOM})
same => n,Set(CONFROOM=${CALLER_CONFROOM}) ; Use the predefined conference room
same => n,GotoIf($[“${CONFROOM}” = “”]?error) ; Ensure CONFROOM is set
same => n,GotoIf($[“${GLOBAL(RECORD_${CONFROOM})}” = “1”]?skip_recording)
same => n,Set(GLOBAL(RECORD_${CONFROOM})=1) ; Mark recording as started
same => n,Set(CONF_FILE=conference-${CALLERID(num)}-to-${DIALED_EXT}-room-${CONFROOM}-${STRFTIME(${EPOCH},%Y%m%d-%H%M%S)}.wav)
same => n,MixMonitor(${CONF_FILE},b) ; Start recording
same => n(skip_recording),ConfBridge(${CONFROOM},default_bridge,default_user,conference_menu)
same => n,Return()
exten => s,n(error),NoOp(Error: CONFROOM is not set)
same => n,Hangup()
[add-participant]
exten => s,1,NoOp(Adding participant to conference room ${CONFROOM})
same => n,Read(ADD_EXTEN,please-enter-the-extension) ; Prompt for extension
same => n,GotoIf($[“${ADD_EXTEN}”=“”]?end)
same => n,Dial(PJSIP/${ADD_EXTEN},20)
same => n,GotoIf($[“${DIALSTATUS}”=“ANSWER”]?add_to_conference)
same => n,Playback(vm-nobodyavail) ; Notify if no answer
same => n(end),Return()
exten => s,n(add_to_conference),Set(CONFROOM=${CONFROOM})
same => n,ConfBridge(${CONFROOM},default_bridge,default_user,conference_menu)
same => n,Return()
/etc/asterisk/features.conf is configured as below
[applicationmap]
join_conference => *3,both,Gosub(conference-setup,s,1)
When *3 is pressed, core show channels in asterisk cli shows that caller goes to the conference room but callee stays in Dial Application
