]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
fix stuck zchans on pri boost on call failure between proceeding and media being...
authorMichael Jerris <mike@jerris.com>
Thu, 21 Jan 2010 04:54:05 +0000 (04:54 +0000)
committerMichael Jerris <mike@jerris.com>
Thu, 21 Jan 2010 04:54:05 +0000 (04:54 +0000)
git-svn-id: http://svn.openzap.org/svn/openzap/trunk@993 a93c3328-9c30-0410-af19-c9cd2b2d52af

libs/openzap/src/ozmod/ozmod_sangoma_boost/ozmod_sangoma_boost.c

index 35f5e3876df04bd9db82eb3c7536ff61a0abfd8c..a863c68d6762b04b6f9f9f390de6c309eee172c9 100644 (file)
@@ -358,7 +358,6 @@ static ZIO_CHANNEL_REQUEST_FUNCTION(sangoma_boost_channel_request)
                        *zchan = NULL;
                        goto done;
                }
-               //printf("WTF %d\n", sanity);
        }
        
        if (OUTBOUND_REQUESTS[r].status == BST_ACK && OUTBOUND_REQUESTS[r].zchan) {
@@ -368,15 +367,14 @@ static ZIO_CHANNEL_REQUEST_FUNCTION(sangoma_boost_channel_request)
                zap_log(ZAP_LOG_DEBUG, "Channel state changed to PROGRESS [Csid:%d]\n", r);
        }
 
+       /* This is blocking the channel thread in openzap */
+       /* Once we know the channel we need to get out of here and move to a state */
        sanity = 60000;
        while(zap_running() && OUTBOUND_REQUESTS[r].status == BST_ACK) {
                zap_sleep(1);
                if (--sanity <= 0) {
-                       status = ZAP_FAIL;
-                       *zchan = NULL;
-                       goto done;
+                       break;
                }
-               //printf("WTF %d\n", sanity);
        }
 
        if (OUTBOUND_REQUESTS[r].status == BST_READY && OUTBOUND_REQUESTS[r].zchan) {
@@ -390,7 +388,22 @@ static ZIO_CHANNEL_REQUEST_FUNCTION(sangoma_boost_channel_request)
        }
 
  done:
-       
+
+       /* We failed to ever setup media, we need to let go of the channel */
+       /* All of this early media stuff should not be in this function at all */
+       /* Everything after we know the channel should be moved to a new state */
+       if (OUTBOUND_REQUESTS[r].zchan && OUTBOUND_REQUESTS[r].status != BST_READY && zap_test_flag((OUTBOUND_REQUESTS[r].zchan), ZAP_CHANNEL_INUSE)) {
+               status = ZAP_FAIL;
+               *zchan = NULL;
+               OUTBOUND_REQUESTS[event->call_setup_id].zchan = NULL;
+               if (zchan->extra_id) {                                                                                                                              
+                       zchan->extra_id = 0;                                                                                                                            
+               }
+               zchan->sflags = 0;                                                                                                                                  
+               zchan->call_data = NULL;                                                                                                                            
+               zap_channel_done(zchan);
+       } 
+
        st = OUTBOUND_REQUESTS[r].status;
        OUTBOUND_REQUESTS[r].status = BST_FREE;