Update of /usr/cvsroot/asterisk/channels
In directory mongoose.digium.com:/tmp/cvs-serv25653/channels

Modified Files:
        chan_iax2.c chan_zap.c 
Log Message:
issue #3360 plus related fix


Index: chan_iax2.c
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/chan_iax2.c,v
retrieving revision 1.371
retrieving revision 1.372
diff -u -d -r1.371 -r1.372
--- chan_iax2.c 6 Nov 2005 15:09:46 -0000       1.371
+++ chan_iax2.c 9 Nov 2005 00:48:38 -0000       1.372
@@ -2753,7 +2753,7 @@
        }
 
        /* if the peer is being monitored and is currently unreachable, return 
failure */
-       if (peer->maxms && (peer->lastms > peer->maxms)) {
+       if (peer->maxms && ((peer->lastms > peer->maxms) || (peer->lastms < 
0))) {
                if (ast_test_flag(peer, IAX_TEMPONLY))
                        destroy_peer(peer);
                return -1;

Index: chan_zap.c
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/chan_zap.c,v
retrieving revision 1.540
retrieving revision 1.541
diff -u -d -r1.540 -r1.541
--- chan_zap.c  8 Nov 2005 19:36:20 -0000       1.540
+++ chan_zap.c  9 Nov 2005 00:48:38 -0000       1.541
@@ -7236,16 +7236,22 @@
        return tmp;
 }
 
-static inline int available(struct zt_pvt *p, int channelmatch, int 
groupmatch, int *busy)
+static inline int available(struct zt_pvt *p, int channelmatch, int 
groupmatch, int *busy, int *channelmatched, int *groupmatched)
 {
        int res;
        ZT_PARAMS par;
        /* First, check group matching */
-       if ((p->group & groupmatch) != groupmatch)
-               return 0;
+       if (groupmatch) {
+               if ((p->group & groupmatch) != groupmatch)
+                       return 0;
+               *groupmatched = 1;
+       }
        /* Check to see if we have a channel match */
-       if ((channelmatch > 0) && (p->channel != channelmatch))
-               return 0;
+       if (channelmatch) {
+               if (p->channel != channelmatch)
+                       return 0;
+               *channelmatched = 1;
+       }
        /* We're at least busy at this point */
        if (busy) {
                if ((p->sig == SIG_FXOKS) || (p->sig == SIG_FXOLS) || (p->sig 
== SIG_FXOGS))
@@ -7428,6 +7434,8 @@
 #endif 
        struct zt_pvt *exit, *start, *end;
        ast_mutex_t *lock;
+       int channelmatched = 0;
+       int groupmatched = 0;
        
        /* Assume we're locking the iflock */
        lock = &iflock;
@@ -7528,7 +7536,8 @@
 #if 0
                ast_verbose("name = %s, %d, %d, %d\n",p->owner ? p->owner->name 
: "<none>", p->channel, channelmatch, groupmatch);
 #endif
-               if (p && available(p, channelmatch, groupmatch, &busy)) {
+
+               if (p && available(p, channelmatch, groupmatch, &busy, 
&channelmatched, &groupmatched)) {
                        if (option_debug)
                                ast_log(LOG_DEBUG, "Using channel %d\n", 
p->channel);
                                if (p->inalarm) 
@@ -7619,8 +7628,13 @@
        }
        ast_mutex_unlock(lock);
        restart_monitor();
-       if (callwait || (!tmp && busy))
-               *cause = AST_CAUSE_BUSY;
+       if (channelmatched) {
+               if (callwait || (!tmp && busy))
+                       *cause = AST_CAUSE_BUSY;
+       } else if (groupmatched) {
+               *cause = AST_CAUSE_CONGESTION;
+       }
+               
        return tmp;
 }
 

_______________________________________________
Asterisk-Cvs mailing list
Asterisk-Cvs@lists.digium.com
http://lists.digium.com/mailman/listinfo/asterisk-cvs

Reply via email to