Asterisk SIP externip

Asterisk SIP externip


externip = extern.ip.address


Indicates the IP address (alternatively you can enter a hostname) that will be used as the source IP address for all SIP messages when NAT is specified.

Examples - Use it in [general] section of SIP.CONF

externip =


externip can only appear under the [general] section of the sip.conf
If you have SIP peers both inside and outside your NAT'ed network, you will need to use the localnet parameter so Asterisk can distinguish between them.

Asterisk 1.8

Addition of the 'subscribe_network_change' option for turning on and off res_stun_monitor module support in chan_sip.
The 'stunaddr' option has been removed from chan_sip. This feature did not behave as expected, had no correct use case, and was not RFC compliant. The removal of this feature will hopefully be followed by a correct RFC compliant STUN implementation in chan_sip in the future.

Changes for Asterisk 1.2.x

Apparently CVS head (Dec '04 and later) comes with an in-box solution that doesn't require the solutions discussed above. See bugs 3086 and 3262. Taken from the sample sip.conf:

; ; Alternatively you can specify an
; external host, and Asterisk will
; perform DNS queries periodically. Not
; recommended for production
; environments! Use externip instead
;externrefresh=10 ; How often to refresh externhost if
; used (in seconds)

Implementation tips Asterisk 1.0.x

Discussion (Nov '04):
The issue: DSL provider hands out new IP every 24h (forced re-connect)
See also bug 3086 (included in Asterisk v1.0.6 and later)

> Have your cron job issue an "asterisk -rx 'restart when convenient'"
> command instead of a hard restart. That will wait until there are no
> active channels to restart. Also, issuing a 'sip reload' instead of
> restarting * is probably sufficient to re-register with Broadvoice.

Unfortunately not. I have the same problem and the same solution here.
You really have to do a restart of asterisk. I think the reason that
asterisk does not always lookup the IP Adress for the DDNS-Hostname is
performance. But it would be nice if a sip reload could do so.

Question: With Asterisk v1.0.3 and later we don't need to issue a "reload"
in order for Asterisk to pick up its new IP address (for SIP)?

See Also

  • localnet
  • Asterisk SIP externhost: New in Asterisk v1.2.x
  • Asterisk SIP externrefresh: New in Asterisk v1.2.x
  • Asterisk SIP stunaddr: For STUN support (new in Asterisk 1.6 but unreliable)
  • NAT

Go back to Asterisk config sip.conf

Created by: chandave, Last modification: Fri 12 of Aug, 2011 (23:31 UTC) by JustRumours
Please update this page with new information, just login and click on the "Edit" or "Discussion" tab. Get a free login here: Register Thanks! - Find us on Google+