diff options
author | Olle Johansson <oej@edvina.net> | 2006-11-04 19:13:30 +0000 |
---|---|---|
committer | Olle Johansson <oej@edvina.net> | 2006-11-04 19:13:30 +0000 |
commit | d900b47ccf388849546d53e52fc7e7d3387725a8 (patch) | |
tree | 437f3949bad7b37242117ebe906030a93cf0779a /channels | |
parent | 338c18486c8c63e5a9046f146f82448defd0c81b (diff) |
Adding new config option "limitpeersonly" to only apply call limits
to the peer side of a type=friend.
This is for trying to support BJ in his quest to solve some issues
with the queue system and type=friend objects.
BJ: Please test!
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@47201 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'channels')
-rw-r--r-- | channels/chan_sip.c | 28 |
1 files changed, 23 insertions, 5 deletions
diff --git a/channels/chan_sip.c b/channels/chan_sip.c index d3a6af043..edbc346b1 100644 --- a/channels/chan_sip.c +++ b/channels/chan_sip.c @@ -512,6 +512,7 @@ static int default_maxcallbitrate; /*!< Maximum bitrate for call */ static struct ast_codec_pref default_prefs; /*!< Default codec prefs */ /* Global settings only apply to the channel */ +static int global_limitonpeers; /*!< Match call limit on peers only */ static int global_rtautoclear; static int global_notifyringing; /*!< Send notifications on ringing */ static int global_alwaysauthreject; /*!< Send 401 Unauthorized for all failing requests */ @@ -3042,16 +3043,29 @@ static int update_call_counter(struct sip_pvt *fup, int event) ast_copy_string(name, fup->username, sizeof(name)); /* Check the list of users only for incoming calls */ - if (!outgoing && (u = find_user(name, 1)) ) { - inuse = &u->inUse; - call_limit = &u->call_limit; - inringing = NULL; + if (!outgoing) { + if (global_limitonpeers == FALSE && (u = find_user(name, 1))) { + inuse = &u->inUse; + call_limit = &u->call_limit; + inringing = NULL; + } else { + /* If limitonpeers is on, we only apply the limits to the + peer part of the type=friend. This is mainly to + help the queue system */ + p = find_peer(name, NULL, 1); /* Check the peer */ + if (p != NULL) { + inuse = &p->inUse; + call_limit = &p->call_limit; + inringing = &p->inRinging; + } + } } else if ( (p = find_peer(fup->peername, NULL, 1) ) ) { /* Try to find peer */ inuse = &p->inUse; call_limit = &p->call_limit; inringing = &p->inRinging; ast_copy_string(name, fup->peername, sizeof(name)); - } else { + } + if (!p && !u) { if (option_debug > 1) ast_log(LOG_DEBUG, "%s is not a local device, no call limit\n", name); return 0; @@ -10271,6 +10285,7 @@ static int sip_show_settings(int fd, int argc, char *argv[]) ast_cli(fd, " Our auth realm %s\n", global_realm); ast_cli(fd, " Realm. auth: %s\n", authl ? "Yes": "No"); ast_cli(fd, " Always auth rejects: %s\n", global_alwaysauthreject ? "Yes" : "No"); + ast_cli(fd, " Call limit peers only: %s\n", global_limitonpeers ? "Yes" : "No"); ast_cli(fd, " User Agent: %s\n", global_useragent); ast_cli(fd, " MWI checking interval: %d secs\n", global_mwitime); ast_cli(fd, " Reg. context: %s\n", S_OR(global_regcontext, "(not set)")); @@ -15966,6 +15981,7 @@ static int reload_config(enum channelreloadreason reason) global_regcontext[0] = '\0'; expiry = DEFAULT_EXPIRY; global_notifyringing = DEFAULT_NOTIFYRINGING; + global_limitonpeers = FALSE; /*!< Match call limit on peers only */ global_alwaysauthreject = 0; global_allowsubscribe = FALSE; ast_copy_string(global_useragent, DEFAULT_USERAGENT, sizeof(global_useragent)); @@ -16090,6 +16106,8 @@ static int reload_config(enum channelreloadreason reason) ast_copy_string(default_notifymime, v->value, sizeof(default_notifymime)); } else if (!strcasecmp(v->name, "notifyringing")) { global_notifyringing = ast_true(v->value); + } else if (!strcasecmp(v->name, "limitpeersonly")) { + global_limitonpeers = ast_true(v->value); } else if (!strcasecmp(v->name, "alwaysauthreject")) { global_alwaysauthreject = ast_true(v->value); } else if (!strcasecmp(v->name, "mohinterpret") |