Make mailbox time configurable with SIP (bug #2837)
authorMark Spencer <markster@digium.com>
Fri, 12 Nov 2004 03:49:13 +0000 (03:49 +0000)
committerMark Spencer <markster@digium.com>
Fri, 12 Nov 2004 03:49:13 +0000 (03:49 +0000)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@4219 65c4cc65-6c06-0410-ace0-fbb531ad65f3

channels/chan_sip.c

index 2f512b6..5b5498a 100755 (executable)
@@ -129,11 +129,11 @@ static char default_fromdomain[AST_MAX_EXTENSION] = "";
 
 static char notifymime[AST_MAX_EXTENSION] = "application/simple-message-summary";
 
-static int srvlookup = 0;
+static int srvlookup = 1;              /* SRV Lookup on or off. Default now on */
 
-static int pedanticsipchecking = 0;
+static int pedanticsipchecking = 0;    /* Extra checking ?  Default off */
 
-static int autocreatepeer = 0;         
+static int autocreatepeer = 0;         /* Auto creation of peers at registration? Default off. */
 
 static int relaxdtmf = 0;
 
@@ -141,7 +141,7 @@ static int global_rtptimeout = 0;
 
 static int global_rtpholdtimeout = 0;
 
-static int global_trustrpid = 0;
+static int global_trustrpid = 0;       /* Trust RPID headers? Default off. */
 
 static int global_progressinband = 0;
 
@@ -149,6 +149,9 @@ static int global_progressinband = 0;
 static int global_ospauth = 0;
 #endif
 
+#define DEFAULT_MWITIME 10
+static int global_mwitime = DEFAULT_MWITIME;   /* Time between MWI checks for peers */
+
 static int usecnt =0;
 AST_MUTEX_DEFINE_STATIC(usecnt_lock);
 
@@ -7808,6 +7811,7 @@ restartsearch:
                ast_mutex_lock(&monlock);
                if (res >= 0) 
                        ast_sched_runq(sched);
+
                /* needs work to send mwi to realtime peers */
                ast_mutex_lock(&peerl.lock);
                peer = peerl.peers;
@@ -7815,7 +7819,7 @@ restartsearch:
                fastrestart = 0;
                curpeernum = 0;
                while(peer) {
-                       if ((curpeernum > lastpeernum) && !ast_strlen_zero(peer->mailbox) && ((t - peer->lastmsgcheck) > 10)) {
+                       if ((curpeernum > lastpeernum) && !ast_strlen_zero(peer->mailbox) && ((t - peer->lastmsgcheck) > global_mwitime)) {
                                sip_send_mwi_to_peer(peer);
                                fastrestart = 1;
                                lastpeernum = curpeernum;
@@ -8569,6 +8573,11 @@ static int reload_config(void)
                                ast_log(LOG_WARNING, "Unknown dtmf mode '%s', using rfc2833\n", v->value);
                                global_dtmfmode = SIP_DTMF_RFC2833;
                        }
+               } else if (!strcasecmp(v->name, "checkmwi")) {
+                       if ((sscanf(v->value, "%d", &global_mwitime) != 1) || (global_mwitime < 0)) {
+                               ast_log(LOG_WARNING, "'%s' is not a valid MWI time setting at line %d.  Using default (10).\n", v->value, v->lineno);
+                               global_mwitime = DEFAULT_MWITIME;
+                       }
                } else if (!strcasecmp(v->name, "rtptimeout")) {
                        if ((sscanf(v->value, "%d", &global_rtptimeout) != 1) || (global_rtptimeout < 0)) {
                                ast_log(LOG_WARNING, "'%s' is not a valid RTP hold time at line %d.  Using default.\n", v->value, v->lineno);