61#include <sys/socket.h>
62#include <netinet/in.h>
64#include <netinet/in_systm.h>
65#include <netinet/ip.h>
305#define SCHED_MULTITHREADED
309#define DEBUG_SCHED_MULTITHREAD
313static int nochecksums = 0;
316#define PTR_TO_CALLNO(a) ((unsigned short)(unsigned long)(a))
317#define CALLNO_TO_PTR(a) ((void *)(unsigned long)(a))
319#define DEFAULT_THREAD_COUNT 10
320#define DEFAULT_MAX_THREAD_COUNT 100
321#define DEFAULT_RETRY_TIME 1000
322#define MEMORY_SIZE 100
323#define DEFAULT_DROP 3
327#define MIN_REUSE_TIME 60
334static const char tdesc[] =
"Inter Asterisk eXchange Driver (Ver 2)";
339#define MAX_TRUNK_MTU 1240
344#define DEFAULT_CONTEXT "default"
364#define MAX_TRUNKDATA 640 * 200
397#define IAX_CAPABILITY_FULLBANDWIDTH 0xFFFF
399#define IAX_CAPABILITY_MEDBANDWIDTH (IAX_CAPABILITY_FULLBANDWIDTH & \
401 ~AST_FORMAT_SLIN16 & \
402 ~AST_FORMAT_SIREN7 & \
403 ~AST_FORMAT_SIREN14 & \
409#define IAX_CAPABILITY_LOWBANDWIDTH (IAX_CAPABILITY_MEDBANDWIDTH & \
411 ~AST_FORMAT_G726_AAL2 & \
414#define IAX_CAPABILITY_LOWFREE (IAX_CAPABILITY_LOWBANDWIDTH & \
418#define DEFAULT_MAXMS 2000
419#define DEFAULT_FREQ_OK 60 * 1000
420#define DEFAULT_FREQ_NOTOK 10 * 1000
431#define AUTH_METHOD_NAMES_BUFSIZE 19
446 pos += sprintf(pos,
"|RSA");
449 pos += sprintf(pos,
"|MD5");
452 pos += sprintf(pos,
"|plaintext");
464#define IAX_CALLENCRYPTED(pvt) \
465 (ast_test_flag64(pvt, IAX_ENCRYPTED) && ast_test_flag64(pvt, IAX_KEYPOPULATED))
467#define IAX_DEBUGDIGEST(msg, key) do { \
469 char digest[33] = ""; \
474 for (idx = 0; idx < 16; idx++) \
475 sprintf(digest + (idx << 1), "%02hhx", (unsigned char) key[idx]); \
477 ast_log(LOG_NOTICE, msg " IAX_COMMAND_RTKEY to rotate key to '%s'\n", digest); \
491static int test_late = 0;
492static int test_resync = 0;
493static int test_jit = 0;
494static int test_jitpct = 0;
522#define IAX_HASCALLERID (uint64_t)(1LLU << 0)
523#define IAX_DELME (uint64_t)(1LLU << 1)
524#define IAX_TEMPONLY (uint64_t)(1LLU << 2)
525#define IAX_TRUNK (uint64_t)(1LLU << 3)
526#define IAX_NOTRANSFER (uint64_t)(1LLU << 4)
527#define IAX_USEJITTERBUF (uint64_t)(1LLU << 5)
528#define IAX_DYNAMIC (uint64_t)(1LLU << 6)
529#define IAX_SENDANI (uint64_t)(1LLU << 7)
530#define IAX_RTSAVE_SYSNAME (uint64_t)(1LLU << 8)
531#define IAX_ALREADYGONE (uint64_t)(1LLU << 9)
532#define IAX_PROVISION (uint64_t)(1LLU << 10)
533#define IAX_QUELCH (uint64_t)(1LLU << 11)
534#define IAX_ENCRYPTED (uint64_t)(1LLU << 12)
535#define IAX_KEYPOPULATED (uint64_t)(1LLU << 13)
536#define IAX_CODEC_USER_FIRST (uint64_t)(1LLU << 14)
537#define IAX_CODEC_NOPREFS (uint64_t)(1LLU << 15)
538#define IAX_CODEC_NOCAP (uint64_t)(1LLU << 16)
539#define IAX_RTCACHEFRIENDS (uint64_t)(1LLU << 17)
540#define IAX_RTUPDATE (uint64_t)(1LLU << 18)
541#define IAX_RTAUTOCLEAR (uint64_t)(1LLU << 19)
542#define IAX_RTIGNOREREGEXPIRE (uint64_t)(1LLU << 21)
543#define IAX_TRUNKTIMESTAMPS (uint64_t)(1LLU << 22)
544#define IAX_TRANSFERMEDIA (uint64_t)(1LLU << 23)
545#define IAX_MAXAUTHREQ (uint64_t)(1LLU << 24)
546#define IAX_DELAYPBXSTART (uint64_t)(1LLU << 25)
547#define IAX_ALLOWFWDOWNLOAD (uint64_t)(1LLU << 26)
548#define IAX_IMMEDIATE (uint64_t)(1LLU << 27)
549#define IAX_SENDCONNECTEDLINE (uint64_t)(1LLU << 28)
550#define IAX_RECVCONNECTEDLINE (uint64_t)(1LLU << 29)
551#define IAX_FORCE_ENCRYPT (uint64_t)(1LLU << 30)
552#define IAX_SHRINKCALLERID (uint64_t)(1LLU << 31)
662#define IAX2_TRUNK_PREFACE (sizeof(struct iax_frame) + sizeof(struct ast_iax2_meta_hdr) + sizeof(struct ast_iax2_meta_trunk_hdr))
728#define MIN_RETRY_TIME 100
729#define MAX_RETRY_TIME 10000
731#define MAX_JITTER_BUFFER 50
732#define MIN_JITTER_BUFFER 10
734#define DEFAULT_TRUNKDATA 640 * 10
736#define MAX_TIMESTAMP_SKEW 160
739#define TS_GAP_FOR_JB_RESYNC 5000
742#define MARK_IAX_SUBCLASS_TX 0x8000
975#define PTR_TO_CALLNO_ENTRY(a) ((uint16_t)(unsigned long)(a))
976#define CALLNO_ENTRY_TO_PTR(a) ((void *)(unsigned long)(a))
978#define CALLNO_ENTRY_SET_VALIDATED(a) ((a) |= 0x8000)
979#define CALLNO_ENTRY_IS_VALIDATED(a) ((a) & 0x8000)
980#define CALLNO_ENTRY_GET_CALLNO(a) ((a) & 0x7FFF)
1021#define MAX_PEER_BUCKETS 17
1023#define MAX_PEER_BUCKETS 563
1027#define MAX_USER_BUCKETS MAX_PEER_BUCKETS
1137#ifdef SCHED_MULTITHREADED
1141#ifdef DEBUG_SCHED_MULTITHREAD
1247#define TRUNK_CALL_START (IAX_MAX_CALLS / 2)
1286 va_start(
args, fmt);
1298 va_start(
args, fmt);
1310 va_start(
args, fmt);
1343static int send_command_locked(
unsigned short callno,
char,
int,
unsigned int,
const unsigned char *,
int,
int);
1368 .description =
tdesc,
1409 if (!
iaxs[callno] || !
iaxs[callno]->owner) {
1440 if (subtype == -1) {
1578 ast_verb(1,
"IAX, got a network change message, renewing all IAX registrations.\n");
1596 .
type =
"IAX2_VARIABLE",
1724#ifdef SCHED_MULTITHREADED
1728 static time_t lasterror;
1733 thread->schedfunc = func;
1734 thread->scheddata = data;
1736#ifdef DEBUG_SCHED_MULTITHREAD
1743 if (t != lasterror) {
1745 ast_debug(1,
"Out of idle IAX2 threads for scheduling! (%s)\n", funcname);
1750#define schedule_action(func, data) __schedule_action(func, data, __PRETTY_FUNCTION__)
1778 ast_debug(3,
"I wanted to lock callno %d, but it is dead or going to die.\n",
callno);
1794 ast_debug(3,
"Hangup initiated on call %d, aborting __send_ping\n",
callno);
1815#ifdef SCHED_MULTITHREADED
1842 if (!strcasecmp(s,
"aes128"))
1858 ast_debug(3,
"Hangup initiated on call %d, aborting __send_lagrq\n",
callno);
1879#ifdef SCHED_MULTITHREADED
1895 if (subclass & (1LL << x)) {
1927 uint64_t pref_bitfield;
1930 if (!pref_bitfield) {
1946 return found_format;
1949 ast_debug(4,
"Could not find preferred codec - Returning zero codec.\n");
2038 const char *
name = obj;
2048 struct iax2_peer *peer = obj, *peer2 = arg;
2049 const char *
name = arg;
2061 const char *
name = obj;
2072 const char *
name = arg;
2089 if (!peer && realtime) {
2214 ast_debug(1,
"Really destroying %d now...\n", callno);
2364 memcpy(
new, fr,
sizeof(*
new));
2475 ast_log(
LOG_ERROR,
"This should not be called without a transfer call number.\n");
2485 ast_log(
LOG_ERROR,
"This should not be called without a transfer call number.\n");
2494 ast_log(
LOG_ERROR,
"This should not be called without a peer call number.\n");
2504 ast_log(
LOG_ERROR,
"This should not be called without a peer call number.\n");
2544 struct peercnt *peercnt1 = obj, *peercnt2 = arg;
2573 const char *find =
S_OR(
name,
"guest");
2656 ast_debug(1,
"Reset limits for peercnts table\n");
2822 for (; v; v = v->
next) {
2830 ast_log(
LOG_ERROR,
"Call number limit for %s could not be added, Invalid address range\n.", v->
name);
2832 }
else if ((sscanf(v->
value,
"%d", &limit) != 1) || (limit < 0)) {
2918 e->
command =
"iax2 show callnumber usage";
2920 "Usage: iax2 show callnumber usage [IP address]\n"
2921 " Shows current IP addresses which are consuming iax2 call numbers\n";
2926 if (
a->argc < 4 ||
a->argc > 5)
2930 ast_cli(
a->fd,
"%-45s %-12s %-12s\n",
"Address",
"Callno Usage",
"Callno Limit");
2939 ast_cli(
a->fd,
"%-45s %-12s %-12s\n",
"Address",
"Callno Usage",
"Callno Limit");
2956 ast_cli(
a->fd,
"\nNon-CallToken Validation Callno Limit: %d\n"
2957 "Non-CallToken Validated Callno Used: %d\n",
2961 ast_cli(
a->fd,
"Total Available Callno: %zu\n"
2962 "Regular Callno Available: %zu\n"
2963 "Trunk Callno Available: %zu\n",
2964 pool_avail + trunk_pool_avail,
2967 }
else if (
a->argc == 5 && !found) {
2968 ast_cli(
a->fd,
"No call number table entries for %s found\n",
a->argv[4] );
3015 "NON-CallToken callnumber limit is reached. Current: %d Max: %d\n",
3038 *entry = pool->
numbers[choice];
3069 "Attempted to decrement total non calltoken validated "
3070 "callnumbers below zero. Callno is: %d\n",
3187 int validated = (
new >
NEW_ALLOW) ? 1 : 0;
3196 .transfercallno =
callno,
3198 .frames_received = check_dcallno,
3204 if (return_locked) {
3213 memset(&tmp_pvt.
addr, 0,
sizeof(tmp_pvt.
addr));
3216 if (return_locked) {
3234 if (!res || !return_locked) {
3274 ast_debug(1,
"Creating new call structure %d\n", x);
3434 struct sockaddr_in *sin;
3437 struct sock_extended_err e;
3442 m.msg_controllen =
sizeof(e);
3444 res = recvmsg(
netsocket, &m, MSG_ERRQUEUE);
3448 if (m.msg_controllen) {
3449 sin = (
struct sockaddr_in *)SO_EE_OFFENDER(&e);
3538 if ((pvt =
iaxs[callno])) {
3555 ast_debug(3,
"Avoiding IAX destroy deadlock\n");
3641 }
else if (f->
final) {
3645 ast_log(
LOG_WARNING,
"Max retries exceeded to host %s on %s (type = %u, subclass = %d, ts=%u, seqno=%d)\n",
3659 if (
iaxs[callno] &&
iaxs[callno]->owner)
3662 if (
iaxs[callno]->reg) {
3663 memset(&
iaxs[callno]->reg->us, 0,
sizeof(
iaxs[callno]->
reg->
us));
3699 }
else if (callno) {
3706#ifdef SCHED_MULTITHREADED
3717 static const char *
const choices[] = {
"all",
NULL };
3722 e->
command =
"iax2 prune realtime";
3724 "Usage: iax2 prune realtime [<peername>|all]\n"
3725 " Prunes object(s) from the cache\n";
3738 if (!strcmp(
a->argv[3],
"all")) {
3741 ast_cli(
a->fd,
"Cache flushed successfully.\n");
3751 ast_cli(
a->fd,
"Peer %s was removed from the cache.\n",
a->argv[3]);
3753 ast_cli(
a->fd,
"Peer %s is not eligible for this operation.\n",
a->argv[3]);
3760 ast_cli(
a->fd,
"User %s was removed from the cache.\n",
a->argv[3]);
3762 ast_cli(
a->fd,
"User %s is not eligible for this operation.\n",
a->argv[3]);
3768 ast_cli(
a->fd,
"%s was not found in the cache.\n",
a->argv[3]);
3778 e->
command =
"iax2 test losspct";
3780 "Usage: iax2 test losspct <percentage>\n"
3781 " For testing, throws away <percentage> percent of incoming packets\n";
3799 e->
command =
"iax2 test late";
3801 "Usage: iax2 test late <ms>\n"
3802 " For testing, count the next frame as <ms> ms late\n";
3811 test_late = atoi(
a->argv[3]);
3820 e->
command =
"iax2 test resync";
3822 "Usage: iax2 test resync <ms>\n"
3823 " For testing, adjust all future frames by <ms> ms\n";
3832 test_resync = atoi(
a->argv[3]);
3841 e->
command =
"iax2 test jitter";
3843 "Usage: iax2 test jitter <ms> <pct>\n"
3844 " For testing, simulate maximum jitter of +/- <ms> on <pct>\n"
3845 " percentage of packets. If <pct> is not specified, adds\n"
3846 " jitter to all packets.\n";
3852 if (
a->argc < 4 ||
a->argc > 5)
3855 test_jit = atoi(
a->argv[3]);
3857 test_jitpct = atoi(
a->argv[4]);
3872 snprintf(
status, statuslen,
"LAGGED (%d ms)", peer->
lastms);
3874 }
else if (peer->
lastms) {
3875 snprintf(
status, statuslen,
"OK (%d ms)", peer->
lastms);
3895 int load_realtime = 0;
3899 e->
command =
"iax2 show peer";
3901 "Usage: iax2 show peer <name>\n"
3902 " Display details on specific IAX peer\n";
3913 load_realtime = (
a->argc == 5 && !strcmp(
a->argv[4],
"load")) ? 1 : 0;
3917 char *str_addr, *str_defaddr;
3918 char *str_port, *str_defport;
3941 ast_cli(
a->fd,
" Addr->IP : %s Port %s\n", str_addr ? str_addr :
"(Unspecified)", str_port);
3942 ast_cli(
a->fd,
" Defaddr->IP : %s Port %s\n", str_defaddr, str_defport);
3947 strcpy(cbuf,
"Error");
3949 ast_cli(
a->fd,
" Codec Order : %s\n", cbuf);
3957 ast_cli(
a->fd,
"Peer %s not found.\n",
a->argv[3]);
3969 int wordlen = strlen(
word);
3974 if (!strncasecmp(peer->
name,
word, wordlen) && ++which >
state
3990 int cnt = 0, dead = 0,
final = 0, i = 0;
3994 e->
command =
"iax2 show stats";
3996 "Usage: iax2 show stats\n"
3997 " Display statistics on IAX channel driver.\n";
4018 ast_cli(
a->fd,
" IAX Statistics\n");
4019 ast_cli(
a->fd,
"---------------------\n");
4023 ast_cli(
a->fd,
"Packets in transmit queue: %d dead, %d final, %d total\n\n", dead,
final, cnt);
4041 "Usage: iax2 set mtu <value>\n"
4042 " Set the system-wide IAX IP mtu to <value> bytes net or\n"
4043 " zero to disable. Disabling means that the operating system\n"
4044 " must handle fragmentation of UDP packets when the IAX2 trunk\n"
4045 " packet exceeds the UDP payload size. This is substantially\n"
4046 " below the IP mtu. Try 1240 on ethernets. Must be 172 or\n"
4047 " greater for G.711 samples.\n";
4055 if (strncasecmp(
a->argv[3],
"default", strlen(
a->argv[3])) == 0)
4058 mtuv = atoi(
a->argv[3]);
4065 if (mtuv < 172 || mtuv > 4000) {
4066 ast_cli(
a->fd,
"Trunk MTU must be between 172 and 4000\n");
4077 char tmp[1024], *pc =
NULL;
4083 e->
command =
"iax2 show cache";
4085 "Usage: iax2 show cache\n"
4086 " Display currently cached IAX Dialplan results.\n";
4094 ast_cli(
a->fd,
"%-20.20s %-12.12s %-9.9s %-8.8s %s\n",
"Peer/Context",
"Exten",
"Exp.",
"Wait.",
"Flags");
4097 s = dp->
expiry.tv_sec - now.tv_sec;
4100 strncat(tmp,
"EXISTS|",
sizeof(tmp) - strlen(tmp) - 1);
4102 strncat(tmp,
"NONEXISTENT|",
sizeof(tmp) - strlen(tmp) - 1);
4104 strncat(tmp,
"CANEXIST|",
sizeof(tmp) - strlen(tmp) - 1);
4106 strncat(tmp,
"PENDING|",
sizeof(tmp) - strlen(tmp) - 1);
4108 strncat(tmp,
"TIMEOUT|",
sizeof(tmp) - strlen(tmp) - 1);
4110 strncat(tmp,
"TRANSMITTED|",
sizeof(tmp) - strlen(tmp) - 1);
4112 strncat(tmp,
"MATCHMORE|",
sizeof(tmp) - strlen(tmp) - 1);
4114 strncat(tmp,
"UNKNOWN|",
sizeof(tmp) - strlen(tmp) - 1);
4117 tmp[strlen(tmp) - 1] =
'\0';
4133 ast_cli(
a->fd,
"%-20.20s %-12.12s %-9d %-8d %s\n", pc, dp->
exten, s, y, tmp);
4135 ast_cli(
a->fd,
"%-20.20s %-12.12s %-9.9s %-8d %s\n", pc, dp->
exten,
"(expired)", y, tmp);
4151 const int lower_mask = (1 << ts_shift) - 1;
4152 const int upper_mask = ~lower_mask;
4155 if ( (fr->
ts & upper_mask) == last_upper ) {
4157 const int threshold = (ts_shift == 15) ? 25000 : 50000;
4164 fr->
ts = (last_upper + (1 << ts_shift)) | (fr->
ts & lower_mask);
4166 ast_debug(1,
"schedule_delivery: pushed forward timestamp\n");
4172 fr->
ts = (last_upper - (1 << ts_shift)) | (fr->
ts & lower_mask);
4174 ast_debug(1,
"schedule_delivery: pushed back timestamp\n");
4224 now.tv_usec += 1000;
4270 af.
src =
"IAX2 JB interpolation";
4303#ifdef SCHED_MULTITHREADED
4339 ast_debug(1,
"schedule_delivery: set delivery to 0 as we don't have an rxcore yet, or frame is from trunk.\n");
4428 0, 0, (
unsigned char *)
text, strlen(
text) + 1, -1);
4462 time_t regseconds = 0, nowtime;
4464 char *str_addr, *str_port;
4478 for (tmp =
var; tmp; tmp = tmp->
next) {
4479 if (!strcasecmp(tmp->
name,
"name"))
4480 peername = tmp->
value;
4484 if (!
var && peername) {
4493 for (tmp =
var; tmp; tmp = tmp->
next) {
4494 if (!strcasecmp(tmp->
name,
"host")) {
4519 for (tmp =
var; tmp; tmp = tmp->
next) {
4521 if (!strcasecmp(tmp->
name,
"type")) {
4522 if (strcasecmp(tmp->
value,
"friend") &&
4523 strcasecmp(tmp->
value,
"peer")) {
4528 }
else if (!strcasecmp(tmp->
name,
"regseconds")) {
4530 }
else if (!strcasecmp(tmp->
name,
"ipaddr")) {
4538 }
else if (!strcasecmp(tmp->
name,
"port")) {
4544 }
else if (!strcasecmp(tmp->
name,
"host")) {
4545 if (!strcasecmp(tmp->
value,
"dynamic"))
4575 memset(&peer->
addr, 0,
sizeof(peer->
addr));
4577 ast_debug(1,
"realtime_peer: Bah, '%s' is expired (%d/%d/%d)!\n",
4578 peername, (
int)(nowtime - regseconds), (
int)regseconds, (
int)nowtime);
4581 ast_debug(1,
"realtime_peer: Registration for '%s' still active (%d/%d/%d)!\n",
4582 peername, (
int)(nowtime - regseconds), (
int)regseconds, (
int)nowtime);
4594 char *str_addr, *str_port;
4616 for (tmp =
var; tmp; tmp = tmp->
next) {
4617 if (!strcasecmp(tmp->
name,
"host")) {
4638 if (!strcasecmp(tmp->
name,
"type")) {
4639 if (strcasecmp(tmp->
value,
"friend") &&
4640 strcasecmp(tmp->
value,
"user")) {
4666 char regseconds[20];
4668 char *syslabel =
NULL;
4674 syslabel =
"regserver";
4676 snprintf(regseconds,
sizeof(regseconds),
"%d", (
int)regtime);
4681 "regseconds", regseconds, syslabel, sysname,
SENTINEL);
4799 key = strchr(family,
'/');
4837#ifdef SCHED_MULTITHREADED
4850 tmp = (tm.
tm_sec >> 1) & 0x1f;
4851 tmp |= (tm.
tm_min & 0x3f) << 5;
4852 tmp |= (tm.
tm_hour & 0x1f) << 11;
4853 tmp |= (tm.
tm_mday & 0x1f) << 16;
4854 tmp |= ((tm.
tm_mon + 1) & 0xf) << 21;
4855 tmp |= ((tm.
tm_year - 100) & 0x7f) << 25;
4871 struct ast_sockaddr *addr,
int command,
int ts,
unsigned char seqno,
4882 memcpy(&data.ied, ied->
buf, ied->
pos);
4885 data.f.scallno = htons(0x8000 | callno);
4887 data.f.ts = htonl(
ts);
4888 data.f.iseqno = seqno;
4895 return ast_sendto(sockfd, &data, size, 0, addr);
4901 if (pvt && ied && (2 < ((
int)
sizeof(ied->
buf) - ied->
pos))) {
4903 ied->
buf[ied->
pos++] = 0;
4940 (f->
datalen >
sizeof(data))) {
4960 data.ied.pos = ie_data_pos;
5033#define CALLTOKEN_HASH_FORMAT "%s%u%d"
5034#define CALLTOKEN_IE_FORMAT "%u?%s"
5036 time_t t = time(
NULL);
5059 char *rec_hash =
NULL;
5060 char *rec_ts =
NULL;
5061 unsigned int rec_time;
5071 if (!rec_hash || !rec_ts) {
5073 }
else if (sscanf(rec_ts,
"%u", &rec_time) != 1) {
5082 if (strcmp(hash, rec_hash)) {
5134 char *outkey =
NULL;
5149 if (strchr(pds->
peer,
'@')) {
5182 }
else if (outkey && (outkey[0] ==
'[')) {
5197 char *defaultrdest =
"s";
5203 const char* osp_token_ptr;
5204 unsigned int osp_token_length;
5205 unsigned char osp_block_index;
5206 unsigned int osp_block_length;
5207 unsigned char osp_buffer[256];
5208 char encoded_prefs[32];
5216 memset(&cai, 0,
sizeof(cai));
5220 memset(&pds, 0,
sizeof(pds));
5229 pds.
exten = defaultrdest;
5273 memset(&ied, 0,
sizeof(ied));
5358 if (
iaxs[callno]->maxtime) {
5371 osp_block_index = 0;
5372 while (osp_token_length > 0) {
5374 osp_buffer[0] = osp_block_index;
5375 memcpy(osp_buffer + 1, osp_token_ptr, osp_block_length);
5378 osp_token_ptr += osp_block_length;
5379 osp_token_length -= osp_block_length;
5384 ast_debug(1,
"OSP token is undefined\n");
5390 if (variablestore) {
5392 ast_debug(1,
"Found an IAX variable store on this channel\n");
5422 memset(&ied, 0,
sizeof(ied));
5424 if (callno &&
iaxs[callno]) {
5429 if (!
iaxs[callno]->
error && !alreadygone) {
5433 if (!
iaxs[callno]) {
5441 if (
iaxs[callno] && alreadygone) {
5444 }
else if (
iaxs[callno]) {
5446 ast_log(
LOG_ERROR,
"Unable to schedule iax2 callno %d destruction?!! Destroying immediately.\n", callno);
5467 unsigned short callno = pvt->
callno;
5503 if ((*(
int *)
data)) {
5535 if (!(h =
ast_malloc(datalen +
sizeof(*h)))) {
5540 h->option = htons(option);
5541 memcpy(h->
data, data, datalen);
5544 datalen +
sizeof(*h), -1);
5575 ast_debug(1,
"I should never be called!\n");
5592 snprintf(key,
sizeof(key),
"%lX", (
unsigned long)
ast_random());
5611#if defined(IAX2_NATIVE_BRIDGING)
5612static int iax2_start_transfer(
unsigned short callno0,
unsigned short callno1,
int mediaonly)
5617 unsigned int transferid = (
unsigned int)
ast_random();
5620 ast_debug(1,
"transfers are not supported for encrypted calls at this time\n");
5626 memset(&ied0, 0,
sizeof(ied0));
5631 memset(&ied1, 0,
sizeof(ied1));
5648#if defined(IAX2_NATIVE_BRIDGING)
5649static void lock_both(
unsigned short callno0,
unsigned short callno1)
5658#if defined(IAX2_NATIVE_BRIDGING)
5659static void unlock_both(
unsigned short callno0,
unsigned short callno1)
5666#if defined(IAX2_NATIVE_BRIDGING)
5673 int transferstarted=0;
5677 struct timeval waittimer = {0, 0};
5680 if (timeoutms > 0) {
5686 lock_both(callno0, callno1);
5687 if (!
iaxs[callno0] || !
iaxs[callno1]) {
5688 unlock_both(callno0, callno1);
5696 unlock_both(callno0, callno1);
5704 ast_verb(3,
"Can't masquerade, we're different...\n");
5722 ast_verb(3,
"Operating with different codecs [%s] [%s] , can't native bridge...\n",
5727 lock_both(callno0, callno1);
5732 unlock_both(callno0, callno1);
5741 transferstarted = 1;
5764 if (timeoutms > -1) {
5765 timeoutms -= (1000 - to);
5787 other = (who == c0) ? c1 : c0;
5819 if (flags & monitored_source) {
5834 lock_both(callno0, callno1);
5839 unlock_both(callno0, callno1);
5858 ast_debug(1,
"Indicating condition %d\n", condition);
5868 switch (condition) {
5885 ast_debug(2,
"Callno %d: Config blocked sending control frame %d.\n",
5948 const struct ast_channel *requestor,
unsigned int cachable)
5957 char *peer_name =
NULL;
5959 if (!(i =
iaxs[callno])) {
6007 if (i !=
iaxs[callno]) {
6025 if ((callid =
iaxs[callno]->callid)) {
6046 ast_channel_parkinglot_set(tmp, i->
parkinglot);
6067 ast_channel_language_set(tmp, i->
language);
6087 for (v = i->
vars ; v ; v = v->
next)
6094 ast_debug(1,
"Loading up the channel with IAXVARs\n");
6097 if (variablestore && varlist) {
6098 variablestore->
data = varlist;
6108 ast_log(
LOG_ERROR,
"Memory allocation error while processing IAX2 variables\n");
6118 if (variablestore) {
6147 unsigned long int mssincetx;
6174static unsigned int fix_peerts(
struct timeval *rxtrunktime,
int callno,
unsigned int ts)
6196 struct timeval *delivery =
NULL;
6259 else if (adjust > 0)
6279 ast_debug(1,
"predicted timestamp skew (%d) > max (%d), using real ts instead.\n",
6284 int diff = ms % (f->
samples / rate);
6301 if ( (
unsigned int)ms < p->
lastsent )
6309 if (ms <= p->lastsent)
6336 ast_debug(1,
"calc_rxstamp: call=%d: rxcore set to %d.%6.6d - %ums\n",
6341 ast_debug(1,
"calc_rxstamp: call=%d: works out as %d.%6.6d\n",
6349 if (!test_jitpct || ((100.0 *
ast_random() / (RAND_MAX + 1.0)) < test_jitpct)) {
6350 jit = (int)((
float)test_jit *
ast_random() / (RAND_MAX + 1.0));
6351 if ((
int)(2.0 *
ast_random() / (RAND_MAX + 1.0)))
6379 if ((tpeer =
ast_calloc(1,
sizeof(*tpeer)))) {
6388 setsockopt(tpeer->
sockfd, SOL_SOCKET, SO_NO_CHECK, &nochecksums,
sizeof(nochecksums));
6437 mtm->
mini.
ts = htons(0xffff & fr->
ts);
6477 memcpy(
buf, (
unsigned char *) &tmp, (
len >
sizeof(tmp)) ?
sizeof(tmp) :
len);
6487 for (i = 0; i < 60; i++) {
6523 dst[x] = src[x] ^ 0xff;
6525 unsigned char lastblock[16] = { 0 };
6530 dst[x] ^= lastblock[x];
6531 memcpy(lastblock, src,
sizeof(lastblock));
6547 dst[x] = src[x] ^ 0xff;
6549 unsigned char curblock[16] = { 0 };
6553 curblock[x] ^= src[x];
6555 memcpy(curblock, dst,
sizeof(curblock));
6566 unsigned char *workspace;
6569 memset(f, 0,
sizeof(*f));
6577 padding = 16 + (workspace[15] & 0x0f);
6579 ast_debug(1,
"Decoding full frame with length %d (padding = %d) (15=%02hhx)\n", *datalen, padding, workspace[15]);
6583 *datalen -= padding;
6602 ast_debug(5,
"Decoding mini with length %d\n", *datalen);
6607 padding = 16 + (workspace[15] & 0x0f);
6610 *datalen -= padding;
6619 unsigned char *workspace;
6624 ast_debug(1,
"Encoding full frame %d/%d with length %d\n", fh->
type, fh->
csub, *datalen);
6626 padding = 16 + (padding & 0xf);
6627 memcpy(workspace, poo, padding);
6629 workspace[15] &= 0xf0;
6630 workspace[15] |= (padding & 0xf);
6632 ast_debug(1,
"Encoding full frame %d/%d with length %d + %d padding (15=%02hhx)\n", fh->
type, fh->
csub, *datalen, padding, workspace[15]);
6633 *datalen += padding;
6636 memcpy(poo, workspace + *datalen - 32, 32);
6640 ast_debug(5,
"Encoding mini frame with length %d\n", *datalen);
6642 padding = 16 + (padding & 0xf);
6643 memcpy(workspace, poo, padding);
6645 workspace[15] &= 0xf0;
6646 workspace[15] |= (padding & 0x0f);
6647 *datalen += padding;
6650 memcpy(poo, workspace + *datalen - 32, 32);
6661 unsigned char digest[16];
6662 char *tmppw, *stringp;
6666 while ((tmppw =
strsep(&stringp,
";"))) {
6669 MD5Update(&
md5, (
unsigned char *)tmppw, strlen(tmppw));
6693 unsigned char buffer[4096];
6698 unsigned int lastsent;
6720 "f->frametype %c= AST_FRAME_VOICE, %sencrypted, %srotation scheduled...\n",
6731 (((fts & 0xFFFF0000L) == (lastsent & 0xFFFF0000L)) ||
6732 ((fts & 0xFFFF0000L) == ((lastsent + 0x10000) & 0xFFFF0000L))))
6750 if (((fts & 0xFFFF8000L) == (pvt->
lastvsent & 0xFFFF8000L)) &&
6795 fh->
ts = htonl(fr->
ts);
6879 mh->
ts = htons(fr->
ts & 0xFFFF);
6900 int havepattern = 0;
6902#define FORMAT "%-15.15s %-20.20s %-15.15s %-15.15s %-5.5s %-5.10s\n"
6903#define FORMAT2 "%-15.15s %-20.20s %-15.15d %-15.15s %-5.5s %-5.10s\n"
6912 e->
command =
"iax2 show users [like]";
6914 "Usage: iax2 show users [like <pattern>]\n"
6915 " Lists all known IAX2 users.\n"
6916 " Optional regular expression pattern is used to filter the user list.\n";
6924 if (!strcasecmp(
a->argv[3],
"like")) {
6925 if (regcomp(®exbuf,
a->argv[4], REG_EXTENDED | REG_NOSUB))
6936 ast_cli(
a->fd,
FORMAT,
"Username",
"Secret",
"Authen",
"Def.Context",
"A/C",
"Codec Pref");
6939 if (havepattern && regexec(®exbuf,
user->name, 0,
NULL, 0))
6945 snprintf(auth,
sizeof(auth),
"Key: %-15.15s ",
user->inkeys);
6982#define PEERS_FORMAT2 "%-15.15s %-40.40s %s %-40.40s %-9s %s %-11s %-32.32s\n"
6983#define PEERS_FORMAT "%-15.15s %-40.40s %s %-40.40s %-6s%s %s %-11s %-32.32s\n"
6987 char name[256] =
"";
6992 char *tmp_host, *tmp_mask, *tmp_port;
7006 if (retstatus > 0) {
7008 }
else if (!retstatus) {
7017 "Event: PeerEntry\r\n%s"
7018 "Channeltype: IAX\r\n",
7022 "ObjectName: %s\r\n"
7023 "ObjectUsername: %s\r\n",
7028 "ObjectName: %s\r\n",
7033 "Event: PeerEntry\r\n%s"
7034 "Channeltype: IAX2\r\n"
7035 "ObjectName: %s\r\n",
7040 "ChanObjectType: peer\r\n"
7041 "IPaddress: %s\r\n",
7057 "Encryption: %s\r\n"
7067 "Description: %s\r\n\r\n",
7091 .registeredonly = 0,
7098 .unmonitored_peers = 0,
7107 if (!strcasecmp(argv[3],
"registered"))
7111 if (!strcasecmp(argv[4],
"like")) {
7112 if (regcomp(&cont.
regexbuf, argv[5], REG_EXTENDED | REG_NOSUB))
7119 if (!strcasecmp(argv[3],
"like")) {
7120 if (regcomp(&cont.
regexbuf, argv[4], REG_EXTENDED | REG_NOSUB))
7127 if (!strcasecmp(argv[3],
"registered")) {
7141 ast_cli(fd,
PEERS_FORMAT2,
"Name/Username",
"Host",
" ",
"Mask",
"Port",
" ",
"Status",
"Description");
7160 ast_cli(fd,
"%d iax2 peers [%d online, %d offline, %d unmonitored]\n",
7182 int threadcount = 0, dynamiccount = 0;
7187 e->
command =
"iax2 show threads";
7189 "Usage: iax2 show threads\n"
7190 " Lists status of IAX helper threads\n";
7198 ast_cli(
a->fd,
"IAX2 Thread Information\n");
7203#ifdef DEBUG_SCHED_MULTITHREAD
7204 ast_cli(
a->fd,
"Thread %d: state=%u, update=%d, actions=%d, func='%s'\n",
7207 ast_cli(
a->fd,
"Thread %d: state=%u, update=%d, actions=%d\n",
7213 ast_cli(
a->fd,
"Active Threads:\n");
7220#ifdef DEBUG_SCHED_MULTITHREAD
7221 ast_cli(
a->fd,
"Thread %c%d: state=%u, update=%d, actions=%d, func='%s'\n",
7224 ast_cli(
a->fd,
"Thread %c%d: state=%u, update=%d, actions=%d\n",
7230 ast_cli(
a->fd,
"Dynamic Threads:\n");
7233#ifdef DEBUG_SCHED_MULTITHREAD
7234 ast_cli(
a->fd,
"Thread %d: state=%u, update=%d, actions=%d, func='%s'\n",
7237 ast_cli(
a->fd,
"Thread %d: state=%u, update=%d, actions=%d\n",
7243 ast_cli(
a->fd,
"%d of %d threads accounted for with %d dynamic threads\n", threadcount,
iaxthreadcount, dynamiccount);
7253 e->
command =
"iax2 unregister";
7255 "Usage: iax2 unregister <peername>\n"
7256 " Unregister (force expiration) an IAX2 peer from the registry.\n";
7274 ast_cli(
a->fd,
"Peer %s unregistered\n",
a->argv[2]);
7276 ast_cli(
a->fd,
"Peer %s not found\n",
a->argv[2]);
7279 ast_cli(
a->fd,
"Peer %s not registered\n",
a->argv[2]);
7283 ast_cli(
a->fd,
"Peer unknown: %s. Not unregistered\n",
a->argv[2]);
7293 int wordlen = strlen(
word);
7299 if (!strncasecmp(p->
name,
word, wordlen) &&
7317 e->
command =
"iax2 show peers";
7319 "Usage: iax2 show peers [registered] [like <pattern>]\n"
7320 " Lists all known IAX2 peers.\n"
7321 " Optional 'registered' argument lists only peers with known addresses.\n"
7322 " Optional regular expression pattern is used to filter the peer list.\n";
7348 int *fd = user_data;
7350 ast_cli(*fd,
"%-15.15s %-15d %-15d\n",
7353 (
int) ntohl(
header->datalen));
7362 e->
command =
"iax2 show firmware";
7364 "Usage: iax2 show firmware\n"
7365 " Lists all known IAX firmware images.\n";
7371 if (
a->argc != 3 &&
a->argc != 4)
7374 ast_cli(
a->fd,
"%-15.15s %-15.15s %-15.15s\n",
"Device",
"Version",
"Size");
7377 a->argc == 3 ?
NULL :
a->argv[3],
7387 static const char *
const a[] = {
"iax2",
"show",
"peers" };
7389 char idtext[256] =
"";
7393 snprintf(idtext,
sizeof(idtext),
"ActionID: %s\r\n",
id);
7412 .registeredonly = 0,
7419 .unmonitored_peers = 0,
7428 snprintf(cont.
idtext,
sizeof(cont.
idtext),
"ActionID: %s\r\n",
id);
7450 return "Unregistered";
7452 return "Request Sent";
7454 return "Auth. Sent";
7456 return "Registered";
7462 return "No Authentication";
7470#define FORMAT2 "%-45.45s %-6.6s %-10.10s %-45.45s %8.8s %s\n"
7471#define FORMAT "%-45.45s %-6.6s %-10.10s %-45.45s %8d %s\n"
7480 e->
command =
"iax2 show registry";
7482 "Usage: iax2 show registry\n"
7483 " Lists all registration requests and status.\n";
7490 ast_cli(
a->fd,
FORMAT2,
"Host",
"dnsmgr",
"Username",
"Perceived",
"Refresh",
"State");
7498 (reg->
dnsmgr) ?
"Y" :
"N",
7503 ast_cli(
a->fd,
"%d IAX2 registrations.\n", counter);
7513 char idtext[256] =
"";
7515 char perceived[80] =
"";
7519 snprintf(idtext,
sizeof(idtext),
"ActionID: %s\r\n",
id);
7530 "Event: RegistryEntry\r\n"
7533 "DNSmanager: %s\r\n"
7538 "\r\n", idtext, host, (reg->
dnsmgr) ?
"Y" :
"N", reg->
username, perceived,
7553#define FORMAT2 "%-20.20s %-40.40s %-10.10s %-11.11s %-11.11s %-7.7s %-6.6s %-6.6s %s %s %9s\n"
7554#define FORMAT "%-20.20s %-40.40s %-10.10s %5.5d/%5.5d %5.5d/%5.5d %-5.5dms %-4.4dms %-4.4dms %-6.6s %s%s %3s%s\n"
7555#define FORMATB "%-20.20s %-40.40s %-10.10s %5.5d/%5.5d %5.5d/%5.5d [Native Bridged to ID=%5.5d]\n"
7558 char first_message[10] = { 0, };
7559 char last_message[10] = { 0, };
7563 e->
command =
"iax2 show channels";
7565 "Usage: iax2 show channels\n"
7566 " Lists all currently active IAX channels.\n";
7574 ast_cli(
a->fd,
FORMAT2,
"Channel",
"Peer",
"Username",
"ID (Lo/Rem)",
"Seq (Tx/Rx)",
"Lag",
"Jitter",
"JitBuf",
"Format",
"FirstMsg",
"LastMsg");
7578 int lag, jitter, localdelay;
7610 ast_cli(
a->fd,
"%d active IAX channel%s\n", numchans, (numchans != 1) ?
"s" :
"");
7621 char first_message[10] = { 0, };
7622 char last_message[10] = { 0, };
7623#define ACN_FORMAT1 "%-24.25s %4u %4d %4d %5d %3d %5d %4d %6d %4d %4d %5d %3d %5d %4d %6d %s%s %4s%s\n"
7624#define ACN_FORMAT2 "%s %u %d %d %d %d %d %d %d %d %d %d %d %d %d %d %s%s %s%s\n"
7628 int localjitter, localdelay, locallost, locallosspct, localdropped, localooo;
7635 localjitter = jbinfo.
jitter;
7638 locallosspct = jbinfo.
losspct/1000;
7659 iaxs[x]->frames_received/1000,
7660 iaxs[x]->remote_rr.jitter,
7681 iaxs[x]->frames_received/1000,
7682 iaxs[x]->remote_rr.jitter,
7707 e->
command =
"iax2 show netstats";
7709 "Usage: iax2 show netstats\n"
7710 " Lists network status for all currently active IAX channels.\n";
7717 ast_cli(
a->fd,
" -------- LOCAL --------------------- -------- REMOTE --------------------\n");
7718 ast_cli(
a->fd,
"Channel RTT Jit Del Lost %% Drop OOO Kpkts Jit Del Lost %% Drop OOO Kpkts FirstMsg LastMsg\n");
7720 ast_cli(
a->fd,
"%d active IAX channel%s\n", numchans, (numchans != 1) ?
"s" :
"");
7728 e->
command =
"iax2 set debug {on|off|peer}";
7730 "Usage: iax2 set debug {on|off|peer peername}\n"
7731 " Enables/Disables dumping of IAX packets for debugging purposes.\n";
7734 if (
a->pos == 4 && !strcasecmp(
a->argv[3],
"peer"))
7739 if (
a->argc < e->
args ||
a->argc > e->
args + 1)
7742 if (!strcasecmp(
a->argv[3],
"peer")) {
7745 if (
a->argc != e->
args + 1)
7751 ast_cli(
a->fd,
"IAX2 peer '%s' does not exist\n",
a->argv[e->
args-1]);
7760 }
else if (!strncasecmp(
a->argv[3],
"on", 2)) {
7762 ast_cli(
a->fd,
"IAX2 Debugging Enabled\n");
7766 ast_cli(
a->fd,
"IAX2 Debugging Disabled\n");
7775 e->
command =
"iax2 set debug trunk {on|off}";
7777 "Usage: iax2 set debug trunk {on|off}\n"
7778 " Enables/Disables debugging of IAX trunking\n";
7784 if (
a->argc != e->
args)
7787 if (!strncasecmp(
a->argv[e->
args - 1],
"on", 2)) {
7789 ast_cli(
a->fd,
"IAX2 Trunk Debugging Enabled\n");
7792 ast_cli(
a->fd,
"IAX2 Trunk Debugging Disabled\n");
7801 e->
command =
"iax2 set debug jb {on|off}";
7803 "Usage: iax2 set debug jb {on|off}\n"
7804 " Enables/Disables jitterbuffer debugging information\n";
7810 if (
a->argc != e->
args)
7813 if (!strncasecmp(
a->argv[e->
args -1],
"on", 2)) {
7815 ast_cli(
a->fd,
"IAX2 Jitterbuffer Debugging Enabled\n");
7818 ast_cli(
a->fd,
"IAX2 Jitterbuffer Debugging Disabled\n");
7861 f.
src = __FUNCTION__;
7875 ast_debug(2,
"Callno %d: Blocked sending control frame %d.\n",
7898 int call_num = i->
callno;
7901 if (!
iaxs[call_num])
7934 int gotcapability = 0;
7985 memset(&
iaxs[callno]->rprefs, 0,
sizeof(
iaxs[callno]->rprefs));
7989 if (!gotcapability) {
8001 !strcmp(
iaxs[callno]->username,
user->name))
8015 if (bestscore < 4) {
8024 if (bestscore < 3) {
8035 if (bestscore < 2) {
8044 if (bestscore < 1) {
8069 for (v =
user->vars ; v ; v = v->
next) {
8078 if (
user->maxauthreq > 0)
8127 char *family, *key=
NULL;
8130 key = strchr(family,
'/');
8173 return ast_sendto(sockfd, &fh,
sizeof(fh), 0, addr);
8200 int res = -1, authreq_restrict = 0;
8204 memset(&ied, 0,
sizeof(ied));
8212 if (
user->curauthreq ==
user->maxauthreq)
8213 authreq_restrict = 1;
8221 if (authreq_restrict) {
8250 char requeststr[256];
8251 char md5secret[256] =
"";
8253 char rsasecret[256] =
"";
8272 ast_log(
LOG_WARNING,
"Call Terminated, incoming call is unencrypted while force encrypt is enabled.\n");
8289 ast_log(
LOG_ERROR,
"Unable to create a temporary string for parsing stored 'inkeys'\n");
8293 keyn =
strsep(&stringp,
":");
8301 ast_log(
LOG_WARNING,
"Requested inkey '%s' for RSA authentication does not exist\n", keyn);
8303 keyn =
strsep(&stringp,
":");
8311 unsigned char digest[16];
8312 char *tmppw, *stringp;
8315 while((tmppw =
strsep(&stringp,
";"))) {
8318 MD5Update(&
md5, (
unsigned char *)tmppw, strlen(tmppw));
8322 sprintf(requeststr + (x << 1),
"%02hhx", digest[x]);
8323 if (!strcasecmp(requeststr, md5secret)) {
8332 if (!strcmp(secret, p->
secret)) {
8345 char requeststr[256] =
"";
8346 char peer[256] =
"";
8347 char md5secret[256] =
"";
8348 char rsasecret[256] =
"";
8349 char secret[256] =
"";
8379 if (!p || !
iaxs[callno]) {
8423 ast_log(
LOG_ERROR,
"Unable to create a temporary string for parsing stored 'inkeys'\n");
8427 keyn =
strsep(&stringp,
":");
8435 keyn =
strsep(&stringp,
":");
8445 ast_log(
LOG_NOTICE,
"Host '%s' trying to do RSA authentication, but we have no inkeys\n", peer);
8450 unsigned char digest[16];
8451 char *tmppw, *stringp;
8455 while((tmppw =
strsep(&stringp,
";"))) {
8458 MD5Update(&
md5, (
unsigned char *)tmppw, strlen(tmppw));
8461 sprintf(requeststr + (x << 1),
"%02hhx", digest[x]);
8462 if (!strcasecmp(requeststr, md5secret))
8474 if (strcmp(secret, p->
secret)) {
8494 if (expire && (expire <
iaxs[callno]->expiry)) {
8537 unsigned char digest[16];
8541 MD5Update(&
md5, (
unsigned char *) secret, strlen(secret));
8552 unsigned char digest[16];
8556 MD5Update(&
md5, (
unsigned char *)secret, strlen(secret));
8560 sprintf(digres + (x << 1),
"%02hhx", digest[x]);
8590 uint16_t callno = p->
callno;
8592 memset(&ied, 0,
sizeof(ied));
8644 if (!(p =
iaxs[callno])) {
8653 if (!(p =
iaxs[callno]))
8668 ast_log(
LOG_WARNING,
"Call terminated. Encryption requested by peer but no secret available locally\n");
8677 ast_log(
LOG_NOTICE,
"Call initiated without encryption while forceencryption=yes option is set\n");
8686 if (variablestore && varlist && p->
owner) {
8687 variablestore->
data = varlist;
8697 ast_log(
LOG_ERROR,
"Memory allocation error while processing IAX2 variables\n");
8708 ast_log(
LOG_ERROR,
"Memory allocation error while processing IAX2 variables\n");
8743#ifdef SCHED_MULTITHREADED
8756 memset(&ied, 0,
sizeof(ied));
8786 char exten[256] =
"";
8813 dp->
flags &= ~CACHE_FLAG_PENDING;
8820 if (write(dp->
waiters[x],
"asdf", 4) < 0) {
8839 peercallno = ies->
callno;
8841 if (peercallno < 1) {
8902 char peer[256] =
"";
8905 char ourip[256] =
"<Unspecified>";
8946 snprintf(msgstatus,
sizeof(msgstatus),
" with %d new and %d old messages waiting", reg->
messages & 0xff, reg->
messages >> 8);
8948 snprintf(msgstatus,
sizeof(msgstatus),
" with %d new messages waiting", reg->
messages);
8950 ast_copy_string(msgstatus,
" with 1 new message waiting",
sizeof(msgstatus));
8952 ast_copy_string(msgstatus,
" with no messages waiting",
sizeof(msgstatus));
8965 const char *secret,
const char *porta)
8991 if (!porta && !reg->
port) {
8994 sscanf(porta,
"%5d", ®->
port);
9022 ast_log(
LOG_WARNING,
"Format for registration is user[:secret]@host[:port] at line %d\n", lineno);
9031 porta =
strsep(&stringp,
":");
9033 if (porta && !atoi(porta)) {
9045 char *stringp, *
ext;
9087 if (peer->
expire == -1) {
9094 ast_debug(1,
"Expiring registration for peer '%s'\n", peer->
name);
9099 "peer_status",
"Unregistered",
9100 "cause",
"Expired");
9123#ifdef SCHED_MULTITHREADED
9139 expiry = strrchr(data,
':');
9195 const char *peer_name;
9227 ast_log(
LOG_NOTICE,
"Restricting registration for peer '%s' to %d seconds (requested %d)\n",
9231 ast_log(
LOG_NOTICE,
"Restricting registration for peer '%s' to %d seconds (requested %d)\n",
9257 ast_verb(3,
"Registered IAX2 '%s' (%s) at %s\n",
9263 "peer_status",
"Registered",
9264 "address", str_addr,
9269 ast_verb(3,
"Unregistered IAX2 '%s' (%s)\n",
9274 "peer_status",
"Unregistered");
9341 msgcount = (old << 8) |
new;
9367 const char *peer_name;
9382 memset(&ied, 0,
sizeof(ied));
9415 char peer[256] =
"";
9418 int authmethods = 0;
9425 memset(&ied, 0,
sizeof(ied));
9440 if (reg->
secret[0] ==
'[') {
9443 tmpkey[strlen(tmpkey) - 1] =
'\0';
9467 int callno = (int)(
long)(nothing);
9471 memset(&ied, 0,
sizeof(ied));
9486 int callno = (int)(
long)(data);
9491#ifdef SCHED_MULTITHREADED
9516 int callno = (int)(
long)(nothing);
9520 memset(&ied, 0,
sizeof(ied));
9530 int callno = (int)(
long)(data);
9536#ifdef SCHED_MULTITHREADED
9549 memset(&ied, 0,
sizeof(ied));
9566 if (((
unsigned char) (f->
oseqno -
last) < 128) &&
9584#ifdef SCHED_MULTITHREADED
9621 calls = tpeer->
calls;
9637 if (now->tv_sec > tpeer->
trunkact.tv_sec + 5)
9676 ast_verbose(
" - Trunk peer (%s) has %d call chunk%s in transit, %u bytes backlogged and has hit a high water mark of %u bytes\n",
9679 (res != 1) ?
"s" :
"",
9696 if (drop->trunkdata) {
9698 drop->trunkdata =
NULL;
9706 ast_verbose(
"Ending trunk processing with %d peers and %d call chunks processed\n", processed,
totalcalls);
9720static void dp_lookup(
int callno,
const char *
context,
const char *callednum,
const char *callerid,
int skiplock)
9722 unsigned short dpstatus = 0;
9726 memset(&ied1, 0,
sizeof(ied1));
9765 pthread_t newthread;
9783 unsigned int ourver;
9785 snprintf(rsi,
sizeof(rsi),
"si-%s", si);
9788 ast_debug(1,
"Service identifier '%s', we think '%08x', they think '%08x'\n", si, ourver, ver);
9799 memset(iep, 0,
sizeof(*iep));
9824 unsigned int length, offset = 0;
9835 memcpy(full_osptoken + offset, ies->
osptokenblock[i], length);
9842 *(full_osptoken + offset) =
'\0';
9843 if (strlen(full_osptoken) != offset) {
9845 *full_osptoken =
'\0';
9853 int localjitter = -1, localdelay = 0, locallost = -1, locallosspct = -1, localdropped = 0, localooo = -1, localpackets = -1;
9860 localjitter = jbinfo.
jitter;
9863 locallosspct = jbinfo.
losspct/1000;
9868 ast_debug(3,
"JB STATS:%s ping=%u ljitterms=%d ljbdelayms=%d ltotlost=%d lrecentlosspct=%d ldropped=%d looo=%d lrecvd=%d rjitterms=%d rjbdelayms=%d rtotlost=%d rrecentlosspct=%d rdropped=%d rooo=%d rrecvd=%d\n",
9933 memcpy(pkt_buf->
buf, from_here->
buf, pkt_buf->
len);
9959 static time_t last_errtime = 0;
9964 if (t != last_errtime) {
9966 ast_debug(1,
"Out of idle IAX2 threads for I/O, pausing!\n");
9976 if (
thread->buf_len < 0) {
9977 if (
errno != ECONNREFUSED &&
errno != EAGAIN)
10025#ifdef DEBUG_SCHED_MULTITHREAD
10036 unsigned char metatype;
10043 struct timeval rxtrunktime;
10046 if (packet_len <
sizeof(*
meta)) {
10047 ast_log(
LOG_WARNING,
"Rejecting packet from '%s' that is flagged as a meta frame but is too short\n",
10055 if (packet_len < (
sizeof(*
meta) +
sizeof(*mth))) {
10056 ast_log(
LOG_WARNING,
"midget meta trunk packet received (%d of %d min)\n", packet_len,
10057 (
int) (
sizeof(*
meta) +
sizeof(*mth)));
10061 ts = ntohl(mth->
ts);
10062 metatype =
meta->cmddata;
10063 packet_len -= (
sizeof(*meta) +
sizeof(*mth));
10067 ast_log(
LOG_WARNING,
"Unable to accept trunked packet from '%s': No matching peer\n",
10076 while (packet_len >=
sizeof(*mte)) {
10078 unsigned short callno, trunked_ts,
len;
10082 ptr +=
sizeof(*mtm);
10083 packet_len -=
sizeof(*mtm);
10086 trunked_ts = ntohs(mtm->
mini.
ts);
10089 ptr +=
sizeof(*mte);
10090 packet_len -=
sizeof(*mte);
10099 if (
len > packet_len)
10108 memset(&f, 0,
sizeof(f));
10171 if (!variablestore) {
10175 varlist = variablestore->
data;
10179 if (strcmp(
var->name, data) == 0) {
10200 if (!variablestore) {
10202 if (!variablestore) {
10214 variablestore->
data = varlist;
10218 varlist = variablestore->
data;
10222 if (strcmp(
var->name, data) == 0) {
10247 if (
iaxs[callno] &&
iaxs[callno]->owner) {
10269 int updatehistory=1;
10272 char decrypted = 0;
10291 char host_pref_buf[128];
10292 char caller_pref_buf[128];
10294 char *using_prefs =
"mine";
10298 memset(fr, 0,
sizeof(*fr));
10306 if (res <
sizeof(*mh)) {
10307 ast_log(
LOG_WARNING,
"midget packet received (%d of %d min)\n", res, (
int)
sizeof(*mh));
10310 if ((vh->zeros == 0) && (ntohs(vh->callno) & 0x8000)) {
10311 if (res <
sizeof(*vh)) {
10312 ast_log(
LOG_WARNING,
"Rejecting packet from '%s' that is flagged as a video frame but is too short\n",
10318 fr->
callno =
find_callno(ntohs(vh->callno) & ~0x8000, dcallno, &addr,
new, fd, 0);
10320 }
else if ((
meta->zeros == 0) && !(ntohs(
meta->metacmd) & 0x8000))
10323#ifdef DEBUG_SUPPORT
10324 if (res >=
sizeof(*fh))
10328 if (res <
sizeof(*fh)) {
10329 ast_log(
LOG_WARNING,
"Rejecting packet from '%s' that is flagged as a full frame but is too short\n",
10335 dcallno = ntohs(fh->
dcallno) & ~IAX_FLAG_RETRANS;
10362 if ((fh->
csub >> 6) & 0x1) {
10384 f.
datalen = res -
sizeof(*fh);
10398 memset(&ies, 0,
sizeof(ies));
10405 memset(&ies, 0,
sizeof(ies));
10429 memset(&ies, 0,
sizeof(ies));
10433 int check_dcallno = 0;
10499#ifdef DEBUG_SUPPORT
10511 int data_size =
sizeof(*cause_code);
10512 char subclass[40] =
"";
10528 data_size += strlen(subclass);
10531 memset(cause_code, 0, data_size);
10535 snprintf(cause_code->
code, data_size -
sizeof(*cause_code) + 1,
"IAX2 %s(%d)", subclass, ies.
causecode);
10556 unsigned short new_peercallno;
10558 new_peercallno = (
unsigned short) (ntohs(mh->callno) & ~IAX_FLAG_FULL);
10573 fr->
ts = ntohl(fh->
ts);
10576 ast_debug(1,
"Simulating frame ts resync, was %u now %u\n", fr->
ts, fr->
ts + test_resync);
10577 fr->
ts += test_resync;
10609 ast_debug(1,
"Packet arrived out of order (expecting %d, got %d) (frametype = %u, subclass = %d)\n",
10642 if (res < thread->buf_size)
10643 thread->buf[res++] =
'\0';
10645 thread->buf[res - 1] =
'\0';
10654 int call_to_destroy;
10666 ast_debug(1,
"Cancelling transmission of packet %d\n", x);
10667 call_to_destroy = 0;
10674 call_to_destroy = fr->
callno;
10677 if (call_to_destroy) {
10679 ast_debug(1,
"Really destroying %d, having been acked on final message\n", call_to_destroy);
10740 if (variablestore && varlist) {
10741 variablestore->
data = varlist;
10753 ast_log(
LOG_ERROR,
"Memory allocation error while processing IAX2 variables\n");
10764 ast_log(
LOG_ERROR,
"Memory allocation error while processing IAX2 variables\n");
10765 if (variablestore) {
10776 ast_debug(1,
"No channel, so populating IAXVARs to the pvt, as an intermediate step.\n");
10787 ast_debug(1,
"I have IAX variables, but they were not processed\n");
10817 ast_debug(1,
"Neat, somebody took away the channel at a magical time but i found it!\n");
10821 ast_debug(1,
"I can haz iaxvars, but they is no good. :-(\n");
10863 const char *moh_suggest;
10909 memset(&ied1, 0,
sizeof(ied1));
10931 fr->
callno = new_callno;
10940 ast_log(
LOG_NOTICE,
"Rejected connect attempt from %s, who was trying to reach '%s@%s'\n",
10947 ast_log(
LOG_WARNING,
"Rejected connect attempt. No secret present while force encrypt enabled.\n");
10951 const char *
context, *exten, *cid_num;
10971 memset(&ied0, 0,
sizeof(ied0));
10979 ast_log(
LOG_NOTICE,
"Rejected connect attempt from %s, request '%s@%s' does not exist\n",
10987 using_prefs =
"reqonly";
10989 using_prefs =
"disabled";
10992 memset(&pref, 0,
sizeof(pref));
10993 strcpy(caller_pref_buf,
"disabled");
10994 strcpy(host_pref_buf,
"disabled");
10997 using_prefs =
"mine";
11005 using_prefs =
"caller";
11020 memset(&ied0, 0,
sizeof(ied0));
11033 ast_log(
LOG_NOTICE,
"Rejected connect attempt from %s, requested '%s' incompatible with our capability '%s'.\n",
11038 ast_log(
LOG_NOTICE,
"Rejected connect attempt from %s, requested/capability '%s'/'%s' incompatible with our capability '%s'.\n",
11053 memset(&pref, 0,
sizeof(pref));
11055 strcpy(caller_pref_buf,
"disabled");
11056 strcpy(host_pref_buf,
"disabled");
11059 using_prefs =
"mine";
11066 using_prefs =
"caller";
11079 memset(&ied0, 0,
sizeof(ied0));
11088 ast_log(
LOG_NOTICE,
"Rejected connect attempt from %s, requested/capability '%s'/'%s' incompatible with our capability '%s'.\n",
11101 memset(&ied1, 0,
sizeof(ied1));
11107 ast_verb(3,
"Accepting UNAUTHENTICATED call from %s:\n"
11108 "%srequested format = %s,\n"
11109 "%srequested prefs = %s,\n"
11110 "%sactual format = %s,\n"
11111 "%shost prefs = %s,\n"
11112 "%spriority = %s\n",
11161 ast_debug(1,
"Immediately destroying %d, having received hangup\n", fr->
callno);
11188 ast_debug(1,
"Immediately destroying %d, having received reject\n",
11247 memset(&ied0, 0,
sizeof(ied0));
11258 ast_log(
LOG_NOTICE,
"Rejected call to %s, format %s incompatible with our capability %s.\n",
11325 "peer_status",
"Reachable",
11334 "peer_status",
"Lagged",
11388 ast_debug(1,
"Peer %s lag measured as %dms\n",
11402 "I don't know how to authenticate %s to %s\n",
11420 memset(&ied0, 0,
sizeof(ied0));
11431 ast_log(
LOG_WARNING,
"Rejected connect attempt from %s, request '%s@%s' does not exist\n",
11435 memset(&ied0, 0,
sizeof(ied0));
11446 using_prefs =
"reqonly";
11448 using_prefs =
"disabled";
11451 memset(&pref, 0,
sizeof(pref));
11452 strcpy(caller_pref_buf,
"disabled");
11453 strcpy(host_pref_buf,
"disabled");
11456 using_prefs =
"mine";
11462 using_prefs =
"caller";
11478 ast_debug(1,
"We don't do requested format %s, falling back to peer capability '%s'\n",
11486 ast_log(
LOG_WARNING,
"Rejected connect attempt from %s, requested '%s' incompatible with our capability '%s'.\n",
11491 ast_log(
LOG_WARNING,
"Rejected connect attempt from %s, requested/capability '%s'/'%s' incompatible with our capability '%s'.\n",
11498 memset(&ied0, 0,
sizeof(ied0));
11513 memset(&pref, 0,
sizeof(pref));
11517 strcpy(caller_pref_buf,
"disabled");
11518 strcpy(host_pref_buf,
"disabled");
11521 using_prefs =
"mine";
11528 using_prefs =
"caller";
11544 ast_log(
LOG_WARNING,
"Rejected connect attempt from %s, requested '%s' incompatible with our capability '%s'.\n",
11549 ast_log(
LOG_WARNING,
"Rejected connect attempt from %s, requested/capability '%s'/'%s' incompatible with our capability '%s'.\n",
11556 memset(&ied0, 0,
sizeof(ied0));
11568 memset(&ied1, 0,
sizeof(ied1));
11575 ast_verb(3,
"Accepting AUTHENTICATED call from %s:\n"
11576 "%srequested auth methods = (%s),\n"
11577 "%sactual auth method = %s,\n"
11578 "%sencrypted = %s,\n"
11579 "%srequested format = %s,\n"
11580 "%srequested prefs = %s,\n"
11581 "%sactual format = %s,\n"
11582 "%shost prefs = %s,\n"
11583 "%spriority = %s\n",
11612 }
else if (ies.
vars) {
11618 if (variablestore && varlist) {
11619 variablestore->
data = varlist;
11622 ast_debug(1,
"I can haz IAX vars? w00t\n");
11630 ast_log(
LOG_ERROR,
"Memory allocation error while processing IAX2 variables\n");
11640 ast_log(
LOG_ERROR,
"Memory allocation error while processing IAX2 variables\n");
11652 goto immediatedial;
11665 ast_log(
LOG_WARNING,
"Rejected dial attempt from %s, request '%s@%s' does not exist\n",
11669 memset(&ied0, 0,
sizeof(ied0));
11679 ast_verb(3,
"Accepting DIAL from %s, formats = %s\n",
11689 }
else if (ies.
vars) {
11695 ast_debug(1,
"I can haz IAX vars? w00t\n");
11696 if (variablestore && varlist) {
11697 variablestore->
data = varlist;
11707 ast_log(
LOG_ERROR,
"Memory allocation error while processing IAX2 variables\n");
11717 ast_log(
LOG_ERROR,
"Memory allocation error while processing IAX2 variables\n");
11729 ast_debug(1,
"Immediately destroying %d, having received INVAL\n", fr->
callno);
11734 ast_debug(1,
"Received VNAK: resending outstanding frames\n");
11800 memset(&ied0, 0,
sizeof(ied0));
11875 memset(&ied0, 0,
sizeof(ied0));
11876 memset(&ied1, 0,
sizeof(ied1));
11894 memset(&ied0, 0,
sizeof(ied0));
11895 memset(&ied1, 0,
sizeof(ied1));
11931 "we've been told to rotate our encryption key, "
11932 "but this isn't an encrypted call. bad things will happen.\n"
11953 memset(&ied0, 0,
sizeof(ied0));
11973 memset(&ied0, 0,
sizeof(ied0));
11980 ast_debug(1,
"I can haz IAX vars, but they is no good :-(\n");
12000 }
else if (minivid) {
12003 if (ntohs(vh->ts) & 0x8000LL) {
12019 f.
datalen = res -
sizeof(*vh);
12026 fr->
ts = (
iaxs[fr->
callno]->
last & 0xFFFF8000L) | ((ntohs(vh->ts) + test_resync) & 0x7fff);
12029 fr->
ts = (
iaxs[fr->
callno]->
last & 0xFFFF8000L) | (ntohs(vh->ts) & 0x7fff);
12041 ast_debug(1,
"Received mini frame before first full voice frame\n");
12060 fr->
ts = (
iaxs[fr->
callno]->
last & 0xFFFF0000L) | ((ntohs(mh->ts) + test_resync) & 0xffff);
12078 ast_debug(2,
"Callno %d: Blocked receiving control frame %d.\n",
12089 ast_debug(2,
"Callno %d: Config blocked receiving control frame %d.\n",
12211 struct timeval wait;
12212 struct timespec ts;
12213 int put_into_idle = 0;
12214 int first_time = 1;
12219 pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, &old_state);
12238 if (put_into_idle) {
12246 ts.tv_sec = wait.tv_sec;
12247 ts.tv_nsec = wait.tv_usec * 1000;
12251 if (!put_into_idle ||
thread->stop) {
12271 ts.tv_sec = wait.tv_sec;
12272 ts.tv_nsec = wait.tv_usec * 1000;
12292 switch (
thread->iostate) {
12304#ifdef SCHED_MULTITHREADED
12322 time(&
thread->checktime);
12324#ifdef DEBUG_SCHED_MULTITHREAD
12325 thread->curfunc[0]=
'\0';
12344 pthread_detach(pthread_self());
12350 pthread_cleanup_pop(1);
12371 int callno = reg->
callno;
12379 ast_debug(1,
"Unable to send registration request for '%s' without IP address\n", reg->
username);
12391 ast_debug(3,
"Allocate call number\n");
12406 memset(&ied, 0,
sizeof(ied));
12426 memset(&cai, 0,
sizeof(cai));
12428 ast_debug(1,
"Provisioning '%s' from template '%s'\n", dest,
template);
12431 ast_debug(1,
"No provisioning found for template '%s'\n",
template);
12442 memset(&ied, 0,
sizeof(ied));
12449 if (
iaxs[callno]) {
12477 opts = strchr(sdata,
'|');
12490 ast_verb(3,
"Provisioned IAXY at '%s' with '%s'= %d\n",
12503 e->
command =
"iax2 provision";
12505 "Usage: iax2 provision <host> <template> [forced]\n"
12506 " Provisions the given peer or IP address using a template\n"
12507 " matching either 'template' or '*' if the template is not\n"
12508 " found. If 'forced' is specified, even empty provisioning\n"
12509 " fields will be provisioned as empty fields.\n";
12520 if (!strcasecmp(
a->argv[4],
"forced"))
12527 ast_cli(
a->fd,
"Unable to find peer/address '%s'\n",
a->argv[2]);
12529 ast_cli(
a->fd,
"No template (including wildcard) matching '%s'\n",
a->argv[3]);
12531 ast_cli(
a->fd,
"Provisioning '%s' with template '%s'%s\n",
a->argv[2],
a->argv[3], force ?
", forced" :
"");
12540 if (peer->
lastms > -1) {
12546 "peer_status",
"Unreachable",
12568#ifdef SCHED_MULTITHREADED
12687 memset(&pds, 0,
sizeof(pds));
12697 memset(&cai, 0,
sizeof(cai));
12725 if ((new_callno =
make_trunk(callno, 1)) != -1)
12726 callno = new_callno;
12738 requestor, cai.
found);
12779 ao2_ref(best_fmt_native, -1);
12802 pthread_testcancel();
12809 if (res < 0 &&
errno != -EINTR) {
12821 int threadcount = 0;
12827 thread->threadnum = ++threadcount;
12861 ast_verb(2,
"%d helper threads started\n", threadcount);
12878 if (strstr(
value,
"rsa"))
12880 if (strstr(
value,
"md5"))
12882 if (strstr(
value,
"plaintext"))
12897 sd = socket(addr->
ss.ss_family, SOCK_DGRAM, 0);
12930 port = atoi(portstr);
12968 if (nonlocal == 1) {
12970 "Non-local or unbound address specified (%s) in sourceaddress for '%s', reverting to default\n",
12974 }
else if (nonlocal == 2) {
12976 "Unable to bind to sourceaddress '%s' for '%s', reverting to default\n",
12981 ast_debug(1,
"Using sourceaddress %s for '%s'\n", srcaddr, peer->
name);
13021 int subscribe_acl_change = 0;
13032 oldacl = peer->
acl;
13082 if (!strcasecmp(v->
name,
"secret")) {
13084 }
else if (!strcasecmp(v->
name,
"mailbox")) {
13086 }
else if (!strcasecmp(v->
name,
"hasvoicemail")) {
13092 if (strchr(
name,
'@')) {
13098 }
else if (!strcasecmp(v->
name,
"mohinterpret")) {
13100 }
else if (!strcasecmp(v->
name,
"mohsuggest")) {
13102 }
else if (!strcasecmp(v->
name,
"dbsecret")) {
13104 }
else if (!strcasecmp(v->
name,
"description")) {
13106 }
else if (!strcasecmp(v->
name,
"trunk")) {
13109 ast_log(
LOG_WARNING,
"Unable to support trunking on peer '%s' without a timing interface\n", peer->
name);
13112 }
else if (!strcasecmp(v->
name,
"auth")) {
13117 }
else if (!strcasecmp(v->
name,
"encryption")) {
13122 }
else if (!strcasecmp(v->
name,
"forceencryption")) {
13131 }
else if (!strcasecmp(v->
name,
"transfer")) {
13132 if (!strcasecmp(v->
value,
"mediaonly")) {
13138 }
else if (!strcasecmp(v->
name,
"jitterbuffer")) {
13140 }
else if (!strcasecmp(v->
name,
"host")) {
13141 if (!strcasecmp(v->
value,
"dynamic")) {
13169 }
else if (!strcasecmp(v->
name,
"defaultip")) {
13171 peer_defaddr_tmp.
ss.ss_family = AF_UNSPEC;
13177 }
else if (!strcasecmp(v->
name,
"sourceaddress")) {
13179 }
else if (!strcasecmp(v->
name,
"permit") ||
13180 !strcasecmp(v->
name,
"deny") ||
13181 !strcasecmp(v->
name,
"acl")) {
13183 }
else if (!strcasecmp(v->
name,
"mask")) {
13186 }
else if (!strcasecmp(v->
name,
"context")) {
13188 }
else if (!strcasecmp(v->
name,
"regexten")) {
13190 }
else if (!strcasecmp(v->
name,
"peercontext")) {
13192 }
else if (!strcasecmp(v->
name,
"port")) {
13202 }
else if (!strcasecmp(v->
name,
"username")) {
13204 }
else if (!strcasecmp(v->
name,
"allow")) {
13206 }
else if (!strcasecmp(v->
name,
"disallow")) {
13208 }
else if (!strcasecmp(v->
name,
"callerid")) {
13220 }
else if (!strcasecmp(v->
name,
"fullname")) {
13223 }
else if (!strcasecmp(v->
name,
"cid_number")) {
13226 }
else if (!strcasecmp(v->
name,
"sendani")) {
13228 }
else if (!strcasecmp(v->
name,
"inkeys")) {
13230 }
else if (!strcasecmp(v->
name,
"outkey")) {
13232 }
else if (!strcasecmp(v->
name,
"qualify")) {
13233 if (!strcasecmp(v->
value,
"no")) {
13235 }
else if (!strcasecmp(v->
value,
"yes")) {
13237 }
else if (sscanf(v->
value,
"%30d", &peer->
maxms) != 1) {
13238 ast_log(
LOG_WARNING,
"Qualification of peer '%s' should be 'yes', 'no', or a number of milliseconds at line %d of iax.conf\n", peer->
name, v->
lineno);
13241 }
else if (!strcasecmp(v->
name,
"qualifysmoothing")) {
13243 }
else if (!strcasecmp(v->
name,
"qualifyfreqok")) {
13245 ast_log(
LOG_WARNING,
"Qualification testing frequency of peer '%s' when OK should a number of milliseconds at line %d of iax.conf\n", peer->
name, v->
lineno);
13247 }
else if (!strcasecmp(v->
name,
"qualifyfreqnotok")) {
13249 ast_log(
LOG_WARNING,
"Qualification testing frequency of peer '%s' when NOT OK should be a number of milliseconds at line %d of iax.conf\n", peer->
name, v->
lineno);
13251 }
else if (!strcasecmp(v->
name,
"timezone")) {
13253 }
else if (!strcasecmp(v->
name,
"adsi")) {
13255 }
else if (!strcasecmp(v->
name,
"connectedline")) {
13258 }
else if (!strcasecmp(v->
value,
"send")) {
13261 }
else if (!strcasecmp(v->
value,
"receive")) {
13267 }
else if (!strcasecmp(v->
name,
"maxcallnumbers")) {
13273 }
else if (!strcasecmp(v->
name,
"requirecalltoken")) {
13277 }
else if (!strcasecmp(v->
value,
"auto")) {
13318 if (subscribe_acl_change) {
13347 int oldcurauthreq = 0;
13348 int subscribe_acl_change = 0;
13349 char *varname =
NULL, *varval =
NULL;
13360 oldcurauthreq =
user->curauthreq;
13361 oldacl =
user->acl;
13362 oldcon =
user->contexts;
13381 user->curauthreq = oldcurauthreq;
13403 if (!strcasecmp(v->
name,
"context")) {
13409 user->contexts = con;
13412 }
else if (!strcasecmp(v->
name,
"permit") ||
13413 !strcasecmp(v->
name,
"deny") ||
13414 !strcasecmp(v->
name,
"acl")) {
13416 }
else if (!strcasecmp(v->
name,
"setvar")) {
13418 if ((varval = strchr(varname,
'='))) {
13424 user->vars = tmpvar;
13428 }
else if (!strcasecmp(v->
name,
"allow")) {
13430 }
else if (!strcasecmp(v->
name,
"disallow")) {
13432 }
else if (!strcasecmp(v->
name,
"trunk")) {
13435 ast_log(
LOG_WARNING,
"Unable to support trunking on user '%s' without a timing interface\n",
user->name);
13438 }
else if (!strcasecmp(v->
name,
"auth")) {
13443 }
else if (!strcasecmp(v->
name,
"encryption")) {
13445 if (!
user->encmethods) {
13448 }
else if (!strcasecmp(v->
name,
"forceencryption")) {
13453 if (
user->encmethods) {
13457 }
else if (!strcasecmp(v->
name,
"transfer")) {
13458 if (!strcasecmp(v->
value,
"mediaonly")) {
13464 }
else if (!strcasecmp(v->
name,
"codecpriority")) {
13465 if(!strcasecmp(v->
value,
"caller"))
13467 else if(!strcasecmp(v->
value,
"disabled"))
13469 else if(!strcasecmp(v->
value,
"reqonly")) {
13473 }
else if (!strcasecmp(v->
name,
"immediate")) {
13475 }
else if (!strcasecmp(v->
name,
"jitterbuffer")) {
13477 }
else if (!strcasecmp(v->
name,
"dbsecret")) {
13479 }
else if (!strcasecmp(v->
name,
"secret")) {
13486 }
else if (!strcasecmp(v->
name,
"callerid")) {
13499 }
else if (!strcasecmp(v->
name,
"fullname")) {
13508 }
else if (!strcasecmp(v->
name,
"cid_number")) {
13517 }
else if (!strcasecmp(v->
name,
"accountcode")) {
13519 }
else if (!strcasecmp(v->
name,
"mohinterpret")) {
13521 }
else if (!strcasecmp(v->
name,
"mohsuggest")) {
13523 }
else if (!strcasecmp(v->
name,
"parkinglot")) {
13525 }
else if (!strcasecmp(v->
name,
"language")) {
13527 }
else if (!strcasecmp(v->
name,
"amaflags")) {
13532 user->amaflags = format;
13534 }
else if (!strcasecmp(v->
name,
"inkeys")) {
13536 }
else if (!strcasecmp(v->
name,
"maxauthreq")) {
13538 if (
user->maxauthreq < 0)
13539 user->maxauthreq = 0;
13540 }
else if (!strcasecmp(v->
name,
"adsi")) {
13542 }
else if (!strcasecmp(v->
name,
"connectedline")) {
13545 }
else if (!strcasecmp(v->
value,
"send")) {
13548 }
else if (!strcasecmp(v->
value,
"receive")) {
13554 }
else if (!strcasecmp(v->
name,
"requirecalltoken")) {
13558 }
else if (!strcasecmp(v->
value,
"auto")) {
13573 if (!
user->authmethods) {
13594 if (subscribe_acl_change) {
13703 const char *tosval;
13708 int subscribe_network_change = 1;
13743 ast_log(
LOG_ERROR,
"Config file users.conf is in an invalid format. Aborting.\n");
13795 if (!strcasecmp(v->
name,
"bindport")) {
13802 }
else if (!strcasecmp(v->
name,
"pingtime")){
13805 else if (!strcasecmp(v->
name,
"iaxthreadcount")) {
13819 }
else if (!strcasecmp(v->
name,
"iaxmaxthreadcount")) {
13834 }
else if (!strcasecmp(v->
name,
"nochecksums")) {
13842 ast_log(
LOG_WARNING,
"Disabling RTP checksums is not supported on this operating system!\n");
13845 else if (!strcasecmp(v->
name,
"maxjitterbuffer"))
13847 else if (!strcasecmp(v->
name,
"resyncthreshold"))
13849 else if (!strcasecmp(v->
name,
"maxjitterinterps"))
13851 else if (!strcasecmp(v->
name,
"jittertargetextra"))
13853 else if (!strcasecmp(v->
name,
"lagrqtime"))
13855 else if (!strcasecmp(v->
name,
"maxregexpire"))
13857 else if (!strcasecmp(v->
name,
"minregexpire"))
13859 else if (!strcasecmp(v->
name,
"bindaddr")) {
13887 }
else if (!strcasecmp(v->
name,
"auth")) {
13892 }
else if (!strcasecmp(v->
name,
"authdebug")) {
13894 }
else if (!strcasecmp(v->
name,
"encryption")) {
13899 }
else if (!strcasecmp(v->
name,
"forceencryption")) {
13908 }
else if (!strcasecmp(v->
name,
"transfer")) {
13909 if (!strcasecmp(v->
value,
"mediaonly")) {
13915 }
else if (!strcasecmp(v->
name,
"codecpriority")) {
13916 if(!strcasecmp(v->
value,
"caller"))
13918 else if(!strcasecmp(v->
value,
"disabled"))
13920 else if(!strcasecmp(v->
value,
"reqonly")) {
13924 }
else if (!strcasecmp(v->
name,
"jitterbuffer"))
13926 else if (!strcasecmp(v->
name,
"delayreject"))
13928 else if (!strcasecmp(v->
name,
"allowfwdownload"))
13930 else if (!strcasecmp(v->
name,
"rtcachefriends"))
13932 else if (!strcasecmp(v->
name,
"rtignoreregexpire"))
13934 else if (!strcasecmp(v->
name,
"rtupdate"))
13936 else if (!strcasecmp(v->
name,
"rtsavesysname"))
13938 else if (!strcasecmp(v->
name,
"trunktimestamps"))
13940 else if (!strcasecmp(v->
name,
"rtautoclear")) {
13941 int i = atoi(v->
value);
13947 }
else if (!strcasecmp(v->
name,
"trunkfreq")) {
13950 ast_log(
LOG_NOTICE,
"trunkfreq must be between 10ms and 1000ms, using 10ms instead.\n");
13953 ast_log(
LOG_NOTICE,
"trunkfreq must be between 10ms and 1000ms, using 1000ms instead.\n");
13959 }
else if (!strcasecmp(v->
name,
"trunkmtu")) {
13960 mtuv = atoi(v->
value);
13963 else if (mtuv >= 172 && mtuv < 4000)
13968 }
else if (!strcasecmp(v->
name,
"trunkmaxsize")) {
13972 }
else if (!strcasecmp(v->
name,
"autokill")) {
13973 if (sscanf(v->
value,
"%30d", &x) == 1) {
13983 }
else if (!strcasecmp(v->
name,
"bandwidth")) {
13984 if (!strcasecmp(v->
value,
"low")) {
13987 }
else if (!strcasecmp(v->
value,
"medium")) {
13990 }
else if (!strcasecmp(v->
value,
"high")) {
13996 }
else if (!strcasecmp(v->
name,
"allow")) {
13998 }
else if (!strcasecmp(v->
name,
"disallow")) {
14000 }
else if (!strcasecmp(v->
name,
"register")) {
14002 }
else if (!strcasecmp(v->
name,
"iaxcompat")) {
14004 }
else if (!strcasecmp(v->
name,
"regcontext")) {
14008 }
else if (!strcasecmp(v->
name,
"tos")) {
14011 }
else if (!strcasecmp(v->
name,
"cos")) {
14014 }
else if (!strcasecmp(v->
name,
"parkinglot")) {
14016 }
else if (!strcasecmp(v->
name,
"accountcode")) {
14018 }
else if (!strcasecmp(v->
name,
"mohinterpret")) {
14020 }
else if (!strcasecmp(v->
name,
"mohsuggest")) {
14022 }
else if (!strcasecmp(v->
name,
"amaflags")) {
14029 }
else if (!strcasecmp(v->
name,
"language")) {
14031 }
else if (!strcasecmp(v->
name,
"maxauthreq")) {
14035 }
else if (!strcasecmp(v->
name,
"adsi")) {
14037 }
else if (!strcasecmp(v->
name,
"srvlookup")) {
14039 }
else if (!strcasecmp(v->
name,
"connectedline")) {
14042 }
else if (!strcasecmp(v->
value,
"send")) {
14045 }
else if (!strcasecmp(v->
value,
"receive")) {
14051 }
else if (!strcasecmp(v->
name,
"maxcallnumbers")) {
14055 }
else if (!strcasecmp(v->
name,
"maxcallnumbers_nonvalidated")) {
14059 }
else if (!strcasecmp(v->
name,
"calltokenoptional")) {
14064 }
else if (!strcasecmp(v->
name,
"calltokenexpiration")) {
14066 sscanf(v->
value,
"%u", &temp);
14072 }
else if (!strcasecmp(v->
name,
"subscribe_network_change_event")) {
14074 subscribe_network_change = 1;
14076 subscribe_network_change = 0;
14080 }
else if (!strcasecmp(v->
name,
"shrinkcallerid")) {
14093 if (subscribe_network_change) {
14122 ast_log(
LOG_WARNING,
"Minimum registration interval of %d is more than maximum of %d, resetting minimum to %d\n",
14132 int genregisteriax;
14133 const char *hasiax, *registeriax;
14140 if (strcasecmp(cat,
"general")) {
14143 if (
ast_true(hasiax) || (!hasiax && genhasiax)) {
14159 if (
ast_true(registeriax) || (!registeriax && genregisteriax)) {
14172 snprintf(tmp,
sizeof(tmp),
"%s:%s@%s", username, secret, host);
14174 snprintf(tmp,
sizeof(tmp),
"%s@%s", username, host);
14186 if (strcasecmp(cat,
"general")) {
14188 if (!strcasecmp(cat,
"callnumberlimits")) {
14190 }
else if (utype) {
14191 if (!strcasecmp(utype,
"user") || !strcasecmp(utype,
"friend")) {
14198 if (!strcasecmp(utype,
"peer") || !strcasecmp(utype,
"friend")) {
14206 }
else if (strcasecmp(utype,
"user")) {
14232 static const char config[] =
"iax.conf";
14267 "Usage: iax2 reload\n"
14268 " Reloads IAX configuration from iax.conf\n";
14298 if (
iaxs[x] && !strcasecmp(data,
iaxs[x]->dproot))
14306 memset(&cai, 0,
sizeof(cai));
14307 memset(&ied, 0,
sizeof(ied));
14308 memset(&pds, 0,
sizeof(pds));
14322 ast_debug(1,
"peer: %s, username: %s, password: %s, context: %s\n",
14361 int x, com[2], timeout, doabort, callno;
14434 pfd.events = POLLIN;
14441 }
else if (!pfd.revents) {
14462 dp->
flags &= ~CACHE_FLAG_PENDING;
14469 if (write(dp->
waiters[x],
"asdf", 4) < 0) {
14487 ast_log(
LOG_NOTICE,
"iax2_exists: con: %s, exten: %s, pri: %d, cid: %s, data: %s\n",
context,
exten,
priority, callerid ? callerid :
"<unknown>", data);
14510 ast_log(
LOG_NOTICE,
"iax2_canmatch: con: %s, exten: %s, pri: %d, cid: %s, data: %s\n",
context,
exten,
priority, callerid ? callerid :
"<unknown>", data);
14533 ast_log(
LOG_NOTICE,
"iax2_matchmore: con: %s, exten: %s, pri: %d, cid: %s, data: %s\n",
context,
exten,
priority, callerid ? callerid :
"<unknown>", data);
14559 ast_log(
LOG_NOTICE,
"iax2_exec: con: %s, exten: %s, pri: %d, cid: %s, data: %s, newstack: %d\n",
context, exten,
priority, callerid ? callerid :
"<unknown>", data, newstack);
14577 ncontext = strchr(odata,
'/');
14581 snprintf(req,
sizeof(req),
"IAX2/%s/%s@%s", odata, exten, ncontext);
14583 snprintf(req,
sizeof(req),
"IAX2/%s/%s", odata, exten);
14585 ast_verb(3,
"Executing Dial('%s')\n", req);
14605 char *peername, *colname;
14610 if (!strcmp(peername,
"CURRENTCHANNEL")) {
14620 if ((colname = strchr(peername,
',')))
14628 if (!strcasecmp(colname,
"ip")) {
14630 }
else if (!strcasecmp(colname,
"status")) {
14632 }
else if (!strcasecmp(colname,
"mailbox")) {
14634 }
else if (!strcasecmp(colname,
"context")) {
14636 }
else if (!strcasecmp(colname,
"expire")) {
14638 }
else if (!strcasecmp(colname,
"dynamic")) {
14640 }
else if (!strcasecmp(colname,
"callerid_name")) {
14642 }
else if (!strcasecmp(colname,
"callerid_num")) {
14644 }
else if (!strcasecmp(colname,
"codecs")) {
14649 }
else if (!strncasecmp(colname,
"codec[", 6)) {
14650 char *codecnum, *ptr;
14654 codecnum = colname + 5;
14657 if ((ptr = strchr(codecnum,
']'))) {
14697 if (!strcasecmp(
args,
"osptoken")) {
14699 }
else if (!strcasecmp(
args,
"peerip")) {
14701 }
else if (!strcasecmp(
args,
"peername")) {
14703 }
else if (!strcasecmp(
args,
"secure_signaling") || !strcasecmp(
args,
"secure_media")) {
14722 memset(&pds, 0,
sizeof(pds));
14730 ast_debug(3,
"Checking device state for device %s\n", pds.
peer);
14738 ast_debug(3,
"Found peer. What's device state of %s? addr=%s, defaddr=%s maxms=%d, lastms=%d\n",
14758 .description =
"IAX Remote Dialplan Switch",
14787 AST_CLI_DEFINE(handle_cli_iax2_test_jitter,
"Simulates jitter for testing"),
14788 AST_CLI_DEFINE(handle_cli_iax2_test_late,
"Test the receipt of a late frame"),
14789 AST_CLI_DEFINE(handle_cli_iax2_test_resync,
"Test a resync in received timestamps"),
14796 struct iax2_thread_list *list_head = head;
14801 pthread_t thread_id =
thread->threadid;
14807 pthread_join(thread_id,
NULL);
14925 return match(&pvt2->addr, pvt2->peercallno, pvt2->callno, pvt,
14943 return match(&pvt2->transfer, pvt2->transfercallno, pvt2->callno, pvt,
14955 goto container_fail;
14961 goto container_fail;
14967 goto container_fail;
14973 goto container_fail;
14979 goto container_fail;
14985 goto container_fail;
14991 goto container_fail;
14995 goto container_fail;
15000 goto container_fail;
15042 static const char config[] =
"iax.conf";
15156 ast_verb(2,
"IAX Ready and Listening\n");
15171 ast_realtime_require_field(
"iaxpeers",
"name",
RQ_CHAR, 10,
"ipaddr",
RQ_CHAR, 15,
"port",
RQ_UINTEGER2, 5,
"regseconds",
RQ_UINTEGER2, 6,
SENTINEL);
15184 .
requires =
"dnsmgr",
15185 .optional_modules =
"res_crypto",
Access Control of various sorts.
enum ast_acl_sense ast_apply_acl(struct ast_acl_list *acl_list, const struct ast_sockaddr *addr, const char *purpose)
Apply a set of rules to a given IP address.
void ast_free_ha(struct ast_ha *ha)
Free a list of HAs.
int ast_str2tos(const char *value, unsigned int *tos)
Convert a string to the appropriate TOS value.
struct stasis_message_type * ast_named_acl_change_type(void)
a stasis_message_type for changes against a named ACL or the set of all named ACLs
void ast_copy_ha(const struct ast_ha *from, struct ast_ha *to)
Copy the contents of one HA to another.
void ast_append_acl(const char *sense, const char *stuff, struct ast_acl_list **path, int *error, int *named_acl_flag)
Add a rule to an ACL struct.
int ast_get_ip(struct ast_sockaddr *addr, const char *hostname)
Get the IP address given a hostname.
int ast_acl_list_is_empty(struct ast_acl_list *acl_list)
Determines if an ACL is empty or if it contains entries.
int ast_str2cos(const char *value, unsigned int *cos)
Convert a string to the appropriate COS value.
struct ast_acl_list * ast_free_acl_list(struct ast_acl_list *acl)
Free a list of ACLs.
struct ast_ha * ast_append_ha(const char *sense, const char *stuff, struct ast_ha *path, int *error)
Add a new rule to a list of HAs.
int ast_get_ip_or_srv(struct ast_sockaddr *addr, const char *hostname, const char *service)
Get the IP address given a hostname and optional service.
static const struct adsi_event events[]
static struct ast_generator gen
static int copy(char *infile, char *outfile)
Utility function to copy a file.
Persistent data storage (akin to *doze registry)
int ast_db_put(const char *family, const char *key, const char *value)
Store value addressed by family/key.
int ast_db_get(const char *family, const char *key, char *value, int valuelen)
Get key value specified by family/key.
int ast_db_del(const char *family, const char *key)
Delete entry in astdb.
char * strsep(char **str, const char *delims)
Asterisk main include file. File version handling, generic pbx functions.
#define ast_alloca(size)
call __builtin_alloca to ensure we get gcc builtin semantics
#define ast_realloc(p, len)
A wrapper for realloc()
#define ast_strdup(str)
A wrapper for strdup()
#define ast_strdupa(s)
duplicate a string in memory from the stack
void ast_free_ptr(void *ptr)
free() wrapper
#define ast_calloc(num, len)
A wrapper for calloc()
#define ast_malloc(len)
A wrapper for malloc()
#define ao2_iterator_next(iter)
#define ao2_link(container, obj)
Add an object to a container.
@ AO2_ALLOC_OPT_LOCK_MUTEX
#define ao2_callback(c, flags, cb_fn, arg)
ao2_callback() is a generic function that applies cb_fn() to all objects in a container,...
#define ao2_unlink(container, obj)
Remove an object from a container.
#define ao2_find(container, arg, flags)
struct ao2_iterator ao2_iterator_init(struct ao2_container *c, int flags) attribute_warn_unused_result
Create an iterator for a container.
#define ao2_ref(o, delta)
Reference/unreference an object and return the old refcount.
void ao2_iterator_destroy(struct ao2_iterator *iter)
Destroy a container iterator.
#define ao2_alloc(data_size, destructor_fn)
#define ao2_container_alloc_hash(ao2_options, container_options, n_buckets, hash_fn, sort_fn, cmp_fn)
Allocate and initialize a hash container with the desired number of buckets.
enum ast_transfer_result ast_bridge_transfer_blind(int is_external, struct ast_channel *transferer, const char *exten, const char *context, transfer_channel_cb new_channel_cb, void *user_data)
Blind transfer target to the extension and context provided.
@ AST_BRIDGE_TRANSFER_SUCCESS
CallerID (and other GR30) management and generation Includes code and algorithms from the Zapata libr...
#define AST_PRES_ALLOWED_USER_NUMBER_PASSED_SCREEN
char * ast_callerid_merge(char *buf, int bufsiz, const char *name, const char *num, const char *unknown)
#define AST_PRES_NUMBER_NOT_AVAILABLE
void ast_shrink_phone_number(char *n)
Shrink a phone number in place to just digits (more accurately it just removes ()'s,...
int ast_callerid_split(const char *src, char *name, int namelen, char *num, int numlen)
Internal Asterisk hangup causes.
#define AST_CAUSE_CONGESTION
#define AST_CAUSE_BEARERCAPABILITY_NOTAVAIL
#define AST_CAUSE_DESTINATION_OUT_OF_ORDER
#define AST_CAUSE_NO_USER_RESPONSE
#define AST_CAUSE_FACILITY_NOT_SUBSCRIBED
#define AST_CAUSE_CALL_REJECTED
#define AST_CAUSE_FACILITY_REJECTED
#define AST_CAUSE_NO_ROUTE_DESTINATION
#define AST_CAUSE_UNREGISTERED
static const char config_file[]
static int timing_read(int *id, int fd, short events, void *cbdata)
#define IAX_TRUNKTIMESTAMPS
static int iax2_indicate(struct ast_channel *c, int condition, const void *data, size_t datalen)
static void set_peercnt_limit(struct peercnt *peercnt)
static int check_access(int callno, struct ast_sockaddr *addr, struct iax_ies *ies)
static int iaxthreadcount
static int send_ping(const void *data)
static int iax2_trunk_expired(struct iax2_trunk_peer *tpeer, struct timeval *now)
static int manager_iax2_show_peers(struct mansession *s, const struct message *m)
callback to display iax peers in manager
static struct ao2_container * peercnts
static struct iax2_context * build_context(const char *context)
static void save_rr(struct iax_frame *fr, struct iax_ies *ies)
static int update_registry(struct ast_sockaddr *addr, int callno, char *devtype, int fd, unsigned short refresh)
static int iax2_write(struct ast_channel *c, struct ast_frame *f)
#define AUTH_METHOD_NAMES_BUFSIZE
static struct iax2_peer * realtime_peer(const char *peername, struct ast_sockaddr *addr)
static int socket_process_meta(int packet_len, struct ast_iax2_meta_hdr *meta, struct ast_sockaddr *addr, int sockfd, struct iax_frame *fr)
static struct iax2_user * user_unref(struct iax2_user *user)
static int apply_context(struct iax2_context *con, const char *context)
static struct ast_channel_tech iax2_tech
static void __auto_hangup(const void *nothing)
static int iax2_poke_peer_cb(void *obj, void *arg, int flags)
static void iax2_destroy_helper(struct chan_iax2_pvt *pvt)
static char * complete_iax2_peers(const char *line, const char *word, int pos, int state, uint64_t flags)
static int randomcalltokendata
static int iaxdynamicthreadcount
static void iax2_lock_owner(int callno)
static int iax2_queue_hold(int callno, const char *musicclass)
Queue a hold frame on the ast_channel owner.
#define MAX_TIMESTAMP_SKEW
static void acl_change_stasis_subscribe(void)
static void store_by_transfercallno(struct chan_iax2_pvt *pvt)
static struct ast_channel * ast_iax2_new(int callno, int state, iax2_format capability, struct iax2_codec_pref *prefs, const struct ast_assigned_ids *assignedids, const struct ast_channel *requestor, unsigned int cachable)
Create new call, interface with the PBX core.
static void jb_error_output(const char *fmt,...)
static int peer_hash_cb(const void *obj, const int flags)
@ NEW_ALLOW_CALLTOKEN_VALIDATED
static void iax2_publish_registry(const char *username, const char *domain, const char *status, const char *cause)
static int replace_callno(const void *obj)
#define CALLNO_ENTRY_IS_VALIDATED(a)
static int auto_congest(const void *data)
static unsigned int calc_txpeerstamp(struct iax2_trunk_peer *tpeer, int sampms, struct timeval *now)
static void __iax2_poke_noanswer(const void *data)
static int iax2_predestroy(int callno)
static int update_packet(struct iax_frame *f)
static int iax2_trunk_queue(struct chan_iax2_pvt *pvt, struct iax_frame *fr)
static char * handle_cli_iax2_prune_realtime(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
static int peercnt_hash_cb(const void *obj, const int flags)
static int check_provisioning(struct ast_sockaddr *addr, int sockfd, char *si, unsigned int ver)
static int iax2_setoption(struct ast_channel *c, int option, void *data, int datalen)
static int send_command_transfer(struct chan_iax2_pvt *, char, int, unsigned int, const unsigned char *, int)
static void unwrap_timestamp(struct iax_frame *fr)
static int wait_for_peercallno(struct chan_iax2_pvt *pvt)
static int iax2_hangup(struct ast_channel *c)
static int queue_signalling(struct chan_iax2_pvt *pvt, struct ast_frame *f)
All frames other than that of type AST_FRAME_IAX must be held until we have received a destination ca...
static int __schedule_action(void(*func)(const void *data), const void *data, const char *funcname)
static int addr_range_match_address_cb(void *obj, void *arg, int flags)
static int maxjitterbuffer
static int auth_fail(int callno, int failcode)
static char * handle_cli_iax2_test_losspct(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
static int iax2_queue_hangup(int callno)
Queue a hangup frame on the ast_channel owner.
static int peercnt_remove_cb(const void *obj)
static unsigned int fix_peerts(struct timeval *rxtrunktime, int callno, unsigned int ts)
static unsigned char compress_subclass(iax2_format subclass)
static int handle_error(void)
static const char * auth_method_labels[]
Name of effective auth method.
static int peer_cmp_cb(void *obj, void *arg, int flags)
static void resend_with_token(int callno, struct iax_frame *f, const char *newtoken)
static int get_auth_methods(const char *value)
static int handle_call_token(struct ast_iax2_full_hdr *fh, struct iax_ies *ies, struct ast_sockaddr *addr, int fd)
static struct chan_iax2_pvt * new_iax(struct ast_sockaddr *addr, const char *host)
static char default_parkinglot[AST_MAX_CONTEXT]
static struct iax2_trunk_peer * find_tpeer(struct ast_sockaddr *addr, int fd)
static void iax_error_output(const char *data)
static void vnak_retransmit(int callno, int last)
static int user_delme_cb(void *obj, void *arg, int flags)
static int send_command_immediate(struct chan_iax2_pvt *, char, int, unsigned int, const unsigned char *, int, int)
static int acf_channel_read(struct ast_channel *chan, const char *funcname, char *preparse, char *buf, size_t buflen)
static struct ast_custom_function iaxvar_function
#define IAX_SHRINKCALLERID
static void defer_full_frame(struct iax2_thread *from_here, struct iax2_thread *to_here)
Queue the last read full frame for processing by a certain thread.
static int iax2_exec(struct ast_channel *chan, const char *context, const char *exten, int priority, const char *callerid, const char *data)
Execute IAX2 dialplan switch.
static int __unload_module(void)
static char * handle_cli_iax2_set_debug(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
static struct stasis_subscription * acl_change_sub
static int iax2_poke_peer(struct iax2_peer *peer, int heldcall)
static iax2_format iax2_capability
#define DEFAULT_MAX_THREAD_COUNT
static ast_mutex_t iaxsl[ARRAY_LEN(iaxs)]
chan_iax2_pvt structure locks
static int iax2_digit_end(struct ast_channel *c, char digit, unsigned int duration)
static uint16_t DEFAULT_MAXCALLNO_LIMIT_NONVAL
static struct ast_sched_context * sched
static void * dp_lookup_thread(void *data)
static uint16_t DEFAULT_MAXCALLNO_LIMIT
static void peercnt_modify(unsigned char reg, uint16_t limit, struct ast_sockaddr *sockaddr)
static int transmit_trunk(struct iax_frame *f, struct ast_sockaddr *addr, int sockfd)
static int registry_rerequest(struct iax_ies *ies, int callno, struct ast_sockaddr *addr)
static int send_command(struct chan_iax2_pvt *, char, int, unsigned int, const unsigned char *, int, int)
static void encmethods_to_str(int e, struct ast_str **buf)
static void construct_rr(struct chan_iax2_pvt *pvt, struct iax_ie_data *iep)
static struct ast_custom_function iaxpeer_function
static int load_objects(void)
static int complete_transfer(int callno, struct iax_ies *ies)
static int iax2_fixup(struct ast_channel *oldchannel, struct ast_channel *newchan)
static struct ast_format * codec_choose_from_prefs(struct iax2_codec_pref *pref, struct ast_format_cap *cap)
static int prune_addr_range_cb(void *obj, void *arg, int flags)
static void iax_debug_output(const char *data)
#define IAX_CALLENCRYPTED(pvt)
static char * handle_cli_iax2_provision(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
static uint16_t global_maxcallno_nonval
static int maxjitterinterps
static int schedule_delivery(struct iax_frame *fr, int updatehistory, int fromtrunk, unsigned int *tsout)
static void jb_debug_output(const char *fmt,...)
static void iax_pvt_callid_new(int callno)
static char * regstate2str(int regstate)
static int last_authmethod
static int __iax2_show_peers(int fd, int *total, struct mansession *s, const int argc, const char *const argv[])
static int iax2_call(struct ast_channel *c, const char *dest, int timeout)
static char * handle_cli_iax2_set_mtu(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
Set trunk MTU from CLI.
static void pvt_destructor(void *obj)
static int addr_range_hash_cb(const void *obj, const int flags)
static int pvt_hash_cb(const void *obj, const int flags)
static int iax2_queue_unhold(int callno)
Queue an unhold frame on the ast_channel owner.
#define MAX_TRUNK_MTU
Maximum transmission unit for the UDP packet in the trunk not to be fragmented. This is based on 1516...
static int iax2_getpeername(struct ast_sockaddr addr, char *host, int len)
static struct iax2_peer * build_peer(const char *name, struct ast_variable *v, struct ast_variable *alt, int temponly)
Create peer structure based on configuration.
static int find_callno_locked(unsigned short callno, unsigned short dcallno, struct ast_sockaddr *addr, int new, int sockfd, int full_frame)
static void * iax2_process_thread(void *data)
static int iax2_digit_begin(struct ast_channel *c, char digit)
static struct iax2_user * build_user(const char *name, struct ast_variable *v, struct ast_variable *alt, int temponly)
Create in-memory user structure from configuration.
static char regcontext[AST_MAX_CONTEXT]
static int socket_process_helper(struct iax2_thread *thread)
#define IAX_CAPABILITY_FULLBANDWIDTH
static struct ao2_container * peers
static int set_config(const char *config_file, int reload, int forced)
Load configuration.
static int try_transfer(struct chan_iax2_pvt *pvt, struct iax_ies *ies)
static void _iax2_show_peers_one(int fd, struct mansession *s, struct show_peers_context *cont, struct iax2_peer *peer)
static void __auto_congest(const void *nothing)
static void free_signaling_queue_entry(struct signaling_queue_entry *s)
static int __send_command(struct chan_iax2_pvt *i, char type, int command, unsigned int ts, const unsigned char *data, int datalen, int seqno, int now, int transfer, int final)
#define MARK_IAX_SUBCLASS_TX
static int iax2_key_rotate(const void *vpvt)
#define schedule_action(func, data)
static int invalid_key(ast_aes_decrypt_key *ecx)
static int user_cmp_cb(void *obj, void *arg, int flags)
static void __expire_registry(const void *data)
static void reg_source_db(struct iax2_peer *p)
static int scheduled_destroy(const void *vid)
static void prune_peers(void)
static time_t max_calltoken_delay
static struct ao2_container * callno_limits
static int calltoken_required(struct ast_sockaddr *addr, const char *name, int subclass)
static struct ast_frame * iax2_read(struct ast_channel *c)
static struct ast_netsock_list * netsock
static int min_reg_expire
static int add_calltoken_ignore(const char *addr)
static int authenticate_reply(struct chan_iax2_pvt *p, struct ast_sockaddr *addr, struct iax_ies *ies, const char *override, const char *okey)
static char * handle_cli_iax2_show_firmware(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
static int iax2_transfer(struct ast_channel *c, const char *dest)
static int iax2_transmit(struct iax_frame *fr)
static void __auth_reject(const void *nothing)
static void build_ecx_key(const unsigned char *digest, struct chan_iax2_pvt *pvt)
@ IAX_THREAD_TYPE_DYNAMIC
#define CALLNO_ENTRY_GET_CALLNO(a)
static int iax2_getpeertrunk(struct ast_sockaddr addr)
static int attempt_transmit(const void *data)
static int encrypt_frame(ast_aes_encrypt_key *ecx, struct ast_iax2_full_hdr *fh, unsigned char *poo, int *datalen)
static struct ast_netsock_list * outsock
static void prune_users(void)
static void user_destructor(void *obj)
static struct ao2_container * iax_transfercallno_pvts
Another container of iax2_pvt structures.
static struct iax2_user * find_user(const char *name)
static int resyncthreshold
#define IAX_RECVCONNECTEDLINE
static void register_peer_exten(struct iax2_peer *peer, int onoff)
static int transfercallno_pvt_cmp_cb(void *obj, void *arg, int flags)
static int iaxdynamicthreadnum
static ast_mutex_t callno_pool_lock
static int send_command_final(struct chan_iax2_pvt *, char, int, unsigned int, const unsigned char *, int, int)
static void free_context(struct iax2_context *con)
static char * handle_cli_iax2_show_channels(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
#define CALLNO_ENTRY_SET_VALIDATED(a)
static uint16_t total_nonval_callno_used
static int complete_dpreply(struct chan_iax2_pvt *pvt, struct iax_ies *ies)
#define IAX_DEBUGDIGEST(msg, key)
static const char tdesc[]
static void parse_dial_string(char *data, struct parsed_dial_string *pds)
Parses an IAX dial string into its component parts.
static int global_rtautoclear
static void iax2_destroy(int callno)
static int manager_iax2_show_netstats(struct mansession *s, const struct message *m)
static void spawn_dp_lookup(int callno, const char *context, const char *callednum, const char *callerid)
static struct iax_frame * iaxfrdup2(struct iax_frame *fr)
static int transmit_frame(void *data)
static int acf_iaxvar_write(struct ast_channel *chan, const char *cmd, char *data, const char *value)
static int iax2_answer(struct ast_channel *c)
static int iax2_authmethods
static const char * iax2_getformatname_multiple(iax2_format format, struct ast_str **codec_buf)
static void set_hangup_source_and_cause(int callno, unsigned char causecode)
static int iax2_canmatch(struct ast_channel *chan, const char *context, const char *exten, int priority, const char *callerid, const char *data)
part of the IAX2 dial plan switch interface
static void __send_ping(const void *data)
static struct iax2_peer * find_peer(const char *name, int realtime)
static char * handle_cli_iax2_show_netstats(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
static int iaxactivethreadcount
static int check_srcaddr(struct ast_sockaddr *addr)
Check if address can be used as packet source.
static void insert_idle_thread(struct iax2_thread *thread)
static void acl_change_stasis_unsubscribe(void)
static int match(struct ast_sockaddr *addr, unsigned short callno, unsigned short dcallno, const struct chan_iax2_pvt *cur, int check_dcallno)
static int pvt_cmp_cb(void *obj, void *arg, int flags)
static int authenticate(const char *challenge, const char *secret, const char *keyn, int authmethods, struct iax_ie_data *ied, struct ast_sockaddr *addr, struct chan_iax2_pvt *pvt)
static void network_change_stasis_cb(void *data, struct stasis_subscription *sub, struct stasis_message *message)
static int iaxdefaulttimeout
static struct ao2_container * users
static int auth_reject(const void *data)
static int create_callno_pools(void)
static void send_signaling(struct chan_iax2_pvt *pvt)
This function must be called once we are sure the other side has given us a call number....
#define CALLTOKEN_IE_FORMAT
static char * handle_cli_iax2_show_cache(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
#define IAX_FORCE_ENCRYPT
static char * handle_cli_iax2_reload(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
static void network_change_stasis_subscribe(void)
static struct ast_switch iax2_switch
static void poke_all_peers(void)
#define IAX_SENDCONNECTEDLINE
static int(* iax2_regfunk)(const char *username, int onoff)
static int network_change_sched_cb(const void *data)
static int find_callno(unsigned short callno, unsigned short dcallno, struct ast_sockaddr *addr, int new, int sockfd, int full_frame)
static int __do_deliver(void *data)
#define IAX_RTCACHEFRIENDS
#define IAX_RTIGNOREREGEXPIRE
static int socket_process(struct iax2_thread *thread)
static int manager_iax2_show_registry(struct mansession *s, const struct message *m)
static void dp_lookup(int callno, const char *context, const char *callednum, const char *callerid, int skiplock)
static int iax2_poke_noanswer(const void *data)
static int get_unused_callno(enum callno_type type, int validated, callno_entry *entry)
static char * handle_cli_iax2_show_callno_limits(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
static char * handle_cli_iax2_show_stats(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
static struct ast_taskprocessor * transmit_processor
static int iaxdefaultdpcache
static int function_iaxpeer(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t len)
static struct @117 frame_queue[IAX_MAX_CALLS]
a list of frames that may need to be retransmitted
static int send_lagrq(const void *data)
static int peer_set_srcaddr(struct iax2_peer *peer, const char *srcaddr)
Parse the "sourceaddress" value, lookup in netsock list and set peer's sockfd. Defaults to defaultsoc...
static int reload_config(int forced_reload)
static int peercnt_add(struct ast_sockaddr *addr)
static int iax2_do_register(struct iax2_registry *reg)
static int iax2_register(const char *value, int lineno)
static int iax2_sendimage(struct ast_channel *c, struct ast_frame *img)
static struct ast_timer * timer
static void __send_lagrq(const void *data)
static void unlink_peer(struct iax2_peer *peer)
static int authenticate_request(int call_num)
static struct iax2_peer * peer_unref(struct iax2_peer *peer)
static int iax2_append_register(const char *hostname, const char *username, const char *secret, const char *porta)
static int firmware_show_callback(struct ast_iax2_firmware_header *header, void *user_data)
static int get_from_jb(const void *p)
static void save_osptoken(struct iax_frame *fr, struct iax_ies *ies)
static int max_reg_expire
static int iax2_queryoption(struct ast_channel *c, int option, void *data, int *datalen)
static unsigned int calc_timestamp(struct chan_iax2_pvt *p, unsigned int ts, struct ast_frame *f)
#define DEFAULT_RETRY_TIME
static int peer_status(struct iax2_peer *peer, char *status, int statuslen)
peer_status: Report Peer status in character string
static void set_config_destroy(void)
static int attribute_pure iax2_allow_new(int frametype, int subclass, int inbound)
#define IAX_RTSAVE_SYSNAME
static iax2_format iax2_codec_choose(struct iax2_codec_pref *pref, iax2_format formats)
static int iax2_delete_from_sched(const void *data)
static char * handle_cli_iax2_set_debug_jb(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
#define DEFAULT_FREQ_NOTOK
static void update_jbsched(struct chan_iax2_pvt *pvt)
static void store_by_peercallno(struct chan_iax2_pvt *pvt)
static int set_peercnt_limit_all_cb(void *obj, void *arg, int flags)
static void handle_deferred_full_frames(struct iax2_thread *thread)
Handle any deferred full frames for this thread.
static int ast_cli_netstats(struct mansession *s, int fd, int limit_fmt)
static int transfercallno_pvt_hash_cb(const void *obj, const int flags)
static int decrypt_frame(int callno, struct ast_iax2_full_hdr *fh, struct ast_frame *f, int *datalen)
static void iax_pvt_callid_set(int callno, ast_callid callid)
static void __get_from_jb(const void *p)
static int iax2_encryption
static int peercnt_remove_by_addr(struct ast_sockaddr *addr)
static int decode_frame(ast_aes_decrypt_key *dcx, struct ast_iax2_full_hdr *fh, struct ast_frame *f, int *datalen)
static struct call_number_pool callno_pool
static pthread_t netthreadid
#define CALLNO_ENTRY_TO_PTR(a)
static void build_rand_pad(unsigned char *buf, ssize_t len)
static void signal_condition(ast_mutex_t *lock, ast_cond_t *cond)
static char * handle_cli_iax2_set_debug_trunk(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
static char * handle_cli_iax2_show_registry(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
static int iax2_sched_add(struct ast_sched_context *sched, int when, ast_sched_cb callback, const void *data)
static int socket_read(int *id, int fd, short events, void *cbdata)
static int peer_delme_cb(void *obj, void *arg, int flags)
static int create_addr(const char *peername, struct ast_channel *c, struct ast_sockaddr *addr, struct create_addr_info *cai)
static char * auth_method_names(int authmethods, char *restrict buf)
Get names of all auth methods.
static int user_hash_cb(const void *obj, const int flags)
static void peer_destructor(void *obj)
static void __iax2_do_register_s(const void *data)
static int send_apathetic_reply(unsigned short callno, unsigned short dcallno, struct ast_sockaddr *addr, int command, int ts, unsigned char seqno, int sockfd, struct iax_ie_data *ied)
static void jb_warning_output(const char *fmt,...)
static int iax2_exists(struct ast_channel *chan, const char *context, const char *exten, int priority, const char *callerid, const char *data)
Part of the IAX2 switch interface.
calltoken_peer_enum
Call token validation settings.
@ CALLTOKEN_DEFAULT
Default calltoken required unless the ip is in the ignorelist.
@ CALLTOKEN_AUTO
Require call token validation after a successful registration using call token validation occurs.
@ CALLTOKEN_NO
Do not require call token validation.
@ CALLTOKEN_YES
Require call token validation.
static int get_encrypt_methods(const char *s)
static int jittertargetextra
static int iax2_matchmore(struct ast_channel *chan, const char *context, const char *exten, int priority, const char *callerid, const char *data)
Part of the IAX2 Switch interface.
static struct ast_flags64 globalflags
static struct iax2_dpcache * find_cache(struct ast_channel *chan, const char *data, const char *context, const char *exten, int priority)
static iax2_format uncompress_subclass(unsigned char csub)
static void * network_thread(void *ignore)
static char * handle_cli_iax2_show_peers(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
static int iax2_is_control_frame_allowed(int subtype)
static void network_change_stasis_unsubscribe(void)
static void realtime_update_peer(const char *peername, struct ast_sockaddr *sockaddr, time_t regtime)
static struct io_context * io
static char * complete_iax2_unregister(const char *line, const char *word, int pos, int state)
static struct stasis_subscription * network_change_sub
static int raw_hangup(struct ast_sockaddr *addr, unsigned short src, unsigned short dst, int sockfd)
#define PTR_TO_CALLNO_ENTRY(a)
static struct ao2_container * calltoken_ignores
static void * iax2_dup_variable_datastore(void *)
static struct iax2_codec_pref prefs_global
@ IAX_STATE_AUTHENTICATED
static struct iax2_user * realtime_user(const char *username, struct ast_sockaddr *addr)
#define IAX2_TRUNK_PREFACE
static int iax2_ack_registry(struct iax_ies *ies, struct ast_sockaddr *addr, int callno)
Acknowledgment received for OUR registration.
static void __iax2_poke_peer_s(const void *data)
static int load_module(void)
Load the module.
static int iax2_vnak(int callno)
#define IAX_CAPABILITY_MEDBANDWIDTH
static int iax2_parse_allow_disallow(struct iax2_codec_pref *pref, iax2_format *formats, const char *list, int allowing)
#define DEFAULT_TRUNKDATA
static char * handle_cli_iax2_show_peer(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
Show one peer in detail.
static void iax2_process_thread_cleanup(void *data)
#define IAX_TRANSFERMEDIA
static int iax2_sendhtml(struct ast_channel *c, int subclass, const char *data, int datalen)
static int addr_range_cmp_cb(void *obj, void *arg, int flags)
static int registry_authrequest(int callno)
static int iax2_provision(struct ast_sockaddr *end, int sockfd, const char *dest, const char *template, int force)
const char * iax2_getformatname(iax2_format format)
iax2 wrapper function for ast_getformatname
#define DEFAULT_THREAD_COUNT
static int acf_iaxvar_read(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t len)
static void iax2_free_variable_datastore(void *)
static int iax2_poke_peer_s(const void *data)
static int addr_range_delme_cb(void *obj, void *arg, int flags)
static struct iax2_thread * find_idle_thread(void)
static struct ast_channel * iax2_request(const char *type, struct ast_format_cap *cap, const struct ast_assigned_ids *assignedids, const struct ast_channel *requestor, const char *data, int *cause)
static void add_empty_calltoken_ie(struct chan_iax2_pvt *pvt, struct iax_ie_data *ied)
static void delete_users(void)
#define IAX_DELAYPBXSTART
static int cache_get_callno_locked(const char *data)
static void iax_outputframe(struct iax_frame *f, struct ast_iax2_full_hdr *fhi, int rx, struct ast_sockaddr *addr, int datalen)
static int unload_module(void)
static void remove_by_transfercallno(struct chan_iax2_pvt *pvt)
static struct chan_iax2_pvt * iaxs[IAX_MAX_CALLS]
an array of iax2 pvt structures
static int peer_set_sock_cb(void *obj, void *arg, int flags)
static void stop_stuff(int callno)
static char * handle_cli_iax2_show_users(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
static int send_trunk(struct iax2_trunk_peer *tpeer, struct timeval *now)
static void log_jitterstats(unsigned short callno)
static struct iax2_peer * peer_ref(struct iax2_peer *peer)
static ast_callid iax_pvt_callid_get(int callno)
#define IAX_CAPABILITY_LOWBANDWIDTH
static void cleanup_thread_list(void *head)
static int manager_iax2_show_peer_list(struct mansession *s, const struct message *m)
callback to display iax peers in manager format
static int iax2_queue_frame(int callno, struct ast_frame *f)
Queue a frame to a call's owning asterisk channel.
static int authenticate_verify(struct chan_iax2_pvt *p, struct iax_ies *ies)
static int iax2_sendtext(struct ast_channel *c, const char *text)
static struct ast_sockaddr debugaddr
static int send_packet(struct iax_frame *f)
static char language[MAX_LANGUAGE]
static char accountcode[AST_MAX_ACCOUNT_CODE]
static void merge_encryption(struct chan_iax2_pvt *p, unsigned int enc)
static void memcpy_decrypt(unsigned char *dst, const unsigned char *src, int len, ast_aes_decrypt_key *dcx)
static char * handle_cli_iax2_unregister(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
#define IAX_ALLOWFWDOWNLOAD
#define IAX_CODEC_USER_FIRST
static int iax2_lock_callno_unless_destroyed(int callno)
Acquire the iaxsl[callno] if call exists and not having ongoing hangup.
static struct call_number_pool callno_pool_trunk
static uint16_t global_maxcallno
static void remove_by_peercallno(struct chan_iax2_pvt *pvt)
#define CALLTOKEN_HASH_FORMAT
static int start_network_thread(void)
static unsigned int calc_rxstamp(struct chan_iax2_pvt *p, unsigned int offset)
static int iax2_sched_replace(int id, struct ast_sched_context *con, int when, ast_sched_cb callback, const void *data)
static char mohsuggest[MAX_MUSICCLASS]
static int __find_callno(unsigned short callno, unsigned short dcallno, struct ast_sockaddr *addr, int new, int sockfd, int return_locked, int check_dcallno)
static void build_encryption_keys(const unsigned char *digest, struct chan_iax2_pvt *pvt)
static void build_callno_limits(struct ast_variable *v)
static void __attempt_transmit(const void *data)
static struct ast_cli_entry cli_iax2[]
static unsigned int iax2_datetime(const char *tz)
static int iax2_send(struct chan_iax2_pvt *pvt, struct ast_frame *f, unsigned int ts, int seqno, int now, int transfer, int final)
#define IAX_CODEC_NOPREFS
static int auto_hangup(const void *data)
static char * handle_cli_iax2_show_threads(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
static void acl_change_stasis_cb(void *data, struct stasis_subscription *sub, struct stasis_message *message)
static char mohinterpret[MAX_MUSICCLASS]
static const struct ast_datastore_info iax2_variable_datastore_info
static void sched_delay_remove(struct ast_sockaddr *addr, callno_entry entry)
static int iax2_do_register_s(const void *data)
static int iax2_devicestate(const char *data)
Part of the device state notification system —.
static void peercnt_remove(struct peercnt *peercnt)
static int network_change_sched_id
static int expire_registry(const void *data)
static void iax2_frame_free(struct iax_frame *fr)
static void memcpy_encrypt(unsigned char *dst, const unsigned char *src, int len, ast_aes_encrypt_key *ecx)
static void requirecalltoken_mark_auto(const char *name, int subclass)
static int iaxmaxthreadcount
static int peercnt_cmp_cb(void *obj, void *arg, int flags)
static struct ao2_container * iax_peercallno_pvts
Another container of iax2_pvt structures.
static int send_command_locked(unsigned short callno, char, int, unsigned int, const unsigned char *, int, int)
static int make_trunk(unsigned short callno, int locked)
static int register_verify(int callno, struct ast_sockaddr *addr, struct iax_ies *ies)
Verify inbound registration.
static int global_max_trunk_mtu
static void iax2_dprequest(struct iax2_dpcache *dp, int callno)
struct ast_sockaddr bindaddr
static char version[AST_MAX_EXTENSION]
static const char config[]
static int transfer(void *data)
General Asterisk PBX channel definitions.
void ast_channel_exten_set(struct ast_channel *chan, const char *value)
const char * ast_channel_name(const struct ast_channel *chan)
#define ast_channel_alloc_with_endpoint(needqueue, state, cid_num, cid_name, acctcode, exten, context, assignedids, requestor, amaflag, endpoint,...)
void * ast_channel_tech_pvt(const struct ast_channel *chan)
int ast_channel_datastore_add(struct ast_channel *chan, struct ast_datastore *datastore)
Add a datastore to a channel.
void ast_hangup(struct ast_channel *chan)
Hang up a channel.
#define AST_BRIDGE_DTMF_CHANNEL_0
Report DTMF on channel 0.
#define ast_channel_alloc(needqueue, state, cid_num, cid_name, acctcode, exten, context, assignedids, requestor, amaflag,...)
Create a channel structure.
int ast_queue_hangup(struct ast_channel *chan)
Queue a hangup frame.
int ast_party_id_presentation(const struct ast_party_id *id)
Determine the overall presentation value for the given party.
#define DATASTORE_INHERIT_FOREVER
void ast_channel_nativeformats_set(struct ast_channel *chan, struct ast_format_cap *value)
void ast_party_connected_line_free(struct ast_party_connected_line *doomed)
Destroy the connected line information contents.
struct ast_channel * ast_waitfor_n(struct ast_channel **chan, int n, int *ms)
Waits for input on a group of channels Wait for input on an array of channels for a given # of millis...
#define ast_channel_lock(chan)
struct ast_format_cap * ast_channel_nativeformats(const struct ast_channel *chan)
@ AST_CHAN_TP_WANTSJITTER
Channels have this property if they can accept input with jitter; i.e. most VoIP channels.
struct ast_party_redirecting * ast_channel_redirecting(struct ast_channel *chan)
void ast_channel_unregister(const struct ast_channel_tech *tech)
Unregister a channel technology.
struct ast_flags * ast_channel_flags(struct ast_channel *chan)
#define ast_channel_ref(c)
Increase channel reference count.
struct ast_party_connected_line * ast_channel_connected(struct ast_channel *chan)
int ast_queue_frame(struct ast_channel *chan, struct ast_frame *f)
Queue one or more frames to a channel's frame queue.
const char * ast_channel_context(const struct ast_channel *chan)
int ast_write(struct ast_channel *chan, struct ast_frame *frame)
Write a frame to a channel This function writes the given frame to the indicated channel.
struct ast_frame * ast_read(struct ast_channel *chan)
Reads a frame.
#define AST_BRIDGE_DTMF_CHANNEL_1
Report DTMF on channel 1.
#define ast_channel_trylock(chan)
int ast_queue_control_data(struct ast_channel *chan, enum ast_control_frame_type control, const void *data, size_t datalen)
Queue a control frame with payload.
void ast_set_callerid(struct ast_channel *chan, const char *cid_num, const char *cid_name, const char *cid_ani)
Set caller ID number, name and ANI and generate AMI event.
int ast_set_read_format(struct ast_channel *chan, struct ast_format *format)
Sets read format on channel chan.
void ast_channel_set_rawreadformat(struct ast_channel *chan, struct ast_format *format)
void ast_channel_tech_pvt_set(struct ast_channel *chan, void *value)
int ast_connected_line_parse_data(const unsigned char *data, size_t datalen, struct ast_party_connected_line *connected)
Parse connected line indication frame data.
int ast_check_hangup(struct ast_channel *chan)
Check to see if a channel is needing hang up.
int ast_channel_hangupcause(const struct ast_channel *chan)
void ast_channel_set_rawwriteformat(struct ast_channel *chan, struct ast_format *format)
struct ast_party_dialed * ast_channel_dialed(struct ast_channel *chan)
#define AST_MAX_ACCOUNT_CODE
struct ast_channel * ast_channel_release(struct ast_channel *chan)
Unlink and release reference to a channel.
void ast_set_hangupsource(struct ast_channel *chan, const char *source, int force)
Set the source of the hangup in this channel and it's bridge.
void ast_channel_hangupcause_hash_set(struct ast_channel *chan, const struct ast_control_pvt_cause_code *cause_code, int datalen)
Sets the HANGUPCAUSE hash and optionally the SIP_CAUSE hash on the given channel.
int ast_queue_unhold(struct ast_channel *chan)
Queue an unhold frame.
@ AST_BRIDGE_FAILED_NOWARN
int ast_queue_hold(struct ast_channel *chan, const char *musicclass)
Queue a hold frame.
void ast_channel_set_readformat(struct ast_channel *chan, struct ast_format *format)
int ast_channel_register(const struct ast_channel_tech *tech)
Register a channel technology (a new channel driver) Called by a channel module to register the kind ...
void ast_channel_softhangup_internal_flag_add(struct ast_channel *chan, int value)
#define ast_channel_unref(c)
Decrease channel reference count.
struct ast_format * ast_channel_writeformat(struct ast_channel *chan)
@ AST_FLAG_DISABLE_DEVSTATE_CACHE
int ast_set_write_format(struct ast_channel *chan, struct ast_format *format)
Sets write format on channel chan.
void ast_party_connected_line_init(struct ast_party_connected_line *init)
Initialize the given connected line structure.
void ast_channel_amaflags_set(struct ast_channel *chan, enum ama_flags value)
const char * ast_channel_language(const struct ast_channel *chan)
void ast_channel_context_set(struct ast_channel *chan, const char *value)
enum ama_flags ast_channel_string2amaflag(const char *flag)
Convert a string to a detail record AMA flag.
const struct ast_channel_tech * ast_channel_tech(const struct ast_channel *chan)
struct ast_party_caller * ast_channel_caller(struct ast_channel *chan)
void ast_channel_callid_set(struct ast_channel *chan, ast_callid value)
void ast_channel_hangupcause_set(struct ast_channel *chan, int value)
void ast_channel_adsicpe_set(struct ast_channel *chan, enum ast_channel_adsicpe value)
void ast_channel_tech_set(struct ast_channel *chan, const struct ast_channel_tech *value)
#define ast_channel_unlock(chan)
#define AST_MAX_EXTENSION
void ast_channel_set_writeformat(struct ast_channel *chan, struct ast_format *format)
struct ast_datastore * ast_channel_datastore_find(struct ast_channel *chan, const struct ast_datastore_info *info, const char *uid)
Find a datastore on a channel.
struct ast_format * ast_channel_readformat(struct ast_channel *chan)
ast_channel_state
ast_channel states
int ast_setstate(struct ast_channel *chan, enum ast_channel_state)
Change the state of a channel.
static struct ast_channel * callback(struct ast_channelstorage_instance *driver, ao2_callback_data_fn *cb_fn, void *arg, void *data, int ao2_flags)
const char * ast_var_name(const struct ast_var_t *var)
#define ast_var_assign(name, value)
const char * ast_var_value(const struct ast_var_t *var)
void ast_var_delete(struct ast_var_t *var)
Standard Command Line Interface.
int ast_cli_unregister_multiple(struct ast_cli_entry *e, int len)
Unregister multiple commands.
#define AST_CLI_DEFINE(fn, txt,...)
void ast_cli(int fd, const char *fmt,...)
char * ast_cli_complete(const char *word, const char *const choices[], int pos)
#define ast_cli_register_multiple(e, len)
Register multiple commands.
unsigned int ast_codec_samples_count(struct ast_frame *frame)
Get the number of samples contained within a frame.
int iax2_codec_pref_string(struct iax2_codec_pref *pref, char *buf, size_t size)
Dump audio codec preference list into a string.
void iax2_codec_pref_prepend(struct iax2_codec_pref *pref, struct ast_format *format, unsigned int framing, int only_if_existing)
Prepend an audio codec to a preference list, removing it first if it was already there.
uint64_t iax2_codec_pref_order_value_to_format_bitfield(int order_value)
Convert an iax2_codec_pref order value into a format bitfield.
uint64_t iax2_codec_pref_from_bitfield(struct iax2_codec_pref *pref, uint64_t bitfield)
Create codec preference list from the given bitfield formats.
struct ast_format * iax2_codec_pref_index(struct iax2_codec_pref *pref, int idx, struct ast_format **result)
Codec located at a particular place in the preference index.
void iax2_codec_pref_convert(struct iax2_codec_pref *pref, char *buf, size_t size, int right)
Shift an audio codec preference list up or down 65 bytes so that it becomes an ASCII string.
void iax2_codec_pref_remove_missing(struct iax2_codec_pref *pref, uint64_t bitfield)
Removes format from the pref list that aren't in the bitfield.
void iax2_codec_pref_append(struct iax2_codec_pref *pref, struct ast_format *format, unsigned int framing)
Append a audio codec to a preference list, removing it first if it was already there.
int iax2_codec_pref_to_cap(struct iax2_codec_pref *pref, struct ast_format_cap *cap)
Convert a preference structure to a capabilities structure.
int iax2_codec_pref_best_bitfield2cap(uint64_t bitfield, struct iax2_codec_pref *prefs, struct ast_format_cap *cap)
Convert a bitfield to a format capabilities structure in the "best" order.
Media Format Bitfield Compatibility API.
Provide cryptographic signature routines.
int ast_aes_set_encrypt_key(const unsigned char *key, ast_aes_encrypt_key *ctx)
Set an encryption key.
struct ast_key * ast_key_get(const char *kname, int ktype)
Retrieve a key.
int ast_aes_set_decrypt_key(const unsigned char *key, ast_aes_decrypt_key *ctx)
Set a decryption key.
int ast_aes_encrypt(const unsigned char *in, unsigned char *out, const ast_aes_encrypt_key *key)
AES encrypt data.
int ast_aes_decrypt(const unsigned char *in, unsigned char *out, const ast_aes_decrypt_key *key)
AES decrypt data.
int ast_sign(struct ast_key *key, char *msg, char *sig)
Sign a message signature using a given private key.
int ast_check_signature(struct ast_key *key, const char *msg, const char *sig)
Check the authenticity of a message signature using a given public key.
#define ast_datastore_alloc(info, uid)
int ast_datastore_free(struct ast_datastore *datastore)
Free a data store object.
int ast_devstate_changed(enum ast_device_state state, enum ast_devstate_cache cachable, const char *fmt,...)
Tells Asterisk the State for Device is changed.
Background DNS update manager.
void ast_dnsmgr_release(struct ast_dnsmgr_entry *entry)
Free a DNS manager entry.
int ast_dnsmgr_lookup(const char *name, struct ast_sockaddr *result, struct ast_dnsmgr_entry **dnsmgr, const char *service)
Allocate and initialize a DNS manager entry.
int ast_dnsmgr_changed(struct ast_dnsmgr_entry *entry)
Check is see if a dnsmgr entry has changed.
int ast_dnsmgr_refresh(struct ast_dnsmgr_entry *entry)
Force a refresh of a dnsmgr entry.
void ast_endpoint_set_state(struct ast_endpoint *endpoint, enum ast_endpoint_state state)
Updates the state of the given endpoint.
void ast_endpoint_shutdown(struct ast_endpoint *endpoint)
Shutsdown an ast_endpoint.
struct ast_endpoint * ast_endpoint_create(const char *tech, const char *resource)
Create an endpoint struct.
void ast_verbose(const char *fmt,...)
Call Parking and Pickup API Includes code and algorithms from the Zapata library.
int iax_firmware_get_version(const char *dev, uint16_t *version)
void iax_firmware_reload(void)
void iax_firmware_unload(void)
int iax_firmware_append(struct iax_ie_data *ied, const char *dev, unsigned int desc)
void iax_firmware_traverse(const char *filter, int(*callback)(struct ast_iax2_firmware_header *header, void *data), void *data)
IAX Firmware Support header file.
static int exists(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t len)
static int md5(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t len)
static int len(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t buflen)
void astman_send_listack(struct mansession *s, const struct message *m, char *msg, char *listflag)
Send ack in manager transaction to begin a list.
void astman_send_list_complete_start(struct mansession *s, const struct message *m, const char *event_name, int count)
Start the list complete event.
const char * astman_get_header(const struct message *m, char *var)
Get header from manager transaction.
void astman_send_list_complete_end(struct mansession *s)
End the list complete event.
void astman_append(struct mansession *s, const char *fmt,...)
int ast_manager_unregister(const char *action)
Unregister a registered manager command.
void ast_endpoint_blob_publish(struct ast_endpoint *endpoint, struct stasis_message_type *type, struct ast_json *blob)
Creates and publishes a ast_endpoint_blob message.
void ast_channel_stage_snapshot_done(struct ast_channel *chan)
Clear flag to indicate channel snapshot is being staged, and publish snapshot.
struct stasis_message_type * ast_endpoint_state_type(void)
Message type for endpoint state changes.
void ast_channel_stage_snapshot(struct ast_channel *chan)
Set flag to indicate channel snapshot is being staged.
static int iax2_prov_app(struct ast_channel *chan, const char *data)
Implementation of Inter-Asterisk eXchange, version 2 parser.c parser.h chan_iax2.c.
#define IAX_LINGER_TIMEOUT
#define IAX_DPSTATUS_CANEXIST
#define IAX_MAX_OSPBLOCK_SIZE
#define IAX_IE_CALLINGANI2
#define IAX_IE_CALLING_NUMBER
#define IAX_IE_TRANSFERID
#define IAX_IE_CALLING_ANI
#define IAX_DEFAULT_PORTNO
#define IAX_IE_CALLINGTNS
#define IAX_IE_RSA_RESULT
#define IAX_META_TRUNK_SUPERMINI
#define IAX_IE_IAX_UNKNOWN
#define IAX_DPSTATUS_NONEXISTENT
#define IAX_DPSTATUS_IGNOREPAT
#define IAX_IE_CAPABILITY2
#define IAX_IE_CALLING_NAME
#define IAX_DEFAULT_REG_EXPIRE
#define IAX_MAX_OSPTOKEN_SIZE
#define IAX_IE_RR_DROPPED
#define IAX_IE_ENCRYPTION
#define IAX_ENCRYPT_AES128
#define IAX_MAX_OSPBUFF_SIZE
#define IAX_IE_FIRMWAREVER
#define IAX_IE_CODEC_PREFS
#define IAX_IE_CALLED_NUMBER
#define IAX_IE_CAPABILITY
#define IAX_DPSTATUS_MATCHMORE
#define IAX_IE_PROVISIONING
#define IAX_IE_MD5_RESULT
#define IAX_PROTO_VERSION
#define IAX_IE_AUTOANSWER
#define IAX_ENCRYPT_KEYROTATE
#define IAX_IE_APPARENT_ADDR
#define IAX_AUTH_PLAINTEXT
#define IAX_MAX_OSPBLOCK_NUM
#define IAX_META_TRUNK_MINI
#define IAX_IE_CALLINGPRES
#define IAX_IE_AUTHMETHODS
#define IAX_IE_CALLED_CONTEXT
#define IAX_IE_CALLINGTON
#define IAX_DPSTATUS_EXISTS
Application convenience functions, designed to give consistent look and feel to Asterisk apps.
int ast_app_inboxcount(const char *mailboxes, int *newmsgs, int *oldmsgs)
Determine number of new/old messages in a mailbox.
Configuration File Parser.
#define ast_config_load(filename, flags)
Load a config file.
char * ast_category_browse(struct ast_config *config, const char *prev_name)
Browse categories.
int ast_realtime_require_field(const char *family,...) attribute_sentinel
Inform realtime what fields that may be stored.
@ CONFIG_FLAG_FILEUNCHANGED
#define ast_variable_new(name, value, filename)
int ast_unload_realtime(const char *family)
Release any resources cached for a realtime family.
#define CONFIG_STATUS_FILEUNCHANGED
#define CONFIG_STATUS_FILEINVALID
int ast_parse_arg(const char *arg, enum ast_parse_flags flags, void *p_result,...)
The argument parsing routine.
void ast_config_destroy(struct ast_config *cfg)
Destroys a config.
int ast_variable_list_replace(struct ast_variable **head, struct ast_variable *replacement)
Replace a variable in the given list with a new value.
const char * ast_variable_retrieve(struct ast_config *config, const char *category, const char *variable)
int ast_update_realtime(const char *family, const char *keyfield, const char *lookup,...) attribute_sentinel
Update realtime configuration.
struct ast_variable * ast_load_realtime(const char *family,...) attribute_sentinel
void ast_variables_destroy(struct ast_variable *var)
Free variable list.
struct ast_variable * ast_variable_browse(const struct ast_config *config, const char *category_name)
Asterisk internal frame definitions.
#define ast_frame_byteswap_be(fr)
#define AST_OPTION_RELAXDTMF
#define AST_OPTION_TONE_VERIFY
#define AST_OPTION_RXGAIN
#define AST_OPTION_DIGIT_DETECT
#define AST_OPTION_OPRMODE
#define AST_OPTION_SECURE_MEDIA
#define AST_OPTION_FLAG_REQUEST
#define AST_OPTION_FAX_DETECT
#define AST_OPTION_TXGAIN
#define AST_FRIENDLY_OFFSET
Offset into a frame's data buffer.
#define AST_OPTION_SECURE_SIGNALING
ast_control_frame_type
Internal control frame subtype field values.
@ AST_CONTROL_RECORD_CANCEL
@ AST_CONTROL_STREAM_TOPOLOGY_SOURCE_CHANGED
@ AST_CONTROL_STREAM_RESTART
@ AST_CONTROL_STREAM_SUSPEND
@ AST_CONTROL_RADIO_UNKEY
@ AST_CONTROL_STREAM_TOPOLOGY_REQUEST_CHANGE
@ AST_CONTROL_STREAM_REVERSE
@ AST_CONTROL_REDIRECTING
@ AST_CONTROL_TAKEOFFHOOK
@ AST_CONTROL_T38_PARAMETERS
@ AST_CONTROL_READ_ACTION
@ AST_CONTROL_RECORD_STOP
@ AST_CONTROL_PLAYBACK_BEGIN
@ AST_CONTROL_RECORD_MUTE
@ AST_CONTROL_STREAM_STOP
@ AST_CONTROL_STREAM_TOPOLOGY_CHANGED
@ AST_CONTROL_CONNECTED_LINE
@ AST_CONTROL_STREAM_FORWARD
@ AST_CONTROL_RECORD_SUSPEND
@ AST_CONTROL_MASQUERADE_NOTIFY
@ AST_CONTROL_PVT_CAUSE_CODE
@ AST_CONTROL_UPDATE_RTP_PEER
#define AST_OPTION_AUDIO_MODE
struct ast_frame ast_null_frame
@ AST_FRFLAG_HAS_TIMING_INFO
void ast_callid_strnprint(char *buffer, size_t buffer_size, ast_callid callid)
copy a string representation of the callid into a target string
#define ast_debug(level,...)
Log a DEBUG message.
ast_callid ast_read_threadstorage_callid(void)
extracts the callerid from the thread
int ast_callid_threadassoc_add(ast_callid callid)
Adds a known callid to thread storage of the calling thread.
#define AST_CALLID_BUFFER_LENGTH
ast_callid ast_create_callid(void)
factory function to create a new uniquely identifying callid.
int ast_callid_threadassoc_remove(void)
Removes callid from thread storage of the calling thread.
#define ast_verb(level,...)
I/O Management (derived from Cheops-NG)
struct io_context * io_context_create(void)
Creates a context Create a context for I/O operations Basically mallocs an IO structure and sets up s...
int * ast_io_add(struct io_context *ioc, int fd, ast_io_cb callback, short events, void *data)
Adds an IO context.
void io_context_destroy(struct io_context *ioc)
Destroys a context.
int ast_io_wait(struct io_context *ioc, int howlong)
Waits for IO.
jitterbuf: an application-independent jitterbuffer jitterbuf.c
void jb_destroy(jitterbuf *jb)
destroy jitterbuf
void jb_reset(jitterbuf *jb)
reset jitterbuf
enum jb_return_code jb_get(jitterbuf *jb, jb_frame *frame, long now, long interpl)
get a frame for time now (receiver's time) return value is one of JB_OK: You've got frame!...
jitterbuf * jb_new(void)
new jitterbuf
void jb_setoutput(jb_output_function_t err, jb_output_function_t warn, jb_output_function_t dbg)
enum jb_return_code jb_put(jitterbuf *jb, void *data, const enum jb_frame_type type, long ms, long ts, long now)
queue a frame
long jb_next(jitterbuf *jb)
when is the next frame due out, in receiver's time (0=EMPTY) This value may change as frames are adde...
enum jb_return_code jb_setconf(jitterbuf *jb, jb_conf *conf)
set jitterbuf conf
enum jb_return_code jb_getall(jitterbuf *jb, jb_frame *frameout)
unconditionally get frames from jitterbuf until empty
enum jb_return_code jb_getinfo(jitterbuf *jb, jb_info *stats)
get jitterbuf info: only "statistics" may be valid
void ast_json_unref(struct ast_json *value)
Decrease refcount on value. If refcount reaches zero, value is freed.
struct ast_json * ast_json_pack(char const *format,...)
Helper for creating complex JSON values.
AST_JSON_INT_T ast_json_int_t
Primarily used to cast when packing to an "I" type.
A set of macros to manage forward-linked lists.
#define AST_LIST_HEAD_INIT_NOLOCK(head)
Initializes a list head structure.
#define AST_LIST_HEAD_STATIC(name, type)
Defines a structure to be used to hold a list of specified type, statically initialized.
#define AST_LIST_HEAD_NOLOCK(name, type)
Defines a structure to be used to hold a list of specified type (with no lock).
#define AST_LIST_LAST(head)
Returns the last entry contained in a list.
#define AST_LIST_TRAVERSE(head, var, field)
Loops over (traverses) the entries in a list.
#define AST_LIST_HEAD_DESTROY(head)
Destroys a list head structure.
#define AST_LIST_INSERT_TAIL(head, elm, field)
Appends a list entry to the tail of a list.
#define AST_LIST_ENTRY(type)
Declare a forward link structure inside a list entry.
#define AST_LIST_HEAD_INIT(head)
Initializes a list head structure.
#define AST_LIST_TRAVERSE_SAFE_END
Closes a safe loop traversal block.
#define AST_LIST_INSERT_BEFORE_CURRENT(elm, field)
Inserts a list entry before the current entry during a traversal.
#define AST_LIST_LOCK(head)
Locks a list.
#define AST_LIST_INSERT_HEAD(head, elm, field)
Inserts a list entry at the head of a list.
#define AST_LIST_REMOVE(head, elm, field)
Removes a specific entry from a list.
#define AST_LIST_TRAVERSE_SAFE_BEGIN(head, var, field)
Loops safely over (traverses) the entries in a list.
#define AST_LIST_REMOVE_CURRENT(field)
Removes the current entry from a list during a traversal.
#define AST_LIST_REMOVE_HEAD(head, field)
Removes and returns the head entry from a list.
#define AST_LIST_UNLOCK(head)
Attempts to unlock a list.
#define AST_LIST_HEAD(name, type)
Defines a structure to be used to hold a list of specified type.
Custom localtime functions for multiple timezones.
struct ast_tm * ast_localtime(const struct timeval *timep, struct ast_tm *p_tm, const char *zone)
Timezone-independent version of localtime_r(3).
Asterisk locking-related definitions:
#define ast_cond_destroy(cond)
#define ast_cond_wait(cond, mutex)
#define AST_PTHREADT_NULL
#define ast_cond_init(cond, attr)
#define ast_cond_timedwait(cond, mutex, time)
#define ast_mutex_init(pmutex)
#define DEADLOCK_AVOIDANCE(lock)
#define ast_mutex_unlock(a)
int ast_atomic_fetchadd_int(volatile int *p, int v)
Atomically add v to *p and return the previous value of *p.
#define ast_mutex_trylock(a)
pthread_cond_t ast_cond_t
#define ast_mutex_destroy(a)
#define ast_mutex_lock(a)
#define AST_MUTEX_DEFINE_STATIC(mutex)
int ast_atomic_dec_and_test(volatile int *p)
decrement *p by 1 and return true if the variable has reached 0.
#define ast_cond_signal(cond)
static char hostname[MAXHOSTNAMELEN]
The AMI - Asterisk Manager Interface - is a TCP protocol created to manage Asterisk with third-party ...
#define EVENT_FLAG_REPORTING
#define EVENT_FLAG_SYSTEM
#define ast_manager_register_xml(action, authority, func)
Register a manager callback using XML documentation to describe the manager.
void MD5Update(struct MD5Context *context, unsigned char const *buf, unsigned len)
void MD5Init(struct MD5Context *context)
void MD5Final(unsigned char digest[MD5_DIGEST_LENGTH], struct MD5Context *context)
Asterisk module definitions.
#define ast_module_unref(mod)
Release a reference to the module.
#define ast_module_ref(mod)
Hold a reference to the module.
#define AST_MODULE_INFO(keystr, flags_to_set, desc, fields...)
@ AST_MODPRI_CHANNEL_DRIVER
@ AST_MODULE_SUPPORT_CORE
#define ASTERISK_GPL_KEY
The text the key() function should return.
int ast_unregister_application(const char *app)
Unregister an application.
@ AST_MODULE_LOAD_SUCCESS
@ AST_MODULE_LOAD_DECLINE
Module has failed to load, may be in an inconsistent state.
#define ast_register_application_xml(app, execute)
Register an application using XML documentation.
int ast_moh_start(struct ast_channel *chan, const char *mclass, const char *interpclass)
Turn on music on hold on a given channel.
void ast_moh_stop(struct ast_channel *chan)
Turn off music on hold on a given channel.
struct stasis_message_type * ast_mwi_state_type(void)
Get the Stasis Message Bus API message type for MWI messages.
void * ast_mwi_unsubscribe(struct ast_mwi_subscriber *sub)
Unsubscribe from the stasis topic and MWI.
struct stasis_cache * ast_mwi_state_cache(void)
Backend cache for ast_mwi_topic_cached().
struct ast_mwi_subscriber * ast_mwi_subscribe_pool(const char *mailbox, stasis_subscription_cb callback, void *data)
Add an MWI state subscriber, and stasis subscription to the mailbox.
meta
below block is needed for mssql
def ignore(key=None, val=None, section=None, pjsip=None, nmapped=None, type='endpoint')
static char * ast_sockaddr_stringify(const struct ast_sockaddr *addr)
Wrapper around ast_sockaddr_stringify_fmt() with default format.
#define ast_sockaddr_port(addr)
Get the port number of a socket address.
static void ast_sockaddr_copy(struct ast_sockaddr *dst, const struct ast_sockaddr *src)
Copies the data from one ast_sockaddr to another.
int ast_sockaddr_is_ipv6(const struct ast_sockaddr *addr)
Determine if this is an IPv6 address.
int ast_bind(int sockfd, const struct ast_sockaddr *addr)
Wrapper around bind(2) that uses struct ast_sockaddr.
int ast_sockaddr_apply_netmask(const struct ast_sockaddr *addr, const struct ast_sockaddr *netmask, struct ast_sockaddr *result)
Apply a netmask to an address and store the result in a separate structure.
int ast_sockaddr_cmp_addr(const struct ast_sockaddr *a, const struct ast_sockaddr *b)
Compares the addresses of two ast_sockaddr structures.
ssize_t ast_sendto(int sockfd, const void *buf, size_t len, int flags, const struct ast_sockaddr *dest_addr)
Wrapper around sendto(2) that uses ast_sockaddr.
int ast_sockaddr_split_hostport(char *str, char **host, char **port, int flags)
Splits a string into its host and port components.
int ast_sockaddr_resolve(struct ast_sockaddr **addrs, const char *str, int flags, int family)
Parses a string with an IPv4 or IPv6 address and place results into an array.
int ast_sockaddr_parse(struct ast_sockaddr *addr, const char *str, int flags)
Parse an IPv4 or IPv6 address string.
static int ast_sockaddr_isnull(const struct ast_sockaddr *addr)
Checks if the ast_sockaddr is null. "null" in this sense essentially means uninitialized,...
ssize_t ast_recvfrom(int sockfd, void *buf, size_t len, int flags, struct ast_sockaddr *src_addr)
Wrapper around recvfrom(2) that uses struct ast_sockaddr.
int ast_sockaddr_cmp(const struct ast_sockaddr *a, const struct ast_sockaddr *b)
Compares two ast_sockaddr structures.
static char * ast_sockaddr_stringify_port(const struct ast_sockaddr *addr)
Wrapper around ast_sockaddr_stringify_fmt() to return a port only.
#define ast_sockaddr_set_port(addr, port)
Sets the port number of a socket address.
static char * ast_sockaddr_stringify_addr(const struct ast_sockaddr *addr)
Wrapper around ast_sockaddr_stringify_fmt() to return an address only.
static void ast_sockaddr_setnull(struct ast_sockaddr *addr)
Sets address addr to null.
int ast_sockaddr_is_ipv4_mapped(const struct ast_sockaddr *addr)
Determine if this is an IPv4-mapped IPv6 address.
int ast_sockaddr_hash(const struct ast_sockaddr *addr)
Computes a hash value from the address. The port is ignored.
int ast_netsock_release(struct ast_netsock_list *list)
struct ast_netsock_list * ast_netsock_list_alloc(void)
struct ast_netsock * ast_netsock_bind(struct ast_netsock_list *list, struct io_context *ioc, const char *bindinfo, int defaultport, int tos, int cos, ast_io_cb callback, void *data)
void ast_netsock_unref(struct ast_netsock *ns)
int ast_netsock_sockfd(const struct ast_netsock *ns)
struct ast_netsock * ast_netsock_find(struct ast_netsock_list *list, struct ast_sockaddr *addr)
int ast_netsock_init(struct ast_netsock_list *list)
struct ast_netsock * ast_netsock_bindaddr(struct ast_netsock_list *list, struct io_context *ioc, struct ast_sockaddr *bindaddr, int tos, int cos, ast_io_cb callback, void *data)
const char * ast_inet_ntoa(struct in_addr ia)
thread-safe replacement for inet_ntoa().
Implementation of the IAX2 protocol.
int iax_parse_ies(struct iax_ies *ies, unsigned char *data, int datalen)
int iax_get_iframes(void)
#define DIRECTION_OUTGRESS
int iax_ie_append_addr(struct iax_ie_data *ied, unsigned char ie, const struct ast_sockaddr *addr)
void iax_frame_subclass2str(enum iax_frame_subclass subclass, char *str, size_t len)
int iax_ie_append_byte(struct iax_ie_data *ied, unsigned char ie, unsigned char dat)
void iax_frame_free(struct iax_frame *fr)
int iax_ie_append(struct iax_ie_data *ied, unsigned char ie)
int iax_ie_append_versioned_uint64(struct iax_ie_data *ied, unsigned char ie, unsigned char version, uint64_t value)
struct iax_frame * iax_frame_new(int direction, int datalen, unsigned int cacheable)
int iax_ie_append_raw(struct iax_ie_data *ied, unsigned char ie, const void *data, int datalen)
int iax_ie_append_int(struct iax_ie_data *ied, unsigned char ie, unsigned int value)
void iax_set_output(void(*output)(const char *data))
int iax_get_oframes(void)
#define DIRECTION_INGRESS
void iax_frame_wrap(struct iax_frame *fr, struct ast_frame *f)
int iax_ie_append_short(struct iax_ie_data *ied, unsigned char ie, unsigned short value)
void iax_showframe(struct iax_frame *f, struct ast_iax2_full_hdr *fhi, int rx, struct ast_sockaddr *addr, int datalen)
int iax_ie_append_str(struct iax_ie_data *ied, unsigned char ie, const char *str)
void iax_set_error(void(*output)(const char *data))
Asterisk file paths, configured in asterisk.conf.
const char * ast_config_AST_SYSTEM_NAME
Core PBX routines and definitions.
int ast_add_extension(const char *context, int replace, const char *extension, int priority, const char *label, const char *callerid, const char *application, void *data, void(*datad)(void *), const char *registrar)
Add and extension to an extension context.
int ast_context_destroy_by_name(const char *context, const char *registrar)
Destroy a context by name.
void ast_unregister_switch(struct ast_switch *sw)
Unregister an alternative switch.
int ast_register_switch(struct ast_switch *sw)
Register an alternative dialplan switch.
const char * pbx_builtin_getvar_helper(struct ast_channel *chan, const char *name)
Return a pointer to the value of the corresponding channel variable.
int ast_exists_extension(struct ast_channel *c, const char *context, const char *exten, int priority, const char *callerid)
Determine whether an extension exists.
struct ast_context * ast_context_find_or_create(struct ast_context **extcontexts, struct ast_hashtab *exttable, const char *name, const char *registrar)
Register a new context or find an existing one.
int pbx_exec(struct ast_channel *c, struct ast_app *app, const char *data)
Execute an application.
int pbx_builtin_setvar_helper(struct ast_channel *chan, const char *name, const char *value)
Add a variable to the channel variable stack, removing the most recently set value for the same name.
int ast_context_remove_extension(const char *context, const char *extension, int priority, const char *registrar)
Simply remove extension from context.
#define ast_custom_function_register(acf)
Register a custom function.
int ast_canmatch_extension(struct ast_channel *c, const char *context, const char *exten, int priority, const char *callerid)
Looks for a valid matching extension.
int ast_custom_function_unregister(struct ast_custom_function *acf)
Unregister a custom function.
enum ast_pbx_result ast_pbx_start(struct ast_channel *c)
Create a new thread and start the PBX.
int ast_ignore_pattern(const char *context, const char *pattern)
Checks to see if a number should be ignored.
int ast_matchmore_extension(struct ast_channel *c, const char *context, const char *exten, int priority, const char *callerid)
Looks to see if adding anything to this extension might match something. (exists ^ canmatch)
struct ast_app * pbx_findapp(const char *app)
Look up an application.
static int matchmore(struct ast_channel *chan, const char *context, const char *exten, int priority, const char *callerid, const char *data)
static void * cleanup(void *unused)
#define ast_poll(a, b, c)
IAX2 Provisioning protocol.
int iax_provision_reload(int reload)
int iax_provision_build(struct iax_ie_data *provdata, unsigned int *signature, const char *template, int force)
int iax_provision_unload(void)
char * iax_prov_complete_template(const char *line, const char *word, int pos, int state)
int iax_provision_version(unsigned int *signature, const char *template, int force)
struct stasis_forward * sub
static struct @453 methods[]
static void challenge(const char *endpoint_id, struct ast_sip_auth *auth, pjsip_tx_data *tdata, const pjsip_rx_data *rdata, int is_stale, const pjsip_auth_algorithm *algorithm)
Send a WWW-Authenticate challenge.
Scheduler Routines (derived from cheops)
#define AST_SCHED_DEL(sched, id)
Remove a scheduler entry.
void ast_sched_clean_by_callback(struct ast_sched_context *con, ast_sched_cb match, ast_sched_cb cleanup_cb)
Clean all scheduled events with matching callback.
int ast_sched_replace(int old_id, struct ast_sched_context *con, int when, ast_sched_cb callback, const void *data) attribute_warn_unused_result
replace a scheduler entry
int ast_sched_add(struct ast_sched_context *con, int when, ast_sched_cb callback, const void *data) attribute_warn_unused_result
Adds a scheduled event.
void ast_sched_context_destroy(struct ast_sched_context *c)
destroys a schedule context
int ast_sched_start_thread(struct ast_sched_context *con)
Start a thread for processing scheduler entries.
int(* ast_sched_cb)(const void *data)
scheduler callback
struct ast_sched_context * ast_sched_context_create(void)
Create a scheduler context.
Security Event Reporting API.
struct stasis_topic * ast_security_topic(void)
A stasis_topic which publishes messages for security related issues.
Stasis Message Bus API. See Stasis Message Bus API for detailed documentation.
struct stasis_message_type * stasis_message_type(const struct stasis_message *msg)
Get the message type for a stasis_message.
@ STASIS_SUBSCRIPTION_FILTER_SELECTIVE
int stasis_subscription_accept_message_type(struct stasis_subscription *subscription, const struct stasis_message_type *type)
Indicate to a subscription that we are interested in a message type.
int stasis_subscription_set_filter(struct stasis_subscription *subscription, enum stasis_subscription_message_filter filter)
Set the message type filtering level on a subscription.
void stasis_subscription_cb_noop(void *data, struct stasis_subscription *sub, struct stasis_message *message)
Stasis subscription callback function that does nothing.
void * stasis_message_data(const struct stasis_message *msg)
Get the data contained in a message.
struct stasis_subscription * stasis_unsubscribe_and_join(struct stasis_subscription *subscription)
Cancel a subscription, blocking until the last message is processed.
struct stasis_message * stasis_cache_get(struct stasis_cache *cache, struct stasis_message_type *type, const char *id)
Retrieve an item from the cache for the ast_eid_default entity.
#define stasis_subscribe(topic, callback, data)
void ast_system_publish_registry(const char *channeltype, const char *username, const char *domain, const char *status, const char *cause)
Publish a channel driver outgoing registration message.
struct stasis_topic * ast_system_topic(void)
A Stasis Message Bus API topic which publishes messages regarding system changes.
struct stasis_message_type * ast_network_change_type(void)
A stasis_message_type for network changes.
#define AST_DECLARE_STRING_FIELDS(field_list)
Declare the fields needed in a structure.
#define AST_STRING_FIELD(name)
Declare a string field.
#define ast_string_field_set(x, field, data)
Set a field to a simple string value.
#define ast_string_field_init(x, size)
Initialize a field pool and fields.
#define ast_string_field_build(x, field, fmt, args...)
Set a field to a complex (built) value.
#define ast_string_field_free_memory(x)
free all memory - to be called before destroying the object
int ast_str_append(struct ast_str **buf, ssize_t max_len, const char *fmt,...)
Append to a thread local dynamic string.
char * ast_str_buffer(const struct ast_str *buf)
Returns the string buffer within the ast_str buf.
#define S_OR(a, b)
returns the equivalent of logic or for strings: first one if not empty, otherwise second one.
static force_inline int attribute_pure ast_str_hash(const char *str)
Compute a hash value on a string.
int attribute_pure ast_true(const char *val)
Make sure something is true. Determine if a string containing a boolean value is "true"....
#define S_COR(a, b, c)
returns the equivalent of logic or for strings, with an additional boolean check: second one if not e...
int ast_get_time_t(const char *src, time_t *dst, time_t _default, int *consumed)
Parse a time (integer) string.
static force_inline int attribute_pure ast_strlen_zero(const char *s)
int attribute_pure ast_false(const char *val)
Make sure something is false. Determine if a string containing a boolean value is "false"....
#define ast_str_alloca(init_len)
char * ast_strip_quoted(char *s, const char *beg_quotes, const char *end_quotes)
Strip leading/trailing whitespace and quotes from a string.
int ast_str_set(struct ast_str **buf, ssize_t max_len, const char *fmt,...)
Set a dynamic string using variable arguments.
size_t ast_str_strlen(const struct ast_str *buf)
Returns the current length of the string stored within buf.
void ast_copy_string(char *dst, const char *src, size_t size)
Size-limited null-terminating string copy.
unsigned char raw[AST_CRYPTO_AES_BLOCKSIZE/8]
When we need to walk through a container, we use an ao2_iterator to keep track of the current positio...
Wrapper for an ast_acl linked list.
ast_app: A registered application
Structure to pass both assignedid values to channel drivers.
Structure to describe a channel "technology", ie a channel driver See for examples:
struct ast_format_cap * capabilities
Main Channel structure associated with a channel.
descriptor for a cli entry.
int args
This gets set in ast_cli_register()
char chan_name[AST_CHANNEL_NAME]
Data structure associated with a custom dialplan function.
Structure for a data store type.
Structure for a data store object.
Structure used to handle a large number of boolean flags == used only in app_dial?
Structure used to handle boolean flags.
unsigned int frame_ending
struct ast_format * format
Data structure associated with a single frame of data.
union ast_frame::@228 data
struct ast_frame_subclass subclass
enum ast_frame_type frametype
internal representation of ACL entries In principle user applications would have no need for this,...
struct ast_sockaddr netmask
Abstract JSON element (object, array, string, int, ...).
Structure for mutex and tracking information.
The structure that contains MWI state.
struct ast_party_id id
Caller party ID.
int ani2
Automatic Number Identification 2 (Info Digits)
struct ast_party_id ani
Automatic Number Identification (ANI)
Connected Line/Party information.
struct ast_party_id id
Connected party ID.
struct ast_party_dialed::@210 number
Dialed/Called number.
char * str
Subscriber phone number (Malloced)
int transit_network_select
Transit Network Select.
struct ast_party_name name
Subscriber name.
struct ast_party_number number
Subscriber phone number.
int presentation
Q.931 encoded presentation-indicator encoded field.
unsigned char valid
TRUE if the name information is valid/present.
char * str
Subscriber name (Malloced)
int presentation
Q.931 presentation-indicator and screening-indicator encoded fields.
unsigned char valid
TRUE if the number information is valid/present.
char * str
Subscriber phone number (Malloced)
int plan
Q.931 Type-Of-Number and Numbering-Plan encoded fields.
struct ast_party_id from
Who is redirecting the call (Sent to the party the call is redirected toward)
Socket address structure.
struct sockaddr_storage ss
Support for dynamic strings.
A ast_taskprocessor structure is a singleton by name.
struct ast_var_t::@213 entries
Structure for variables, used for configurations and for channel variables.
struct ast_variable * next
callno_entry numbers[IAX_MAX_CALLS/2+1]
unsigned char semirand[32]
const ast_string_field mohinterpret
struct ast_variable * vars
const ast_string_field language
const ast_string_field cid_num
struct chan_iax2_pvt::signaling_queue signaling_queue
const ast_string_field inkeys
const ast_string_field outkey
struct chan_iax2_pvt::@122 dpentries
const ast_string_field dproot
const ast_string_field mohsuggest
unsigned short bridgecallno
const ast_string_field accountcode
const ast_string_field username
iax2_format peercapability
struct ast_variable * iaxvars
struct ast_sockaddr transfer
const ast_string_field context
unsigned short peercallno
struct iax2_codec_pref prefs
unsigned char calltoken_ie_len
const ast_string_field parkinglot
const ast_string_field host
callno_entry callno_entry
unsigned short transfercallno
struct ast_channel * owner
const ast_string_field rdnis
const ast_string_field challenge
const ast_string_field exten
const ast_string_field ani
struct iax2_codec_pref rprefs
struct iax2_registry * reg
ast_aes_decrypt_key mydcx
const ast_string_field cid_name
enum iax_transfer_state transferring
const ast_string_field secret
const ast_string_field dnid
const ast_string_field osptoken
struct iax2_peer * peerpoke
const ast_string_field peer
struct iax2_codec_pref prefs
char context[AST_MAX_CONTEXT]
char peercontext[AST_MAX_CONTEXT]
char mohsuggest[MAX_MUSICCLASS]
char mohinterpret[MAX_MUSICCLASS]
char context[AST_MAX_EXTENSION]
char callednum[AST_MAX_EXTENSION]
char order[IAX2_CODEC_PREF_SIZE]
char context[AST_MAX_CONTEXT]
struct iax2_context * next
struct iax2_dpcache::@125 peer_list
char exten[AST_MAX_EXTENSION]
struct iax2_dpcache::@124 cache_list
char peercontext[AST_MAX_CONTEXT]
const ast_string_field peercontext
const ast_string_field mohinterpret
struct ast_dnsmgr_entry * dnsmgr
const ast_string_field cid_num
const ast_string_field inkeys
const ast_string_field outkey
struct ast_mwi_subscriber * mwi_event_sub
enum calltoken_peer_enum calltoken_required
const ast_string_field regexten
const ast_string_field mohsuggest
const ast_string_field username
const ast_string_field zonetag
struct ast_sockaddr defaddr
const ast_string_field description
const ast_string_field context
struct iax2_codec_pref prefs
const ast_string_field parkinglot
const ast_string_field dbsecret
struct ast_endpoint * endpoint
struct ast_acl_list * acl
const ast_string_field name
const ast_string_field cid_name
const ast_string_field secret
const ast_string_field mailbox
struct iax2_pkt_buf::@126 entry
struct ast_dnsmgr_entry * dnsmgr
enum iax_reg_state regstate
struct iax2_registry::@121 entry
unsigned char readbuf[4096]
struct iax2_thread::@128 ffinfo
struct ast_sockaddr ioaddr
struct iax2_thread::@127 list
enum iax2_thread_iostate iostate
enum iax2_thread_type type
void(* schedfunc)(const void *)
struct iax2_thread::@129 full_frames
struct timeval lasttxtime
struct timeval rxtrunktime
struct iax2_trunk_peer::@120 list
unsigned int trunkdataalloc
unsigned int trunkdatalen
unsigned char * trunkdata
struct timeval txtrunktime
const ast_string_field mohinterpret
struct ast_variable * vars
const ast_string_field language
const ast_string_field cid_num
const ast_string_field inkeys
struct iax2_context * contexts
enum calltoken_peer_enum calltoken_required
const ast_string_field mohsuggest
const ast_string_field accountcode
struct iax2_codec_pref prefs
const ast_string_field parkinglot
const ast_string_field dbsecret
struct ast_acl_list * acl
const ast_string_field name
const ast_string_field cid_name
const ast_string_field secret
unsigned char semirand[32]
struct iax_frame::@139 list
ast_aes_decrypt_key mydcx
struct ast_sockaddr apparent_addr
unsigned char * calltokendata
struct ast_variable * vars
unsigned char iax_unknown
unsigned int ospblocklength[IAX_MAX_OSPBLOCK_NUM]
char * osptokenblock[IAX_MAX_OSPBLOCK_NUM]
Global IO variables are now in a struct in order to be made threadsafe.
In case you didn't read that giant block of text above the mansession_session struct,...
struct signaling_queue_entry * next
structure to hold users read from users.conf
list of users found in the config file
An API for managing task processing threads that can be shared across modules.
struct ast_taskprocessor * ast_taskprocessor_get(const char *name, enum ast_tps_options create)
Get a reference to a taskprocessor with the specified name and create the taskprocessor if necessary.
void * ast_taskprocessor_unreference(struct ast_taskprocessor *tps)
Unreference the specified taskprocessor and its reference count will decrement.
@ TPS_REF_DEFAULT
return a reference to a taskprocessor, create one if it does not exist
int ast_taskprocessor_push(struct ast_taskprocessor *tps, int(*task_exe)(void *datap), void *datap) attribute_warn_unused_result
Push a task into the specified taskprocessor queue and signal the taskprocessor thread.
struct timeval ast_samp2tv(unsigned int _nsamp, unsigned int _rate)
Returns a timeval corresponding to the duration of n samples at rate r. Useful to convert samples to ...
int ast_tvzero(const struct timeval t)
Returns true if the argument is 0,0.
int ast_tvcmp(struct timeval _a, struct timeval _b)
Compress two struct timeval instances returning -1, 0, 1 if the first arg is smaller,...
struct timeval ast_tvadd(struct timeval a, struct timeval b)
Returns the sum of two timevals a + b.
struct timeval ast_tvsub(struct timeval a, struct timeval b)
Returns the difference of two timevals a - b.
int64_t ast_tvdiff_ms(struct timeval end, struct timeval start)
Computes the difference (in milliseconds) between two struct timeval instances.
struct timeval ast_tvnow(void)
Returns current timeval. Meant to replace calls to gettimeofday().
struct timeval ast_tv(ast_time_t sec, ast_suseconds_t usec)
Returns a timeval from sec, usec.
Timing source management.
void ast_timer_close(struct ast_timer *handle)
Close an opened timing handle.
int ast_timer_ack(const struct ast_timer *handle, unsigned int quantity)
Acknowledge a timer event.
int ast_timer_set_rate(const struct ast_timer *handle, unsigned int rate)
Set the timing tick rate.
struct ast_timer * ast_timer_open(void)
Open a timer.
int ast_timer_fd(const struct ast_timer *handle)
Get a poll()-able file descriptor for a timer.
Support for translation of data formats. translate.c.
int ast_translator_best_choice(struct ast_format_cap *dst_cap, struct ast_format_cap *src_cap, struct ast_format **dst_fmt_out, struct ast_format **src_fmt_out)
Chooses the best translation path.
int error(const char *format,...)
#define ast_test_flag(p, flag)
#define RAII_VAR(vartype, varname, initval, dtor)
Declare a variable that will call a destructor function when it goes out of scope.
#define ast_set2_flag64(p, value, flag)
#define ast_test_flag64(p, flag)
#define ast_set_flags_to64(p, flag, value)
#define ast_clear_flag64(p, flag)
#define ast_pthread_create_background(a, b, c, d)
#define ast_assert_return(a,...)
#define ast_clear_flag(p, flag)
long int ast_random(void)
#define ast_pthread_create_detached(a, b, c, d)
#define ast_copy_flags64(dest, src, flagz)
#define ast_set_flag64(p, flag)
#define ast_set_flag(p, flag)
void ast_sha1_hash(char *output, const char *input)
Produces SHA1 hash based on input string.