summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Jordan <mjordan@digium.com>2014-03-07 05:04:32 +0000
committerMatthew Jordan <mjordan@digium.com>2014-03-07 05:04:32 +0000
commitd3ac8b8a0e70049af7b5552c4dfd8adc2cc5df11 (patch)
tree5940118091d756d6f9305a53ad8744566bff7e0f
parent4fd50a9d8127a5fb02363f4917e9110a23e57666 (diff)
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 ........ Merged revisions 410106 from http://svn.asterisk.org/svn/asterisk/branches/11 ........ Merged revisions 410107 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@410108 65c4cc65-6c06-0410-ace0-fbb531ad65f3
-rw-r--r--channels/chan_sip.c29
1 files changed, 17 insertions, 12 deletions
diff --git a/channels/chan_sip.c b/channels/chan_sip.c
index 1b809a659..6b7a3e4f3 100644
--- a/channels/chan_sip.c
+++ b/channels/chan_sip.c
@@ -30967,21 +30967,26 @@ static struct sip_peer *build_peer(const char *name, struct ast_variable *v, str
peer->socket.port = htons(((peer->socket.type & AST_TRANSPORT_TLS) ? STANDARD_TLS_PORT : STANDARD_SIP_PORT));
}
- if (!sip_cfg.ignore_regexpire && peer->host_dynamic && realtime) {
- time_t nowtime = time(NULL);
+ if (realtime) {
+ int enablepoke = 1;
- if ((nowtime - regseconds) > 0) {
- destroy_association(peer);
- memset(&peer->addr, 0, sizeof(peer->addr));
- peer->lastms = -1;
- ast_debug(1, "Bah, we're expired (%d/%d/%d)!\n", (int)(nowtime - regseconds), (int)regseconds, (int)nowtime);
+ if (!sip_cfg.ignore_regexpire && peer->host_dynamic) {
+ time_t nowtime = time(NULL);
+
+ if ((nowtime - regseconds) > 0) {
+ destroy_association(peer);
+ memset(&peer->addr, 0, sizeof(peer->addr));
+ peer->lastms = -1;
+ enablepoke = 0;
+ ast_debug(1, "Bah, we're expired (%d/%d/%d)!\n", (int)(nowtime - regseconds), (int)regseconds, (int)nowtime);
+ }
}
- }
- /* Startup regular pokes */
- if (!devstate_only && realtime && peer->lastms > 0) {
- sip_ref_peer(peer, "schedule qualify");
- sip_poke_peer(peer, 0);
+ /* Startup regular pokes */
+ if (!devstate_only && enablepoke) {
+ sip_ref_peer(peer, "schedule qualify");
+ sip_poke_peer(peer, 0);
+ }
}
if (ast_test_flag(&peer->flags[1], SIP_PAGE2_ALLOWSUBSCRIBE)) {