[svn-commits] qwell: branch qwell/pimp_my_dtmf r385985 - /team/qwell/pimp_my_dtmf/res/

SVN commits to the Digium repositories svn-commits at lists.digium.com
Wed Apr 17 15:35:42 CDT 2013


Author: qwell
Date: Wed Apr 17 15:35:39 2013
New Revision: 385985

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=385985
Log:
Handle responding to invalid INFO packets.

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

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=385985&r1=385984&r2=385985
==============================================================================
--- team/qwell/pimp_my_dtmf/res/res_sip_dtmf_info.c (original)
+++ team/qwell/pimp_my_dtmf/res/res_sip_dtmf_info.c Wed Apr 17 15:35:39 2013
@@ -32,6 +32,7 @@
 
 static int dtmf_info_incoming_request(struct ast_sip_session *session, struct pjsip_rx_data *rdata)
 {
+	int res = 0;
 	pjsip_msg_body *body = rdata->msg_info.msg->body;
 
 	pjsip_tx_data *tdata;
@@ -68,7 +69,8 @@
 				event = c[0];
 			} else {
 				ast_log(LOG_ERROR, "Invalid DTMF event signal in INFO message.\n");
-				return -1;
+				res = -1;
+				break;
 			}
 		} else if (!strcasecmp(line, "duration")) {
 			sscanf(c, "%30u", &duration);
@@ -83,21 +85,23 @@
 		struct ast_frame f = { AST_FRAME_CONTROL, { AST_CONTROL_FLASH, } };
 
 		ast_queue_frame(session->channel, &f);
-	} else {
+	} else if (event != '\0') {
 		struct ast_frame f = { AST_FRAME_DTMF, };
 		f.len = duration;
 		f.subclass.integer = event;
 
 		ast_queue_frame(session->channel, &f);
+	} else {
+		res = -1;
 	}
 
-	if (pjsip_dlg_create_response(session->inv_session->dlg, rdata, 200, NULL, &tdata) == PJ_SUCCESS) {
+	if (pjsip_dlg_create_response(session->inv_session->dlg, rdata, !res ? 200 : 500, NULL, &tdata) == PJ_SUCCESS) {
 		struct pjsip_transaction *tsx = pjsip_rdata_get_tsx(rdata);
 
 		pjsip_dlg_send_response(session->inv_session->dlg, tsx, tdata);
 	}
 
-	return 0;
+	return res;
 }
 
 static struct ast_sip_session_supplement dtmf_info_supplement = {




More information about the svn-commits mailing list