[asterisk-commits] file: branch file/gulp_fax r394550 - /team/file/gulp_fax/res/res_sip_t38.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Jul 17 10:17:27 CDT 2013


Author: file
Date: Wed Jul 17 10:17:25 2013
New Revision: 394550

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=394550
Log:
React to failure responses for outgoing T.38 re-invites.

Modified:
    team/file/gulp_fax/res/res_sip_t38.c

Modified: team/file/gulp_fax/res/res_sip_t38.c
URL: http://svnview.digium.com/svn/asterisk/team/file/gulp_fax/res/res_sip_t38.c?view=diff&rev=394550&r1=394549&r2=394550
==============================================================================
--- team/file/gulp_fax/res/res_sip_t38.c (original)
+++ team/file/gulp_fax/res/res_sip_t38.c Wed Jul 17 10:17:25 2013
@@ -289,6 +289,29 @@
 			break;
 		}
 	}
+
+	return 0;
+}
+
+/*! \brief Callback for when a response is received for a T.38 re-invite */
+static int t38_reinvite_response_cb(struct ast_sip_session *session, pjsip_rx_data *rdata)
+{
+	struct pjsip_status_line status = rdata->msg_info.msg->line.status;
+	struct t38_state *state;
+	RAII_VAR(struct ast_sip_session_media *, session_media, NULL, ao2_cleanup);
+
+	if (status.code == 100) {
+		return 0;
+	}
+
+	if (!(state = t38_state_get_or_alloc(session)) ||
+		!(session_media = ao2_find(session->media, "image", OBJ_KEY))) {
+		ast_log(LOG_WARNING, "Received response to T.38 re-invite on '%s' but state unavailable\n",
+			ast_channel_name(session->channel));
+		return 0;
+	}
+
+	t38_change_state(session, session_media, state, (status.code == 200) ? T38_ENABLED : T38_REJECTED);
 
 	return 0;
 }
@@ -342,7 +365,8 @@
 			state->our_parms = *parameters;
 			ast_udptl_set_local_max_ifp(session_media->udptl, state->our_parms.max_ifp);
 			t38_change_state(data->session, session_media, state, T38_LOCAL_REINVITE);
-			ast_sip_session_refresh(data->session, NULL, t38_reinvite_sdp_cb, NULL, AST_SIP_SESSION_REFRESH_METHOD_INVITE, 1);
+			ast_sip_session_refresh(data->session, NULL, t38_reinvite_sdp_cb, t38_reinvite_response_cb,
+				AST_SIP_SESSION_REFRESH_METHOD_INVITE, 1);
 		}
 		break;
 	case AST_T38_TERMINATED:
@@ -747,10 +771,7 @@
 	ast_sockaddr_set_port(addrs, remote_stream->desc.port);
 	ast_udptl_set_peer(session_media->udptl, addrs);
 
-	if (session->t38state == T38_LOCAL_REINVITE) {
-		t38_interpret_sdp(state, session, session_media, remote_stream);
-		t38_change_state(session, session_media, state, T38_ENABLED);
-	}
+	t38_interpret_sdp(state, session, session_media, remote_stream);
 
 	return 0;
 }




More information about the asterisk-commits mailing list