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:
- 14:22a35f575502
- Parent:
- 13:ae278302dffe
- Child:
- 15:9c7456c1b6f4
--- a/sip.cpp Tue Sep 16 15:09:11 2014 +0000 +++ b/sip.cpp Tue Sep 16 21:02:37 2014 +0000 @@ -120,6 +120,7 @@ } } } + debug_msg(""); } VZ_call * Sip::invite(){ @@ -127,7 +128,9 @@ char callbox_string[ 32 ]; itoa( get_id(), callbox_string, 10 ); - if( status != sip_on_call ) set_status(status, sip_waiting_trying ); + if( status != sip_on_call ){ + set_status(status, sip_waiting_trying ); + } else return( NULL ); @@ -228,6 +231,7 @@ debug_msg("Call nao alocada -- Sip::status::%d -- loop_times :: %d :: received_loop_times :: %d", status, loop_times, received_loop_times ); if( t.read() > __INVITE_MAX_WAITING_TIME__ ){ set_status(status, sip_denied); + send_bye(); } delete( call ); return( NULL ); @@ -917,7 +921,8 @@ > 0 :: devo remover essa call do vetor de calls */ int Sip::listen_SIP_server( void ){ - sock.set_blocking( false, 3 ); // verificar isso com mais cuidado depois + sock.set_blocking( false, 1 ); + debug_msg(""); uint8_t read = sock.receiveFrom( sip_server, this->buffer, sizeof( this->buffer ) ); if( read > 0 ){ //debug_msg( "-- SIP recebeu algo --" ); @@ -932,6 +937,7 @@ debug_msg(" Options received "); build_reply_package( ans, (unsigned char*)buffer ); sock.sendTo( sip_server, ans, sizeof( ans ) ); + debug_msg(""); } } return( 0 );