问题
I have written a Python 3 script to emulate SIP call transfer event. The script was working successfully when tested with a SIP server sitting on the same network. When I tested with a SIP server sitting across a firewall, all data sent by the script to port 5060 of the SIP server is blocked by the Firewall. Data sent on any other port than 5060 are allowed across the Firewall. This made me presume that the packets are blocked by SIP ALG protocol running on port 5060 of the Firewall (Fortigate). To gather more information about the scenario, I tested with a command line tool called SIPp. SIPp was used to send SIP invites across the Firewall to the SIP server to port 5060. The invites generated by this tool was successfully sent across the Firewall. Then I made sure the format of the messages generated by SIPp and my script are identical. Even then the messages generated by my script are not going through the Firewall. My situation is quite complicated because there is no log for the Firewall available. I was doing some research online came across this protocol called SIP ALG implemented on most routers and Firewalls. I do understand SIP ALG used correct private/public IPs of the SIP user agent. But in my situation I don't have plausible reason other than SIP ALG blocking my messages to port 5060. If SIP ALG is the culprit and it only blocks the messages generated by my script not SIPp, is then because of different encoding used in the message composition? If yes, what's the standard encoding used for SIP? I am currently using utf-8 on Python 3. Any insights is appreciated.
来源:https://stackoverflow.com/questions/48473828/whats-the-encoding-used-in-sip-or-in-sip-alg-in-firewalls