[asterisk-commits] murf: branch murf/bug8173-1.2 r48060 - /team/murf/bug8173-1.2/manager.c

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Mon Nov 27 11:46:07 MST 2006


Author: murf
Date: Mon Nov 27 12:46:06 2006
New Revision: 48060

URL: http://svn.digium.com/view/asterisk?view=rev&rev=48060
Log:
my debug stuff in manager.c

Modified:
    team/murf/bug8173-1.2/manager.c

Modified: team/murf/bug8173-1.2/manager.c
URL: http://svn.digium.com/view/asterisk/team/murf/bug8173-1.2/manager.c?view=diff&rev=48060&r1=48059&r2=48060
==============================================================================
--- team/murf/bug8173-1.2/manager.c (original)
+++ team/murf/bug8173-1.2/manager.c Mon Nov 27 12:46:06 2006
@@ -376,6 +376,23 @@
 	ast_cli(s->fd, "Response: %s\r\n", resp);
 	if (!ast_strlen_zero(id))
 		ast_cli(s->fd, "ActionID: %s\r\n",id);
+	if (msg)
+		ast_cli(s->fd, "Message: %s\r\n\r\n", msg);
+	else
+		ast_cli(s->fd, "\r\n");
+}
+
+void astman_send_response_uniqueid(struct mansession *s, struct message *m, char *resp, char *msg, char *uniqueid);
+
+void astman_send_response_uniqueid(struct mansession *s, struct message *m, char *resp, char *msg, char *uniqueid)
+{
+	char *id = astman_get_header(m,"ActionID");
+
+	ast_cli(s->fd, "Response: %s\r\n", resp);
+	if (!ast_strlen_zero(id))
+		ast_cli(s->fd, "ActionID: %s\r\n",id);
+	if (!ast_strlen_zero(uniqueid))
+		ast_cli(s->fd, "Uniqueid: %s\r\n", uniqueid);
 	if (msg)
 		ast_cli(s->fd, "Message: %s\r\n\r\n", msg);
 	else
@@ -1005,6 +1022,7 @@
 	char *async = astman_get_header(m, "Async");
 	char *id = astman_get_header(m, "ActionID");
 	struct ast_variable *vars = astman_get_variables(m);
+	struct ast_channel *chan = NULL;
 	char *tech, *data;
 	char *l=NULL, *n=NULL;
 	int pi = 0;
@@ -1052,7 +1070,9 @@
 		struct fast_originate_helper *fast = malloc(sizeof(struct fast_originate_helper));
 		if (!fast) {
 			res = -1;
+			ast_log(LOG_NOTICE,"Debug: async was set, malloc failed\n");
 		} else {
+			ast_log(LOG_NOTICE,"Debug: async was set, firing a pthread\n");
 			memset(fast, 0, sizeof(struct fast_originate_helper));
 			if (!ast_strlen_zero(id))
 				snprintf(fast->idtext, sizeof(fast->idtext), "ActionID: %s\r\n", id);
@@ -1079,19 +1099,33 @@
 			}
 		}
 	} 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);
+		ast_log(LOG_NOTICE,"Debug: App processed.\n");
+        	res = ast_pbx_outgoing_app(tech, AST_FORMAT_SLINEAR, data, to, app, appdata, &reason, 1, l, n, vars, account, &chan);
     	} 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);
-		else {
+		if (exten && context && pi) {
+			ast_log(LOG_NOTICE,"Debug: exten processed.\n");
+	        	res = ast_pbx_outgoing_exten(tech, AST_FORMAT_SLINEAR, data, to, context, exten, pi, &reason, 1, l, n, vars, account, &chan);
+		} else {
+			ast_log(LOG_NOTICE,"Debug: no App or exten processed.\n");
 			astman_send_error(s, m, "Originate with 'Exten' requires 'Context' and 'Priority'");
 			return 0;
 		}
 	}   
-	if (!res)
-		astman_send_ack(s, m, "Originate successfully queued");
-	else
+	if (!res) {
+		if (chan && chan->uniqueid[0]) {
+			ast_log(LOG_NOTICE,"Debug: res=success, Chan=%x, Uniq=%s send response.\n", (int)chan, chan->uniqueid);
+			astman_send_response_uniqueid(s, m, "Success", "Originate Successfully Queued", chan->uniqueid);
+		} else  {
+			if (chan)
+				ast_log(LOG_NOTICE,"Debug: res=success, Chan=%x, uniq=%s.\n", (int)chan, chan->uniqueid);
+			else
+				ast_log(LOG_NOTICE,"Debug: res-success, Chan=%x, uniq=Null.\n", (int)chan);
+			astman_send_ack(s, m, "Originate successfully queued");
+		}
+	} else {
+		ast_log(LOG_NOTICE,"Debug: Originate failed.\n");
 		astman_send_error(s, m, "Originate failed");
+	}
 	return 0;
 }
 



More information about the asterisk-commits mailing list