]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Prevent DAHDI channels from overriding the callerid, once it's been set by the user.
authorTilghman Lesher <tilghman@meg.abyt.es>
Tue, 3 Aug 2010 20:49:10 +0000 (20:49 +0000)
committerTilghman Lesher <tilghman@meg.abyt.es>
Tue, 3 Aug 2010 20:49:10 +0000 (20:49 +0000)
(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.4@280811 65c4cc65-6c06-0410-ace0-fbb531ad65f3

channels/chan_dahdi.c
funcs/func_callerid.c

index 1e4713c6d7df570917f5dd934a38722549b987a5..a4e549a6f78d073aa75ff80e090a44a576c1b5df 100644 (file)
@@ -5250,7 +5250,7 @@ static struct ast_frame  *dahdi_read(struct ast_channel *ast)
                return &p->subs[index].f;
        }
 
-       if (p->subs[index].needcallerid) {
+       if (p->subs[index].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)
@@ -9815,12 +9815,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 86c54883ebd5da44b93296046761de9c001c2e27..418878fdac60795e2a0a8aa88e310437c6c63f7d 100644 (file)
@@ -114,6 +114,7 @@ static int callerid_read(struct ast_channel *chan, char *cmd, char *data,
 static int callerid_write(struct ast_channel *chan, char *cmd, char *data,
                          const char *value)
 {
+       int valid = 1;
        if (!value || !chan)
                return -1;
 
@@ -157,6 +158,11 @@ static int callerid_write(struct ast_channel *chan, char *cmd, char *data,
                ast_channel_unlock(chan);
        } else {
                ast_log(LOG_ERROR, "Unknown callerid data type '%s'.\n", data);
+               valid = 0;
+       }
+
+       if (valid) {
+               chan->cid.cid_tns = 1;
        }
 
        return 0;