[asterisk-commits] oej: trunk r64497 - in /trunk: channels/chan_sip.c configs/sip.conf.sample

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Wed May 16 00:35:57 MST 2007


Author: oej
Date: Wed May 16 02:35:56 2007
New Revision: 64497

URL: http://svn.digium.com/view/asterisk?view=rev&rev=64497
Log:
Issue #6789 - Marquis - Add option to support regexten removal when host becomes unreachable

Modified:
    trunk/channels/chan_sip.c
    trunk/configs/sip.conf.sample

Modified: trunk/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/chan_sip.c?view=diff&rev=64497&r1=64496&r2=64497
==============================================================================
--- trunk/channels/chan_sip.c (original)
+++ trunk/channels/chan_sip.c Wed May 16 02:35:56 2007
@@ -524,6 +524,7 @@
 #define DEFAULT_PEDANTIC	FALSE
 #define DEFAULT_AUTOCREATEPEER	FALSE
 #define DEFAULT_QUALIFY		FALSE
+#define DEFAULT_REGEXTENONQUALIFY FALSE
 #define DEFAULT_T1MIN		100		/*!< 100 MS for minimal roundtrip time */
 #define DEFAULT_MAX_CALL_BITRATE (384)		/*!< Max bitrate for video */
 #ifndef DEFAULT_USERAGENT
@@ -584,6 +585,7 @@
 static int allow_external_domains;	/*!< Accept calls to external SIP domains? */
 static int global_callevents;		/*!< Whether we send manager events or not */
 static int global_t1min;		/*!< T1 roundtrip time minimum */
+static int global_regextenonqualify;  /*!< Whether to add/remove regexten when qualifying peers */
 static int global_autoframing;          /*!< Turn autoframing on or off. */
 static enum transfermodes global_allowtransfer;	/*!< SIP Refer restriction scheme */
 static struct sip_proxy global_outboundproxy;	/*!< Outbound proxy */
@@ -11113,6 +11115,7 @@
 	ast_cli(fd, "  Direct RTP setup:       %s\n", global_directrtpsetup ? "Yes" : "No");
 	ast_cli(fd, "  User Agent:             %s\n", global_useragent);
 	ast_cli(fd, "  Reg. context:           %s\n", S_OR(global_regcontext, "(not set)"));
+	ast_cli(fd, "  Regexten on Qualify:    %s\n", global_regextenonqualify ? "Yes" : "No");
 	ast_cli(fd, "  Caller ID:              %s\n", default_callerid);
 	ast_cli(fd, "  From: Domain:           %s\n", default_fromdomain);
 	ast_cli(fd, "  Record SIP history:     %s\n", recordhistory ? "On" : "Off");
@@ -13056,6 +13059,8 @@
 		manager_event(EVENT_FLAG_SYSTEM, "PeerStatus",
 			"Peer: SIP/%s\r\nPeerStatus: %s\r\nTime: %d\r\n",
 			peer->name, s, pingtime);
+		if (is_reachable && global_regextenonqualify)
+			register_peer_exten(peer, TRUE);
 	}
 
 	if (peer->pokeexpire > -1)
@@ -16096,6 +16101,8 @@
 	if (peer->lastms > -1) {
 		ast_log(LOG_NOTICE, "Peer '%s' is now UNREACHABLE!  Last qualify: %d\n", peer->name, peer->lastms);
 		manager_event(EVENT_FLAG_SYSTEM, "PeerStatus", "Peer: SIP/%s\r\nPeerStatus: Unreachable\r\nTime: %d\r\n", peer->name, -1);
+		if (global_regextenonqualify)
+			register_peer_exten(peer, FALSE);
 	}
 	if (peer->call)
 		sip_destroy(peer->call);
@@ -17189,6 +17196,7 @@
 	/* Reset channel settings to default before re-configuring */
 	allow_external_domains = DEFAULT_ALLOW_EXT_DOM;				/* Allow external invites */
 	global_regcontext[0] = '\0';
+	global_regextenonqualify = DEFAULT_REGEXTENONQUALIFY;
 	expiry = DEFAULT_EXPIRY;
 	global_notifyringing = DEFAULT_NOTIFYRINGING;
 	global_limitonpeers = FALSE;		/*!< Match call limit on peers only */
@@ -17342,6 +17350,8 @@
 					ast_context_create(NULL, context,"SIP");
 			}
 			ast_copy_string(global_regcontext, v->value, sizeof(global_regcontext));
+		} else if (!strcasecmp(v->name, "regextenonqualify")) {
+			global_regextenonqualify = ast_true(v->value);
 		} else if (!strcasecmp(v->name, "callerid")) {
 			ast_copy_string(default_callerid, v->value, sizeof(default_callerid));
 		} else if (!strcasecmp(v->name, "fromdomain")) {

Modified: trunk/configs/sip.conf.sample
URL: http://svn.digium.com/view/asterisk/trunk/configs/sip.conf.sample?view=diff&rev=64497&r1=64496&r2=64497
==============================================================================
--- trunk/configs/sip.conf.sample (original)
+++ trunk/configs/sip.conf.sample Wed May 16 02:35:56 2007
@@ -172,6 +172,10 @@
 ; separated by '&'.  Patterns may be used in regexten.
 ;
 ;regcontext=sipregistrations
+;regextenonqualify=yes		; Default "no"
+				; If you have qualify on and the peer becomes unreachable
+				; this setting will enforce inactivation of the regexten
+				; extension for the peer
 ;
 ;--------------------------- RTP timers ----------------------------------------------------
 ; These timers are currently used for both audio and video streams. The RTP timeouts



More information about the asterisk-commits mailing list