voltando a versao de n aberturas e fechamentos de sockets data 19/09

Dependencies:   EthernetInterface NTPClient mbed-rtos mbed EALib

Fork of header_main_publish by VZTECH

Revision:
15:9c7456c1b6f4
Parent:
14:22a35f575502
Child:
16:b45b5b7363d7
--- a/sip.cpp	Tue Sep 16 21:02:37 2014 +0000
+++ b/sip.cpp	Thu Sep 18 13:56:13 2014 +0000
@@ -183,6 +183,14 @@
                 }
             }
             if( ( status == sip_trying ) || ( status == sip_ringing ) ){            
+                if( !( strncasecmp( buffer + 12, "Busy Here", strlen("Busy Here") ) ) ){
+                    debug_msg("Busy Here");    
+                    delete( call );
+                    set_status( status, sip_busy );
+                    return( NULL );  
+                }
+            }
+            if( ( status == sip_trying ) || ( status == sip_ringing ) ){            
                 if( !( strncasecmp( buffer + 12, "Session Progress", strlen("Session Progress") ) ) ){
                     debug_msg( "Trocando dados de audio -- musica de espera com o CBx" );
                     char *ref = strstr( buffer, "audio" );
@@ -922,7 +930,7 @@
 */
 int Sip::listen_SIP_server( void ){
     sock.set_blocking( false, 1 );
-    debug_msg("");
+    //debug_msg("");
     uint8_t read = sock.receiveFrom( sip_server, this->buffer, sizeof( this->buffer ) );
     if( read > 0 ){
         //debug_msg( "-- SIP recebeu algo --" );
@@ -937,7 +945,7 @@
             debug_msg(" Options received ");
             build_reply_package( ans, (unsigned char*)buffer );
             sock.sendTo( sip_server, ans, sizeof( ans ) );
-            debug_msg("");
+            //debug_msg("");
         }
     }
     return( 0 );