[asterisk-commits] mmichelson: branch mmichelson/digit_manipulation r197137 - /team/mmichelson/d...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed May 27 12:19:31 CDT 2009


Author: mmichelson
Date: Wed May 27 12:19:25 2009
New Revision: 197137

URL: http://svn.asterisk.org/svn-view/asterisk?view=rev&rev=197137
Log:
Initial work towards SIP transfers.

This handles the 4-channel case. Next I will explore
the unbridged scenarios and the "blonde" transfer case.


Modified:
    team/mmichelson/digit_manipulation/channels/chan_sip.c

Modified: team/mmichelson/digit_manipulation/channels/chan_sip.c
URL: http://svn.asterisk.org/svn-view/asterisk/team/mmichelson/digit_manipulation/channels/chan_sip.c?view=diff&rev=197137&r1=197136&r2=197137
==============================================================================
--- team/mmichelson/digit_manipulation/channels/chan_sip.c (original)
+++ team/mmichelson/digit_manipulation/channels/chan_sip.c Wed May 27 12:19:25 2009
@@ -20354,6 +20354,8 @@
 					/* Chan 2: Call from Asterisk to target */
 	int res = 0;
 	struct sip_pvt *targetcall_pvt;
+	struct ast_party_connected_line connected_to_transferee;
+	struct ast_party_connected_line connected_to_target;
 
 	/* Check if the call ID of the replaces header does exist locally */
 	if (!(targetcall_pvt = get_sip_pvt_byid_locked(transferer->refer->replaces_callid, transferer->refer->replaces_callid_totag, 
@@ -20421,6 +20423,11 @@
 		transferer->callid,
 		target.chan1->name,
 		target.chan1->uniqueid);
+	ast_party_connected_line_init(&connected_to_transferee);
+	ast_party_connected_line_init(&connected_to_target);
+	ast_party_connected_line_copy(&connected_to_transferee, &current->chan1->connected);
+	ast_party_connected_line_copy(&connected_to_target, &target.chan1->connected);
+	connected_to_target.source = connected_to_transferee.source = AST_CONNECTED_LINE_UPDATE_SOURCE_TRANSFER;
 	res = attempt_transfer(current, &target);
 	sip_pvt_unlock(targetcall_pvt);
 	if (res) {
@@ -20452,17 +20459,15 @@
 		if (target.chan2) {
 			if (current->chan2) {
 				/* Tell each of the other channels to whom they are now connected */
-				ast_channel_lock(current->chan2);
-				ast_connected_line_copy_from_caller(&connected_caller, &current->chan2->cid);
-				ast_channel_unlock(current->chan2);
-				connected_caller.source = AST_CONNECTED_LINE_UPDATE_SOURCE_TRANSFER;
-				ast_channel_update_connected_line(target.chan2, &connected_caller);
-				ast_channel_lock(target.chan2);
-				ast_connected_line_copy_from_caller(&connected_caller, &target.chan2->cid);
-				ast_channel_unlock(target.chan2);
-				connected_caller.source = AST_CONNECTED_LINE_UPDATE_SOURCE_TRANSFER;
-				ast_channel_update_connected_line(current->chan2, &connected_caller);
-				ast_party_connected_line_free(&connected_caller);
+				/* XXX locking will need to be re-worked here since this is deadlock-prone.*/
+				ast_channel_lock(target.chan1);
+				/* If the channel thread already did the masquerade, then we don't need to do anything */
+				if (target.chan1->masq) {
+					ast_do_masquerade(target.chan1);
+				}
+				ast_channel_unlock(target.chan1);
+				ast_channel_queue_connected_line_update(target.chan1, &connected_to_transferee);
+				ast_channel_queue_connected_line_update(target.chan2, &connected_to_target);
 			}
 		} else {
 			/* Notify the first other party that they are connected to someone else assuming that target.chan1




More information about the asterisk-commits mailing list