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

svn-commits at lists.digium.com svn-commits at lists.digium.com
Sun Dec 31 22:19:25 MST 2006


Author: russell
Date: Sun Dec 31 23:19:24 2006
New Revision: 49090

URL: http://svn.digium.com/view/asterisk?view=rev&rev=49090
Log:
Add support for setting the default context and extension for outgoing calls

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=49090&r1=49089&r2=49090
==============================================================================
--- team/russell/chan_console/channels/chan_console.c (original)
+++ team/russell/chan_console/channels/chan_console.c Sun Dec 31 23:19:24 2006
@@ -108,6 +108,10 @@
 	PaStream *stream;
 	/*! Name of the device */
 	const char *name;
+	/*! Default context for outgoing calls */
+	char context[AST_MAX_CONTEXT];
+	/*! Default extension for outgoing calls */
+	char exten[AST_MAX_EXTENSION];
 	/*! Default CallerID number */
 	char cid_num[256];
 	/*! Default CallerID name */
@@ -597,9 +601,9 @@
 	}
 	/* supply default values if needed */
 	if (mye == NULL)
-		mye = "s";
+		mye = pvt.exten;
 	if (myc == NULL)
-		myc = "default";
+		myc = pvt.context;
 	if (ast_exists_extension(NULL, myc, mye, 1, NULL)) {
 		pvt.hookstate = 1;
 		console_new(&pvt, mye, myc, AST_STATE_RINGING);
@@ -724,6 +728,8 @@
 	/* default values */
 	memcpy(&global_jbconf, &default_jbconf, sizeof(global_jbconf));
 	strcpy(pvt.mohinterpret, "default");
+	strcpy(pvt.context, "default");
+	strcpy(pvt.exten, "s");
 	pvt.language[0] = '\0';
 	pvt.cid_num[0] = '\0';
 	pvt.cid_name[0] = '\0';
@@ -737,6 +743,10 @@
 	for (; v; v = v->next) {
 		if (!ast_jb_read_conf(&global_jbconf, v->name, v->value))
 			continue;
+		else if (!strcasecmp(v->name, "context"))
+			ast_copy_string(pvt.context, v->value, sizeof(pvt.context));
+		else if (!strcasecmp(v->name, "extension"))
+			ast_copy_string(pvt.exten, v->value, sizeof(pvt.exten));
 		else if (!strcasecmp(v->name, "mohinterpret"))
 			ast_copy_string(pvt.mohinterpret, v->value, sizeof(pvt.mohinterpret));
 		else if (!strcasecmp(v->name, "overridecontext"))

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=49090&r1=49089&r2=49090
==============================================================================
--- team/russell/chan_console/configs/console.conf.sample (original)
+++ team/russell/chan_console/configs/console.conf.sample Sun Dec 31 23:19:24 2006
@@ -3,6 +3,15 @@
 ;
 
 [general]
+
+; Set the default context to use for outgoing calls.  This can be overridden by
+; dialing some extension at context, unless the overridecontext option is enabled.
+;
+; context=default
+
+; Set the default extension to use for outgoing calls.  The default is "s".
+;
+; extension=s
 
 ; Set the default CallerID for created channels.
 ; 



More information about the svn-commits mailing list