[svn-commits] mmichelson: branch mmichelson/sip_attended_transfer r387660 - /team/mmichelso...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Sun May 5 14:43:45 CDT 2013


Author: mmichelson
Date: Sun May  5 14:43:43 2013
New Revision: 387660

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=387660
Log:
Further changes to handle_invite_replaces.

Use ast_raw_answer() instead of sending a 200 OK in place.
This way, CDR/CEL/Stasis/Manager events can be sent as
expected. 

We no longer use ast_quiet_chan so it's been removed.
Remove the "ignoring in a stupid way" case. "ignore" means
that we've received a retransmission. If we get a retransmission
we shouldn't answer. We need to just ignore the request,
so that's what we do now.


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

Modified: team/mmichelson/sip_attended_transfer/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/team/mmichelson/sip_attended_transfer/channels/chan_sip.c?view=diff&rev=387660&r1=387659&r2=387660
==============================================================================
--- team/mmichelson/sip_attended_transfer/channels/chan_sip.c (original)
+++ team/mmichelson/sip_attended_transfer/channels/chan_sip.c Sun May  5 14:43:43 2013
@@ -1274,7 +1274,6 @@
 /* static int sip_addrcmp(char *name, struct sockaddr_in *sin);	Support for peer matching */
 static int sip_refer_alloc(struct sip_pvt *p);
 static int sip_notify_alloc(struct sip_pvt *p);
-static void ast_quiet_chan(struct ast_channel *chan);
 static int do_magic_pickup(struct ast_channel *channel, const char *extension, const char *context);
 static void set_peer_nat(const struct sip_pvt *p, struct sip_peer *peer);
 static void check_for_nat(const struct ast_sockaddr *them, struct sip_pvt *p);
@@ -24606,19 +24605,6 @@
 	return 0;
 }
 
-/*! \brief Turn off generator data
-	XXX Does this function belong in the SIP channel?
-*/
-static void ast_quiet_chan(struct ast_channel *chan)
-{
-	if (chan && ast_channel_state(chan) == AST_STATE_UP) {
-		if (ast_test_flag(ast_channel_flags(chan), AST_FLAG_MOH))
-			ast_moh_stop(chan);
-		else if (ast_channel_generatordata(chan))
-			ast_deactivate_generator(chan);
-	}
-}
-
 /*! \brief Get tag from packet
  *
  * \return Returns the pointer to the provided tag buffer,
@@ -24960,17 +24946,7 @@
 	RAII_VAR(struct ast_channel *, c, p->owner, ao2_cleanup);
 
 	if (req->ignore) {
-		ast_log(LOG_NOTICE, "Ignoring this INVITE with replaces in a stupid way.\n");
-		/* We should answer something here. If we are here, the
-			call we are replacing exists, so an accepted
-			can't harm */
-		transmit_response_with_sdp(p, "200 OK", req, XMIT_RELIABLE, FALSE, FALSE);
-		/* Do something more clever here */
-		if (c) {
-			*nounlock = 1;
-			ast_channel_unlock(c);
-		}
-		return 1;
+		return 0;
 	}
 
 	if (!c) {
@@ -24987,19 +24963,14 @@
 	transmit_response(p, "100 Trying", req);
 	ast_setstate(c, AST_STATE_RING);
 
-	/* Answer the incoming call and set channel to UP state */
-	transmit_response_with_sdp(p, "200 OK", req, XMIT_RELIABLE, FALSE, FALSE);
-
-	ast_setstate(c, AST_STATE_UP);
-
-	/* Stop music on hold and other generators */
-	ast_quiet_chan(replaces_chan);
 	ast_debug(4, "Invite/Replaces: preparing to masquerade %s into %s\n", ast_channel_name(c), ast_channel_name(replaces_chan));
 
 	bridge = ast_channel_get_bridge(c);
 	*nounlock = 1;
 	ast_channel_unlock(c);
 	sip_pvt_unlock(p);
+
+	ast_raw_answer(c, 1);
 
 	if (bridge) {
 		ast_bridge_impart(bridge, replaces_chan, c, NULL, 1);




More information about the svn-commits mailing list