| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
|
| 32 |
|
| 33 |
#include "asterisk.h" |
| 34 |
|
| 35 |
#include "asterisk/logger.h" |
| 36 |
#include "asterisk/logger_category.h" |
| 37 |
#include "asterisk/_private.h" |
| 38 |
#include "asterisk/stun.h" |
| 39 |
#include "asterisk/cli.h" |
| 40 |
#include "asterisk/utils.h" |
| 41 |
#include "asterisk/channel.h" |
| 42 |
|
| 43 |
|
| 44 |
|
| 45 |
|
| 46 |
|
| 47 |
|
| 48 |
|
| 49 |
|
| 50 |
|
| 51 |
|
| 52 |
|
| 53 |
|
| 54 |
|
| 55 |
|
| 56 |
|
| 57 |
|
| 58 |
|
| 59 |
|
| 60 |
|
| 61 |
|
| 62 |
|
| 63 |
|
| 64 |
|
| 65 |
|
| 66 |
|
| 67 |
|
| 68 |
|
| 69 |
typedef struct { unsigned int id[4]; } __attribute__((packed)) stun_trans_id; |
| 70 |
|
| 71 |
struct stun_header { |
| 72 |
unsigned short msgtype; |
| 73 |
unsigned short msglen; |
| 74 |
stun_trans_id id; |
| 75 |
unsigned char ies[0]; |
| 76 |
} __attribute__((packed)); |
| 77 |
|
| 78 |
struct stun_attr { |
| 79 |
unsigned short attr; |
| 80 |
unsigned short len; |
| 81 |
unsigned char value[0]; |
| 82 |
} __attribute__((packed)); |
| 83 |
|
| 84 |
|
| 85 |
|
| 86 |
|
| 87 |
struct stun_addr { |
| 88 |
unsigned char unused; |
| 89 |
unsigned char family; |
| 90 |
unsigned short port; |
| 91 |
unsigned int addr; |
| 92 |
} __attribute__((packed)); |
| 93 |
|
| 94 |
|
| 95 |
|
| 96 |
|
| 97 |
|
| 98 |
|
| 99 |
|
| 100 |
|
| 101 |
#define STUN_BINDREQ 0x0001 |
| 102 |
#define STUN_BINDRESP 0x0101 |
| 103 |
#define STUN_BINDERR 0x0111 |
| 104 |
#define STUN_SECREQ 0x0002 |
| 105 |
#define STUN_SECRESP 0x0102 |
| 106 |
#define STUN_SECERR 0x0112 |
| 107 |
|
| 108 |
|
| 109 |
|
| 110 |
|
| 111 |
#define STUN_MAPPED_ADDRESS 0x0001 |
| 112 |
#define STUN_RESPONSE_ADDRESS 0x0002 |
| 113 |
#define STUN_CHANGE_REQUEST 0x0003 |
| 114 |
#define STUN_SOURCE_ADDRESS 0x0004 |
| 115 |
#define STUN_CHANGED_ADDRESS 0x0005 |
| 116 |
#define STUN_USERNAME 0x0006 |
| 117 |
#define STUN_PASSWORD 0x0007 |
| 118 |
#define STUN_MESSAGE_INTEGRITY 0x0008 |
| 119 |
#define STUN_ERROR_CODE 0x0009 |
| 120 |
#define STUN_UNKNOWN_ATTRIBUTES 0x000a |
| 121 |
#define STUN_REFLECTED_FROM 0x000b |
| 122 |
|
| 123 |
#define STUN_MAX_RETRIES 3 |
| 124 |
|
| 125 |
|
| 126 |
static const char *stun_msg2str(int msg) |
| 127 |
{ |
| 128 |
switch (msg) { |
| 129 |
case STUN_BINDREQ: |
| 130 |
return "Binding Request"; |
| 131 |
case STUN_BINDRESP: |
| 132 |
return "Binding Response"; |
| 133 |
case STUN_BINDERR: |
| 134 |
return "Binding Error Response"; |
| 135 |
case STUN_SECREQ: |
| 136 |
return "Shared Secret Request"; |
| 137 |
case STUN_SECRESP: |
| 138 |
return "Shared Secret Response"; |
| 139 |
case STUN_SECERR: |
| 140 |
return "Shared Secret Error Response"; |
| 141 |
} |
| 142 |
return "Non-RFC3489 Message"; |
| 143 |
} |
| 144 |
|
| 145 |
|
| 146 |
static const char *stun_attr2str(int msg) |
| 147 |
{ |
| 148 |
switch (msg) { |
| 149 |
case STUN_MAPPED_ADDRESS: |
| 150 |
return "Mapped Address"; |
| 151 |
case STUN_RESPONSE_ADDRESS: |
| 152 |
return "Response Address"; |
| 153 |
case STUN_CHANGE_REQUEST: |
| 154 |
return "Change Request"; |
| 155 |
case STUN_SOURCE_ADDRESS: |
| 156 |
return "Source Address"; |
| 157 |
case STUN_CHANGED_ADDRESS: |
| 158 |
return "Changed Address"; |
| 159 |
case STUN_USERNAME: |
| 160 |
return "Username"; |
| 161 |
case STUN_PASSWORD: |
| 162 |
return "Password"; |
| 163 |
case STUN_MESSAGE_INTEGRITY: |
| 164 |
return "Message Integrity"; |
| 165 |
case STUN_ERROR_CODE: |
| 166 |
return "Error Code"; |
| 167 |
case STUN_UNKNOWN_ATTRIBUTES: |
| 168 |
return "Unknown Attributes"; |
| 169 |
case STUN_REFLECTED_FROM: |
| 170 |
return "Reflected From"; |
| 171 |
} |
| 172 |
return "Non-RFC3489 Attribute"; |
| 173 |
} |
| 174 |
|
| 175 |
|
| 176 |
struct stun_state { |
| 177 |
const char *username; |
| 178 |
const char *password; |
| 179 |
}; |
| 180 |
|
| 181 |
static int stun_process_attr(struct stun_state *state, struct stun_attr *attr) |
| 182 |
{ |
| 183 |
if (ast_debug_stun_packet_is_allowed) { |
| 184 |
ast_verbose("Found STUN Attribute %s (%04x), length %d\n", |
| 185 |
stun_attr2str(ntohs(attr->attr)), (unsigned)ntohs(attr->attr), ntohs(attr->len)); |
| 186 |
} |
| 187 |
switch (ntohs(attr->attr)) { |
| 188 |
case STUN_USERNAME: |
| 189 |
state->username = (const char *) (attr->value); |
| 190 |
break; |
| 191 |
case STUN_PASSWORD: |
| 192 |
state->password = (const char *) (attr->value); |
| 193 |
break; |
| 194 |
default: |
| 195 |
if (ast_debug_stun_packet_is_allowed) { |
| 196 |
ast_verbose("Ignoring STUN attribute %s (%04x), length %d\n", |
| 197 |
stun_attr2str(ntohs(attr->attr)), (unsigned)ntohs(attr->attr), ntohs(attr->len)); |
| 198 |
} |
| 199 |
} |
| 200 |
|
| 201 |
return 0; |
| 202 |
} |
| 203 |
|
| 204 |
|
| 205 |
static void append_attr_string(struct stun_attr **attr, int attrval, const char *s, int *len, int *left) |
| 206 |
{ |
| 207 |
int str_length = strlen(s); |
| 208 |
int attr_length = str_length + ((~(str_length - 1)) & 0x3); |
| 209 |
int size = sizeof(**attr) + attr_length; |
| 210 |
if (*left > size) { |
| 211 |
(*attr)->attr = htons(attrval); |
| 212 |
(*attr)->len = htons(attr_length); |
| 213 |
memcpy((*attr)->value, s, str_length); |
| 214 |
memset((*attr)->value + str_length, 0, attr_length - str_length); |
| 215 |
(*attr) = (struct stun_attr *)((*attr)->value + attr_length); |
| 216 |
*len += size; |
| 217 |
*left -= size; |
| 218 |
} |
| 219 |
} |
| 220 |
|
| 221 |
|
| 222 |
static void append_attr_address(struct stun_attr **attr, int attrval, struct sockaddr_in *sin, int *len, int *left) |
| 223 |
{ |
| 224 |
int size = sizeof(**attr) + 8; |
| 225 |
struct stun_addr *addr; |
| 226 |
if (*left > size) { |
| 227 |
(*attr)->attr = htons(attrval); |
| 228 |
(*attr)->len = htons(8); |
| 229 |
addr = (struct stun_addr *)((*attr)->value); |
| 230 |
addr->unused = 0; |
| 231 |
addr->family = 0x01; |
| 232 |
addr->port = sin->sin_port; |
| 233 |
addr->addr = sin->sin_addr.s_addr; |
| 234 |
(*attr) = (struct stun_attr *)((*attr)->value + 8); |
| 235 |
*len += size; |
| 236 |
*left -= size; |
| 237 |
} |
| 238 |
} |
| 239 |
|
| 240 |
static void handle_stun_timeout(int retry, struct sockaddr_in *dst) |
| 241 |
{ |
| 242 |
char *stun_destination = ""; |
| 243 |
if (dst) { |
| 244 |
ast_asprintf(&stun_destination, "to '%s' ", ast_inet_ntoa(dst->sin_addr)); |
| 245 |
} |
| 246 |
if (retry < STUN_MAX_RETRIES) { |
| 247 |
ast_log(LOG_NOTICE, |
| 248 |
"Attempt %d to send STUN request %stimed out.\n", |
| 249 |
retry, |
| 250 |
stun_destination); |
| 251 |
} else { |
| 252 |
ast_log(LOG_WARNING, |
| 253 |
"Attempt %d to send STUN request %stimed out. " |
| 254 |
"Check that the server address is correct and reachable.\n", |
| 255 |
retry, |
| 256 |
stun_destination); |
| 257 |
} |
| 258 |
if (dst) { |
| 259 |
ast_free(stun_destination); |
| 260 |
} |
| 261 |
} |
| 262 |
|
| 263 |
|
| 264 |
static int stun_send(int s, struct sockaddr_in *dst, struct stun_header *resp) |
| 265 |
{ |
| 266 |
return sendto(s, resp, ntohs(resp->msglen) + sizeof(*resp), 0, |
| 267 |
(struct sockaddr *)dst, sizeof(*dst)); |
| 268 |
} |
| 269 |
|
| 270 |
|
| 271 |
|
| 272 |
|
| 273 |
|
| 274 |
|
| 275 |
|
| 276 |
|
| 277 |
|
| 278 |
|
| 279 |
|
| 280 |
static int stun_id_cmp(stun_trans_id *left, stun_trans_id *right) |
| 281 |
{ |
| 282 |
return memcmp(left, right, sizeof(*left)); |
| 283 |
} |
| 284 |
|
| 285 |
|
| 286 |
static void stun_req_id(struct stun_header *req) |
| 287 |
{ |
| 288 |
int x; |
| 289 |
for (x = 0; x < 4; x++) |
| 290 |
req->id.id[x] = ast_random(); |
| 291 |
} |
| 292 |
|
| 293 |
int ast_stun_handle_packet(int s, struct sockaddr_in *src, unsigned char *data, size_t len, stun_cb_f *stun_cb, void *arg) |
| 294 |
{ |
| 295 |
struct stun_header *hdr = (struct stun_header *)data; |
| 296 |
struct stun_attr *attr; |
| 297 |
struct stun_state st; |
| 298 |
int ret = AST_STUN_IGNORE; |
| 299 |
int x; |
| 300 |
|
| 301 |
|
| 302 |
|
| 303 |
|
| 304 |
|
| 305 |
if (len < sizeof(struct stun_header)) { |
| 306 |
ast_debug_stun(1, "Runt STUN packet (only %d, wanting at least %d)\n", (int) len, (int) sizeof(struct stun_header)); |
| 307 |
return -1; |
| 308 |
} |
| 309 |
len -= sizeof(struct stun_header); |
| 310 |
data += sizeof(struct stun_header); |
| 311 |
x = ntohs(hdr->msglen); |
| 312 |
if (ast_debug_stun_packet_is_allowed) |
| 313 |
ast_verbose("STUN Packet, msg %s (%04x), length: %d\n", stun_msg2str(ntohs(hdr->msgtype)), (unsigned)ntohs(hdr->msgtype), x); |
| 314 |
if (x > len) { |
| 315 |
ast_debug_stun(1, "Scrambled STUN packet length (got %d, expecting %d)\n", x, (int)len); |
| 316 |
} else |
| 317 |
len = x; |
| 318 |
memset(&st, 0, sizeof(st)); |
| 319 |
while (len) { |
| 320 |
if (len < sizeof(struct stun_attr)) { |
| 321 |
ast_debug_stun(1, "Runt Attribute (got %d, expecting %d)\n", (int)len, (int) sizeof(struct stun_attr)); |
| 322 |
break; |
| 323 |
} |
| 324 |
attr = (struct stun_attr *)data; |
| 325 |
|
| 326 |
x = ntohs(attr->len) + sizeof(struct stun_attr); |
| 327 |
if (x > len) { |
| 328 |
ast_debug_stun(1, "Inconsistent Attribute (length %d exceeds remaining msg len %d)\n", x, (int)len); |
| 329 |
break; |
| 330 |
} |
| 331 |
if (stun_cb) |
| 332 |
stun_cb(attr, arg); |
| 333 |
if (stun_process_attr(&st, attr)) { |
| 334 |
ast_debug_stun(1, "Failed to handle attribute %s (%04x)\n", stun_attr2str(ntohs(attr->attr)), (unsigned)ntohs(attr->attr)); |
| 335 |
break; |
| 336 |
} |
| 337 |
|
| 338 |
|
| 339 |
|
| 340 |
attr->attr = 0; |
| 341 |
data += x; |
| 342 |
len -= x; |
| 343 |
} |
| 344 |
|
| 345 |
|
| 346 |
|
| 347 |
|
| 348 |
|
| 349 |
|
| 350 |
*data = '\0'; |
| 351 |
|
| 352 |
|
| 353 |
|
| 354 |
|
| 355 |
if (len == 0) { |
| 356 |
unsigned char respdata[1024]; |
| 357 |
struct stun_header *resp = (struct stun_header *)respdata; |
| 358 |
int resplen = 0; |
| 359 |
int respleft = sizeof(respdata) - sizeof(struct stun_header); |
| 360 |
char combined[33]; |
| 361 |
|
| 362 |
resp->id = hdr->id; |
| 363 |
resp->msgtype = 0; |
| 364 |
resp->msglen = 0; |
| 365 |
attr = (struct stun_attr *)resp->ies; |
| 366 |
switch (ntohs(hdr->msgtype)) { |
| 367 |
case STUN_BINDREQ: |
| 368 |
if (ast_debug_stun_packet_is_allowed) |
| 369 |
ast_verbose("STUN Bind Request, username: %s\n", |
| 370 |
st.username ? st.username : "<none>"); |
| 371 |
if (st.username) { |
| 372 |
append_attr_string(&attr, STUN_USERNAME, st.username, &resplen, &respleft); |
| 373 |
|
| 374 |
|
| 375 |
|
| 376 |
|
| 377 |
|
| 378 |
snprintf(combined, 17, "%16s", st.username + 16); |
| 379 |
snprintf(combined + 16, 17, "%16s", st.username); |
| 380 |
} else { |
| 381 |
combined[0] = '\0'; |
| 382 |
} |
| 383 |
|
| 384 |
append_attr_address(&attr, STUN_MAPPED_ADDRESS, src, &resplen, &respleft); |
| 385 |
resp->msglen = htons(resplen); |
| 386 |
resp->msgtype = htons(STUN_BINDRESP); |
| 387 |
stun_send(s, src, resp); |
| 388 |
ast_stun_request(s, src, combined, NULL); |
| 389 |
ret = AST_STUN_ACCEPT; |
| 390 |
break; |
| 391 |
default: |
| 392 |
if (ast_debug_stun_packet_is_allowed) |
| 393 |
ast_verbose("Dunno what to do with STUN message %04x (%s)\n", (unsigned)ntohs(hdr->msgtype), stun_msg2str(ntohs(hdr->msgtype))); |
| 394 |
} |
| 395 |
} |
| 396 |
return ret; |
| 397 |
} |
| 398 |
|
| 399 |
|
| 400 |
|
| 401 |
|
| 402 |
|
| 403 |
static int stun_get_mapped(struct stun_attr *attr, void *arg) |
| 404 |
{ |
| 405 |
struct stun_addr *addr = (struct stun_addr *)(attr + 1); |
| 406 |
struct sockaddr_in *sa = (struct sockaddr_in *)arg; |
| 407 |
|
| 408 |
if (ntohs(attr->attr) != STUN_MAPPED_ADDRESS || ntohs(attr->len) != 8) |
| 409 |
return 1; |
| 410 |
sa->sin_port = addr->port; |
| 411 |
sa->sin_addr.s_addr = addr->addr; |
| 412 |
return 0; |
| 413 |
} |
| 414 |
|
| 415 |
int ast_stun_request(int s, struct sockaddr_in *dst, |
| 416 |
const char *username, struct sockaddr_in *answer) |
| 417 |
{ |
| 418 |
struct stun_header *req; |
| 419 |
struct stun_header *rsp; |
| 420 |
unsigned char req_buf[1024]; |
| 421 |
unsigned char rsp_buf[1024]; |
| 422 |
int reqlen, reqleft; |
| 423 |
struct stun_attr *attr; |
| 424 |
int res = -1; |
| 425 |
int retry; |
| 426 |
|
| 427 |
if (answer) { |
| 428 |
|
| 429 |
memset(answer, 0, sizeof(struct sockaddr_in)); |
| 430 |
} |
| 431 |
|
| 432 |
|
| 433 |
req = (struct stun_header *) req_buf; |
| 434 |
stun_req_id(req); |
| 435 |
reqlen = 0; |
| 436 |
reqleft = sizeof(req_buf) - sizeof(struct stun_header); |
| 437 |
attr = (struct stun_attr *) req->ies; |
| 438 |
if (username) { |
| 439 |
append_attr_string(&attr, STUN_USERNAME, username, &reqlen, &reqleft); |
| 440 |
} |
| 441 |
req->msglen = htons(reqlen); |
| 442 |
req->msgtype = htons(STUN_BINDREQ); |
| 443 |
|
| 444 |
for (retry = 0; retry++ < STUN_MAX_RETRIES;) { |
| 445 |
|
| 446 |
struct sockaddr_in src; |
| 447 |
socklen_t srclen; |
| 448 |
struct timeval start; |
| 449 |
|
| 450 |
|
| 451 |
res = stun_send(s, dst, req); |
| 452 |
if (res < 0) { |
| 453 |
ast_debug_stun(1, "stun_send try %d failed: %s\n", retry, strerror(errno)); |
| 454 |
break; |
| 455 |
} |
| 456 |
if (!answer) { |
| 457 |
|
| 458 |
res = 0; |
| 459 |
break; |
| 460 |
} |
| 461 |
|
| 462 |
start = ast_tvnow(); |
| 463 |
try_again: |
| 464 |
|
| 465 |
{ |
| 466 |
struct pollfd pfds = { .fd = s, .events = POLLIN }; |
| 467 |
int ms; |
| 468 |
|
| 469 |
ms = ast_remaining_ms(start, 3000); |
| 470 |
if (ms <= 0) { |
| 471 |
|
| 472 |
handle_stun_timeout(retry, dst); |
| 473 |
res = 1; |
| 474 |
continue; |
| 475 |
} |
| 476 |
res = ast_poll(&pfds, 1, ms); |
| 477 |
if (res < 0) { |
| 478 |
|
| 479 |
continue; |
| 480 |
} |
| 481 |
if (!res) { |
| 482 |
|
| 483 |
handle_stun_timeout(retry, dst); |
| 484 |
res = 1; |
| 485 |
continue; |
| 486 |
} |
| 487 |
} |
| 488 |
|
| 489 |
|
| 490 |
memset(&src, 0, sizeof(src)); |
| 491 |
srclen = sizeof(src); |
| 492 |
|
| 493 |
|
| 494 |
|
| 495 |
res = recvfrom(s, rsp_buf, sizeof(rsp_buf) - 1, |
| 496 |
0, (struct sockaddr *) &src, &srclen); |
| 497 |
if (res < 0) { |
| 498 |
ast_debug_stun(1, "recvfrom try %d failed: %s\n", retry, strerror(errno)); |
| 499 |
break; |
| 500 |
} |
| 501 |
|
| 502 |
|
| 503 |
rsp = (struct stun_header *) rsp_buf; |
| 504 |
if (ast_stun_handle_packet(s, &src, rsp_buf, res, stun_get_mapped, answer) |
| 505 |
|| (rsp->msgtype != htons(STUN_BINDRESP) |
| 506 |
&& rsp->msgtype != htons(STUN_BINDERR)) |
| 507 |
|| stun_id_cmp(&req->id, &rsp->id)) { |
| 508 |
|
| 509 |
memset(answer, 0, sizeof(struct sockaddr_in)); |
| 510 |
|
| 511 |
|
| 512 |
goto try_again; |
| 513 |
} |
| 514 |
|
| 515 |
res = 0; |
| 516 |
break; |
| 517 |
} |
| 518 |
return res; |
| 519 |
} |
| 520 |
|
| 521 |
static char *handle_cli_stun_set_debug(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) |
| 522 |
{ |
| 523 |
switch (cmd) { |
| 524 |
case CLI_INIT: |
| 525 |
e->command = "stun set debug {on|off}"; |
| 526 |
e->usage = |
| 527 |
"Usage: stun set debug {on|off}\n" |
| 528 |
" Enable/Disable STUN (Simple Traversal of UDP through NATs)\n" |
| 529 |
" debugging\n"; |
| 530 |
return NULL; |
| 531 |
case CLI_GENERATE: |
| 532 |
return NULL; |
| 533 |
} |
| 534 |
|
| 535 |
if (a->argc != e->args) |
| 536 |
return CLI_SHOWUSAGE; |
| 537 |
|
| 538 |
if (!strncasecmp(a->argv[e->args-1], "on", 2)) |
| 539 |
ast_debug_category_set_sublevel(AST_LOG_CATEGORY_STUN_PACKET, AST_LOG_CATEGORY_ENABLED); |
| 540 |
else if (!strncasecmp(a->argv[e->args-1], "off", 3)) |
| 541 |
ast_debug_category_set_sublevel(AST_LOG_CATEGORY_STUN_PACKET, AST_LOG_CATEGORY_DISABLED); |
| 542 |
else |
| 543 |
return CLI_SHOWUSAGE; |
| 544 |
|
| 545 |
ast_cli(a->fd, "STUN Debugging %s\n", ast_debug_stun_packet_is_allowed ? "Enabled" : "Disabled"); |
| 546 |
return CLI_SUCCESS; |
| 547 |
} |
| 548 |
|
| 549 |
static struct ast_cli_entry cli_stun[] = { |
| 550 |
AST_CLI_DEFINE(handle_cli_stun_set_debug, "Enable/Disable STUN debugging"), |
| 551 |
}; |
| 552 |
|
| 553 |
static uintmax_t debug_category_stun_id; |
| 554 |
|
| 555 |
uintmax_t ast_debug_category_stun_id(void) |
| 556 |
{ |
| 557 |
return debug_category_stun_id; |
| 558 |
} |
| 559 |
|
| 560 |
static uintmax_t debug_category_stun_packet_id; |
| 561 |
|
| 562 |
uintmax_t ast_debug_category_stun_packet_id(void) |
| 563 |
{ |
| 564 |
return debug_category_stun_packet_id; |
| 565 |
} |
| 566 |
|
| 567 |
static void stun_shutdown(void) |
| 568 |
{ |
| 569 |
ast_cli_unregister_multiple(cli_stun, sizeof(cli_stun) / sizeof(struct ast_cli_entry)); |
| 570 |
|
| 571 |
ast_debug_category_unregister(AST_LOG_CATEGORY_STUN_PACKET); |
| 572 |
ast_debug_category_unregister(AST_LOG_CATEGORY_STUN); |
| 573 |
} |
| 574 |
|
| 575 |
|
| 576 |
void ast_stun_init(void) |
| 577 |
{ |
| 578 |
ast_cli_register_multiple(cli_stun, sizeof(cli_stun) / sizeof(struct ast_cli_entry)); |
| 579 |
debug_category_stun_id = ast_debug_category_register(AST_LOG_CATEGORY_STUN); |
| 580 |
debug_category_stun_packet_id = ast_debug_category_register(AST_LOG_CATEGORY_STUN_PACKET); |
| 581 |
|
| 582 |
|
| 583 |
|
| 584 |
|
| 585 |
|
| 586 |
|
| 587 |
|
| 588 |
|
| 589 |
|
| 590 |
ast_register_atexit(stun_shutdown); |
| 591 |
|
| 592 |
} |