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: main.cpp
- Revision:
- 15:9c7456c1b6f4
- Parent:
- 14:22a35f575502
- Child:
- 16:b45b5b7363d7
--- a/main.cpp Tue Sep 16 21:02:37 2014 +0000 +++ b/main.cpp Thu Sep 18 13:56:13 2014 +0000 @@ -138,9 +138,10 @@ Call_Box * cb = ( Call_Box * )v_cb->get_element( i ); debug_msg(" Type :: %d -- Ext :: %d -- TimeSlice :: %d -- remain_timeslices :: %d :: v_call->size() :: %d :: Status :: %d :: SIP Status %d", type , cb->get_ext(), cb->get_timeslice(), ts->remain_timeslices(), v_call->size(), cb->status, cb->sip->status ); } - debug_msg(""); + if( v_cb->size() != 0 ) debug_msg(""); t.reset(); led3 = !led3; + hack_led = !hack_led; } //---------------------- switch( type ){ @@ -239,7 +240,7 @@ debug_msg(" -- %d on %d -- ", cb->get_ext(), data[ __TIMESLICE_PLACE__ ] ); __send_to_cb__( __build_cb_package__( ext, port, __INVITE__, ( char * )data, cb->get_msg_id(), __CB_BUFFER_SIZE__ - __VZ_HEADER_OFFSET__, write_buffer ) ); - debug_msg( "-- Trying -- aceitando pedido de invite -- %s ", write_buffer ); + debug_msg( "-- Trying -- aceitando pedido de invite --" ); //debug_pkg( 300, write_buffer ); }else{ set_status( cb->status,cb_idle); @@ -249,13 +250,21 @@ debug_msg(" -- %d on %d -- ", cb->get_ext(), data[ __TIMESLICE_PLACE__ ] ); __send_to_cb__( __build_cb_package__( ext, port, __CB_BYE__, ( char * )data, cb->get_msg_id(), __CB_BUFFER_SIZE__ - __VZ_HEADER_OFFSET__, write_buffer ) ); - debug_msg( "-- Trying -- Negando pedido de invite -- %s ", write_buffer ); + debug_msg( "-- Trying -- Negando pedido de invite --" ); set_status( cb->sip->status, sip_idle); } } }break; case cb_busy : { - // tratar sip + set_status( cb->status,cb_idle); + ts->return_timeslice( cb->get_timeslice() ); + cb->set_timeslice( 0x00 ); + data[ __TIMESLICE_PLACE__ ] = 0x00; + debug_msg(" -- %d on %d -- ", cb->get_ext(), data[ __TIMESLICE_PLACE__ ] ); + __send_to_cb__( __build_cb_package__( ext, port, __CB_BYE__, + ( char * )data, cb->get_msg_id(), __CB_BUFFER_SIZE__ - __VZ_HEADER_OFFSET__, write_buffer ) ); + debug_msg( "-- Trying -- Negando pedido de invite << Busy Here >> --" ); + set_status( cb->sip->status, sip_idle ); }break; } }break; @@ -321,7 +330,7 @@ __send_to_cb__( pkg2cb ); } } - debug_msg(""); + ///debug_msg(""); registry_aging( v_cb, buffer, write_buffer ); int ret = sip_manager( v_cb, v_call, write_buffer );