[svn-commits] mmichelson: branch group/issue8824 r183811 - in /team/group/issue8824: apps/ ...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Mon Mar 23 15:37:33 CDT 2009


Author: mmichelson
Date: Mon Mar 23 15:37:29 2009
New Revision: 183811

URL: http://svn.digium.com/svn-view/asterisk?view=rev&rev=183811
Log:
Address some of Russell's comments. Also fix a compilation error.


Modified:
    team/group/issue8824/apps/app_dial.c
    team/group/issue8824/main/features.c

Modified: team/group/issue8824/apps/app_dial.c
URL: http://svn.digium.com/svn-view/asterisk/team/group/issue8824/apps/app_dial.c?view=diff&rev=183811&r1=183810&r2=183811
==============================================================================
--- team/group/issue8824/apps/app_dial.c (original)
+++ team/group/issue8824/apps/app_dial.c Mon Mar 23 15:37:29 2009
@@ -118,8 +118,7 @@
 					immediately after receiving a PROGRESS message.</para>
 				</option>
 				<option name="e">
-					<para>Execute the <literal>h</literal> extension for peer after the call ends. This
-					operation will not be performed if the peer was parked</para>
+					<para>Execute the <literal>h</literal> extension for peer after the call ends</para>
 				</option>
 				<option name="f">
 					<para>Force the callerid of the <emphasis>calling</emphasis> channel to be set as the
@@ -636,12 +635,12 @@
 	}
 }
 
-/*! free the buffer if allocated, and set the pointer to the second arg */
-#define S_REPLACE(s, new_val) \
-	do {                      \
-		if (s)                \
-			ast_free(s);      \
-		s = (new_val);        \
+/* free the buffer if allocated, and set the pointer to the second arg */
+#define S_REPLACE(s, new_val)		\
+	do {				\
+		if (s)			\
+			ast_free(s);	\
+		s = (new_val);		\
 	} while (0)
 
 static int onedigit_goto(struct ast_channel *chan, const char *context, char exten, int pri)
@@ -756,6 +755,10 @@
 		c->cdrflags = in->cdrflags;
 
 		ast_set_redirecting(c, apr);
+		ast_channel_lock(c);
+		while (ast_channel_trylock(in)) {
+			CHANNEL_DEADLOCK_AVOIDANCE(c);
+		}
 		S_REPLACE(c->cid.cid_rdnis, ast_strdup(S_OR(original->cid.cid_rdnis, S_OR(in->macroexten, in->exten))));
 
 		c->cid.cid_tns = in->cid.cid_tns;
@@ -767,10 +770,13 @@
 		} else {
 			ast_party_caller_copy(&c->cid, &in->cid);
 			ast_string_field_set(c, accountcode, in->accountcode);
+			ast_channel_unlock(in);
 		}
 		ast_party_connected_line_copy(&c->connected, apc);
 
 		S_REPLACE(in->cid.cid_rdnis, ast_strdup(c->cid.cid_rdnis));
+		ast_channel_unlock(in);
+		ast_channel_unlock(c);
 		ast_redirecting_update(in, apr);
 
 		ast_clear_flag64(peerflags, OPT_IGNORE_CONNECTEDLINE);
@@ -831,9 +837,12 @@
 		ast_channel_make_compatible(outgoing->chan, in);
 
 		if (!ast_test_flag64(peerflags, OPT_IGNORE_CONNECTEDLINE) && !ast_test_flag64(outgoing, DIAL_NOCONNECTEDLINE)) {
-			ast_party_connected_line_collect_caller(&connected_caller, &outgoing->chan->cid);
+			ast_channel_lock(outgoing->chan);
+			ast_copy_caller_to_connected(&connected_caller, &outgoing->chan->cid);
+			ast_channel_unlock(outgoing->chan);
 			connected_caller.source = AST_CONNECTED_LINE_UPDATE_SOURCE_ANSWER;
 			ast_connected_line_update(in, &connected_caller);
+			ast_party_connected_line_free(&connected_caller);
 		}
 	}
 
@@ -885,9 +894,12 @@
 						if (o->connected.id.number) {
 							ast_connected_line_update(in, &o->connected);
 						} else if (!ast_test_flag64(o, DIAL_NOCONNECTEDLINE)) {
-							ast_party_connected_line_collect_caller(&connected_caller, &c->cid);
+							ast_channel_lock(c);
+							ast_copy_caller_to_connected(&connected_caller, &c->cid);
+							ast_channel_unlock(c);
 							connected_caller.source = AST_CONNECTED_LINE_UPDATE_SOURCE_ANSWER;
 							ast_connected_line_update(in, &connected_caller);
+							ast_party_connected_line_free(&connected_caller);
 						}
 					}
 					peer = c;
@@ -932,9 +944,12 @@
 							if (o->connected.id.number) {
 								ast_connected_line_update(in, &o->connected);
 							} else if (!ast_test_flag64(o, DIAL_NOCONNECTEDLINE)) {
-								ast_party_connected_line_collect_caller(&connected_caller, &c->cid);
+								ast_channel_lock(c);
+								ast_copy_caller_to_connected(&connected_caller, &c->cid);
+								ast_channel_unlock(c);
 								connected_caller.source = AST_CONNECTED_LINE_UPDATE_SOURCE_ANSWER;
 								ast_connected_line_update(in, &connected_caller);
+								ast_party_connected_line_free(&connected_caller);
 							}
 						}
 						peer = c;
@@ -1814,6 +1829,10 @@
 		}
 		pbx_builtin_setvar_helper(tc, "DIALEDPEERNUMBER", numsubst);
 
+		ast_channel_lock(tc);
+		while (ast_channel_trylock(chan)) {
+			CHANNEL_DEADLOCK_AVOIDANCE(tc);
+		}
 		/* Setup outgoing SDP to match incoming one */
 		ast_rtp_make_compatible(tc, chan, !outgoing && !rest);
 		
@@ -1886,6 +1905,8 @@
 			if (tc->hangupcause) {
 				chan->hangupcause = tc->hangupcause;
 			}
+			ast_channel_unlock(chan);
+			ast_channel_unlock(tc);
 			ast_hangup(tc);
 			tc = NULL;
 			ast_free(tmp);
@@ -1896,6 +1917,8 @@
 			if (!ast_test_flag64(peerflags, OPT_ORIGINAL_CLID)) {
 				ast_set_callerid(tc, S_OR(chan->macroexten, chan->exten), get_cid_name(cidname, sizeof(cidname), chan), NULL);
 			}
+			ast_channel_unlock(chan);
+			ast_channel_unlock(tc);
 		}
 		/* Put them in the list of outgoing thingies...  We're ready now.
 		   XXX If we're forcibly removed, these outgoing calls won't get

Modified: team/group/issue8824/main/features.c
URL: http://svn.digium.com/svn-view/asterisk/team/group/issue8824/main/features.c?view=diff&rev=183811&r1=183810&r2=183811
==============================================================================
--- team/group/issue8824/main/features.c (original)
+++ team/group/issue8824/main/features.c Mon Mar 23 15:37:29 2009
@@ -1698,7 +1698,7 @@
 		connected_line.source = AST_CONNECTED_LINE_UPDATE_SOURCE_TRANSFER;
 		ast_connected_line_update(newchan, &connected_line);
 
-		ast_party_connected_line_free(&connected);
+		ast_party_connected_line_free(&connected_line);
 		
 		if (ast_stream_and_wait(newchan, xfersound, ""))
 			ast_log(LOG_WARNING, "Failed to play transfer sound!\n");




More information about the svn-commits mailing list