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

6 thoughts on “Setting up a chan_sip trunk for CTCIMS in FreePBX”

  1. 也发现这问题了,每次重启能工作,没多久就断了。
    请教一下,为啥要在猫上端口转发?还有chan_sip只能使用猫的5160端口吗?

    1. 原来 是RASPBERRY PI发热的问题。后来改到OPENWRT下运行ASTERISK工作了一段时间。

    2. 因为chan_sip对nat支持不好,需要手动设置,并且需要在猫上设置端口转发

  2. 我在OPENWRT下装的ASTERISK运行几个月,(SIP.conf)挺正常的。
    这周开始,不能注册到上海电信了,显示 SIP_REG TIMEOUT。
    你现在还能工作吗?

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.