[Asterisk-code-review] res pjsip t38.c: Fix crash by ignoring 1xx messages. (asterisk[15])

Jenkins2 asteriskteam at digium.com
Thu Jul 5 10:56:41 CDT 2018


Jenkins2 has submitted this change and it was merged. ( https://gerrit.asterisk.org/9322 )

Change subject: res_pjsip_t38.c: Fix crash by ignoring 1xx messages.
......................................................................

res_pjsip_t38.c: Fix crash by ignoring 1xx messages.

If we initiated a T.38 reINVITE, we would crash if we received any other
1xx response message except 100 if it were followed by a 200 response.

* Made ignore any 1xx response so we do not close out the T.38 negotiation
too early.  For good measure we'll now accept any 2xx response as
acceptance of the reINVITE T.38 offer.

ASTERISK-27944

Change-Id: I0ca88aae708d091db7335af73f41035a212adff4
---
M res/res_pjsip_t38.c
1 file changed, 6 insertions(+), 5 deletions(-)

Approvals:
  Joshua Colp: Looks good to me, but someone else must approve
  Benjamin Keith Ford: Looks good to me, but someone else must approve
  Matthew Fredrickson: Looks good to me, approved
  Jenkins2: Approved for Submit



diff --git a/res/res_pjsip_t38.c b/res/res_pjsip_t38.c
index d30500a..8091bb3 100644
--- a/res/res_pjsip_t38.c
+++ b/res/res_pjsip_t38.c
@@ -251,8 +251,6 @@
 	/* This will get bumped up before scheduling */
 	pj_timer_entry_init(&state->timer, 0, session, t38_automatic_reject_timer_cb);
 
-	datastore->data = state;
-
 	return state;
 }
 
@@ -297,18 +295,21 @@
 	struct t38_state *state;
 	struct ast_sip_session_media *session_media = NULL;
 
-	if (status.code == 100) {
+	if (status.code / 100 <= 1) {
+		/* Ignore any non-final responses (1xx) */
 		return 0;
 	}
 
 	state = t38_state_get_or_alloc(session);
 	if (!session->channel || !state) {
-		ast_log(LOG_WARNING, "Received response to T.38 re-invite on '%s' but state unavailable\n",
+		ast_log(LOG_WARNING, "Received %d response to T.38 re-invite on '%s' but state unavailable\n",
+			status.code,
 			session->channel ? ast_channel_name(session->channel) : "unknown channel");
 		return 0;
 	}
 
-	if (status.code == 200) {
+	if (status.code / 100 == 2) {
+		/* Accept any 2xx response as successfully negotiated */
 		int index;
 
 		session_media = session->active_media_state->default_session[AST_MEDIA_TYPE_IMAGE];

-- 
To view, visit https://gerrit.asterisk.org/9322
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: 15
Gerrit-MessageType: merged
Gerrit-Change-Id: I0ca88aae708d091db7335af73f41035a212adff4
Gerrit-Change-Number: 9322
Gerrit-PatchSet: 1
Gerrit-Owner: Richard Mudgett <rmudgett at digium.com>
Gerrit-Reviewer: Benjamin Keith Ford <bford at digium.com>
Gerrit-Reviewer: Jenkins2
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Matthew Fredrickson <creslin at digium.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20180705/0a6103c9/attachment-0001.html>


More information about the asterisk-code-review mailing list