Skip to content

Commit 1b38e89

Browse files
InterLinked1gtjoseph
authored andcommitted
res_pjsip_dtmf_info: Hook flash
Adds hook flash recognition support for application/hook-flash. ASTERISK-29460 Change-Id: I1d060fa89a7cf41244c98f892fff44eb1c9738ea
1 parent 5f8cabc commit 1b38e89

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed
+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
res_pjsip_dtmf_info: Hook flash
2+
3+
Adds recognition for application/
4+
hook-flash as a hook flash event.
5+

res/res_pjsip_dtmf_info.c

+6-4
Original file line numberDiff line numberDiff line change
@@ -87,16 +87,18 @@ static int dtmf_info_incoming_request(struct ast_sip_session *session, struct pj
8787
char *line;
8888
char event = '\0';
8989
unsigned int duration = 100;
90-
char is_dtmf;
90+
char is_dtmf, is_dtmf_relay, is_flash;
9191
int res;
9292

9393
if (!session->channel) {
9494
return 0;
9595
}
9696

9797
is_dtmf = is_media_type(rdata, "dtmf");
98+
is_dtmf_relay = is_media_type(rdata, "dtmf-relay");
99+
is_flash = is_media_type(rdata, "hook-flash");
98100

99-
if (!is_dtmf && !is_media_type(rdata, "dtmf-relay")) {
101+
if (!is_flash && !is_dtmf && !is_dtmf_relay) {
100102
return 0;
101103
}
102104

@@ -116,7 +118,7 @@ static int dtmf_info_incoming_request(struct ast_sip_session *session, struct pj
116118
if (is_dtmf) {
117119
/* directly use what is in the message body */
118120
event = get_event(cur);
119-
} else { /* content type = application/dtmf-relay */
121+
} else if (is_dtmf_relay) { /* content type = application/dtmf-relay */
120122
while ((line = strsep(&cur, "\r\n"))) {
121123
char *c;
122124

@@ -137,7 +139,7 @@ static int dtmf_info_incoming_request(struct ast_sip_session *session, struct pj
137139
}
138140
}
139141

140-
if (event == '!') {
142+
if (event == '!' || is_flash) {
141143
struct ast_frame f = { AST_FRAME_CONTROL, { AST_CONTROL_FLASH, } };
142144
ast_queue_frame(session->channel, &f);
143145
} else if (event != '\0') {

0 commit comments

Comments
 (0)