Setting up a chan_sip trunk for CTCIMS in FreePBX

上周末,我发现FreePBX到中国电信IMS服务器的chan_pjsip中继出现问题,电话呼入遇忙音或报网络问题。经过一番抓包分析后,我用回了chan_sip中继。我估计中国电信近期对IMS服务器作过系统升级,导致跟Asterisk 13 pjsip中继之间的对称SIP/RTP信令的匹配问题。不过,最新版的MicroSIP软电话仍能匹配,电话呼入和呼出都没问题。

要使用chan_sip中继,须在EPON网关上为chan_sip绑定的端口号设置端口转发。

Setup port forwarding on the voice network interface of the epon home gateway

The voice network interface on the epon gateway is 1_VOICE_INTERNET_R_VID_46 (epon0.4).
Note: chan_sip binds to the non-default SIP port 5160 in FreePBX.

服务器名 外部初始端口 外部终止端口 协议 内部初始端口 内部终止端口 服务器IP地址 WAN接口
SIP 5160 5160 UDP 5160 5160 192.168.1.2 epon0.4

Create a chan_sip trunk in FreePBX

  • General:
    • Trunk Name: CTC
    • Outbound Caller ID: 0216XXXXXXX
  • sip Settings:
    • Outgoing:
      • Trunk Name: CTC
      • PEER Details:
        host=15.192.XX.XX
        username=+86216XXXXXXX@sh.ctcims.cn
        secret=xxxxxx
        type=peer
        keepalive=30
        insecure=port,invite
        fromuser=+86216XXXXXXX
        fromdomain=sh.ctcims.cn
        context=from-trunk
        dtmfmode=auto
    • Incoming:
      • Register String: +86216XXXXXXX@sh.ctcims.cn:xxxxxx:+86216XXXXXXX@sh.ctcims.cn@15.192.XX.XX

Asterisk SIP Settings

  • General SIP Settings
    • NAT Settings
      • External Address: 28.XX.XX.XXX (IP address of epon0.4)
      • Local Networks: 192.168.0.0/16
  • Chan SIP Settings
    • NAT Settings
      • NAT: yes
      • IP Configuration: Static IP
    • Registration Settings
      • Registration Minimum Expiry: 1500
      • Registration Default Expiry: 1500

Updates

2020-06-15

  • Pressing number keys doesn't work with IVR systems. Add dtmfmode=auto to "PEER Details" to resolve the issue.

See also