summaryrefslogtreecommitdiff
path: root/res
diff options
context:
space:
mode:
authorJenkins2 <jenkins2@gerrit.asterisk.org>2017-07-13 10:11:40 -0500
committerGerrit Code Review <gerrit2@gerrit.digium.api>2017-07-13 10:11:40 -0500
commite29284b13170c3bcd559a146e43558f8db2a1976 (patch)
treebecc256183817b5f9a2951563babce28b43d1370 /res
parent6d0ff310c664aa8490648ead5aceb112b19e01d6 (diff)
parent154d2914fa7e7e91225e18fa8c93224740790a3e (diff)
Merge "res/res_pjsip_t38 ensure t38 requests get rejected quickly" into 13
Diffstat (limited to 'res')
-rw-r--r--res/res_pjsip_t38.c26
1 files changed, 14 insertions, 12 deletions
diff --git a/res/res_pjsip_t38.c b/res/res_pjsip_t38.c
index 4e76ac3c6..91af292c1 100644
--- a/res/res_pjsip_t38.c
+++ b/res/res_pjsip_t38.c
@@ -403,16 +403,21 @@ static int t38_interpret_parameters(void *obj)
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 @@ 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);