我们正在使用带有8个FXO端口的Asterisk。FXO连接到我们的旧PBX(三星Office Serv 100)。
现在我们想要记录通过FXO路由的所有呼叫(无论是拨打外部电话还是来自外部电话)。
是否有简单的方法可以实现这一点?
我们正在使用带有8个FXO端口的Asterisk。FXO连接到我们的旧PBX(三星Office Serv 100)。
现在我们想要记录通过FXO路由的所有呼叫(无论是拨打外部电话还是来自外部电话)。
是否有简单的方法可以实现这一点?
你是否正在使用纯Asterisk呢?如果是的话,你可以修改你的拨号计划来开始“监控”通道,这将记录通话。
monitor命令的文档:http://www.voip-info.org/wiki/view/Asterisk+cmd+monitor
只是为了完整起见,这里是文档:
[root@localhost ~]# asterisk -rx 'core show application monitor'
-= Info about application 'Monitor' =-
[Synopsis]
Monitor a channel
[Description]
Monitor([file_format[:urlbase],[fname_base],[options]]):
Used to start monitoring a channel. The channel's input and output
voice packets are logged to files until the channel hangs up or
monitoring is stopped by the StopMonitor application.
file_format optional, if not set, defaults to "wav"
fname_base if set, changes the filename used to the one specified.
options:
m - when the recording ends mix the two leg files into one and
delete the two leg files. If the variable MONITOR_EXEC is set, the
application referenced in it will be executed instead of
soxmix and the raw leg files will NOT be deleted automatically.
soxmix or MONITOR_EXEC is handed 3 arguments, the two leg files
and a target mixed file name which is the same as the leg file names
only without the in/out designator.
If MONITOR_EXEC_ARGS is set, the contents will be passed on as
additional arguments to MONITOR_EXEC
Both MONITOR_EXEC and the Mix flag can be set from the
administrator interface
b - Don't begin recording unless a call is bridged to another channel
i - Skip recording of input stream (disables m option)
o - Skip recording of output stream (disables m option)
By default, files are stored to /var/spool/asterisk/monitor/.
Returns -1 if monitor files can't be opened or if the channel is already
monitored, otherwise 0.
这里是一个使用它的示例:
; This fake context records all outgoing calls to /var/spool/asterisk/monitor in wav format.
[fake-outgoing-context]
exten => s,1,Answer()
exten => s,n,Monitor(wav,,b)
exten => s,n,Dial(DAHDI/g0/${EXTEN})
exten => s,n,Hangup()
一个真实的例子是:
exten => _87X,1,NoOp() exten => _87X,n,MixMonitor(${UNIQUEID}.wav,ab) exten => _87X,n,Dial(SIP/${EXTEN},45) exten => _87X,n,StopMixMonitor() exten => _87X,n,Hangup()
始终使用NoOp - 第一条规则必须以1开始,这样您可以随意交换规则并将n步骤放置在任何位置。
最好使用MixMonitor而不是Monitor - Monitor仅记录入站或出站音频 - MixMonitor同时使用两者。
此外,wav是相当不错的选择作为格式 - 我还使用脚本将wav文件转换为OGG - 这是大小/质量和许可问题之间的最佳折衷方案。
关于参数:
a是附加 b是桥接(适用于生产环境-只有在呼叫获得答复时才会记录-不适用于调试)
关于StopMixMonitor(),我只是很全面,但是例如,有些情况下,您可能希望停止录音,例如:
... exten => _39[5-9],n,Dial(SIP/${EXTEN},45) exten => _39[5-9],n,GotoIf($["${DIALSTATUS}" = "BUSY"]?busy:unavailable) exten => _39[5-9],n(busy),NoOp() exten => _39[5-9],n,StopMixMonitor() exten => _39[5-9],n,Voicemail(${EXTEN},u) exten => _39[5-9],n,Hangup() exten => _39[5-9],n(unavailble),NoOp() exten => _39[5-9],n,StopMixMonitor() exten => _39[5-9],n,Hangup() ...
在这个例子中,您会停止语音邮件交互的录音。
希望这能为您解决问题。
根据您Asterisk盒子的规格,您可能会发现这个技巧也很有用。创建一个相当大的ramdisk并将/var/spool/asterisk/monitor挂载到它上面。这样Asterisk就记录到内存而不是磁盘上。然后编写一个cron脚本,每15-30分钟移动一次录音到永久存储。