[asterisk-commits] file: branch file/gulp_transfer r387934 - /team/file/gulp_transfer/res/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed May 8 09:08:40 CDT 2013


Author: file
Date: Wed May  8 09:08:38 2013
New Revision: 387934

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=387934
Log:
Implement more of INVITE with Replaces.

Modified:
    team/file/gulp_transfer/res/res_sip_refer.c

Modified: team/file/gulp_transfer/res/res_sip_refer.c
URL: http://svnview.digium.com/svn/asterisk/team/file/gulp_transfer/res/res_sip_refer.c?view=diff&rev=387934&r1=387933&r2=387934
==============================================================================
--- team/file/gulp_transfer/res/res_sip_refer.c (original)
+++ team/file/gulp_transfer/res/res_sip_refer.c Wed May  8 09:08:38 2013
@@ -562,6 +562,8 @@
 	struct ast_sip_session *session;
 	/*! \brief Channel from the session (with reference) */
 	struct ast_channel *channel;
+	/*! \brief Bridge the channel is in */
+	struct ast_bridge *bridge;
 };
 
 /*! \brief Task for invite replaces */
@@ -575,6 +577,10 @@
 
 	ast_channel_ref(invite->session->channel);
 	invite->channel = invite->session->channel;
+
+	ast_channel_lock(invite->channel);
+	invite->bridge = ast_channel_get_bridge(invite->channel);
+	ast_channel_unlock(invite->channel);
 
 	return 0;
 }
@@ -614,6 +620,23 @@
 		response = 481;
 		goto end;
 	}
+
+	ast_setstate(session->channel, AST_STATE_RING);
+	ast_raw_answer(session->channel, 1);
+
+	if (!invite.bridge) {
+		struct ast_channel *chan = session->channel;
+
+		/* This will use a synchronous task but we aren't operating in the serializer at this point in time, so it
+		 * won't deadlock */
+		ast_channel_move(invite.channel, session->channel);
+		ast_hangup(chan);
+	} else {
+		ast_bridge_impart(invite.bridge, session->channel, invite.channel, NULL, 1);
+	}
+
+	ast_channel_unref(invite.channel);
+	ao2_cleanup(invite.bridge);
 
 end:
 	if (response) {




More information about the asterisk-commits mailing list