voltando a versao de n aberturas e fechamentos de sockets

Dependencies:   EthernetInterface NTPClient mbed-rtos_old mbed

Fork of header_main_public by VZTECH

Revision:
13:ae278302dffe
Parent:
12:07fd716e0f35
Child:
14:22a35f575502
--- a/call_box.cpp	Tue Sep 16 13:21:01 2014 +0000
+++ b/call_box.cpp	Tue Sep 16 15:09:11 2014 +0000
@@ -77,9 +77,9 @@
         
         VZ_call * call = sip->invite();
         
-        //delete( sip );
-        //this->sip = NULL;
-        debug_msg("nao metei o socket");
+        delete( sip );
+        this->sip = NULL;
+        
         debug_msg("Valor do retorno do invite :: %p ", call );        
         return( call );
     }else{
@@ -98,7 +98,6 @@
     > 0 :: devo remover essa call do vetor de calls 
 */
 int Call_Box::listen_SIP_server( void ){
-    debug_msg("");
     if( this->sip == NULL ){
         if( status == cb_on_call || status == cb_idle ){
             this->sip = new Sip( ext, port );
@@ -109,18 +108,8 @@
         }else return( 0 );
     }else{
         if( status == cb_on_call || status == cb_idle ){
-            //return ( sip->listen_SIP_server() );
-            int out_read = sip->listen_SIP_server();
-            if( out_read > 0 ){
-                delete( sip );
-                this->sip = NULL;
-            }
-            debug_msg("");
-            return( out_read );
-        }else{
-            debug_msg("");
-            return( 0 );
-        }
+            return ( sip->listen_SIP_server() );
+        } else return( 0 );
     }
 }
 
@@ -139,17 +128,16 @@
 //}
 
 void Call_Box::send_bye( void ){ 
-    debug_msg("");
     if( this->sip == NULL ){
         this->sip = new Sip( ext, port );
         
         sip->send_bye();
-        debug_msg("");
-        delete( sip );    
+        
+        delete( sip );
+        
         sip = NULL;
     }else{
         sip->send_bye();
-        debug_msg("");
     }
 }