[Asterisk-Users] Call Waiting on SIP phones

Paul Liew pliew at atp.org.au
Mon Oct 20 16:21:47 MST 2003


Hi All,

This is the first time I'm submitting a patch, and I hope it fixes more than
it breaks. I'm putting it  here, since John Todd mentioned a while ago about
the heavy load Mark and crew have at Digium (doing such good work), so I
thought all of us could test this first, and if ok submit for inclusion in
CVS later if appropriate.

This is an extension to work done earlier (sorry I can't remember your name)
with regard to "incominglimit" and "outgoinglimit" to prevent that horrible
call waiting in your ear for Grand Stream phones. It worked only if you
received a call and only once.

I've tested this on my system between GS and X-ten, using normal extension
and queue calling, and it seems to work ok for me. No call waiting at all,
whether I originate or receive calls. You only need to set "incominglimit=1"
for each sip phone that you wish to block call waiting.

Anway, enough blurb, please test and let me know how you go .....

Paul

--- chan_sip.c.save     2003-10-20 21:51:52.000000000 +1000
+++ chan_sip.c  2003-10-21 09:02:33.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,7 @@
                        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 +998,7 @@
                        }
                        u->outUse++;
                        break;
+                       */
                default:
                        ast_log(LOG_ERROR, "find_user(%s,%d) called with no
even
t!\n",u->name,event);
        }
@@ -1086,6 +1091,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 +4719,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)




More information about the asterisk-users mailing list