34 #include "asterisk/_private.h"
78 #include <sys/epoll.h>
81 #if defined(KEEP_TILL_CHANNEL_PARTY_NUMBER_INFO_NEEDED)
94 #define MONITOR_CONSTANT_DELAY
95 #define MONITOR_DELAY 150 * 8
107 #define STATE2STR_BUFSIZE 32
111 #define AST_DEFAULT_EMULATE_DTMF_DURATION 100
114 #define AST_MIN_DTMF_DURATION 80
118 #define AST_MIN_DTMF_GAP 45
128 struct ast_chan_trace_data {
134 struct ast_chan_trace {
146 #define NUM_CHANNEL_BUCKETS 61
148 #define NUM_CHANNEL_BUCKETS 1567
152 #define DATA_EXPORT_CALLERID(MEMBER) \
153 MEMBER(ast_callerid, cid_dnid, AST_DATA_STRING) \
154 MEMBER(ast_callerid, cid_num, AST_DATA_STRING) \
155 MEMBER(ast_callerid, cid_name, AST_DATA_STRING) \
156 MEMBER(ast_callerid, cid_ani, AST_DATA_STRING) \
157 MEMBER(ast_callerid, cid_pres, AST_DATA_INTEGER) \
158 MEMBER(ast_callerid, cid_ani2, AST_DATA_INTEGER) \
159 MEMBER(ast_callerid, cid_tag, AST_DATA_STRING)
164 #define DATA_EXPORT_CHANNEL(MEMBER) \
165 MEMBER(ast_channel, blockproc, AST_DATA_STRING) \
166 MEMBER(ast_channel, appl, AST_DATA_STRING) \
167 MEMBER(ast_channel, data, AST_DATA_STRING) \
168 MEMBER(ast_channel, name, AST_DATA_STRING) \
169 MEMBER(ast_channel, language, AST_DATA_STRING) \
170 MEMBER(ast_channel, musicclass, AST_DATA_STRING) \
171 MEMBER(ast_channel, accountcode, AST_DATA_STRING) \
172 MEMBER(ast_channel, peeraccount, AST_DATA_STRING) \
173 MEMBER(ast_channel, userfield, AST_DATA_STRING) \
174 MEMBER(ast_channel, call_forward, AST_DATA_STRING) \
175 MEMBER(ast_channel, uniqueid, AST_DATA_STRING) \
176 MEMBER(ast_channel, linkedid, AST_DATA_STRING) \
177 MEMBER(ast_channel, parkinglot, AST_DATA_STRING) \
178 MEMBER(ast_channel, hangupsource, AST_DATA_STRING) \
179 MEMBER(ast_channel, dialcontext, AST_DATA_STRING) \
180 MEMBER(ast_channel, rings, AST_DATA_INTEGER) \
181 MEMBER(ast_channel, priority, AST_DATA_INTEGER) \
182 MEMBER(ast_channel, macropriority, AST_DATA_INTEGER) \
183 MEMBER(ast_channel, adsicpe, AST_DATA_INTEGER) \
184 MEMBER(ast_channel, fin, AST_DATA_UNSIGNED_INTEGER) \
185 MEMBER(ast_channel, fout, AST_DATA_UNSIGNED_INTEGER) \
186 MEMBER(ast_channel, emulate_dtmf_duration, AST_DATA_UNSIGNED_INTEGER) \
187 MEMBER(ast_channel, visible_indication, AST_DATA_INTEGER) \
188 MEMBER(ast_channel, context, AST_DATA_STRING) \
189 MEMBER(ast_channel, exten, AST_DATA_STRING) \
190 MEMBER(ast_channel, macrocontext, AST_DATA_STRING) \
191 MEMBER(ast_channel, macroexten, AST_DATA_STRING)
305 #if defined(KEEP_TILL_CHANNEL_PARTY_NUMBER_INFO_NEEDED)
306 static const char *party_number_ton2str(
int ton)
308 #if defined(HAVE_PRI)
309 switch ((ton >> 4) & 0x07) {
310 case PRI_TON_INTERNATIONAL:
311 return "International";
312 case PRI_TON_NATIONAL:
314 case PRI_TON_NET_SPECIFIC:
315 return "Network Specific";
316 case PRI_TON_SUBSCRIBER:
318 case PRI_TON_ABBREVIATED:
319 return "Abbreviated";
320 case PRI_TON_RESERVED:
322 case PRI_TON_UNKNOWN:
331 #if defined(KEEP_TILL_CHANNEL_PARTY_NUMBER_INFO_NEEDED)
332 static const char *party_number_plan2str(
int plan)
334 #if defined(HAVE_PRI)
335 switch (plan & 0x0F) {
337 case PRI_NPI_UNKNOWN:
339 case PRI_NPI_E163_E164:
340 return "Public (E.163/E.164)";
342 return "Data (X.121)";
344 return "Telex (F.69)";
345 case PRI_NPI_NATIONAL:
346 return "National Standard";
347 case PRI_NPI_PRIVATE:
349 case PRI_NPI_RESERVED:
430 if (!data_softhangup) {
453 if (!data_callerid) {
463 snprintf(value_str,
sizeof(value_str),
"TON: %s/Plan: %s",
464 party_number_ton2str(chan->cid.cid_ton),
465 party_number_plan2str(chan->cid.cid_ton));
498 #define FORMAT "%-10.10s %-40.40s %-12.12s %-12.12s %-12.12s\n"
504 e->
command =
"core show channeltypes";
506 "Usage: core show channeltypes\n"
507 " Lists available channel types registered in your\n"
508 " Asterisk server.\n";
517 ast_cli(a->
fd,
FORMAT,
"Type",
"Description",
"Devicestate",
"Indications",
"Transfer");
518 ast_cli(a->
fd,
FORMAT,
"----------",
"-----------",
"-----------",
"-----------",
"--------");
530 ast_cli(a->
fd,
"----------\n%d channel drivers registered.\n", count_chan);
547 wordlen = strlen(a->
word);
551 if (!strncasecmp(a->
word, cl->
tech->
type, wordlen) && ++which > a->
n) {
569 e->
command =
"core show channeltype";
571 "Usage: core show channeltype <name>\n"
572 " Show details about the specified channel type, <name>.\n";
590 ast_cli(a->
fd,
"\n%s is not a registered channel driver.\n", a->
argv[3]);
596 "-- Info about channel driver: %s --\n"
597 " Device State: %s\n"
600 " Capabilities: %s\n"
604 " Image Support: %s\n"
605 " Text Support: %s\n",
670 .description =
"Kill channel (should not see this)",
681 static void ast_chan_trace_destroy_cb(
void *data)
683 struct ast_chan_trace *trace;
684 struct ast_chan_trace_data *traced = data;
694 .destroy = ast_chan_trace_destroy_cb
701 struct ast_chan_trace *trace;
702 struct ast_chan_trace_data *traced;
711 traced = store->
data;
714 if (
ast_str_append(buf, 0,
"[%d] => %s, %s, %d\n", total, trace->context, trace->exten, trace->priority) < 0) {
726 int ast_channel_trace_is_enabled(
struct ast_channel *chan)
731 return ((
struct ast_chan_trace_data *)store->
data)->enabled;
735 static int ast_channel_trace_data_update(
struct ast_channel *chan,
struct ast_chan_trace_data *traced)
737 struct ast_chan_trace *trace;
738 if (!traced->enabled)
763 int ast_channel_trace_update(
struct ast_channel *chan)
768 return ast_channel_trace_data_update(chan, store->
data);
772 int ast_channel_trace_enable(
struct ast_channel *chan)
775 struct ast_chan_trace_data *traced;
785 store->
data = traced;
789 ((
struct ast_chan_trace_data *)store->
data)->enabled = 1;
790 ast_channel_trace_data_update(chan, store->
data);
795 int ast_channel_trace_disable(
struct ast_channel *chan)
800 ((
struct ast_chan_trace_data *)store->
data)->enabled = 0;
880 struct timeval when = { offset, };
887 struct timeval whentohangup;
902 struct timeval when = { offset, };
942 ast_debug(1,
"Unregistering channel type '%s'\n", tech->
type);
947 if (chan->
tech == tech) {
950 ast_verb(2,
"Unregistered channel type '%s'\n", tech->
type);
968 if (!strcasecmp(name, chanls->
tech->
type)) {
985 if (
causes[x].cause == cause)
998 if (!strncasecmp(
causes[x].name, name, strlen(
causes[x].name)))
1029 return "Dialing Offhook";
1043 switch (transfercapability) {
1049 return "RESTRICTED_DIGITAL";
1053 return "DIGITAL_W_TONES";
1110 for (x = 0; x <
ARRAY_LEN(prefs); x++) {
1111 if (fmts & prefs[x])
1122 .description =
"Null channel (should not see this)",
1131 const
char *acctcode, const
char *
exten, const
char *
context,
1132 const
char *
linkedid, const
int amaflag, const
char *file,
int line,
1133 const
char *function, const
char *name_fmt, va_list ap1, va_list ap2)
1139 char *
tech =
"", *tech2 = NULL;
1142 if (shutting_down) {
1143 ast_log(
LOG_WARNING,
"Channel allocation failed: Refusing due to active shutdown\n");
1147 #if defined(REF_DEBUG)
1150 #elif defined(__AST_DEBUG_MALLOC)
1173 tmp->epfd = epoll_create(25);
1177 ast_log(
LOG_WARNING,
"Channel allocation failed: Unable to create schedule context\n");
1210 ast_log(
LOG_WARNING,
"Channel allocation failed: Can't create alert pipe! Try increasing max file descriptors with ulimit -n\n");
1213 flags = fcntl(tmp->
alertpipe[0], F_GETFL);
1214 if (fcntl(tmp->
alertpipe[0], F_SETFL, flags | O_NONBLOCK) < 0) {
1218 flags = fcntl(tmp->
alertpipe[1], F_GETFL);
1219 if (fcntl(tmp->
alertpipe[1], F_SETFL, flags | O_NONBLOCK) < 0) {
1265 char *slash, *slash2;
1275 if ((slash = strchr(tech,
'/'))) {
1276 if ((slash2 = strchr(slash + 1,
'/'))) {
1306 strcpy(tmp->
context,
"default");
1311 strcpy(tmp->
exten,
"s");
1344 "ChannelState: %d\r\n"
1345 "ChannelStateDesc: %s\r\n"
1346 "CallerIDNum: %s\r\n"
1347 "CallerIDName: %s\r\n"
1348 "AccountCode: %s\r\n"
1367 const char *
cid_name,
const char *acctcode,
1369 const char *
linkedid,
const int amaflag,
1370 const char *file,
int line,
const char *
function,
1371 const char *name_fmt, ...)
1376 va_start(ap1, name_fmt);
1377 va_start(ap2, name_fmt);
1379 linkedid, amaflag, file, line,
function, name_fmt, ap1, ap2);
1388 #if defined(REF_DEBUG) || defined(__AST_DEBUG_MALLOC)
1389 struct ast_channel *__ast_dummy_channel_alloc(
const char *file,
int line,
const char *
function)
1398 #if defined(REF_DEBUG)
1400 file, line,
function, 1);
1401 #elif defined(__AST_DEBUG_MALLOC)
1403 file, line,
function, 0);
1442 unsigned int new_frames = 0;
1443 unsigned int new_voice_frames = 0;
1444 unsigned int queued_frames = 0;
1445 unsigned int queued_voice_frames = 0;
1507 queued_voice_frames++;
1511 if ((queued_frames + new_frames > 128 || queued_voice_frames + new_voice_frames > 96)) {
1513 ast_log(
LOG_WARNING,
"Exceptionally long %squeue length queuing to %s\n", queued_frames + new_frames > 128 ?
"" :
"voice ", chan->
name);
1540 int blah[new_frames];
1542 memset(blah, 1,
sizeof(blah));
1543 if (write(chan->
alertpipe[1], &blah,
sizeof(blah)) != (
sizeof(blah))) {
1545 chan->
name, queued_frames, strerror(
errno));
1550 pthread_kill(chan->
blocker, SIGURG);
1609 const void *data,
size_t datalen)
1635 void *data,
int ao2_flags)
1658 size_t name_len,
const char *
exten,
1729 name_len = cmp_args->rings;
1734 if ((!name_len && strcasecmp(chan->
name, cmp_args->name)) ||
1735 (name_len && strncasecmp(chan->
name, cmp_args->name, name_len))) {
1739 if (cmp_args->context && strcasecmp(chan->
context, cmp_args->context) &&
1743 if (ret && strcasecmp(chan->
exten, cmp_args->exten) &&
1744 strcasecmp(chan->
macroexten, cmp_args->exten)) {
1748 if ((!name_len && strcasecmp(chan->
uniqueid, cmp_args->uniqueid)) ||
1749 (name_len && strncasecmp(chan->
uniqueid, cmp_args->uniqueid, name_len))) {
1850 struct timeval start;
1865 if (
cond && ((*
cond)(data) == 0)) {
1965 if (src->
str && src->
str != dest->
str) {
2018 if (src->
str && src->
str != dest->
str) {
2071 if (src->
str && src->
str != dest->
str) {
2125 if (!update || update->
name) {
2128 if (!update || update->
number) {
2135 if (src->
tag && src->
tag != dest->
tag) {
2153 int number_priority;
2155 int number_screening;
2165 switch (name_value) {
2186 number_priority = 3;
2190 switch (number_value) {
2192 number_priority = 0;
2195 number_priority = 1;
2198 number_priority = 2;
2203 number_priority = 3;
2209 if (name_priority < number_priority) {
2210 number_value = name_value;
2216 return number_value | number_screening;
2347 connected->
id = caller->
id;
2348 connected->
ani = caller->
ani;
2447 if ((dashptr = strrchr(device_name,
'-'))) {
2451 device_name[0] =
'\0';
2486 if (chan->epfd_data[i])
2487 free(chan->epfd_data[i]);
2516 if (device_name[0]) {
2612 if (datastore->
info != info) {
2621 if ((datastore->
uid != NULL) && !strcasecmp(uid, datastore->
uid)) {
2634 struct epoll_event ev;
2637 if (chan->
fds[which] > -1) {
2638 epoll_ctl(chan->epfd, EPOLL_CTL_DEL, chan->
fds[which], &ev);
2639 aed = chan->epfd_data[
which];
2644 if (!aed && (!(aed =
ast_calloc(1,
sizeof(*aed)))))
2647 chan->epfd_data[
which] = aed;
2651 ev.events = EPOLLIN | EPOLLPRI | EPOLLERR | EPOLLHUP;
2653 epoll_ctl(chan->epfd, EPOLL_CTL_ADD, fd, &ev);
2657 chan->epfd_data[
which] = NULL;
2668 struct epoll_event ev;
2671 if (chan0->epfd == -1)
2676 if (chan1->
fds[i] == -1)
2678 ev.events = EPOLLIN | EPOLLPRI | EPOLLERR | EPOLLHUP;
2679 ev.data.ptr = chan1->epfd_data[i];
2680 epoll_ctl(chan0->epfd, EPOLL_CTL_ADD, chan1->
fds[i], &ev);
2691 struct epoll_event ev;
2694 if (chan0->epfd == -1)
2698 if (chan1->
fds[i] == -1)
2700 epoll_ctl(chan0->epfd, EPOLL_CTL_DEL, chan1->
fds[i], &ev);
2741 pthread_kill(chan->
blocker, SIGURG);
2821 while (chan->
masq) {
2879 "is blocked by thread %ld in procedure %s! Expect a failure\n",
2899 "CallerIDNum: %s\r\n"
2900 "CallerIDName: %s\r\n"
2901 "ConnectedLineNum: %s\r\n"
2902 "ConnectedLineName: %s\r\n"
2904 "Cause-txt: %s\r\n",
2987 old_state = chan->
_state;
2992 switch (old_state) {
3001 int timeout_ms =
MAX(delay, 500);
3002 unsigned int done = 0;
3003 struct timeval start;
3017 ast_debug(2,
"Didn't receive a media frame from %s within %u ms of answering. Continuing anyway\n", chan->
name,
MAX(delay, 500));
3027 ast_debug(2,
"Hangup of channel %s detected in answer routine\n", chan->
name);
3045 switch (new->frametype) {
3096 if (generator && generator->
release) {
3129 if (!tmp || !generate)
3141 ast_debug(1,
"Auto-deactivating generator\n");
3156 if (generator_old && generator_old->
release) {
3186 int *exception,
int *outfd,
int *ms)
3189 int *exception,
int *outfd,
int *ms)
3192 struct timeval start = { 0 , 0 };
3193 struct pollfd *pfds = NULL;
3198 struct timeval now = { 0, 0 };
3199 struct timeval whentohangup = { 0, 0 }, diff;
3220 for (x = 0; x < n; x++) {
3221 while (c[x]->masq) {
3229 diff =
ast_tvsub(c[x]->whentohangup, now);
3238 whentohangup = diff;
3245 if (!
ast_tvzero(whentohangup) && whentohangup.tv_sec < INT_MAX / 1000) {
3246 rms = whentohangup.tv_sec * 1000 + whentohangup.tv_usec / 1000;
3247 if (*ms >= 0 && *ms < rms) {
3250 }
else if (!
ast_tvzero(whentohangup) && rms < 0) {
3260 for (x = 0; x < n; x++) {
3262 fdmap[max].fdno = y;
3263 fdmap[max].chan = x;
3269 for (x = 0; x < nfds; x++) {
3270 fdmap[max].chan = -1;
3277 if (
sizeof(
int) == 4) {
3285 }
while (!res && (rms > 0));
3289 for (x = 0; x < n; x++)
3298 for (x = 0; x < n; x++) {
3316 for (x = 0; x < max; x++) {
3317 res = pfds[x].revents;
3320 if (fdmap[x].chan >= 0) {
3321 winner = c[fdmap[x].chan];
3326 winner->
fdno = fdmap[x].fdno;
3329 *outfd = pfds[x].fd;
3331 *exception = (res & POLLPRI) ? -1 : 0;
3346 struct timeval start = { 0 , 0 };
3348 struct epoll_event ev[1];
3349 long diff, rms = *ms;
3355 while (chan->
masq) {
3382 res = epoll_wait(chan->epfd, ev, 1, rms);
3409 aed = ev[0].data.ptr;
3411 if (ev[0].
events & EPOLLPRI)
3427 struct timeval start = { 0 , 0 };
3429 struct epoll_event ev[25] = { { 0, } };
3430 struct timeval now = { 0, 0 };
3431 long whentohangup = 0, diff = 0, rms = *ms;
3434 for (i = 0; i < n; i++) {
3435 while (c[i]->
masq) {
3441 if (whentohangup == 0)
3448 if (!whentohangup || whentohangup > diff)
3449 whentohangup = diff;
3458 if (*ms >= 0 && *ms < rms)
3465 res = epoll_wait(c[0]->epfd, ev, 25, rms);
3467 for (i = 0; i < n; i++)
3478 for (i = 0; i < n; i++) {
3492 for (i = 0; i < res; i++) {
3495 if (!ev[i].
events || !aed)
3499 if (ev[i].
events & EPOLLPRI)
3516 int *exception,
int *outfd,
int *ms)
3525 if (!n || nfds || c[0]->epfd == -1)
3526 return ast_waitfor_nandfds_classic(c, n, fds, nfds, exception, outfd, ms);
3527 else if (!nfds && n == 1)
3528 return ast_waitfor_nandfds_simple(c[0], ms);
3530 return ast_waitfor_nandfds_complex(c, n, ms);
3565 unsigned int real_rate = rate, max_rate;
3580 real_rate = max_rate;
3583 ast_debug(1,
"Scheduling timer at (%u requested / %u actual) timer ticks per second\n", rate, real_rate);
3594 if (data && is_ao2_obj) {
3641 if (!rchan && outfd < 0 && ms) {
3647 }
else if (outfd > -1) {
3649 ast_log(
LOG_WARNING,
"The FD we were waiting for has something waiting. Waitfordigit returning numeric 1\n");
3719 chan->
name, chan->
uniqueid, digit, direction, begin, end);
3747 samples = (int) (((
float) f->
samples) * factor);
3772 ast_debug(1,
"Auto-deactivating generator\n");
3825 int diff = sample_rate - seek_rate;
3828 samples = samples / (float) (sample_rate / seek_rate);
3829 }
else if (diff < 0) {
3830 samples = samples * (float) (seek_rate / sample_rate);
3888 if (chan->
fdno == -1) {
3890 "ast_read() on chan '%s' called with no recorded file descriptor.\n",
3913 int (*func)(
const void *) = chan->
timingfunc;
3962 if ((flags & O_NONBLOCK) == 0) {
3964 if (fcntl(chan->
alertpipe[0], F_SETFL, flags | O_NONBLOCK) < 0) {
3970 if (read(chan->
alertpipe[0], &blah,
sizeof(blah)) < 0) {
4002 if (write(chan->
alertpipe[1], &poke,
sizeof(poke)) !=
sizeof(poke)) {
4025 chan->
blocker = pthread_self();
4069 ast_debug(1,
"Ignoring answer on an inbound call!\n");
4073 ast_debug(1,
"Dropping duplicate answer!\n");
4083 read_action_payload = f->
data.
ptr;
4084 switch (read_action_payload->
action) {
4166 }
else if (!f->
len) {
4231 if (old_frame != f) {
4280 ast_log(
LOG_NOTICE,
"Dropping incompatible voice frame on %s of format %s since our native format has changed to %s\n",
4294 #ifndef MONITOR_CONSTANT_DELAY
4299 ast_log(
LOG_WARNING,
"Failed to perform seek in monitoring read stream, synchronization between the files may be broken\n");
4305 if (jump - MONITOR_DELAY >= 0) {
4307 ast_log(
LOG_WARNING,
"Failed to perform seek in monitoring read stream, synchronization between the files may be broken\n");
4403 switch (condition) {
4448 const void *data,
size_t datalen)
4463 goto indicate_cleanup;
4470 .subclass.integer = condition,
4471 .data.ptr = (
void *) data,
4483 goto indicate_cleanup;
4487 data = awesome_frame->
data.
ptr;
4488 datalen = awesome_frame->
datalen;
4491 switch (condition) {
4532 res = chan->
tech->
indicate(chan, condition, data, datalen);
4540 goto indicate_cleanup;
4549 if (_condition < 0) {
4553 goto indicate_cleanup;
4557 switch (condition) {
4561 goto indicate_cleanup;
4570 goto indicate_cleanup;
4623 ast_debug(1,
"Driver for channel '%s' does not support indication %u, emulating it\n", chan->
name, condition);
4635 if (awesome_frame) {
4648 c = *(
unsigned char *)buf;
4709 static const char *
const dtmf_tones[] = {
4739 if (digit >=
'0' && digit <=
'9')
4741 else if (digit >=
'A' && digit <=
'D')
4743 else if (digit ==
'*')
4745 else if (digit ==
'#')
4749 ast_debug(1,
"Unable to generate DTMF tone '%c' for '%s'\n", digit, chan->
name);
4827 struct plc_ds *plc = data;
4839 int num_new_samples = frame->
samples;
4861 if (!num_new_samples) {
4883 frame->
datalen = num_new_samples * 2;
4897 plc = datastore->
data;
4911 datastore->
data = plc;
4926 ast_debug(1,
"Deadlock avoided for write to channel '%s'\n", chan->
name);
4936 while (chan->
masq) {
4988 if (old_frame != fr)
5003 if (new_frame != fr) {
5060 ast_log(
LOG_WARNING,
"Codec mismatch on channel %s setting write format to %s from %s native formats %s\n",
5075 struct ast_frame *prev = NULL, *new_frame, *cur, *dup;
5076 int freeoldlist = 0;
5090 if (new_frame != cur) {
5101 if (new_frame != dup) {
5128 #ifndef MONITOR_CONSTANT_DELAY
5133 ast_log(
LOG_WARNING,
"Failed to perform seek in monitoring write stream, synchronization between the files may be broken\n");
5140 if (jump - MONITOR_DELAY >= 0) {
5142 ast_log(
LOG_WARNING,
"Failed to perform seek in monitoring write stream, synchronization between the files may be broken\n");
5160 unsigned int skip = 0;
5166 if ((res = chan->
tech->
write(chan, cur)) < 0) {
5223 char from[200], to[200];
5230 if (!fmt || !native)
5235 ast_debug(1,
"Channel driver natively set channel %s to %s format %s\n", chan->
name,
5263 if ((*rawformat == native) && (*format == fmt) && ((*rawformat == *format) || (*trans))) {
5269 *rawformat = native;
5278 if (*format == *rawformat) {
5293 res = *trans ? 0 : -1;
5296 ast_debug(1,
"Set channel %s to %s format %s\n", chan->
name,
5318 return "Call Failure (not BUSY, and not NO_ANSWER, maybe Circuit busy or down?)";
5322 return "Local Ring";
5324 return "Remote end Ringing";
5326 return "Remote end has Answered";
5328 return "Remote end is Busy";
5330 return "Congestion (circuits busy)";
5332 return "Unknown Reason!!";
5396 if ((data = strchr(tmpchan,
'/'))) {
5400 const char *forward_context;
5408 if (!(new_chan =
ast_request(type, format, orig, data, &cause))) {
5409 ast_log(
LOG_NOTICE,
"Unable to create channel for call forward to '%s/%s' (cause = %d)\n", type, data, cause);
5428 }
else if (caller) {
5446 ast_log(
LOG_NOTICE,
"Unable to call forward to channel %s/%s\n", type, (
char *)data);
5462 int last_subclass = 0;
5468 outstate = &dummy_outstate;
5470 chan =
ast_request(type, format, requestor, data, &cause);
5523 connected.
id.
name.
str = (
char *) cid_name;
5633 snprintf(tmp,
sizeof(tmp),
"%s/%s", type, (
char *)data);
5665 if (!requestor || !out) {
5673 ops[1][1] = encrypt->
media;
5680 for (i = 0; i < 2; i++) {
5716 if (strcasecmp(type, chan->
tech->
type))
5727 char tmp1[256], tmp2[256];
5728 ast_log(
LOG_WARNING,
"No translator path exists for channel type %s (native %s) to %s\n", type,
5740 if (!(c = chan->
tech->
requester(type, capabilities | videoformat | textformat, requestor, data, cause)))
5774 res = chan->
tech->
call(chan, addr, timeout);
5813 if (res < 0 || !(fr =
ast_read(chan))) {
5883 if (strchr(enders, d) && (pos == 0)) {
5888 if (!strchr(enders, d)) {
5891 if (strchr(enders, d) || (pos >= len)) {
5910 return chan->
tech->
send_html(chan, subclass, data, datalen);
5990 struct ast_channel *final_orig, *final_clone, *base;
5993 final_orig = original;
5994 final_clone = clonechan;
6002 "Can't setup masquerade. One or both channels is dead. (%s <-- %s)\n",
6017 final_orig = original->
_bridge;
6022 final_clone = clonechan->
_bridge;
6029 if ((final_orig != original) || (final_clone != clonechan)) {
6052 original = final_orig;
6053 clonechan = final_clone;
6059 "Can't setup masquerade. One or both channels is dead. (%s <-- %s)\n",
6069 if (original == clonechan) {
6076 ast_debug(1,
"Planning to masquerade channel %s into the structure of %s\n",
6080 original->
masq = clonechan;
6081 clonechan->
masqr = original;
6087 ast_debug(1,
"Done planning to masquerade channel %s into the structure of %s\n", clonechan->
name, original->
name);
6089 }
else if (original->
masq) {
6092 }
else if (original->
masqr) {
6096 }
else if (clonechan->
masq) {
6133 if (!connected.id.name.str) {
6134 connected.id.name.str =
"";
6136 if (!connected.id.number.str) {
6137 connected.id.number.str =
"";
6139 if (!connected.id.subaddress.str) {
6140 connected.id.subaddress.str =
"";
6142 if (!connected.id.tag) {
6143 connected.id.tag =
"";
6180 .
type =
"xfer_colp",
6190 int transferee_held)
6201 xfer_colp =
ast_calloc(1,
sizeof(*xfer_colp));
6210 xfer_ds->
data = xfer_colp;
6244 const char *varname;
6253 if (varname[0] ==
'_') {
6255 if (varname[1] ==
'_')
6264 ast_debug(1,
"Inheriting variable %s from %s to %s.\n",
6272 ast_debug(1,
"Inheriting variable %s from %s to %s.\n",
6322 const char *satime, *saseq;
6323 const char *sbtime, *sbseq;
6326 unsigned int atime, aseq, btime, bseq;
6338 if ((dash = strrchr(satime,
'-'))) {
6341 if ((dash = strrchr(sbtime,
'-'))) {
6346 saseq = strchr(satime,
'.');
6347 sbseq = strchr(sbtime,
'.');
6348 if (!saseq || !sbseq)
6354 atime = atoi(satime);
6355 btime = atoi(sbtime);
6360 if (atime == btime) {
6361 return (aseq < bseq) ? a : b;
6364 return (atime < btime) ? a : b;
6374 if (!strcmp(chan->
linkedid, linkedid)) {
6389 const char* linkedid=NULL;
6397 if (bridged && bridged != peer) {
6404 if (bridged && bridged != chan) {
6417 if (bridged && bridged != peer) {
6423 if (bridged && bridged != chan) {
6434 ast_log(
LOG_DEBUG,
"setting peeraccount to %s for %s from data on channel %s\n",
6439 ast_log(
LOG_DEBUG,
"setting peeraccount to %s for %s from data on channel %s\n",
6444 ast_log(
LOG_DEBUG,
"setting accountcode to %s for %s from data on channel %s\n",
6449 ast_log(
LOG_DEBUG,
"setting accountcode to %s for %s from data on channel %s\n",
6454 ast_log(
LOG_DEBUG,
"changing peeraccount from %s to %s on %s to match channel %s\n",
6459 ast_log(
LOG_DEBUG,
"changing peeraccount from %s to %s on %s to match channel %s\n",
6475 "CallerIDNum: %s\r\n"
6476 "CallerIDName: %s\r\n"
6478 "CID-CallingPres: %d (%s)\r\n",
6503 unsigned char connected_line_data[1024];
6520 sizeof(connected_line_data), &colp->
target_id, NULL);
6521 if (payload_size != -1) {
6522 frame_size = payload_size +
sizeof(*frame_payload);
6526 memcpy(frame_payload->payload, connected_line_data, payload_size);
6551 unsigned int orig_disablestatecache;
6552 unsigned int clone_disablestatecache;
6553 int visible_indication;
6555 int clone_was_zombie = 0;
6577 char clone_sending_dtmf_digit;
6578 struct timeval clone_sending_dtmf_tv;
6620 clonechan = original->
masq;
6643 xfer_colp = xfer_ds->
data;
6669 ast_debug(4,
"Actually Masquerading %s(%u) into the structure of %s(%u)\n",
6672 chans[0] = clonechan;
6673 chans[1] = original;
6676 "CloneState: %s\r\n"
6678 "OriginalState: %s\r\n",
6699 snprintf(masqn,
sizeof(masqn),
"%s<MASQ>", newn);
6713 clonechan->
tech = t;
6720 cdr = original->
cdr;
6723 original->
cdr = clonechan->
cdr;
6724 clonechan->
cdr = cdr;
6727 for (i = 0; i < 2; i++) {
6756 if (write(original->
alertpipe[1], &poke,
sizeof(poke)) < 0) {
6778 origstate = original->
_state;
6780 clonechan->
_state = origstate;
6786 if (orig_disablestatecache != clone_disablestatecache) {
6787 if (orig_disablestatecache) {
6797 snprintf(zombn,
sizeof(zombn),
"%s<ZOMBIE>", orig);
6853 exchange.dialed = original->
dialed;
6855 clonechan->
dialed = exchange.dialed;
6857 exchange.caller = original->
caller;
6859 clonechan->
caller = exchange.caller;
6861 exchange.connected = original->
connected;
6863 clonechan->
connected = exchange.connected;
6900 ast_debug(1,
"Putting channel %s in %s/%s formats\n", original->
name,
6905 ast_log(
LOG_WARNING,
"Channel type '%s' could not fixup channel %s, strange things may happen. (clonechan)\n",
6911 ast_log(
LOG_WARNING,
"Channel type '%s' could not fixup channel %s, strange things may happen. (original)\n",
6925 clone_was_zombie = 1;
6932 original->
masq = NULL;
6933 clonechan->
masqr = NULL;
6957 if (clone_sending_dtmf_digit) {
6975 if (visible_indication) {
6981 if (moh_is_playing) {
6989 pthread_kill(original->
blocker, SIGURG);
7017 if (clone_was_zombie) {
7019 ast_debug(1,
"Destroying channel clone '%s'\n", clonechan->
name);
7024 "Cause-txt: %s\r\n",
7081 if (&chan->
caller == caller) {
7093 const char *pre_set_number;
7094 const char *pre_set_name;
7096 if (&chan->
caller == caller) {
7121 int oldstate = chan->
_state;
7124 if (oldstate == state)
7128 if ((dashptr = strrchr(name,
'-'))) {
7142 "ChannelState: %u\r\n"
7143 "ChannelStateDesc: %s\r\n"
7144 "CallerIDNum: %s\r\n"
7145 "CallerIDName: %s\r\n"
7146 "ConnectedLineNum: %s\r\n"
7147 "ConnectedLineName: %s\r\n"
7171 int min = 0, sec = 0, check;
7178 if (remain / 60 > 1) {
7186 if (!strcmp(sound,
"timeleft")) {
7217 int frame_put_in_jb = 0;
7312 ast_debug(1,
"Didn't get a frame from channel: %s\n",who->
name);
7316 other = (who == c0) ? c1 : c0;
7322 int bridge_exit = 0;
7368 int monitored_source = (who == c0) ? watch_c0_dtmf : watch_c1_dtmf;
7370 if (monitored_source &&
7375 ast_debug(1,
"Got DTMF %s on channel (%s)\n",
7382 if (!frame_put_in_jb)
7425 "Bridgestate: %s\r\n"
7426 "Bridgetype: %s\r\n"
7432 "CallerID2: %s\r\n",
7433 onoff ?
"Link" :
"Unlink",
7434 type == 1 ?
"core" :
"native",
7443 const char *c0_name;
7444 const char *c1_name;
7445 const char *c0_pvtid = NULL;
7446 const char *c1_pvtid = NULL;
7480 const char *s, *sound;
7513 long time_left_ms=0;
7514 char caller_warning = 0;
7515 char callee_warning = 0;
7541 if (caller_warning) {
7544 if (callee_warning) {
7567 if ((caller_warning || callee_warning) && config->
play_warning) {
7569 if (time_left_ms < config->play_warning && config->
warning_freq > 0) {
7594 struct timeval now = { 0, };
7613 if (time_left_ms < 0) {
7617 if (time_left_ms < to) {
7621 if (time_left_ms <= 0) {
7622 if (caller_warning && config->
end_sound)
7624 if (callee_warning && config->
end_sound)
7634 int t = (time_left_ms + 500) / 1000;
7662 ast_debug(1,
"Unbridge signal received. Ending native bridge.\n");
7671 ast_debug(1,
"Bridge stops because we're zombie or need a soft hangup: c0=%s, c1=%s, flags: %s,%s,%s,%s\n",
7686 (!config->
timelimit || to > 1000 || to == -1) &&
7692 int timeoutms = to - 1000 > 0 ? to - 1000 : to;
7703 "CallerID2: %s\r\n",
7709 ast_debug(1,
"Returning from native bridge, channels: %s, %s\n", c0->
name, c1->
name);
7784 "CallerID2: %s\r\n",
7908 if (len >
sizeof(ts->
data) / 2 - 1) {
7912 memset(&ts->
f, 0,
sizeof(ts->
f));
7913 for (x=0;x<len/2;x++) {
7923 p = ts->
v3_2 - 32768;
7925 p = ((p * 9) / 10) + 1;
7926 ts->
data[x] = (ts->
v3_1 * p) >> 15;
7958 d.
vol = (vol < 1) ? 8192 : vol;
7991 int start=0, finish=0, x;
7999 while ((piece =
strsep(&c,
","))) {
8000 if (sscanf(piece,
"%30d-%30d", &start, &finish) == 2) {
8002 }
else if (sscanf(piece,
"%30d", &start)) {
8006 ast_log(
LOG_ERROR,
"Syntax error parsing group configuration '%s' at '%s'. Ignoring.\n", s, piece);
8009 for (x = start; x <= finish; x++) {
8010 if ((x > 63) || (x < 0)) {
8045 ast_verb(3,
"Music class %s requested but no musiconhold loaded.\n", mclass ? mclass : (interpclass ? interpclass :
"default"));
8084 if (!strcasecmp(var->
name,
"genericplc")) {
8108 if (!data_channel) {
8114 ast_log(
LOG_ERROR,
"Unable to add channel structure for channel: %s\n", c->name);
8208 AST_DATA_ENTRY(
"/asterisk/core/channeltypes", &channeltypes_provider),
8247 for (i = 0; i <= 63; i++) {
8250 strncat(buf,
", ", buflen - strlen(buf) - 1);
8254 snprintf(num,
sizeof(num),
"%u", i);
8255 strncat(buf, num, buflen - strlen(buf) - 1);
8265 for (cur = vars; cur; cur = cur->
next)
8288 .datalen =
sizeof(buf),
8291 memset(buf, 0,
sizeof(buf));
8313 if (!(state =
ast_calloc(1,
sizeof(*state)))) {
8327 ast_debug(1,
"Started silence generator on '%s'\n", chan->
name);
8337 ast_debug(1,
"Trying to stop silence generator when there is no generator on '%s'\n",
8342 if (chan->
generator != &silence_generator) {
8343 ast_debug(1,
"Trying to stop silence generator when it is not the current generator on '%s'\n",
8362 ast_debug(1,
"Stopped silence generator on '%s'\n", chan->
name);
8365 ast_log(
LOG_ERROR,
"Could not return write format to its original state\n");
8376 return "LOAD (Channel module load)";
8379 return "RELOAD (Channel module reload)";
8382 return "CLIRELOAD (Channel module reload by CLI command)";
8385 return "MANAGERRELOAD (Channel module reload by manager)";
8398 const char *ints,
const char *
language,
const char *options)
8404 const char *ints,
const char *
language,
const char *options)
8410 const char *ints,
const char *lang)
8416 const char *ints,
const char *lang)
8422 const char *ints,
const char *lang)
8428 const char *ints,
const char *lang)
8434 const char *ints,
const char *lang,
int audiofd,
int ctrlfd)
8438 snprintf(buf,
sizeof(buf),
"%d", num);
8506 length = strlen(name->
str);
8507 if (datalen < pos + (
sizeof(data[0]) * 2) + length) {
8511 data[pos++] = ies->
str;
8512 data[pos++] = length;
8513 memcpy(data + pos, name->
str, length);
8517 if (datalen < pos + (
sizeof(data[0]) * 2) + 1) {
8525 if (datalen < pos + (
sizeof(data[0]) * 2) + 1) {
8533 if (datalen < pos + (
sizeof(data[0]) * 2) + 1) {
8537 data[pos++] = ies->
valid;
8539 data[pos++] = name->
valid;
8580 length = strlen(number->
str);
8581 if (datalen < pos + (
sizeof(data[0]) * 2) + length) {
8585 data[pos++] = ies->
str;
8586 data[pos++] = length;
8587 memcpy(data + pos, number->
str, length);
8591 if (datalen < pos + (
sizeof(data[0]) * 2) + 1) {
8595 data[pos++] = ies->
plan;
8597 data[pos++] = number->
plan;
8599 if (datalen < pos + (
sizeof(data[0]) * 2) + 1) {
8607 if (datalen < pos + (
sizeof(data[0]) * 2) + 1) {
8611 data[pos++] = ies->
valid;
8613 data[pos++] = number->
valid;
8653 if (subaddress->
str) {
8654 length = strlen(subaddress->
str);
8655 if (datalen < pos + (
sizeof(data[0]) * 2) + length) {
8659 data[pos++] = ies->
str;
8660 data[pos++] = length;
8661 memcpy(data + pos, subaddress->
str, length);
8665 if (datalen < pos + (
sizeof(data[0]) * 2) + 1) {
8669 data[pos++] = ies->
type;
8671 data[pos++] = subaddress->
type;
8673 if (datalen < pos + (
sizeof(data[0]) * 2) + 1) {
8675 "No space left for %s subaddress odd-even indicator\n", label);
8682 if (datalen < pos + (
sizeof(data[0]) * 2) + 1) {
8686 data[pos++] = ies->
valid;
8688 data[pos++] = subaddress->
valid;
8735 if (!update || update->
name) {
8744 if (!update || update->
number) {
8764 length = strlen(id->
tag);
8765 if (datalen < pos + (
sizeof(data[0]) * 2) + length) {
8769 data[pos++] = ies->
tag;
8770 data[pos++] = length;
8771 memcpy(data + pos, id->
tag, length);
8776 if (!update || update->
number) {
8779 if (!update || update->
name) {
8787 presentation =
id->number.presentation;
8790 if (datalen < pos + (
sizeof(data[0]) * 2) + 1) {
8796 data[pos++] = presentation;
8857 if (datalen < pos + (
sizeof(data[0]) * 2) + 1) {
8866 "connected line", &ies, update ? &update->
id : NULL);
8873 if (datalen < pos + (
sizeof(data[0]) * 2) +
sizeof(value)) {
8878 data[pos++] =
sizeof(
value);
8879 value = htonl(connected->
source);
8880 memcpy(data + pos, &value,
sizeof(value));
8881 pos +=
sizeof(
value);
8889 unsigned char ie_len;
8890 unsigned char ie_id;
8892 int frame_version = 1;
8894 int got_combined_presentation = 0;
8896 for (pos = 0; pos < datalen; pos += ie_len) {
8897 if (datalen < pos +
sizeof(ie_id) +
sizeof(ie_len)) {
8901 ie_id = data[pos++];
8902 ie_len = data[pos++];
8903 if (datalen < pos + ie_len) {
8916 frame_version = data[pos];
8923 memcpy(connected->
id.
name.
str, data + pos, ie_len);
8956 memcpy(connected->
id.
number.
str, data + pos, ie_len);
8991 combined_presentation = data[pos];
8992 got_combined_presentation = 1;
9014 "Invalid connected line subaddress odd-even indicator (%u)\n",
9032 if (connected->
id.
tag) {
9033 memcpy(connected->
id.
tag, data + pos, ie_len);
9034 connected->
id.
tag[ie_len] = 0;
9039 if (ie_len !=
sizeof(value)) {
9044 memcpy(&value, data + pos,
sizeof(value));
9045 connected->
source = ntohl(value);
9050 (
unsigned) ie_id, (
unsigned) ie_len);
9055 switch (frame_version) {
9064 if (got_combined_presentation) {
9078 (
unsigned) frame_version);
9087 unsigned char data[1024];
9091 if (datalen == (
size_t) -1) {
9100 unsigned char data[1024];
9104 if (datalen == (
size_t) -1) {
9207 if (datalen < pos + (
sizeof(data[0]) * 2) + 1) {
9216 "redirecting-from", &from_ies, update ? &update->
from : NULL);
9223 "redirecting-to", &to_ies, update ? &update->
to : NULL);
9230 if (datalen < pos + (
sizeof(data[0]) * 2) +
sizeof(value)) {
9235 data[pos++] =
sizeof(
value);
9236 value = htonl(redirecting->
reason);
9237 memcpy(data + pos, &value,
sizeof(value));
9238 pos +=
sizeof(
value);
9241 if (datalen < pos + (
sizeof(data[0]) * 2) +
sizeof(
value)) {
9246 data[pos++] =
sizeof(
value);
9247 value = htonl(redirecting->
count);
9248 memcpy(data + pos, &value,
sizeof(value));
9249 pos +=
sizeof(
value);
9257 unsigned char ie_len;
9258 unsigned char ie_id;
9260 int frame_version = 1;
9261 int from_combined_presentation = 0;
9262 int got_from_combined_presentation = 0;
9263 int to_combined_presentation = 0;
9264 int got_to_combined_presentation = 0;
9266 for (pos = 0; pos < datalen; pos += ie_len) {
9267 if (datalen < pos +
sizeof(ie_id) +
sizeof(ie_len)) {
9271 ie_id = data[pos++];
9272 ie_len = data[pos++];
9273 if (datalen < pos + ie_len) {
9286 frame_version = data[pos];
9293 memcpy(redirecting->
from.
name.
str, data + pos, ie_len);
9361 from_combined_presentation = data[pos];
9362 got_from_combined_presentation = 1;
9384 "Invalid redirecting-from subaddress odd-even indicator (%u)\n",
9403 memcpy(redirecting->
from.
tag, data + pos, ie_len);
9404 redirecting->
from.
tag[ie_len] = 0;
9412 memcpy(redirecting->
to.
name.
str, data + pos, ie_len);
9445 memcpy(redirecting->
to.
number.
str, data + pos, ie_len);
9480 to_combined_presentation = data[pos];
9481 got_to_combined_presentation = 1;
9503 "Invalid redirecting-to subaddress odd-even indicator (%u)\n",
9521 if (redirecting->
to.
tag) {
9522 memcpy(redirecting->
to.
tag, data + pos, ie_len);
9523 redirecting->
to.
tag[ie_len] = 0;
9528 if (ie_len !=
sizeof(value)) {
9533 memcpy(&value, data + pos,
sizeof(value));
9534 redirecting->
reason = ntohl(value);
9538 if (ie_len !=
sizeof(value)) {
9543 memcpy(&value, data + pos,
sizeof(value));
9544 redirecting->
count = ntohl(value);
9549 (
unsigned) ie_id, (
unsigned) ie_len);
9554 switch (frame_version) {
9563 if (got_from_combined_presentation) {
9571 if (got_to_combined_presentation) {
9585 (
unsigned) frame_version);
9594 unsigned char data[1024];
9598 if (datalen == (
size_t) -1) {
9607 unsigned char data[1024];
9611 if (datalen == (
size_t) -1) {
9621 const char *macro_args;
9626 ?
"CONNECTED_LINE_CALLER_SEND_MACRO" :
"CONNECTED_LINE_CALLEE_SEND_MACRO");
9629 ?
"CONNECTED_LINE_CALLER_SEND_MACRO_ARGS" :
"CONNECTED_LINE_CALLEE_SEND_MACRO_ARGS");
9638 const struct ast_frame *frame = connected_info;
9666 const char *macro_args;
9671 ?
"REDIRECTING_CALLER_SEND_MACRO" :
"REDIRECTING_CALLEE_SEND_MACRO");
9674 ?
"REDIRECTING_CALLER_SEND_MACRO_ARGS" :
"REDIRECTING_CALLEE_SEND_MACRO_ARGS");
9683 const struct ast_frame *frame = redirecting_info;
9726 .
type =
"Call Completion",
9749 cc_datastore->
data = cc_params;
9773 return cc_datastore->
data;
9778 int len = name_buffer_length;
9786 if ((dash = strrchr(device_name,
'-'))) {
9803 if ((slash = strchr(agent_type,
'/'))) {
9818 #undef ast_channel_alloc
9821 const char *
cid_name,
const char *acctcode,
9823 const char *
linkedid,
const int amaflag,
9824 const char *name_fmt, ...);
9826 const char *
cid_name,
const char *acctcode,
9828 const char *
linkedid,
const int amaflag,
9829 const char *name_fmt, ...)
9835 va_start(ap1, name_fmt);
9836 va_start(ap2, name_fmt);
9838 linkedid, amaflag, __FILE__, __LINE__, __FUNCTION__, name_fmt, ap1, ap2);
int valid
valid/present ie
int(* func_channel_read)(struct ast_channel *chan, const char *function, char *data, char *buf, size_t len)
Provide additional read items for CHANNEL() dialplan function.
const ast_string_field peeraccount
void ast_party_connected_line_collect_caller(struct ast_party_connected_line *connected, struct ast_party_caller *caller)
Collect the caller party information into a connected line structure.
int ast_cdr_disposition(struct ast_cdr *cdr, int cause)
Save the result of the call based on the AST_CAUSE_*.
#define AST_CAUSE_PROTOCOL_ERROR
static char musicclass[MAX_MUSICCLASS]
#define AST_THREADSTORAGE(name)
Define a thread storage variable.
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...
int ast_safe_sleep(struct ast_channel *chan, int ms)
Wait for a specified amount of time, looking for hangups.
void ast_party_name_copy(struct ast_party_name *dest, const struct ast_party_name *src)
Copy the source party name information to the destination party name.
int ast_queue_hangup(struct ast_channel *chan)
Queue a hangup frame.
unsigned long long ast_group_t
union ast_frame_subclass subclass
int ast_hangup(struct ast_channel *chan)
Hang up a channel.
int ast_channel_early_bridge(struct ast_channel *c0, struct ast_channel *c1)
Bridge two channels together (early)
Information needed to identify an endpoint in a call.
enum sip_cc_notify_state state
int ast_recvchar(struct ast_channel *chan, int timeout)
Receives a text character from a channel.
#define AST_LIST_INSERT_LIST_AFTER(head, list, elm, field)
Inserts a whole list after a specific entry in a list.
int char_set
Character set ie.
struct ast_channel * chan
void ast_party_connected_line_init(struct ast_party_connected_line *init)
Initialize the given connected line structure.
static char accountcode[AST_MAX_ACCOUNT_CODE]
int presentation
Q.931 encoded presentation-indicator encoded field.
#define AST_CAUSE_MANDATORY_IE_MISSING
struct ast_channel * masqr
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.
#define ast_channel_lock(chan)
#define AST_CAUSE_BEARERCAPABILITY_NOTAUTH
#define AST_OPTION_FORMAT_WRITE
void ast_bridge_end_dtmf(struct ast_channel *chan, char digit, struct timeval start, const char *why)
Simulate a DTMF end on a broken bridge channel.
static char exten[AST_MAX_EXTENSION]
Main Channel structure associated with a channel.
void ast_party_redirecting_set(struct ast_party_redirecting *dest, const struct ast_party_redirecting *src, const struct ast_set_party_redirecting *update)
Set the redirecting information based on another redirecting source.
struct ast_channel * ast_channel_get_by_exten(const char *exten, const char *context)
Find a channel by extension and context.
#define AST_CLI_DEFINE(fn, txt,...)
int ast_connected_line_build_data(unsigned char *data, size_t datalen, const struct ast_party_connected_line *connected, const struct ast_set_party_connected_line *update)
Build the connected line information data frame.
void ast_cdr_failed(struct ast_cdr *cdr)
Fail a call.
int plan
Q.931 Type-Of-Number and Numbering-Plan encoded fields.
char * str
Subscriber phone number (Malloced)
struct ast_channel * masq
General Asterisk channel transcoding definitions.
struct chanlist::@238 list
struct ast_party_connected_line connected
Channel Connected Line ID information.
#define AST_CAUSE_SUBSCRIBER_ABSENT
#define AST_CAUSE_OUTGOING_CALL_BARRED
#define AST_CAUSE_INCOMPATIBLE_DESTINATION
Asterisk locking-related definitions:
unsigned int ast_timer_get_max_rate(const struct ast_timer *handle)
Get maximum rate supported for a timer.
static void adjust_frame_for_plc(struct ast_channel *chan, struct ast_frame *frame, struct ast_datastore *datastore)
struct ast_channel * ast_channel_iterator_next(struct ast_channel_iterator *i)
Get the next channel for a channel iterator.
Asterisk main include file. File version handling, generic pbx functions.
void ast_poll_channel_add(struct ast_channel *chan0, struct ast_channel *chan1)
#define AST_BRIDGE_IGNORE_SIGS
Ignore all signal frames except NULL.
#define ao2_link(arg1, arg2)
#define AST_LIST_FIRST(head)
Returns the first entry contained in a list.
struct ast_channel *(*const requester)(const char *type, format_t format, const struct ast_channel *requestor, void *data, int *cause)
Requester - to set up call data structures (pvt's)
static void bridge_play_sounds(struct ast_channel *c0, struct ast_channel *c1)
int ao2_container_count(struct ao2_container *c)
Returns the number of elements in a container.
int ast_channel_cmpwhentohangup(struct ast_channel *chan, time_t offset)
Compare a offset with the settings of when to hang a channel up.
int(*const send_image)(struct ast_channel *chan, struct ast_frame *frame)
Display or send an image.
static const char config[]
The data tree to be returned by the callbacks and managed by functions local to this file...
char * str
Subscriber phone number (Malloced)
void ast_channel_set_caller_event(struct ast_channel *chan, const struct ast_party_caller *caller, const struct ast_set_party_caller *update)
Set the caller id information in the Asterisk channel and generate an AMI event if the caller id name...
int(*const write_video)(struct ast_channel *chan, struct ast_frame *frame)
Write a frame, in standard format.
static char parkinglot[AST_MAX_CONTEXT]
int ast_queue_control(struct ast_channel *chan, enum ast_control_frame_type control)
Queue a control frame with payload.
int ast_redirecting_parse_data(const unsigned char *data, size_t datalen, struct ast_party_redirecting *redirecting)
Parse redirecting indication frame data.
struct ast_frame ast_null_frame
struct timeval feature_start_time
struct ast_party_caller caller
Channel Caller ID information.
struct ast_set_party_id ani
struct ast_tone_zone * zone
void * ast_threadstorage_get(struct ast_threadstorage *ts, size_t init_size)
Retrieve thread storage.
int ast_autoservice_start(struct ast_channel *chan)
Automatically service a channel for us...
char * strsep(char **str, const char *delims)
void ast_frame_dump(const char *name, struct ast_frame *f, char *prefix)
static int __ast_queue_frame(struct ast_channel *chan, struct ast_frame *fin, int head, struct ast_frame *after)
static int attribute_const is_visible_indication(enum ast_control_frame_type condition)
#define ast_string_field_build_va(x, field, fmt, args1, args2)
Set a field to a complex (built) value.
static struct ast_tone_zone * ast_tone_zone_unref(struct ast_tone_zone *tz)
Release a reference to an ast_tone_zone.
void ast_party_number_set_init(struct ast_party_number *init, const struct ast_party_number *guide)
Initialize the given party number structure using the given guide for a set update operation...
#define AST_RWLIST_HEAD_STATIC(name, type)
Defines a structure to be used to hold a read/write list of specified type, statically initialized...
struct ast_channel_tech * ast_get_channel_tech(const char *name)
Get a channel technology structure by name.
int str
Subscriber phone number ie.
const ast_string_field uniqueid
struct ast_flags features_callee
static void ast_dummy_channel_destructor(void *obj)
Free a dummy channel structure.
static struct ast_channel_tech null_tech
struct ast_party_subaddress_ies subaddress
Subscriber subaddress ies.
int presentation
Q.931 presentation-indicator and screening-indicator encoded fields.
channelreloadreason
Channel reload reasons for manager events at load or reload of configuration.
void ast_cc_config_params_destroy(struct ast_cc_config_params *params)
Free memory from CCSS configuration params.
int ast_channel_masquerade(struct ast_channel *original, struct ast_channel *clone)
Weird function made for call transfers.
CallerID (and other GR30) management and generation Includes code and algorithms from the Zapata libr...
#define AST_CAUSE_INCOMING_CALL_BARRED
#define STATE2STR_BUFSIZE
void ast_cel_check_retire_linkedid(struct ast_channel *chan)
Check and potentially retire a Linked ID.
struct ast_channel * parent_channel
static struct ast_data_handler channels_provider
#define ast_alloca(size)
call __builtin_alloca to ensure we get gcc builtin semantics
struct ast_party_id id
Connected party ID.
static int calc_monitor_jump(int samples, int sample_rate, int seek_rate)
calculates the number of samples to jump forward with in a monitor stream.
int ast_cli_unregister_multiple(struct ast_cli_entry *e, int len)
Unregister multiple commands.
int ast_jb_put(struct ast_channel *chan, struct ast_frame *f)
Puts a frame into a channel jitterbuffer.
#define AST_CAUSE_NORMAL_TEMPORARY_FAILURE
#define ast_channel_unref(c)
Decrease channel reference count.
#define AST_CAUSE_NOSUCHDRIVER
const char * ast_describe_caller_presentation(int data)
Convert caller ID pres value to explanatory string.
#define ast_set2_flag(p, value, flag)
void ast_party_connected_line_set_init(struct ast_party_connected_line *init, const struct ast_party_connected_line *guide)
Initialize the given connected line structure using the given guide for a set update operation...
#define ast_test_flag(p, flag)
void ast_party_subaddress_copy(struct ast_party_subaddress *dest, const struct ast_party_subaddress *src)
Copy the source party subaddress information to the destination party subaddress. ...
#define AST_CAUSE_SWITCH_CONGESTION
int __ast_answer(struct ast_channel *chan, unsigned int delay, int cdr_answer)
Answer a channel, with a selectable delay before returning.
void ast_channel_setwhentohangup_tv(struct ast_channel *chan, struct timeval offset)
Set when to hang a channel up.
int ast_activate_generator(struct ast_channel *chan, struct ast_generator *gen, void *params)
static void update(int code_size, int y, int wi, int fi, int dq, int sr, int dqsez, struct g726_state *state_ptr)
Support for translation of data formats. translate.c.
int ast_indicate(struct ast_channel *chan, int condition)
Indicates condition of channel.
static void free_translation(struct ast_channel *clonechan)
void ast_cdr_end(struct ast_cdr *cdr)
End a call.
const char * ast_var_value(const struct ast_var_t *var)
struct ast_party_name name
Subscriber name.
#define AST_FORMAT_G723_1
void ast_jb_empty_and_reset(struct ast_channel *c0, struct ast_channel *c1)
drops all frames from a jitterbuffer and resets it
void ast_channel_unregister(const struct ast_channel_tech *tech)
Unregister a channel technology.
struct ast_party_id from
Who is redirecting the call (Sent to the party the call is redirected toward)
#define AST_CAUSE_UNALLOCATED
int ast_channel_queryoption(struct ast_channel *channel, int option, void *data, int *datalen, int block)
Checks the value of an option.
struct ast_var_t * ast_var_assign(const char *name, const char *value)
int presentation
presentation-indicator ie
void ast_channel_update_redirecting(struct ast_channel *chan, const struct ast_party_redirecting *redirecting, const struct ast_set_party_redirecting *update)
Indicate that the redirecting id has changed.
#define AST_DEFAULT_EMULATE_DTMF_DURATION
#define AST_RWLIST_WRLOCK(head)
Write locks a list.
char context[AST_MAX_CONTEXT]
int(*const send_digit_begin)(struct ast_channel *chan, char digit)
Start sending a literal DTMF digit.
#define AST_CAUSE_INVALID_MSG_UNSPECIFIED
struct ast_variable * ast_channeltype_list(void)
return an ast_variable list of channeltypes
struct ast_channel * ast_channel_release(struct ast_channel *chan)
Unlink and release reference to a channel.
#define AST_CAUSE_NETWORK_OUT_OF_ORDER
const char * ast_var_name(const struct ast_var_t *var)
int ast_channel_supports_html(struct ast_channel *channel)
Checks for HTML support on a channel.
int ast_audiohook_write_list_empty(struct ast_audiohook_list *audiohook_list)
determines if a audiohook_list is empty or not.
#define ao2_iterator_next(arg1)
#define ast_set_flag(p, flag)
int ast_check_hangup_locked(struct ast_channel *chan)
struct ast_party_number_ies number
Subscriber phone number ies.
int ast_framehook_list_is_empty(struct ast_framehook_list *framehooks)
Determine if an framehook list is empty or not.
struct ast_channel * __ast_request_and_dial(const char *type, format_t format, const struct ast_channel *requestor, void *data, int timeout, int *reason, const char *cid_num, const char *cid_name, struct outgoing_helper *oh)
Request a channel of a given type, with data as optional information used by the low level module and...
static int(* ast_moh_start_ptr)(struct ast_channel *, const char *, const char *)
descriptor for a cli entry.
int ast_cel_report_event(struct ast_channel *chan, enum ast_cel_event_type event_type, const char *userdefevname, const char *extra, struct ast_channel *peer2)
Report a channel event.
struct ast_variable * ast_variable_browse(const struct ast_config *config, const char *category)
Goes through variables.
static struct aji_capabilities * capabilities
#define ast_data_search_cmp_structure(search, structure_name, structure, structure_name_cmp)
int ast_party_id_presentation(const struct ast_party_id *id)
Determine the overall presentation value for the given party.
#define ao2_callback(c, flags, cb_fn, arg)
void ast_channel_update_connected_line(struct ast_channel *chan, const struct ast_party_connected_line *connected, const struct ast_set_party_connected_line *update)
Indicate that the connected line information has changed.
static struct ast_frame * __ast_read(struct ast_channel *chan, int dropaudio)
static struct ast_datastore_info plc_ds_info
void ast_party_caller_set(struct ast_party_caller *dest, const struct ast_party_caller *src, const struct ast_set_party_caller *update)
Set the caller information based on another caller source.
int plan
Type-Of-Number and Numbering-Plan ie.
static int set_format(struct ast_channel *chan, format_t fmt, format_t *rawformat, format_t *format, struct ast_trans_pvt **trans, const int direction)
static void * tonepair_alloc(struct ast_channel *chan, void *params)
#define AST_RWLIST_UNLOCK(head)
Attempts to unlock a read/write based list.
int ast_cdr_setaccount(struct ast_channel *chan, const char *account)
Set account code, will generate AMI event.
void ast_begin_shutdown(int hangup)
int ast_say_digits_full(struct ast_channel *chan, int num, const char *ints, const char *lang, int audiofd, int ctrlfd)
int ast_jb_get_when_to_wakeup(struct ast_channel *c0, struct ast_channel *c1, int time_left)
Calculates the time, left to the closest delivery moment in a bridge.
static int ast_add_fd(struct pollfd *pfd, int fd)
if fd is a valid descriptor, set *pfd with the descriptor
This entries are for multiple registers.
#define AST_CAUSE_FACILITY_REJECTED
#define AST_CAUSE_ACCESS_INFO_DISCARDED
static void destroy_hooks(struct ast_channel *chan)
int ast_settimeout_full(struct ast_channel *c, unsigned int rate, int(*func)(const void *data), void *data, unsigned int is_ao2_obj)
#define AST_CAUSE_RECOVERY_ON_TIMER_EXPIRE
struct ast_datastore_info * info
void ast_party_id_copy(struct ast_party_id *dest, const struct ast_party_id *src)
Copy the source party id information to the destination party id.
Structure for variables, used for configurations and for channel variables.
int ast_channel_datastore_free(struct ast_datastore *datastore)
Free a channel data store object.
struct ast_generator * generator
unsigned int emulate_dtmf_duration
void ast_set_variables(struct ast_channel *chan, struct ast_variable *vars)
adds a list of channel variables to a channel
int ast_app_group_discard(struct ast_channel *chan)
Discard all group counting for a channel.
static struct ast_channel * ast_channel_get_full(const char *name, size_t name_len, const char *exten, const char *context)
#define AST_CAUSE_MISDIALLED_TRUNK_PREFIX
int(* cc_callback)(struct ast_channel *inbound, const char *dest, ast_cc_callback_fn callback)
Call a function with cc parameters as a function parameter.
globally accessible channel datastores
int ast_tvzero(const struct timeval t)
Returns true if the argument is 0,0.
void ast_channel_set_caller(struct ast_channel *chan, const struct ast_party_caller *caller, const struct ast_set_party_caller *update)
Set the caller id information in the Asterisk channel.
#define AST_LIST_NEXT(elm, field)
Returns the next entry in the list after the given entry.
struct ast_frame * ast_read(struct ast_channel *chan)
Reads a frame.
struct ast_frame *(*const read)(struct ast_channel *chan)
Read a frame, in standard format (see frame.h)
struct ast_party_redirecting redirecting
Redirecting/Diversion information.
int ast_say_digit_str(struct ast_channel *chan, const char *num, const char *ints, const char *lang)
says digits of a string
static void silence_generator_release(struct ast_channel *chan, void *data)
int char_set
Character set the name is using.
void ast_timer_close(struct ast_timer *handle)
Close an opened timing handle.
#define DATA_EXPORT_CHANNEL(MEMBER)
#define AST_OPTION_DEVICE_NAME
void *(* duplicate)(void *data)
static int kill_fixup(struct ast_channel *oldchan, struct ast_channel *newchan)
Structure for a data store type.
ast_channel_state
ast_channel states
struct ast_timer * ast_timer_open(void)
Open a timer.
static void clone_variables(struct ast_channel *original, struct ast_channel *clonechan)
Clone channel variables from 'clone' channel into 'original' channel.
char * str
Subscriber name (Malloced)
int ast_say_digits(struct ast_channel *chan, int num, const char *ints, const char *lang)
says digits
int ast_indicate_data(struct ast_channel *chan, int condition, const void *data, size_t datalen)
Indicates condition of channel, with payload.
unsigned long global_fout
struct timeval nexteventts
static void * channel_cc_params_copy(void *data)
struct ast_data * ast_data_add_uint(struct ast_data *root, const char *childname, unsigned int value)
Add an unsigned integer node type.
void ast_party_caller_free(struct ast_party_caller *doomed)
Destroy the caller party contents.
int ast_str_append(struct ast_str **buf, ssize_t max_len, const char *fmt,...)
Append to a thread local dynamic string.
unsigned char valid
TRUE if the subaddress information is valid/present.
int(*const send_digit_end)(struct ast_channel *chan, char digit, unsigned int duration)
Stop sending a literal DTMF digit.
static int party_number_build_data(unsigned char *data, size_t datalen, const struct ast_party_number *number, const char *label, const struct ast_party_number_ies *ies)
format_t ast_best_codec(format_t fmts)
Pick the best audio codec.
int(* stop)(struct ast_channel *chan, int need_lock)
int plc_fillin(plc_state_t *s, int16_t amp[], int len)
Fill-in a block of missing audio samples.
struct timeval ast_tvnow(void)
Returns current timeval. Meant to replace calls to gettimeofday().
static force_inline int ast_format_rate(format_t format)
Get the sample rate for a given format.
static int should_skip_dtmf(struct ast_channel *chan)
Determine whether or not we should ignore DTMF in the readq.
int ani2
Automatic Number Identification 2 (Info Digits)
struct ast_data * ast_data_add_bool(struct ast_data *root, const char *childname, unsigned int boolean)
Add a boolean node type.
int presentation
presentation-indicator ie
#define AST_LIST_EMPTY(head)
Checks whether the specified list contains any entries.
struct ast_frame * ast_translate(struct ast_trans_pvt *tr, struct ast_frame *f, int consume)
translates one or more frames Apply an input frame into the translator and receive zero or one output...
#define ast_opt_transmit_silence
unsigned short transfercapability
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 ...
struct ao2_iterator ao2_iterator_init(struct ao2_container *c, int flags)
Create an iterator for a container.
#define ast_copy_flags(dest, src, flagz)
int64_t ast_tvdiff_ms(struct timeval end, struct timeval start)
Computes the difference (in milliseconds) between two struct timeval instances.
void ast_party_id_free(struct ast_party_id *doomed)
Destroy the party id contents.
Structure for a data store object.
void ast_party_connected_line_free(struct ast_party_connected_line *doomed)
Destroy the connected line information contents.
struct ast_frame * ast_frisolate(struct ast_frame *fr)
Makes a frame independent of any static storage.
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.
int(*const queryoption)(struct ast_channel *chan, int option, void *data, int *datalen)
Query a given option. Called with chan locked.
static void update_bridge_vars(struct ast_channel *c0, struct ast_channel *c1)
int ast_channel_connected_line_macro(struct ast_channel *autoservice_chan, struct ast_channel *macro_chan, const void *connected_info, int caller, int frame)
Run a connected line interception macro and update a channel's connected line information.
Generic File Format Support. Should be included by clients of the file handling routines. File service providers should instead include mod_format.h.
static void send_dtmf_event(struct ast_channel *chan, const char *direction, const char digit, const char *begin, const char *end)
int ast_prod(struct ast_channel *chan)
Send empty audio to prime a channel driver.
const char * ast_state2str(enum ast_channel_state)
Gives the string form of a given channel state.
struct ast_datastore *attribute_malloc ast_channel_datastore_alloc(const struct ast_datastore_info *info, const char *uid)
Create a channel data store object.
#define AST_OPTION_MAKE_COMPATIBLE
int ast_senddigit_begin(struct ast_channel *chan, char digit)
Send a DTMF digit to a channel.
void ast_playtones_stop(struct ast_channel *chan)
Stop playing tones on a channel.
char * str
Malloced subaddress string.
struct ao2_iterator simple_iterator
#define AST_CAUSE_NO_USER_RESPONSE
char * ast_cdr_flags2str(int flags)
Definitions to aid in the use of thread local storage.
int ast_senddigit(struct ast_channel *chan, char digit, unsigned int duration)
Send a DTMF digit to a channel.
#define AST_CAUSE_NORMAL_CIRCUIT_CONGESTION
void ast_cli(int fd, const char *fmt,...)
#define ast_cc_config_params_init()
Allocate and initialize an ast_cc_config_params structure.
#define AST_LIST_REMOVE(head, elm, field)
Removes a specific entry from a list.
static struct ast_frame * kill_exception(struct ast_channel *chan)
const ast_string_field linkedid
#define AST_DATA_ENTRY(__path, __handler)
int ast_channel_setoption(struct ast_channel *channel, int option, void *data, int datalen, int block)
Sets an option on a channel.
int(*const fixup)(struct ast_channel *oldchan, struct ast_channel *newchan)
Fix up a channel: If a channel is consumed, this is called. Basically update any ->owner links...
#define AST_CAUSE_INVALID_NUMBER_FORMAT
int ast_framehook_list_destroy(struct ast_channel *chan)
This is used by the channel API to detach and destroy all framehooks on a channel during channel dest...
enum ast_channel_adsicpe adsicpe
void ast_moh_stop(struct ast_channel *chan)
Turn off music on hold on a given channel.
#define AST_LIST_TRAVERSE_SAFE_END
Closes a safe loop traversal block.
#define AST_PRES_ALLOWED_USER_NUMBER_NOT_SCREENED
static void xfer_ds_destroy(void *data)
static char cid_num[AST_MAX_EXTENSION]
struct ast_channel * ast_waitfor_nandfds(struct ast_channel **chan, int n, int *fds, int nfds, int *exception, int *outfd, int *ms)
Waits for activity on a group of channels.
static struct ast_data_handler channeltypes_provider
static void(* ast_moh_cleanup_ptr)(struct ast_channel *)
void ast_var_delete(struct ast_var_t *var)
unsigned char odd_even_indicator
TRUE if odd number of address signals.
#define ast_verb(level,...)
struct ast_party_name_ies name
Subscriber name ies.
void ast_config_destroy(struct ast_config *config)
Destroys a config.
static const char * oldest_linkedid(const char *a, const char *b)
Indicate what information in ast_party_caller should be set.
void ast_uninstall_music_functions(void)
int ast_atomic_fetchadd_int(volatile int *p, int v)
Atomically add v to *p and return * the previous value of *p. This can be used to handle reference co...
int ast_datastore_free(struct ast_datastore *datastore)
Free a data store object.
struct ast_channel * ast_channel_alloc(int needqueue, int state, const char *cid_num, const char *cid_name, const char *acctcode, const char *exten, const char *context, const char *linkedid, const int amaflag, const char *name_fmt,...)
struct ast_variable * vars
the list of registered channel types
const char * pbx_builtin_getvar_helper(struct ast_channel *chan, const char *name)
Return a pointer to the value of the corresponding channel variable.
struct ast_cc_config_params * ast_channel_get_cc_config_params(struct ast_channel *chan)
Get the CCSS parameters from a channel.
int(*const answer)(struct ast_channel *chan)
Answer the channel.
String fields in structures.
char * ast_print_group(char *buf, int buflen, ast_group_t group)
print call- and pickup groups into buffer
void ast_party_caller_copy(struct ast_party_caller *dest, const struct ast_party_caller *src)
Copy the source caller information to the destination caller.
int ast_queue_hangup_with_cause(struct ast_channel *chan, int cause)
Queue a hangup frame with hangupcause set.
#define AST_PRES_RESTRICTED
struct ast_channel * ast_channel_get_by_name_prefix(const char *name, size_t name_len)
Find a channel by a name prefix.
void ast_party_dialed_set(struct ast_party_dialed *dest, const struct ast_party_dialed *src)
Set the dialed information based on another dialed source.
static int set_security_requirements(const struct ast_channel *requestor, struct ast_channel *out)
static struct ast_threadstorage state2str_threadbuf
int ast_cdr_data_add_structure(struct ast_data *tree, struct ast_cdr *cdr, int recur)
#define ast_manager_event(chan, category, event, contents,...)
struct ast_set_party_id from
struct ast_channel_tech * tech
int ast_channel_defer_dtmf(struct ast_channel *chan)
Defers DTMF so that you only read things like hangups and audio.
const char * ast_config_AST_SYSTEM_NAME
#define CONFIG_STATUS_FILEMISSING
static enum ast_bridge_result ast_generic_bridge(struct ast_channel *c0, struct ast_channel *c1, struct ast_bridge_config *config, struct ast_frame **fo, struct ast_channel **rc)
static int ast_channel_hash_cb(const void *obj, const int flags)
static void plc_ds_destroy(void *data)
void ast_party_id_set(struct ast_party_id *dest, const struct ast_party_id *src, const struct ast_set_party_id *update)
Set the source party id information into the destination party id.
struct ast_trans_pvt * ast_translator_build_path(format_t dest, format_t source)
Builds a translator path Build a path (possibly NULL) from source to dest.
#define AST_OPTION_FORMAT_READ
static int deactivate_silence_generator(struct ast_channel *chan)
static void manager_bridge_event(int onoff, int type, struct ast_channel *c0, struct ast_channel *c1)
Send manager event for bridge link and unlink events.
struct ast_party_id id
Caller party ID.
int ast_cdr_setcid(struct ast_cdr *cdr, struct ast_channel *chan)
Initialize based on a channel.
int ast_channel_bridge(struct ast_channel *c0, struct ast_channel *c1, struct ast_bridge_config *config, struct ast_frame **fo, struct ast_channel **rc)
Bridge two channels together.
#define AST_OPTION_SECURE_MEDIA
int ast_set_write_format(struct ast_channel *chan, format_t format)
Sets write format on channel chan Set write format for channel to whichever component of "format" is ...
#define AST_CAUSE_RESPONSE_TO_STATUS_ENQUIRY
void ast_change_name(struct ast_channel *chan, const char *newname)
Change channel name.
int ast_channel_datastore_inherit(struct ast_channel *from, struct ast_channel *to)
Inherit datastores from a parent to a child.
#define AST_RWLIST_RDLOCK(head)
Read locks a list.
void ast_moh_cleanup(struct ast_channel *chan)
#define AST_RWLIST_INSERT_HEAD
a masquerade happened to alter the participants on a bridge
static int kill_hangup(struct ast_channel *chan)
int ast_set_read_format(struct ast_channel *chan, format_t format)
Sets read format on channel chan Set read format for channel to whichever component of "format" is be...
#define ast_debug(level,...)
Log a DEBUG message.
int(*const setoption)(struct ast_channel *chan, int option, void *data, int datalen)
Set a given option. Called with chan locked.
int ast_channel_data_add_structure(struct ast_data *tree, struct ast_channel *chan, int add_bridged)
Insert into an astdata tree, the channel structure.
#define AST_CAUSE_NO_ROUTE_TRANSIT_NET
#define AST_DATA_HANDLER_VERSION
The Data API structures version.
void * __ao2_alloc_debug(const size_t data_size, ao2_destructor_fn destructor_fn, char *tag, const char *file, int line, const char *funcname, int ref_debug)
static int ast_channel_softhangup_cb(void *obj, void *arg, int flags)
#define ao2_callback_data(arg1, arg2, arg3, arg4, arg5)
int ast_waitfor_n_fd(int *fds, int n, int *ms, int *exception)
Waits for input on an fd.
void ast_channel_queue_connected_line_update(struct ast_channel *chan, const struct ast_party_connected_line *connected, const struct ast_set_party_connected_line *update)
Queue a connected line update frame on a channel.
struct ast_party_id ani
Automatic Number Identification (ANI)
struct ast_channel * ast_call_forward(struct ast_channel *caller, struct ast_channel *orig, int *timeout, format_t format, struct outgoing_helper *oh, int *outstate)
Forwards a call to a new channel specified by the original channel's call_forward str...
General Asterisk PBX channel definitions.
#define AST_PRES_USER_NUMBER_UNSCREENED
#define ast_data_register_multiple_core(data_entries, entries)
int(* set_base_channel)(struct ast_channel *chan, struct ast_channel *base)
Set base channel (agent and local)
struct ast_party_dialed::@155 number
Dialed/Called number.
#define AST_FRIENDLY_OFFSET
Offset into a frame's data buffer.
int ast_raw_answer(struct ast_channel *chan, int cdr_answer)
Answer 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.
Asterisk file paths, configured in asterisk.conf.
int(*const hangup)(struct ast_channel *chan)
Hangup (and possibly destroy) the channel.
void ast_channel_clear_softhangup(struct ast_channel *chan, int flag)
Clear a set of softhangup flags from a channel.
static char * handle_cli_core_show_channeltype(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
Show details about a channel driver - CLI command.
struct ast_channel * chan
void ast_channel_undefer_dtmf(struct ast_channel *chan)
Unset defer DTMF flag on channel.
struct timeval start_time
int ast_write_video(struct ast_channel *chan, struct ast_frame *frame)
Write video frame to a channel This function writes the given frame to the indicated channel...
SAY_EXTERN int(* ast_say_enumeration_full)(struct ast_channel *chan, int num, const char *ints, const char *lang, const char *options, int audiofd, int ctrlfd) SAY_INIT(ast_say_enumeration_full)
static struct ast_generator gen
#define ast_string_field_init(x, size)
Initialize a field pool and fields.
void ast_party_subaddress_free(struct ast_party_subaddress *doomed)
Destroy the party subaddress contents.
#define AST_TRANS_CAP_DIGITAL_W_TONES
#define ast_config_load(filename, flags)
Load a config file.
int ast_senddigit_end(struct ast_channel *chan, char digit, unsigned int duration)
Send a DTMF digit to a channel.
static force_inline int attribute_pure ast_strlen_zero(const char *s)
static void handle_cause(int cause, int *outstate)
int ast_timer_disable_continuous(const struct ast_timer *handle)
Disable continuous mode.
int ast_channel_data_cmp_structure(const struct ast_data_search *tree, struct ast_channel *chan, const char *structure_name)
Compare to channel structures using the data api.
struct ast_audiohook_list * audiohooks
#define ast_poll(a, b, c)
#define AST_CAUSE_ANSWERED_ELSEWHERE
#define AST_TRANS_CAP_3_1K_AUDIO
Asterisk internal frame definitions.
struct ast_data * ast_data_add_node(struct ast_data *root, const char *childname)
Add a container child.
#define AST_FORMAT_TEXT_MASK
#define AST_MAX_EXTENSION
#define AST_RWLIST_TRAVERSE
int ast_settimeout(struct ast_channel *c, unsigned int rate, int(*func)(const void *data), void *data)
Enable or disable timer ticks for a channel.
#define AST_CAUSE_NORMAL_CLEARING
Scheduler Routines (derived from cheops)
#define AST_CAUSE_CHAN_NOT_IMPLEMENTED
void ast_cdr_answer(struct ast_cdr *cdr)
Answer a call.
#define ast_data_unregister(path)
char ast_default_accountcode[AST_MAX_ACCOUNT_CODE]
void ast_party_number_init(struct ast_party_number *init)
Initialize the given number structure.
Caller Party information.
#define AST_LIST_REMOVE_CURRENT(field)
Removes the current entry from a list during a traversal.
int(*const write_text)(struct ast_channel *chan, struct ast_frame *frame)
Write a text frame, in standard format.
#define AST_FORMAT_G726_AAL2
#define ao2_ref(o, delta)
int ast_shutting_down(void)
Returns non-zero if Asterisk is being shut down.
#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_softhangup(struct ast_channel *chan, int reason)
Softly hangup up a channel.
void ast_jb_destroy(struct ast_channel *chan)
Destroys jitterbuffer on a channel.
int ast_register_atexit(void(*func)(void))
Register a function to be executed before Asterisk exits.
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 ...
const ast_string_field parkinglot
static struct ast_tone_zone_sound * ast_tone_zone_sound_unref(struct ast_tone_zone_sound *ts)
Release a reference to an ast_tone_zone_sound.
static int silence_generator_generate(struct ast_channel *chan, void *data, int len, int samples)
static struct causes_map causes[]
int ast_internal_timing_enabled(struct ast_channel *chan)
Check if the channel can run in internal timing mode.
#define AST_BRIDGE_DTMF_CHANNEL_1
Report DTMF on channel 1.
int ast_channel_get_cc_agent_type(struct ast_channel *chan, char *agent_type, size_t size)
Find the appropriate CC agent type to use given a channel.
static int ast_channel_cmp_cb(void *obj, void *arg, int flags)
int ast_plc_reload(void)
Reload genericplc configuration value from codecs.conf.
struct sched_context * sched
struct ast_set_party_id id
map AST_CAUSE's to readable string representations
struct ast_frame *(*const exception)(struct ast_channel *chan)
Handle an exception, reading a frame.
const char *(* get_pvt_uniqueid)(struct ast_channel *chan)
Get the unique identifier for the PVT, i.e. SIP call-ID for SIP.
A set of macros to manage forward-linked lists.
void ast_channel_set_redirecting(struct ast_channel *chan, const struct ast_party_redirecting *redirecting, const struct ast_set_party_redirecting *update)
Set the redirecting id information in the Asterisk channel.
static char language[MAX_LANGUAGE]
int ast_data_add_codecs(struct ast_data *root, const char *node_name, format_t capability)
Add the list of codecs in the root node based on the capability parameter.
int(* timingfunc)(const void *data)
hangup terminates connection
void ast_channel_set_linkgroup(struct ast_channel *chan, struct ast_channel *peer)
propagate the linked id between chan and peer
struct ast_channel * _bridge
static struct ast_generator silence_generator
ast_group_t ast_get_group(const char *s)
#define AST_LIST_REMOVE_HEAD(head, field)
Removes and returns the head entry from a list.
#define AST_CAUSE_NO_ANSWER
#define ast_opt_generic_plc
int ast_cel_linkedid_ref(const char *linkedid)
Inform CEL that a new linkedid is being used.
struct ast_party_id ani
Automatic Number Identification (ANI)
int odd_even_indicator
odd/even indicator ie
static void apply_plc(struct ast_channel *chan, struct ast_frame *frame)
#define AST_FORMAT_SLINEAR16
#define AST_CAUSE_NUMBER_PORTED_NOT_HERE
AST_REDIRECTING_REASON
redirecting reason codes.
#define AST_CAUSE_FACILITY_NOT_IMPLEMENTED
#define AST_CAUSE_NOTDEFINED
Structure to describe a channel "technology", ie a channel driver See for examples: ...
Core PBX routines and definitions.
int ast_channel_cc_params_init(struct ast_channel *chan, const struct ast_cc_config_params *base_params)
Set up datastore with CCSS parameters for a channel.
int ast_queue_frame(struct ast_channel *chan, struct ast_frame *f)
Queue one or more frames to a channel's frame queue.
int ast_cdr_update(struct ast_channel *chan)
Update CDR on a channel.
int ast_autoservice_stop(struct ast_channel *chan)
Stop servicing a channel for us...
void ast_party_number_free(struct ast_party_number *doomed)
Destroy the party number contents.
int ast_check_hangup(struct ast_channel *chan)
Check to see if a channel is needing hang up.
struct ast_party_connected_line connected
SAY_EXTERN int(* ast_say_phonetic_str_full)(struct ast_channel *chan, const char *num, const char *ints, const char *lang, int audiofd, int ctrlfd) SAY_INIT(ast_say_phonetic_str_full)
#define AST_RWLIST_TRAVERSE_SAFE_BEGIN
struct ast_flags features_caller
void ast_party_subaddress_set_init(struct ast_party_subaddress *init, const struct ast_party_subaddress *guide)
Initialize the given party subaddress structure using the given guide for a set update operation...
struct ast_datastore_info secure_call_info
#define AST_CAUSE_DESTINATION_OUT_OF_ORDER
#define ast_data_add_structure(structure_name, root, structure)
struct ast_channel * ast_channel_callback(ao2_callback_data_fn *cb_fn, void *arg, void *data, int ao2_flags)
Call a function with every active channel.
The list of nodes with their search requirement.
static void report_new_callerid(struct ast_channel *chan)
#define ast_test_suite_event_notify(s, f,...)
enum ast_bridge_result(*const bridge)(struct ast_channel *c0, struct ast_channel *c1, int flags, struct ast_frame **fo, struct ast_channel **rc, int timeoutms)
Bridge two channels of the same type together.
struct ast_party_dialed dialed
Dialed/Called information.
struct ast_silence_generator * ast_channel_start_silence_generator(struct ast_channel *chan)
Starts a silence generator on the given channel.
struct ast_trans_pvt * writetrans
The AMI - Asterisk Manager Interface - is a TCP protocol created to manage Asterisk with third-party ...
#define AST_LIST_HEAD_NOLOCK(name, type)
Defines a structure to be used to hold a list of specified type (with no lock).
int tag
User party id tag ie.
#define ast_strdupa(s)
duplicate a string in memory from the stack
static void bridge_playfile(struct ast_channel *chan, struct ast_channel *peer, const char *sound, int remain)
struct ast_party_subaddress subaddress
Subscriber subaddress.
"smart" channels that update automatically if a channel is masqueraded
Dialed/Called Party information.
static void ast_set_owners_and_peers(struct ast_channel *chan1, struct ast_channel *chan2)
int ast_tone_zone_data_add_structure(struct ast_data *tree, struct ast_tone_zone *zone)
Add a tone_zone structure to the data tree specified.
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.
static void masquerade_colp_transfer(struct ast_channel *transferee, struct xfer_masquerade_ds *colp)
Responsible for call detail data.
#define AST_CAUSE_FACILITY_NOT_SUBSCRIBED
int ast_timer_ack(const struct ast_timer *handle, unsigned int quantity)
Acknowledge a timer event.
Indicate what information in ast_party_id should be set.
ast_control_frame_type
Internal control frame subtype field values.
char * ast_getformatname(format_t format)
Get the name of a format.
struct ast_channel_tech ast_kill_tech
Kill the channel channel driver technology descriptor.
void ast_cdr_start(struct ast_cdr *cdr)
Start a call.
#define AST_CAUSE_REDIRECTED_TO_NEW_DESTINATION
void ast_party_dialed_init(struct ast_party_dialed *init)
Initialize the given dialed structure.
static int shutting_down
Prevent new channel allocation if shutting down.
int ast_tvcmp(struct timeval _a, struct timeval _b)
Compres two struct timeval instances returning -1, 0, 1 if the first arg is smaller, equal or greater to the second.
#define AST_LIST_INSERT_TAIL(head, elm, field)
Appends a list entry to the tail of a list.
int ast_channel_transfer_masquerade(struct ast_channel *target_chan, const struct ast_party_connected_line *target_id, int target_held, struct ast_channel *transferee_chan, const struct ast_party_connected_line *transferee_id, int transferee_held)
Setup a masquerade to transfer a call.
#define AST_FORMAT_SIREN7
struct ast_frame * ast_audiohook_write_list(struct ast_channel *chan, struct ast_audiohook_list *audiohook_list, enum ast_audiohook_direction direction, struct ast_frame *frame)
Pass a frame off to be handled by the audiohook core.
#define ast_opt_transcode_via_slin
int attribute_pure ast_true(const char *val)
Make sure something is true. Determine if a string containing a boolean value is "true". This function checks to see whether a string passed to it is an indication of an "true" value. It checks to see if the string is "yes", "true", "y", "t", "on" or "1".
void sched_context_destroy(struct sched_context *c)
destroys a schedule context Destroys (free's) the given sched_context structure
void ast_party_caller_set_init(struct ast_party_caller *init, const struct ast_party_caller *guide)
Initialize the given caller structure using the given guide for a set update operation.
The descriptor of a dynamic string XXX storage will be optimized later if needed We use the ts field ...
int ast_cc_offer(struct ast_channel *caller_chan)
Offer CC to a caller.
static struct ast_generator generator
Default structure for translators, with the basic fields and buffers, all allocated as part of the sa...
#define AST_CAUSE_CALL_AWARDED_DELIVERED
static struct ao2_container * channels
All active channels on the system.
void ast_data_remove_node(struct ast_data *root, struct ast_data *child)
Remove a node that was added using ast_data_add_.
#define AST_CAUSE_NORMAL_UNSPECIFIED
int plan
Q.931 Type-Of-Number and Numbering-Plan encoded fields.
void ast_party_name_set(struct ast_party_name *dest, const struct ast_party_name *src)
Set the source party name information into the destination party name.
static struct ast_codec_pref prefs
unsigned int ast_translate_path_steps(format_t dest, format_t src)
Returns the number of steps required to convert from 'src' to 'dest'.
struct timeval sending_dtmf_tv
int ast_remaining_ms(struct timeval start, int max_ms)
Calculate remaining milliseconds given a starting timestamp and upper bound.
#define AST_CAUSE_CHANNEL_UNACCEPTABLE
#define AST_PRES_NUMBER_TYPE
char * ast_recvtext(struct ast_channel *chan, int timeout)
Receives a text string from a channel Read a string of text from a channel.
static void party_connected_line_copy_transfer(struct ast_party_connected_line *dest, const struct ast_party_connected_line *src)
const ast_string_field call_forward
void ast_party_name_init(struct ast_party_name *init)
Initialize the given name structure.
void ast_party_connected_line_set(struct ast_party_connected_line *dest, const struct ast_party_connected_line *src, const struct ast_set_party_connected_line *update)
Set the connected line information based on another connected line source.
struct ast_framehook_list * framehooks
static int len(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t buflen)
int ani2
Automatic Number Identification 2 (Info Digits)
SAY_EXTERN int(* ast_say_character_str_full)(struct ast_channel *chan, const char *num, const char *ints, const char *lang, int audiofd, int ctrlfd) SAY_INIT(ast_say_character_str_full)
void ast_cdr_detach(struct ast_cdr *cdr)
Detaches the detail record for posting (and freeing) either now or at a later time in bulk with other...
enum ast_channel_state _state
#define AST_FORMAT_TESTLAW
struct ast_tone_zone_sound * ast_get_indication_tone(const struct ast_tone_zone *zone, const char *indication)
Locate a tone zone sound.
struct ast_channel * ast_bridged_channel(struct ast_channel *chan)
Find bridged channel.
#define AST_TRANS_CAP_VIDEO
struct ast_channel_iterator * ast_channel_iterator_by_exten_new(const char *exten, const char *context)
Create a new channel iterator based on extension.
struct timeval ast_tvadd(struct timeval a, struct timeval b)
Returns the sum of two timevals a + b.
void(* release)(struct ast_channel *chan, void *data)
Connected Line/Party information.
const ast_string_field name
void ast_party_id_set_init(struct ast_party_id *init, const struct ast_party_id *guide)
Initialize the given party id structure using the given guide for a set update operation.
static int party_name_build_data(unsigned char *data, size_t datalen, const struct ast_party_name *name, const char *label, const struct ast_party_name_ies *ies)
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_party_name_set_init(struct ast_party_name *init, const struct ast_party_name *guide)
Initialize the given party name structure using the given guide for a set update operation.
struct sla_ringing_trunk * first
const ast_string_field hangupsource
struct ast_party_connected_line transferee_id
void ast_party_name_free(struct ast_party_name *doomed)
Destroy the party name contents.
void ast_log(int level, const char *file, int line, const char *function, const char *fmt,...)
Used for sending a log message This is the standard logger function. Probably the only way you will i...
#define AST_OPTION_SECURE_SIGNALING
#define AST_CAUSE_WRONG_MESSAGE
enum ast_frame_read_action action
#define ao2_alloc(data_size, destructor_fn)
struct ast_datastore * ast_datastore_alloc(const struct ast_datastore_info *info, const char *uid)
#define AST_PRES_NUMBER_NOT_AVAILABLE
#define AST_LIST_LAST(head)
Returns the last entry contained in a list.
Redirecting Line information. RDNIS (Redirecting Directory Number Information Service) Where a call d...
static void __ast_change_name_nolink(struct ast_channel *chan, const char *newname)
this function simply changes the name of the channel and issues a manager_event with out unlinking an...
struct ast_frame * ast_framehook_list_write_event(struct ast_framehook_list *framehooks, struct ast_frame *frame)
This is used by the channel API push a frame write event to a channel's framehook list...
struct ast_channel *(* get_base_channel)(struct ast_channel *chan)
Retrieve base channel (agent and local)
int ast_seekstream(struct ast_filestream *fs, off_t sample_offset, int whence)
Seeks into stream.
struct ast_filestream * read_stream
int ast_softhangup_nolock(struct ast_channel *chan, int reason)
Softly hangup up a channel (no channel lock)
int ast_channel_sendhtml(struct ast_channel *channel, int subclass, const char *data, int datalen)
Sends HTML on given channel Send HTML or URL on link.
#define AST_MIN_DTMF_DURATION
const char * ast_var_full_name(const struct ast_var_t *var)
struct ast_bridge * bridge
#define AST_LIST_TRAVERSE(head, var, field)
Loops over (traverses) the entries in a list.
#define AST_LIST_ENTRY(type)
Declare a forward link structure inside a list entry.
#define AST_LIST_INSERT_HEAD(head, elm, field)
Inserts a list entry at the head of a list.
int ast_app_run_macro(struct ast_channel *autoservice_chan, struct ast_channel *macro_chan, const char *macro_name, const char *macro_args)
Run a macro on a channel, placing an optional second channel into autoservice.
int ast_channel_sendurl(struct ast_channel *channel, const char *url)
Sends a URL on a given link Send URL on link.
#define AST_FORMAT_VIDEO_MASK
int(*const send_html)(struct ast_channel *chan, int subclass, const char *data, int len)
Send HTML data.
#define ao2_find(arg1, arg2, arg3)
#define ast_channel_unlock(chan)
int(*const transfer)(struct ast_channel *chan, const char *newdest)
Blind transfer other side (see app_transfer.c and ast_transfer()
void ast_channel_stop_silence_generator(struct ast_channel *chan, struct ast_silence_generator *state)
Stops a previously-started silence generator on the given channel.
void *(* alloc)(struct ast_channel *chan, void *params)
A machine to gather up arbitrary frames and convert them to raw slinear on demand.
const char * ast_cause2str(int state) attribute_pure
Gives the string form of a given cause code.
struct ast_channel::datastores datastores
struct ast_var_t::@158 entries
int(*const send_text)(struct ast_channel *chan, const char *text)
Display or transmit text.
void ast_channel_inherit_variables(const struct ast_channel *parent, struct ast_channel *child)
Inherits channel variable from parent to child channel.
int source
Information about the source of an update.
int valid
valid/present ie
#define AST_CAUSE_BEARERCAPABILITY_NOTIMPL
static char * complete_channeltypes(struct ast_cli_args *a)
char macrocontext[AST_MAX_CONTEXT]
void ast_autochan_new_channel(struct ast_channel *old_chan, struct ast_channel *new_chan)
Switch what channel autochans point to.
void ast_cancel_shutdown(void)
Cancel a shutdown in progress.
struct ast_filestream * vstream
int valid
valid/present ie
static int __ast_channel_masquerade(struct ast_channel *original, struct ast_channel *clonechan, struct ast_datastore *xfer_ds)
#define AST_FORMAT_AUDIO_MASK
struct ast_filestream * write_stream
static int tonepair_generator(struct ast_channel *chan, void *data, int len, int samples)
int ast_stream_and_wait(struct ast_channel *chan, const char *file, const char *digits)
stream file until digit If the file name is non-empty, try to play it.
int ast_say_character_str(struct ast_channel *chan, const char *num, const char *ints, const char *lang)
struct ast_channel *attribute_malloc __ast_channel_alloc(int needqueue, int state, const char *cid_num, const char *cid_name, const char *acctcode, const char *exten, const char *context, const char *linkedid, const int amaflag, const char *file, int line, const char *function, const char *name_fmt,...)
Create a channel structure.
int ast_closestream(struct ast_filestream *f)
Closes a stream.
#define AST_FORMAT_SIREN14
struct ast_channel *(*const bridged_channel)(struct ast_channel *chan, struct ast_channel *bridge)
Find bridged channel.
#define AST_CAUSE_NUMBER_CHANGED
void ast_install_music_functions(int(*start_ptr)(struct ast_channel *, const char *, const char *), void(*stop_ptr)(struct ast_channel *), void(*cleanup_ptr)(struct ast_channel *))
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.
static int party_subaddress_build_data(unsigned char *data, size_t datalen, const struct ast_party_subaddress *subaddress, const char *label, const struct ast_party_subaddress_ies *ies)
void ast_party_number_copy(struct ast_party_number *dest, const struct ast_party_number *src)
Copy the source party number information to the destination party number.
#define FRAMECOUNT_INC(x)
struct ao2_iterator * active_iterator
void ast_cdr_setapp(struct ast_cdr *cdr, const char *app, const char *data)
Set the last executed application.
int ast_call(struct ast_channel *chan, char *addr, int timeout)
Make a call.
#define DATASTORE_INHERIT_FOREVER
#define AST_CAUSE_MANDATORY_IE_LENGTH_ERROR
void ast_cc_copy_config_params(struct ast_cc_config_params *dest, const struct ast_cc_config_params *src)
copy CCSS configuration parameters from one structure to another
static int party_id_build_data(unsigned char *data, size_t datalen, const struct ast_party_id *id, const char *label, const struct ast_party_id_ies *ies, const struct ast_set_party_id *update)
int ast_timer_fd(const struct ast_timer *handle)
Get a poll()-able file descriptor for a timer.
int ast_timer_set_rate(const struct ast_timer *handle, unsigned int rate)
Set the timing tick rate.
static void channels_shutdown(void)
static void tonepair_release(struct ast_channel *chan, void *params)
#define AST_CAUSE_INTERWORKING
if(yyss+yystacksize-1<=yyssp)
struct ast_party_subaddress subaddress
Dialed/Called subaddress.
void ast_party_id_init(struct ast_party_id *init)
Initialize the given party id structure.
void ast_channel_setwhentohangup(struct ast_channel *chan, time_t offset)
Set when to hang a channel up.
static int generator_force(const void *data)
int ast_timer_enable_continuous(const struct ast_timer *handle)
Enable continuous mode.
const char *const description
void ao2_iterator_destroy(struct ao2_iterator *i)
Destroy a container iterator.
#define ast_string_field_build(x, field, fmt, args...)
Set a field to a complex (built) value.
Structure used to handle boolean flags.
static struct ast_channel_iterator * channel_iterator_search(const char *name, size_t name_len, const char *exten, const char *context)
struct ast_channel_iterator * ast_channel_iterator_by_name_new(const char *name, size_t name_len)
Create a new channel iterator based on name.
#define ast_clear_flag(p, flag)
void ast_channel_set_fd(struct ast_channel *chan, int which, int fd)
static char cid_name[AST_MAX_EXTENSION]
Indicate what information in ast_party_connected_line should be set.
#define CHECK_BLOCKING(c)
int ast_say_phonetic_str(struct ast_channel *chan, const char *num, const char *ints, const char *lang)
int(* generate)(struct ast_channel *chan, void *data, int len, int samples)
int ast_waitfordigit_full(struct ast_channel *c, int ms, int audiofd, int ctrlfd)
Wait for a digit Same as ast_waitfordigit() with audio fd for outputting read audio and ctrlfd to mon...
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(*const write)(struct ast_channel *chan, struct ast_frame *frame)
Write a frame, in standard format (see frame.h)
#define NUM_CHANNEL_BUCKETS
#define AST_CAUSE_INVALID_IE_CONTENTS
char macroexten[AST_MAX_EXTENSION]
#define AST_PRES_RESTRICTION
int ast_waitfordigit(struct ast_channel *c, int ms)
Waits for a digit.
static void channel_cc_params_destroy(void *data)
int combined_presentation
Combined name and number presentation ie.
#define ast_channel_lock_both(chan1, chan2)
Lock two channels.
void ast_str_reset(struct ast_str *buf)
Reset the content of a dynamic string. Useful before a series of ast_str_append.
char * tag
User-set "tag".
struct ast_set_party_id id
void ast_deactivate_generator(struct ast_channel *chan)
int type
Q.931 subaddress type.
#define AST_CAUSE_REQUESTED_CHAN_UNAVAIL
void ast_poll_channel_del(struct ast_channel *chan0, struct ast_channel *chan1)
int transit_network_select
Transit Network Select.
void ast_cdr_discard(struct ast_cdr *cdr)
Discard and free a CDR record.
#define AST_LIST_HEAD_INIT_NOLOCK(head)
Initializes a list head structure.
int ast_waitstream_full(struct ast_channel *c, const char *breakon, int audiofd, int monfd)
int ast_app_group_update(struct ast_channel *oldchan, struct ast_channel *newchan)
Update all group counting for a channel to a new one.
struct ast_flags ast_options
#define AST_CAUSE_PRE_EMPTED
int(*const call)(struct ast_channel *chan, char *addr, int timeout)
Call a given phone number (address, etc), but don't take longer than timeout seconds to do so...
void ast_party_redirecting_free(struct ast_party_redirecting *doomed)
Destroy the redirecting information contents.
int(*const devicestate)(void *data)
void ast_party_connected_line_copy(struct ast_party_connected_line *dest, const struct ast_party_connected_line *src)
Copy the source connected line information to the destination connected line.
struct ast_set_party_id to
#define AST_CAUSE_NO_ROUTE_DESTINATION
#define AST_FORMAT_SLINEAR
#define ast_channel_ref(c)
Increase channel reference count.
struct sched_context * sched_context_create(void)
New schedule context.
int ast_waitfor(struct ast_channel *chan, int ms)
Wait for input on a channel.
int ast_channel_make_compatible(struct ast_channel *c0, struct ast_channel *c1)
Makes two channel formats compatible.
Indicate what information in ast_party_redirecting should be set.
When we need to walk through a container, we use an ao2_iterator to keep track of the current positio...
SAY_EXTERN int(* ast_say_digit_str_full)(struct ast_channel *chan, const char *num, const char *ints, const char *lang, int audiofd, int ctrlfd) SAY_INIT(ast_say_digit_str_full)
struct ast_channel * ast_request_and_dial(const char *type, format_t format, const struct ast_channel *requestor, void *data, int timeout, int *reason, const char *cid_num, const char *cid_name)
Request a channel of a given type, with data as optional information used by the low level module and...
void ast_tonepair_stop(struct ast_channel *chan)
int ast_say_number(struct ast_channel *chan, int num, const char *ints, const char *lang, const char *options)
says a number
int count
Number of times the call was redirected.
Standard Command Line Interface.
struct ast_party_id to
Call is redirecting to a new party (Sent to the caller)
void ast_copy_string(char *dst, const char *src, size_t size)
Size-limited null-terminating string copy.
void ast_connected_line_copy_from_caller(struct ast_party_connected_line *dest, const struct ast_party_caller *src)
Copy the caller information to the connected line information.
#define ao2_container_alloc(arg1, arg2, arg3)
static int ast_channel_make_compatible_helper(struct ast_channel *from, struct ast_channel *to)
Set up translation from one channel to another.
#define S_OR(a, b)
returns the equivalent of logic or for strings: first one if not empty, otherwise second one...
int type
subaddress type ie
void ast_party_subaddress_init(struct ast_party_subaddress *init)
Initialize the given subaddress structure.
A ringing phone is answered.
static struct ast_channel *attribute_malloc __ast_channel_alloc_ap(int needqueue, int state, const char *cid_num, const char *cid_name, const char *acctcode, const char *exten, const char *context, const char *linkedid, const int amaflag, const char *file, int line, const char *function, const char *name_fmt, va_list ap1, va_list ap2)
Create a new channel structure.
enum ast_bridge_result(*const early_bridge)(struct ast_channel *c0, struct ast_channel *c1)
Bridge two channels of the same type together (early)
struct ast_set_party_id ani
#define AST_CAUSE_IE_NONEXIST
void ast_party_redirecting_init(struct ast_party_redirecting *init)
Initialize the given redirecting structure.
int ast_writestream(struct ast_filestream *fs, struct ast_frame *f)
Writes a frame to a stream.
int ast_cli_register_multiple(struct ast_cli_entry *e, int len)
Register multiple commands.
static void call_forward_inherit(struct ast_channel *new_chan, struct ast_channel *parent, struct ast_channel *orig)
#define AST_CAUSE_USER_BUSY
void ast_jb_get_and_deliver(struct ast_channel *c0, struct ast_channel *c1)
Deliver the queued frames that should be delivered now for both channels.
int ast_readstring_full(struct ast_channel *c, char *s, int len, int timeout, int rtimeout, char *enders, int audiofd, int ctrlfd)
struct ast_channel_iterator * ast_channel_iterator_destroy(struct ast_channel_iterator *i)
Destroy a channel iterator.
struct ast_category * root
int ast_setstate(struct ast_channel *chan, enum ast_channel_state)
Change the state of a channel.
Information needed to specify a number in a call.
int ast_answer(struct ast_channel *chan)
Answer a channel.
char * ast_transfercapability2str(int transfercapability) attribute_const
Gives the string form of a given transfer capability.
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.
Application convenience functions, designed to give consistent look and feel to Asterisk apps...
int ast_transfer(struct ast_channel *chan, char *dest)
Transfer a channel (if supported).
const ast_string_field musicclass
int ast_is_deferrable_frame(const struct ast_frame *frame)
Should we keep this frame for later?
char * ast_getformatname_multiple(char *buf, size_t size, format_t format)
Get the names of a set of formats.
int ast_channel_get_device_name(struct ast_channel *chan, char *device_name, size_t name_buffer_length)
Get a device name given its channel structure.
const ast_string_field accountcode
Data structure associated with a single frame of data.
#define AST_DATA_STRUCTURE(__struct, __name)
static struct ast_datastore_info cc_channel_datastore_info
Internal Asterisk hangup causes.
#define ast_manager_event_multichan(category, event, nchans, chans, contents,...)
void ast_party_redirecting_set_init(struct ast_party_redirecting *init, const struct ast_party_redirecting *guide)
Initialize the given redirecting id structure using the given guide for a set update operation...
static void ast_channel_change_linkedid(struct ast_channel *chan, const char *linkedid)
static void ast_channel_destructor(void *obj)
Free a channel structure.
int ast_playtones_start(struct ast_channel *chan, int vol, const char *tonelist, int interruptible)
Start playing a list of tones on a channel.
#define AST_TRANS_CAP_RESTRICTED_DIGITAL
SAY_EXTERN int(* ast_say_number_full)(struct ast_channel *chan, int num, const char *ints, const char *lang, const char *options, int audiofd, int ctrlfd) SAY_INIT(ast_say_number_full)
void ast_connected_line_copy_to_caller(struct ast_party_caller *dest, const struct ast_party_connected_line *src)
Copy the connected line information to the caller information.
int plc_rx(plc_state_t *s, int16_t amp[], int len)
Process a block of received audio samples.
struct ast_channel::autochans autochans
int ast_tonepair_start(struct ast_channel *chan, int freq1, int freq2, int duration, int vol)
void ast_party_dialed_free(struct ast_party_dialed *doomed)
Destroy the dialed party contents.
struct timeval ast_tvsub(struct timeval a, struct timeval b)
Returns the difference of two timevals a - b.
struct timeval whentohangup
const char * data
Description of a tone.
static char * handle_cli_core_show_channeltypes(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
Show channel types - CLI command.
#define AST_LIST_TRAVERSE_SAFE_BEGIN(head, var, field)
Loops safely over (traverses) the entries in a list.
enum ast_frame_type frametype
int ast_str2cause(const char *name) attribute_pure
Convert the string form of a cause code to a number.
struct ast_variable * next
static void(* ast_moh_stop_ptr)(struct ast_channel *)
const char * warning_sound
void ast_channel_queue_redirecting_update(struct ast_channel *chan, const struct ast_party_redirecting *redirecting, const struct ast_set_party_redirecting *update)
Queue a redirecting update frame on a channel.
int ast_safe_sleep_conditional(struct ast_channel *chan, int ms, int(*cond)(void *), void *data)
Wait for a specified amount of time, looking for hangups and a condition argument.
static struct adsi_event events[]
int ast_undestroyed_channels(void)
#define AST_PRES_UNAVAILABLE
#define ast_channel_trylock(chan)
void ast_channels_init(void)
struct ast_trans_pvt * readtrans
unsigned char valid
TRUE if the name information is valid/present.
const char * ast_channel_reason2str(int reason)
return an english explanation of the code returned thru __ast_request_and_dial's 'outstate' argument ...
const char * channelreloadreason2txt(enum channelreloadreason reason)
Convert enum channelreloadreason to text string for manager event.
#define CONFIG_STATUS_FILEINVALID
static char context[AST_MAX_CONTEXT]
#define AST_TRANS_CAP_SPEECH
Call Parking and Pickup API Includes code and algorithms from the Zapata library. ...
int ast_readstring(struct ast_channel *c, char *s, int len, int timeout, int rtimeout, char *enders)
Reads multiple digits.
Information needed to specify a subaddress in a call.
int ast_tonepair(struct ast_channel *chan, int freq1, int freq2, int duration, int vol)
struct ast_party_connected_line target_id
struct ast_channel_monitor * monitor
void ast_party_number_set(struct ast_party_number *dest, const struct ast_party_number *src)
Set the source party number information into the destination party number.
static void * silence_generator_alloc(struct ast_channel *chan, void *data)
static int kill_write(struct ast_channel *chan, struct ast_frame *frame)
struct ast_channel_iterator * ast_channel_iterator_all_new(void)
Create a new channel iterator.
int ast_devstate_changed_literal(enum ast_device_state state, enum ast_devstate_cache cachable, const char *device)
Tells Asterisk the State for Device is changed.
static void queue_dtmf_readq(struct ast_channel *chan, struct ast_frame *f)
enum ast_timer_event ast_timer_get_event(const struct ast_timer *handle)
Retrieve timing event.
int reason
enum AST_REDIRECTING_REASON value for redirection
struct ast_channel * ast_dummy_channel_alloc(void)
Create a fake channel structure.
struct ast_filestream * stream
const char * ast_timer_get_name(const struct ast_timer *handle)
Get name of timer in use.
enum AST_MONITORING_STATE state
int ast_say_enumeration(struct ast_channel *chan, int num, const char *ints, const char *lang, const char *options)
says an enumeration
int ast_queue_frame_head(struct ast_channel *chan, struct ast_frame *f)
Queue one or more frames to the head of a channel's frame queue.
void ast_party_caller_init(struct ast_party_caller *init)
Initialize the given caller structure.
Say numbers and dates (maybe words one day too)
int(* func_channel_write)(struct ast_channel *chan, const char *function, char *data, const char *value)
Provide additional write items for CHANNEL() dialplan function.
#define AST_CAUSE_CALL_REJECTED
struct ast_channel * ast_channel_get_by_name(const char *name)
Find a channel by name.
#define AST_CAUSE_BEARERCAPABILITY_NOTAVAIL
struct ast_data * ast_data_add_str(struct ast_data *root, const char *childname, const char *string)
Add a string node type.
int ast_jb_do_usecheck(struct ast_channel *c0, struct ast_channel *c1)
Checks the need of a jb use in a generic bridge.
struct ast_channel * ast_request(const char *type, format_t format, const struct ast_channel *requestor, void *data, int *status)
Requests a channel.
static snd_pcm_format_t format
union ast_frame::@172 data
#define AST_CAUSE_MESSAGE_TYPE_NONEXIST
struct ast_channel_tech * tech
int ast_active_channels(void)
returns number of active/allocated channels
struct ast_channel::@156 readq
int ast_channel_datastore_add(struct ast_channel *chan, struct ast_datastore *datastore)
Add a datastore to a channel.
Information needed to specify a name in a call.
struct ast_data * ast_data_add_int(struct ast_data *root, const char *childname, int value)
Add an integer node type.
int ast_audiohook_detach_list(struct ast_audiohook_list *audiohook_list)
Detach audiohooks from list and destroy said list.
#define ast_string_field_free_memory(x)
free all memory - to be called before destroying the object
struct ast_frame * ast_read_noaudio(struct ast_channel *chan)
Reads a frame, returning AST_FRAME_NULL frame if audio.
void(* chan_fixup)(void *data, struct ast_channel *old_chan, struct ast_channel *new_chan)
Fix up channel references.
#define ast_strndup(a, b)
int(*const indicate)(struct ast_channel *c, int condition, const void *data, size_t datalen)
Indicate a particular condition (e.g. AST_CONTROL_BUSY or AST_CONTROL_RINGING or AST_CONTROL_CONGESTI...
static struct ast_frame * kill_read(struct ast_channel *chan)
unsigned char valid
TRUE if the number information is valid/present.
#define ao2_unlink(arg1, arg2)
static void ast_read_generator_actions(struct ast_channel *chan, struct ast_frame *f)
static int data_channels_provider_handler(const struct ast_data_search *search, struct ast_data *root)
int ast_channel_datastore_remove(struct ast_channel *chan, struct ast_datastore *datastore)
Remove a datastore from a channel.
int ast_cdr_init(struct ast_cdr *cdr, struct ast_channel *chan)
Initialize based on a channel.
static struct ast_datastore_info xfer_ds_info
int ast_data_search_match(const struct ast_data_search *search, struct ast_data *data)
Check the current generated node to know if it matches the search condition.
int str
Subscriber name ie.
const ast_string_field language
void ast_channel_set_connected_line(struct ast_channel *chan, const struct ast_party_connected_line *connected, const struct ast_set_party_connected_line *update)
Set the connected line information in the Asterisk channel.
uint32_t version
Structure version.
struct ast_frame * ast_framehook_list_read_event(struct ast_framehook_list *framehooks, struct ast_frame *frame)
This is used by the channel API push a frame read event to a channel's framehook list.
static void deactivate_generator_nolock(struct ast_channel *chan)
int( ao2_callback_data_fn)(void *obj, void *arg, void *data, int flags)
Type of a generic callback function.
#define AST_CAUSE_INVALID_CALL_REFERENCE
#define AST_CAUSE_CONGESTION
struct ast_cdr * ast_cdr_alloc(void)
Allocate a CDR record.
#define AST_TRANS_CAP_DIGITAL
static struct ast_cli_entry cli_channel[]
static void channel_data_add_flags(struct ast_data *tree, struct ast_channel *chan)
#define AST_BRIDGE_DTMF_CHANNEL_0
Report DTMF on channel 0.
int ast_do_masquerade(struct ast_channel *chan)
Start masquerading a channel.
char exten[AST_MAX_EXTENSION]
Timing source management.
#define AST_CAUSE_WRONG_CALL_STATE
int ast_stopstream(struct ast_channel *c)
Stops a stream.
struct ast_frame * ast_frdup(const struct ast_frame *fr)
Copies a frame.
struct ast_variable * ast_variable_new(const char *name, const char *value, const char *filename)
int ast_redirecting_build_data(unsigned char *data, size_t datalen, const struct ast_party_redirecting *redirecting, const struct ast_set_party_redirecting *update)
Build the redirecting id data frame.
void ast_party_redirecting_copy(struct ast_party_redirecting *dest, const struct ast_party_redirecting *src)
Copy the source redirecting information to the destination redirecting.
static struct ast_data_entry channel_providers[]
static force_inline int attribute_pure ast_str_case_hash(const char *str)
Compute a hash value on a case-insensitive string.
format_t ast_translator_best_choice(format_t *dsts, format_t *srcs)
Chooses the best translation path.
int ast_channel_cmpwhentohangup_tv(struct ast_channel *chan, struct timeval offset)
Compare a offset with the settings of when to hang a channel up.
The structure of the node handler.
#define AST_OPTION_CC_AGENT_TYPE
void ast_translator_free_path(struct ast_trans_pvt *tr)
Frees a translator path Frees the given translator path structure.
static struct ast_generator tonepair
#define ASTERISK_FILE_VERSION(file, version)
Register/unregister a source code file with the core.
void ast_party_dialed_copy(struct ast_party_dialed *dest, const struct ast_party_dialed *src)
Copy the source dialed party information to the destination dialed party.
int ast_channel_redirecting_macro(struct ast_channel *autoservice_chan, struct ast_channel *macro_chan, const void *redirecting_info, int is_caller, int is_frame)
Run a redirecting interception macro and update a channel's redirecting information.
static int data_channeltypes_provider_handler(const struct ast_data_search *search, struct ast_data *data_root)
#define CONFIG_STATUS_FILEUNCHANGED
void ast_party_dialed_set_init(struct ast_party_dialed *init, const struct ast_party_dialed *guide)
Initialize the given dialed structure using the given guide for a set update operation.
void ast_party_subaddress_set(struct ast_party_subaddress *dest, const struct ast_party_subaddress *src)
Set the source party subaddress information into the destination party subaddress.
int ast_sendtext(struct ast_channel *chan, const char *text)
Sends text to a channel.
#define AST_LIST_APPEND_LIST(head, list, field)
Appends a whole list to the tail of a list.
#define ast_string_field_set(x, field, data)
Set a field to a simple string value.
#define AST_FORMAT_SPEEX16
void ast_cdr_busy(struct ast_cdr *cdr)
Busy a call.
struct ast_party_number number
Subscriber phone number.
void(* digit)(struct ast_channel *chan, char digit)