diff options
author | George Joseph <gjoseph@digium.com> | 2017-07-14 07:44:20 -0500 |
---|---|---|
committer | Gerrit Code Review <gerrit2@gerrit.digium.api> | 2017-07-14 07:44:20 -0500 |
commit | a20703fd1b6957db2e446a59923f5faeef8f8bb7 (patch) | |
tree | 791e08614fca2e2f6fd997a6bfd7bc1dc9ad9fb6 /res | |
parent | 0f45c979a3de00b320e05ba93309cf412e9e2702 (diff) | |
parent | d42a9cc9dc3c218254d5bb71159ca290431fa244 (diff) |
Merge "res/res_pjsip_t38 ensure t38 requests get rejected quickly"
Diffstat (limited to 'res')
-rw-r--r-- | res/res_pjsip_t38.c | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/res/res_pjsip_t38.c b/res/res_pjsip_t38.c index 877d48fb6..fbfbd0cb0 100644 --- a/res/res_pjsip_t38.c +++ b/res/res_pjsip_t38.c @@ -497,16 +497,21 @@ static struct ast_frame *t38_framehook(struct ast_channel *chan, struct ast_fram return f; } - if (f->frametype == AST_FRAME_CONTROL && f->subclass.integer == AST_CONTROL_T38_PARAMETERS && - channel->session->endpoint->media.t38.enabled) { - struct t38_parameters_task_data *data = t38_parameters_task_data_alloc(channel->session, f); + if (f->frametype == AST_FRAME_CONTROL && f->subclass.integer == AST_CONTROL_T38_PARAMETERS) { + if (channel->session->endpoint->media.t38.enabled) { + struct t38_parameters_task_data *data = t38_parameters_task_data_alloc(channel->session, f); - if (!data) { - return f; - } + if (!data) { + return f; + } - if (ast_sip_push_task(channel->session->serializer, t38_interpret_parameters, data)) { - ao2_ref(data, -1); + if (ast_sip_push_task(channel->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(chan, AST_CONTROL_T38_PARAMETERS, ¶meters, sizeof(parameters)); } } @@ -551,10 +556,7 @@ static void t38_attach_framehook(struct ast_sip_session *session) 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); |