]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
update
authorAnthony Minessale <anthony.minessale@gmail.com>
Fri, 18 May 2007 18:28:32 +0000 (18:28 +0000)
committerAnthony Minessale <anthony.minessale@gmail.com>
Fri, 18 May 2007 18:28:32 +0000 (18:28 +0000)
git-svn-id: http://svn.openzap.org/svn/openzap/trunk@34 a93c3328-9c30-0410-af19-c9cd2b2d52af

libs/openzap/src/openzap.c
libs/openzap/src/testapp.c

index c82f6f7608e81d92c08e998a8b9da32088df41c4..a33bcdbc982ea02453843d3101fd60bbb2ec063e 100644 (file)
@@ -212,15 +212,17 @@ zap_status_t zap_channel_open_any(const char *name, unsigned span_id, zap_direct
                j = span_max;
        }
 
+       
+
        for(;;) {
                span = &zint->spans[j];
-               
+
                if (!zap_test_flag(span, ZAP_SPAN_CONFIGURED)) {
                        goto next_loop;
                }
 
                if (direction == ZAP_TOP_DOWN) {
-                       if (j == span_max) {
+                       if (j > span_max) {
                                break;
                        }
                } else {
@@ -228,7 +230,7 @@ zap_status_t zap_channel_open_any(const char *name, unsigned span_id, zap_direct
                                break;
                        }
                }
-
+               
                if (direction == ZAP_TOP_DOWN) {
                        i = 1;
                } else {
@@ -238,7 +240,7 @@ zap_status_t zap_channel_open_any(const char *name, unsigned span_id, zap_direct
                for(;;) {
                
                        if (direction == ZAP_TOP_DOWN) {
-                               if (i == span->chan_count) {
+                               if (i > span->chan_count) {
                                        break;
                                }
                        } else {
@@ -246,7 +248,7 @@ zap_status_t zap_channel_open_any(const char *name, unsigned span_id, zap_direct
                                        break;
                                }
                        }
-
+                       
                        check = &span->channels[i];
 
                        if (zap_test_flag(check, ZAP_CHANNEL_READY) && !zap_test_flag(check, ZAP_CHANNEL_OPEN)) {
index dbd7d989eea5954c5f73c4866d26a53f19f5ce9d..ab429f0f7983fd51497d33b8c609f1e4a5f1983b 100644 (file)
@@ -15,8 +15,9 @@ int main(int argc, char *argv[])
        printf("OpenZAP loaded\n");
 
        
-       if (zap_channel_open("wanpipe", 1, 1, &chan) == ZAP_SUCCESS) {
+       if (zap_channel_open_any("wanpipe", 0, ZAP_TOP_DOWN, &chan) == ZAP_SUCCESS) {
                int x = 0;
+               printf("opened channel %d:%d\n", chan->span_id, chan->chan_id);
 
                if (zap_channel_command(chan, ZAP_COMMAND_SET_INTERVAL, &ms) == ZAP_SUCCESS) {
                        ms = 0;
@@ -53,6 +54,8 @@ int main(int argc, char *argv[])
                                printf("wait fail [%s]\n", chan->last_error);
                        }
                }
+       } else {
+               printf("open fail [%s]\n", chan->last_error);
        }
 
        zap_global_destroy();