Relay setting of China Telecom SIP account in FreePBX 13

In the article " Configuring EPON Home Gateway to Access China Telecom's Telephone Switching IP Network ", we introduced how to use the MicroSIP soft phone program to access China Telecom's telephone IP network, and proposed the possibility of implementing LAN-PBX ​​(IP-PBX) Sex. The following FreePBX 13 relay settings have passed several weeks of actual testing and can be used with confidence.

On the FreePBX 13 management interface, create a SIP trunk of type chan_pjsip and enter the following parameters in the "pjsip Settings" tab of the trunk editing page:

 

General:
  Username: [email protected]
  Secret: <SECRET>
  SIP Server: sh.ctcims.cn
  SIP Server Port: 5060

Advanced:
  From Domain: sh.ctcims.cn
  From User: +8621XXXXXXXX
  Client URI: sip:[email protected]:5060
  AOR Contact: sip:[email protected]:5060
  Match(Permit): 15.192.0.0/16

Codecs: Enable g729

Note: Match (Permit) is the network segment where all the central SIP servers may be located.

Since there is no record of sh.ctcims.cn in the DNS server of the telecommunications IP phone network, and the Outbound Proxy setting of chan_pjsip in FreePBX 13 is invalid, we must set the resolution for sh.ctcims.cn in the local DNS server. In the common DNS agent dnsmasq, set the parameters as follows:

server=/sh.ctcims.cn/15.192.252.188
address=/sh.ctcims.cn/15.192.60.71

Among them, server is one of the DNS servers obtained by the VOICE_INTERNET connection (epon0.4) of the EPON gateway, and the address is sh.ctcims.cn for local resolution (one of the two IP addresses resolved from the OutboundProxy domain name preset in the EPON gateway) .

Update

  • 2017-07-20
    At the end of June 2017, 15.192.60.71 failed and no response caused the relay to fail, while the other address 15.192.60.77 resolved by the OutboundProxy domain name still works normally. Configuring dnsmasq to resolve sh.ctcims.cn to two IP addresses can solve this problem as follows:
    1. Create a hosts mapping file for sh.ctcims.cn.
# cat > /tmp/hosts.addn <<EOF
15.192.60.71 sh.ctcims.cn
15.192.60.77 sh.ctcims.cn
EOF
    1. Add the following parameters in dnsmasq.conf:
addn-hosts=/tmp/hosts.addn

Note: After Asterisk 14, chan_pjsip should be able to switch according to the DNS SRV record (srvlookup), see [1] for details.

  • 2018-05-05
    Packet capture found that freepbx will query the SRV record _sip._udp.sh.ctcims.cn and the AAAA record of sh.ctcims.cn every few minutes. Add the SRV record _sip._udp.sh.ctcims.cn pointing to the OutboundProxy domain name in the dnsmasq configuration to reduce invalid DNS queries and eliminate the need to set up local resolution for sh.ctcims.cn; "DNS" server adds a server configuration, DNS query will be more reliable. The improved dnsmasq configuration is as follows:
server=/sh.ctcims.cn/15.192.252.188
server=/sh.ctcims.cn/15.192.251.188
srv-host=_sip._udp.sh.ctcims.cn,BAC04.nq.sh.ctcims.cn,5060,0,0

As for the problem of invalid AAAA record query, it cannot be solved by system configuration at present, even if IPv6 is disabled through kernel parameters, see [2] and [3] for details.

  • 2018-05-10I
    recently discovered that the phone will disconnect for no reason after a few minutes of conversation. After a detailed test, I found that Asterisk 13 will not failover according to the priority / weight recorded by the SRV. It will select the host with higher priority and poll according to the weight, but it will not failover. In addition, the two IMS servers that Telecom provides SIP access did not form a shared session or a single system image cluster-if a client successfully registers with one IP address and then registers with another IP address, it will be rejected, resulting in The call is disconnected. In summary, if you continue to use FreePBX 13, it is best to go back to the DNS settings in the body and resolve the domain name sh.ctcims.cn to one of the two IP addresses of OutboundProxy, or set different SRV records pointing to the two IP addresses. The priority is as follows:
# addn-hosts file for dnsmasq
cat > /tmp/hosts.addn <<EOF
15.192.60.71 s1.nq.sh.ctcims.cn
15.192.60.77 s2.nq.sh.ctcims.cn
EOF

# dnsmasq.conf params for ctcims 
server=/sh.ctcims.cn/15.192.252.188
server=/sh.ctcims.cn/15.192.251.188
addn-hosts=/tmp/hosts.addn
srv-host=_sip._udp.sh.ctcims.cn,s1.nq.sh.ctcims.cn,5060,0,0
srv-host=_sip._udp.sh.ctcims.cn,s2.nq.sh.ctcims.cn,5060,1,0

Note: In a network environment with such DNS settings, the pjsip relay from FreePBX to the telecom voice network can run stably for a long time.

参考
【1】http://blogs.asterisk.org/2016/04/20/pjsip-dns-support/
【2】https://linux.ioerror.us/2015/07/25/how-to-disable-aaaa-lookups/
【3】https://bugzilla.redhat.com/show_bug.cgi?id=1027452

Published 57 original articles · won praise 0 · Views 2175

Guess you like

Origin blog.csdn.net/zhidc/article/details/105329083
sip