chan_sip: Allow static realtime members to be qualified during module load.

When a static realtime peer with qualify=yes is loaded, Asterisk will fail to
send an OPTIONS request due to the lastms being equal to 0. This results in
the peer being unable to receive calls from Asterisk because the status is
permanently UNKNOWN.

This patch allows an OPTIONS request to be sent during module load by
ignoring the lastms value on startup only.

Review: https://reviewboard.asterisk.org/r/3294/

(closes issue ASTERISK-17523)
Reported by: Maciej Krajewski
Tested by: wushumasters
patches:
  realtime_fix_11.7.0.txt uploaded by Trevor Peirce (license 6112)
........

Merged revisions 410105 from http://svn.asterisk.org/svn/asterisk/branches/1.8


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/11@410106 65c4cc65-6c06-0410-ace0-fbb531ad65f3
changes/61/61/1
Matthew Jordan 11 years ago
parent fa1d3b0941
commit 69fb0d2585

@ -31193,22 +31193,27 @@ static struct sip_peer *build_peer(const char *name, struct ast_variable *v, str
peer->socket.port = htons(((peer->socket.type & SIP_TRANSPORT_TLS) ? STANDARD_TLS_PORT : STANDARD_SIP_PORT)); peer->socket.port = htons(((peer->socket.type & SIP_TRANSPORT_TLS) ? STANDARD_TLS_PORT : STANDARD_SIP_PORT));
} }
if (!sip_cfg.ignore_regexpire && peer->host_dynamic && realtime) { if (realtime) {
int enablepoke = 1;
if (!sip_cfg.ignore_regexpire && peer->host_dynamic) {
time_t nowtime = time(NULL); time_t nowtime = time(NULL);
if ((nowtime - regseconds) > 0) { if ((nowtime - regseconds) > 0) {
destroy_association(peer); destroy_association(peer);
memset(&peer->addr, 0, sizeof(peer->addr)); memset(&peer->addr, 0, sizeof(peer->addr));
peer->lastms = -1; peer->lastms = -1;
enablepoke = 0;
ast_debug(1, "Bah, we're expired (%d/%d/%d)!\n", (int)(nowtime - regseconds), (int)regseconds, (int)nowtime); ast_debug(1, "Bah, we're expired (%d/%d/%d)!\n", (int)(nowtime - regseconds), (int)regseconds, (int)nowtime);
} }
} }
/* Startup regular pokes */ /* Startup regular pokes */
if (!devstate_only && realtime && peer->lastms > 0) { if (!devstate_only && enablepoke) {
sip_ref_peer(peer, "schedule qualify"); sip_ref_peer(peer, "schedule qualify");
sip_poke_peer(peer, 0); sip_poke_peer(peer, 0);
} }
}
if (ast_test_flag(&peer->flags[1], SIP_PAGE2_ALLOWSUBSCRIBE)) { if (ast_test_flag(&peer->flags[1], SIP_PAGE2_ALLOWSUBSCRIBE)) {
sip_cfg.allowsubscribe = TRUE; /* No global ban any more */ sip_cfg.allowsubscribe = TRUE; /* No global ban any more */

Loading…
Cancel
Save