Index: channels/chan_sip.c =================================================================== --- channels/chan_sip.c (revision 176174) +++ channels/chan_sip.c (working copy) @@ -17596,15 +17596,6 @@ peer->maxcallbitrate = default_maxcallbitrate; } } - if (!ast_strlen_zero(fullcontact)) { - ast_copy_string(peer->fullcontact, fullcontact, sizeof(peer->fullcontact)); - /* We have a hostname in the fullcontact, but if we don't have an - * 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); - } if (!ast_test_flag(&global_flags[1], SIP_PAGE2_IGNOREREGEXPIRE) && ast_test_flag(&peer->flags[1], SIP_PAGE2_DYNAMIC) && realtime) { time_t nowtime = time(NULL); @@ -17614,7 +17605,20 @@ memset(&peer->addr, 0, sizeof(peer->addr)); if (option_debug) ast_log(LOG_DEBUG, "Bah, we're expired (%d/%d/%d)!\n", (int)(nowtime - regseconds), (int)regseconds, (int)nowtime); + } else { + goto setcontact; } + } else { +setcontact: + if (!ast_strlen_zero(fullcontact)) { + ast_copy_string(peer->fullcontact, fullcontact, sizeof(peer->fullcontact)); + /* We have a hostname in the fullcontact, but if we don't have an + * 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); + } } ast_copy_flags(&peer->flags[0], &peerflags[0], mask[0].flags); ast_copy_flags(&peer->flags[1], &peerflags[1], mask[1].flags);