SpyChan 用於第三者監聽兩方的通話,一般多用於 Call Center 系統。
設計一個 feature code 779 & 778 ,用於啟動/關閉分機的監聽功能。
[app-chanspy] ;include => app-chanspy-custom ;exten => 779,1,Authenticate(1234) ;exten => 779,n,Read(SPYNUM,extension) ;exten => 779,n,ChanSpy(SIP/${SPYNUM},q) exten => 779,1,Authenticate(4567) exten => 779,n,Goto(chanspy-ext,s,1) ; end of [app-chanspy] [app-chanspy] ;include => app-chanspy-custom exten => 778,1,Authenticate(4544) exten => 778,n,Macro(user-callerid,) exten => 778,n,Answer exten => 778,n,Wait(1) exten => 778,n,ChanSpy() exten => 778,n,Hangup ; end of [app-chanspy] [chanspy-ext] exten => s,1,Background(extension) exten => s,n,WaitExten(5) exten => i,1,Playback(invalid) exten => i,2,Goto(s,1) exten => t,1,Playback(invalid) exten => t,2,Goto(s,1) exten => 111,1,ChanSpy(SIP/${EXTEN})
SPYGROUP 的運用
方式一:
7791 -> 分機開啟被監聽功能
7792 -> 分機關閉被監聽功能
[ext-local-custom] exten => s,1,Set(GROUP=${DB(spygrp/${CALLERID(number)})) exten => s,n,GotoIf($[${ISNULL(${GROUP})}]?:continue) exten => s,n,NoOp(SPYGROUP is <${GROUP}> for ext.${CALLERID}) exten => s,n,Set(SPYGROUP=${GROUP}) exten => s,n(continue),NoOP(Ignore SPYGROUP...)
[app-chanspy-set-on] exten => 7791,1,Answer exten => 7791,n,Wait(1) exten => 7791,n,Macro(user-callerid,) exten => 7791,n,Set(DB(spygrp/${AMPUSER})=spyon) exten => 7791,n,Playback(activated) exten => 7791,n,Hangup
[app-chanspy-set-off] exten => 7792,1,Answer exten => 7792,n,Wait(1) exten => 7792,n,Macro(user-callerid,) exten => 7792,n,DBDel(spygrp/${AMPUSER}) exten => 7792,n,Playback(de-activated) exten => 7792,n,Hangup
方式二:
用於所有 Inbound Call,若目的分機為 110-160 時,啟用監聽功能。
注意 Set(__SPYGROUP=spygrp),兩個底線的用法。
使用 override 方式修改 [macro-dial] 在 extensions.conf
[macro-dial] exten => s,1,NoOp("------------ Set SPYGROUP -------------") exten => s,n,Set(TOEXT=${ARG3}) ;exten => s,n,Set(TOEXT="150") ; Spy activate to ext.110-160 ;exten => s,n,GotoIf($[ $["x${LEN(${TOEXT})}"="x3"] & $["x${TOEXT:0:1}"="x1"] & $[${TOEXT:1:1}<=6] ]?spy:nospy) exten => s,n,GotoIf($[ $["x${LEN(${TOEXT})}"="x3"] & $[${TOEXT:0:3}<=201] & $[${TOEXT:0:3}>110] ]?spy:continue) exten => s,n(spy),Set(__SPYGROUP=spygrp) exten => s,n(continue),NoOp("--------- Nothing --------") exten => s,n,GotoIf($["${MOHCLASS}" = ""]?dial) exten => s,n,SetMusicOnHold(${MOHCLASS}) exten => s,n(dial),AGI(dialparties.agi) exten => s,n,NoOp(Returned from dialparties with no extensions to call and DIALSTATUS: ${DIALSTATUS}) ...
方法三:
使用資料庫的方式來管理所有分機的 SPYGroup,非常實用,方便與其他系統作整合。
官方網站:http://code.google.com/p/spygroup/
參考連結
- Asterisk::ChanSpy
- FreePBX::ChanSpy - Customization in FreePBX
- FreePBX::CHANSPY SPYGROUP
- Using the Asterisk Database (AstDB)
- [Elastix] Is there a way to Listen-in on calls ?
Asterisk cmd ChanSpy
ChanSpy
Synopsis
Listen in on a call. Useful in a call center to monitor agents on the phone.Description
See bug 3836This adds the ability to spy on any bridged call, this includes VoIP only calls where ZapScan/ZapBarge couldn't this can.
Chanspy([<chanprefix>][,<options>])
Valid Options:
- b: Only spy on channels involved in a bridged call.
- g(grp): Match only channels where their ${SPYGROUP} variable is set to contain 'grp' in an optional : delimited list.
- q: Don't play a beep when beginning to spy on a channel, or speak the selected channel name.
- r([basename]): Record the session to the monitor spool directory. An optional base for the filename may be specified.
The default is 'chanspy'. ChanSpy only records to a .raw file.
- v([value]): Adjust the initial volume in the range from -4 to 4. A negative value refers to a quieter setting.
Since 1.4:
- w Enable 'whisper' mode, so the spying channel can talk to the spied-on channel.
- W Enable 'private whisper' mode, so the spying channel can talk to the spied-on
channel but cannot listen to that channel.
Since 1.6:
- o: Only listen to audio coming from this channel.
- X: Allow the user to exit ChanSpy to a valid single digit numeric extension in the current context or
the context specified by the SPY_EXIT_CONTEXT channel variable. The name of the last channel
that was spied on will be stored in the SPY_CHANNEL variable.
- e(ext): Enable 'enforced' mode, so the spying channel can only monitor extensions whose name
is in the 'ext' : delimited list.
If <chanprefix> is specified, only channel names *beginning* with that string will be scanned.
('all' or an empty string are also both valid <chanprefix>)
While spying, the following actions may be performed:
Dialing # cycles the volume level.
Dialing * will stop spying and look for another channel to spy on.
Dialing a series of digits followed by # builds a channel name to append to <chanprefix>
(e.g. run ChanSpy(Agent) and dial 1234# while spying to jump to channel Agent/1234)
Update : Asterisk 1.4 includes a 'whisper' feature as part of ChanSpy(): A third party may speak to only one of the two parties of a bridged call.
Attention
- Up to and including Asterisk 1.4.17 ChanSpy can cause a crash/segfault if used together with Monitor or MixMonitor at the same time. 1.4.18 is supposed to attack this issue by using "audiohooks" that replaces the current ChanSpy approach.
Example
exten => 556,1,ChanSpy(scan)Note:
ChanSpy will not work if you are Record()-ing the spied channel; unless you add transmit_silence_during_record=yes to the options section in /etc/asterisk/asterisk.confSee also
- Original description of ChanSpy from Digium (Asterisk 1.6)
- ExtenSpy: Listen/whisper to a specific extension (introduced in Asterisk 1.4)
- Recording calls with Asterisk
- Asterisk cmd ZapBarge: Listen to a Zap channel call
- Asterisk cmd ZapScan
- Click to Spy for Windows, Linux & Mac, DialApplet