You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
asterisk/patches/chan_sip_nat-realtime_15194...

17 lines
832 B

--- channels/chan_sip.c (revision 196376)
+++ channels/chan_sip.c (working copy)
@@ -17693,8 +17693,11 @@
* address listed on the entry (or if it's 'dynamic'), then we need to
* parse the entry to obtain the IP address, so a dynamic host can be
* contacted immediately after reload (as opposed to waiting for it to
- * register once again). */
- __set_address_from_contact(fullcontact, &peer->addr);
+ * register once again). But if we have an address for this peer and NAT was
+ * specified, use that address instead. */
+ if (!ast_test_flag(&peer->flags[0], SIP_NAT_ROUTE) || !peer->addr.sin_addr.s_addr) {
+ __set_address_from_contact(fullcontact, &peer->addr);
+ }
}
if (!ast_test_flag(&global_flags[1], SIP_PAGE2_IGNOREREGEXPIRE) && ast_test_flag(&peer->flags[1], SIP_PAGE2_DYNAMIC) && realtime) {