[svn-commits] russell: branch russell/chan_console r49078 - in /team/russell/chan_console: ...

svn-commits at lists.digium.com svn-commits at lists.digium.com
Sat Dec 30 23:36:11 MST 2006


Author: russell
Date: Sun Dec 31 00:36:10 2006
New Revision: 49078

URL: http://svn.digium.com/view/asterisk?view=rev&rev=49078
Log:
Add support for setting default CallerID information.

Modified:
    team/russell/chan_console/channels/chan_console.c
    team/russell/chan_console/configs/console.conf.sample

Modified: team/russell/chan_console/channels/chan_console.c
URL: http://svn.digium.com/view/asterisk/team/russell/chan_console/channels/chan_console.c?view=diff&rev=49078&r1=49077&r2=49078
==============================================================================
--- team/russell/chan_console/channels/chan_console.c (original)
+++ team/russell/chan_console/channels/chan_console.c Sun Dec 31 00:36:10 2006
@@ -49,6 +49,7 @@
 #include "asterisk/causes.h"
 #include "asterisk/cli.h"
 #include "asterisk/musiconhold.h"
+#include "asterisk/callerid.h"
 
 #include "busy.h"
 #include "ringtone.h"
@@ -107,6 +108,10 @@
 	PaStream *stream;
 	/*! Name of the device */
 	const char *name;
+	/*! Default CallerID number */
+	char cid_num[256];
+	/*! Default CallerID name */
+	char cid_name[256];
 	/*! Default MOH class to listen to, if:
 	 *    - No MOH class set on the channel
 	 *    - Peer channel putting this device on hold did not suggest a class */
@@ -233,7 +238,7 @@
 {
 	struct ast_channel *chan;
 
-	if (!(chan = ast_channel_alloc(1, state, NULL, NULL, "Console/%s", pvt->name)))
+	if (!(chan = ast_channel_alloc(1, state, pvt->cid_num, pvt->cid_name, "Console/%s", pvt->name)))
 		return NULL;
 
 	chan->tech = &console_tech;
@@ -247,6 +252,14 @@
 		ast_copy_string(chan->exten, ext, sizeof(chan->exten));
 	if (!ast_strlen_zero(ctx))
 		ast_copy_string(chan->context, ctx, sizeof(chan->context));
+
+	/* Don't use ast_set_callerid() here because it will
+	 * generate a needless NewCallerID event */
+	chan->cid.cid_num = ast_strdup(pvt->cid_num);
+	chan->cid.cid_ani = ast_strdup(pvt->cid_num);
+	chan->cid.cid_name = ast_strdup(pvt->cid_name);
+	if (!ast_strlen_zero(ext))
+		chan->cid.cid_dnid = ast_strdup(ext);
 
 	ast_jb_configure(chan, &global_jbconf);
 
@@ -722,7 +735,10 @@
 			ast_copy_string(pvt.mohinterpret, v->value, sizeof(pvt.mohinterpret));
 		else if (!strcasecmp(v->name, "overridecontext"))
 			pvt.overridecontext = ast_true(v->value) ? 1 : 0;
-		else {
+		else if (!strcasecmp(v->name, "callerid")) {
+			ast_callerid_split(v->value, pvt.cid_name, sizeof(pvt.cid_name), 
+				pvt.cid_num, sizeof(pvt.cid_num));
+		} else {
 			ast_log(LOG_WARNING, "Unknown option '%s' on line '%d' of '%s'!\n",
 				v->name, v->lineno, CONFIG_FILE);
 		}

Modified: team/russell/chan_console/configs/console.conf.sample
URL: http://svn.digium.com/view/asterisk/team/russell/chan_console/configs/console.conf.sample?view=diff&rev=49078&r1=49077&r2=49078
==============================================================================
--- team/russell/chan_console/configs/console.conf.sample (original)
+++ team/russell/chan_console/configs/console.conf.sample Sun Dec 31 00:36:10 2006
@@ -3,6 +3,10 @@
 ;
 
 [general]
+
+; Set the default CallerID.
+; 
+; callerid=MyName Here <(256) 428-6000>
 
 ; If you set overridecontext to 'yes', then the whole dial string
 ; will be interpreted as an extension, which is extremely useful



More information about the svn-commits mailing list