[svn-commits] tilghman: branch 1.4 r134976 - in /branches/1.4: ./ main/ pbx/

SVN commits to the Digium repositories svn-commits at lists.digium.com
Thu Jul 31 16:53:20 CDT 2008


Author: tilghman
Date: Thu Jul 31 16:53:19 2008
New Revision: 134976

URL: http://svn.digium.com/view/asterisk?view=rev&rev=134976
Log:
Specify codecs in callfiles and manager, to allow video calls to be set up
from callfiles and AMI.
(closes issue #9531)
 Reported by: Geisj
 Patches: 
       20080715__bug9531__1.4.diff.txt uploaded by Corydon76 (license 14)
       20080715__bug9531__1.6.0.diff.txt uploaded by Corydon76 (license 14)
 Tested by: Corydon76

Modified:
    branches/1.4/main/manager.c
    branches/1.4/pbx/pbx_spool.c
    branches/1.4/sample.call

Modified: branches/1.4/main/manager.c
URL: http://svn.digium.com/view/asterisk/branches/1.4/main/manager.c?view=diff&rev=134976&r1=134975&r2=134976
==============================================================================
--- branches/1.4/main/manager.c (original)
+++ branches/1.4/main/manager.c Thu Jul 31 16:53:19 2008
@@ -75,6 +75,7 @@
 	char tech[AST_MAX_EXTENSION];
 	char data[AST_MAX_EXTENSION];
 	int timeout;
+	int format;
 	char app[AST_MAX_APP];
 	char appdata[AST_MAX_EXTENSION];
 	char cid_name[AST_MAX_EXTENSION];
@@ -1783,12 +1784,12 @@
 	char requested_channel[AST_CHANNEL_NAME];
 
 	if (!ast_strlen_zero(in->app)) {
-		res = ast_pbx_outgoing_app(in->tech, AST_FORMAT_SLINEAR, in->data, in->timeout, in->app, in->appdata, &reason, 1, 
+		res = ast_pbx_outgoing_app(in->tech, in->format, in->data, in->timeout, in->app, in->appdata, &reason, 1, 
 			S_OR(in->cid_num, NULL), 
 			S_OR(in->cid_name, NULL),
 			in->vars, in->account, &chan);
 	} else {
-		res = ast_pbx_outgoing_exten(in->tech, AST_FORMAT_SLINEAR, in->data, in->timeout, in->context, in->exten, in->priority, &reason, 1, 
+		res = ast_pbx_outgoing_exten(in->tech, in->format, in->data, in->timeout, in->context, in->exten, in->priority, &reason, 1, 
 			S_OR(in->cid_num, NULL), 
 			S_OR(in->cid_name, NULL),
 			in->vars, in->account, &chan);
@@ -1851,6 +1852,7 @@
 	const char *appdata = astman_get_header(m, "Data");
 	const char *async = astman_get_header(m, "Async");
 	const char *id = astman_get_header(m, "ActionID");
+	const char *codecs = astman_get_header(m, "Codecs");
 	struct ast_variable *vars = astman_get_variables(m);
 	char *tech, *data;
 	char *l = NULL, *n = NULL;
@@ -1860,6 +1862,7 @@
 	int reason = 0;
 	char tmp[256];
 	char tmp2[256];
+	int format = AST_FORMAT_SLINEAR;
 	
 	pthread_t th;
 	pthread_attr_t attr;
@@ -1895,6 +1898,10 @@
 		ast_shrink_phone_number(l);
 		if (ast_strlen_zero(l))
 			l = NULL;
+	}
+	if (!ast_strlen_zero(codecs)) {
+		format = 0;
+		ast_parse_allow_disallow(NULL, &format, codecs, 1);
 	}
 	if (ast_true(async)) {
 		struct fast_originate_helper *fast = ast_calloc(1, sizeof(*fast));
@@ -1915,6 +1922,7 @@
 			ast_copy_string(fast->context, context, sizeof(fast->context));
 			ast_copy_string(fast->exten, exten, sizeof(fast->exten));
 			ast_copy_string(fast->account, account, sizeof(fast->account));
+			fast->format = format;
 			fast->timeout = to;
 			fast->priority = pi;
 			pthread_attr_init(&attr);
@@ -1928,10 +1936,10 @@
 			pthread_attr_destroy(&attr);
 		}
 	} else if (!ast_strlen_zero(app)) {
-        	res = ast_pbx_outgoing_app(tech, AST_FORMAT_SLINEAR, data, to, app, appdata, &reason, 1, l, n, vars, account, NULL);
+        	res = ast_pbx_outgoing_app(tech, format, data, to, app, appdata, &reason, 1, l, n, vars, account, NULL);
     	} else {
 		if (exten && context && pi)
-	        	res = ast_pbx_outgoing_exten(tech, AST_FORMAT_SLINEAR, data, to, context, exten, pi, &reason, 1, l, n, vars, account, NULL);
+	        	res = ast_pbx_outgoing_exten(tech, format, data, to, context, exten, pi, &reason, 1, l, n, vars, account, NULL);
 		else {
 			astman_send_error(s, m, "Originate with 'Exten' requires 'Context' and 'Priority'");
 			return 0;

Modified: branches/1.4/pbx/pbx_spool.c
URL: http://svn.digium.com/view/asterisk/branches/1.4/pbx/pbx_spool.c?view=diff&rev=134976&r1=134975&r2=134976
==============================================================================
--- branches/1.4/pbx/pbx_spool.c (original)
+++ branches/1.4/pbx/pbx_spool.c Thu Jul 31 16:53:19 2008
@@ -78,6 +78,8 @@
 	int waittime;
 	/* PID which is currently calling */
 	long callingpid;
+	/* Formats (codecs) for this call */
+	int format;
 	
 	/* What to connect to outgoing */
 	char tech[256];
@@ -115,6 +117,7 @@
 	o->priority = 1;
 	o->retrytime = 300;
 	o->waittime = 45;
+	o->format = AST_FORMAT_SLINEAR;
 	ast_set_flag(&o->options, SPOOL_FLAG_ALWAYS_DELETE);
 }
 
@@ -190,6 +193,8 @@
 						ast_log(LOG_WARNING, "Invalid max retries at line %d of %s\n", lineno, fn);
 						o->maxretries = 0;
 					}
+				} else if (!strcasecmp(buf, "codecs")) {
+					ast_parse_allow_disallow(NULL, &o->format, c, 1);
 				} else if (!strcasecmp(buf, "context")) {
 					ast_copy_string(o->context, c, sizeof(o->context));
 				} else if (!strcasecmp(buf, "extension")) {
@@ -340,11 +345,11 @@
 	if (!ast_strlen_zero(o->app)) {
 		if (option_verbose > 2)
 			ast_verbose(VERBOSE_PREFIX_3 "Attempting call on %s/%s for application %s(%s) (Retry %d)\n", o->tech, o->dest, o->app, o->data, o->retries);
-		res = ast_pbx_outgoing_app(o->tech, AST_FORMAT_SLINEAR, o->dest, o->waittime * 1000, o->app, o->data, &reason, 2 /* wait to finish */, o->cid_num, o->cid_name, o->vars, o->account, NULL);
+		res = ast_pbx_outgoing_app(o->tech, o->format, o->dest, o->waittime * 1000, o->app, o->data, &reason, 2 /* wait to finish */, o->cid_num, o->cid_name, o->vars, o->account, NULL);
 	} else {
 		if (option_verbose > 2)
 			ast_verbose(VERBOSE_PREFIX_3 "Attempting call on %s/%s for %s@%s:%d (Retry %d)\n", o->tech, o->dest, o->exten, o->context,o->priority, o->retries);
-		res = ast_pbx_outgoing_exten(o->tech, AST_FORMAT_SLINEAR, o->dest, o->waittime * 1000, o->context, o->exten, o->priority, &reason, 2 /* wait to finish */, o->cid_num, o->cid_name, o->vars, o->account, NULL);
+		res = ast_pbx_outgoing_exten(o->tech, o->format, o->dest, o->waittime * 1000, o->context, o->exten, o->priority, &reason, 2 /* wait to finish */, o->cid_num, o->cid_name, o->vars, o->account, NULL);
 	}
 	if (res) {
 		ast_log(LOG_NOTICE, "Call failed to go through, reason (%d) %s\n", reason, ast_channel_reason2str(reason));

Modified: branches/1.4/sample.call
URL: http://svn.digium.com/view/asterisk/branches/1.4/sample.call?view=diff&rev=134976&r1=134975&r2=134976
==============================================================================
--- branches/1.4/sample.call (original)
+++ branches/1.4/sample.call Thu Jul 31 16:53:19 2008
@@ -14,6 +14,9 @@
 # would for the "Dial" application.  Only one channel name is permitted.
 #
 Channel: Zap/1
+#
+# You can specify codecs for the call
+Codecs: alaw, speex, h264
 #
 # You may also specify a wait time (default is 45 seconds) for how long to
 # wait for the channel to be answered, a retry time (default is 5 mins)




More information about the svn-commits mailing list