Allow dringXrange to properly default to 10, as was done in 1.4.
authorJason Parker <jparker@digium.com>
Thu, 1 May 2008 16:49:24 +0000 (16:49 +0000)
committerJason Parker <jparker@digium.com>
Thu, 1 May 2008 16:49:24 +0000 (16:49 +0000)
dringXrange is a new feature that was added, and it attempted to default, but only when the option was specified.

(closes issue #12536)
Reported by: bjm
Patches:
      12536-dringXrange.diff uploaded by qwell (license 4)
Tested by: bjm

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@114922 65c4cc65-6c06-0410-ace0-fbb531ad65f3

channels/chan_zap.c

index f8da436..589a8fe 100644 (file)
@@ -8380,7 +8380,15 @@ static struct zt_pvt *mkintf(int channel, struct zt_chan_conf conf, struct zt_pr
                        if (conf.timing.debouncetime >= 0)
                                p.debouncetime = conf.timing.debouncetime;
                }
-               
+
+               /* 10 is a nice default. */
+               if (conf.chan.drings.ringnum[0].range == 0)
+                       conf.chan.drings.ringnum[0].range = 10;
+               if (conf.chan.drings.ringnum[1].range == 0)
+                       conf.chan.drings.ringnum[1].range = 10;
+               if (conf.chan.drings.ringnum[2].range == 0)
+                       conf.chan.drings.ringnum[2].range = 10;
+
                /* dont set parms on a pseudo-channel (or CRV) */
                if (tmp->subs[SUB_REAL].zfd >= 0)
                {
@@ -13313,19 +13321,10 @@ static int process_zap(struct zt_chan_conf *confp, struct ast_variable *v, int r
                        ast_copy_string(confp->chan.drings.ringContext[2].contextData,v->value,sizeof(confp->chan.drings.ringContext[2].contextData));
                } else if (!strcasecmp(v->name, "dring1range")) {
                        confp->chan.drings.ringnum[0].range = atoi(v->value);
-                       /* 10 is a nice default. */
-                       if (confp->chan.drings.ringnum[0].range == 0)
-                               confp->chan.drings.ringnum[0].range = 10;
                } else if (!strcasecmp(v->name, "dring2range")) {
                        confp->chan.drings.ringnum[1].range = atoi(v->value);
-                       /* 10 is a nice default. */
-                       if (confp->chan.drings.ringnum[1].range == 0)
-                               confp->chan.drings.ringnum[1].range = 10;
                } else if (!strcasecmp(v->name, "dring3range")) {
                        confp->chan.drings.ringnum[2].range = atoi(v->value);
-                       /* 10 is a nice default. */
-                       if (confp->chan.drings.ringnum[2].range == 0)
-                               confp->chan.drings.ringnum[2].range = 10;
                } else if (!strcasecmp(v->name, "dring1")) {
                        ringc = v->value;
                        sscanf(ringc, "%d,%d,%d", &confp->chan.drings.ringnum[0].ring[0], &confp->chan.drings.ringnum[0].ring[1], &confp->chan.drings.ringnum[0].ring[2]);