[svn-commits] oej: branch oej/videocaps r116233 - in /team/oej/videocaps: ./ channels/ main...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Wed May 14 08:03:52 CDT 2008


Author: oej
Date: Wed May 14 08:03:52 2008
New Revision: 116233

URL: http://svn.digium.com/view/asterisk?view=rev&rev=116233
Log:
Update to trunk again, try to turn on automerge

Modified:
    team/oej/videocaps/   (props changed)
    team/oej/videocaps/CHANGES
    team/oej/videocaps/channels/chan_sip.c
    team/oej/videocaps/main/manager.c
    team/oej/videocaps/pbx/pbx_spool.c
    team/oej/videocaps/res/res_agi.c
    team/oej/videocaps/sample.call

Propchange: team/oej/videocaps/
------------------------------------------------------------------------------
    automerge = http://www.codename-pineapple.org/

Propchange: team/oej/videocaps/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Wed May 14 08:03:52 2008
@@ -1,1 +1,1 @@
-/trunk:1-116179
+/trunk:1-116231

Modified: team/oej/videocaps/CHANGES
URL: http://svn.digium.com/view/asterisk/team/oej/videocaps/CHANGES?view=diff&rev=116233&r1=116232&r2=116233
==============================================================================
--- team/oej/videocaps/CHANGES (original)
+++ team/oej/videocaps/CHANGES Wed May 14 08:03:52 2008
@@ -166,6 +166,7 @@
   * Originate now requires the Originate privilege and, if you want to call out
     to a subshell, it requires the System privilege, as well.  This was done to
     enhance manager security.
+  * Originate now accepts codec settings with "Codecs: alaw, ulaw, h264" 
   * New command: Atxfer. See doc/manager_1_1.txt for more details or 
     manager show command Atxfer from the CLI
 

Modified: team/oej/videocaps/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/team/oej/videocaps/channels/chan_sip.c?view=diff&rev=116233&r1=116232&r2=116233
==============================================================================
--- team/oej/videocaps/channels/chan_sip.c (original)
+++ team/oej/videocaps/channels/chan_sip.c Wed May 14 08:03:52 2008
@@ -25,15 +25,21 @@
  * See Also:
  * \arg \ref AstCREDITS
  *
- * Implementation of RFC 3261 - without S/MIME, TCP and TLS support
+ * Implementation of RFC 3261 - without S/MIME, and experimental TCP and TLS support
  * Configuration file \link Config_sip sip.conf \endlink
  *
+ * ********** IMPORTANT *
+ * \note TCP/TLS support is EXPERIMENTAL and WILL CHANGE. This applies to configuration
+ *	settings, dialplan commands and dialplans apps/functions
+ * 
  *
+ * TODO:s
  * \todo Better support of forking
  * \todo VIA branch tag transaction checking
  * \todo Transaction support
  * \todo We need to test TCP sessions with SIP proxies and in regards
  *       to the SIP outbound specs.
+ * \todo Fix TCP/TLS handling in dialplan, SRV records, transfers and much more
  *
  * \ingroup channel_drivers
  *
@@ -12643,11 +12649,12 @@
 	Reference: RFC 3428 */
 static void receive_message(struct sip_pvt *p, struct sip_request *req)
 {
-	char buf[1024];
+	char buf[1400];	
 	struct ast_frame f;
 	const char *content_type = get_header(req, "Content-Type");
 
-	if (strcmp(content_type, "text/plain")) { /* No text/plain attachment */
+ 	if (strncmp(content_type, "text/plain", strlen("text/plain"))) { 
+	//if (strcmp(content_type, "text/plain")) { /* No text/plain attachment */
 		transmit_response(p, "415 Unsupported Media Type", req); 
 		if (!p->owner)
 			sip_scheddestroy(p, DEFAULT_TRANS_TIMEOUT);
@@ -12664,7 +12671,7 @@
 
 	if (p->owner) {
 		if (sip_debug_test_pvt(p))
-			ast_verbose("Message received: '%s'\n", buf);
+			ast_verbose("SIP Text message received: '%s'\n", buf);
 		memset(&f, 0, sizeof(f));
 		f.frametype = AST_FRAME_TEXT;
 		f.subclass = 0;
@@ -12673,11 +12680,13 @@
 		f.datalen = strlen(buf);
 		ast_queue_frame(p->owner, &f);
 		transmit_response(p, "202 Accepted", req); /* We respond 202 accepted, since we relay the message */
-	} else { /* Message outside of a call, we do not support that */
-		ast_log(LOG_WARNING, "Received message to %s from %s, dropped it...\n  Content-Type:%s\n  Message: %s\n", get_header(req, "To"), get_header(req, "From"), content_type, buf);
-		transmit_response(p, "405 Method Not Allowed", req);
-		sip_scheddestroy(p, DEFAULT_TRANS_TIMEOUT);
-	}
+		return;
+	}
+
+	/* Message outside of a call, we do not support that */
+	ast_log(LOG_WARNING, "Received message to %s from %s, dropped it...\n  Content-Type:%s\n  Message: %s\n", get_header(req, "To"), get_header(req, "From"), content_type, buf);
+	transmit_response(p, "405 Method Not Allowed", req);
+	sip_scheddestroy(p, DEFAULT_TRANS_TIMEOUT);
 	return;
 }
 

Modified: team/oej/videocaps/main/manager.c
URL: http://svn.digium.com/view/asterisk/team/oej/videocaps/main/manager.c?view=diff&rev=116233&r1=116232&r2=116233
==============================================================================
--- team/oej/videocaps/main/manager.c (original)
+++ team/oej/videocaps/main/manager.c Wed May 14 08:03:52 2008
@@ -2106,11 +2106,12 @@
 	return 0;
 }
 
-/* helper function for originate */
+/*! \brief helper function for originate */
 struct fast_originate_helper {
 	char tech[AST_MAX_EXTENSION];
 	char data[AST_MAX_EXTENSION];
 	int timeout;
+	int format;				/*!< Codecs used for a call */
 	char app[AST_MAX_APP];
 	char appdata[AST_MAX_EXTENSION];
 	char cid_name[AST_MAX_EXTENSION];
@@ -2132,12 +2133,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);
@@ -2198,6 +2199,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;
@@ -2207,6 +2209,7 @@
 	int reason = 0;
 	char tmp[256];
 	char tmp2[256];
+	int format = AST_FORMAT_SLINEAR;
 
 	pthread_t th;
 	if (!name) {
@@ -2241,6 +2244,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));
@@ -2261,6 +2268,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;
 			if (ast_pthread_create_detached(&th, NULL, fast_originate, fast)) {
@@ -2285,10 +2293,10 @@
 			astman_send_error(s, m, "Originate with certain 'Application' arguments requires the additional System privilege, which you do not have.");
 			return 0;
 		}
-		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: team/oej/videocaps/pbx/pbx_spool.c
URL: http://svn.digium.com/view/asterisk/team/oej/videocaps/pbx/pbx_spool.c?view=diff&rev=116233&r1=116232&r2=116233
==============================================================================
--- team/oej/videocaps/pbx/pbx_spool.c (original)
+++ team/oej/videocaps/pbx/pbx_spool.c Wed May 14 08:03:52 2008
@@ -66,6 +66,7 @@
 	int retrytime;                            /*!< How long to wait between retries (in seconds) */
 	int waittime;                             /*!< How long to wait for an answer */
 	long callingpid;                          /*!< PID which is currently calling */
+	int format;                               /*!< Formats (codecs) for this call */
 	
 	char tech[256];                           /*!< Which channel driver to use for outgoing call */
 	char dest[256];                           /*!< Which device/line to use for outgoing call */
@@ -94,6 +95,7 @@
 	o->priority = 1;
 	o->retrytime = 300;
 	o->waittime = 45;
+	o->format = AST_FORMAT_SLINEAR;
 	ast_set_flag(&o->options, SPOOL_FLAG_ALWAYS_DELETE);
 }
 
@@ -165,6 +167,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")) {
@@ -310,10 +314,10 @@
 	int res, reason;
 	if (!ast_strlen_zero(o->app)) {
 		ast_verb(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 {
 		ast_verb(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: team/oej/videocaps/res/res_agi.c
URL: http://svn.digium.com/view/asterisk/team/oej/videocaps/res/res_agi.c?view=diff&rev=116233&r1=116232&r2=116233
==============================================================================
--- team/oej/videocaps/res/res_agi.c (original)
+++ team/oej/videocaps/res/res_agi.c Wed May 14 08:03:52 2008
@@ -811,15 +811,13 @@
 	if (res == 0) {
 		ast_agi_fdprintf(chan, agi->fd, "200 result=%d (timeout)\n", res);
 		return RESULT_SUCCESS;
-	}
+	} 
 	if (res > 0) {
 		ast_agi_fdprintf(chan, agi->fd, "200 result=%d\n", res);
 		return RESULT_SUCCESS;
 	}
-	else {
-		ast_agi_fdprintf(chan, agi->fd, "200 result=%d (hangup)\n", res);
-		return RESULT_FAILURE;
-	}
+	ast_agi_fdprintf(chan, agi->fd, "200 result=%d (hangup)\n", res);
+	return RESULT_FAILURE;
 }
 
 static int handle_recvtext(struct ast_channel *chan, AGI *agi, int argc, char *argv[])
@@ -829,7 +827,7 @@
 	if (argc != 3)
 		return RESULT_SHOWUSAGE;
 
-	buf = ast_recvtext(chan,atoi(argv[2]));
+	buf = ast_recvtext(chan, atoi(argv[2]));
 	if (buf) {
 		ast_agi_fdprintf(chan, agi->fd, "200 result=1 (%s)\n", buf);
 		ast_free(buf);
@@ -846,19 +844,23 @@
 	if (argc != 3)
 		return RESULT_SHOWUSAGE;
 
-	if (!strncasecmp(argv[2],"on",2)) 
+	if (!strncasecmp(argv[2],"on",2)) {
 		x = 1; 
-	else 
+	} else  {
 		x = 0;
-	if (!strncasecmp(argv[2],"mate",4)) 
+	}
+	if (!strncasecmp(argv[2],"mate",4))  {
 		x = 2;
-	if (!strncasecmp(argv[2],"tdd",3))
+	}
+	if (!strncasecmp(argv[2],"tdd",3)) {
 		x = 1;
+	}
 	res = ast_channel_setoption(chan, AST_OPTION_TDD, &x, sizeof(char), 0);
-	if (res != RESULT_SUCCESS)
+	if (res != RESULT_SUCCESS) {
 		ast_agi_fdprintf(chan, agi->fd, "200 result=0\n");
-	else
+	} else {
 		ast_agi_fdprintf(chan, agi->fd, "200 result=1\n");
+	}
 	return RESULT_SUCCESS;
 }
 
@@ -866,12 +868,14 @@
 {
 	int res;
 
-	if (argc != 3)
-		return RESULT_SHOWUSAGE;
+	if (argc != 3) {
+		return RESULT_SHOWUSAGE;
+	}
 
 	res = ast_send_image(chan, argv[2]);
-	if (!ast_check_hangup(chan))
+	if (!ast_check_hangup(chan)) {
 		res = 0;
+	}
 	ast_agi_fdprintf(chan, agi->fd, "200 result=%d\n", res);
 	return (res >= 0) ? RESULT_SUCCESS : RESULT_FAILURE;
 }
@@ -879,33 +883,31 @@
 static int handle_controlstreamfile(struct ast_channel *chan, AGI *agi, int argc, char *argv[])
 {
 	int res = 0, skipms = 3000;
-	char *fwd = NULL, *rev = NULL, *pause = NULL, *stop = NULL;
-
-	if (argc < 5 || argc > 9)
-		return RESULT_SHOWUSAGE;
-
-	if (!ast_strlen_zero(argv[4]))
+	char *fwd = "#", *rev = "*", *pause = NULL, *stop = NULL;	/* Default values */
+
+	if (argc < 5 || argc > 9) {
+		return RESULT_SHOWUSAGE;
+	}
+
+	if (!ast_strlen_zero(argv[4])) {
 		stop = argv[4];
-	else
-		stop = NULL;
-	
-	if ((argc > 5) && (sscanf(argv[5], "%d", &skipms) != 1))
-		return RESULT_SHOWUSAGE;
-
-	if (argc > 6 && !ast_strlen_zero(argv[6]))
+	}
+	
+	if ((argc > 5) && (sscanf(argv[5], "%d", &skipms) != 1)) {
+		return RESULT_SHOWUSAGE;
+	}
+
+	if (argc > 6 && !ast_strlen_zero(argv[6])) {
 		fwd = argv[6];
-	else
-		fwd = "#";
-
-	if (argc > 7 && !ast_strlen_zero(argv[7]))
+	} 
+
+	if (argc > 7 && !ast_strlen_zero(argv[7])) {
 		rev = argv[7];
-	else
-		rev = "*";
-	
-	if (argc > 8 && !ast_strlen_zero(argv[8]))
+	}
+	
+	if (argc > 8 && !ast_strlen_zero(argv[8])) {
 		pause = argv[8];
-	else
-		pause = NULL;
+	} 
 	
 	res = ast_control_streamfile(chan, argv[3], fwd, rev, stop, pause, NULL, skipms, NULL);
 	

Modified: team/oej/videocaps/sample.call
URL: http://svn.digium.com/view/asterisk/team/oej/videocaps/sample.call?view=diff&rev=116233&r1=116232&r2=116233
==============================================================================
--- team/oej/videocaps/sample.call (original)
+++ team/oej/videocaps/sample.call Wed May 14 08:03:52 2008
@@ -13,6 +13,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