From 7bd3ce358bba82e75b6e665fb363559d617d6a80 Mon Sep 17 00:00:00 2001 From: Sean Bright Date: Sun, 23 Nov 2008 03:36:52 +0000 Subject: 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. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@158756 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- channels/chan_sip.c | 24 +++++++++++++++++++----- configs/sip.conf.sample | 4 +++- 2 files changed, 22 insertions(+), 6 deletions(-) diff --git a/channels/chan_sip.c b/channels/chan_sip.c index 53a6c9e64..095a0630a 100644 --- a/channels/chan_sip.c +++ b/channels/chan_sip.c @@ -775,6 +775,13 @@ enum sipmethod { 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 @@ static const struct cfsip_options { #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,9 +1029,10 @@ static struct sip_settings sip_cfg; 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 */ static int global_rtpholdtimeout; /*!< Time out call if no RTP during hold */ @@ -9920,7 +9928,7 @@ static int find_calling_channel(struct ast_channel *c, void *data) { 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 @@ static char *sip_show_settings(struct ast_cli_entry *e, int cmd, struct ast_cli_ 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 @@ static int reload_config(enum channelreloadreason reason) } 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")) { diff --git a/configs/sip.conf.sample b/configs/sip.conf.sample index 6feb1ea57..8cc8366f4 100644 --- a/configs/sip.conf.sample +++ b/configs/sip.conf.sample @@ -385,7 +385,9 @@ srvlookup=yes ; Enable DNS SRV lookups on outbound calls ; 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. -- cgit v1.2.3