81#if defined(KEEP_TILL_CHANNEL_PARTY_NUMBER_INFO_NEEDED)
89#define MONITOR_CONSTANT_DELAY
90#define MONITOR_DELAY 150 * 8
98#define STATE2STR_BUFSIZE 32
102#define AST_DEFAULT_EMULATE_DTMF_DURATION 100
106#define DEFAULT_EMULATE_MF_DURATION 55
108#define DEFAULT_AMA_FLAGS AST_AMA_DOCUMENTATION
112#define AST_MIN_DTMF_GAP 45
208#if defined(KEEP_TILL_CHANNEL_PARTY_NUMBER_INFO_NEEDED)
209static const char *party_number_ton2str(
int ton)
212 switch ((ton >> 4) & 0x07) {
213 case PRI_TON_INTERNATIONAL:
214 return "International";
215 case PRI_TON_NATIONAL:
217 case PRI_TON_NET_SPECIFIC:
218 return "Network Specific";
219 case PRI_TON_SUBSCRIBER:
221 case PRI_TON_ABBREVIATED:
222 return "Abbreviated";
223 case PRI_TON_RESERVED:
225 case PRI_TON_UNKNOWN:
234#if defined(KEEP_TILL_CHANNEL_PARTY_NUMBER_INFO_NEEDED)
235static const char *party_number_plan2str(
int plan)
238 switch (plan & 0x0F) {
240 case PRI_NPI_UNKNOWN:
242 case PRI_NPI_E163_E164:
243 return "Public (E.163/E.164)";
245 return "Data (X.121)";
247 return "Telex (F.69)";
248 case PRI_NPI_NATIONAL:
249 return "National Standard";
250 case PRI_NPI_PRIVATE:
252 case PRI_NPI_RESERVED:
263#define FORMAT "%-15.15s %-40.40s %-13.13s %-13.13s %-13.13s %-13.13s\n"
269 e->
command =
"core show channeltypes";
271 "Usage: core show channeltypes\n"
272 " Lists available channel types registered in your\n"
273 " Asterisk server.\n";
282 ast_cli(
a->fd,
FORMAT,
"Type",
"Description",
"Devicestate",
"Presencestate",
"Indications",
"Transfer");
283 ast_cli(
a->fd,
FORMAT,
"-------------",
"-------------",
"-------------",
"-------------",
"-------------",
"-------------");
288 (cl->
tech->devicestate) ?
"yes" :
"no",
289 (cl->
tech->presencestate) ?
"yes" :
"no",
290 (cl->
tech->indicate) ?
"yes" :
"no",
291 (cl->
tech->transfer) ?
"yes" :
"no");
296 ast_cli(
a->fd,
"----------\n%d channel drivers registered.\n", count_chan);
312 wordlen = strlen(
a->word);
316 if (!strncasecmp(
a->word, cl->
tech->type, wordlen)) {
333 e->
command =
"core show channeltype";
335 "Usage: core show channeltype <name>\n"
336 " Show details about the specified channel type, <name>.\n";
348 if (!strncasecmp(cl->
tech->type,
a->argv[3], strlen(cl->
tech->type)))
354 ast_cli(
a->fd,
"\n%s is not a registered channel driver.\n",
a->argv[3]);
360 "-- Info about channel driver: %s --\n"
361 " Device State: %s\n"
362 "Presence State: %s\n"
365 " Capabilities: %s\n"
369 " Image Support: %s\n"
370 " Text Support: %s\n",
372 (cl->
tech->devicestate) ?
"yes" :
"no",
373 (cl->
tech->presencestate) ?
"yes" :
"no",
374 (cl->
tech->indicate) ?
"yes" :
"no",
375 (cl->
tech->transfer) ?
"yes" :
"no",
377 (cl->
tech->send_digit_begin) ?
"yes" :
"no",
378 (cl->
tech->send_digit_end) ?
"yes" :
"no",
379 (cl->
tech->send_html) ?
"yes" :
"no",
380 (cl->
tech->send_image) ?
"yes" :
"no",
381 (cl->
tech->send_text) ?
"yes" :
"no"
436 .description =
"Kill channel (should not see this)",
473 ast_debug(1,
"Setting hangupcause of channel %s to %d (is %d now)\n",
525 struct timeval whentohangup;
574 ast_debug(5,
"Unregistering channel type '%s'\n",
tech->type);
582 ast_verb(5,
"Unregistered channel type '%s'\n",
tech->type);
600 if (!strcasecmp(
name, chanls->
tech->type)) {
617 if (
causes[x].cause == cause)
658 return "Dialing Offhook";
674 switch (transfercapability) {
680 return "RESTRICTED_DIGITAL";
684 return "DIGITAL_W_TONES";
698 .description =
"Surrogate channel used to pull channel from an application",
704 .description =
"Null channel (should not see this)",
722 ast_log(
LOG_ERROR,
"Channel Unique ID '%s' already in use by channel %s(%p)\n",
732static struct ast_channel *__attribute__((format(printf, 15, 0)))
737 const
char *function, const
char *name_fmt, va_list ap)
741 char *tech =
"", *tech2 =
NULL;
756 file, line, function);
773 if (!nativeformats) {
792 ast_log(
LOG_WARNING,
"Channel allocation failed: Unable to create schedule context\n");
860 char *slash, *slash2;
868 ast_channel_name_build_va(
tmp, name_fmt, ap);
870 if ((slash = strchr(tech,
'/'))) {
871 if ((slash2 = strchr(slash + 1,
'/'))) {
882 ast_channel_name_set(
tmp,
"-**Unknown**");
892 ast_channel_accountcode_set(
tmp, acctcode);
955 const char *cid_name,
const char *acctcode,
959 const char *
file,
int line,
const char *function,
960 const char *name_fmt, ...)
965 va_start(ap, name_fmt);
967 assignedids, requestor, amaflag, endpoint,
NULL,
file, line, function, name_fmt, ap);
974 const char *cid_name,
const char *acctcode,
978 const char *
file,
int line,
const char *function,
979 const char *name_fmt, ...)
984 va_start(ap, name_fmt);
986 assignedids, requestor, amaflag, endpoint, initializers,
file, line, function, name_fmt, ap);
1000 file, line, function);
1032 unsigned int new_frames = 0;
1033 unsigned int new_voice_frames = 0;
1034 unsigned int queued_frames = 0;
1035 unsigned int queued_voice_frames = 0;
1097 queued_voice_frames++;
1101 if ((queued_frames + new_frames > 128 || queued_voice_frames + new_voice_frames > 96)) {
1102 int total_queued = queued_frames + new_frames;
1103 int total_voice = queued_voice_frames + new_voice_frames;
1105 ast_log(
LOG_WARNING,
"Exceptionally long %squeue length (%d voice / %d total) queuing to %s\n",
1106 queued_frames + new_frames > 128 ?
"" :
"voice ", total_voice, total_queued,
ast_channel_name(chan));
1140 while (new_frames--) {
1217 f.
data.
ptr = (
void *) musicclass;
1218 f.
datalen = strlen(musicclass) + 1;
1221 "musicclass", musicclass);
1298 void *
data,
int ao2_flags)
1306 const char *
name = arg;
1307 size_t name_len = *(
size_t *)
data;
1311 ast_log(
LOG_ERROR,
"BUG! Must supply a channel name or partial name to match!\n");
1352 size_t id_len = *(
size_t *)
data;
1356 ast_log(
LOG_ERROR,
"BUG! Must supply a uniqueid or partial uniqueid to match!\n");
1390 char *l_exten = (
char *) exten;
1391 char *l_context = (
char *)
context;
1410 char *l_name = (
char *)
name;
1456 char *l_name = (
char *)
name;
1464 (name_len == 0) ?
OBJ_KEY : 0);
1480 char *l_exten = (
char *)
exten;
1481 char *l_context = (
char *)
context;
1522 struct timeval start;
1647 if (src->
str && src->
str != dest->
str) {
1700 if (src->
str && src->
str != dest->
str) {
1753 if (src->
str && src->
str != dest->
str) {
1771 update_id->
name = 1;
1824 if (src->
tag && src->
tag != dest->
tag) {
1842 int number_priority;
1844 int number_screening;
1849 if (!
id->name.valid) {
1854 switch (name_value) {
1872 if (!
id->number.valid) {
1875 number_priority = 3;
1879 switch (number_value) {
1881 number_priority = 0;
1884 number_priority = 1;
1887 number_priority = 2;
1892 number_priority = 3;
1898 if (name_priority < number_priority) {
1899 number_value = name_value;
1905 return number_value | number_screening;
1911 id->number.valid = 0;
1912 id->subaddress.valid = 0;
1926 if (overlay->name.valid) {
1927 merged.
name = overlay->name;
1929 if (overlay->number.valid) {
1930 merged.
number = overlay->number;
1932 if (overlay->subaddress.valid) {
2127 if (src->
str && src->
str != dest->
str) {
2273 if ((dashptr = strrchr(device_name,
'-'))) {
2277 device_name[0] =
'\0';
2332 if (device_name[0]) {
2435 if ((datastore->
uid !=
NULL) && !strcasecmp(
uid, datastore->
uid)) {
2524 ast_channel_hangupsource_set(chan, source);
2531 ast_channel_hangupsource_set(bridge, source);
2623 ast_log(
LOG_WARNING,
"Hard hangup called by thread LWP %d on %s, while blocked by thread LWP %d in procedure %s! Expect a failure\n",
2650 struct timeval answertime;
2725 switch (old_state) {
2735 int timeout_ms =
MAX(delay, 500);
2736 unsigned int done = 0;
2737 struct timeval start;
2751 ast_debug(2,
"Didn't receive a media frame from %s within %u ms of answering. Continuing anyway\n",
ast_channel_name(chan),
MAX(delay, 500));
2901 if (generator && generator->
release) {
2950 if (!
tmp || !generate) {
2963 ast_debug(1,
"Auto-deactivating generator\n");
2979 if (generator_old && generator_old->
release) {
3008 int *exception,
int *outfd,
int *ms)
3010 struct timeval start = { 0 , 0 };
3011 struct pollfd *pfds =
NULL;
3016 struct timeval now = { 0, 0 };
3017 struct timeval whentohangup = { 0, 0 }, diff;
3031 for (x = 0; x < n; x++) {
3045 whentohangup = diff;
3061 if (!
ast_tvzero(whentohangup) && whentohangup.tv_sec < INT_MAX / 1000) {
3062 rms = whentohangup.tv_sec * 1000 + whentohangup.tv_usec / 1000;
3063 if (*ms >= 0 && *ms < rms) {
3066 }
else if (!
ast_tvzero(whentohangup) && rms < 0) {
3076 for (x = 0; x < n; x++) {
3079 fdmap[
max].fdno = y;
3080 fdmap[
max].chan = x;
3087 for (x = 0; x < nfds; x++) {
3088 fdmap[
max].chan = -1;
3096 if (
sizeof(
int) == 4) {
3099 if (kbrms > 600000) {
3106 }
while (!res && (rms > 0));
3110 for (x = 0; x < n; x++) {
3116 if (
errno != EINTR) {
3123 for (x = 0; x < n; x++) {
3127 if (winner ==
NULL) {
3142 for (x = 0; x <
max; x++) {
3143 res = pfds[x].revents;
3147 if (fdmap[x].chan >= 0) {
3148 winner =
c[fdmap[x].chan];
3150 if (res & POLLPRI) {
3159 *outfd = pfds[x].fd;
3162 *exception = (res & POLLPRI) ? -1 : 0;
3207 unsigned int real_rate = rate, max_rate;
3222 real_rate = max_rate;
3225 ast_debug(3,
"Scheduling timer at (%u requested / %u actual) timer ticks per second\n", rate, real_rate);
3236 if (
data && is_ao2_obj) {
3283 if (!rchan && outfd < 0 && ms) {
3289 }
else if (outfd > -1) {
3291 ast_log(
LOG_WARNING,
"The FD we were waiting for has something waiting. Waitfordigit returning numeric 1\n");
3309 if (!breakon || strchr(breakon, res)) {
3393 char digit_str[] = {
digit,
'\0' };
3409 char digit_str[] = {
digit,
'\0' };
3455 samples = (int) (((
float) f->
samples) * factor);
3480 ast_debug(1,
"Auto-deactivating generator\n");
3533 int diff = sample_rate - seek_rate;
3537 }
else if (diff < 0) {
3591 "ast_read() on chan '%s' called with no recorded file descriptor.\n",
3630 if (trigger_dtmf_emulating) {
3640 }
else if (trigger_dtmf_emulating) {
3686 int skipped_dtmf_frame = 0;
3695 skipped_dtmf_frame = 1;
3707 if (!skipped_dtmf_frame) {
3800 if (stream == default_stream) {
3827 if (dropnondefault && stream != default_stream) {
3839 ast_debug(1,
"Dropping duplicate answer!\n");
3852 read_action_payload = f->
data.
ptr;
3853 switch (read_action_payload->
action) {
3973 }
else if (!f->
len) {
4057 if (old_frame != f) {
4075 if (stream != default_stream) {
4181 if (old_frame != f) {
4199 if (old_frame != f) {
4306 switch (condition) {