Update of /usr/cvsroot/asterisk/channels
In directory mongoose.digium.com:/tmp/cvs-serv13843/channels

Modified Files:
        chan_misdn.c 
Log Message:
issue #5639


Index: chan_misdn.c
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/chan_misdn.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- chan_misdn.c        6 Nov 2005 15:09:46 -0000       1.3
+++ chan_misdn.c        8 Nov 2005 00:02:53 -0000       1.4
@@ -98,8 +98,6 @@
   
        ast_mutex_t lock;
 
-       pthread_t *audio_thread;
-  
        enum misdn_chan_state state;
        int holded; 
        int orginator;
@@ -225,7 +223,6 @@
 void cl_queue_chan(struct chan_list **list, struct chan_list *chan);
 void cl_dequeue_chan(struct chan_list **list, struct chan_list *chan);
 struct chan_list *find_chan_by_bc(struct chan_list *list, struct 
misdn_bchannel *bc);
-void * audio_thread( void * data);
 void chan_misdn_log(int level, int port, char *tmpl, ...);
 void chan_misdn_trace_call(struct ast_channel *chan, int debug, char *tmpl, 
...);
 
@@ -1632,7 +1629,7 @@
        
        
        len = misdn_ibuf_usedcount(tmp->bc->astbuf);
-       
+
        /*shrinken len if necessary, we transmit at maximum 4k*/
        len = len<=sizeof(tmp->ast_rd_buf)?len:sizeof(tmp->ast_rd_buf);
        
@@ -1754,6 +1751,11 @@
        while(1) {
                to=-1;
                who = ast_waitfor_n(carr, 2, &to);
+
+               if (!who) {
+                       ast_log(LOG_DEBUG,"misdn_bridge: empty read\n");
+                       continue;
+               }
                f = ast_read(who);
     
                if (!f || f->frametype == AST_FRAME_CONTROL) {
@@ -1960,8 +1962,8 @@
        }
        
        if (!newbc) {
-               chan_misdn_log(1, port, " --> ! No free channel chan ext:%s 
even after Group Call\n",ext);
-               chan_misdn_log(1, port, " --> SEND: State Down\n");
+               chan_misdn_log(1, 0, " --> ! No free channel chan ext:%s even 
after Group Call\n",ext);
+               chan_misdn_log(1, 0, " --> SEND: State Down\n");
                return NULL;
        }
        
@@ -2650,21 +2652,19 @@
                        
                        int digits;
                        misdn_cfg_get( 0, MISDN_GEN_APPEND_DIGITS2EXTEN, 
&digits, sizeof(int));
-                       if (ch->state != MISDN_CONNECTED && digits) {
-                               {
+                       if (ch->state != MISDN_CONNECTED ) {
+                               if (digits) {
                                        int l = sizeof(bc->dad);
                                        strncat(bc->dad,bc->info_dad, l);
                                        bc->dad[l-1] = 0;
-                               }
-                               {
-                                       int l = sizeof(ch->ast->exten);
+                                       l = sizeof(ch->ast->exten);
                                        strncpy(ch->ast->exten, bc->dad, l);
                                        ch->ast->exten[l-1] = 0;
+
+                                       ast_cdr_update(ch->ast);
                                }
-                               ast_cdr_update(ch->ast);
                                
                                ast_queue_frame(ch->ast, &fr);
-                               
                        }
                        
                }
@@ -3056,10 +3056,16 @@
                        misdn_tx2ast_frm(ch, bc->bframe, bc->bframe_len );
                } else {
                        int len=bc->bframe_len;
+                       int free=misdn_ibuf_freecount(bc->astbuf);
                        
-                       if (bc->bframe_len > misdn_ibuf_freecount(bc->astbuf)) {
+                       
+                       if (bc->bframe_len > free) {
                                ast_log(LOG_DEBUG, "sbuf overflow!\n");
                                len=misdn_ibuf_freecount(bc->astbuf);
+
+                               if (len == 0) {
+                                       ast_log(LOG_WARNING, "BCHAN_DATA: write 
buffer overflow port:%d channel:%d!\n",bc->port,bc->channel);
+                               }
                        }
                        
                        misdn_ibuf_memcpy_w(bc->astbuf, bc->bframe, len);
@@ -3080,7 +3086,7 @@
                                write(ch->pipe[1], blah,sizeof(blah));
 #endif
                                
-
+                               
                        }
                }
                
@@ -3351,8 +3357,8 @@
 
 void chan_misdn_log(int level, int port, char *tmpl, ...)
 {
-       if (! (0 <= port <= max_ports)) {
-               ast_console_puts("cb_log called with out-of-range port 
number!\n");
+       if (! ((0 <= port) && (port <= max_ports))) {
+               ast_log(LOG_WARNING, "cb_log called with out-of-range port 
number! (%d)\n", port);
                return;
        }
                
@@ -3592,10 +3598,10 @@
                        chan_misdn_log(1, ch->bc->port, "SETOPT: Digital\n");
                        if (strlen(tok) > 1 && tok[1]=='1') {
                                chan_misdn_log(1, ch->bc->port, "SETOPT: 
Digital TRANS_DIGITAL\n");
-                               ch->bc->nohdlc=1;
+                               ch->bc->async=1;
                                
ch->bc->capability=INFO_CAPABILITY_DIGITAL_UNRESTRICTED;
                        } else {
-                               ch->bc->nohdlc=0;
+                               ch->bc->async=0;
                                
ch->bc->capability=INFO_CAPABILITY_DIGITAL_UNRESTRICTED;
                        }
                        break;

_______________________________________________
Asterisk-Cvs mailing list
[email protected]
http://lists.digium.com/mailman/listinfo/asterisk-cvs

Reply via email to