This is the longest persistent problem since I learned to build the opensips server. Specifically, the terminal phone software has been unable to register the created sip session account. The terminal phone software I used at the beginning was Zoiper, which was either being registered all the time, or failed to register directly. Later, I searched online and downloaded Microsip again. It can display the reason for the registration failure, such as the request timed out, which is more convenient.
According to the online query, you can use the sngrep tool to capture and analyze packets. You need to download this tool for the first time:
#sudo apt-get install sngrep
Then directly sngrep
#sngrep
It felt like the sip server didn't receive any messages sent by the terminal at all. At first I thought it was a problem with the configuration file, such as the IP address or port number was not written correctly.
#cd /usr/local/etc/opensips
#vim opensips.cfg
#vim opensipsctlrc
#vim /etc/default/opensips
#vim /etc/init.d/opensips
There is no problem with the configuration. For the content of the specific configuration file, see http://t.csdn.cn/7NezY
I checked a lot of solutions on the Internet, such as modifying the /usr/local/etc/opensips/opensips.cfg configuration file:
Adding your own sip server IP address still doesn't work. Modify the configuration of the control panel:
No way.
Later, I saw on the Internet that it was because the firewall restricted port 5060, that is, port 5060 was still open.
#netstat -anp
#netstat -ulpn | Grip 5060
Display the occupancy of all ports/protocols, and there is no occupancy of 5060 as expected.
First of all, I think it may be the 5060 port restricted by the host firewall, and the information sent through the 5060 port cannot be received, so the following settings are made:
Control Panel—>Windows Firewall—>Advanced Settings—>Inbound Rules—>New Rules—>Port—>Protocol (udp)—>Specific Local Port (5060)—>Allow Connection—— > Tick "Domain, Private, Company" --> Name --> Done
Still didn't solve the problem.
Then the firewall of the sip server, open port 5060 with the command
#iptables -I INPUT -p tcp --dport 5060 -j ACCEPT
#iptables -I INPUT -p udp --dport 5060 -j ACCEPT
#iptables-save
Then executed #dmesg according to the instructions, and other problems occurred, such as:
The online query said that the virtual disk capacity of the sip server is not enough, and the capacity needs to be increased:
#df -h
Query the space usage of each device:
After changing the disk capacity allocated when the Ubuntu was built (the virtual machine needs to be shut down before changing), re-allocate (the specific method can be found online). Anyway, this wave of operation is still useless.
**************************************************
It should be that the command to open the port on the firewall is incorrect. The firewall used by Ubuntu 18.04 is found to be ufw:
① Check the status of the firewall
#sudo ufw status
The firewall is enabled. If it is disabled, it can be enabled by #sudo ufw enable.
② Install firewalld and open port 5060.
#sudo apt-get install firewalld
#sudo firewall-cmd --permanent --add-port=560/udp
#sudo firewall-cmd --list-all
③Restart the firewall (emphasis)
#sudo systemctl reload firewalld
or
#firewall-cmd --reload
The sip account is still not registered successfully. After thinking hard, I found that the firewall may also restrict the udp protocol and not open the protocol. As shown in the figure above, the protocols item has no content.
#sudo firewall-cmd --permanent --add-protocol=udp
Restart the firewall again #firewall-cmd --reload .
The Microsip phone is displayed online, and the problem has finally been solved:
#netstat -ulpn | Grip 5060
There is also a 5060 port occupancy:
Note: It is a personal study summary, please correct me if there is any mistake.