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:
12:07fd716e0f35
Parent:
10:22da1a0ac1e1
Child:
13:ae278302dffe
--- a/sip.cpp	Mon Sep 15 20:58:59 2014 +0000
+++ b/sip.cpp	Tue Sep 16 13:21:01 2014 +0000
@@ -105,7 +105,8 @@
 }
  
 void Sip::registry(){
-    char out[ 1000 ];
+    //jhcchar out[ 1000 ];
+    char out[ 350 ];
     debug_msg("registrando -- %d", this->my_ext );
     build_registry_package( buffer );
     int sent = sock.sendTo( sip_server, buffer, strlen( buffer ) );
@@ -114,12 +115,14 @@
     if( decode_gettag( (unsigned char *)buffer, "cseq: ", out ) ){
         if(strlen( out ) > 7){
             if(strcasecmp("options",out+strlen(out)-7) == 0){
-                char ans[ 2000 ];
+                //jhcchar ans[ 2000 ];
+                char ans[ 350 ];
                 build_reply_package( ans, (unsigned char*)buffer );
                 sock.sendTo( sip_server, ans, sizeof( ans ) );
             }
         }
     }
+    debug_msg("registrei");
 }
 
 VZ_call * Sip::invite(){
@@ -170,7 +173,8 @@
                         ref += 6; // audio 
                         ref = strtok( ref, " ");
                         if( call == NULL ) call = new VZ_call( this->my_ext, this->my_rtp_port, this->peer_ext, atoi( ref ) );
-                        char ans[ 1024 ];
+                        //jhcchar ans[ 1024 ];
+                        char ans[ 350 ];
                         build_ack_package( ans, ( unsigned char *)buffer );
                         sock.sendTo( sip_server, ans, sizeof( ans ) );
                         debug_msg("Call alocada -- Sip::status::%d -- loop_times :: %d :: received_loop_times :: %d", status, loop_times, received_loop_times );
@@ -921,13 +925,15 @@
     uint8_t read = sock.receiveFrom( sip_server, this->buffer, sizeof( this->buffer ) );
     if( read > 0 ){
         if( !( strncasecmp( buffer, "bye", strlen("bye") ) ) ){
-            char ans[ 2000 ];
+            //jhcchar ans[ 2000 ];
+            char ans[ 350 ];
             build_reply_package( ans, (unsigned char*)buffer );
             int sent_to_ast = sock.sendTo( sip_server, ans, sizeof( ans ) );
             debug_msg(" Server request BYE to %d ext -- %d bytes reply", my_ext, sent_to_ast );
             return( this->my_ext );
         }else if( !( strncasecmp( buffer, "options", strlen("options") ) ) ){
-            char ans[ 2000 ];
+            //jhcchar ans[ 2000 ];
+            char ans[ 350 ];
             build_reply_package( ans, (unsigned char*)buffer );
             int sent_to_ast = sock.sendTo( sip_server, ans, sizeof( ans ) );
             debug_msg(" Ext %d :: Options -- %d bytes reply ", my_ext, sent_to_ast );