Skip to content

Commit

Permalink
res_pjsip_dtmf_info: Hook flash
Browse files Browse the repository at this point in the history
Adds hook flash recognition support
for application/hook-flash.

ASTERISK-29460

Change-Id: I1d060fa89a7cf41244c98f892fff44eb1c9738ea
  • Loading branch information
InterLinked1 authored and gtjoseph committed Jun 8, 2021
1 parent 5f8cabc commit 1b38e89
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
5 changes: 5 additions & 0 deletions 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.

10 changes: 6 additions & 4 deletions res/res_pjsip_dtmf_info.c
Expand Up @@ -87,16 +87,18 @@ 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) {
return 0;
}

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;
}

Expand All @@ -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;

Expand All @@ -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') {
Expand Down

0 comments on commit 1b38e89

Please sign in to comment.