Summary:ASTERISK-12737: unable to place outgoing call on TE Port
Reporter:andre valentin (avalentin)Labels:
Date Opened:2008-09-16 09:55:58Date Closed:2009-01-14 13:20:33.000-0600
Versions:Frequency of
Environment:Attachments:( 0) isdn_lib_145555.patch
( 1) isdn_lib_fix_proposal.c
( 2) misdn_trace
( 3) misdn.conf
( 4) misdn.log
Description:Beginning with SVN Revision 132967 asterisk is unable to place outgoing calls on TE ports. In SVN Revision 132966 everything works fine.
It seems that this change is responsible for that (132966:132967):

@@ -3121,8 +3134,8 @@
       struct timeval now;
       gettimeofday(&now, NULL);
       if (!bc->in_use) {
-               if (bc->last_used.tv_sec < now.tv_sec) {
-                       cb_log(0,bc->port, "channel with stid:%x for one second still in use!\n", bc->b_stid);
+               if (misdn_lib_port_is_pri(bc->port) && 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_u
                       return 1;

Console output with debugging enabled:
   -- Attempting call on MISDN/1/012341212 for application Echo() (Retry 1)
P[ 1] There is no free channel on port (1)
[Sep 16 17:02:12] WARNING[28356]: chan_misdn.c:3333 misdn_request: Could not create channel on port:1 with extensions:012341212
[Sep 16 17:02:12] NOTICE[28356]: channel.c:3309 __ast_request_and_dial: Unable to request channel MISDN/1/012341212
[Sep 16 17:02:12] NOTICE[28356]: pbx_spool.c:346 attempt_thread: Call failed to go through, reason (0) Call Failure (not BUSY, and not NO_ANSWER, maybe Circuit busy or down?)

By removing the patch above everything seems to work as expected.
We tried 4 Port Cards, Fritzcards and USB TAs. Everytime the same error.
Comments:By: crich (crich) 2008-09-17 02:40:17

can you please attach your misdn.conf and a chan_misdn trace with debuglevel 5.


By: andre valentin (avalentin) 2008-09-17 08:57:17

That's all output I get from chan_misdn. Hope it helps.

By: Dirk Nehring (dnehring) 2008-09-21 17:42:15

Any updates here? A fix should be included in 1.6.0.

By: Bernhard Wolf (wolfelectronic) 2008-10-04 18:28:50

i made some changes to isdn_lib.c to fix the problem:
1) test_inuse is called 3 times in the code, line 3191, 3206 and 3218. the interresting thing is that line 3191 expects test_inuse to return 1 if the channel is in use and line 3206 and 3218 expect test_inuse to return 1 if the channel is free. so i changed line 3191 to fix this mismatch.
2) test_inuse returns 0 if the channel is in use and the only time it returns 1 is if the port is a pri port and the channel wasn't free for more than 1 second. As far as i understand the code this behaviour is not correct. I changed test_inuse to
a) return 0 if the channel is in use, regardless of the type
b) return 0 if the channel is a pri and wasn't free for at least 1 second
c) return 1 if the channel is a pri and was free for more than 1 second
d) return 1 if the channel is a bri and free

this changes worked fine for my system, but i have only bri cards in it, so i could not test with pri cards. i have uploaded my file and i hope somebody can benefit from my changes

By: Bernhard Wolf (wolfelectronic) 2008-10-07 05:16:25

after solving some problems in my dev enviroment i got isdn_lib.c revision 145220 from svn asterisk/trunk/channels/misdn and found that this revision solves (at least) this problem.
So all what is needed to be done is merching this revision in to the next 1.6x version.

By: andre valentin (avalentin) 2008-10-08 07:30:22

I can confirm that the solution by wolfelectronic is working. I applied it here instead of my upper solution.

By: Niels Basjes (basjes) 2009-01-06 17:07:57.000-0600

Because of similar problems I applied the isdn_lib_145555.patch to asterisk-
I now have a working setup on CentOS 5.2 64bit.
Thanks wolfelectronic!

By: Digium Subversion (svnbot) 2009-01-14 13:20:30.000-0600

Repository: asterisk
Revision: 168607

U   branches/1.6.0/channels/misdn/isdn_lib.c

r168607 | rmudgett | 2009-01-14 13:20:29 -0600 (Wed, 14 Jan 2009) | 9 lines

Fix merge error caused by merging -r132883 and -r121770 from
https://origsvn.digium.com/svn/asterisk/trunk out of order.

(closes issue ASTERISK-12970)
Reported by: IgorG

(closes issue ASTERISK-12737)
Reported by: avalentin