Dear,
The goal is to set up a conference call where Party A calls Party B and Party C, and then Party A initiates the conference by dialing 7777. The logic involves dynamically creating a conference room and redirecting all active channels into it. However, only the current channel (Party A) is being redirected into the conference room, while the other channels (Party B and Party C) are not joining the conference as intended.
asterisk 13.
Here is my dialplan logic.
exten => 7777,1,NoOp(Starting dynamic channel handling)
; Create a unique conference room ID
same => n,Set(CONF_ROOM=${UNIQUEID})
same => n,Verbose(1, “Conference Room: ${CONF_ROOM}”)
; Store the conference room ID in AstDB
same => n,Set(DB(conference/${CONF_ROOM})=${CONF_ROOM})
same => n,Verbose(1, "Stored conference room ${CONF_ROOM} in AstDB")
; Fetch all channels for the Caller ID
same => n,Set(CALLER_ID=03004262303)
same => n,Set(PARTY_A_CALLS=${SHELL(asterisk -rx "core show channels concise" | grep ${CALLER_ID} | awk -F'!' '{print $1}' | tr '\n' ':')})
same => n,Verbose(1, "Active channels for Caller ID ${CALLER_ID}: ${PARTY_A_CALLS}")
; Validate that PARTY_A_CALLS is not empty
same => n,ExecIf($["${PARTY_A_CALLS}" = ""]?Verbose(1, "No active channels found for Caller ID: ${CALLER_ID}")?Goto(end))
; Loop through all channels and redirect them to the conference
same => n,Set(CHANNEL_LIST=${PARTY_A_CALLS})
same => n,While($["${CHANNEL_LIST}" != ""])
same => n,Verbose(1, "Remaining CHANNEL_LIST: ${CHANNEL_LIST}")
same => n,Set(CURRENT_CHANNEL=${CUT(CHANNEL_LIST,:,1)}) ; Get the first channel
same => n,Set(CHANNEL_LIST=${CUT(CHANNEL_LIST,:,2-)}) ; Remove the processed channel
same => n,ExecIf($["${CURRENT_CHANNEL}" != ""]?Verbose(1, "Attempting to redirect: ${CURRENT_CHANNEL}"))
same => n,ExecIf($["${CURRENT_CHANNEL}" != ""]?ChannelRedirect(${CURRENT_CHANNEL},conference-join,s,1))
same => n,ExecIf($["${CURRENT_CHANNEL}" != ""]?Verbose(1, "Redirect status: ${CHANNELREDIRECTSTATUS}"))
same => n,EndWhile()
; Start the conference for the current caller (non-blocking mode)
same => n,ConfBridge(${CONF_ROOM},default_bridge,default_user,default_menu)
; End label
same => n(end),NoOp(Dialplan execution finished for Caller ID ${CALLER_ID})
[conference-join]
exten => s,1,Verbose(1, “Joining conference room…”)
; Retrieve the conference room ID from AstDB
same => n,Set(CONF_ROOM=${DB(conference/${CONF_ROOM})})
same => n,Verbose(1, “Retrieved conference room ${CONF_ROOM} from AstDB”)
same => n,ConfBridge(${CONF_ROOM},default_bridge,default_user,default_menu)
and console logs are:
-- Executing [7777@tp-opensips:1] NoOp("SIP/mbl-callmax-00000004", "Starting dynamic channel handling") in new stack
-- Executing [7777@tp-opensips:2] Set("SIP/mbl-callmax-00000004", "CONF_ROOM=1737375334.4") in new stack
-- Executing [7777@tp-opensips:3] Verbose("SIP/mbl-callmax-00000004", "1, "Conference Room: 1737375334.4"") in new stack
“Conference Room: 1737375334.4”
– Executing [7777@tp-opensips:4] Set(“SIP/mbl-callmax-00000004”, “DB(conference/1737375334.4)=1737375334.4”) in new stack
– Executing [7777@tp-opensips:5] Verbose(“SIP/mbl-callmax-00000004”, “1, “Stored conference room 1737375334.4 in AstDB””) in new stack
“Stored conference room 1737375334.4 in AstDB”
– Executing [7777@tp-opensips:6] Set(“SIP/mbl-callmax-00000004”, “CALLER_ID=03004262303”) in new stack
– Remote UNIX connection
– Remote UNIX connection disconnected
– Executing [7777@tp-opensips:7] Set(“SIP/mbl-callmax-00000004”, “PARTY_A_CALLS=SIP/mbl-callmax-00000004:SIP/mbl-callmax-00000002:SIP/mbl-callmax-00000000:”) in new stack
– Executing [7777@tp-opensips:8] Verbose(“SIP/mbl-callmax-00000004”, “1, “Active channels for Caller ID 03004262303: SIP/mbl-callmax-00000004:SIP/mbl-callmax-00000002:SIP/mbl-callmax-00000000:””) in new stack
“Active channels for Caller ID 03004262303: SIP/mbl-callmax-00000004:SIP/mbl-callmax-00000002:SIP/mbl-callmax-00000000:”
– Executing [7777@tp-opensips:9] ExecIf(“SIP/mbl-callmax-00000004”, “0?Verbose(1, “No active channels found for Caller ID: 03004262303”)?Goto(end)”) in new stack
– Executing [7777@tp-opensips:10] Set(“SIP/mbl-callmax-00000004”, “CHANNEL_LIST=SIP/mbl-callmax-00000004:SIP/mbl-callmax-00000002:SIP/mbl-callmax-00000000:”) in new stack
– Executing [7777@tp-opensips:11] While(“SIP/mbl-callmax-00000004”, “1”) in new stack
– Executing [7777@tp-opensips:12] Verbose(“SIP/mbl-callmax-00000004”, “1, “Remaining CHANNEL_LIST: SIP/mbl-callmax-00000004:SIP/mbl-callmax-00000002:SIP/mbl-callmax-00000000:””) in new stack
“Remaining CHANNEL_LIST: SIP/mbl-callmax-00000004:SIP/mbl-callmax-00000002:SIP/mbl-callmax-00000000:”
– Executing [7777@tp-opensips:13] Set(“SIP/mbl-callmax-00000004”, “CURRENT_CHANNEL=SIP/mbl-callmax-00000004”) in new stack
– Executing [7777@tp-opensips:14] Set(“SIP/mbl-callmax-00000004”, “CHANNEL_LIST=SIP/mbl-callmax-00000002:SIP/mbl-callmax-00000000:”) in new stack
– Executing [7777@tp-opensips:15] ExecIf(“SIP/mbl-callmax-00000004”, “1?Verbose(1, “Attempting to redirect: SIP/mbl-callmax-00000004”)”) in new stack
“Attempting to redirect: SIP/mbl-callmax-00000004”
– Executing [7777@tp-opensips:16] ExecIf(“SIP/mbl-callmax-00000004”, “1?ChannelRedirect(SIP/mbl-callmax-00000004,conference-join,s,1)”) in new stack
– Executing [s@conference-join:1] Verbose(“SIP/mbl-callmax-00000004”, “1, “Joining conference room…””) in new stack
“Joining conference room…”
– Executing [s@conference-join:2] Set(“SIP/mbl-callmax-00000004”, “CONF_ROOM=1737375334.4”) in new stack
– Executing [s@conference-join:3] Verbose(“SIP/mbl-callmax-00000004”, “1, “Retrieved conference room 1737375334.4 from AstDB””) in new stack
“Retrieved conference room 1737375334.4 from AstDB”
– Executing [s@conference-join:4] ConfBridge(“SIP/mbl-callmax-00000004”, “1737375334.4,default_bridge,default_user,default_menu”) in new stack
> 0x7f5f84026c90 – Strict RTP qualifying stream type: audio
> 0x7f5f84026c90 – Strict RTP switching source address to 12.29.211.22:2480
– <SIP/mbl-callmax-00000004> Playing ‘vm-rec-name.gsm’ (language ‘en’)
– <SIP/mbl-callmax-00000004> Playing ‘beep.gsm’ (language ‘en’)
> 0x7f5f84026c90 – Strict RTP learning complete - Locking on source address 12.29.211.22:2480
– x=0, open writing: /var/spool/asterisk/confbridge/confbridge-name-1737375334.4-1737375334.4 format: sln, 0x7f5fec003598
– User ended message by pressing #
– <SIP/mbl-callmax-00000004> Playing ‘auth-thankyou.gsm’ (language ‘en’)
> 0x7f5f840153a0 – Strict RTP learning complete - Locking on source address 12.29.211.22:2475
– Channel CBAnn/1737375334.4-00000000;2 joined ‘softmix’ base-bridge <9398e43f-56de-4a3a-bd13-04cbdf7ee3fa>
– <SIP/mbl-callmax-00000004> Playing ‘conf-onlyperson.gsm’ (language ‘en’)
– <CBAnn/1737375334.4-00000000;1> Playing ‘/var/spool/asterisk/confbridge/confbridge-name-1737375334.4-1737375334.4.slin’ (language ‘en’)
– <CBAnn/1737375334.4-00000000;1> Playing ‘conf-hasjoin.gsm’ (language ‘en’)
– Started music on hold, class ‘default’, on channel ‘SIP/mbl-callmax-00000004’
– Channel SIP/mbl-callmax-00000004 joined ‘softmix’ base-bridge <9398e43f-56de-4a3a-bd13-04cbdf7ee3fa>
– <CBAnn/1737375334.4-00000000;1> Playing ‘confbridge-join.gsm’ (language ‘en’)
– Stopped music on hold on SIP/mbl-callmax-00000004
– Channel SIP/mbl-callmax-00000004 left ‘softmix’ base-bridge <9398e43f-56de-4a3a-bd13-04cbdf7ee3fa>
– <CBAnn/1737375334.4-00000000;1> Playing ‘/var/spool/asterisk/confbridge/confbridge-name-1737375334.4-1737375334.4.slin’ (language ‘en’)
– <CBAnn/1737375334.4-00000000;1> Playing ‘conf-hasleft.gsm’ (language ‘en’)