[asterisk-commits] tilghman: branch 1.4 r280811 - in /branches/1.4: channels/ funcs/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Aug 3 15:49:16 CDT 2010


Author: tilghman
Date: Tue Aug  3 15:49:10 2010
New Revision: 280811

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=280811
Log:
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

Modified:
    branches/1.4/channels/chan_dahdi.c
    branches/1.4/funcs/func_callerid.c

Modified: branches/1.4/channels/chan_dahdi.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.4/channels/chan_dahdi.c?view=diff&rev=280811&r1=280810&r2=280811
==============================================================================
--- branches/1.4/channels/chan_dahdi.c (original)
+++ branches/1.4/channels/chan_dahdi.c Tue Aug  3 15:49:10 2010
@@ -5250,7 +5250,7 @@
 		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 @@
 					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);
 					}

Modified: branches/1.4/funcs/func_callerid.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.4/funcs/func_callerid.c?view=diff&rev=280811&r1=280810&r2=280811
==============================================================================
--- branches/1.4/funcs/func_callerid.c (original)
+++ branches/1.4/funcs/func_callerid.c Tue Aug  3 15:49:10 2010
@@ -114,6 +114,7 @@
 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 @@
 		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;




More information about the asterisk-commits mailing list