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

Upgrading an OpenWrt 18.06.1 x86_64 ext4 image to 18.06.2

Before proceeding, power off your OpenWrt 18.06.1 ext4 system and create a backup image.

Upgrade all non-core packages

You know the drill. If a netifd update is available, upgrade it first. Upgrading netifd will restart the network interface daemon, and if netifd is upgraded together with other packages, they will fail to download while the network interfaces are being re-initialized.

Continue reading Upgrading an OpenWrt 18.06.1 x86_64 ext4 image to 18.06.2

Deploying certificates to Prosody automatically upon Certbot renewal

Certbot, developed by EFF, is a popular and easy-to-use ACME client to request and deploy SSL/TLS certificates from Let's Encrypt.

On Ubuntu 16.04 and later systems, a systemd timer, instead of a cron job, is used to schedule automatic renewal of certificates.

Continue reading Deploying certificates to Prosody automatically upon Certbot renewal

Setting up a DNS-over-TLS forwarding cache on OpenWrt Snapshot (r6693 or later)

This article describes how to set up a local DNS caching server on OpenWrt, which forwards unresolved DNS queries to recursive resolvers through DNS-over-TLS, to prevent eavesdropping and tampering of DNS queries on their network path.

Continue reading Setting up a DNS-over-TLS forwarding cache on OpenWrt Snapshot (r6693 or later)

中国电信SIP账号在FreePBX 13中的中继设置

在《配置EPON家庭网关接入中国电信电话交换IP网络》一文中我们介绍了如何使用MicroSIP软电话程序接入中国电信的电话IP网络,并提出了实现局域网电话软交换(IP-PBX)的可能性。以下FreePBX 13的中继设置已经通过几周的实际测试,可以放心使用。

在FreePBX 13管理界面上,创建类型为chan_pjsip的SIP中继(Trunk),并在中继编辑页面的“pjsip Settings”选项卡里输入如下参数:

Continue reading 中国电信SIP账号在FreePBX 13中的中继设置

配置EPON家庭网关接入中国电信电话交换IP网络

电信网、广播电视网、互联网三网融合是业界趋势,也是国务院大力推行的国家产业政策。中国电信正在进行PSTN电话网到IP网络的迁移。上半年,我家固定电话发生(也许是有计划的)故障后,电信维修人员就将我家电话从双绞线迁移进了光纤。无源光纤网络“EPON上行e8-C家庭网关”(下文称为光猫或EPON网关)提供两个RJ11接口,适配老式电话机。查看管理界面就可以发现它是通过SIP协议接入IP电话网络的。既然如此,如果能通过其LAN口接入电信的IP电话网络,我们就应该可以使用SIP协议打电话,甚至实现局域网软交换。

Continue reading 配置EPON家庭网关接入中国电信电话交换IP网络

RDP Wrapper Library使功能受限的Windows版本支持远程桌面服务

微软开发的专有协议Remote Desktop Protocol(RDP)允许用户远程登录另一台Windows电脑,像在本机终端前一样操作图形界面。自Windows XP以来,所有Windows版本都自带了Remote Desktop Connection (RDC) ("Terminal Services")客户端(mstsc.exe),但是家庭/基础版却不支持启动Terminal Services服务器。RDP Wrapper Library是Service Control Manager和Terminal Services的中间层,为这些功能受限制的Windows版本提供远程桌面服务。

下载地址:https://github.com/stascorp/rdpwrap/releases

安装方法很简单,只须解压缩zip文件,然后运行Install.bat安装脚本。

dd-wrt的配置变更

在无线路由器操作系统中,dd-wrt的强项是能采用最新的Linux内核和软件,并且有较为简便的Web管理界面。但是,它的配置变更的细粒度不够。在Web界面上更改某项配置,小如增加一个DHCP静态租约,在应用变更(Apply Settings)后,它都会重启所有服务。

因此,如果路由器上用户较多,在Web界面上修改配置后,最好不要轻易应用变更,而应先保存配置(Save),然后ssh登录,手动重启相关服务。比如,因DHCP功能由dnsmasq提供,在增加静态租约后,可以在命令行上输入以下两条命令,重启dnsmasq服务:

# stopservice dnsmasq
# startservice dnsmasq

如果修改了NAS配置,使配置变更生效最简便的方法就是先用“Use SES Button to remove drives”功能弹出USB驱动器,然后拔下USB驱动器,等待几秒后重插。