星号自动通话录音

时间:2010-03-13 12:59:34

标签: asterisk

我们用8端口FXO运行星号。 FXO连接到我们的旧PBX(Samsung Office Serv 100)。

现在我们要记录通过FXO路由的所有呼叫(如果它被拨到外面或从外面传来)。

这是图

           |------|---------------------------------
           |      |--------------24 Lines ---------- Other clasic Phones
PRI------  | PBX  |---------------------------------
           |      |
           |      |
           |      |-----------|---------|
           |      |--8 lines--|         |---------         
           |      |-----------|Asterisk |---------- 50 SIP phone
           |------|           |         |----------
                              |---------|----------

有一种简单的方法吗?

3 个答案:

答案 0 :(得分:23)

你在运行普通的星号吗?如果是这样,您可以修改拨号计划以开始“监控”通道,该通道将记录通话。

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()

显然你必须对我的代码进行更改,但希望这会给你一个好主意。

答案 1 :(得分:9)

现实生活中的例子是


    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()
    ...

在此示例中,您将停止录制语音邮件交互。

希望这会为此事带来一些启示。

答案 2 :(得分:5)

根据您的Asterisk框的规格,您可能会发现此黑客也很有用。创建一个相当大的ramdisk并挂载/ var / spool / asterisk / monitor。那样Asterisk记录到内存而不是磁盘。然后在cron下面编写一个脚本,每15-30分钟左右将录音移动到永久存储器中。

相关问题