I got Asterisk 16 up and running on Ubuntu 18.04 using chan_sip in the office and everything is working great. I was hoping to take a handset home to use and at first things looked fine.
I got the phone registered and was able to make an outbound call. I then noticed that while they can hear me, I can’t hear them (one way audio). I had the same issue using Zoiper on my cell phone (which uses dynamic IPv4), but I set up a STUN server for it and it worked after that, but with the home handset I am confused. Before I get into it any further, let me describe the topology.
Asterisk 16 server public IP: 126.96.36.199
Home ISP: Comcast
Router: Linksys WRT1200AC
Home Public IPv4: 188.8.131.52 (Yes, it ends with a 0 when I check whatismyip)
Home Public IPv6: 2001:0db8:0000:0000:0000:8a2e:0370:7334
Port Forwarding configured sending port 5060 => 192.168.1.125
Phone: Cisco 7960
Phone IP: 192.168.1.125
While my phone does get registered, when I issue the command sip show peers I get:
Name/username Host Dyn Forcerport Comedia ACL Port Status Description
10/10 192.168.1.148 D No No A 5060 Unmonitored
115/115 192.168.1.125 D No No 5060 Unmonitored
Line 10 is in the office, line 115 is at home and yet to the Asterisk server, they are both on the same network. With that knowledge, a STUN server didn’t seem like the right solution since the Asterisk server would be sending those UDP packets to our internal office network.
In looking into how to solve it I found externip and externhost, but since it is a dynamic one then I don’t think that is the solution. Next I looked into using dynamic DNS, but my router only supports noip.com and ddns.com, and their “dynamic” ipv6 is manually assigned, so I might as well do that myself using a subdomain of my own. I believe that the IPv6 address changes anytime the cable modem or router gets rebooted, which in our area is not infrequent.
Here is my sip.conf for 115:
Thanks John, my Asterisk server has a local ip of 192.168.1.10, but I am doing port forwarding there for the tftp and SIP.
When I was starting my proof of concept I was setting it up on a Raspberry Pi 3, using RasPBX and was getting errors on pjsip. I then tried a fresh RPi install and installed Asterisk from source and still had errors loading pjsip. Since I had already worked with chan_sip on a different server, I just copied my configuration and it worked.
nat=no was clearly a mistake, I was thinking that I should leave it because of my port forwarding but upon further reflection that was stupid. I will fix that, is there anything relating to this that chan_pjsip would address?
I can’t work out the address of the Asterisk daemon, but I see no evidence that it is not local to the phones. If one phone is local, the other would seem to be.
Also, the standard recipe for nat is overused. It is mainly intended for when Asterisk is on the public side of of NAT and the phone is both on the private side, and not fully aware that it is. In many cases the default should work if Asterisk is on the private side and all its external peers are correctly presenting public addresses.
comedia is a work around for when the peer is sending a private address or port number, when it should be sending public ones.
force_rport is a workaround for incorrect signaling address information, although I forget the exact details.
Generally with this sort of problem it is easiest if you provide the Asteriski’s SIP protocol trace for the completed INVITE exchange, so one can see the Contact and Via headers,and hte m= and c= lines in the SDP.