![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
Modularizando o src
Dependencies: EALib EthernetInterface_vz mbed-rtos mbed
Fork of header_main_colinas_V0-20-09-14 by
main.cpp@126:1f90756250fb, 2015-05-20 (annotated)
- Committer:
- klauss
- Date:
- Wed May 20 19:50:31 2015 +0000
- Revision:
- 126:1f90756250fb
- Parent:
- 124:c1b6c893e1c3
- Child:
- 127:e7160a463b6c
under validation
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
klauss | 121:ee02790d00b7 | 1 | #include "main_app_functions.h" |
klauss | 120:770f00554b1e | 2 | #include "main_app_var_configs.h" |
klauss | 85:b6f2dc1d0f4f | 3 | |
klauss | 91:c2a86b1f8aaa | 4 | int main() |
klauss | 114:472502b31a12 | 5 | { |
klauss | 100:09a23fcd3bdf | 6 | debug_uart3 = true; |
klauss | 119:ee6a53069455 | 7 | |
klauss | 119:ee6a53069455 | 8 | int header_app_init_ret = header_app_init (); |
klauss | 117:e9facba9db27 | 9 | |
klauss | 119:ee6a53069455 | 10 | send_msg( "header_app_init %s" , ( header_app_init_ret == 0 ) ? "Ok" : "Failure" ); |
klauss | 99:e80850c51106 | 11 | |
klauss | 119:ee6a53069455 | 12 | if ( header_app_init_ret == 0 ) send_msg("Ready"); |
klauss | 105:a930035b6556 | 13 | |
klauss | 114:472502b31a12 | 14 | debug_uart3 = false; |
klauss | 105:a930035b6556 | 15 | |
klauss | 119:ee6a53069455 | 16 | /*------------------------------------------ main loop ---------------------------------------------------------------*/ |
klauss | 115:a1e1e2e60a2c | 17 | |
klauss | 119:ee6a53069455 | 18 | while( true ) |
klauss | 119:ee6a53069455 | 19 | { |
klauss | 126:1f90756250fb | 20 | prompt_process( NULL, 0 ); |
klauss | 126:1f90756250fb | 21 | |
klauss | 126:1f90756250fb | 22 | if ( show_last_rx ) |
klauss | 126:1f90756250fb | 23 | { |
klauss | 126:1f90756250fb | 24 | show_last_rx_pkg_from_cbx (); |
klauss | 126:1f90756250fb | 25 | show_last_rx = false; |
klauss | 126:1f90756250fb | 26 | } |
klauss | 126:1f90756250fb | 27 | |
klauss | 126:1f90756250fb | 28 | if ( show_last_tx ) |
klauss | 126:1f90756250fb | 29 | { |
klauss | 126:1f90756250fb | 30 | show_last_tx_pkg_from_cbx (); |
klauss | 126:1f90756250fb | 31 | show_last_tx = false; |
klauss | 126:1f90756250fb | 32 | } |
klauss | 126:1f90756250fb | 33 | |
klauss | 124:c1b6c893e1c3 | 34 | if ( show_hello_status ) |
klauss | 124:c1b6c893e1c3 | 35 | { |
klauss | 124:c1b6c893e1c3 | 36 | show_hello_status_function (); |
klauss | 124:c1b6c893e1c3 | 37 | show_hello_status = false; |
klauss | 124:c1b6c893e1c3 | 38 | } |
klauss | 124:c1b6c893e1c3 | 39 | |
klauss | 78:1353744f01e1 | 40 | if( v_cb->size() > max_registered_cbx ) max_registered_cbx = v_cb->size(); |
klauss | 91:c2a86b1f8aaa | 41 | |
klauss | 120:770f00554b1e | 42 | if ( sync_timer.read() > 5 ) |
klauss | 119:ee6a53069455 | 43 | { |
klauss | 78:1353744f01e1 | 44 | sync_timer.reset(); |
klauss | 91:c2a86b1f8aaa | 45 | |
klauss | 119:ee6a53069455 | 46 | if( debug_cks == true ) { pcks_s = true; } |
klauss | 91:c2a86b1f8aaa | 47 | |
klauss | 119:ee6a53069455 | 48 | if( debug_alive == true ) { pshowcb = true; } |
klauss | 105:a930035b6556 | 49 | |
klauss | 114:472502b31a12 | 50 | if( !( ++count % 15 ) ) { |
klauss | 91:c2a86b1f8aaa | 51 | if( eth_status ) { |
klauss | 119:ee6a53069455 | 52 | try_reconnect_with_eth (); |
klauss | 78:1353744f01e1 | 53 | } |
klauss | 78:1353744f01e1 | 54 | } |
klauss | 100:09a23fcd3bdf | 55 | |
klauss | 114:472502b31a12 | 56 | //35 sec. |
klauss | 126:1f90756250fb | 57 | if( ( count > 7 ) and ( wake_all == false ) ) { |
klauss | 81:3656f00ab3db | 58 | wake_all = true; |
klauss | 78:1353744f01e1 | 59 | if( debug_wake == true ) send_msg( "Time to wake" ); |
klauss | 78:1353744f01e1 | 60 | } |
klauss | 119:ee6a53069455 | 61 | |
klauss | 119:ee6a53069455 | 62 | // enable na variavel que exibe lista com estatisticas de pacotes que falharam ao serem enviados via interface eth |
klauss | 119:ee6a53069455 | 63 | if ( debug_missed ) { missed_send_udp_pkg = true; } |
klauss | 119:ee6a53069455 | 64 | |
klauss | 114:472502b31a12 | 65 | } |
klauss | 124:c1b6c893e1c3 | 66 | |
klauss | 124:c1b6c893e1c3 | 67 | if ( show_wake_all_up_status ) |
klauss | 124:c1b6c893e1c3 | 68 | { |
klauss | 124:c1b6c893e1c3 | 69 | send_msg("wake_all_up status :: %s", ( wake_all ) ? "Enable" : "Disable" ); |
klauss | 124:c1b6c893e1c3 | 70 | show_wake_all_up_status = false; |
klauss | 124:c1b6c893e1c3 | 71 | } |
klauss | 119:ee6a53069455 | 72 | |
klauss | 119:ee6a53069455 | 73 | check_clock (); |
klauss | 114:472502b31a12 | 74 | |
klauss | 119:ee6a53069455 | 75 | if ( r_stats ) |
klauss | 119:ee6a53069455 | 76 | { |
klauss | 119:ee6a53069455 | 77 | reset_stats (); |
klauss | 120:770f00554b1e | 78 | stats = true; |
klauss | 63:0d95da692bb4 | 79 | r_stats = false; |
klauss | 63:0d95da692bb4 | 80 | } |
klauss | 91:c2a86b1f8aaa | 81 | |
klauss | 119:ee6a53069455 | 82 | if ( stats ) |
klauss | 119:ee6a53069455 | 83 | { |
klauss | 119:ee6a53069455 | 84 | show_stats (); |
klauss | 63:0d95da692bb4 | 85 | stats =false; |
klauss | 63:0d95da692bb4 | 86 | } |
klauss | 114:472502b31a12 | 87 | |
klauss | 119:ee6a53069455 | 88 | if ( list ) |
klauss | 119:ee6a53069455 | 89 | { |
klauss | 119:ee6a53069455 | 90 | show_cb_list ( v_cb ); |
klauss | 91:c2a86b1f8aaa | 91 | list = false; |
klauss | 114:472502b31a12 | 92 | } |
klauss | 114:472502b31a12 | 93 | |
klauss | 119:ee6a53069455 | 94 | if ( long_list ) |
klauss | 106:a34fcf9f0e02 | 95 | { |
klauss | 123:1d395b5a4cad | 96 | show_cb_long_list ( v_cb, show_time ); |
klauss | 91:c2a86b1f8aaa | 97 | long_list = false; |
klauss | 123:1d395b5a4cad | 98 | show_time = false; |
klauss | 52:12930cef17c4 | 99 | } |
klauss | 119:ee6a53069455 | 100 | |
klauss | 119:ee6a53069455 | 101 | if ( pshowcb ) |
klauss | 119:ee6a53069455 | 102 | { |
klauss | 119:ee6a53069455 | 103 | show_cb ( v_cb ); |
klauss | 78:1353744f01e1 | 104 | pshowcb = false; |
klauss | 48:195c97f12e8e | 105 | } |
klauss | 97:8985817e8847 | 106 | |
klauss | 124:c1b6c893e1c3 | 107 | if ( request_clock_now ) |
klauss | 124:c1b6c893e1c3 | 108 | { |
klauss | 124:c1b6c893e1c3 | 109 | request_clock_to_server (); |
klauss | 124:c1b6c893e1c3 | 110 | show_current_time = true; |
klauss | 124:c1b6c893e1c3 | 111 | request_clock_now = false; |
klauss | 124:c1b6c893e1c3 | 112 | } |
klauss | 124:c1b6c893e1c3 | 113 | |
klauss | 119:ee6a53069455 | 114 | if ( show_current_time ) |
klauss | 119:ee6a53069455 | 115 | { |
klauss | 119:ee6a53069455 | 116 | show_clock (); |
klauss | 119:ee6a53069455 | 117 | show_current_time = false;; |
klauss | 119:ee6a53069455 | 118 | } |
klauss | 119:ee6a53069455 | 119 | |
klauss | 120:770f00554b1e | 120 | if( show_sip ){ |
klauss | 120:770f00554b1e | 121 | show_cb_sip ( v_cb ); |
klauss | 97:8985817e8847 | 122 | show_sip = false; |
klauss | 97:8985817e8847 | 123 | } |
klauss | 91:c2a86b1f8aaa | 124 | |
klauss | 81:3656f00ab3db | 125 | if( pflood == true ) flood(); |
klauss | 91:c2a86b1f8aaa | 126 | |
klauss | 91:c2a86b1f8aaa | 127 | if( debug_eth ) { |
klauss | 120:770f00554b1e | 128 | send_msg("Eth status %s", ( eth_status == 0 ) ? "Connected" : "Disconnected" ); |
klauss | 81:3656f00ab3db | 129 | debug_eth = false; |
klauss | 81:3656f00ab3db | 130 | } |
klauss | 126:1f90756250fb | 131 | |
klauss | 126:1f90756250fb | 132 | |
klauss | 91:c2a86b1f8aaa | 133 | |
klauss | 120:770f00554b1e | 134 | // chechando se existe um pacote vindo do cbx pendente |
klauss | 121:ee02790d00b7 | 135 | if( status != WAITING ) |
klauss | 121:ee02790d00b7 | 136 | { |
klauss | 126:1f90756250fb | 137 | process_received_pkg_from_cbx (); |
klauss | 126:1f90756250fb | 138 | } |
klauss | 126:1f90756250fb | 139 | else if ( test_ts and test_ts_timer.read_ms () > 10 ) |
klauss | 126:1f90756250fb | 140 | { |
klauss | 126:1f90756250fb | 141 | if ( v_cb -> size () not_eq 0 ) |
klauss | 126:1f90756250fb | 142 | { |
klauss | 126:1f90756250fb | 143 | Call_Box * cb = ( Call_Box * ) v_cb -> get_element ( 0 ); |
klauss | 126:1f90756250fb | 144 | if ( cb not_eq NULL ) |
klauss | 126:1f90756250fb | 145 | { |
klauss | 126:1f90756250fb | 146 | ext = cb -> get_ext (); |
klauss | 126:1f90756250fb | 147 | port = cb -> get_port (); |
klauss | 126:1f90756250fb | 148 | } |
klauss | 126:1f90756250fb | 149 | } |
klauss | 126:1f90756250fb | 150 | else |
klauss | 126:1f90756250fb | 151 | { |
klauss | 126:1f90756250fb | 152 | ext = 5000; |
klauss | 126:1f90756250fb | 153 | port = 5000; |
klauss | 126:1f90756250fb | 154 | } |
klauss | 126:1f90756250fb | 155 | |
klauss | 126:1f90756250fb | 156 | type = INVITE; |
klauss | 126:1f90756250fb | 157 | data = buffer; |
klauss | 126:1f90756250fb | 158 | |
klauss | 126:1f90756250fb | 159 | test_ts_timer.reset (); |
klauss | 0:4d17cd9c8f9d | 160 | } |
klauss | 91:c2a86b1f8aaa | 161 | |
klauss | 119:ee6a53069455 | 162 | if( sizes == true ) |
klauss | 119:ee6a53069455 | 163 | { |
klauss | 120:770f00554b1e | 164 | show_sizes (); |
klauss | 119:ee6a53069455 | 165 | sizes = false; |
klauss | 109:a5b8264ffbbc | 166 | } |
klauss | 109:a5b8264ffbbc | 167 | |
klauss | 120:770f00554b1e | 168 | // usado pra testes |
klauss | 114:472502b31a12 | 169 | if ( registra ) |
klauss | 112:6ae726539ab9 | 170 | { |
klauss | 112:6ae726539ab9 | 171 | int internal_ext = 8000; |
klauss | 112:6ae726539ab9 | 172 | registra = false; |
klauss | 123:1d395b5a4cad | 173 | for( register uint8_t i = 0; i < MAX_CB_IN_A_BRANCH - 2; i++ ) { |
klauss | 112:6ae726539ab9 | 174 | v_cb -> add ( new Call_Box ( internal_ext, internal_ext++ ) ); |
klauss | 112:6ae726539ab9 | 175 | } |
klauss | 112:6ae726539ab9 | 176 | } |
klauss | 112:6ae726539ab9 | 177 | |
klauss | 120:770f00554b1e | 178 | check_udp_packages_pending ( v_cb ); |
klauss | 120:770f00554b1e | 179 | |
klauss | 120:770f00554b1e | 180 | if( dshow_rtp == true ) |
klauss | 109:a5b8264ffbbc | 181 | { |
klauss | 120:770f00554b1e | 182 | show_rtp (); |
klauss | 120:770f00554b1e | 183 | dshow_rtp = false; |
klauss | 120:770f00554b1e | 184 | } |
klauss | 117:e9facba9db27 | 185 | |
klauss | 120:770f00554b1e | 186 | // usado pra test |
klauss | 120:770f00554b1e | 187 | if ( frtp ) |
klauss | 120:770f00554b1e | 188 | { |
klauss | 120:770f00554b1e | 189 | fuck_rtp ( v_cb ); |
klauss | 120:770f00554b1e | 190 | frtp = false; |
klauss | 109:a5b8264ffbbc | 191 | } |
klauss | 109:a5b8264ffbbc | 192 | |
klauss | 120:770f00554b1e | 193 | // usado pra test |
klauss | 109:a5b8264ffbbc | 194 | if ( rescue_rtp ) |
klauss | 109:a5b8264ffbbc | 195 | { |
klauss | 109:a5b8264ffbbc | 196 | rescue_rtp = false; |
klauss | 121:ee02790d00b7 | 197 | Call_Box * cb = find_CB( v_cb, rescue_rtp_target ); |
klauss | 109:a5b8264ffbbc | 198 | if ( cb != NULL ) |
klauss | 109:a5b8264ffbbc | 199 | { |
klauss | 109:a5b8264ffbbc | 200 | cb -> set_rtp_port ( rescue_rtp_value ); |
klauss | 109:a5b8264ffbbc | 201 | } |
klauss | 109:a5b8264ffbbc | 202 | else |
klauss | 109:a5b8264ffbbc | 203 | { |
klauss | 109:a5b8264ffbbc | 204 | debug_msg("rescue rtp fail"); |
klauss | 109:a5b8264ffbbc | 205 | } |
klauss | 109:a5b8264ffbbc | 206 | } |
klauss | 109:a5b8264ffbbc | 207 | |
klauss | 109:a5b8264ffbbc | 208 | if ( print_v_cb ) |
klauss | 109:a5b8264ffbbc | 209 | { |
klauss | 120:770f00554b1e | 210 | v_cb->print_yourself (); |
klauss | 109:a5b8264ffbbc | 211 | print_v_cb = false; |
klauss | 109:a5b8264ffbbc | 212 | } |
klauss | 109:a5b8264ffbbc | 213 | |
klauss | 109:a5b8264ffbbc | 214 | if ( print_v_call ) |
klauss | 109:a5b8264ffbbc | 215 | { |
klauss | 109:a5b8264ffbbc | 216 | v_call->print_yourself (); |
klauss | 120:770f00554b1e | 217 | print_v_call = false; |
klauss | 109:a5b8264ffbbc | 218 | } |
klauss | 109:a5b8264ffbbc | 219 | |
klauss | 109:a5b8264ffbbc | 220 | if ( print_cb_var ) |
klauss | 109:a5b8264ffbbc | 221 | { |
klauss | 120:770f00554b1e | 222 | show_cb_content (); |
klauss | 109:a5b8264ffbbc | 223 | print_cb_var = false; |
klauss | 109:a5b8264ffbbc | 224 | } |
klauss | 109:a5b8264ffbbc | 225 | |
klauss | 109:a5b8264ffbbc | 226 | if ( print_cb_all ) |
klauss | 109:a5b8264ffbbc | 227 | { |
klauss | 120:770f00554b1e | 228 | show_cb_content_all (); |
klauss | 109:a5b8264ffbbc | 229 | print_cb_all = false; |
klauss | 109:a5b8264ffbbc | 230 | } |
klauss | 109:a5b8264ffbbc | 231 | |
klauss | 109:a5b8264ffbbc | 232 | if ( print_hex_cb_var ) |
klauss | 109:a5b8264ffbbc | 233 | { |
klauss | 120:770f00554b1e | 234 | show_hex_cb_content (); |
klauss | 109:a5b8264ffbbc | 235 | print_hex_cb_var = false; |
klauss | 81:3656f00ab3db | 236 | } |
klauss | 106:a34fcf9f0e02 | 237 | |
klauss | 109:a5b8264ffbbc | 238 | if ( print_hex_cb_all ) |
klauss | 109:a5b8264ffbbc | 239 | { |
klauss | 120:770f00554b1e | 240 | show_hex_cb_content_all (); |
klauss | 109:a5b8264ffbbc | 241 | print_hex_cb_all = false; |
klauss | 109:a5b8264ffbbc | 242 | } |
klauss | 106:a34fcf9f0e02 | 243 | |
klauss | 120:770f00554b1e | 244 | if ( print_sip_var ) |
klauss | 109:a5b8264ffbbc | 245 | { |
klauss | 120:770f00554b1e | 246 | show_cB_sip (); |
klauss | 120:770f00554b1e | 247 | print_sip_var = false; |
klauss | 120:770f00554b1e | 248 | } |
klauss | 109:a5b8264ffbbc | 249 | |
klauss | 120:770f00554b1e | 250 | if ( print_sip_all ) |
klauss | 120:770f00554b1e | 251 | { |
klauss | 120:770f00554b1e | 252 | show_cB_sip_all (); |
klauss | 120:770f00554b1e | 253 | print_sip_all = false; |
klauss | 120:770f00554b1e | 254 | } |
klauss | 120:770f00554b1e | 255 | |
klauss | 120:770f00554b1e | 256 | if ( print_hex_sip_var ) |
klauss | 120:770f00554b1e | 257 | { |
klauss | 120:770f00554b1e | 258 | show_cB_hex_sip (); |
klauss | 120:770f00554b1e | 259 | print_hex_sip_var = false; |
klauss | 120:770f00554b1e | 260 | } |
klauss | 109:a5b8264ffbbc | 261 | |
klauss | 109:a5b8264ffbbc | 262 | if( dcallshow_rtp == true ){ |
klauss | 120:770f00554b1e | 263 | show_rtp_on_call (); |
klauss | 109:a5b8264ffbbc | 264 | dcallshow_rtp = false; |
klauss | 109:a5b8264ffbbc | 265 | } |
klauss | 109:a5b8264ffbbc | 266 | |
klauss | 109:a5b8264ffbbc | 267 | if ( print_call_var ) |
klauss | 109:a5b8264ffbbc | 268 | { |
klauss | 120:770f00554b1e | 269 | show_call (); |
klauss | 109:a5b8264ffbbc | 270 | print_call_var = false; |
klauss | 120:770f00554b1e | 271 | |
klauss | 109:a5b8264ffbbc | 272 | } |
klauss | 109:a5b8264ffbbc | 273 | |
klauss | 109:a5b8264ffbbc | 274 | if ( print_hex_call_var ) |
klauss | 109:a5b8264ffbbc | 275 | { |
klauss | 120:770f00554b1e | 276 | show_hex_call (); |
klauss | 109:a5b8264ffbbc | 277 | print_hex_call_var = false; |
klauss | 109:a5b8264ffbbc | 278 | } |
klauss | 109:a5b8264ffbbc | 279 | |
klauss | 109:a5b8264ffbbc | 280 | |
klauss | 109:a5b8264ffbbc | 281 | if ( print_hex_rtp_var ) |
klauss | 109:a5b8264ffbbc | 282 | { |
klauss | 120:770f00554b1e | 283 | show_cb_rtp (); |
klauss | 109:a5b8264ffbbc | 284 | print_hex_rtp_var = false; |
klauss | 109:a5b8264ffbbc | 285 | } |
klauss | 109:a5b8264ffbbc | 286 | |
klauss | 109:a5b8264ffbbc | 287 | if ( print_rtp_var ) |
klauss | 109:a5b8264ffbbc | 288 | { |
klauss | 120:770f00554b1e | 289 | show_cb_hex_rtp (); |
klauss | 109:a5b8264ffbbc | 290 | print_rtp_var = false; |
klauss | 81:3656f00ab3db | 291 | } |
klauss | 91:c2a86b1f8aaa | 292 | |
klauss | 120:770f00554b1e | 293 | if( reset_cks == true ) |
klauss | 120:770f00554b1e | 294 | { |
klauss | 120:770f00554b1e | 295 | reset_stats_cks (); |
klauss | 120:770f00554b1e | 296 | pcks_s = true; |
klauss | 120:770f00554b1e | 297 | reset_cks = false; |
klauss | 120:770f00554b1e | 298 | } |
klauss | 120:770f00554b1e | 299 | |
klauss | 91:c2a86b1f8aaa | 300 | if( pcks_s == true ) { |
klauss | 120:770f00554b1e | 301 | show_cb_stats (); |
klauss | 81:3656f00ab3db | 302 | pcks_s = false; |
klauss | 81:3656f00ab3db | 303 | } |
klauss | 119:ee6a53069455 | 304 | |
klauss | 120:770f00554b1e | 305 | if( reset_missed_send_udp_pkg ) |
klauss | 120:770f00554b1e | 306 | { |
klauss | 120:770f00554b1e | 307 | reset_missed_send_udp (); |
klauss | 120:770f00554b1e | 308 | missed_send_udp_pkg = true; |
klauss | 119:ee6a53069455 | 309 | reset_missed_send_udp_pkg = false; |
klauss | 119:ee6a53069455 | 310 | } |
klauss | 119:ee6a53069455 | 311 | |
klauss | 120:770f00554b1e | 312 | |
klauss | 124:c1b6c893e1c3 | 313 | if ( missed_send_udp_pkg ) |
klauss | 119:ee6a53069455 | 314 | { |
klauss | 120:770f00554b1e | 315 | show_missed_send_udp_pkg (); |
klauss | 119:ee6a53069455 | 316 | missed_send_udp_pkg = false; |
klauss | 119:ee6a53069455 | 317 | } |
klauss | 124:c1b6c893e1c3 | 318 | |
klauss | 121:ee02790d00b7 | 319 | // usado pra test |
klauss | 126:1f90756250fb | 320 | if ( flood_bug_pkg ){ |
klauss | 100:09a23fcd3bdf | 321 | static int id = 0x10; |
klauss | 100:09a23fcd3bdf | 322 | if( id < 10 ) id = 0x0b; |
klauss | 119:ee6a53069455 | 323 | send2callboxes( build_cb_package( 5828, 5123, REGISTRY, |
klauss | 119:ee6a53069455 | 324 | ( char * )buffer, id++, CB_BUFFER_SIZE - VZ_HEADER_OFFSET, write_buffer ) ); |
klauss | 100:09a23fcd3bdf | 325 | } |
klauss | 100:09a23fcd3bdf | 326 | |
klauss | 126:1f90756250fb | 327 | if ( led_sync_timer.read() > 1 ) { |
klauss | 78:1353744f01e1 | 328 | led_sync_timer.reset(); |
klauss | 78:1353744f01e1 | 329 | led3 = !led3; |
klauss | 78:1353744f01e1 | 330 | CAB_LED = !CAB_LED; |
klauss | 78:1353744f01e1 | 331 | } |
klauss | 126:1f90756250fb | 332 | |
klauss | 126:1f90756250fb | 333 | switch( type ) |
klauss | 126:1f90756250fb | 334 | { |
klauss | 126:1f90756250fb | 335 | case DO_NOTHING :{} |
klauss | 91:c2a86b1f8aaa | 336 | break; |
klauss | 91:c2a86b1f8aaa | 337 | |
klauss | 126:1f90756250fb | 338 | case CB_BYE : |
klauss | 126:1f90756250fb | 339 | { |
klauss | 63:0d95da692bb4 | 340 | cb_bye_counter++; |
klauss | 121:ee02790d00b7 | 341 | Call_Box * cb = find_CB( v_cb, ext ); |
klauss | 91:c2a86b1f8aaa | 342 | if( cb != NULL ) { |
klauss | 126:1f90756250fb | 343 | if( debug_invite or debug_main ) debug_msg("[%d] Bye pkg - msg_id %d e pkg_id %d", ext, cb->get_msg_id(), data[ 0 ] ); |
klauss | 92:92df17f538a8 | 344 | |
klauss | 81:3656f00ab3db | 345 | bool already_removed = true; |
klauss | 119:ee6a53069455 | 346 | |
klauss | 119:ee6a53069455 | 347 | if( cb->get_status() != cb_idle ) { |
klauss | 119:ee6a53069455 | 348 | already_removed = false; |
klauss | 119:ee6a53069455 | 349 | |
klauss | 119:ee6a53069455 | 350 | data[ TIMESLICE_PLACE ] = 0; |
klauss | 119:ee6a53069455 | 351 | |
klauss | 119:ee6a53069455 | 352 | send2callboxes( build_cb_package( ext, port, CB_BYE, |
klauss | 126:1f90756250fb | 353 | ( char * )data, data[ 0 ] or_eq BIT7, CB_BUFFER_SIZE - VZ_HEADER_OFFSET, write_buffer ) ); |
klauss | 119:ee6a53069455 | 354 | |
klauss | 119:ee6a53069455 | 355 | ts->return_timeslice( cb->call_end () ); |
klauss | 119:ee6a53069455 | 356 | } |
klauss | 119:ee6a53069455 | 357 | |
klauss | 126:1f90756250fb | 358 | if( already_removed ) if( debug_main or debug_invite ) debug_msg( "[%d] Already removed from inviting queue", ext ); |
klauss | 119:ee6a53069455 | 359 | |
klauss | 119:ee6a53069455 | 360 | already_removed = true; |
klauss | 119:ee6a53069455 | 361 | |
klauss | 119:ee6a53069455 | 362 | for ( register uint8_t i = 0; i < v_call->size(); i++ ) |
klauss | 119:ee6a53069455 | 363 | { |
klauss | 0:4d17cd9c8f9d | 364 | VZ_call * call = (VZ_call *)v_call->get_element( i ); |
klauss | 119:ee6a53069455 | 365 | if( call->get_cb_ext() == ext ) |
klauss | 119:ee6a53069455 | 366 | { |
klauss | 81:3656f00ab3db | 367 | already_removed = false; |
klauss | 119:ee6a53069455 | 368 | |
klauss | 119:ee6a53069455 | 369 | data[ TIMESLICE_PLACE ] = 0; |
klauss | 91:c2a86b1f8aaa | 370 | |
klauss | 81:3656f00ab3db | 371 | v_call->remove_element( i ); |
klauss | 119:ee6a53069455 | 372 | |
klauss | 119:ee6a53069455 | 373 | send2callboxes( build_cb_package( ext, port, CB_BYE, |
klauss | 126:1f90756250fb | 374 | ( char * )data, data[ 0 ] or_eq BIT7, CB_BUFFER_SIZE - VZ_HEADER_OFFSET, write_buffer ) ); |
klauss | 117:e9facba9db27 | 375 | |
klauss | 3:cd9148672e25 | 376 | delete( call ); |
klauss | 119:ee6a53069455 | 377 | |
klauss | 119:ee6a53069455 | 378 | ts->return_timeslice( cb->call_end () ); |
klauss | 0:4d17cd9c8f9d | 379 | } |
klauss | 0:4d17cd9c8f9d | 380 | } |
klauss | 119:ee6a53069455 | 381 | |
klauss | 126:1f90756250fb | 382 | if( already_removed ) if( debug_main or debug_invite ) debug_msg( "[%d] Already removed from vector call", ext ); |
klauss | 82:f55d13babca0 | 383 | |
klauss | 119:ee6a53069455 | 384 | cb -> registry(); |
klauss | 119:ee6a53069455 | 385 | |
klauss | 126:1f90756250fb | 386 | } else if ( debug_invite or debug_main ) debug_msg("[%d] Bye from who ?", ext ); |
klauss | 91:c2a86b1f8aaa | 387 | } |
klauss | 91:c2a86b1f8aaa | 388 | break; |
klauss | 91:c2a86b1f8aaa | 389 | |
klauss | 126:1f90756250fb | 390 | case INVITE : |
klauss | 126:1f90756250fb | 391 | { |
klauss | 126:1f90756250fb | 392 | if ( drop_invite_pkg ) |
klauss | 126:1f90756250fb | 393 | { |
klauss | 119:ee6a53069455 | 394 | debug_msg("[%d] Dropando invite pck - msg id :: %d", ext, data[ 0 ] ); |
klauss | 114:472502b31a12 | 395 | break; |
klauss | 114:472502b31a12 | 396 | } |
klauss | 119:ee6a53069455 | 397 | |
klauss | 63:0d95da692bb4 | 398 | invite_counter++; |
klauss | 119:ee6a53069455 | 399 | |
klauss | 126:1f90756250fb | 400 | if ( debug_invite ) debug_msg ("[%d] Invite request", ext ); |
klauss | 119:ee6a53069455 | 401 | |
klauss | 122:480c44b0e205 | 402 | Call_Box * cb = find_CB ( v_cb, ext ); |
klauss | 119:ee6a53069455 | 403 | |
klauss | 122:480c44b0e205 | 404 | if ( cb == NULL ) |
klauss | 122:480c44b0e205 | 405 | { |
klauss | 122:480c44b0e205 | 406 | if ( v_cb -> size () < MAX_CB_IN_A_BRANCH ) |
klauss | 122:480c44b0e205 | 407 | { |
klauss | 126:1f90756250fb | 408 | if ( debug_main or debug_invite ) debug_msg ( "[%d] Adding CBx", ext ); |
klauss | 122:480c44b0e205 | 409 | cb = new Call_Box ( ext, port ); |
klauss | 91:c2a86b1f8aaa | 410 | |
klauss | 122:480c44b0e205 | 411 | if ( cb == NULL ) |
klauss | 122:480c44b0e205 | 412 | { |
klauss | 91:c2a86b1f8aaa | 413 | memory_is_over = true; |
klauss | 126:1f90756250fb | 414 | if ( debug_memory or debug_invite ) debug_msg ("[%d] Invite allocation cb fail", ext ); |
klauss | 91:c2a86b1f8aaa | 415 | } else { |
klauss | 122:480c44b0e205 | 416 | v_cb->add ( cb ); |
klauss | 91:c2a86b1f8aaa | 417 | } |
klauss | 89:0fe315117b00 | 418 | } |
klauss | 0:4d17cd9c8f9d | 419 | } |
klauss | 119:ee6a53069455 | 420 | |
klauss | 122:480c44b0e205 | 421 | if ( cb != NULL ) |
klauss | 119:ee6a53069455 | 422 | { |
klauss | 122:480c44b0e205 | 423 | cb -> invite_retry_count_reset (); |
klauss | 119:ee6a53069455 | 424 | |
klauss | 122:480c44b0e205 | 425 | cb -> set_msg_id ( data [ 0 ] ); |
klauss | 119:ee6a53069455 | 426 | |
klauss | 122:480c44b0e205 | 427 | if ( cb -> get_status () == cb_idle ) { |
klauss | 119:ee6a53069455 | 428 | cb -> call_config (); |
klauss | 126:1f90756250fb | 429 | if ( test_ts ) debug_msg ("TST::IDLE"); |
klauss | 119:ee6a53069455 | 430 | } else { |
klauss | 122:480c44b0e205 | 431 | data [ TIMESLICE_PLACE ] = cb -> get_timeslice (); |
klauss | 119:ee6a53069455 | 432 | |
klauss | 122:480c44b0e205 | 433 | cb -> set_invite_response_pending (); |
klauss | 126:1f90756250fb | 434 | |
klauss | 126:1f90756250fb | 435 | if ( test_ts ) debug_msg ("TST::%u ", data [ TIMESLICE_PLACE ]); |
klauss | 126:1f90756250fb | 436 | |
klauss | 126:1f90756250fb | 437 | send2callboxes ( build_cb_package ( ext, port, INVITE, |
klauss | 119:ee6a53069455 | 438 | ( char * )data, cb->msg_id_update (), CB_BUFFER_SIZE - VZ_HEADER_OFFSET, write_buffer ) ); |
klauss | 92:92df17f538a8 | 439 | } |
klauss | 119:ee6a53069455 | 440 | |
klauss | 121:ee02790d00b7 | 441 | invite_handler ( v_call, v_cb, ts, cb ); |
klauss | 87:679ee0d594a9 | 442 | } |
klauss | 91:c2a86b1f8aaa | 443 | } |
klauss | 126:1f90756250fb | 444 | |
klauss | 91:c2a86b1f8aaa | 445 | break; |
klauss | 120:770f00554b1e | 446 | |
klauss | 119:ee6a53069455 | 447 | case REGISTRY : { |
klauss | 63:0d95da692bb4 | 448 | registry_counter++; |
klauss | 121:ee02790d00b7 | 449 | Call_Box * cb = find_CB ( v_cb, ext ); |
klauss | 119:ee6a53069455 | 450 | |
klauss | 121:ee02790d00b7 | 451 | if ( cb == NULL ) |
klauss | 119:ee6a53069455 | 452 | { |
klauss | 119:ee6a53069455 | 453 | if( v_cb->size() < MAX_CB_IN_A_BRANCH ) |
klauss | 119:ee6a53069455 | 454 | { |
klauss | 119:ee6a53069455 | 455 | if( debug_main ) debug_msg("[%d] Adding Cbx", ext ); |
klauss | 91:c2a86b1f8aaa | 456 | cb = new Call_Box( ext, port ); |
klauss | 91:c2a86b1f8aaa | 457 | |
klauss | 91:c2a86b1f8aaa | 458 | if( cb == NULL ) { |
klauss | 91:c2a86b1f8aaa | 459 | memory_is_over = true; |
klauss | 119:ee6a53069455 | 460 | if( debug_memory ) debug_msg("[%d] Registry cb allocation fail", ext ); |
klauss | 91:c2a86b1f8aaa | 461 | } else { |
klauss | 91:c2a86b1f8aaa | 462 | v_cb->add( cb ); |
klauss | 119:ee6a53069455 | 463 | if( debug_main ) debug_msg("[%d] Added CBx", ext ); |
klauss | 91:c2a86b1f8aaa | 464 | } |
klauss | 87:679ee0d594a9 | 465 | } |
klauss | 0:4d17cd9c8f9d | 466 | } |
klauss | 119:ee6a53069455 | 467 | |
klauss | 121:ee02790d00b7 | 468 | if ( debug_main ) debug_msg("[%d %d] Registered", ext, port ); |
klauss | 91:c2a86b1f8aaa | 469 | |
klauss | 126:1f90756250fb | 470 | int registry_ret = -1; |
klauss | 126:1f90756250fb | 471 | |
klauss | 126:1f90756250fb | 472 | if ( cb != NULL ) registry_ret = cb -> registry (); |
klauss | 126:1f90756250fb | 473 | |
klauss | 126:1f90756250fb | 474 | if ( ( registry_ret > 0 ) and eth_status ) try_reconnect_with_eth (); |
klauss | 91:c2a86b1f8aaa | 475 | } |
klauss | 91:c2a86b1f8aaa | 476 | break; |
klauss | 120:770f00554b1e | 477 | |
klauss | 119:ee6a53069455 | 478 | case BOOT : { |
klauss | 63:0d95da692bb4 | 479 | boot_counter++; |
klauss | 99:e80850c51106 | 480 | if( debug_boot == true ){ |
klauss | 119:ee6a53069455 | 481 | send_msg("[%d %d] Boot pkg -- pkg-id %d", ext, port, data[ 0 ] ); |
klauss | 99:e80850c51106 | 482 | } |
klauss | 119:ee6a53069455 | 483 | send2callboxes( build_cb_package( ext, port, REGISTRY, |
klauss | 126:1f90756250fb | 484 | ( char * )data, data[ 0 ] bitor BIT7, CB_BUFFER_SIZE - VZ_HEADER_OFFSET, write_buffer ) ); |
klauss | 117:e9facba9db27 | 485 | } |
klauss | 117:e9facba9db27 | 486 | break; |
klauss | 117:e9facba9db27 | 487 | |
klauss | 119:ee6a53069455 | 488 | case FW : { |
klauss | 126:1f90756250fb | 489 | if ( debug_fw_print ) send_msg ("[%d %d]::FW pkg::", ext, port ); |
klauss | 126:1f90756250fb | 490 | fw_cbx_pkg ( ext, ( char *) buffer ); |
klauss | 99:e80850c51106 | 491 | } |
klauss | 99:e80850c51106 | 492 | break; |
klauss | 91:c2a86b1f8aaa | 493 | |
klauss | 119:ee6a53069455 | 494 | case BOOTLOADER_CBX : { |
klauss | 117:e9facba9db27 | 495 | uint16_t bl_cnt2 = 0; |
klauss | 117:e9facba9db27 | 496 | //char bl_send_buffer[ BL_SIZE + 2 ]; |
klauss | 117:e9facba9db27 | 497 | //int ret = bl_cbx_reply_to_eth( ext, ( char * )data ); |
klauss | 117:e9facba9db27 | 498 | //BLEUBA |
klauss | 117:e9facba9db27 | 499 | //pc.printf("\r\nCBX RESPONDEU BOOTLOADER!\r\n"); |
klauss | 117:e9facba9db27 | 500 | if (debug_bootloader) { |
klauss | 117:e9facba9db27 | 501 | pc.printf("\r\npacote CBX->HDR {"); |
klauss | 117:e9facba9db27 | 502 | for (bl_cnt2 = 0;bl_cnt2 < BL_SIZE + 1;bl_cnt2++) { |
klauss | 117:e9facba9db27 | 503 | if ((bl_cnt2 % 30) == 0) { |
klauss | 117:e9facba9db27 | 504 | pc.printf("\r\n "); |
klauss | 117:e9facba9db27 | 505 | pc.printf(hex16(bl_cnt2)); |
klauss | 117:e9facba9db27 | 506 | pc.printf(" : "); |
klauss | 117:e9facba9db27 | 507 | } |
klauss | 117:e9facba9db27 | 508 | pc.printf(hex8(data[bl_cnt2])); |
klauss | 117:e9facba9db27 | 509 | pc.printf(", "); |
klauss | 117:e9facba9db27 | 510 | } |
klauss | 117:e9facba9db27 | 511 | pc.printf("\r\n}"); |
klauss | 117:e9facba9db27 | 512 | } |
klauss | 67:cdedc64d9921 | 513 | bootloader_cbx_counter++; |
klauss | 117:e9facba9db27 | 514 | bl_send_buffer[0] = (char)(ext >> 8); |
klauss | 117:e9facba9db27 | 515 | bl_send_buffer[1] = (char)(ext & 0xff); |
klauss | 117:e9facba9db27 | 516 | for (bl_cnt2 = 0; bl_cnt2 < BL_SIZE; bl_cnt2++) { |
klauss | 117:e9facba9db27 | 517 | bl_send_buffer[bl_cnt2 + 2] = data[bl_cnt2 + 1]; |
klauss | 117:e9facba9db27 | 518 | } |
klauss | 117:e9facba9db27 | 519 | if (debug_bootloader) { |
klauss | 117:e9facba9db27 | 520 | pc.printf("\r\npacote HDR->SRV {"); |
klauss | 117:e9facba9db27 | 521 | for (bl_cnt2 = 0;bl_cnt2 < UDP_BL_SIZE;bl_cnt2++) { |
klauss | 117:e9facba9db27 | 522 | if ((bl_cnt2 % 30) == 0) { |
klauss | 117:e9facba9db27 | 523 | pc.printf("\r\n "); |
klauss | 117:e9facba9db27 | 524 | pc.printf(hex16(bl_cnt2)); |
klauss | 117:e9facba9db27 | 525 | pc.printf(" : "); |
klauss | 117:e9facba9db27 | 526 | } |
klauss | 117:e9facba9db27 | 527 | pc.printf(hex8(bl_send_buffer[bl_cnt2])); |
klauss | 117:e9facba9db27 | 528 | pc.printf(", "); |
klauss | 117:e9facba9db27 | 529 | } |
klauss | 117:e9facba9db27 | 530 | pc.printf("\r\n}"); |
klauss | 117:e9facba9db27 | 531 | } |
klauss | 117:e9facba9db27 | 532 | udp_bl_client.sendTo( udp_bl_server, bl_send_buffer, UDP_BL_SIZE ); |
klauss | 91:c2a86b1f8aaa | 533 | } |
klauss | 91:c2a86b1f8aaa | 534 | break; |
klauss | 91:c2a86b1f8aaa | 535 | |
klauss | 119:ee6a53069455 | 536 | case PROMPT : { |
klauss | 121:ee02790d00b7 | 537 | Call_Box * cb = find_CB( v_cb, ext ); |
klauss | 91:c2a86b1f8aaa | 538 | |
klauss | 91:c2a86b1f8aaa | 539 | if( cb == NULL ) { |
klauss | 119:ee6a53069455 | 540 | if( v_cb->size() < MAX_CB_IN_A_BRANCH ) { |
klauss | 119:ee6a53069455 | 541 | if( debug_main ) debug_msg("[%d] Adding Cbx", ext ); |
klauss | 119:ee6a53069455 | 542 | cb = new Call_Box( ext, port ); |
klauss | 119:ee6a53069455 | 543 | if( cb == NULL ){ |
klauss | 119:ee6a53069455 | 544 | memory_is_over = true; |
klauss | 119:ee6a53069455 | 545 | }else{ |
klauss | 119:ee6a53069455 | 546 | v_cb->add( cb ); |
klauss | 119:ee6a53069455 | 547 | if( debug_main ) debug_msg("[%d] Added CBx", ext ); |
klauss | 119:ee6a53069455 | 548 | } |
klauss | 87:679ee0d594a9 | 549 | } |
klauss | 48:195c97f12e8e | 550 | } |
klauss | 91:c2a86b1f8aaa | 551 | |
klauss | 126:1f90756250fb | 552 | if( cb!= NULL ) cb -> registry (); |
klauss | 91:c2a86b1f8aaa | 553 | |
klauss | 126:1f90756250fb | 554 | // if( ( xstrmatch( ( uint8_t * )data, ( uint8_t * )"ping" ) ) or xstrmatch ( ( uint8_t * )data, ( uint8_t * )"pong" ) ) |
klauss | 126:1f90756250fb | 555 | if ( ( strncasecmp ( ( const char * )data, "ping", 4 ) == 0 ) or ( strncasecmp ( ( const char * )data, "pong", 4 ) == 0 ) ) |
klauss | 126:1f90756250fb | 556 | { |
klauss | 119:ee6a53069455 | 557 | if( debug_ping ) send_msg( "[%d %d] Prompt pkg :: Ping", ext, port ); |
klauss | 126:1f90756250fb | 558 | } |
klauss | 126:1f90756250fb | 559 | else |
klauss | 126:1f90756250fb | 560 | { |
klauss | 78:1353744f01e1 | 561 | prompt_counter++; |
klauss | 119:ee6a53069455 | 562 | send_msg( "[%i, %i] Prompt pkg::", ext, port ); |
klauss | 91:c2a86b1f8aaa | 563 | for( register uint8_t i = 0; i < 32; i++ ) { |
klauss | 100:09a23fcd3bdf | 564 | if( debug_uart3 ) pc.printf("%c", data[ i ] ); |
klauss | 100:09a23fcd3bdf | 565 | if( i == 15 ) if( debug_uart3 ) pc.printf( "\r\n" ); |
klauss | 78:1353744f01e1 | 566 | } |
klauss | 100:09a23fcd3bdf | 567 | if( debug_uart3 ) pc.printf("\n\r> "); |
klauss | 91:c2a86b1f8aaa | 568 | |
klauss | 114:472502b31a12 | 569 | if( tcp_session ) { |
klauss | 119:ee6a53069455 | 570 | char aux[ CB_BUFFER_SIZE + 3 ]; |
klauss | 119:ee6a53069455 | 571 | strncpy( aux, (char * )data, CB_BUFFER_SIZE ); |
klauss | 78:1353744f01e1 | 572 | strcat( aux, "\n\r\0" ); |
klauss | 78:1353744f01e1 | 573 | tcp_client.send_all( ( char *)data, strlen( (char * )data ) ); |
klauss | 78:1353744f01e1 | 574 | tcp_client.send_all( "\r\n> ", strlen( "\r\n> " ) ); |
klauss | 78:1353744f01e1 | 575 | } |
klauss | 48:195c97f12e8e | 576 | } |
klauss | 91:c2a86b1f8aaa | 577 | } |
klauss | 91:c2a86b1f8aaa | 578 | break; |
klauss | 120:770f00554b1e | 579 | |
klauss | 119:ee6a53069455 | 580 | case AUDIO : { |
klauss | 63:0d95da692bb4 | 581 | audio_counter++; |
klauss | 119:ee6a53069455 | 582 | if ( received_audio_from_cb ) { |
klauss | 119:ee6a53069455 | 583 | debug_msg("[%d] audio pkg", ext ); |
klauss | 119:ee6a53069455 | 584 | } |
klauss | 119:ee6a53069455 | 585 | |
klauss | 126:1f90756250fb | 586 | VZ_call * call = find_Call ( v_call, ext ); |
klauss | 126:1f90756250fb | 587 | if ( call != NULL ) |
klauss | 126:1f90756250fb | 588 | { |
klauss | 126:1f90756250fb | 589 | if ( drop_rtp_from_cbx_pkg ) |
klauss | 126:1f90756250fb | 590 | { |
klauss | 114:472502b31a12 | 591 | led2 = !led2; |
klauss | 114:472502b31a12 | 592 | break; |
klauss | 119:ee6a53069455 | 593 | } else { |
klauss | 126:1f90756250fb | 594 | char * pkg = call -> build_eth_package ( data + 2 ); |
klauss | 126:1f90756250fb | 595 | call -> send_message ( pkg ); |
klauss | 126:1f90756250fb | 596 | call -> cbx_pkg_idle_timer_reset(); |
klauss | 114:472502b31a12 | 597 | } |
klauss | 119:ee6a53069455 | 598 | } |
klauss | 119:ee6a53069455 | 599 | |
klauss | 121:ee02790d00b7 | 600 | Call_Box * cb = find_CB( v_cb, ext ); |
klauss | 126:1f90756250fb | 601 | if ( cb != NULL ) |
klauss | 126:1f90756250fb | 602 | { |
klauss | 126:1f90756250fb | 603 | if ( cb -> get_invite_response() == false ) |
klauss | 126:1f90756250fb | 604 | { |
klauss | 126:1f90756250fb | 605 | cb -> set_invite_response_ok (); |
klauss | 126:1f90756250fb | 606 | cb -> invite_retry_count_reset (); |
klauss | 126:1f90756250fb | 607 | } |
klauss | 126:1f90756250fb | 608 | } else { |
klauss | 126:1f90756250fb | 609 | if( debug_main ) debug_msg("[%d] received missed package", ext ); |
klauss | 0:4d17cd9c8f9d | 610 | } |
klauss | 91:c2a86b1f8aaa | 611 | } |
klauss | 91:c2a86b1f8aaa | 612 | break; |
klauss | 114:472502b31a12 | 613 | }// fim switch |
klauss | 105:a930035b6556 | 614 | |
klauss | 120:770f00554b1e | 615 | // rajada |
klauss | 120:770f00554b1e | 616 | if( invite_retry_timer.read_ms() >= 20 ) |
klauss | 120:770f00554b1e | 617 | { |
klauss | 120:770f00554b1e | 618 | invite_ack_to_cb_handler ( v_cb, v_call ); |
klauss | 112:6ae726539ab9 | 619 | |
klauss | 120:770f00554b1e | 620 | invite_retry_timer.reset(); |
klauss | 120:770f00554b1e | 621 | } |
klauss | 120:770f00554b1e | 622 | |
klauss | 120:770f00554b1e | 623 | check_audio_from_ast ( v_cb, v_call ); |
klauss | 99:e80850c51106 | 624 | |
klauss | 120:770f00554b1e | 625 | wake_up_or_refresh_handler ( v_cb ); |
klauss | 117:e9facba9db27 | 626 | |
klauss | 120:770f00554b1e | 627 | check_sip_messages_from_ast ( v_cb, v_call ); |
klauss | 119:ee6a53069455 | 628 | |
klauss | 81:3656f00ab3db | 629 | /* Verifica andamento de ligações para eventualmente encerra-las por timeout */ |
klauss | 119:ee6a53069455 | 630 | call_manager( v_call, v_cb, ts ); |
klauss | 91:c2a86b1f8aaa | 631 | |
klauss | 81:3656f00ab3db | 632 | invite_handler( v_call, v_cb, ts, NULL ); |
klauss | 114:472502b31a12 | 633 | |
klauss | 120:770f00554b1e | 634 | check_for_runaways_ts ( v_cb, ts ); |
klauss | 112:6ae726539ab9 | 635 | |
klauss | 120:770f00554b1e | 636 | check_for_unwanted_rtp_ports ( v_cb ); |
klauss | 120:770f00554b1e | 637 | |
klauss | 72:895ca792c647 | 638 | tx_buffer_ring_buffer_handler(); |
klauss | 91:c2a86b1f8aaa | 639 | |
klauss | 119:ee6a53069455 | 640 | type = DO_NOTHING; |
klauss | 114:472502b31a12 | 641 | |
klauss | 81:3656f00ab3db | 642 | if( eth_status == 0 ) eth_wdt = ETH_CONNECT_TIMEOUT; |
klauss | 114:472502b31a12 | 643 | |
klauss | 91:c2a86b1f8aaa | 644 | if( wdt_timer.read() >= 1 ) { |
klauss | 122:480c44b0e205 | 645 | if ( -1 == wdt_update () ) debug_msg("Erro!!!!!"); |
klauss | 81:3656f00ab3db | 646 | wdt_timer.reset(); |
klauss | 114:472502b31a12 | 647 | } |
klauss | 114:472502b31a12 | 648 | |
klauss | 120:770f00554b1e | 649 | if( debug_wdt ) |
klauss | 120:770f00554b1e | 650 | { |
klauss | 120:770f00554b1e | 651 | show_wdt_status (); |
klauss | 81:3656f00ab3db | 652 | debug_wdt = false; |
klauss | 120:770f00554b1e | 653 | |
klauss | 114:472502b31a12 | 654 | } |
klauss | 123:1d395b5a4cad | 655 | |
klauss | 123:1d395b5a4cad | 656 | update_all_cb_timer ( v_cb ); |
klauss | 123:1d395b5a4cad | 657 | |
klauss | 124:c1b6c893e1c3 | 658 | if ( !dont_say_hello_again ) send_hello_to_cbx (); |
klauss | 124:c1b6c893e1c3 | 659 | |
klauss | 120:770f00554b1e | 660 | }// fim while |
klauss | 120:770f00554b1e | 661 | }// fim main \o/ |