[asterisk-commits] mmichelson: branch group/pimp_my_sip r391270 - /team/group/pimp_my_sip/res/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Jun 10 10:48:17 CDT 2013


Author: mmichelson
Date: Mon Jun 10 10:48:15 2013
New Revision: 391270

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=391270
Log:
Get SIP INFO-initiated recording to use features configuration API.


Modified:
    team/group/pimp_my_sip/res/res_sip_one_touch_record_info.c

Modified: team/group/pimp_my_sip/res/res_sip_one_touch_record_info.c
URL: http://svnview.digium.com/svn/asterisk/team/group/pimp_my_sip/res/res_sip_one_touch_record_info.c?view=diff&rev=391270&r1=391269&r2=391270
==============================================================================
--- team/group/pimp_my_sip/res/res_sip_one_touch_record_info.c (original)
+++ team/group/pimp_my_sip/res/res_sip_one_touch_record_info.c Mon Jun 10 10:48:15 2013
@@ -32,6 +32,7 @@
 #include "asterisk/res_sip.h"
 #include "asterisk/res_sip_session.h"
 #include "asterisk/module.h"
+#include "asterisk/features_config.h"
 
 static void send_response(struct ast_sip_session *session, int code, struct pjsip_rx_data *rdata)
 {
@@ -47,9 +48,10 @@
 static int handle_incoming_request(struct ast_sip_session *session, struct pjsip_rx_data *rdata)
 {
 	static const pj_str_t rec_str = { "Record", 6 };
-	struct ast_call_feature *feature;
 	pjsip_generic_string_hdr *record;
-	char *feature_code;
+	int feature_res;
+	char feature_code[AST_FEATURE_MAX_LEN];
+	char *digit;
 
 	record = pjsip_msg_find_hdr_by_name(rdata->msg_info.msg, &rec_str, NULL);
 
@@ -69,26 +71,19 @@
 		return 0;
 	}
 
-	ast_rdlock_call_features();
+	ast_channel_lock(session->channel);
+	feature_res = ast_get_builtin_feature(session->channel, "automixmon", feature_code, sizeof(feature_code));
+	ast_channel_unlock(session->channel);
 
-	if (!(feature = ast_find_call_feature("automixmon"))) {
-		ast_unlock_call_features();
+	if (feature_res || ast_strlen_zero(feature_code)) {
 		send_response(session, 403, rdata);
 		return 0;
 	}
 
-	if (!feature->exten || ast_strlen_zero(feature->exten)) {
-		ast_unlock_call_features();
-		send_response(session, 403, rdata);
-		return 0;
-	}
-
-	for (feature_code = feature->exten; *feature_code; ++feature_code) {
-		struct ast_frame f = { AST_FRAME_DTMF, .subclass.integer = *feature_code, .len = 100 };
+	for (digit = feature_code; *digit; ++digit) {
+		struct ast_frame f = { AST_FRAME_DTMF, .subclass.integer = *digit, .len = 100 };
 		ast_queue_frame(session->channel, &f);
 	}
-
-	ast_unlock_call_features();
 
 	send_response(session, 200, rdata);
 




More information about the asterisk-commits mailing list