![](/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
call_box.h@112:6ae726539ab9, 2015-04-13 (annotated)
- Committer:
- klauss
- Date:
- Mon Apr 13 12:16:21 2015 +0000
- Revision:
- 112:6ae726539ab9
- Parent:
- 109:a5b8264ffbbc
- Child:
- 113:db67ae00550e
colinas - ramo 3 - 2014 - 04 - 11
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
klauss | 69:65665afbad5d | 1 | /** |
klauss | 69:65665afbad5d | 2 | * @file call_box.h |
klauss | 69:65665afbad5d | 3 | * @Synopsis Implementa as funções de gerenciamento do Call_Box |
klauss | 69:65665afbad5d | 4 | * @author Jhonatan Casale |
klauss | 69:65665afbad5d | 5 | * @version 1 |
klauss | 69:65665afbad5d | 6 | * @date 2014-11-06 |
klauss | 69:65665afbad5d | 7 | * \class Call_Box |
klauss | 69:65665afbad5d | 8 | */ |
klauss | 0:4d17cd9c8f9d | 9 | #ifndef __CALL_BOX_H__ |
klauss | 0:4d17cd9c8f9d | 10 | #define __CALL_BOX_H__ |
klauss | 0:4d17cd9c8f9d | 11 | |
klauss | 0:4d17cd9c8f9d | 12 | #include "mbed.h" |
klauss | 0:4d17cd9c8f9d | 13 | #include "object.h" |
klauss | 0:4d17cd9c8f9d | 14 | #include "sip.h" |
klauss | 0:4d17cd9c8f9d | 15 | #include "debug.h" |
klauss | 85:b6f2dc1d0f4f | 16 | #include "shared_variables.h" |
klauss | 74:81c47fff88a5 | 17 | |
klauss | 78:1353744f01e1 | 18 | #define __RESQUEST_TIME__ 3 |
klauss | 99:e80850c51106 | 19 | #define MAX_INVITE_RETRY 1000 |
klauss | 92:92df17f538a8 | 20 | |
klauss | 78:1353744f01e1 | 21 | |
klauss | 78:1353744f01e1 | 22 | #define __TIMEOUT__ 250 |
klauss | 69:65665afbad5d | 23 | ///< O tempo que a Header demora para "pingar" o Call_Box para saber se esta tudo bem. |
klauss | 78:1353744f01e1 | 24 | #define __RANGE_TO_REGISTER__ 150 |
klauss | 78:1353744f01e1 | 25 | ///< Doc. later |
klauss | 78:1353744f01e1 | 26 | #define __TIME_TO_REGISTER__ __TIMEOUT__ - __RANGE_TO_REGISTER__ |
klauss | 78:1353744f01e1 | 27 | |
klauss | 78:1353744f01e1 | 28 | #define __CYCLES__ __TIME_TO_REGISTER__ / __RESQUEST_TIME__ // 200 // 3 ~ 66 |
klauss | 78:1353744f01e1 | 29 | |
klauss | 112:6ae726539ab9 | 30 | #define RTP_REQUEST_PORT_TIMEOUT 45 // 600 // seconds |
klauss | 112:6ae726539ab9 | 31 | |
klauss | 78:1353744f01e1 | 32 | #define REQUEST_REGISTRY -1 |
klauss | 78:1353744f01e1 | 33 | #define REQUEST_PEND -2 |
klauss | 78:1353744f01e1 | 34 | #define REQUEST_PING -4 |
klauss | 78:1353744f01e1 | 35 | |
klauss | 78:1353744f01e1 | 36 | ///< Valor usado como referencia para registro do equipamento CBx. |
klauss | 55:2f5e7374af9d | 37 | #define __MAX_ATTEMPTS__ 5 |
klauss | 69:65665afbad5d | 38 | ///< O numero maximo de vezes que a Header vai tentar pingar o Call_Box |
klauss | 69:65665afbad5d | 39 | #define __STEP__ 30 |
klauss | 69:65665afbad5d | 40 | ///< Usado para aumentar o intervalo entre cada ping, fora de uso atualmente. |
klauss | 0:4d17cd9c8f9d | 41 | #define __MAX_TIMEOUT__ __STEP__ * __MAX_ATTEMPTS__ |
klauss | 69:65665afbad5d | 42 | ///< Usado para limitar o tempo maximo de timeout do Call_Box sem responder o ping, fora de uso. |
klauss | 0:4d17cd9c8f9d | 43 | |
klauss | 0:4d17cd9c8f9d | 44 | #define cb_idle 1 |
klauss | 69:65665afbad5d | 45 | ///< Representa que o Call_Box esta disponivel |
klauss | 0:4d17cd9c8f9d | 46 | #define cb_ringing 2 |
klauss | 69:65665afbad5d | 47 | ///< Representa o Call_Box no status, discando. |
klauss | 0:4d17cd9c8f9d | 48 | #define cb_trying 3 |
klauss | 69:65665afbad5d | 49 | ///< Representa o Call_Box no status tentando concluir o pedido de ligação. |
klauss | 0:4d17cd9c8f9d | 50 | #define cb_on_call 4 |
klauss | 69:65665afbad5d | 51 | ///< Representa que o Call_Box já esta em uma ligação. |
klauss | 0:4d17cd9c8f9d | 52 | #define cb_busy 5 |
klauss | 69:65665afbad5d | 53 | ///< Representa que o Call_Box esta ocupado. |
klauss | 78:1353744f01e1 | 54 | #define cb_denied 6 |
klauss | 78:1353744f01e1 | 55 | ///< Representa que o pedido de invite do Call_Box foi negado. |
klauss | 0:4d17cd9c8f9d | 56 | |
klauss | 0:4d17cd9c8f9d | 57 | class Call_Box : public Object{ |
klauss | 0:4d17cd9c8f9d | 58 | private : |
klauss | 0:4d17cd9c8f9d | 59 | int ext; // ramal |
klauss | 0:4d17cd9c8f9d | 60 | int port; // porta |
klauss | 0:4d17cd9c8f9d | 61 | Timer t; |
klauss | 112:6ae726539ab9 | 62 | Timer rtp_timer; // usado pra controlar o timeout dos pedidos de porta rtp |
klauss | 0:4d17cd9c8f9d | 63 | uint8_t remaining_attempts; |
klauss | 0:4d17cd9c8f9d | 64 | float timeout; |
klauss | 0:4d17cd9c8f9d | 65 | uint8_t msg_id; |
klauss | 0:4d17cd9c8f9d | 66 | uint8_t timeslice; |
klauss | 78:1353744f01e1 | 67 | uint8_t next_aging_type; |
klauss | 81:3656f00ab3db | 68 | bool invite_response; |
klauss | 99:e80850c51106 | 69 | uint16_t invite_retry_count; |
klauss | 81:3656f00ab3db | 70 | bool bye_response; |
klauss | 78:1353744f01e1 | 71 | Timer seconds; |
klauss | 89:0fe315117b00 | 72 | int sip_socket_fd; |
klauss | 0:4d17cd9c8f9d | 73 | public : |
klauss | 69:65665afbad5d | 74 | /** |
klauss | 69:65665afbad5d | 75 | * @Synopsis Objeto Sip que será usado para tratativas com o servidor. |
klauss | 69:65665afbad5d | 76 | * |
klauss | 69:65665afbad5d | 77 | * \note Esse objeto é criado no construtor da classe Call_Box, com os mesmos parâmetros passados para o |
klauss | 69:65665afbad5d | 78 | * construtor da classe Call_Box. |
klauss | 69:65665afbad5d | 79 | */ |
klauss | 0:4d17cd9c8f9d | 80 | Sip * sip; |
klauss | 69:65665afbad5d | 81 | |
klauss | 69:65665afbad5d | 82 | /** |
klauss | 69:65665afbad5d | 83 | * @Synopsis Cria um objeto Call_Box |
klauss | 69:65665afbad5d | 84 | * |
klauss | 69:65665afbad5d | 85 | * @param ext Vincula o objeto ao ramal informado |
klauss | 69:65665afbad5d | 86 | * @param port Vincula o objeto a porto informada. |
klauss | 69:65665afbad5d | 87 | * |
klauss | 69:65665afbad5d | 88 | * Exemplo: |
klauss | 69:65665afbad5d | 89 | * @code |
klauss | 69:65665afbad5d | 90 | * ... |
klauss | 69:65665afbad5d | 91 | * int ext = 5121; |
klauss | 69:65665afbad5d | 92 | * int port = 5021; |
klauss | 69:65665afbad5d | 93 | * Call_Box * cb = new Call_Box( ext, port ); |
klauss | 69:65665afbad5d | 94 | * ... |
klauss | 69:65665afbad5d | 95 | * @endcode |
klauss | 69:65665afbad5d | 96 | */ |
klauss | 0:4d17cd9c8f9d | 97 | Call_Box( int ext, int port ); |
klauss | 69:65665afbad5d | 98 | |
klauss | 69:65665afbad5d | 99 | /** |
klauss | 69:65665afbad5d | 100 | * @Synopsis Destroi o objeto Call_Box |
klauss | 69:65665afbad5d | 101 | * |
klauss | 69:65665afbad5d | 102 | * Exemplo: |
klauss | 69:65665afbad5d | 103 | * @code |
klauss | 69:65665afbad5d | 104 | * ... |
klauss | 69:65665afbad5d | 105 | * delete( cb ); |
klauss | 69:65665afbad5d | 106 | * ... |
klauss | 69:65665afbad5d | 107 | * @endcode |
klauss | 69:65665afbad5d | 108 | * \note Deleta o objeto Sip nesse processo. |
klauss | 69:65665afbad5d | 109 | */ |
klauss | 0:4d17cd9c8f9d | 110 | ~Call_Box( void ); |
klauss | 0:4d17cd9c8f9d | 111 | |
klauss | 69:65665afbad5d | 112 | /** |
klauss | 69:65665afbad5d | 113 | * @Synopsis Representa o status do Call_Box. |
klauss | 69:65665afbad5d | 114 | * |
klauss | 69:65665afbad5d | 115 | * \note Este valor sempre é atualizado ( por convenção ) com o uso da macro set_status(a,b), definida em utils.h |
klauss | 69:65665afbad5d | 116 | */ |
klauss | 0:4d17cd9c8f9d | 117 | uint8_t status; |
klauss | 0:4d17cd9c8f9d | 118 | |
klauss | 69:65665afbad5d | 119 | /** |
klauss | 69:65665afbad5d | 120 | * @Synopsis Informa o ramal vinculado ao objeto Call_Box. |
klauss | 69:65665afbad5d | 121 | * |
klauss | 69:65665afbad5d | 122 | * @return O numero do ramal contido atualmente no objeto Call_Box |
klauss | 69:65665afbad5d | 123 | * |
klauss | 69:65665afbad5d | 124 | * Exemplo: |
klauss | 69:65665afbad5d | 125 | * @code |
klauss | 69:65665afbad5d | 126 | * ... |
klauss | 69:65665afbad5d | 127 | * int ext = cb->get_ext(); |
klauss | 69:65665afbad5d | 128 | * ... |
klauss | 69:65665afbad5d | 129 | * @endcode |
klauss | 69:65665afbad5d | 130 | */ |
klauss | 0:4d17cd9c8f9d | 131 | int get_ext( void ); |
klauss | 69:65665afbad5d | 132 | |
klauss | 69:65665afbad5d | 133 | /** |
klauss | 69:65665afbad5d | 134 | * @Synopsis Informa o numero da porta vinculada ao objeto Call_Box. |
klauss | 69:65665afbad5d | 135 | * |
klauss | 69:65665afbad5d | 136 | * @return O numero da porta contido atualmente no objeto Call_Box |
klauss | 69:65665afbad5d | 137 | * |
klauss | 69:65665afbad5d | 138 | * Exemplo: |
klauss | 69:65665afbad5d | 139 | * @code |
klauss | 69:65665afbad5d | 140 | * ... |
klauss | 69:65665afbad5d | 141 | * int port = cb->get_port(); |
klauss | 69:65665afbad5d | 142 | * ... |
klauss | 69:65665afbad5d | 143 | * @endcode |
klauss | 69:65665afbad5d | 144 | */ |
klauss | 0:4d17cd9c8f9d | 145 | int get_port( void ); |
klauss | 69:65665afbad5d | 146 | |
klauss | 69:65665afbad5d | 147 | /** |
klauss | 69:65665afbad5d | 148 | * @Synopsis Informa o tempo decorrido. |
klauss | 69:65665afbad5d | 149 | * \note O timer de cada objeto é iniciado no momento da criação do objeto Call_Box. |
klauss | 69:65665afbad5d | 150 | * |
klauss | 69:65665afbad5d | 151 | * @return O tempo decorrido desde a ultima vez que o timer do objeto foi resetado. |
klauss | 69:65665afbad5d | 152 | * |
klauss | 69:65665afbad5d | 153 | * Exemplo: |
klauss | 69:65665afbad5d | 154 | * @code |
klauss | 69:65665afbad5d | 155 | * ... |
klauss | 69:65665afbad5d | 156 | * float elapsed_time = cb->get_elapsed_time(); |
klauss | 69:65665afbad5d | 157 | * ... |
klauss | 69:65665afbad5d | 158 | * @endcode |
klauss | 69:65665afbad5d | 159 | */ |
klauss | 0:4d17cd9c8f9d | 160 | float get_elapsed_time( void ); |
klauss | 69:65665afbad5d | 161 | |
klauss | 69:65665afbad5d | 162 | /** |
klauss | 69:65665afbad5d | 163 | * @Synopsis Informa se o Call_Box esta inativo acima do tempo previsto. |
klauss | 69:65665afbad5d | 164 | * |
klauss | 69:65665afbad5d | 165 | * @retval True - Caso o timer do objeto seja maior que o definido. |
klauss | 69:65665afbad5d | 166 | * @retval False - Caso o timer do objeto seja menor que o definido.. |
klauss | 69:65665afbad5d | 167 | * |
klauss | 69:65665afbad5d | 168 | * Exemplo: |
klauss | 69:65665afbad5d | 169 | * @code |
klauss | 69:65665afbad5d | 170 | * ... |
klauss | 69:65665afbad5d | 171 | * printf(" %s ", ( cb->is_timeout() ) ? "Call_Box is outdated" : "Call_Box is okay" ); |
klauss | 69:65665afbad5d | 172 | * ... |
klauss | 69:65665afbad5d | 173 | * @endcode |
klauss | 69:65665afbad5d | 174 | */ |
klauss | 0:4d17cd9c8f9d | 175 | bool is_timeout( void ); |
klauss | 69:65665afbad5d | 176 | |
klauss | 69:65665afbad5d | 177 | /** |
klauss | 69:65665afbad5d | 178 | * @Synopsis Reconfigura o timeout de forma incremental, informando se ainda existe alguma tentativas de "ping" nesse Call_Box |
klauss | 69:65665afbad5d | 179 | * |
klauss | 69:65665afbad5d | 180 | * @return O numero de tentativas restantes de registro desse Call_Box. Retorno 0 significa que as tentativar acabaram. |
klauss | 69:65665afbad5d | 181 | * |
klauss | 69:65665afbad5d | 182 | * Exemplo: |
klauss | 69:65665afbad5d | 183 | * @code |
klauss | 69:65665afbad5d | 184 | * ... |
klauss | 78:1353744f01e1 | 185 | * if( cb->has_next_try() == 0x00 ){ |
klauss | 69:65665afbad5d | 186 | * // faça alguma coisa ... |
klauss | 69:65665afbad5d | 187 | * } |
klauss | 69:65665afbad5d | 188 | * ... |
klauss | 69:65665afbad5d | 189 | * @endcode |
klauss | 69:65665afbad5d | 190 | */ |
klauss | 78:1353744f01e1 | 191 | bool has_next_try( void ); |
klauss | 69:65665afbad5d | 192 | |
klauss | 69:65665afbad5d | 193 | /** |
klauss | 69:65665afbad5d | 194 | * @Synopsis Reseta o timer do objeto Call_Box. |
klauss | 69:65665afbad5d | 195 | * |
klauss | 69:65665afbad5d | 196 | * Exemplo: |
klauss | 69:65665afbad5d | 197 | * @code |
klauss | 69:65665afbad5d | 198 | * ... |
klauss | 69:65665afbad5d | 199 | * cb->reset_elapsed_time(); |
klauss | 69:65665afbad5d | 200 | * ... |
klauss | 69:65665afbad5d | 201 | * @endcode |
klauss | 69:65665afbad5d | 202 | */ |
klauss | 0:4d17cd9c8f9d | 203 | void reset_elapsed_time( void ); |
klauss | 69:65665afbad5d | 204 | |
klauss | 69:65665afbad5d | 205 | /** |
klauss | 69:65665afbad5d | 206 | * @Synopsis Invoca o método de registro deste Call_Box ( via objeto Sip vinculado ). |
klauss | 69:65665afbad5d | 207 | * |
klauss | 69:65665afbad5d | 208 | * Exemplo: |
klauss | 69:65665afbad5d | 209 | * @code |
klauss | 69:65665afbad5d | 210 | * ... |
klauss | 69:65665afbad5d | 211 | * cb->registry(); |
klauss | 69:65665afbad5d | 212 | * ... |
klauss | 69:65665afbad5d | 213 | * @endcode |
klauss | 69:65665afbad5d | 214 | */ |
klauss | 0:4d17cd9c8f9d | 215 | void registry( void ); |
klauss | 69:65665afbad5d | 216 | |
klauss | 69:65665afbad5d | 217 | /** |
klauss | 69:65665afbad5d | 218 | * @Synopsis Invoca o método de pedido de ligação. |
klauss | 69:65665afbad5d | 219 | * |
klauss | 69:65665afbad5d | 220 | * @return Um ponteiro para um objeto VZ_call quando o pedido foi aceito pelo server, NULL caso em que o pedido de invite foi |
klauss | 69:65665afbad5d | 221 | * negado pelo server ou aconteceu timeout do invite. |
klauss | 69:65665afbad5d | 222 | * |
klauss | 69:65665afbad5d | 223 | * Exemplo: |
klauss | 69:65665afbad5d | 224 | * @code |
klauss | 69:65665afbad5d | 225 | * ... |
klauss | 69:65665afbad5d | 226 | * VZ_call * call = cb->invite(); |
klauss | 69:65665afbad5d | 227 | * ... |
klauss | 69:65665afbad5d | 228 | * @endcode |
klauss | 69:65665afbad5d | 229 | */ |
klauss | 0:4d17cd9c8f9d | 230 | VZ_call * invite( void ); |
klauss | 69:65665afbad5d | 231 | |
klauss | 69:65665afbad5d | 232 | /** |
klauss | 69:65665afbad5d | 233 | * @Synopsis Valor inicial para preenchimento deste campo nos pacotes trocados entre Header/Call_Box. |
klauss | 69:65665afbad5d | 234 | * |
klauss | 69:65665afbad5d | 235 | * @param msg_id Seta o valor recebido como parâmetro na variável do objeto. |
klauss | 69:65665afbad5d | 236 | * |
klauss | 69:65665afbad5d | 237 | * Exemplo: |
klauss | 69:65665afbad5d | 238 | * @code |
klauss | 69:65665afbad5d | 239 | * ... |
klauss | 69:65665afbad5d | 240 | * cb->set_msg_id( 0x12 ); |
klauss | 69:65665afbad5d | 241 | * ... |
klauss | 69:65665afbad5d | 242 | * @endcode |
klauss | 69:65665afbad5d | 243 | */ |
klauss | 0:4d17cd9c8f9d | 244 | void set_msg_id( uint8_t msg_id ); |
klauss | 69:65665afbad5d | 245 | |
klauss | 69:65665afbad5d | 246 | /** |
klauss | 69:65665afbad5d | 247 | * @Synopsis Informa o numero atual de msg_id que será enviado na próxima mensagem desse Call_Box |
klauss | 69:65665afbad5d | 248 | * |
klauss | 69:65665afbad5d | 249 | * @return O valor atual de msg_id. |
klauss | 69:65665afbad5d | 250 | * |
klauss | 69:65665afbad5d | 251 | * Exemplo: |
klauss | 69:65665afbad5d | 252 | * @code |
klauss | 69:65665afbad5d | 253 | * ... |
klauss | 69:65665afbad5d | 254 | * uint8_t msg_id = cb->get_msg_id(); |
klauss | 69:65665afbad5d | 255 | * ... |
klauss | 69:65665afbad5d | 256 | * @endcode |
klauss | 69:65665afbad5d | 257 | */ |
klauss | 0:4d17cd9c8f9d | 258 | uint8_t get_msg_id( void ); |
klauss | 69:65665afbad5d | 259 | |
klauss | 69:65665afbad5d | 260 | |
klauss | 69:65665afbad5d | 261 | /** |
klauss | 69:65665afbad5d | 262 | * @Synopsis Armazena o valor de Timeslice atualmente em uso pelo Call_Box. |
klauss | 69:65665afbad5d | 263 | * |
klauss | 69:65665afbad5d | 264 | * @param timeslice O valor que corresponde ao Timeslice disponivel para comunição do Call_Box |
klauss | 69:65665afbad5d | 265 | * |
klauss | 69:65665afbad5d | 266 | * Exemplo: |
klauss | 69:65665afbad5d | 267 | * @code |
klauss | 69:65665afbad5d | 268 | * ... |
klauss | 69:65665afbad5d | 269 | * Timeslice * ts = new Timeslice(); |
klauss | 69:65665afbad5d | 270 | * cb->set_timeslice( ts->get_timeslice() ); |
klauss | 69:65665afbad5d | 271 | * ... |
klauss | 69:65665afbad5d | 272 | * @endcode |
klauss | 69:65665afbad5d | 273 | */ |
klauss | 69:65665afbad5d | 274 | void set_timeslice( uint8_t timeslice ); |
klauss | 69:65665afbad5d | 275 | |
klauss | 69:65665afbad5d | 276 | |
klauss | 69:65665afbad5d | 277 | /** |
klauss | 69:65665afbad5d | 278 | * @Synopsis Informa o timeslice ocupado atualmente pelo Call_Box. |
klauss | 69:65665afbad5d | 279 | * |
klauss | 69:65665afbad5d | 280 | * @return O valor do timeslice em uso pelo Call_Box. |
klauss | 69:65665afbad5d | 281 | * |
klauss | 69:65665afbad5d | 282 | * Exemplo: |
klauss | 69:65665afbad5d | 283 | * @code |
klauss | 69:65665afbad5d | 284 | * ... |
klauss | 69:65665afbad5d | 285 | * uint8_t ts = cb->get_timeslice(); |
klauss | 69:65665afbad5d | 286 | * ... |
klauss | 69:65665afbad5d | 287 | * @endcode |
klauss | 69:65665afbad5d | 288 | */ |
klauss | 0:4d17cd9c8f9d | 289 | uint8_t get_timeslice( void ); |
klauss | 69:65665afbad5d | 290 | |
klauss | 0:4d17cd9c8f9d | 291 | //void set_sip( Sip * sip ); |
klauss | 69:65665afbad5d | 292 | |
klauss | 69:65665afbad5d | 293 | /** |
klauss | 69:65665afbad5d | 294 | * @Synopsis Faz chamada ( via objeto Sip vinculado ) a função que irá escutar a porta SIP associada neste Call_Box. |
klauss | 69:65665afbad5d | 295 | * |
klauss | 69:65665afbad5d | 296 | * @return Um valor menor que zero se a execução falhar, igual a zero se a execução for bem sucedida e nenhum dado foi |
klauss | 69:65665afbad5d | 297 | * recebido, ou quando a execução foi bem sucedida e nenhuma mensagem que demanda tramamento foi recebida; um numero |
klauss | 69:65665afbad5d | 298 | * maior do que zero, caso tenha recebido um pacote do tipo "bye" do servidor; este numero corresponde ao ramal do Call_Box. |
klauss | 69:65665afbad5d | 299 | * |
klauss | 69:65665afbad5d | 300 | * Exemplo: |
klauss | 69:65665afbad5d | 301 | * @code |
klauss | 69:65665afbad5d | 302 | * ... |
klauss | 69:65665afbad5d | 303 | * int returned_value = cb->listen_SIP_server(); |
klauss | 69:65665afbad5d | 304 | * ... |
klauss | 69:65665afbad5d | 305 | * @endcode |
klauss | 69:65665afbad5d | 306 | */ |
klauss | 0:4d17cd9c8f9d | 307 | int listen_SIP_server( void ); |
klauss | 69:65665afbad5d | 308 | |
klauss | 69:65665afbad5d | 309 | /** |
klauss | 69:65665afbad5d | 310 | * @Synopsis Invoca ( no objeto Sip ) o método de pedido de "desregistro". |
klauss | 69:65665afbad5d | 311 | * |
klauss | 69:65665afbad5d | 312 | * Exemplo: |
klauss | 69:65665afbad5d | 313 | * @code |
klauss | 69:65665afbad5d | 314 | * ... |
klauss | 69:65665afbad5d | 315 | * cb->unregistry(); |
klauss | 69:65665afbad5d | 316 | * ... |
klauss | 69:65665afbad5d | 317 | * @endcode |
klauss | 69:65665afbad5d | 318 | */ |
klauss | 0:4d17cd9c8f9d | 319 | void unregistry( void ); |
klauss | 69:65665afbad5d | 320 | |
klauss | 69:65665afbad5d | 321 | /** |
klauss | 69:65665afbad5d | 322 | * @Synopsis Invoca ( via objeto Sip ) o método de envio do pacote de "bye" para o servidor. |
klauss | 69:65665afbad5d | 323 | * |
klauss | 69:65665afbad5d | 324 | * Exemplo: |
klauss | 69:65665afbad5d | 325 | * @code |
klauss | 69:65665afbad5d | 326 | * ... |
klauss | 69:65665afbad5d | 327 | * cb->send_bye(); |
klauss | 69:65665afbad5d | 328 | * ... |
klauss | 69:65665afbad5d | 329 | * @endcode |
klauss | 69:65665afbad5d | 330 | */ |
klauss | 0:4d17cd9c8f9d | 331 | void send_bye( void ); |
klauss | 69:65665afbad5d | 332 | |
klauss | 69:65665afbad5d | 333 | /** |
klauss | 69:65665afbad5d | 334 | * @Synopsis Destroi o objeto Sip vinculado ao Call_Box, criando e vinculando outro em seguida. |
klauss | 69:65665afbad5d | 335 | * |
klauss | 69:65665afbad5d | 336 | * Exemplo: |
klauss | 69:65665afbad5d | 337 | * @code |
klauss | 69:65665afbad5d | 338 | * ... |
klauss | 69:65665afbad5d | 339 | * cb->reset_sip(); |
klauss | 69:65665afbad5d | 340 | * ... |
klauss | 69:65665afbad5d | 341 | * @endcode |
klauss | 69:65665afbad5d | 342 | */ |
klauss | 1:a1758104fa1d | 343 | void reset_sip( void ); |
klauss | 69:65665afbad5d | 344 | |
klauss | 69:65665afbad5d | 345 | /** |
klauss | 69:65665afbad5d | 346 | * @Synopsis Altera o valor do status do objeto Sip vinculado. |
klauss | 69:65665afbad5d | 347 | * |
klauss | 69:65665afbad5d | 348 | * @param status O novo valor de status que será associado ao objeto Sip vinculado ao Call_Box. |
klauss | 69:65665afbad5d | 349 | * |
klauss | 69:65665afbad5d | 350 | * Exemplo: |
klauss | 69:65665afbad5d | 351 | * @code |
klauss | 69:65665afbad5d | 352 | * ... |
klauss | 69:65665afbad5d | 353 | * cb->set_sip_status( 0 ); |
klauss | 69:65665afbad5d | 354 | * ... |
klauss | 69:65665afbad5d | 355 | * @endcode |
klauss | 69:65665afbad5d | 356 | */ |
klauss | 14:22a35f575502 | 357 | void set_sip_status( int status ); |
klauss | 69:65665afbad5d | 358 | |
klauss | 69:65665afbad5d | 359 | /** |
klauss | 69:65665afbad5d | 360 | * @Synopsis Inicia ( ou re-inicia ) o Timer do objeto Call_Box. |
klauss | 69:65665afbad5d | 361 | * |
klauss | 69:65665afbad5d | 362 | * Exemplo: |
klauss | 69:65665afbad5d | 363 | * @code |
klauss | 69:65665afbad5d | 364 | * ... |
klauss | 69:65665afbad5d | 365 | * cb->re_start_timer(); |
klauss | 69:65665afbad5d | 366 | * ... |
klauss | 69:65665afbad5d | 367 | * @endcode |
klauss | 69:65665afbad5d | 368 | */ |
klauss | 78:1353744f01e1 | 369 | void re_start_timer( void ); |
klauss | 78:1353744f01e1 | 370 | |
klauss | 78:1353744f01e1 | 371 | |
klauss | 78:1353744f01e1 | 372 | int get_sip_status( void ); |
klauss | 78:1353744f01e1 | 373 | int set_sip_status( uint8_t sip_status ); |
klauss | 78:1353744f01e1 | 374 | |
klauss | 78:1353744f01e1 | 375 | int get_status( void ); |
klauss | 78:1353744f01e1 | 376 | void cb_set_status( uint8_t status ); |
klauss | 78:1353744f01e1 | 377 | |
klauss | 78:1353744f01e1 | 378 | int8_t get_next_aging_type( void ); |
klauss | 81:3656f00ab3db | 379 | |
klauss | 92:92df17f538a8 | 380 | //void set_first_invite_response_ok( void ); |
klauss | 92:92df17f538a8 | 381 | //void set_first_invite_response_pending( void ); |
klauss | 92:92df17f538a8 | 382 | //bool get_first_invite_response( void ); |
klauss | 92:92df17f538a8 | 383 | |
klauss | 81:3656f00ab3db | 384 | void set_invite_response_ok( void ); |
klauss | 81:3656f00ab3db | 385 | void set_invite_response_pending( void ); |
klauss | 81:3656f00ab3db | 386 | bool get_invite_response( void ); |
klauss | 81:3656f00ab3db | 387 | |
klauss | 81:3656f00ab3db | 388 | void set_bye_response_ok( void ); |
klauss | 81:3656f00ab3db | 389 | void set_bye_response_pending( void ); |
klauss | 81:3656f00ab3db | 390 | bool get_bye_response( void ); |
klauss | 89:0fe315117b00 | 391 | |
klauss | 89:0fe315117b00 | 392 | int get_sip_socket_fd( void ); |
klauss | 91:c2a86b1f8aaa | 393 | int sip_udp_incomming_pkg( void ); |
klauss | 91:c2a86b1f8aaa | 394 | void reset_cb_status( void ); |
klauss | 92:92df17f538a8 | 395 | void invite_retry_count_reset( void ); |
klauss | 92:92df17f538a8 | 396 | uint8_t get_invite_retry_count( void ); |
klauss | 97:8985817e8847 | 397 | int get_sip_ext( void ); |
klauss | 97:8985817e8847 | 398 | int get_sip_port( void ); |
klauss | 99:e80850c51106 | 399 | int get_timer( void ); |
klauss | 108:18a3702650f3 | 400 | int get_rtp_port ( void ); |
klauss | 109:a5b8264ffbbc | 401 | int print_yourself ( void ); |
klauss | 108:18a3702650f3 | 402 | void set_rtp_port ( int ); |
klauss | 112:6ae726539ab9 | 403 | void init_rtp_timer ( void ); |
klauss | 112:6ae726539ab9 | 404 | void reset_rtp_timer ( void ); |
klauss | 112:6ae726539ab9 | 405 | bool is_rtp_timer_timeout ( void ); |
klauss | 112:6ae726539ab9 | 406 | int get_rtp_timer ( void ); |
klauss | 0:4d17cd9c8f9d | 407 | }; |
klauss | 0:4d17cd9c8f9d | 408 | #endif |