wardmundy
Nerd Uno
- Joined
- Oct 12, 2007
- Messages
- 19,199
- Reaction score
- 5,218
Asterisk uses a stun server if defined. Issue a "stun set debug on" and make some calls to see the activity.
To find out how much trouble a broken or down stun server can cause, set the stun address to a valid address that is not a stun server.
It may be firewall/router dependent, but I've never found a stun server needed for SIP/IAX endpoints. WebRTC is another matter. I don't set it anymore because of the potential bad server issues - got bit once and it took way too long to figure out what the issue really was.
The show status is dependent on the server being listed in res_stun_monitor.conf:Code:; ; Configuration file for the res_stun_monitor module ; ; The res_stun_monitor module sends STUN requests to a configured STUN server ; periodically. If the monitor detects a change in the external IP address or port ; provided by the STUN server an event is sent out internally within Asterisk ; to alert all listeners to that event of the change. ; The current default listeners for the network change event include chan_sip ; and chan_iax. Both of these channel drivers by default react to this event ; by renewing all outbound registrations. This allows the endpoints Asterisk ; is registering with to become aware of the address change and know the new ; location. ; [general] ; ; ---- STUN Server configuration --- ; Setting the 'stunaddr' option to a valid address enables the STUN monitor. ; ;stunaddr = mystunserver.com ; Address of the STUN server to query. ; Valid form: ; [(hostname | IP-address) [':' port]] ; The port defaults to the standard STUN port (3478). ; Set to an empty value to disable STUN monitoring. ; Default is disabled. ;stunrefresh = 30 ; Number of seconds between STUN refreshes. ; Default is 30.
Problem is that this stun stuff is all over the place in the Asterisk config files. Here's what we're now doing, and it seems to work most (but not all) of the time using stun show status. No idea which config setting Asterisk actually relies upon.
Code:
sed -i 's|;stunaddr|stunaddr=stun.counterpath.net\n;|' /etc/asterisk/res_stun_monitor.conf
sed -i 's|;stunrefresh|stunrefresh|' /etc/asterisk/res_stun_monitor.conf
echo "stunaddr=stun.counterpath.net" > /etc/asterisk/rtp_custom.conf
echo "stunrefresh=30" >> /etc/asterisk/rtp_custom.conf
sed -i 's|stun.counterpath.net|stun.l.google.com:19302|' /etc/asterisk/res_stun_monitor.conf
sed -i 's|stun.counterpath.net|stun.l.google.com:19302|' /etc/asterisk/rtp_custom.conf
sed -i 's|stun.counterpath.net|stun.l.google.com:19302|' /etc/asterisk/sip_general_custom.conf
chown asterisk:asterisk /etc/asterisk/*.conf
amportal restart
Last edited: