fixed a ETSI violation (after RELEASE we need to RELEASE_COMPLETE (network side)...
authorChristian Richter <christian.richter@beronet.com>
Wed, 22 Feb 2006 16:48:25 +0000 (16:48 +0000)
committerChristian Richter <christian.richter@beronet.com>
Wed, 22 Feb 2006 16:48:25 +0000 (16:48 +0000)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@10713 65c4cc65-6c06-0410-ace0-fbb531ad65f3

channels/chan_misdn.c
channels/misdn/isdn_lib.c
channels/misdn/isdn_msg_parser.c
channels/misdn_config.c

index 1e01f96..ab23bb7 100644 (file)
@@ -1915,14 +1915,16 @@ static int misdn_hangup(struct ast_channel *ast)
                        chan_misdn_log(1, bc->port, " --> cause %d\n",bc->cause);
                        chan_misdn_log(1, bc->port, " --> out_cause %d\n",bc->out_cause);
                        
+                       bc->out_cause=-1;
                        misdn_lib_send_event(bc,EVENT_RELEASE);
                        break;
                default:
                        /*  Alerting or Disconect */
 
-                       if (bc->nt)
+                       if (bc->nt) {
+                               bc->out_cause=-1;
                                misdn_lib_send_event(bc, EVENT_RELEASE);
-                       else
+                       } else
                                misdn_lib_send_event(bc, EVENT_DISCONNECT);
                        p->state=MISDN_CLEANING; /* MISDN_HUNGUP_FROM_AST; */
                }
@@ -3377,12 +3379,14 @@ cb_events(enum event_e event, struct misdn_bchannel *bc, void *user_data)
                }
                
                stop_bc_tones(ch);
-               bc->out_cause=16;
+               /*bc->out_cause=16;*/
+               bc->out_cause=-1;
                
-               //if (ch->state == MISDN_CONNECTED) 
-               //misdn_lib_send_event(bc,EVENT_RELEASE);
-               //else
-               //misdn_lib_send_event(bc,EVENT_RELEASE_COMPLETE);
+               /*if (ch->state == MISDN_CONNECTED) 
+               misdn_lib_send_event(bc,EVENT_RELEASE);
+               else
+               misdn_lib_send_event(bc,EVENT_RELEASE_COMPLETE);
+               */
                
                misdn_lib_send_event(bc,EVENT_RELEASE);
                
@@ -3401,15 +3405,18 @@ cb_events(enum event_e event, struct misdn_bchannel *bc, void *user_data)
                                  before, so we should RELEASE_COMPLETE after that Disconnect
                                  (looks like ALERTING State at misdn_hangup !!
                                */
-                               return RESPONSE_OK;
+                               
+                               /*return RESPONSE_OK;*/
                                break;
                        }
                        
                        
                        bc->out_cause=16;
                        
-                       stop_bc_tones(ch);
-                       release_chan(bc);
+                       /*stop_bc_tones(ch);
+                         release_chan(bc);*/
+                       
+                       misdn_lib_send_event(bc,EVENT_RELEASE_COMPLETE);
                }
                break;
        case EVENT_RELEASE_COMPLETE:
index ee0e988..8839be0 100644 (file)
@@ -1659,13 +1659,13 @@ handle_event_nt(void *dat, void *arg)
 
                case CC_RELEASE|CONFIRM:
                {
-                       struct misdn_bchannel *bc=find_bc_by_l3id(stack, hh->dinfo);
-                       cb_log(3, stack->port, " --> RELEASE CONFIRM, doing nothin\n");
-                       cb_event(EVENT_CLEANUP, bc, glob_mgr->user_data);
-                       empty_chan_in_stack(stack,bc->channel);
-                       empty_bc(bc);
-                       free_msg(msg);
-                       return 0;
+                       /*struct misdn_bchannel *bc=find_bc_by_l3id(stack, hh->dinfo);
+                         cb_log(3, stack->port, " --> RELEASE CONFIRM, doing nothin\n");
+                         cb_event(EVENT_CLEANUP, bc, glob_mgr->user_data);
+                         empty_chan_in_stack(stack,bc->channel);
+                         empty_bc(bc);
+                         free_msg(msg);
+                         return 0;*/
                }
                break;  
                case CC_RELEASE|INDICATION:
@@ -2035,7 +2035,7 @@ int handle_bchan(msg_t *msg)
                                
                                int i=cb_event( EVENT_BCHAN_DATA, bc, glob_mgr->user_data);
                                if (i<0) {
-                                       cb_log(2,stack->port,"cb_event returned <0\n");
+                                       cb_log(5,stack->port,"cb_event returned <0\n");
                                        /*clean_up_bc(bc);*/
                                }
                        }
@@ -2990,11 +2990,12 @@ int misdn_lib_init(char *portlist, struct misdn_lib_iface *iface, void *user_dat
        glob_mgr = mgr;
   
        msg_init();
-       debug_init(0 , NULL, NULL, NULL);
 #if 0
        int flags=0xff;
        flags &= ~DBGM_MSG;
        debug_init( flags , NULL, NULL, NULL);
+#else
+       debug_init(0 , NULL, NULL, NULL);
 #endif 
        if (!portlist || (*portlist == 0) ) return 1;
        
index a8d9c1b..5bce3f5 100644 (file)
@@ -798,8 +798,8 @@ msg_t *build_release (struct isdn_msg msgs[], struct misdn_bchannel *bc, int nt)
  
        release=(RELEASE_t*)((msg->data+HEADER_LEN)); 
   
-  
-       enc_ie_cause(&release->CAUSE, msg, nt?1:0, bc->out_cause, nt,bc);
+       if (bc->out_cause>= 0)
+               enc_ie_cause(&release->CAUSE, msg, nt?1:0, bc->out_cause, nt,bc);
   
 #if DEBUG 
        printf("Building RELEASE Msg\n"); 
index 94114ba..b6366ef 100644 (file)
@@ -214,7 +214,7 @@ static void _free_port_cfg (void)
 {
        int i, j;
        int gn = map[MISDN_CFG_GROUPNAME];
-       union misdn_cfg_pt* free_list[max_ports + 1];
+       union misdn_cfg_pt* free_list[max_ports + 2];
        
        memset(free_list, 0, sizeof(free_list));
        free_list[0] = port_cfg[0];