From 99573f9540577b05c9c28d62eed24886d3903755 Mon Sep 17 00:00:00 2001 From: Naveen Albert Date: Wed, 2 Jun 2021 09:25:12 -0400 Subject: [PATCH] res_pjsip_dtmf_info: Hook flash Adds hook flash recognition support for application/hook-flash. ASTERISK-29460 Change-Id: I1d060fa89a7cf41244c98f892fff44eb1c9738ea --- doc/CHANGES-staging/res_pjsip_dtmf.txt | 5 +++++ res/res_pjsip_dtmf_info.c | 10 ++++++---- 2 files changed, 11 insertions(+), 4 deletions(-) create mode 100644 doc/CHANGES-staging/res_pjsip_dtmf.txt diff --git a/doc/CHANGES-staging/res_pjsip_dtmf.txt b/doc/CHANGES-staging/res_pjsip_dtmf.txt new file mode 100644 index 0000000000..4dc2088c6f --- /dev/null +++ b/doc/CHANGES-staging/res_pjsip_dtmf.txt @@ -0,0 +1,5 @@ +res_pjsip_dtmf_info: Hook flash + +Adds recognition for application/ +hook-flash as a hook flash event. + diff --git a/res/res_pjsip_dtmf_info.c b/res/res_pjsip_dtmf_info.c index 3d1223d001..bbc0640661 100644 --- a/res/res_pjsip_dtmf_info.c +++ b/res/res_pjsip_dtmf_info.c @@ -87,7 +87,7 @@ static int dtmf_info_incoming_request(struct ast_sip_session *session, struct pj char *line; char event = '\0'; unsigned int duration = 100; - char is_dtmf; + char is_dtmf, is_dtmf_relay, is_flash; int res; if (!session->channel) { @@ -95,8 +95,10 @@ static int dtmf_info_incoming_request(struct ast_sip_session *session, struct pj } is_dtmf = is_media_type(rdata, "dtmf"); + is_dtmf_relay = is_media_type(rdata, "dtmf-relay"); + is_flash = is_media_type(rdata, "hook-flash"); - if (!is_dtmf && !is_media_type(rdata, "dtmf-relay")) { + if (!is_flash && !is_dtmf && !is_dtmf_relay) { return 0; } @@ -116,7 +118,7 @@ static int dtmf_info_incoming_request(struct ast_sip_session *session, struct pj if (is_dtmf) { /* directly use what is in the message body */ event = get_event(cur); - } else { /* content type = application/dtmf-relay */ + } else if (is_dtmf_relay) { /* content type = application/dtmf-relay */ while ((line = strsep(&cur, "\r\n"))) { char *c; @@ -137,7 +139,7 @@ static int dtmf_info_incoming_request(struct ast_sip_session *session, struct pj } } - if (event == '!') { + if (event == '!' || is_flash) { struct ast_frame f = { AST_FRAME_CONTROL, { AST_CONTROL_FLASH, } }; ast_queue_frame(session->channel, &f); } else if (event != '\0') {