[asterisk-commits] murf: branch murf/bug8173-1.2 r53849 - in /team/murf/bug8173-1.2: ./ apps/ in...

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Fri Feb 9 19:35:39 MST 2007


Author: murf
Date: Fri Feb  9 20:35:38 2007
New Revision: 53849

URL: http://svn.digium.com/view/asterisk?view=rev&rev=53849
Log:
Hopefully, this solves 8173, where the uniqueid gets dropped on async originates. We shall see.

Modified:
    team/murf/bug8173-1.2/apps/app_page.c
    team/murf/bug8173-1.2/include/asterisk/pbx.h
    team/murf/bug8173-1.2/manager.c
    team/murf/bug8173-1.2/pbx.c
    team/murf/bug8173-1.2/pbx/pbx_spool.c

Modified: team/murf/bug8173-1.2/apps/app_page.c
URL: http://svn.digium.com/view/asterisk/team/murf/bug8173-1.2/apps/app_page.c?view=diff&rev=53849&r1=53848&r2=53849
==============================================================================
--- team/murf/bug8173-1.2/apps/app_page.c (original)
+++ team/murf/bug8173-1.2/apps/app_page.c Fri Feb  9 20:35:38 2007
@@ -85,7 +85,7 @@
 {
 	struct calloutdata *cd = data;
 	ast_pbx_outgoing_app(cd->tech, AST_FORMAT_SLINEAR, cd->resource, 30000,
-		"MeetMe", cd->meetmeopts, NULL, 0, cd->cidnum, cd->cidname, cd->variables, NULL, NULL);
+						 "MeetMe", cd->meetmeopts, NULL, 0, cd->cidnum, cd->cidname, cd->variables, NULL, NULL, NULL);
 	free(cd);
 	return NULL;
 }

Modified: team/murf/bug8173-1.2/include/asterisk/pbx.h
URL: http://svn.digium.com/view/asterisk/team/murf/bug8173-1.2/include/asterisk/pbx.h?view=diff&rev=53849&r1=53848&r2=53849
==============================================================================
--- team/murf/bug8173-1.2/include/asterisk/pbx.h (original)
+++ team/murf/bug8173-1.2/include/asterisk/pbx.h Fri Feb  9 20:35:38 2007
@@ -563,11 +563,11 @@
 
 /* Synchronously or asynchronously make an outbound call and send it to a
    particular extension */
-int ast_pbx_outgoing_exten(const char *type, int format, void *data, int timeout, const char *context, const char *exten, int priority, int *reason, int sync, const char *cid_num, const char *cid_name, struct ast_variable *vars, const char *account, struct ast_channel **locked_channel);
+	int ast_pbx_outgoing_exten(const char *type, int format, void *data, int timeout, const char *context, const char *exten, int priority, int *reason, int sync, const char *cid_num, const char *cid_name, struct ast_variable *vars, const char *account, struct ast_channel **locked_channel, char *uniqueid);
 
 /* Synchronously or asynchronously make an outbound call and send it to a
    particular application with given extension */
-int ast_pbx_outgoing_app(const char *type, int format, void *data, int timeout, const char *app, const char *appdata, int *reason, int sync, const char *cid_num, const char *cid_name, struct ast_variable *vars, const char *account, struct ast_channel **locked_channel);
+	int ast_pbx_outgoing_app(const char *type, int format, void *data, int timeout, const char *app, const char *appdata, int *reason, int sync, const char *cid_num, const char *cid_name, struct ast_variable *vars, const char *account, struct ast_channel **locked_channel, char *uniqueid);
 
 /* Evaluate a condition for non-falseness and return a boolean */
 int pbx_checkcondition(char *condition);

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=53849&r1=53848&r2=53849
==============================================================================
--- team/murf/bug8173-1.2/manager.c (original)
+++ team/murf/bug8173-1.2/manager.c Fri Feb  9 20:35:38 2007
@@ -952,17 +952,19 @@
 	int res;
 	int reason = 0;
 	struct ast_channel *chan = NULL;
-
+	char uniqueid[32];
+	
+	uniqueid[0] = 0;
 	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, 
-			!ast_strlen_zero(in->cid_num) ? in->cid_num : NULL, 
-			!ast_strlen_zero(in->cid_name) ? in->cid_name : NULL,
-			in->vars, in->account, &chan);
+								   !ast_strlen_zero(in->cid_num) ? in->cid_num : NULL, 
+								   !ast_strlen_zero(in->cid_name) ? in->cid_name : NULL,
+								   in->vars, in->account, &chan, uniqueid);
 	} else {
 		res = ast_pbx_outgoing_exten(in->tech, AST_FORMAT_SLINEAR, in->data, in->timeout, in->context, in->exten, in->priority, &reason, 1, 
-			!ast_strlen_zero(in->cid_num) ? in->cid_num : NULL, 
-			!ast_strlen_zero(in->cid_name) ? in->cid_name : NULL,
-			in->vars, in->account, &chan);
+									 !ast_strlen_zero(in->cid_num) ? in->cid_num : NULL, 
+									 !ast_strlen_zero(in->cid_name) ? in->cid_name : NULL,
+									 in->vars, in->account, &chan, uniqueid);
 	}   
 	if (!res)
 		manager_event(EVENT_FLAG_CALL,
@@ -973,7 +975,7 @@
 			"Exten: %s\r\n"
 			"Reason: %d\r\n"
 			"Uniqueid: %s\r\n",
-			in->idtext, in->tech, in->data, in->context, in->exten, reason, chan ? chan->uniqueid : "<null>");
+					  in->idtext, in->tech, in->data, in->context, in->exten, reason, (chan ? chan->uniqueid : (uniqueid[0] ? uniqueid : "<null>")));
 	else
 		manager_event(EVENT_FLAG_CALL,
 			"OriginateFailure",
@@ -983,7 +985,7 @@
 			"Exten: %s\r\n"
 			"Reason: %d\r\n"
 			"Uniqueid: %s\r\n",
-			in->idtext, in->tech, in->data, in->context, in->exten, reason, chan ? chan->uniqueid : "<null>");
+					  in->idtext, in->tech, in->data, in->context, in->exten, reason, (chan ? chan->uniqueid : (uniqueid[0]? uniqueid : "<null>")));
 
 	/* Locked by ast_pbx_outgoing_exten or ast_pbx_outgoing_app */
 	if (chan)
@@ -1025,6 +1027,7 @@
 	struct ast_channel *chan = NULL;
 	char *tech, *data;
 	char *l=NULL, *n=NULL;
+	char uniqueid[32];
 	int pi = 0;
 	int res;
 	int to = 30000;
@@ -1034,6 +1037,7 @@
 	
 	pthread_t th;
 	pthread_attr_t attr;
+	uniqueid[0] = 0;
 	if (!name) {
 		astman_send_error(s, m, "Channel not specified");
 		return 0;
@@ -1101,11 +1105,11 @@
 		}
 	} else if (!ast_strlen_zero(app)) {
 		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 {
+		res = ast_pbx_outgoing_app(tech, AST_FORMAT_SLINEAR, data, to, app, appdata, &reason, 1, l, n, vars, account, &chan, uniqueid);
+	} 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);
+			res = ast_pbx_outgoing_exten(tech, AST_FORMAT_SLINEAR, data, to, context, exten, pi, &reason, 1, l, n, vars, account, &chan, uniqueid);
 		} else {
 			ast_log(LOG_NOTICE,"Debug: no App or exten processed.\n");
 			astman_send_error(s, m, "Originate with 'Exten' requires 'Context' and 'Priority'");

Modified: team/murf/bug8173-1.2/pbx.c
URL: http://svn.digium.com/view/asterisk/team/murf/bug8173-1.2/pbx.c?view=diff&rev=53849&r1=53848&r2=53849
==============================================================================
--- team/murf/bug8173-1.2/pbx.c (original)
+++ team/murf/bug8173-1.2/pbx.c Fri Feb  9 20:35:38 2007
@@ -4984,7 +4984,7 @@
 	return 0;  /* success */
 }
 
-int ast_pbx_outgoing_exten(const char *type, int format, void *data, int timeout, const char *context, const char *exten, int priority, int *reason, int sync, const char *cid_num, const char *cid_name, struct ast_variable *vars, const char *account, struct ast_channel **channel)
+int ast_pbx_outgoing_exten(const char *type, int format, void *data, int timeout, const char *context, const char *exten, int priority, int *reason, int sync, const char *cid_num, const char *cid_name, struct ast_variable *vars, const char *account, struct ast_channel **channel, char *uniqueid)
 {
 	struct ast_channel *chan;
 	struct async_stat *as;
@@ -5001,6 +5001,8 @@
 				ast_mutex_lock(&chan->lock);
 		}
 		if (chan) {
+			if (uniqueid)
+				ast_copy_string(uniqueid, chan->uniqueid, sizeof(chan->uniqueid));
 			if (chan->cdr) { /* check if the channel already has a cdr record, if not give it one */
 				ast_log(LOG_WARNING, "%s already has a call record??\n", chan->name);
 			} else {
@@ -5107,6 +5109,8 @@
 			res = -1;
 			goto outgoing_exten_cleanup;
 		}
+		if (uniqueid)
+			ast_copy_string(uniqueid, chan->uniqueid, sizeof(chan->uniqueid));
 		as->chan = chan;
 		ast_copy_string(as->context, context, sizeof(as->context));
 		ast_copy_string(as->exten,  exten, sizeof(as->exten));
@@ -5160,7 +5164,7 @@
 	return NULL;
 }
 
-int ast_pbx_outgoing_app(const char *type, int format, void *data, int timeout, const char *app, const char *appdata, int *reason, int sync, const char *cid_num, const char *cid_name, struct ast_variable *vars, const char *account, struct ast_channel **locked_channel)
+int ast_pbx_outgoing_app(const char *type, int format, void *data, int timeout, const char *app, const char *appdata, int *reason, int sync, const char *cid_num, const char *cid_name, struct ast_variable *vars, const char *account, struct ast_channel **locked_channel, char *chan_uniqueid)
 {
 	struct ast_channel *chan;
 	struct async_stat *as;
@@ -5182,6 +5186,9 @@
 	if (sync) {
 		chan = __ast_request_and_dial(type, format, data, timeout, reason, cid_num, cid_name, &oh);
 		if (chan) {
+			if (chan_uniqueid)
+				ast_copy_string(chan_uniqueid, chan->uniqueid, sizeof(chan->uniqueid));
+								
 			if (chan->cdr) { /* check if the channel already has a cdr record, if not give it one */
 				ast_log(LOG_WARNING, "%s already has a call record??\n", chan->name);
 			} else {
@@ -5274,6 +5281,8 @@
 			res = -1;
 			goto outgoing_app_cleanup;
 		}
+		if (chan_uniqueid)
+			ast_copy_string(chan_uniqueid, chan->uniqueid, sizeof(chan->uniqueid));
 		as->chan = chan;
 		ast_copy_string(as->app, app, sizeof(as->app));
 		if (appdata)

Modified: team/murf/bug8173-1.2/pbx/pbx_spool.c
URL: http://svn.digium.com/view/asterisk/team/murf/bug8173-1.2/pbx/pbx_spool.c?view=diff&rev=53849&r1=53848&r2=53849
==============================================================================
--- team/murf/bug8173-1.2/pbx/pbx_spool.c (original)
+++ team/murf/bug8173-1.2/pbx/pbx_spool.c Fri Feb  9 20:35:38 2007
@@ -259,11 +259,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, 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, 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, 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, NULL);
 	}
 	if (res) {
 		ast_log(LOG_NOTICE, "Call failed to go through, reason %d\n", reason);



More information about the asterisk-commits mailing list