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
This commit is contained in:
parent
338c18486c
commit
d900b47ccf
|
@ -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")
|
||||
|
|
|
@ -125,6 +125,12 @@ srvlookup=yes ; Enable DNS SRV lookups on outbound calls
|
|||
; for peers and users as well
|
||||
;callevents=no ; generate manager events when sip ua
|
||||
; performs events (e.g. hold)
|
||||
;limitpeersonly=no ; Apply all call limits ("limit=") only to peers, never
|
||||
; to users. This improves handling of call limits
|
||||
; and device states in certain situations. The user part
|
||||
; of a type=friend will still be affected by the call
|
||||
; limit, but Asterisk will only use one object for
|
||||
; counting the simultaneous calls.
|
||||
;alwaysauthreject = yes ; When an incoming INVITE or REGISTER is to be rejected,
|
||||
; for any reason, always reject with '401 Unauthorized'
|
||||
; instead of letting the requester know whether there was
|
||||
|
|
Loading…
Reference in New Issue