[Asterisk-code-review] res_pjsip_dtmf_info: Hook flash (asterisk[master])

George Joseph asteriskteam at digium.com
Tue Jun 8 15:47:20 CDT 2021


George Joseph has submitted this change. ( https://gerrit.asterisk.org/c/asterisk/+/15984 )

Change subject: res_pjsip_dtmf_info: Hook flash
......................................................................

res_pjsip_dtmf_info: Hook flash

Adds hook flash recognition support
for application/hook-flash.

ASTERISK-29460

Change-Id: I1d060fa89a7cf41244c98f892fff44eb1c9738ea
---
A doc/CHANGES-staging/res_pjsip_dtmf.txt
M res/res_pjsip_dtmf_info.c
2 files changed, 11 insertions(+), 4 deletions(-)

Approvals:
  Joshua Colp: Looks good to me, but someone else must approve
  Kevin Harwell: Looks good to me, but someone else must approve
  George Joseph: Looks good to me, approved; Approved for Submit



diff --git a/doc/CHANGES-staging/res_pjsip_dtmf.txt b/doc/CHANGES-staging/res_pjsip_dtmf.txt
new file mode 100644
index 0000000..4dc2088
--- /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 3d1223d..bbc0640 100644
--- a/res/res_pjsip_dtmf_info.c
+++ b/res/res_pjsip_dtmf_info.c
@@ -87,7 +87,7 @@
 	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 @@
 	}
 
 	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 @@
 	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 @@
 		}
 	}
 
-	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') {

-- 
To view, visit https://gerrit.asterisk.org/c/asterisk/+/15984
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Change-Id: I1d060fa89a7cf41244c98f892fff44eb1c9738ea
Gerrit-Change-Number: 15984
Gerrit-PatchSet: 3
Gerrit-Owner: N A <mail at interlinked.x10host.com>
Gerrit-Reviewer: Friendly Automation
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Joshua Colp <jcolp at sangoma.com>
Gerrit-Reviewer: Kevin Harwell <kharwell at digium.com>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20210608/e9d9f900/attachment.html>


More information about the asterisk-code-review mailing list