[Asterisk-Users] Call Waiting on SIP phones

Paul Liew pliew at atp.org.au
Mon Oct 20 16:32:44 MST 2003


Sorry, to repost - but I left a "/*" comment - here it is again

Paul

--- chan_sip.c.save     2003-10-20 21:51:52.000000000 +1000
+++ chan_sip.c  2003-10-21 09:26:41.000000000 +1000
@@ -959,7 +959,9 @@
                return 0;
        }
        switch(event) {
+               /* Incoming and outging affects the inUse counter */
                case DEC_IN_USE:
+               case DEC_OUT_USE:
                        if ( u->inUse > 0 ) {
                                u->inUse--;
                        } else {
@@ -967,6 +969,7 @@
                        }
                        break;
                case INC_IN_USE:
+               case INC_OUT_USE:
                        if (u->incominglimit > 0 ) {
                                if (u->inUse >= u->incominglimit) {
                                        ast_log(LOG_ERROR, "Call from user '%s'
rejected due to usage limit of %d\n", u->name, u->incominglimit);
@@ -977,6 +980,8 @@
                        u->inUse++;
                        ast_log(LOG_DEBUG, "Call from user '%s' is %d out of %d\
n", u->name, u->inUse, u->incominglimit);
                        break;
+               /* Commented out - don't want to limit outgoing */
+               /*
                case DEC_OUT_USE:
                        if ( u->outUse > 0 ) {
                                u->outUse--;
@@ -994,6 +999,7 @@
                        }
                        u->outUse++;
                        break;
+                       */
                default:
                        ast_log(LOG_ERROR, "find_user(%s,%d) called with no even
t!\n",u->name,event);
        }
@@ -1086,6 +1092,12 @@
                                   INVITE, but do set an autodestruct just in ca
se. */
                                needdestroy = 0;
                                sip_scheddestroy(p, 15000);
+                               /* channel still up - reverse dec of inuse count
er */
+                               if ( p->outgoing ) {
+                                       find_user(p, INC_OUT_USE);
+                               } else {
+                                       find_user(p, INC_IN_USE);
+                               }
                        } else {
                                char *res;
                                if (ast->hangupcause && ((res = hangup_cause2sip
(ast->hangupcause)))) {
@@ -4708,6 +4720,14 @@
                                        if (p->owner)
                                                ast_queue_control(p->owner, AST_
CONTROL_BUSY, 0);
                                        break;
+                               case 487:
+                                       /* channel now destroyed - dec the inuse
 counter */
+                                       if ( p->outgoing ) {
+                                               find_user(p, DEC_OUT_USE);
+                                       } else {
+                                               find_user(p, DEC_IN_USE);
+                                       }
+                                       break;
                                case 486: /* Busy here */
                                case 600: /* Busy everywhere */
                                        if (p->owner)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.digium.com/pipermail/asterisk-users/attachments/20031020/86db140e/attachment.htm


More information about the asterisk-users mailing list