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

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Jul 10 11:17:58 CDT 2013


Author: mmichelson
Date: Wed Jul 10 11:17:57 2013
New Revision: 393984

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=393984
Log:
Add the 'allowtransfer' option for endpoints.


Modified:
    team/mmichelson/sip_options/include/asterisk/res_sip.h
    team/mmichelson/sip_options/res/res_sip.c
    team/mmichelson/sip_options/res/res_sip/sip_configuration.c
    team/mmichelson/sip_options/res/res_sip_refer.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=393984&r1=393983&r2=393984
==============================================================================
--- team/mmichelson/sip_options/include/asterisk/res_sip.h (original)
+++ team/mmichelson/sip_options/include/asterisk/res_sip.h Wed Jul 10 11:17:57 2013
@@ -418,6 +418,8 @@
 	struct ast_endpoint *persistent;
 	/*! The number of channels at which busy device state is returned */
 	unsigned int devicestate_busy_at;
+	/*! Determines if transfers (using REFER) are allowed by this endpoint */
+	unsigned int allowtransfer;
 };
 
 /*!

Modified: team/mmichelson/sip_options/res/res_sip.c
URL: http://svnview.digium.com/svn/asterisk/team/mmichelson/sip_options/res/res_sip.c?view=diff&rev=393984&r1=393983&r2=393984
==============================================================================
--- team/mmichelson/sip_options/res/res_sip.c (original)
+++ team/mmichelson/sip_options/res/res_sip.c Wed Jul 10 11:17:57 2013
@@ -428,6 +428,9 @@
 				<configOption name="rtpengine" default="asterisk">
 					<synopsis>Name of the RTP engine to use for channels created for this endpoint</synopsis>
 				</configOption>
+				<configOption name="allowtransfeR" default="yes">
+					<synopsis>Determines whether SIP REFER transfers are allowed for this endpoint</synopsis>
+				</configOption>
 			</configObject>
 			<configObject name="auth">
 				<synopsis>Authentication type</synopsis>

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=393984&r1=393983&r2=393984
==============================================================================
--- team/mmichelson/sip_options/res/res_sip/sip_configuration.c (original)
+++ team/mmichelson/sip_options/res/res_sip/sip_configuration.c Wed Jul 10 11:17:57 2013
@@ -663,6 +663,7 @@
 	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));
+	ast_sorcery_object_field_register(sip_sorcery, "endpoint", "allowtransfer", "yes", OPT_BOOL_T, 1, FLDSET(struct ast_sip_endpoint, allowtransfer));
 
 	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_refer.c
URL: http://svnview.digium.com/svn/asterisk/team/mmichelson/sip_options/res/res_sip_refer.c?view=diff&rev=393984&r1=393983&r2=393984
==============================================================================
--- team/mmichelson/sip_options/res/res_sip_refer.c (original)
+++ team/mmichelson/sip_options/res/res_sip_refer.c Wed Jul 10 11:17:57 2013
@@ -732,6 +732,13 @@
 	pjsip_param *replaces;
 	int response;
 
+	if (!session->endpoint->allowtransfer) {
+		pjsip_dlg_respond(session->inv_session->dlg, rdata, 603, NULL, NULL, NULL);
+		ast_log(LOG_WARNING, "Endpoint %s transfer attempt blocked due to configuration\n",
+				ast_sorcery_object_get_id(session->endpoint));
+		return 0;
+	}
+
 	/* A Refer-To header is required */
 	if (!(refer_to = pjsip_msg_find_hdr_by_name(rdata->msg_info.msg, &str_refer_to, NULL))) {
 		pjsip_dlg_respond(session->inv_session->dlg, rdata, 400, NULL, NULL, NULL);




More information about the asterisk-commits mailing list