[asterisk-commits] branch oej/disable-ol-and-sub r11457 - in /team/oej/disable-ol-and-sub: ./ ch...

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Tue Feb 28 14:24:37 MST 2006


Author: oej
Date: Tue Feb 28 15:24:20 2006
New Revision: 11457

URL: http://svn.digium.com/view/asterisk?rev=11457&view=rev
Log:
Implementing variable to disable subscriptions and overlap dialling.
Need to add configuration option and possibly peer/user options.

Modified:
    team/oej/disable-ol-and-sub/   (props changed)
    team/oej/disable-ol-and-sub/channels/chan_sip.c
    team/oej/disable-ol-and-sub/res/Makefile

Propchange: team/oej/disable-ol-and-sub/
------------------------------------------------------------------------------
    svnmerge-integrated = /trunk:1-11434

Modified: team/oej/disable-ol-and-sub/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/team/oej/disable-ol-and-sub/channels/chan_sip.c?rev=11457&r1=11456&r2=11457&view=diff
==============================================================================
--- team/oej/disable-ol-and-sub/channels/chan_sip.c (original)
+++ team/oej/disable-ol-and-sub/channels/chan_sip.c Tue Feb 28 15:24:20 2006
@@ -397,6 +397,8 @@
 static int global_mwitime;		/*!< Time between MWI checks for peers */
 static int global_tos;			/*!< IP Type of service */
 static int global_videosupport;		/*!< Videosupport on or off */
+static int global_allowsubscribe;	/*!< Allow subscriptions ? */
+static int global_allowoverlap;		/*!< Allow overlab dialing ? */
 static int compactheaders;		/*!< send compact sip headers */
 static int recordhistory;		/*!< Record SIP history. Off by default */
 static int dumphistory;			/*!< Dump history to verbose before destroying SIP dialog */
@@ -8301,6 +8303,8 @@
 	ast_cli(fd, "  Videosupport:           %s\n", global_videosupport ? "Yes" : "No");
 	ast_cli(fd, "  AutoCreatePeer:         %s\n", autocreatepeer ? "Yes" : "No");
 	ast_cli(fd, "  Allow unknown access:   %s\n", global_allowguest ? "Yes" : "No");
+	ast_cli(fd, "  Allow subscriptions:    %s\n", global_allowsubscribe ? "Yes" : "No");
+	ast_cli(fd, "  Allow overlap dialing:  %s\n", global_allowoverlap ? "Yes" : "No");
 	ast_cli(fd, "  Promsic. redir:         %s\n", ast_test_flag(&global_flags, SIP_PROMISCREDIR) ? "Yes" : "No");
 	ast_cli(fd, "  SIP domain support:     %s\n", AST_LIST_EMPTY(&domain_list) ? "No" : "Yes");
 	ast_cli(fd, "  Call to non-local dom.: %s\n", allow_external_domains ? "Yes" : "No");
@@ -10332,8 +10336,6 @@
 		ast_string_field_set(p, context, default_context);
 	if (res < 0)
 		transmit_response_with_allow(p, "404 Not Found", req, 0);
-	else if (res > 0)
-		transmit_response_with_allow(p, "484 Address Incomplete", req, 0);
 	else 
 		transmit_response_with_allow(p, "200 OK", req, 0);
 	/* Destroy if this OPTIONS was the opening request, but not if
@@ -10465,11 +10467,11 @@
 		build_contact(p);			/* Build our contact header */
 
 		if (gotdest) {
-			if (gotdest < 0) {
-				transmit_response_reliable(p, "404 Not Found", req, 1);
+			if (gotdest == 1 && global_allowoverlap) {
+				transmit_response_reliable(p, "484 Address Incomplete", req, 1);
 				update_call_counter(p, DEC_CALL_LIMIT);
 			} else {
-				transmit_response_reliable(p, "484 Address Incomplete", req, 1);
+				transmit_response_reliable(p, "404 Not Found", req, 1);
 				update_call_counter(p, DEC_CALL_LIMIT);
 			}
 			ast_set_flag(p, SIP_NEEDDESTROY);		
@@ -10612,10 +10614,10 @@
 	if (ast_strlen_zero(p->context))
 		ast_string_field_set(p, context, default_context);
 	res = get_refer_info(p, req);
-	if (res < 0)
+	if (global_allowoverlap && res > 0)
+		transmit_response_with_allow(p, "484 Address Incomplete", req, 1);
+	else if (res < 0)
 		transmit_response_with_allow(p, "404 Not Found", req, 1);
-	else if (res > 0)
-		transmit_response_with_allow(p, "484 Address Incomplete", req, 1);
 	else {
 		int nobye = 0;
 		if (!ignore) {
@@ -10782,6 +10784,12 @@
 				ast_log(LOG_DEBUG, "Got a re-subscribe on existing subscription %s\n", p->callid);
 		}
 	}
+	if (global_allowsubscribe == FALSE) {
+		transmit_response(p, "403 Forbidden (policy)", &p->initreq);
+		ast_set_flag(p, SIP_NEEDDESTROY);	
+		return 0;
+	}
+
 	if (!ignore && !p->initreq.headers) {
 		/* Use this as the basis */
 		if (debug)
@@ -10823,10 +10831,10 @@
 		gotdest = get_destination(p, NULL);
 		build_contact(p);
 		if (gotdest) {
-			if (gotdest < 0)
+			if (global_allowoverlap && gotdest == 1)
+				transmit_response(p, "484 Address Incomplete", req);	/* Overlap dialing on SUBSCRIBE?? */
+			else 
 				transmit_response(p, "404 Not Found", req);
-			else
-				transmit_response(p, "484 Address Incomplete", req);	/* Overlap dialing on SUBSCRIBE?? */
 			ast_set_flag(p, SIP_NEEDDESTROY);	
 		} else {
 
@@ -12361,6 +12369,8 @@
 	ourport = DEFAULT_SIP_PORT;
 	srvlookup = DEFAULT_SRVLOOKUP;
 	global_tos = DEFAULT_TOS;
+	global_allowsubscribe = TRUE;
+	global_allowoverlap = TRUE;
 	externhost[0] = '\0';			/* External host name (for behind NAT DynDNS support) */
 	externexpire = 0;			/* Expiration for DNS re-issuing */
 	externrefresh = 10;

Modified: team/oej/disable-ol-and-sub/res/Makefile
URL: http://svn.digium.com/view/asterisk/team/oej/disable-ol-and-sub/res/Makefile?rev=11457&r1=11456&r2=11457&view=diff
==============================================================================
--- team/oej/disable-ol-and-sub/res/Makefile (original)
+++ team/oej/disable-ol-and-sub/res/Makefile Tue Feb 28 15:24:20 2006
@@ -32,11 +32,11 @@
   MODS:=$(filter-out res_osp.so,$(MODS))
 endif
 
-ifeq ($(wildcard $(CROSS_COMPILE_TARGET)/usr/include/net-snmp/net-snmp-config.h),)
+#ifeq ($(wildcard $(CROSS_COMPILE_TARGET)/usr/include/net-snmp/net-snmp-config.h),)
   MODS:=$(filter-out res_snmp.so,$(MODS))
-else
-  SNMP_LDLIBS+=$(shell net-snmp-config --agent-libs)
-endif
+#else
+  #SNMP_LDLIBS+=$(shell net-snmp-config --agent-libs)
+#endif
 
 ifeq (${WITH_SMDI},)
   MODS:=$(filter-out res_smdi.so,$(MODS))



More information about the asterisk-commits mailing list