Modularizando o src
Dependencies: EALib EthernetInterface_vz mbed-rtos mbed
Fork of header_main_colinas_V0-20-09-14 by
Diff: call_box.cpp
- Revision:
- 117:e9facba9db27
- Parent:
- 116:39a41ebb675c
- Child:
- 119:ee6a53069455
diff -r 39a41ebb675c -r e9facba9db27 call_box.cpp --- a/call_box.cpp Thu Apr 23 20:24:09 2015 +0000 +++ b/call_box.cpp Thu Apr 23 21:53:28 2015 +0000 @@ -72,11 +72,6 @@ } void Call_Box::registry( void ){ - if( drop_registry_pkg ){ - debug_msg("Dropando registry pck from %d", this->ext ); - return; - } - if( this->sip == NULL ){ deleted_sip++; this->sip = new Sip( ext, port ); @@ -115,8 +110,8 @@ } } -VZ_call * Call_Box::invite ( void ) -{ +VZ_call * Call_Box::invite( void ){ + //t.stop(); VZ_call * call = NULL; if( this->sip == NULL ){ @@ -248,17 +243,21 @@ else return( REQUEST_PING ); } -void Call_Box::set_invite_response_ok ( void ) -{ - this->invite_response = true; - if ( debug_invite ) debug_msg ("Invite response :: ok"); -} +void Call_Box::set_invite_response_ok( void ){ this->invite_response = true; } + +//void Call_Box::set_first_invite_response_ok( void ){ this->invite_first_response = true; +// debug_msg(""); +//} void Call_Box::set_invite_response_pending( void ){ this->invite_response = false; } bool Call_Box::get_invite_response( void ){ return( this->invite_response ); } +//void Call_Box::set_first_invite_response_pending( void ){ this->first_invite_response = false; } +//bool Call_Box::get_first_invite_response( void ){ return( this->first_invite_response ); } + + void Call_Box::invite_retry_count_reset( void ){ invite_retry_count = MAX_INVITE_RETRY; } -uint16_t Call_Box::get_invite_retry_count( void ){ +uint8_t Call_Box::get_invite_retry_count( void ){ return ( invite_retry_count ) ? invite_retry_count-- : 0; } @@ -282,19 +281,14 @@ int Call_Box::get_sip_ext( void ){ return this->sip->get_ext(); } int Call_Box::get_sip_port( void ){ return this->sip->get_port(); } -int Call_Box::get_timer ( void ) -{ - int now = t.read (); - if( now >= 9999 || now <= 0 ) t.reset (); - return t.read (); -} +int Call_Box::get_timer( void ){ return t.read(); } int Call_Box::get_rtp_port ( void ) { if( this->sip != NULL ){ return this->sip->get_sip_rtp_port(); }else{ - if( debug_cb ) debug_msg("Sip equals NULL o.O"); + if( debug_cb) debug_msg("Sip equals NULL o.O"); deleted_sip++; debug_msg("Sip equals NULL o.O"); return -1; @@ -312,27 +306,6 @@ } } -void Call_Box::init_rtp_timer ( void ) -{ - this->rtp_timer.start(); -} - -void Call_Box::reset_rtp_timer ( void ) -{ - this->rtp_timer.stop(); - this->rtp_timer.reset(); -} - -bool Call_Box::is_rtp_timer_timeout ( void ) -{ - return ( rtp_timer.read () > RTP_REQUEST_PORT_TIMEOUT ) ? true : false; -} - -int Call_Box::get_rtp_timer ( void ) -{ - return ( rtp_timer.read () ); -} - int Call_Box::print_yourself ( void ) { send_msg (""); @@ -379,4 +352,25 @@ send_msg (""); return ( sizeof( Call_Box ) ); +} + +void Call_Box::init_rtp_timer ( void ) +{ + this->rtp_timer.start(); +} + +void Call_Box::reset_rtp_timer ( void ) +{ + this->rtp_timer.stop(); + this->rtp_timer.reset(); +} + +bool Call_Box::is_rtp_timer_timeout ( void ) +{ + return ( rtp_timer.read () > RTP_REQUEST_PORT_TIMEOUT ) ? true : false; +} + +int Call_Box::get_rtp_timer ( void ) +{ + return ( rtp_timer.read () ); } \ No newline at end of file