[asterisk-commits] oej: trunk r89554 - in /trunk: ./ channels/ configs/
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Sun Nov 25 05:46:18 CST 2007
Author: oej
Date: Sun Nov 25 05:46:17 2007
New Revision: 89554
URL: http://svn.digium.com/view/asterisk?view=rev&rev=89554
Log:
- Deprecate "call-limit" in chan_sip. No other channel driver enforces call-limits
and we now have the groupcount system to implement call-limits in the dialplan. You
can use the "setvar" option in realtime/sip.conf to set limits per device.
- Implement "callcounter" as a new option to enable the call counting we need to
report device status to queue, manager and SIP subscriptions.
The call counter setting is now enabled in the code by setting the device call-limit
to 999. When we remove the call limit, we can simply enable this with a boolean
setting.
Modified:
trunk/CHANGES
trunk/channels/chan_sip.c
trunk/configs/sip.conf.sample
Modified: trunk/CHANGES
URL: http://svn.digium.com/view/asterisk/trunk/CHANGES?view=diff&rev=89554&r1=89553&r2=89554
==============================================================================
--- trunk/CHANGES (original)
+++ trunk/CHANGES Sun Nov 25 05:46:17 2007
@@ -89,8 +89,14 @@
* SIP now adds a header to the CANCEL if the call was answered by another phone
in the same dial command, or if the new c option in dial() is used.
* The new default is that 100 Trying is not sent on REGISTER attempts as the RFC specifically
- states it is not needed. For phones, however, that do require it the registertrying option
+ states it is not needed. For phones, however, that do require it the "registertrying" option
has been added so it can be enabled.
+ * The "call-limit" option is marked as deprecated. It still works in this version of
+ Asterisk, but will be removed in the following version. Please use the groupcount functions
+ in the dialplan to enforce call limits.
+ * A new option called "callcounter" (global/peer/user level) enables call counters needed
+ for better status reports needed for queues and SIP subscriptions. (Call-Limit was previously
+ used to enable this functionality).
IAX2 changes
------------
Modified: trunk/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/chan_sip.c?view=diff&rev=89554&r1=89553&r2=89554
==============================================================================
--- trunk/channels/chan_sip.c (original)
+++ trunk/channels/chan_sip.c Sun Nov 25 05:46:17 2007
@@ -515,6 +515,7 @@
#define DEFAULT_CALLERID "asterisk"
#define DEFAULT_NOTIFYMIME "application/simple-message-summary"
#define DEFAULT_ALLOWGUEST TRUE
+#define DEFAULT_CALLCOUNTER FALSE
#define DEFAULT_SRVLOOKUP TRUE /*!< Recommended setting is ON */
#define DEFAULT_COMPACTHEADERS FALSE
#define DEFAULT_TOS_SIP 0 /*!< Call signalling packets should be marked as DSCP CS3, but the default is 0 to be compatible with previous versions. */
@@ -584,6 +585,9 @@
static int global_reg_timeout;
static int global_regattempts_max; /*!< Registration attempts before giving up */
static int global_allowguest; /*!< allow unauthenticated users/peers to connect? */
+static int global_callcounter; /*!< Enable call counters for all devices. This is currently enabled by setting the peer
+ call-limit to 999. When we remove the call-limit from the code, we can make it
+ with just a boolean flag in the device structure */
static int global_allowsubscribe; /*!< Flag for disabling ALL subscriptions, this is FALSE only if all peers are FALSE
the global setting is in globals_flags[1] */
static unsigned int global_tos_sip; /*!< IP type of service for SIP packets */
@@ -11711,6 +11715,7 @@
ast_cli(a->fd, " MatchAuthUsername: %s\n", cli_yesno(global_match_auth_username));
ast_cli(a->fd, " Allow unknown access: %s\n", cli_yesno(global_allowguest));
ast_cli(a->fd, " Allow subscriptions: %s\n", cli_yesno(ast_test_flag(&global_flags[1], SIP_PAGE2_ALLOWSUBSCRIBE)));
+ ast_cli(a->fd, " Enable call counters: %s\n", cli_yesno(global_callcounter));
ast_cli(a->fd, " Allow overlap dialing: %s\n", cli_yesno(ast_test_flag(&global_flags[1], SIP_PAGE2_ALLOWOVERLAP)));
ast_cli(a->fd, " Promsic. redir: %s\n", cli_yesno(ast_test_flag(&global_flags[0], SIP_PROMISCREDIR)));
ast_cli(a->fd, " SIP domain support: %s\n", cli_yesno(!AST_LIST_EMPTY(&domain_list)));
@@ -17469,6 +17474,8 @@
user->allowtransfer = global_allowtransfer;
user->maxcallbitrate = default_maxcallbitrate;
user->autoframing = global_autoframing;
+ if (global_callcounter)
+ user->call_limit=999;
user->prefs = default_prefs;
/* set default context */
strcpy(user->context, default_context);
@@ -17516,6 +17523,8 @@
ast_copy_string(user->mohsuggest, v->value, sizeof(user->mohsuggest));
} else if (!strcasecmp(v->name, "accountcode")) {
ast_copy_string(user->accountcode, v->value, sizeof(user->accountcode));
+ } else if (!strcasecmp(v->name, "callcounter")) {
+ user->call_limit = ast_strue(v->value) ? 999 : 0;
} else if (!strcasecmp(v->name, "call-limit")) {
user->call_limit = atoi(v->value);
if (user->call_limit < 0)
@@ -17585,6 +17594,8 @@
peer->rtpkeepalive = global_rtpkeepalive;
peer->allowtransfer = global_allowtransfer;
peer->autoframing = global_autoframing;
+ if (global_callcounter)
+ peer->call_limit=999;
strcpy(peer->vmexten, default_vmexten);
peer->secret[0] = '\0';
peer->md5secret[0] = '\0';
@@ -17810,6 +17821,8 @@
ast_copy_string(peer->regexten, v->value, sizeof(peer->regexten));
} else if (!strcasecmp(v->name, "callbackextension")) {
ast_copy_string(callback, v->value, sizeof(callback));
+ } else if (!strcasecmp(v->name, "callcounter")) {
+ peer->call_limit = ast_strue(v->value) ? 999 : 0;
} else if (!strcasecmp(v->name, "call-limit")) {
peer->call_limit = atoi(v->value);
if (peer->call_limit < 0)
@@ -18057,6 +18070,7 @@
autocreatepeer = DEFAULT_AUTOCREATEPEER;
global_autoframing = 0;
global_allowguest = DEFAULT_ALLOWGUEST;
+ global_callcounter = DEFAULT_CALLCOUNTER;
global_match_auth_username = FALSE; /*!< Match auth username if available instead of From: Default off. */
global_rtptimeout = 0;
global_rtpholdtimeout = 0;
@@ -18112,6 +18126,8 @@
ast_copy_string(default_context, v->value, sizeof(default_context));
} else if (!strcasecmp(v->name, "subscribecontext")) {
ast_copy_string(default_subscribecontext, v->value, sizeof(default_subscribecontext));
+ } else if (!strcasecmp(v->name, "callcounter")) {
+ global_callcounter = ast_true(v->value) ? 1 : 0;
} else if (!strcasecmp(v->name, "allowguest")) {
global_allowguest = ast_true(v->value) ? 1 : 0;
} else if (!strcasecmp(v->name, "realm")) {
Modified: trunk/configs/sip.conf.sample
URL: http://svn.digium.com/view/asterisk/trunk/configs/sip.conf.sample?view=diff&rev=89554&r1=89553&r2=89554
==============================================================================
--- trunk/configs/sip.conf.sample (original)
+++ trunk/configs/sip.conf.sample Sun Nov 25 05:46:17 2007
@@ -22,6 +22,15 @@
; sip reload Reload configuration file
; Active SIP peers will not be reconfigured
;
+
+; ** Deprecated options **
+; The "call-limit" configuation option is deprecated. It still works in
+; this version of Asterisk, but will disappear in the next version.
+; You are encouraged to use the dialplan groupcount functionality
+; to enforce call limits instead of using this channel-specific method.
+;
+; You can still set limits per device in sip.conf or in a database by using
+; "setvar" to set variables that can be used in the dialplan for various limits.
[general]
context=default ; Default context for incoming calls
@@ -206,14 +215,11 @@
; (See extensions.conf.sample for examples)
; chan_sip support two major formats for notifications: dialog-info and SIMPLE
;
-; You will get more detailed reports (busy etc) if you have a call limit set
-; for a device. When the call limit is filled, we will indicate busy. Note that
-; you need at least 2 in order to be able to do attended transfers.
-;
-; If you set the busylevel in addition to the call limit, we will indicate busy
-; when we have a number of calls that matches busylevel, but still allow calls
-; up to the call-limit. This allows for transfers while still having blinking
-; lamps and queues understanding that a device is busy.
+; You will get more detailed reports (busy etc) if you have a call counter enabled
+; for a device.
+;
+; If you set the busylevel, we will indicate busy when we have a number of calls that
+; matches the busylevel treshold.
;
; For queues, you will need this level of detail in status reporting, regardless
; if you use SIP subscriptions. Queues and manager use the same internal interface
@@ -230,12 +236,14 @@
;notifyhold = yes ; Notify subscriptions on HOLD state (default: no)
; Turning on notifyringing and notifyhold will add a lot
; more database transactions if you are using realtime.
-;limitonpeer = yes ; Apply call limits on peers only. This will improve
+;limitonpeer = yes ; Apply call counting on peers only. This will improve
; status notification when you are using type=friend
; Inbound calls, that really apply to the user part
; of a friend will now be added to and compared with
- ; the peer limit instead of applying two call limits,
+ ; the peer counter instead of applying two call counters,
; one for the peer and one for the user.
+;callcounter = yes ; Enable call counters on devices. This can be set per
+ ; device too.
;----------------------------------------- T.38 FAX PASSTHROUGH SUPPORT -----------------------
;
@@ -561,7 +569,8 @@
; setvar setvar
; callerid callerid
; amaflags amaflags
-; call-limit call-limit
+; call-limit call-limit (deprecated)
+; callcounter callcounter
; allowoverlap allowoverlap
; allowsubscribe allowsubscribe
; allowtransfer allowtransfer
@@ -603,9 +612,7 @@
;fromdomain=provider.sip.domain
;host=box.provider.com
;usereqphone=yes ; This provider requires ";user=phone" on URI
-;call-limit=5 ; permit only 5 simultaneous outgoing calls to this peer
- ; Call-limits will not be enforced on real-time peers,
- ; since they are not stored in-memory
+;callcounter=yes ; Enable call counter
;busylevel=2 ; Signal busy at 2 or more calls
;outboundproxy=proxy.provider.domain ; send outbound signaling to this proxy, not directly to the peer
;port=80 ; The port number we want to connect to on the remote side
@@ -690,11 +697,10 @@
;canreinvite=yes ; allow RTP voice traffic to bypass Asterisk
;dtmfmode=info ; either RFC2833 or INFO for the BudgeTone
;call-limit=1 ; permit only 1 outgoing call and 1 incoming call at a time
- ; from the phone to asterisk
+ ; from the phone to asterisk (deprecated)
; 1 for the explicit peer, 1 for the explicit user,
; remember that a friend equals 1 peer and 1 user in
; memory
- ; This will affect your subscriptions as well.
; There is no combined call counter for a "friend"
; so there's currently no way in sip.conf to limit
; to one inbound or outbound call per phone. Use
More information about the asterisk-commits
mailing list