aboutsummaryrefslogtreecommitdiffstats
path: root/channels/misdn
diff options
context:
space:
mode:
authortilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b>2008-12-02 21:46:38 +0000
committertilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b>2008-12-02 21:46:38 +0000
commitd82e6c48cfaab526148775f91c083dc66a14c717 (patch)
tree1c8b2f5990db9df55f7ad5e676a54f7d89f2c43c /channels/misdn
parent46bcf33151d27f721fa6ce8f9b5b3ccc549aca75 (diff)
Merged revisions 115313,121770,123272,139624,140205,144257 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk ................ r115313 | tilghman | 2008-05-05 15:22:08 -0500 (Mon, 05 May 2008) | 10 lines Merged revisions 115312 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r115312 | tilghman | 2008-05-05 15:17:55 -0500 (Mon, 05 May 2008) | 2 lines Reverse order, such that user configs override default selections ........ ................ r121770 | crichter | 2008-06-11 06:52:18 -0500 (Wed, 11 Jun 2008) | 9 lines Merged revisions 121751 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r121751 | crichter | 2008-06-11 11:28:04 +0200 (Mi, 11 Jun 2008) | 1 line fixed issue with previous commit, the find_free_channel test for channels which where inuse was broken. ........ ................ r123272 | russell | 2008-06-17 10:52:13 -0500 (Tue, 17 Jun 2008) | 12 lines Merged revisions 123271 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r123271 | russell | 2008-06-17 10:48:31 -0500 (Tue, 17 Jun 2008) | 4 lines Fix a memory leak in astobj2 that was pointed out by seanbright. When a container got destroyed, the underlying bucket list entry for each object that was in the container at that time did not get free'd. ........ ................ r139624 | jpeeler | 2008-08-22 16:57:32 -0500 (Fri, 22 Aug 2008) | 13 lines Merged revisions 139621 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r139621 | jpeeler | 2008-08-22 16:36:13 -0500 (Fri, 22 Aug 2008) | 5 lines (closes issue #13359) Reported by: Laureano Patches: originate_channel_check.patch uploaded by Laureano (license 265) ........ ................ r140205 | jpeeler | 2008-08-26 13:48:55 -0500 (Tue, 26 Aug 2008) | 17 lines Merged revisions 140056 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r140056 | jpeeler | 2008-08-26 10:57:02 -0500 (Tue, 26 Aug 2008) | 9 lines (closes issue #12071) Reported by: tzafrir Patches: dahdi_close.diff uploaded by tzafrir (license 46) Tested by: tzafrir, jpeeler This patch fixes closing open file descriptors in the case of an error. ........ ................ r144257 | crichter | 2008-09-24 03:42:55 -0500 (Wed, 24 Sep 2008) | 9 lines Merged revisions 144238 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r144238 | crichter | 2008-09-24 10:20:52 +0200 (Mi, 24 Sep 2008) | 1 line improved helptext of misdn_set_opt. ........ ................ git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.6.0@160386 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channels/misdn')
-rw-r--r--channels/misdn/isdn_lib.c26
1 files changed, 19 insertions, 7 deletions
diff --git a/channels/misdn/isdn_lib.c b/channels/misdn/isdn_lib.c
index 81ea7fb7b..3f634183d 100644
--- a/channels/misdn/isdn_lib.c
+++ b/channels/misdn/isdn_lib.c
@@ -3134,12 +3134,18 @@ static int test_inuse(struct misdn_bchannel *bc)
struct timeval now;
gettimeofday(&now, NULL);
if (!bc->in_use) {
- if (misdn_lib_port_is_pri(bc->port) && bc->last_used.tv_sec == now.tv_sec ) {
+ if ( bc->last_used.tv_sec == now.tv_sec ) {
cb_log(2,bc->port, "channel with stid:%x for one second still in use! (n:%d lu:%d)\n", bc->b_stid, (int) now.tv_sec, (int) bc->last_used.tv_sec);
return 1;
}
+
+
+ cb_log(3,bc->port, "channel with stid:%x not in use!\n", bc->b_stid);
+ return 0;
}
- return 0;
+
+ cb_log(2,bc->port, "channel with stid:%x in use!\n", bc->b_stid);
+ return 1;
}
@@ -3188,9 +3194,15 @@ struct misdn_bchannel* misdn_lib_get_free_bc(int port, int channel, int inout, i
if (channel > 0) {
if (channel <= stack->b_num) {
for (i = 0; i < stack->b_num; i++) {
- if ( test_inuse(&stack->bc[i]) && stack->bc[i].channel == channel) {
- cb_log(0,port,"Requested channel:%d on port:%d is already in use\n",channel, port);
- return NULL;
+ if ( stack->bc[i].channel == channel) {
+ if (test_inuse(&stack->bc[i])) {
+ cb_log(0,port,"Requested channel:%d on port:%d is already in use\n",channel, port);
+ return NULL;
+
+ } else {
+ prepare_bc(&stack->bc[i], channel);
+ return &stack->bc[i];
+ }
}
}
} else {
@@ -3203,7 +3215,7 @@ struct misdn_bchannel* misdn_lib_get_free_bc(int port, int channel, int inout, i
if (dec) {
for (i = maxnum-1; i>=0; i--) {
- if (test_inuse(&stack->bc[i])) {
+ if (!test_inuse(&stack->bc[i])) {
/* 3. channel on bri means CW*/
if (!stack->pri && i==stack->b_num)
stack->bc[i].cw=1;
@@ -3215,7 +3227,7 @@ struct misdn_bchannel* misdn_lib_get_free_bc(int port, int channel, int inout, i
}
} else {
for (i = 0; i <maxnum; i++) {
- if (test_inuse(&stack->bc[i])) {
+ if (!test_inuse(&stack->bc[i])) {
/* 3. channel on bri means CW*/
if (!stack->pri && i==stack->b_num)
stack->bc[i].cw=1;