Modularizando o src
Dependencies: EALib EthernetInterface_vz mbed-rtos mbed
Fork of header_main_colinas_V0-20-09-14 by
Diff: call_manager.cpp
- Revision:
- 132:05cd37f7e007
- Parent:
- 126:1f90756250fb
- Child:
- 135:2f4290590e51
diff -r 938ab88facae -r 05cd37f7e007 call_manager.cpp --- a/call_manager.cpp Tue Jul 21 20:03:35 2015 +0000 +++ b/call_manager.cpp Tue Sep 01 17:21:11 2015 +0000 @@ -58,7 +58,7 @@ /* remove calls por timeout */ void call_manager ( Vector * v_call, Vector * v_cb, Timeslice * ts ) { - //FixME pode dar problema por conta do static + //FIXME precisa tratar o caso dos parametros NULL ? static uint8_t data[ CB_BUFFER_SIZE ], write_buffer[ CB_BUFFER_SIZE ]; bool should_remove = false; @@ -80,33 +80,34 @@ } } - if ( call->is_timetofinish() || call->cbx_pkg_is_idle() || should_remove ) + if ( call->is_timetofinish() || call -> cbx_pkg_is_idle() || should_remove ) { if ( debug_invite && !should_remove ) { - if ( call->cbx_pkg_is_idle() ){ - if( debug_invite ) debug_msg("[%d] Call timeout: no pkg", call->get_cb_ext () ); + if ( call -> cbx_pkg_is_idle () ) { + if( debug_invite ) vz_debug ("[%d] Call timeout: no pkg", call -> get_cb_ext () ); } else { - if( debug_invite ) debug_msg("[%d] Call timeout", call->get_cb_ext () ); + if( debug_invite ) vz_debug ("[%d] Call timeout", call->get_cb_ext () ); } } - v_call->remove_element( i ); - Call_Box * cb = find_CB ( v_cb, call->get_cb_ext() ); - if ( cb != NULL ){ - data[ TIMESLICE_PLACE ] = 0; + v_call -> remove_element ( i ); + Call_Box * cb = find_CB ( v_cb, call -> get_cb_ext () ); + if ( cb != NULL ) + { + data [ TIMESLICE_PLACE ] = 0; - send2callboxes( build_cb_package( cb->get_ext(), cb->get_port(), CB_BYE, - ( char * )data, cb->msg_id_update (), CB_BUFFER_SIZE - VZ_HEADER_OFFSET, write_buffer ) ); + send2callboxes ( build_cb_package ( cb -> get_ext (), cb -> get_port (), CB_BYE, + ( char * )data, cb -> msg_id_update (), CB_BUFFER_SIZE - VZ_HEADER_OFFSET, write_buffer ) ); - ts->return_timeslice( cb->call_end () ); + ts -> return_timeslice ( cb -> call_end () ); } delete( call ); } } if ( end_call_ext != 0 ) { - if ( debug_invite ) debug_msg ( "Call from %i not foud", end_call_ext ); + if ( debug_invite ) vz_debug ( "Call from %i not foud", end_call_ext ); end_call = false; end_call_ext = 0; } @@ -125,7 +126,7 @@ if ( inviting_cb -> get_status () == cb_idle ) { inviting_cb -> cb_set_status ( cb_trying ); - if ( debug_invite ) debug_msg ("[%d] Request invite <cb_idle,cb_trying>", inviting_cb->get_ext () ); + if ( debug_invite ) vz_debug ("[%d] Request invite <cb_idle,cb_trying>", inviting_cb->get_ext () ); } } @@ -158,7 +159,7 @@ cb -> call_end (); - if ( debug_invite ) debug_msg ( "[%d] Trying without TS <cb_trying,cb_idle>", ext ); + if ( debug_invite ) vz_debug ( "[%d] Trying without TS <cb_trying,cb_idle>", ext ); return; } @@ -173,7 +174,7 @@ send2callboxes( build_cb_package( ext, port, INVITE, ( char * )data, cb->get_msg_id (), CB_BUFFER_SIZE - VZ_HEADER_OFFSET, write_buffer ) ); - if ( debug_invite ) debug_msg("[%d] TS::%d <cb_trying,cb_ringing>", ext, data [ TIMESLICE_PLACE ] ); + if ( debug_invite ) vz_debug ("[%d] TS::%d <cb_trying,cb_ringing>", ext, data [ TIMESLICE_PLACE ] ); } }break; case cb_ringing : { @@ -199,19 +200,19 @@ cb -> call_confirmed (); - if ( debug_invite ) debug_msg( "[%d] Ringing call ok <cb_ringing,cb_on_call>", ext ); + if ( debug_invite ) vz_debug ( "[%d] Ringing call ok <cb_ringing,cb_on_call>", ext ); } } else { if ( cb -> get_sip_status () == sip_denied ) { cb -> cb_set_status ( cb_denied ); - if ( debug_invite ) debug_msg ( "[%d] call denied <sip_denied>::<cb_ringing,cb_denied>", ext ); + if ( debug_invite ) vz_debug ( "[%d] call denied <sip_denied>::<cb_ringing,cb_denied>", ext ); } else { if ( cb -> time_to_retry () ) { if ( cb -> get_sip_status () == sip_waiting_trying ) { - if ( debug_invite ) debug_msg ("[%4i %3i] Resend invite to *", ext, cb -> get_invite_try_number () ); + if ( debug_invite ) vz_debug ("[%4i %3i] Resend invite to *", ext, cb -> get_invite_try_number () ); cb -> retry_send_invite_pkg_to_ast (); } } @@ -238,7 +239,7 @@ ts -> return_timeslice ( cb -> call_end () ); - if ( debug_invite ) debug_msg( "[%d] Busy Here <cb_busy,cb_idle>", ext ); + if ( debug_invite ) vz_debug ( "[%d] Busy Here <cb_busy,cb_idle>", ext ); }break; case cb_denied : { @@ -259,7 +260,7 @@ } ts -> return_timeslice ( cb -> call_end () ); - if ( debug_invite ) debug_msg ( "[%d] call denied <cb_denied,cb_idle>", ext ); + if ( debug_invite ) vz_debug ( "[%d] call denied <cb_denied,cb_idle>", ext ); }break; } }