Modularizando o src

Dependencies:   EALib EthernetInterface_vz mbed-rtos mbed

Fork of header_main_colinas_V0-20-09-14 by VZTECH

Revision:
25:2cf5e8dd4035
Parent:
24:270b436a1bb0
Child:
26:725cbbedadd5
diff -r 270b436a1bb0 -r 2cf5e8dd4035 main.cpp
--- a/main.cpp	Sat Sep 20 21:20:01 2014 +0000
+++ b/main.cpp	Mon Sep 22 14:43:46 2014 +0000
@@ -132,7 +132,7 @@
             data = __parse_cb_buffer__( &ext, &port, &type, buffer );
             
             if( data != NULL ){                
-                if (debug_alive == 1) debug_msg("Procurando pelo CBx :: %d -- Type :: %d", ext, type );
+                if (debug_alive == 1) debug_msg("Pkg from CBx :: %d -- Type :: %d", ext, type );
                 if( type != __AUDIO__ ){
                     Call_Box * cb = __find_CB__( v_cb, ext );
                     if( cb != NULL ){
@@ -179,7 +179,6 @@
             case __CB_BYE__ : {
                 Call_Box * cb = __find_CB__( v_cb, ext );
                 if( cb != NULL ){
-                    debug_msg("Nao encontrado CBx :: %d -- Type :: %d", ext, type );
                     data[ 0 ] |= BIT7;
                     cb->set_msg_id( data[ 0 ] );
                     debug_msg( " Request bye from CBx " );
@@ -225,7 +224,7 @@
                     break;
                 }
                 set_status( cb->status, cb_trying );
-                debug_msg(" Ok temos um cbx encontrado com status :: %d", cb->status );
+                debug_msg("Request invite cbx status :: %d", cb->status );
                 switch( cb->status ){
                     case cb_on_call : {
                         // a priori, nao fazer nada
@@ -284,7 +283,15 @@
                         }
                     }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;