Get the original channel name in attended transfer context

Hello,

I’d like to know how to get the original channel name when my agent make an attended transfer. With the original channel name I’d like to stop the call recording with StopMixMonitor() function.

Here’s the scenario :

  • A call enter in my queue
  • When an agent is available, the call is answered by an agent and recording starts on original channel
  • If the agent transfers the call (by using 91 prefix), I’d like to get the original channel for stoping the call recording in hangup_handler context. But, when agent hangup the hangup_handler context is executed but the channel name is not the same.

Here’s my dialplan :

[test_svc]
exten => _0.,1,Answer()
same => n,Set(MONITOR_FILENAME=${UNIQUEID}-TEST_SVC-${CALLERID(num)}-${STRFTIME(${EPOCH},,%d%m%Y-%H%M%S)}-IN)
same => n,Set(CHANNEL(hangup_handler_push)=hangup_handler,s,1(${CHANNEL}))
same => n,GotoIfTime(09:00-18:00,mon-thu,*,*?open)
same => n(closed),Set(CDR(userfield)=Q117|CLOSED)
same => n(closed),Wait(1)
same => n(closed),Hangup()
same => n(open),Wait(2)
same => n(open),Queue(Q117,t)
same => n(open),Hangup()

[hangup_handler]
exten => s, 1, NoOP(Call ID =========> ${UNIQUEID})
 same  => n, Set(CDR(dialstatus)=${DIALSTATUS})
 same  => n, Set(CDR(codec)=${CHANNEL(audionativeformat)})
 same  => n, Set(CDR(rtp_qos)=l${CUT(CHANNEL(rtpqos,audio,all),l,2-)})
 same  => n, Set(CDR(isup_cause)=${HANGUPCAUSE})
 same  => n, Return()

[outgoing_calls]
exten => _91XXXXXXXXXX,1,Set(CHANNEL(hangup_handler_push)=hangup_handler,s,1(test))
exten => _91XXXXXXXXXX,n,GotoIf($["${record}"="1"]?record:norecord)
exten => _91XXXXXXXXXX,n(record),MixMonitor(${UNIQUEID}-${EXTEN}-${CHANNEL(NAME):4:4}-${STRFTIME(${EPOCH},,%d%m%Y-%H%M%S)}-STA.wav)
exten => _91XXXXXXXXXX,n(norecord),SIPAddHeader(X-CALLERIDNUM : 03XXXXXXXX)
exten => _91XXXXXXXXXX,n(norecord),Dial(SIP/company-out/99${EXTEN:-10},30)
exten => _91XXXXXXXXXX,n,Playtones(congestion)
exten => _91XXXXXXXXXX,n,Congestion()

Thank you in advance.

If it helps, most, or all, things take a channel name will also accept the channel unique ID.

I haven’t analyzed your case to see if you actually do have the same channel under the same name or if both name and channel have changed.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.