[asterisk-commits] russell: branch 1.4 r59215 - /branches/1.4/apps/app_meetme.c

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Mon Mar 26 11:28:30 MST 2007


Author: russell
Date: Mon Mar 26 13:28:29 2007
New Revision: 59215

URL: http://svn.digium.com/view/asterisk?view=rev&rev=59215
Log:
Fix some codec negotiation problems when CallerID support is not enabled in SLA.
(issue #9308, reported by twilson)

Modified:
    branches/1.4/apps/app_meetme.c

Modified: branches/1.4/apps/app_meetme.c
URL: http://svn.digium.com/view/asterisk/branches/1.4/apps/app_meetme.c?view=diff&rev=59215&r1=59214&r2=59215
==============================================================================
--- branches/1.4/apps/app_meetme.c (original)
+++ branches/1.4/apps/app_meetme.c Mon Mar 26 13:28:29 2007
@@ -3476,6 +3476,8 @@
 	char *tech, *tech_data;
 	struct ast_dial *dial;
 	struct sla_ringing_station *ringing_station;
+	const char *cid_name = NULL, *cid_num = NULL;
+	enum ast_dial_result res;
 
 	if (!(dial = ast_dial_create()))
 		return -1;
@@ -3489,8 +3491,25 @@
 		return -1;
 	}
 
-	if (ast_dial_run(dial, sla.attempt_callerid ? ringing_trunk->trunk->chan : NULL, 1) 
-		!= AST_DIAL_RESULT_TRYING) {
+	if (!sla.attempt_callerid && !ast_strlen_zero(ringing_trunk->trunk->chan->cid.cid_name)) {
+		cid_name = ast_strdupa(ringing_trunk->trunk->chan->cid.cid_name);
+		free(ringing_trunk->trunk->chan->cid.cid_name);
+		ringing_trunk->trunk->chan->cid.cid_name = NULL;
+	}
+	if (!sla.attempt_callerid && !ast_strlen_zero(ringing_trunk->trunk->chan->cid.cid_num)) {
+		cid_num = ast_strdupa(ringing_trunk->trunk->chan->cid.cid_num);
+		free(ringing_trunk->trunk->chan->cid.cid_num);
+		ringing_trunk->trunk->chan->cid.cid_num = NULL;
+	}
+
+	res = ast_dial_run(dial, ringing_trunk->trunk->chan, 1);
+	
+	if (cid_name)
+		ringing_trunk->trunk->chan->cid.cid_name = ast_strdup(cid_name);
+	if (cid_num)
+		ringing_trunk->trunk->chan->cid.cid_num = ast_strdup(cid_num);
+	
+	if (res != AST_DIAL_RESULT_TRYING) {
 		struct sla_failed_station *failed_station;
 		ast_dial_destroy(dial);
 		if (!(failed_station = ast_calloc(1, sizeof(*failed_station))))
@@ -3932,6 +3951,7 @@
 	struct ast_conference *conf;
 	struct ast_flags conf_flags = { 0 };
 	struct sla_trunk_ref *trunk_ref = args->trunk_ref;
+	const char *cid_name = NULL, *cid_num = NULL;
 
 	if (!(dial = ast_dial_create())) {
 		ast_mutex_lock(args->cond_lock);
@@ -3950,7 +3970,24 @@
 		return NULL;
 	}
 
-	dial_res = ast_dial_run(dial, sla.attempt_callerid ? trunk_ref->chan : NULL, 1);
+	if (!sla.attempt_callerid && !ast_strlen_zero(trunk_ref->chan->cid.cid_name)) {
+		cid_name = ast_strdupa(trunk_ref->chan->cid.cid_name);
+		free(trunk_ref->chan->cid.cid_name);
+		trunk_ref->chan->cid.cid_name = NULL;
+	}
+	if (!sla.attempt_callerid && !ast_strlen_zero(trunk_ref->chan->cid.cid_num)) {
+		cid_num = ast_strdupa(trunk_ref->chan->cid.cid_num);
+		free(trunk_ref->chan->cid.cid_num);
+		trunk_ref->chan->cid.cid_num = NULL;
+	}
+
+	dial_res = ast_dial_run(dial, trunk_ref->chan, 1);
+
+	if (cid_name)
+		trunk_ref->chan->cid.cid_name = ast_strdup(cid_name);
+	if (cid_num)
+		trunk_ref->chan->cid.cid_num = ast_strdup(cid_num);
+
 	if (dial_res != AST_DIAL_RESULT_TRYING) {
 		ast_mutex_lock(args->cond_lock);
 		ast_cond_signal(args->cond);



More information about the asterisk-commits mailing list