[asterisk-commits] crichter: trunk r81368 - in /trunk: ./ channels/ channels/misdn/
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Thu Aug 30 03:50:45 CDT 2007
Author: crichter
Date: Thu Aug 30 03:50:44 2007
New Revision: 81368
URL: http://svn.digium.com/view/asterisk?view=rev&rev=81368
Log:
Merged revisions 81367 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4
........
r81367 | crichter | 2007-08-30 10:31:59 +0200 (Do, 30 Aug 2007) | 11 lines
Fixed a severe issue where a misdn_read would lock the channel, but read would
not return because it blocks. later chan_misdn would try to queue a frame like
a AST_CONTROL_ANSWER which could result in a deadlock situation. misdn_read
will now not block forever anymore, and we don't queue the ANSWER frame at all
when we already was called with misdn_answer -> answer would be called twice.
Also we don't explicitly send a RELEASE_COMPLETE on receiption of a RELEASE
anymore, because mISDN does that for us, this resulted in a problem on some
switches, which would block our port after some calls for a short while.
........
Modified:
trunk/ (props changed)
trunk/channels/chan_misdn.c
trunk/channels/misdn/isdn_lib.c
Propchange: trunk/
------------------------------------------------------------------------------
Binary property 'branch-1.4-merged' - no diff available.
Modified: trunk/channels/chan_misdn.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/chan_misdn.c?view=diff&rev=81368&r1=81367&r2=81368
==============================================================================
--- trunk/channels/chan_misdn.c (original)
+++ trunk/channels/chan_misdn.c Thu Aug 30 03:50:44 2007
@@ -2562,15 +2562,39 @@
return NULL;
}
- len = read(tmp->pipe[0], tmp->ast_rd_buf, sizeof(tmp->ast_rd_buf));
-
- if (len <= 0) {
- /* we hangup here, since our pipe is closed */
- chan_misdn_log(2, tmp->bc->port, "misdn_read: Pipe closed, hanging up\n");
+ fd_set rrfs;
+ struct timeval tv;
+ tv.tv_sec=0;
+ tv.tv_usec=20000;
+
+ FD_ZERO(&rrfs);
+ FD_SET(tmp->pipe[0],&rrfs);
+
+ int t=select(FD_SETSIZE,&rrfs,NULL, NULL,&tv);
+
+ if (!t) {
+ chan_misdn_log(3, tmp->bc->port, "read Select Timed out\n");
+ len=160;
+ }
+
+ if (t<0) {
+ chan_misdn_log(-1, tmp->bc->port, "Select Error (err=%s)\n",strerror(errno));
return NULL;
}
- tmp->frame.frametype = AST_FRAME_VOICE;
+ if (FD_ISSET(tmp->pipe[0],&rrfs)) {
+ len=read(tmp->pipe[0],tmp->ast_rd_buf,sizeof(tmp->ast_rd_buf));
+
+ if (len<=0) {
+ /* we hangup here, since our pipe is closed */
+ chan_misdn_log(2,tmp->bc->port,"misdn_read: Pipe closed, hanging up\n");
+ return NULL;
+ }
+
+ } else {
+ return NULL;
+ }
+
tmp->frame.subclass = AST_FORMAT_ALAW;
tmp->frame.datalen = len;
tmp->frame.samples = len;
@@ -4304,8 +4328,15 @@
}
}
}
-
- /* notice that we don't break here!*/
+ ch->l3id=bc->l3_id;
+ ch->addr=bc->addr;
+
+ start_bc_tones(ch);
+
+ ch->state = MISDN_CONNECTED;
+
+ ast_queue_control(ch->ast, AST_CONTROL_ANSWER);
+ break;
case EVENT_CONNECT_ACKNOWLEDGE:
{
ch->l3id = bc->l3_id;
@@ -4314,11 +4345,6 @@
start_bc_tones(ch);
ch->state = MISDN_CONNECTED;
-
- if (!ch->ast)
- break;
-
- ast_queue_control(ch->ast, AST_CONTROL_ANSWER);
}
break;
case EVENT_DISCONNECT:
@@ -4377,9 +4403,6 @@
hangup_chan(ch);
release_chan(bc);
-
- if (bc->need_release_complete)
- misdn_lib_send_event(bc, EVENT_RELEASE_COMPLETE);
}
break;
case EVENT_RELEASE_COMPLETE:
Modified: trunk/channels/misdn/isdn_lib.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/misdn/isdn_lib.c?view=diff&rev=81368&r1=81367&r2=81368
==============================================================================
--- trunk/channels/misdn/isdn_lib.c (original)
+++ trunk/channels/misdn/isdn_lib.c Thu Aug 30 03:50:44 2007
@@ -1557,9 +1557,6 @@
case EVENT_PROGRESS:
case EVENT_PROCEEDING:
case EVENT_SETUP_ACKNOWLEDGE:
-
- setup_bc(bc);
-
case EVENT_SETUP:
{
if (bc->channel == 0xff || bc->channel<=0)
@@ -1571,6 +1568,8 @@
return -1;
}
}
+
+ setup_bc(bc);
break;
case EVENT_RELEASE_COMPLETE:
More information about the asterisk-commits
mailing list