[asterisk-commits] mmichelson: branch mmichelson/direct_media r382517 - in /team/mmichelson/dire...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Mar 6 13:01:46 CST 2013


Author: mmichelson
Date: Wed Mar  6 13:01:42 2013
New Revision: 382517

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=382517
Log:
Fix the reinvite race condition I was experiencing.

As my last commit message stated, I was seeing times where
the reinvite that should be sent to the outbound leg was never
being sent.

The reason was because the inv_session telling when a transaction
was terminated did not correspond to when the inv_session cleared its
invite_tsx field. However, by changing when I send delayed requests
to the transaction layer's transaction state change callback, this
corresponds well with the inv_session's clearing of the invite_tsx.

I currently still have the delayed request being queued into the
serializer, but I believe I can get rid of that since I should already
be serialized and there is nothing that I need to have between getting
the transaction state change notice and sending the delayed request.


Modified:
    team/mmichelson/direct_media/channels/chan_gulp.c
    team/mmichelson/direct_media/res/res_sip_session.c

Modified: team/mmichelson/direct_media/channels/chan_gulp.c
URL: http://svnview.digium.com/svn/asterisk/team/mmichelson/direct_media/channels/chan_gulp.c?view=diff&rev=382517&r1=382516&r2=382517
==============================================================================
--- team/mmichelson/direct_media/channels/chan_gulp.c (original)
+++ team/mmichelson/direct_media/channels/chan_gulp.c Wed Mar  6 13:01:42 2013
@@ -165,7 +165,8 @@
 	struct ast_sip_session *session = ast_channel_tech_pvt(chan);
 	int changed = 0;
 
-	ast_log(LOG_NOTICE, "Are we getting told to send a reinvite?\n");
+	ast_log(LOG_NOTICE, "RTP alert to update peer for session with %s\n",
+			S_OR(ast_sorcery_object_get_id(session->endpoint), "outbound"));
 
 	if (rtp) {
 		struct ast_sip_session_media *audio = &session->media[AST_SIP_MEDIA_AUDIO];

Modified: team/mmichelson/direct_media/res/res_sip_session.c
URL: http://svnview.digium.com/svn/asterisk/team/mmichelson/direct_media/res/res_sip_session.c?view=diff&rev=382517&r1=382516&r2=382517
==============================================================================
--- team/mmichelson/direct_media/res/res_sip_session.c (original)
+++ team/mmichelson/direct_media/res/res_sip_session.c Wed Mar  6 13:01:42 2013
@@ -970,13 +970,12 @@
 {
 	pjsip_inv_session *inv;
 	pjsip_dialog *dlg;
-	ast_log(LOG_NOTICE, "Just curious if we're getting called back?\n");
+	ast_log(LOG_NOTICE, "Just curious if we're getting called back? State is %s\n", pjsip_tsx_state_str(tsx->state));
 	dlg = pjsip_tsx_get_dlg(tsx);
 	inv = pjsip_dlg_get_inv_session(dlg);
-	if (!inv) {
-		ast_log(LOG_NOTICE, "Huh, no inv_session to be found for this tsx?\n");
-	} else if (tsx == inv->invite_tsx) {
-		ast_log(LOG_NOTICE, "Whoa! TSX matches invite_tsx!\n");
+	if (tsx->method.id == PJSIP_INVITE_METHOD && tsx->state == PJSIP_TSX_STATE_TERMINATED) {
+		struct ast_sip_session *session = inv->mod_data[session_module.id];
+		queue_delayed_request(session);
 	}
 }
 
@@ -1137,15 +1136,7 @@
 
 static void session_inv_on_tsx_state_changed(pjsip_inv_session *inv, pjsip_transaction *tsx, pjsip_event *e)
 {
-	if (inv->invite_tsx == tsx && tsx->state == PJSIP_TSX_STATE_TERMINATED) {
-		struct ast_sip_session *session = inv->mod_data[session_module.id];
-		struct ast_sip_endpoint *endpoint = session->endpoint;
-		queue_delayed_request(session);
-		/* XXX This feels wrong being here */
-		if (endpoint->direct_media && session->channel) {
-			ast_queue_control(session->channel, AST_CONTROL_SRCCHANGE);
-		}
-	}
+	/* XXX STUB */
 }
 
 static int add_sdp_streams(void *obj, void *arg, void *data, int flags)




More information about the asterisk-commits mailing list