[asterisk-commits] oej: trunk r53082 - in /trunk: channels/chan_sip.c configs/sip.conf.sample

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Thu Feb 1 13:43:49 MST 2007


Author: oej
Date: Thu Feb  1 14:43:49 2007
New Revision: 53082

URL: http://svn.digium.com/view/asterisk?view=rev&rev=53082
Log:
Implementing "busy-limit".

If you set call limit and busy limit, chan_sip will indicate BUSY for a device
that has reached the busy limit and allow calls up to the call limit, allowing
for call transfers (that generate a new call).

If you only set call limit, chan_sip will not indicate BUSY until that limit
is filled. 

This affects SIP subscriptions, call queues and manager applications.

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=53082&r1=53081&r2=53082
==============================================================================
--- trunk/channels/chan_sip.c (original)
+++ trunk/channels/chan_sip.c Thu Feb  1 14:43:49 2007
@@ -1095,6 +1095,7 @@
 	int inRinging;			/*!< Number of calls ringing */
 	int onHold;                     /*!< Peer has someone on hold */
 	int call_limit;			/*!< Limit of concurrent calls */
+	int busy_limit;			/*!< Limit where we signal busy */
 	enum transfermodes allowtransfer;	/*! SIP Refer restriction scheme */
 	char vmexten[AST_MAX_EXTENSION]; /*!< Dialplan extension for MWI notify message*/
 	char mailbox[AST_MAX_EXTENSION]; /*!< Mailbox setting for MWI checks */
@@ -10207,6 +10208,8 @@
 		ast_cli(fd, "  VM Extension : %s\n", peer->vmexten);
 		ast_cli(fd, "  LastMsgsSent : %d/%d\n", (peer->lastmsgssent & 0x7fff0000) >> 16, peer->lastmsgssent & 0xffff);
 		ast_cli(fd, "  Call limit   : %d\n", peer->call_limit);
+		if (peer->busy_limit)
+			ast_cli(fd, "  Busy limit   : %d\n", peer->busy_limit);
 		ast_cli(fd, "  Dynamic      : %s\n", (ast_test_flag(&peer->flags[1], SIP_PAGE2_DYNAMIC)?"Yes":"No"));
 		ast_cli(fd, "  Callerid     : %s\n", ast_callerid_merge(cbuf, sizeof(cbuf), peer->cid_name, peer->cid_num, "<unspecified>"));
 		ast_cli(fd, "  MaxCallBR    : %d kbps\n", peer->maxcallbitrate);
@@ -10294,7 +10297,8 @@
 		astman_append(s, "VoiceMailbox: %s\r\n", peer->mailbox);
 		astman_append(s, "TransferMode: %s\r\n", transfermode2str(peer->allowtransfer));
 		astman_append(s, "LastMsgsSent: %d\r\n", peer->lastmsgssent);
-		astman_append(s, "Call limit: %d\r\n", peer->call_limit);
+		astman_append(s, "Call-limit: %d\r\n", peer->call_limit);
+		astman_append(s, "Busy-limit: %d\r\n", peer->busy_limit);
 		astman_append(s, "MaxCallBR: %d kbps\r\n", peer->maxcallbitrate);
 		astman_append(s, "Dynamic: %s\r\n", (ast_test_flag(&peer->flags[1], SIP_PAGE2_DYNAMIC)?"Y":"N"));
 		astman_append(s, "Callerid: %s\r\n", ast_callerid_merge(cbuf, sizeof(cbuf), peer->cid_name, peer->cid_num, ""));
@@ -15404,6 +15408,9 @@
 					res = AST_DEVICE_RINGINUSE;
 			} else if (p->call_limit && (p->inUse == p->call_limit))
 				/* check call limit */
+				res = AST_DEVICE_BUSY;
+			else if (p->call_limit && p->busy_limit && p->inUse >= p->busy_limit)
+				/* We're forcing busy before we've reached the call limit */
 				res = AST_DEVICE_BUSY;
 			else if (p->call_limit && p->inUse)
 				/* Not busy, but we do have a call */

Modified: trunk/configs/sip.conf.sample
URL: http://svn.digium.com/view/asterisk/trunk/configs/sip.conf.sample?view=diff&rev=53082&r1=53081&r2=53082
==============================================================================
--- trunk/configs/sip.conf.sample (original)
+++ trunk/configs/sip.conf.sample Thu Feb  1 14:43:49 2007
@@ -195,6 +195,11 @@
 ; 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 busy-limit in addition to the call limit, we will indicate busy
+; when we have a number of calls that matches busy-limit, 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.
+;
 ; 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
 ; for reading status information.
@@ -491,6 +496,7 @@
 ; videosupport		      videosupport
 ; maxcallbitrate	      maxcallbitrate
 ; rfc2833compensate           mailbox
+;			      busy-limit
 ;                             username
 ;                             template
 ;                             fromdomain
@@ -524,6 +530,7 @@
 ;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
+;busy-limit=2				; Signal busy at 2 or more calls
 ;outboundproxy=proxy.provider.domain	; send outbound signaling to this proxy, not directly to the peer
 					; Call-limits will not be enforced on real-time peers,
 					; since they are not stored in-memory



More information about the asterisk-commits mailing list