Disable call recording/spychan after attended transfer in Asterisk

Hi There,

I’d like to know how to disable call recording or spychan after an attended transfer. I’m not using the attended transfer feature. Here’s the context:

  • An incoming call is waiting in a queue.
  • When a station is ready, the call is answered by an agent. The call
    is recorded by the queue. The call can be observed with spychan
    function.
  • If the agent transfers the call, the record is always in progress and
    it’s possible to spy the channel.

Now I want to stop the record after the transfer and block spy for transferred call.

Here’s my dial plan:

[spy_incoming]
exten => _0.,1,Answer()
same => n,Wait(1)
same => n,Authenticate(99999,a)
same => n,Wait(1)
same => n,Read(SPYGRP,agent-newlocation)
same => n,Background(beep)
same => n,ChanSpy(,g(${SPYGRP}),q)
same => n,Hangup()

[test_svc]
exten => _0.,1,Answer()
same => n,Set(MONITOR_FILENAME=${UNIQUEID}-TEST-${CALLERID(num)}-${STRFTIME(${EPOCH},,%d%m%Y-%H%M%S)}-IN)
same => n,Set(CHANNEL(hangup_handler_push)=hangup_handler,s,1)
same => n,Set(SPYGROUP=3737)
same => n,GotoIfTime(*,*,1,jan?closed)
same => n,GotoIfTime(*,*,1,may?closed)
same => n,GotoIfTime(*,*,8,may?closed)
same => n,GotoIfTime(*,*,14,jul?closed)
same => n,GotoIfTime(*,*,15,aug?closed)
same => n,GotoIfTime(*,*,1,nov?closed)
same => n,GotoIfTime(*,*,11,nov?closed)
same => n,GotoIfTime(*,*,25,dec?closed)
same => n,GotoIfTime(08:30-13:00,mon-fri,*,*?open)
same => n,GotoIfTime(13:30-17:00,mon-thu,*,*?open)
same => n,GotoIfTime(13:00-16:00,fri,*,*?open)
same => n(closed),Playback(Fermeture)
same => n(closed),Wait(1)
same => n(closed),Hangup
same => n(open),Wait(2)
same => n(open),Queue(Q199,t)
same => n(open),Hangup()

Here are the parameters of my queue:

name:Q119
musiconhold:test
announce:
context:internal
timeout:10
ringinuse:no
setinterfacevar:
setqueuevar:
setqueueentryvar:
monitor_format:wav
membermacro:
membergosub:
queue_youarenext:
queue_thereare:
queue_callswaiting:
queue_quantity1:
queue_quantity2:
queue_holdtime:
queue_minutes:
queue_minute:
queue_seconds:
queue_thankyou:
queue_callerannounce:
queue_reporthold:
announce_frequency:
announce_to_first_user:
min_announce_frequency:
announce_round_seconds:
announce_holdtime:
announce_position:
announce_position_limit:
periodic_announce:
periodic_announce_frequency:
relative_periodic_announce:
random_periodic_announce:
retry:3
wrapuptime:1
penaltymemberslimit:
autofill:
monitor_type:MixMonitor
autopause:
autopausedelay:
autopausebusy:
autopauseunavail:
maxlen:0
servicelevel:
strategy:rrmemory
joinempty:yes
leavewhenempty:no
reportholdtime:no
memberdelay:
weight:
timeoutrestart:
defaultrule:
timeoutpriority:

I’m using Asterisk 13.12.1.

Thanks a lot.
Julien

I suppose you can do this by adding a prefix before transfer number and then write a script to hangup ChanSpy channel and then transfer it to your desired extension.

For example, if you want to transfer to extension 100, dialplan will look like this (I am supposing you will use 99 as prefix and dial 99100 to transfer to ext. 100):

exten => _99X.,1,AGI(your-agi-to-hangup-spied-channel)
same => n,Dial(SIP/{EXTEN:2})