![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
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
Diff: sip.cpp
- Revision:
- 8:e3bfe62a477e
- Parent:
- 4:de46f0d9b14d
- Child:
- 9:ffa64f38ef9c
diff -r 019b08223b87 -r e3bfe62a477e sip.cpp --- a/sip.cpp Sat Sep 13 19:21:48 2014 +0000 +++ b/sip.cpp Mon Sep 15 15:13:52 2014 +0000 @@ -110,7 +110,7 @@ build_registry_package( buffer ); int sent = sock.sendTo( sip_server, buffer, sizeof( buffer ) ); sock.receiveFrom( sip_server, buffer, sizeof( buffer ) ); - debug_msg(" Recebidos %d bytes para o o ext %d", sent, my_ext ); + debug_msg(" Recebidos %d bytes para o ext %d", sent, my_ext ); if( decode_gettag( (unsigned char *)buffer, "cseq: ", out ) ){ if(strlen( out ) > 7){ if(strcasecmp("options",out+strlen(out)-7) == 0){ @@ -919,19 +919,21 @@ int Sip::listen_SIP_server( void ){ sock.set_blocking( false, 3 ); // verificar isso com mais cuidado depois uint8_t read = sock.receiveFrom( sip_server, this->buffer, sizeof( this->buffer ) ); - if( read > 0 ){ - //debug_msg( "-- SIP recebeu algo --" ); + if( read > 0 ){ if( !( strncasecmp( buffer, "bye", strlen("bye") ) ) ){ char ans[ 2000 ]; build_reply_package( ans, (unsigned char*)buffer ); - sock.sendTo( sip_server, ans, sizeof( ans ) ); - debug_msg(" Server request BYE to %d ext", my_ext ); + uint8_t _reply = sock.sendTo( sip_server, ans, sizeof( ans ) ); + debug_msg("Respondido %d bytes de bye", _reply ); + debug_msg("Pkg::%s", ans ); return( this->my_ext ); }else if( !( strncasecmp( buffer, "options", strlen("options") ) ) ){ char ans[ 2000 ]; - debug_msg(" Options received "); + debug_msg("Options received "); build_reply_package( ans, (unsigned char*)buffer ); - sock.sendTo( sip_server, ans, sizeof( ans ) ); + uint8_t _reply = sock.sendTo( sip_server, ans, sizeof( ans ) ); + debug_msg("Respondido %d bytes", _reply ); + debug_msg("Pkg::%s", ans ); } } return( 0 );