[asterisk-commits] res/res pjsip t38 ensure t38 requests get rejected quickly (asterisk[14])

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Jul 13 14:55:40 CDT 2017


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

Change subject: res/res_pjsip_t38  ensure t38 requests get rejected quickly
......................................................................

res/res_pjsip_t38  ensure t38 requests get rejected quickly

arm the t38 webhook always, so we can correctly reject a
T38 negotiation request when t38 is disabled on a channel

Change-Id: Ib1ffe35aee145d4e0fe61dd012580be11aae079d
---
M res/res_pjsip_t38.c
1 file changed, 14 insertions(+), 12 deletions(-)

Approvals:
  Joshua Colp: Looks good to me, but someone else must approve
  George Joseph: Looks good to me, approved
  Jenkins2: Approved for Submit



diff --git a/res/res_pjsip_t38.c b/res/res_pjsip_t38.c
index 3028d35..241d8b3 100644
--- a/res/res_pjsip_t38.c
+++ b/res/res_pjsip_t38.c
@@ -403,16 +403,21 @@
 static struct ast_frame *t38_framehook_write(struct ast_channel *chan,
 	struct ast_sip_session *session, struct ast_frame *f)
 {
-	if (f->frametype == AST_FRAME_CONTROL && f->subclass.integer == AST_CONTROL_T38_PARAMETERS &&
-		session->endpoint->media.t38.enabled) {
-		struct t38_parameters_task_data *data = t38_parameters_task_data_alloc(session, f);
+	if (f->frametype == AST_FRAME_CONTROL && f->subclass.integer == AST_CONTROL_T38_PARAMETERS) {
+		if (session->endpoint->media.t38.enabled) {
+			struct t38_parameters_task_data *data = t38_parameters_task_data_alloc(session, f);
 
-		if (!data) {
-			return f;
-		}
+			if (!data) {
+				return f;
+			}
 
-		if (ast_sip_push_task(session->serializer, t38_interpret_parameters, data)) {
-			ao2_ref(data, -1);
+			if (ast_sip_push_task(session->serializer, t38_interpret_parameters, data)) {
+				ao2_ref(data, -1);
+			}
+		} else {
+			struct ast_control_t38_parameters parameters = { .request_response = AST_T38_REFUSED, };
+			ast_debug(2, "T.38 support not enabled, rejecting T.38 control packet\n");
+			ast_queue_control_data(session->channel, AST_CONTROL_T38_PARAMETERS, &parameters, sizeof(parameters));
 		}
 	} else if (f->frametype == AST_FRAME_MODEM) {
 		struct ast_sip_session_media *session_media;
@@ -503,10 +508,7 @@
 		return;
 	}
 
-	/* Only attach the framehook if t38 is enabled for the endpoint */
-	if (!session->endpoint->media.t38.enabled) {
-		return;
-	}
+	/* Always attach the framehook so we can quickly reject */
 
 	ast_channel_lock(session->channel);
 

-- 
To view, visit https://gerrit.asterisk.org/6011
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: 14
Gerrit-MessageType: merged
Gerrit-Change-Id: Ib1ffe35aee145d4e0fe61dd012580be11aae079d
Gerrit-Change-Number: 6011
Gerrit-PatchSet: 1
Gerrit-Owner: Torrey Searle <tsearle at gmail.com>
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Jenkins2
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-commits/attachments/20170713/d35270f8/attachment-0001.html>


More information about the asterisk-commits mailing list