I have setup my dialplan so that agents can become queuemembers, and when a caller presses 5 they should be sent to the queue, and a message plays on the cell phone that says “you are recieving a call from your company press-1 to accept” this is to avoid the call going to personal vm on the cell phone. Then the call should connect, but the call flows normally until I press one, then asterisk hangs the call up. I cant figure out how to connect back to the caller.
here is the relevant sections of the dialplan:
exten => 5,1,Log(NOTICE, Queue call for for queuemembers)
exten => 5,n,Queue(hyperionworks-testqueue,t,30)
exten => 5,n,VoiceMail(123@hyperionworks,u)
exten => 5,n,Hangup()
[hyperionworks-queuemembers]
; When a call is added to the queue
exten => 9001,1,Log(NOTICE, Adding queue member to hyperionworks-testqueue)
exten => 9001,n,GotoIf($[${LEN(${CALLERID(num)})} >= 10]?external:local)
; Add external number (e.g., cellphone) to queue
exten => 9001,n(external),Log(NOTICE, Adding external number to queue)
exten => 9001,n,AddQueueMember(hyperionworks-testqueue,Local/${CALLERID(num)}@cellphone-queue/n) ; Adding cell to queue
exten => 9001,n,Goto(complete)
; Add local extension to queue
exten => 9001,n(local),Log(NOTICE, Adding local extension to queue)
exten => 9001,n,AddQueueMember(hyperionworks-testqueue,SIP/${CALLERID(num)}) ; For local SIP extension
exten => 9001,n,Goto(complete)
exten => 9001,n(complete),Answer()
exten => 9001,n,PlayBack(agent-loginok)
exten => 9001,n,Hangup()
; Removing member from the queue
exten => 9011,1,Log(NOTICE, Removing queue member)
exten => 9011,n,GotoIf($[${LEN(${CALLERID(num)})} >= 10]?external:local)
; Remove external number from queue
exten => 9011,n(external),Log(NOTICE, Removing external number from queue)
exten => 9011,n,RemoveQueueMember(hyperionworks-testqueue,Local/${CALLERID(num)}@cellphone-queue/n)
exten => 9011,n,Goto(complete)
; Remove local extension from queue
exten => 9011,n(local),Log(NOTICE, Removing local extension from queue)
exten => 9011,n,RemoveQueueMember(hyperionworks-testqueue,SIP/${CALLERID(num)})
exten => 9011,n,Goto(complete)
exten => 9011,n(complete),Answer()
exten => 9011,n,PlayBack(agent-logoutok)
exten => 9011,n,Hangup()
[cellphone-queue]
exten => _X.,1,NoOp(Handling call for external cell phone ${EXTEN})
exten => _X.,n,Dial(Local/${EXTEN}@internal-phone,M(cellphone-accept^${EXTEN})) ; Use the macro to handle call acceptance
exten => _X.,n,Hangup()
[macro-cellphone-accept]
exten => s,1,NoOp(Starting Cellphone Acceptance Macro for ${ARG1})
exten => s,n,Answer()
exten => s,n,Wait(2)
exten => s,n,Playback(recordings/press-1)
exten => s,n,Read(DIGIT,1,10)
; Check if ‘1’ was pressed to accept the call
exten => s,n,GotoIf($[“${DIGIT}” = “1”]?accepted:hangup)
; If accepted
exten => s,n(accepted),NoOp(Call Accepted)
; Capture the caller’s channel
exten => s,n,Set(CALLER_CHANNEL=${CHANNEL})
; Capture the peer channel
exten => s,n,Set(PEER_CHANNEL=${BRIDGEPEER})
; Log both channels for debugging purposes
exten => s,n,NoOp(CALLER_CHANNEL=${CALLER_CHANNEL} PEER_CHANNEL=${PEER_CHANNEL})
; Check if PEER_CHANNEL is properly set
exten => s,n,GotoIf($[“${PEER_CHANNEL}” != “”]?bridge:hangup)
; Bridge the two channels
exten => s,n(bridge),Bridge(${CALLER_CHANNEL},${PEER_CHANNEL})
; In case of failure, hang up
exten => s,n(hangup),NoOp(Hangup due to failure or no peer channel)
exten => s,n,Hangup()
exten => s,n,Return()
[internal-phone]
exten => _X.,1,NoOp(Dialing external number ${EXTEN} using LCR macro)
exten => _X.,n,Macro(hw-direct-dial,${EXTEN},${EXTEN},5) ; Call the LCR macro with necessary arguments
exten => _X.,n,Hangup()