]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Merged revisions 280811 via svnmerge from
authorTilghman Lesher <tilghman@meg.abyt.es>
Tue, 3 Aug 2010 20:52:20 +0000 (20:52 +0000)
committerTilghman Lesher <tilghman@meg.abyt.es>
Tue, 3 Aug 2010 20:52:20 +0000 (20:52 +0000)
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r280811 | tilghman | 2010-08-03 15:49:10 -0500 (Tue, 03 Aug 2010) | 9 lines

  Prevent DAHDI channels from overriding the callerid, once it's been set by the user.

  (closes issue #16661)
   Reported by: jstapleton
   Patches:
         20100414__issue16661.diff.txt uploaded by tilghman (license 14)
         20100415__issue16661__1.6.2.diff.txt uploaded by tilghman (license 14)
   Tested by: jstapleton
........

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

channels/chan_dahdi.c
funcs/func_callerid.c

index b44c70bec0d60102eee3660a11f46646525b46b2..fb45564e3d546bff3b6ee1eb6fbb02371c4c1d2a 100644 (file)
@@ -6892,7 +6892,7 @@ static struct ast_frame *dahdi_read(struct ast_channel *ast)
                return &p->subs[idx].f;
        }
 
-       if (p->subs[idx].needcallerid) {
+       if (p->subs[idx].needcallerid && !ast->cid.cid_tns) {
                ast_set_callerid(ast, S_OR(p->lastcid_num, NULL),
                                                        S_OR(p->lastcid_name, NULL),
                                                        S_OR(p->lastcid_num, NULL)
@@ -13296,12 +13296,12 @@ static void *pri_dchannel(void *vpri)
                                        if (chanpos < 0) {
                                                ast_log(LOG_WARNING, "Facility Name requested on channel %d/%d not in use on span %d\n",
                                                        PRI_SPAN(e->facname.channel), PRI_CHANNEL(e->facname.channel), pri->span);
-                                       } else {
+                                       } else if (pri->pvts[chanpos]->use_callerid) {
                                                /* Re-use *69 field for PRI */
                                                ast_mutex_lock(&pri->pvts[chanpos]->lock);
                                                ast_copy_string(pri->pvts[chanpos]->lastcid_num, e->facname.callingnum, sizeof(pri->pvts[chanpos]->lastcid_num));
                                                ast_copy_string(pri->pvts[chanpos]->lastcid_name, e->facname.callingname, sizeof(pri->pvts[chanpos]->lastcid_name));
-                                               pri->pvts[chanpos]->subs[SUB_REAL].needcallerid =1;
+                                               pri->pvts[chanpos]->subs[SUB_REAL].needcallerid = 1;
                                                dahdi_enable_ec(pri->pvts[chanpos]);
                                                ast_mutex_unlock(&pri->pvts[chanpos]->lock);
                                        }
index 5e558543265fc64278cbc389ad73c7ab0fd28e2c..3c595daab6f159060e2d121a1fa3aead5b49488f 100644 (file)
@@ -191,6 +191,7 @@ static int callerid_read(struct ast_channel *chan, const char *cmd, char *data,
 static int callerid_write(struct ast_channel *chan, const char *cmd, char *data,
                          const char *value)
 {
+       int valid = 1;
        if (!value || !chan)
                return -1;
 
@@ -267,6 +268,11 @@ static int callerid_write(struct ast_channel *chan, const char *cmd, char *data,
                chan->cid.cid_ton = atoi(value);
        } else {
                ast_log(LOG_ERROR, "Unknown callerid data type '%s'.\n", data);
+               valid = 0;
+       }
+
+       if (valid) {
+               chan->cid.cid_tns = 1;
        }
 
        return 0;