[asterisk-commits] seanbright: trunk r158756 - in /trunk: channels/ configs/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Sat Nov 22 21:36:53 CST 2008


Author: seanbright
Date: Sat Nov 22 21:36:52 2008
New Revision: 158756

URL: http://svn.digium.com/view/asterisk?view=rev&rev=158756
Log:
If you enabled 'notifycid' one of the limitations is that the calling channel
is only found if it dialed the extension that was subscribed to.  You can now
specify 'ignore-context' for the 'notifycid' option in sip.conf which will, as
it's value implies, ignore the current context of the caller when doing the
lookup.

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=158756&r1=158755&r2=158756
==============================================================================
--- trunk/channels/chan_sip.c (original)
+++ trunk/channels/chan_sip.c Sat Nov 22 21:36:52 2008
@@ -775,6 +775,13 @@
 	SIP_PING,		/*!< Not supported at all, no standard but still implemented out there */
 };
 
+/*! \brief Settings for the 'notifycid' option, see sip.conf.sample for details. */
+enum notifycid_setting {
+	DISABLED       = 0,
+	ENABLED        = 1,
+	IGNORE_CONTEXT = 2,
+};
+
 /*! \brief The core structure to setup dialogs. We parse incoming messages by using
 	structure and then route the messages according to the type.
 
@@ -952,7 +959,7 @@
 #define DEFAULT_ALLOW_EXT_DOM	TRUE		/*!< Allow external domains */
 #define DEFAULT_REALM		"asterisk"	/*!< Realm for HTTP digest authentication */
 #define DEFAULT_NOTIFYRINGING	TRUE		/*!< Notify devicestate system on ringing state */
-#define DEFAULT_NOTIFYCID		FALSE	/*!< Include CID with ringing notifications */
+#define DEFAULT_NOTIFYCID		DISABLED	/*!< Include CID with ringing notifications */
 #define DEFAULT_PEDANTIC	FALSE		/*!< Avoid following SIP standards for dialog matching */
 #define DEFAULT_AUTOCREATEPEER	FALSE		/*!< Don't create peers automagically */
 #define	DEFAULT_MATCHEXTERNIPLOCALLY FALSE	/*!< Match extern IP locally default setting */
@@ -1022,8 +1029,9 @@
 
 static int global_notifyringing;	/*!< Send notifications on ringing */
 static int global_notifyhold;		/*!< Send notifications on hold */
-static int global_notifycid;        /*!< Send CID with ringing notifications */
 static int global_match_auth_username;		/*!< Match auth username if available instead of From: Default off. */
+
+static enum notifycid_setting global_notifycid; /*!< Send CID with ringing notifications */
 
 static int global_relaxdtmf;		/*!< Relax DTMF */
 static int global_rtptimeout;		/*!< Time out call if no RTP */
@@ -9920,7 +9928,7 @@
 
 	return (c->pbx &&
 			(!strcasecmp(c->macroexten, p->exten) || !strcasecmp(c->exten, p->exten)) &&
-			!strcasecmp(c->context, p->context));
+			(global_notifycid == IGNORE_CONTEXT || !strcasecmp(c->context, p->context)));
 }
 
 /*! \brief Used in the SUBSCRIBE notification subsystem (RFC3265) */
@@ -14526,7 +14534,9 @@
 	ast_cli(a->fd, "  Outbound reg. attempts: %d\n", global_regattempts_max);
 	ast_cli(a->fd, "  Notify ringing state:   %s\n", cli_yesno(global_notifyringing));
 	if (global_notifyringing) {
-		ast_cli(a->fd, "    Include CID:          %s\n", cli_yesno(global_notifycid));
+		ast_cli(a->fd, "    Include CID:          %s%s\n",
+				cli_yesno(global_notifycid),
+				global_notifycid == IGNORE_CONTEXT ? " (Ignoring context)" : "");
 	}
 	ast_cli(a->fd, "  Notify hold state:      %s\n", cli_yesno(global_notifyhold));
 	ast_cli(a->fd, "  SIP Transfer mode:      %s\n", transfermode2str(global_allowtransfer));
@@ -22681,7 +22691,11 @@
 		} else if (!strcasecmp(v->name, "notifyhold")) {
 			global_notifyhold = ast_true(v->value);
 		} else if (!strcasecmp(v->name, "notifycid")) {
-			global_notifycid = ast_true(v->value);
+			if (!strcasecmp(v->value, "ignore-context")) {
+				global_notifycid = IGNORE_CONTEXT;
+			} else {
+				global_notifycid = ast_true(v->value);
+			}
 		} else if (!strcasecmp(v->name, "alwaysauthreject")) {
 			sip_cfg.alwaysauthreject = ast_true(v->value);
 		} else if (!strcasecmp(v->name, "mohinterpret")) {

Modified: trunk/configs/sip.conf.sample
URL: http://svn.digium.com/view/asterisk/trunk/configs/sip.conf.sample?view=diff&rev=158756&r1=158755&r2=158756
==============================================================================
--- trunk/configs/sip.conf.sample (original)
+++ trunk/configs/sip.conf.sample Sat Nov 22 21:36:52 2008
@@ -385,7 +385,9 @@
                                 ; user or peer (if subscribecontext is different than context).
                                 ; This is also limited to a single caller, meaning that if an
                                 ; extension is ringing because multiple calls are incoming,
-                                ; only one will be used as the source of caller ID.
+                                ; only one will be used as the source of caller ID.  Specify
+                                ; 'ignore-context' to ignore the called context when looking
+                                ; for the caller's channel.  The default value is 'no.'
 ;callcounter = yes              ; Enable call counters on devices. This can be set per
                                 ; device too.
 




More information about the asterisk-commits mailing list