[asterisk-commits] qwell: branch qwell/pimp_my_dtmf r385912 - in /team/qwell/pimp_my_dtmf: chann...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Apr 16 15:14:28 CDT 2013


Author: qwell
Date: Tue Apr 16 15:14:25 2013
New Revision: 385912

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=385912
Log:
Fix review comments.

Modified:
    team/qwell/pimp_my_dtmf/channels/chan_gulp.c
    team/qwell/pimp_my_dtmf/res/res_sip_dtmf_info.c

Modified: team/qwell/pimp_my_dtmf/channels/chan_gulp.c
URL: http://svnview.digium.com/svn/asterisk/team/qwell/pimp_my_dtmf/channels/chan_gulp.c?view=diff&rev=385912&r1=385911&r2=385912
==============================================================================
--- team/qwell/pimp_my_dtmf/channels/chan_gulp.c (original)
+++ team/qwell/pimp_my_dtmf/channels/chan_gulp.c Tue Apr 16 15:14:25 2013
@@ -881,7 +881,7 @@
 		dtmf_data.duration = duration;
 		dtmf_data.session = session;
 
-		ast_sip_push_task_synchronous(session->serializer, transmit_info_dtmf, &dtmf_data);
+		ast_sip_push_task(session->serializer, transmit_info_dtmf, &dtmf_data);
 		break;
 	}
 	case AST_SIP_DTMF_RFC_4733:

Modified: team/qwell/pimp_my_dtmf/res/res_sip_dtmf_info.c
URL: http://svnview.digium.com/svn/asterisk/team/qwell/pimp_my_dtmf/res/res_sip_dtmf_info.c?view=diff&rev=385912&r1=385911&r2=385912
==============================================================================
--- team/qwell/pimp_my_dtmf/res/res_sip_dtmf_info.c (original)
+++ team/qwell/pimp_my_dtmf/res/res_sip_dtmf_info.c Tue Apr 16 15:14:25 2013
@@ -34,64 +34,67 @@
 {
 	pjsip_msg_body *body = rdata->msg_info.msg->body;
 
-	if (!pj_strcmp2(&body->content_type.type, "application") &&
-	    !pj_strcmp2(&body->content_type.subtype, "dtmf-relay")) {
-		pjsip_tx_data *tdata;
+	pjsip_tx_data *tdata;
 
-		char event = '\0';
-		unsigned int duration;
+	char buf[body->len];
+	char *cur = buf;
+	char *line;
 
-		char buf[body->len];
-		char *cur = buf;
-		char *line;
+	char event = '\0';
+	unsigned int duration = 0;
 
-		body->print_body(body, buf, body->len);
+	if (pj_strcmp2(&body->content_type.type, "application") ||
+	    pj_strcmp2(&body->content_type.subtype, "dtmf-relay")) {
+		return 0;
+	}
 
-		while ((line = strsep(&cur, "\r\n"))) {
-			char *c;
+	body->print_body(body, buf, body->len);
 
-			if ((c = strchr(line, '='))) {
-				*c++ = '\0';
+	while ((line = strsep(&cur, "\r\n"))) {
+		char *c;
 
-				c = ast_skip_blanks(c);
+		if (!(c = strchr(line, '='))) {
+			continue;
+		}
+		*c++ = '\0';
 
-				if (!strcasecmp(line, "signal")) {
-					if (c[0] == '!' || c[0] == '*' || c[0] == '#' ||
-					    ('0' <= c[0] && c[0] <= '9') ||
-					    ('A' <= c[0] && c[0] <= 'D') ||
-					    ('a' <= c[0] && c[0] <= 'd')) {
-						event = c[0];
-					} else {
-						ast_log(LOG_ERROR, "Invalid DTMF event signal in INFO message.\n");
-						return -1;
-					}
-				} else if (!strcasecmp(line, "duration")) {
-					sscanf(c, "%30u", &duration);
-				}
+		c = ast_skip_blanks(c);
+
+		if (!strcasecmp(line, "signal")) {
+			if (c[0] == '!' || c[0] == '*' || c[0] == '#' ||
+			    ('0' <= c[0] && c[0] <= '9') ||
+			    ('A' <= c[0] && c[0] <= 'D') ||
+			    ('a' <= c[0] && c[0] <= 'd')) {
+				event = c[0];
+			} else {
+				ast_log(LOG_ERROR, "Invalid DTMF event signal in INFO message.\n");
+				return -1;
 			}
+		} else if (!strcasecmp(line, "duration")) {
+			sscanf(c, "%30u", &duration);
 		}
+	}
 
-		if (!duration) {
-			duration = 100;
-		}
+	if (!duration) {
+		duration = 100;
+	}
 
-		if (event == '!') {
-			struct ast_frame f = { AST_FRAME_CONTROL, { AST_CONTROL_FLASH, } };
+	if (event == '!') {
+		struct ast_frame f = { AST_FRAME_CONTROL, { AST_CONTROL_FLASH, } };
 
-			ast_queue_frame(session->channel, &f);
-		} else {
-			struct ast_frame f = { AST_FRAME_DTMF, };
-			f.len = duration;
-			f.subclass.integer = event;
+		ast_queue_frame(session->channel, &f);
+	} else {
+		struct ast_frame f = { AST_FRAME_DTMF, };
+		f.len = duration;
+		f.subclass.integer = event;
 
-			ast_queue_frame(session->channel, &f);
-		}
+		ast_queue_frame(session->channel, &f);
+	}
 
-		if (pjsip_dlg_create_response(session->inv_session->dlg, rdata, 200, NULL, &tdata) == PJ_SUCCESS) {
-			struct pjsip_transaction *tsx = pjsip_rdata_get_tsx(rdata);
+	if (pjsip_dlg_create_response(session->inv_session->dlg, rdata, 200, NULL, &tdata) == PJ_SUCCESS) {
+		struct pjsip_transaction *tsx = pjsip_rdata_get_tsx(rdata);
 
-			pjsip_dlg_send_response(session->inv_session->dlg, tsx, tdata);
-		}
+		pjsip_dlg_send_response(session->inv_session->dlg, tsx, tdata);
 	}
 
 	return 0;




More information about the asterisk-commits mailing list