[asterisk-commits] mmichelson: branch mmichelson/sip_options r393981 - in /team/mmichelson/sip_o...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Jul 10 10:48:30 CDT 2013


Author: mmichelson
Date: Wed Jul 10 10:48:28 2013
New Revision: 393981

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=393981
Log:
Add 'recordonfeature' and 'recordofffeature' for endpoints.


Modified:
    team/mmichelson/sip_options/include/asterisk/res_sip.h
    team/mmichelson/sip_options/res/res_sip/sip_configuration.c
    team/mmichelson/sip_options/res/res_sip_one_touch_record_info.c

Modified: team/mmichelson/sip_options/include/asterisk/res_sip.h
URL: http://svnview.digium.com/svn/asterisk/team/mmichelson/sip_options/include/asterisk/res_sip.h?view=diff&rev=393981&r1=393980&r2=393981
==============================================================================
--- team/mmichelson/sip_options/include/asterisk/res_sip.h (original)
+++ team/mmichelson/sip_options/include/asterisk/res_sip.h Wed Jul 10 10:48:28 2013
@@ -329,6 +329,10 @@
 		AST_STRING_FIELD(zone);
 		/*! Configured language for this endpoint. */
 		AST_STRING_FIELD(language);
+		/*! Feature to enact when one-touch recording INFO with Record: On is received */
+		AST_STRING_FIELD(recordonfeature);
+		/*! Feature to enact when one-touch recording INFO with Record: Off is received */
+		AST_STRING_FIELD(recordofffeature);
 	);
 	/*! Identification information for this endpoint */
 	struct ast_party_id id;

Modified: team/mmichelson/sip_options/res/res_sip/sip_configuration.c
URL: http://svnview.digium.com/svn/asterisk/team/mmichelson/sip_options/res/res_sip/sip_configuration.c?view=diff&rev=393981&r1=393980&r2=393981
==============================================================================
--- team/mmichelson/sip_options/res/res_sip/sip_configuration.c (original)
+++ team/mmichelson/sip_options/res/res_sip/sip_configuration.c Wed Jul 10 10:48:28 2013
@@ -661,6 +661,8 @@
 	ast_sorcery_object_field_register(sip_sorcery, "endpoint", "rtpengine", "asterisk", OPT_STRINGFIELD_T, 0, STRFLDSET(struct ast_sip_endpoint, rtp_engine));
 	ast_sorcery_object_field_register(sip_sorcery, "endpoint", "tonezone", "", OPT_STRINGFIELD_T, 0, STRFLDSET(struct ast_sip_endpoint, zone));
 	ast_sorcery_object_field_register(sip_sorcery, "endpoint", "language", "", OPT_STRINGFIELD_T, 0, STRFLDSET(struct ast_sip_endpoint, language));
+	ast_sorcery_object_field_register(sip_sorcery, "endpoint", "recordonfeature", "automixmon", OPT_STRINGFIELD_T, 0, STRFLDSET(struct ast_sip_endpoint, recordonfeature));
+	ast_sorcery_object_field_register(sip_sorcery, "endpoint", "recordofffeature", "automixmon", OPT_STRINGFIELD_T, 0, STRFLDSET(struct ast_sip_endpoint, recordofffeature));
 
 	if (ast_sip_initialize_sorcery_transport(sip_sorcery)) {
 		ast_log(LOG_ERROR, "Failed to register SIP transport support with sorcery\n");

Modified: team/mmichelson/sip_options/res/res_sip_one_touch_record_info.c
URL: http://svnview.digium.com/svn/asterisk/team/mmichelson/sip_options/res/res_sip_one_touch_record_info.c?view=diff&rev=393981&r1=393980&r2=393981
==============================================================================
--- team/mmichelson/sip_options/res/res_sip_one_touch_record_info.c (original)
+++ team/mmichelson/sip_options/res/res_sip_one_touch_record_info.c Wed Jul 10 10:48:28 2013
@@ -51,12 +51,22 @@
 	pjsip_generic_string_hdr *record;
 	int feature_res;
 	char feature_code[AST_FEATURE_MAX_LEN];
+	const char *feature;
 	char *digit;
 
 	record = pjsip_msg_find_hdr_by_name(rdata->msg_info.msg, &rec_str, NULL);
 
 	/* If we don't have Record header, we have nothing to do */
-	if (!record || (pj_stricmp2(&record->hvalue, "on") && pj_stricmp2(&record->hvalue, "off"))) {
+	if (!record) {
+		return 0;
+	}
+
+	if (!pj_stricmp2(&record->hvalue, "on")) {
+		feature = session->endpoint->recordonfeature;
+	} else if (!pj_stricmp2(&record->hvalue, "off")) {
+		feature = session->endpoint->recordofffeature;
+	} else {
+		/* Don't send response because another module may handle this */
 		return 0;
 	}
 
@@ -66,13 +76,13 @@
 	}
 
 	/* Is this endpoint configured with One Touch Recording? */
-	if (!session->endpoint->one_touch_recording) {
+	if (!session->endpoint->one_touch_recording || ast_strlen_zero(feature)) {
 		send_response(session, 403, rdata);
 		return 0;
 	}
 
 	ast_channel_lock(session->channel);
-	feature_res = ast_get_builtin_feature(session->channel, "automixmon", feature_code, sizeof(feature_code));
+	feature_res = ast_get_feature(session->channel, feature, feature_code, sizeof(feature_code));
 	ast_channel_unlock(session->channel);
 
 	if (feature_res || ast_strlen_zero(feature_code)) {




More information about the asterisk-commits mailing list