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

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed May 27 13:53:08 CDT 2009


Author: mmichelson
Date: Wed May 27 13:53:04 2009
New Revision: 197191

URL: http://svn.asterisk.org/svn-view/asterisk?view=rev&rev=197191
Log:
Got all the transfer COLP/CONP information working properly now.

There is one little restriction...if the transferer is attempting
to transfer the transferee to an unbridged call (e.g. transfering
a person to an IVR), then we have to indicate the connected line
update on the channel directly from the SIP monitor thread, meaning
that we cannot run a connected line macro on the channel.


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=197191&r1=197190&r2=197191
==============================================================================
--- team/mmichelson/digit_manipulation/channels/chan_sip.c (original)
+++ team/mmichelson/digit_manipulation/channels/chan_sip.c Wed May 27 13:53:04 2009
@@ -20438,8 +20438,6 @@
 			ast_channel_unlock(targetcall_pvt->owner);
 		ast_clear_flag(&transferer->flags[0], SIP_DEFER_BYE_ON_TRANSFER);
 	} else {
-		struct ast_party_connected_line connected_caller;
-
 		/* Transfer succeeded! */
 		const char *xfersound = pbx_builtin_getvar_helper(target.chan1, "ATTENDED_TRANSFER_COMPLETE_SOUND");
 
@@ -20455,41 +20453,28 @@
 			ast_channel_unlock(targetcall_pvt->owner);
 		}
 
-		ast_party_connected_line_init(&connected_caller);
+		/* Tell each of the other channels to whom they are now connected */
+		/* 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);
 		if (target.chan2) {
-			/* Tell each of the other channels to whom they are now connected */
-			/* 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
-			   has progressed far enough through the dialplan to have its called party information set. */
-			if (current->chan2) {
-				ast_channel_lock(target.chan1);
-				ast_party_connected_line_copy(&connected_caller, &target.chan1->connected);
-				ast_channel_unlock(target.chan1);
-				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);
-			}
-
-			/* We can't indicate to the called channel directly so we force the masquerade to complete
-			   and queue and update to be read and passed-through */
-			ast_channel_lock(target.chan1);
-			ast_do_masquerade(target.chan1);
-			ast_channel_unlock(target.chan1);
-
-			ast_party_connected_line_collect_caller(&connected_caller, &target.chan1->cid);
-			connected_caller.source = AST_CONNECTED_LINE_UPDATE_SOURCE_TRANSFER;
-			ast_channel_queue_connected_line_update(target.chan1, &connected_caller);
-		}
-	}
+			/* Since target.chan1 isn't actually connected to another channel, there is no way for us
+			 * to queue a frame so that its connected line status will be updated. Instead, we have to
+			 * change it directly. The problem is that we cannot run any macros on the channel in this
+			 * regard. It will have to be something we live with for now
+			 */
+			ast_channel_update_connected_line(target.chan1, &connected_to_target);
+		}
+	}
+	ast_party_connected_line_free(&connected_to_target);
+	ast_party_connected_line_free(&connected_to_transferee);
 	if (targetcall_pvt)
 		ao2_t_ref(targetcall_pvt, -1, "drop targetcall_pvt");
 	return 1;




More information about the asterisk-commits mailing list