summaryrefslogtreecommitdiff
path: root/main
diff options
context:
space:
mode:
authorTerry Wilson <twilson@digium.com>2012-03-13 18:20:34 +0000
committerTerry Wilson <twilson@digium.com>2012-03-13 18:20:34 +0000
commit786f5898d12d30c481b1d178bb80e5801dbf666f (patch)
tree2b5e07ed1b5fbd7aae1187f068eff498621878a2 /main
parent73ec67e008ca6db76625bfc1f992fa726c948837 (diff)
Finalize ast_channel opaquification
Review: https://reviewboard.asterisk.org/r/1786/ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@358907 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'main')
-rw-r--r--main/app.c4
-rw-r--r--main/autoservice.c6
-rw-r--r--main/bridging.c8
-rw-r--r--main/channel.c311
-rw-r--r--main/channel_internal_api.c678
-rw-r--r--main/cli.c4
-rw-r--r--main/features.c52
-rw-r--r--main/file.c24
-rw-r--r--main/indications.c4
-rw-r--r--main/manager.c8
-rw-r--r--main/pbx.c14
-rw-r--r--main/rtp_engine.c4
12 files changed, 657 insertions, 460 deletions
diff --git a/main/app.c b/main/app.c
index 1719a11f1..3cdb18432 100644
--- a/main/app.c
+++ b/main/app.c
@@ -558,9 +558,9 @@ static void *linear_alloc(struct ast_channel *chan, void *params)
/* In this case, params is already malloc'd */
if (ls->allowoverride) {
- ast_set_flag(chan, AST_FLAG_WRITE_INT);
+ ast_set_flag(ast_channel_flags(chan), AST_FLAG_WRITE_INT);
} else {
- ast_clear_flag(chan, AST_FLAG_WRITE_INT);
+ ast_clear_flag(ast_channel_flags(chan), AST_FLAG_WRITE_INT);
}
ast_format_copy(&ls->origwfmt, ast_channel_writeformat(chan));
diff --git a/main/autoservice.c b/main/autoservice.c
index fca180f5c..96d2c5c18 100644
--- a/main/autoservice.c
+++ b/main/autoservice.c
@@ -198,9 +198,9 @@ int ast_autoservice_start(struct ast_channel *chan)
as->use_count = 1;
ast_channel_lock(chan);
- as->orig_end_dtmf_flag = ast_test_flag(chan, AST_FLAG_END_DTMF_ONLY) ? 1 : 0;
+ as->orig_end_dtmf_flag = ast_test_flag(ast_channel_flags(chan), AST_FLAG_END_DTMF_ONLY) ? 1 : 0;
if (!as->orig_end_dtmf_flag)
- ast_set_flag(chan, AST_FLAG_END_DTMF_ONLY);
+ ast_set_flag(ast_channel_flags(chan), AST_FLAG_END_DTMF_ONLY);
ast_channel_unlock(chan);
AST_LIST_LOCK(&aslist);
@@ -282,7 +282,7 @@ int ast_autoservice_stop(struct ast_channel *chan)
}
if (!as->orig_end_dtmf_flag) {
- ast_clear_flag(chan, AST_FLAG_END_DTMF_ONLY);
+ ast_clear_flag(ast_channel_flags(chan), AST_FLAG_END_DTMF_ONLY);
}
ast_channel_lock(chan);
diff --git a/main/bridging.c b/main/bridging.c
index 9a549691f..66881c3f8 100644
--- a/main/bridging.c
+++ b/main/bridging.c
@@ -818,7 +818,7 @@ static void bridge_channel_feature(struct ast_bridge *bridge, struct ast_bridge_
int look_for_dtmf = 1, dtmf_len = 0;
/* The channel is now under our control and we don't really want any begin frames to do our DTMF matching so disable 'em at the core level */
- ast_set_flag(bridge_channel->chan, AST_FLAG_END_DTMF_ONLY);
+ ast_set_flag(ast_channel_flags(bridge_channel->chan), AST_FLAG_END_DTMF_ONLY);
/* Wait for DTMF on the channel and put it into a buffer. If the buffer matches any feature hook execute the hook. */
while (look_for_dtmf) {
@@ -863,7 +863,7 @@ static void bridge_channel_feature(struct ast_bridge *bridge, struct ast_bridge_
}
/* Since we are done bringing DTMF in return to using both begin and end frames */
- ast_clear_flag(bridge_channel->chan, AST_FLAG_END_DTMF_ONLY);
+ ast_clear_flag(ast_channel_flags(bridge_channel->chan), AST_FLAG_END_DTMF_ONLY);
/* If a hook was actually matched execute it on this channel, otherwise stream up the DTMF to the other channels */
if (hook) {
@@ -967,7 +967,7 @@ static enum ast_bridge_channel_state bridge_channel_join(struct ast_bridge_chann
/* Actually execute the respective threading model, and keep our bridge thread alive */
while (bridge_channel->state == AST_BRIDGE_CHANNEL_STATE_WAIT) {
/* Update bridge pointer on channel */
- bridge_channel->chan->bridge = bridge_channel->bridge;
+ ast_channel_internal_bridge_set(bridge_channel->chan, bridge_channel->bridge);
/* If the technology requires a thread and one is not running, start it up */
if (bridge_channel->bridge->thread == AST_PTHREADT_NULL && (bridge_channel->bridge->technology->capabilities & AST_BRIDGE_CAPABILITY_THREAD)) {
bridge_channel->bridge->stop = 0;
@@ -1006,7 +1006,7 @@ static enum ast_bridge_channel_state bridge_channel_join(struct ast_bridge_chann
}
}
- bridge_channel->chan->bridge = NULL;
+ ast_channel_internal_bridge_set(bridge_channel->chan, NULL);
/* See if we need to dissolve the bridge itself if they hung up */
if (bridge_channel->state == AST_BRIDGE_CHANNEL_STATE_END) {
diff --git a/main/channel.c b/main/channel.c
index 5fdd9ce9f..c1431c7ef 100644
--- a/main/channel.c
+++ b/main/channel.c
@@ -67,6 +67,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
#include "asterisk/stringfields.h"
#include "asterisk/global_datastores.h"
#include "asterisk/data.h"
+#include "asterisk/channel_internal.h"
#ifdef HAVE_EPOLL
#include <sys/epoll.h>
@@ -928,21 +929,12 @@ __ast_channel_alloc_ap(int needqueue, int state, const char *cid_num, const char
struct ast_timer *timer;
/* If shutting down, don't allocate any new channels */
- if (shutting_down) {
+ if (ast_shutting_down()) {
ast_log(LOG_WARNING, "Channel allocation failed: Refusing due to active shutdown\n");
return NULL;
}
-#if defined(REF_DEBUG)
- tmp = __ao2_alloc_debug(sizeof(*tmp), ast_channel_destructor,
- AO2_ALLOC_OPT_LOCK_MUTEX, "", file, line, function, 1);
-#elif defined(__AST_DEBUG_MALLOC)
- tmp = __ao2_alloc_debug(sizeof(*tmp), ast_channel_destructor,
- AO2_ALLOC_OPT_LOCK_MUTEX, "", file, line, function, 0);
-#else
- tmp = ao2_alloc(sizeof(*tmp), ast_channel_destructor);
-#endif
- if (!tmp) {
+ if (!(tmp = ast_channel_internal_alloc(ast_channel_destructor))) {
/* Channel structure allocation failure. */
return NULL;
}
@@ -999,10 +991,6 @@ __ast_channel_alloc_ap(int needqueue, int state, const char *cid_num, const char
ast_channel_timingfd_set(tmp, ast_timer_fd(ast_channel_timer(tmp)));
}
- if (needqueue && ast_channel_internal_alertpipe_init(tmp)) {
- return ast_channel_unref(tmp);
- }
-
/*
* This is the last place the channel constructor can fail.
*
@@ -1010,7 +998,8 @@ __ast_channel_alloc_ap(int needqueue, int state, const char *cid_num, const char
* AST_CEL_CHANNEL_END is not posted if we have not posted the
* AST_CEL_CHANNEL_START yet.
*/
- if ((ast_string_field_init(tmp, 128))) {
+
+ if (needqueue && ast_channel_internal_alertpipe_init(tmp)) {
return ast_channel_unref(tmp);
}
@@ -1132,6 +1121,7 @@ __ast_channel_alloc_ap(int needqueue, int state, const char *cid_num, const char
ast_channel_uniqueid(tmp));
}
+ ast_channel_internal_finalize(tmp);
return tmp;
}
@@ -1164,24 +1154,11 @@ struct ast_channel *ast_dummy_channel_alloc(void)
struct ast_channel *tmp;
struct varshead *headp;
-#if defined(REF_DEBUG)
- tmp = __ao2_alloc_debug(sizeof(*tmp), ast_dummy_channel_destructor,
- AO2_ALLOC_OPT_LOCK_MUTEX, "dummy channel", file, line, function, 1);
-#elif defined(__AST_DEBUG_MALLOC)
- tmp = __ao2_alloc_debug(sizeof(*tmp), ast_dummy_channel_destructor,
- AO2_ALLOC_OPT_LOCK_MUTEX, "dummy channel", file, line, function, 0);
-#else
- tmp = ao2_alloc(sizeof(*tmp), ast_dummy_channel_destructor);
-#endif
- if (!tmp) {
+ if (!(tmp = ast_channel_internal_alloc(ast_dummy_channel_destructor))) {
/* Dummy channel structure allocation failure. */
return NULL;
}
- if ((ast_string_field_init(tmp, 128))) {
- return ast_channel_unref(tmp);
- }
-
headp = ast_channel_varshead(tmp);
AST_LIST_HEAD_INIT_NOLOCK(headp);
@@ -1196,7 +1173,7 @@ static int __ast_queue_frame(struct ast_channel *chan, struct ast_frame *fin, in
unsigned int new_voice_frames = 0;
unsigned int queued_frames = 0;
unsigned int queued_voice_frames = 0;
- AST_LIST_HEAD_NOLOCK(, ast_frame) frames;
+ AST_LIST_HEAD_NOLOCK(,ast_frame) frames;
ast_channel_lock(chan);
@@ -1296,8 +1273,8 @@ static int __ast_queue_frame(struct ast_channel *chan, struct ast_frame *fin, in
}
} else if (ast_channel_timingfd(chan) > -1) {
ast_timer_enable_continuous(ast_channel_timer(chan));
- } else if (ast_test_flag(chan, AST_FLAG_BLOCKING)) {
- pthread_kill(chan->blocker, SIGURG);
+ } else if (ast_test_flag(ast_channel_flags(chan), AST_FLAG_BLOCKING)) {
+ pthread_kill(ast_channel_blocker(chan), SIGURG);
}
ast_channel_unlock(chan);
@@ -1380,8 +1357,8 @@ int ast_channel_defer_dtmf(struct ast_channel *chan)
int pre = 0;
if (chan) {
- pre = ast_test_flag(chan, AST_FLAG_DEFER_DTMF);
- ast_set_flag(chan, AST_FLAG_DEFER_DTMF);
+ pre = ast_test_flag(ast_channel_flags(chan), AST_FLAG_DEFER_DTMF);
+ ast_set_flag(ast_channel_flags(chan), AST_FLAG_DEFER_DTMF);
}
return pre;
}
@@ -1390,7 +1367,7 @@ int ast_channel_defer_dtmf(struct ast_channel *chan)
void ast_channel_undefer_dtmf(struct ast_channel *chan)
{
if (chan)
- ast_clear_flag(chan, AST_FLAG_DEFER_DTMF);
+ ast_clear_flag(ast_channel_flags(chan), AST_FLAG_DEFER_DTMF);
}
struct ast_channel *ast_channel_callback(ao2_callback_data_fn *cb_fn, void *arg,
@@ -2172,8 +2149,7 @@ static void ast_channel_destructor(void *obj)
struct ast_datastore *datastore;
char device_name[AST_CHANNEL_NAME];
- if (ast_channel_name(chan)) {
- /* The string fields were initialized. */
+ if (ast_channel_internal_is_finalized(chan)) {
ast_cel_report_event(chan, AST_CEL_CHANNEL_END, NULL, NULL, NULL);
ast_cel_check_retire_linkedid(chan);
}
@@ -2199,10 +2175,9 @@ static void ast_channel_destructor(void *obj)
ast_sched_context_destroy(ast_channel_sched(chan));
}
- if (ast_channel_name(chan)) {
+ if (ast_channel_internal_is_finalized(chan)) {
char *dashptr;
- /* The string fields were initialized. */
ast_copy_string(device_name, ast_channel_name(chan), sizeof(device_name));
if ((dashptr = strrchr(device_name, '-'))) {
*dashptr = '\0';
@@ -2268,7 +2243,7 @@ static void ast_channel_destructor(void *obj)
ast_channel_zone_set(chan, ast_tone_zone_unref(ast_channel_zone(chan)));
}
- ast_string_field_free_memory(chan);
+ ast_channel_internal_cleanup(chan);
if (device_name[0]) {
/*
@@ -2308,7 +2283,7 @@ static void ast_dummy_channel_destructor(void *obj)
ast_channel_cdr_set(chan, NULL);
}
- ast_string_field_free_memory(chan);
+ ast_channel_internal_cleanup(chan);
}
struct ast_datastore *ast_channel_datastore_alloc(const struct ast_datastore_info *info, const char *uid)
@@ -2490,8 +2465,8 @@ int ast_softhangup_nolock(struct ast_channel *chan, int cause)
ast_channel_softhangup_internal_flag_add(chan, cause);
ast_queue_frame(chan, &ast_null_frame);
/* Interrupt any poll call or such */
- if (ast_test_flag(chan, AST_FLAG_BLOCKING))
- pthread_kill(chan->blocker, SIGURG);
+ if (ast_test_flag(ast_channel_flags(chan), AST_FLAG_BLOCKING))
+ pthread_kill(ast_channel_blocker(chan), SIGURG);
return 0;
}
@@ -2597,14 +2572,14 @@ int ast_hangup(struct ast_channel *chan)
* Mark it as a zombie already so ast_do_masquerade() will know
* to free it later.
*/
- ast_set_flag(chan, AST_FLAG_ZOMBIE);
+ ast_set_flag(ast_channel_flags(chan), AST_FLAG_ZOMBIE);
destroy_hooks(chan);
ast_channel_unlock(chan);
return 0;
}
- if (!(was_zombie = ast_test_flag(chan, AST_FLAG_ZOMBIE))) {
- ast_set_flag(chan, AST_FLAG_ZOMBIE);
+ if (!(was_zombie = ast_test_flag(ast_channel_flags(chan), AST_FLAG_ZOMBIE))) {
+ ast_set_flag(ast_channel_flags(chan), AST_FLAG_ZOMBIE);
}
ast_channel_unlock(chan);
@@ -2640,11 +2615,11 @@ int ast_hangup(struct ast_channel *chan)
snprintf(extra_str, sizeof(extra_str), "%d,%s,%s", ast_channel_hangupcause(chan), ast_channel_hangupsource(chan), S_OR(pbx_builtin_getvar_helper(chan, "DIALSTATUS"), ""));
ast_cel_report_event(chan, AST_CEL_HANGUP, NULL, extra_str, NULL);
- if (ast_test_flag(chan, AST_FLAG_BLOCKING)) {
+ if (ast_test_flag(ast_channel_flags(chan), AST_FLAG_BLOCKING)) {
ast_log(LOG_WARNING, "Hard hangup called by thread %ld on %s, while fd "
"is blocked by thread %ld in procedure %s! Expect a failure\n",
- (long) pthread_self(), ast_channel_name(chan), (long)chan->blocker, ast_channel_blockproc(chan));
- ast_assert(ast_test_flag(chan, AST_FLAG_BLOCKING) == 0);
+ (long) pthread_self(), ast_channel_name(chan), (long)ast_channel_blocker(chan), ast_channel_blockproc(chan));
+ ast_assert(ast_test_flag(ast_channel_flags(chan), AST_FLAG_BLOCKING) == 0);
}
if (!was_zombie) {
ast_debug(1, "Hanging up channel '%s'\n", ast_channel_name(chan));
@@ -2700,13 +2675,13 @@ int ast_raw_answer(struct ast_channel *chan, int cdr_answer)
ast_channel_lock(chan);
/* You can't answer an outbound call */
- if (ast_test_flag(chan, AST_FLAG_OUTGOING)) {
+ if (ast_test_flag(ast_channel_flags(chan), AST_FLAG_OUTGOING)) {
ast_channel_unlock(chan);
return 0;
}
/* Stop if we're a zombie or need a soft hangup */
- if (ast_test_flag(chan, AST_FLAG_ZOMBIE) || ast_check_hangup(chan)) {
+ if (ast_test_flag(ast_channel_flags(chan), AST_FLAG_ZOMBIE) || ast_check_hangup(chan)) {
ast_channel_unlock(chan);
return -1;
}
@@ -2860,7 +2835,7 @@ void ast_deactivate_generator(struct ast_channel *chan)
ast_channel_generatordata_set(chan, NULL);
ast_channel_generator_set(chan, NULL);
ast_channel_set_fd(chan, AST_GENERATOR_FD, -1);
- ast_clear_flag(chan, AST_FLAG_WRITE_INT);
+ ast_clear_flag(ast_channel_flags(chan), AST_FLAG_WRITE_INT);
ast_settimeout(chan, 0, NULL, NULL);
}
ast_channel_unlock(chan);
@@ -3044,7 +3019,7 @@ struct ast_channel *ast_waitfor_nandfds(struct ast_channel **c, int n, int *fds,
res = ast_poll(pfds, max, rms);
}
for (x = 0; x < n; x++)
- ast_clear_flag(c[x], AST_FLAG_BLOCKING);
+ ast_clear_flag(ast_channel_flags(c[x]), AST_FLAG_BLOCKING);
if (res < 0) { /* Simulate a timeout if we were interrupted */
if (errno != EINTR)
*ms = -1;
@@ -3076,9 +3051,9 @@ struct ast_channel *ast_waitfor_nandfds(struct ast_channel **c, int n, int *fds,
if (fdmap[x].chan >= 0) { /* this is a channel */
winner = c[fdmap[x].chan]; /* override previous winners */
if (res & POLLPRI)
- ast_set_flag(winner, AST_FLAG_EXCEPTION);
+ ast_set_flag(ast_channel_flags(winner), AST_FLAG_EXCEPTION);
else
- ast_clear_flag(winner, AST_FLAG_EXCEPTION);
+ ast_clear_flag(ast_channel_flags(winner), AST_FLAG_EXCEPTION);
ast_channel_fdno_set(winner, fdmap[x].fdno);
} else { /* this is an fd */
if (outfd)
@@ -3140,7 +3115,7 @@ static struct ast_channel *ast_waitfor_nandfds_simple(struct ast_channel *chan,
res = epoll_wait(ast_channel_epfd(chan), ev, 1, rms);
/* Stop blocking */
- ast_clear_flag(chan, AST_FLAG_BLOCKING);
+ ast_clear_flag(ast_channel_flags(chan), AST_FLAG_BLOCKING);
/* Simulate a timeout if we were interrupted */
if (res < 0) {
@@ -3167,9 +3142,9 @@ static struct ast_channel *ast_waitfor_nandfds_simple(struct ast_channel *chan,
aed = ev[0].data.ptr;
ast_channel_fdno_set(chan, aed->which);
if (ev[0].events & EPOLLPRI)
- ast_set_flag(chan, AST_FLAG_EXCEPTION);
+ ast_set_flag(ast_channel_flags(chan), AST_FLAG_EXCEPTION);
else
- ast_clear_flag(chan, AST_FLAG_EXCEPTION);
+ ast_clear_flag(ast_channel_flags(chan), AST_FLAG_EXCEPTION);
if (*ms > 0) {
*ms -= ast_tvdiff_ms(ast_tvnow(), start);
@@ -3225,7 +3200,7 @@ static struct ast_channel *ast_waitfor_nandfds_complex(struct ast_channel **c, i
res = epoll_wait(ast_channel_epfd(c[0]), ev, 25, rms);
for (i = 0; i < n; i++)
- ast_clear_flag(c[i], AST_FLAG_BLOCKING);
+ ast_clear_flag(ast_channel_flags(c[i]), AST_FLAG_BLOCKING);
if (res < 0) {
if (errno != EINTR)
@@ -3257,9 +3232,9 @@ static struct ast_channel *ast_waitfor_nandfds_complex(struct ast_channel **c, i
winner = aed->chan;
if (ev[i].events & EPOLLPRI)
- ast_set_flag(winner, AST_FLAG_EXCEPTION);
+ ast_set_flag(ast_channel_flags(winner), AST_FLAG_EXCEPTION);
else
- ast_clear_flag(winner, AST_FLAG_EXCEPTION);
+ ast_clear_flag(ast_channel_flags(winner), AST_FLAG_EXCEPTION);
ast_channel_fdno_set(winner, aed->which);
}
@@ -3337,7 +3312,7 @@ int ast_settimeout(struct ast_channel *c, unsigned int rate, int (*func)(const v
res = ast_timer_set_rate(ast_channel_timer(c), real_rate);
- c->timingfunc = func;
+ ast_channel_timingfunc_set(c, func);
ast_channel_timingdata_set(c, data);
if (func == NULL && rate == 0 && ast_channel_fdno(c) == AST_TIMING_FD) {
@@ -3358,11 +3333,11 @@ int ast_settimeout(struct ast_channel *c, unsigned int rate, int (*func)(const v
int ast_waitfordigit_full(struct ast_channel *c, int ms, int audiofd, int cmdfd)
{
/* Stop if we're a zombie or need a soft hangup */
- if (ast_test_flag(c, AST_FLAG_ZOMBIE) || ast_check_hangup(c))
+ if (ast_test_flag(ast_channel_flags(c), AST_FLAG_ZOMBIE) || ast_check_hangup(c))
return -1;
/* Only look for the end of DTMF, don't bother with the beginning and don't emulate things */
- ast_set_flag(c, AST_FLAG_END_DTMF_ONLY);
+ ast_set_flag(ast_channel_flags(c), AST_FLAG_END_DTMF_ONLY);
/* Wait for a digit, no more than ms milliseconds total. */
@@ -3377,12 +3352,12 @@ int ast_waitfordigit_full(struct ast_channel *c, int ms, int audiofd, int cmdfd)
if (errno == 0 || errno == EINTR)
continue;
ast_log(LOG_WARNING, "Wait failed (%s)\n", strerror(errno));
- ast_clear_flag(c, AST_FLAG_END_DTMF_ONLY);
+ ast_clear_flag(ast_channel_flags(c), AST_FLAG_END_DTMF_ONLY);
return -1;
} else if (outfd > -1) {
/* The FD we were watching has something waiting */
ast_log(LOG_WARNING, "The FD we were waiting for has something waiting. Waitfordigit returning numeric 1\n");
- ast_clear_flag(c, AST_FLAG_END_DTMF_ONLY);
+ ast_clear_flag(ast_channel_flags(c), AST_FLAG_END_DTMF_ONLY);
return 1;
} else if (rchan) {
int res;
@@ -3396,13 +3371,13 @@ int ast_waitfordigit_full(struct ast_channel *c, int ms, int audiofd, int cmdfd)
case AST_FRAME_DTMF_END:
res = f->subclass.integer;
ast_frfree(f);
- ast_clear_flag(c, AST_FLAG_END_DTMF_ONLY);
+ ast_clear_flag(ast_channel_flags(c), AST_FLAG_END_DTMF_ONLY);
return res;
case AST_FRAME_CONTROL:
switch (f->subclass.integer) {
case AST_CONTROL_HANGUP:
ast_frfree(f);
- ast_clear_flag(c, AST_FLAG_END_DTMF_ONLY);
+ ast_clear_flag(ast_channel_flags(c), AST_FLAG_END_DTMF_ONLY);
return -1;
case AST_CONTROL_RINGING:
case AST_CONTROL_ANSWER:
@@ -3436,7 +3411,7 @@ int ast_waitfordigit_full(struct ast_channel *c, int ms, int audiofd, int cmdfd)
}
}
- ast_clear_flag(c, AST_FLAG_END_DTMF_ONLY);
+ ast_clear_flag(ast_channel_flags(c), AST_FLAG_END_DTMF_ONLY);
return 0; /* Time is up */
}
@@ -3462,7 +3437,7 @@ static void ast_read_generator_actions(struct ast_channel *chan, struct ast_fram
int res;
int samples;
- if (chan->timingfunc) {
+ if (ast_channel_timingfunc(chan)) {
ast_debug(1, "Generator got voice, switching to phase locked mode\n");
ast_settimeout(chan, 0, NULL, NULL);
}
@@ -3495,7 +3470,7 @@ static void ast_read_generator_actions(struct ast_channel *chan, struct ast_fram
}
} else if (f->frametype == AST_FRAME_CNG) {
- if (ast_channel_generator(chan) && !chan->timingfunc && (ast_channel_timingfd(chan) > -1)) {
+ if (ast_channel_generator(chan) && !ast_channel_timingfunc(chan) && (ast_channel_timingfd(chan) > -1)) {
ast_debug(1, "Generator got CNG, switching to timed mode\n");
ast_settimeout(chan, 50, generator_force, chan);
}
@@ -3522,7 +3497,7 @@ static inline void queue_dtmf_readq(struct ast_channel *chan, struct ast_frame *
*/
static inline int should_skip_dtmf(struct ast_channel *chan)
{
- if (ast_test_flag(chan, AST_FLAG_DEFER_DTMF | AST_FLAG_EMULATE_DTMF)) {
+ if (ast_test_flag(ast_channel_flags(chan), AST_FLAG_DEFER_DTMF | AST_FLAG_EMULATE_DTMF)) {
/* We're in the middle of emulating a digit, or DTMF has been
* explicitly deferred. Skip this digit, then. */
return 1;
@@ -3582,7 +3557,7 @@ static struct ast_frame *__ast_read(struct ast_channel *chan, int dropaudio)
ast_channel_lock(chan);
/* Stop if we're a zombie or need a soft hangup */
- if (ast_test_flag(chan, AST_FLAG_ZOMBIE) || ast_check_hangup(chan)) {
+ if (ast_test_flag(ast_channel_flags(chan), AST_FLAG_ZOMBIE) || ast_check_hangup(chan)) {
if (ast_channel_generator(chan))
ast_deactivate_generator(chan);
@@ -3627,7 +3602,7 @@ static struct ast_frame *__ast_read(struct ast_channel *chan, int dropaudio)
if (ast_channel_timingfd(chan) > -1 && ast_channel_fdno(chan) == AST_TIMING_FD) {
enum ast_timer_event res;
- ast_clear_flag(chan, AST_FLAG_EXCEPTION);
+ ast_clear_flag(ast_channel_flags(chan), AST_FLAG_EXCEPTION);
res = ast_timer_get_event(ast_channel_timer(chan));
@@ -3635,9 +3610,9 @@ static struct ast_frame *__ast_read(struct ast_channel *chan, int dropaudio)
case AST_TIMING_EVENT_EXPIRED:
ast_timer_ack(ast_channel_timer(chan), 1);
- if (chan->timingfunc) {
+ if (ast_channel_timingfunc(chan)) {
/* save a copy of func/data before unlocking the channel */
- int (*func)(const void *) = chan->timingfunc;
+ ast_timing_func_t func = ast_channel_timingfunc(chan);
void *data = ast_channel_timingdata(chan);
ast_channel_fdno_set(chan, -1);
ast_channel_unlock(chan);
@@ -3671,7 +3646,7 @@ static struct ast_frame *__ast_read(struct ast_channel *chan, int dropaudio)
ast_channel_fdno_set(chan, -1);
goto done;
} else if (ast_channel_fd_isset(chan, AST_JITTERBUFFER_FD) && ast_channel_fdno(chan) == AST_JITTERBUFFER_FD) {
- ast_clear_flag(chan, AST_FLAG_EXCEPTION);
+ ast_clear_flag(ast_channel_flags(chan), AST_FLAG_EXCEPTION);
}
/* Read and ignore anything on the alertpipe, but read only
@@ -3722,8 +3697,8 @@ static struct ast_frame *__ast_read(struct ast_channel *chan, int dropaudio)
}
}
} else {
- chan->blocker = pthread_self();
- if (ast_test_flag(chan, AST_FLAG_EXCEPTION)) {
+ ast_channel_blocker_set(chan, pthread_self());
+ if (ast_test_flag(ast_channel_flags(chan), AST_FLAG_EXCEPTION)) {
if (ast_channel_tech(chan)->exception)
f = ast_channel_tech(chan)->exception(chan);
else {
@@ -3731,7 +3706,7 @@ static struct ast_frame *__ast_read(struct ast_channel *chan, int dropaudio)
f = &ast_null_frame;
}
/* Clear the exception flag */
- ast_clear_flag(chan, AST_FLAG_EXCEPTION);
+ ast_clear_flag(ast_channel_flags(chan), AST_FLAG_EXCEPTION);
} else if (ast_channel_tech(chan) && ast_channel_tech(chan)->read)
f = ast_channel_tech(chan)->read(chan);
else
@@ -3765,7 +3740,7 @@ static struct ast_frame *__ast_read(struct ast_channel *chan, int dropaudio)
switch (f->frametype) {
case AST_FRAME_CONTROL:
if (f->subclass.integer == AST_CONTROL_ANSWER) {
- if (!ast_test_flag(chan, AST_FLAG_OUTGOING)) {
+ if (!ast_test_flag(ast_channel_flags(chan), AST_FLAG_OUTGOING)) {
ast_debug(1, "Ignoring answer on an inbound call!\n");
ast_frfree(f);
f = &ast_null_frame;
@@ -3807,11 +3782,11 @@ static struct ast_frame *__ast_read(struct ast_channel *chan, int dropaudio)
send_dtmf_event(chan, "Received", f->subclass.integer, "No", "Yes");
ast_log(LOG_DTMF, "DTMF end '%c' received on %s, duration %ld ms\n", f->subclass.integer, ast_channel_name(chan), f->len);
/* Queue it up if DTMF is deferred, or if DTMF emulation is forced. */
- if (ast_test_flag(chan, AST_FLAG_DEFER_DTMF) || ast_test_flag(chan, AST_FLAG_EMULATE_DTMF)) {
+ if (ast_test_flag(ast_channel_flags(chan), AST_FLAG_DEFER_DTMF) || ast_test_flag(ast_channel_flags(chan), AST_FLAG_EMULATE_DTMF)) {
queue_dtmf_readq(chan, f);
ast_frfree(f);
f = &ast_null_frame;
- } else if (!ast_test_flag(chan, AST_FLAG_IN_DTMF | AST_FLAG_END_DTMF_ONLY)) {
+ } else if (!ast_test_flag(ast_channel_flags(chan), AST_FLAG_IN_DTMF | AST_FLAG_END_DTMF_ONLY)) {
if (!ast_tvzero(*ast_channel_dtmf_tv(chan)) &&
ast_tvdiff_ms(ast_tvnow(), *ast_channel_dtmf_tv(chan)) < AST_MIN_DTMF_GAP) {
/* If it hasn't been long enough, defer this digit */
@@ -3822,7 +3797,7 @@ static struct ast_frame *__ast_read(struct ast_channel *chan, int dropaudio)
/* There was no begin, turn this into a begin and send the end later */
struct timeval tv = ast_tvnow();
f->frametype = AST_FRAME_DTMF_BEGIN;
- ast_set_flag(chan, AST_FLAG_EMULATE_DTMF);
+ ast_set_flag(ast_channel_flags(chan), AST_FLAG_EMULATE_DTMF);
ast_channel_dtmf_digit_to_emulate_set(chan, f->subclass.integer);
ast_channel_dtmf_tv_set(chan, &tv);
if (f->len) {
@@ -3845,9 +3820,9 @@ static struct ast_frame *__ast_read(struct ast_channel *chan, int dropaudio)
}
} else {
struct timeval now = ast_tvnow();
- if (ast_test_flag(chan, AST_FLAG_IN_DTMF)) {
+ if (ast_test_flag(ast_channel_flags(chan), AST_FLAG_IN_DTMF)) {
ast_log(LOG_DTMF, "DTMF end accepted with begin '%c' on %s\n", f->subclass.integer, ast_channel_name(chan));
- ast_clear_flag(chan, AST_FLAG_IN_DTMF);
+ ast_clear_flag(ast_channel_flags(chan), AST_FLAG_IN_DTMF);
if (!f->len)
f->len = ast_tvdiff_ms(now, *ast_channel_dtmf_tv(chan));
@@ -3867,9 +3842,9 @@ static struct ast_frame *__ast_read(struct ast_channel *chan, int dropaudio)
ast_log(LOG_DTMF, "DTMF end accepted without begin '%c' on %s\n", f->subclass.integer, ast_channel_name(chan));
f->len = AST_MIN_DTMF_DURATION;
}
- if (f->len < AST_MIN_DTMF_DURATION && !ast_test_flag(chan, AST_FLAG_END_DTMF_ONLY)) {
+ if (f->len < AST_MIN_DTMF_DURATION && !ast_test_flag(ast_channel_flags(chan), AST_FLAG_END_DTMF_ONLY)) {
ast_log(LOG_DTMF, "DTMF end '%c' has duration %ld but want minimum %d, emulating on %s\n", f->subclass.integer, f->len, AST_MIN_DTMF_DURATION, ast_channel_name(chan));
- ast_set_flag(chan, AST_FLAG_EMULATE_DTMF);
+ ast_set_flag(ast_channel_flags(chan), AST_FLAG_EMULATE_DTMF);
ast_channel_dtmf_digit_to_emulate_set(chan, f->subclass.integer);
ast_channel_emulate_dtmf_duration_set(chan, AST_MIN_DTMF_DURATION - f->len);
ast_frfree(f);
@@ -3892,7 +3867,7 @@ static struct ast_frame *__ast_read(struct ast_channel *chan, int dropaudio)
case AST_FRAME_DTMF_BEGIN:
send_dtmf_event(chan, "Received", f->subclass.integer, "Yes", "No");
ast_log(LOG_DTMF, "DTMF begin '%c' received on %s\n", f->subclass.integer, ast_channel_name(chan));
- if ( ast_test_flag(chan, AST_FLAG_DEFER_DTMF | AST_FLAG_END_DTMF_ONLY | AST_FLAG_EMULATE_DTMF) ||
+ if (ast_test_flag(ast_channel_flags(chan), AST_FLAG_DEFER_DTMF | AST_FLAG_END_DTMF_ONLY | AST_FLAG_EMULATE_DTMF) ||
(!ast_tvzero(*ast_channel_dtmf_tv(chan)) &&
ast_tvdiff_ms(ast_tvnow(), *ast_channel_dtmf_tv(chan)) < AST_MIN_DTMF_GAP) ) {
ast_log(LOG_DTMF, "DTMF begin ignored '%c' on %s\n", f->subclass.integer, ast_channel_name(chan));
@@ -3900,7 +3875,7 @@ static struct ast_frame *__ast_read(struct ast_channel *chan, int dropaudio)
f = &ast_null_frame;
} else {
struct timeval now = ast_tvnow();
- ast_set_flag(chan, AST_FLAG_IN_DTMF);
+ ast_set_flag(ast_channel_flags(chan), AST_FLAG_IN_DTMF);
ast_channel_dtmf_tv_set(chan, &now);
ast_log(LOG_DTMF, "DTMF begin passthrough '%c' on %s\n", f->subclass.integer, ast_channel_name(chan));
}
@@ -3910,10 +3885,10 @@ static struct ast_frame *__ast_read(struct ast_channel *chan, int dropaudio)
* is reached , because we want to make sure we pass at least one
* voice frame through before starting the next digit, to ensure a gap
* between DTMF digits. */
- if (ast_test_flag(chan, AST_FLAG_EMULATE_DTMF)) {
+ if (ast_test_flag(ast_channel_flags(chan), AST_FLAG_EMULATE_DTMF)) {
struct timeval now = ast_tvnow();
if (!ast_channel_emulate_dtmf_duration(chan)) {
- ast_clear_flag(chan, AST_FLAG_EMULATE_DTMF);
+ ast_clear_flag(ast_channel_flags(chan), AST_FLAG_EMULATE_DTMF);
ast_channel_dtmf_digit_to_emulate_set(chan, 0);
} else if (ast_tvdiff_ms(now, *ast_channel_dtmf_tv(chan)) >= ast_channel_emulate_dtmf_duration(chan)) {
ast_channel_emulate_dtmf_duration_set(chan, 0);
@@ -3923,7 +3898,7 @@ static struct ast_frame *__ast_read(struct ast_channel *chan, int dropaudio)
f->subclass.integer = ast_channel_dtmf_digit_to_emulate(chan);
f->len = ast_tvdiff_ms(now, *ast_channel_dtmf_tv(chan));
ast_channel_dtmf_tv_set(chan, &now);
- ast_clear_flag(chan, AST_FLAG_EMULATE_DTMF);
+ ast_clear_flag(ast_channel_flags(chan), AST_FLAG_EMULATE_DTMF);
ast_channel_dtmf_digit_to_emulate_set(chan, 0);
ast_log(LOG_DTMF, "DTMF end emulation of '%c' queued on %s\n", f->subclass.integer, ast_channel_name(chan));
if (ast_channel_audiohooks(chan)) {
@@ -3941,19 +3916,19 @@ static struct ast_frame *__ast_read(struct ast_channel *chan, int dropaudio)
* is reached , because we want to make sure we pass at least one
* voice frame through before starting the next digit, to ensure a gap
* between DTMF digits. */
- if (ast_test_flag(chan, AST_FLAG_EMULATE_DTMF) && !ast_channel_emulate_dtmf_duration(chan)) {
- ast_clear_flag(chan, AST_FLAG_EMULATE_DTMF);
+ if (ast_test_flag(ast_channel_flags(chan), AST_FLAG_EMULATE_DTMF) && !ast_channel_emulate_dtmf_duration(chan)) {
+ ast_clear_flag(ast_channel_flags(chan), AST_FLAG_EMULATE_DTMF);
ast_channel_dtmf_digit_to_emulate_set(chan, 0);
}
- if (dropaudio || ast_test_flag(chan, AST_FLAG_IN_DTMF)) {
+ if (dropaudio || ast_test_flag(ast_channel_flags(chan), AST_FLAG_IN_DTMF)) {
if (dropaudio)
ast_read_generator_actions(chan, f);
ast_frfree(f);
f = &ast_null_frame;
}
- if (ast_test_flag(chan, AST_FLAG_EMULATE_DTMF) && !ast_test_flag(chan, AST_FLAG_IN_DTMF)) {
+ if (ast_test_flag(ast_channel_flags(chan), AST_FLAG_EMULATE_DTMF) && !ast_test_flag(ast_channel_flags(chan), AST_FLAG_IN_DTMF)) {
struct timeval now = ast_tvnow();
if (ast_tvdiff_ms(now, *ast_channel_dtmf_tv(chan)) >= ast_channel_emulate_dtmf_duration(chan)) {
ast_channel_emulate_dtmf_duration_set(chan, 0);
@@ -4162,7 +4137,7 @@ int ast_indicate_data(struct ast_channel *chan, int _condition,
ast_channel_lock(chan);
/* Don't bother if the channel is about to go away, anyway. */
- if (ast_test_flag(chan, AST_FLAG_ZOMBIE) || ast_check_hangup(chan)) {
+ if (ast_test_flag(ast_channel_flags(chan), AST_FLAG_ZOMBIE) || ast_check_hangup(chan)) {
res = -1;
goto indicate_cleanup;
}
@@ -4388,7 +4363,7 @@ int ast_sendtext(struct ast_channel *chan, const char *text)
ast_channel_lock(chan);
/* Stop if we're a zombie or need a soft hangup */
- if (ast_test_flag(chan, AST_FLAG_ZOMBIE) || ast_check_hangup(chan)) {
+ if (ast_test_flag(ast_channel_flags(chan), AST_FLAG_ZOMBIE) || ast_check_hangup(chan)) {
ast_channel_unlock(chan);
return -1;
}
@@ -4415,7 +4390,7 @@ int ast_sendtext(struct ast_channel *chan, const char *text)
} else if (ast_channel_tech(chan)->send_text) {
res = ast_channel_tech(chan)->send_text(chan, text);
}
- ast_clear_flag(chan, AST_FLAG_BLOCKING);
+ ast_clear_flag(ast_channel_flags(chan), AST_FLAG_BLOCKING);
ast_channel_unlock(chan);
return res;
}
@@ -4636,7 +4611,7 @@ int ast_write(struct ast_channel *chan, struct ast_frame *fr)
usleep(1);
}
/* Stop if we're a zombie or need a soft hangup */
- if (ast_test_flag(chan, AST_FLAG_ZOMBIE) || ast_check_hangup(chan))
+ if (ast_test_flag(ast_channel_flags(chan), AST_FLAG_ZOMBIE) || ast_check_hangup(chan))
goto done;
/* Handle any pending masquerades */
@@ -4661,14 +4636,14 @@ int ast_write(struct ast_channel *chan, struct ast_frame *fr)
}
if (ast_channel_generatordata(chan) && (!fr->src || strcasecmp(fr->src, "ast_prod"))) {
- if (ast_test_flag(chan, AST_FLAG_WRITE_INT)) {
+ if (ast_test_flag(ast_channel_flags(chan), AST_FLAG_WRITE_INT)) {
ast_deactivate_generator(chan);
} else {
if (fr->frametype == AST_FRAME_DTMF_END) {
/* There is a generator running while we're in the middle of a digit.
* It's probably inband DTMF, so go ahead and pass it so it can
* stop the generator */
- ast_clear_flag(chan, AST_FLAG_BLOCKING);
+ ast_clear_flag(ast_channel_flags(chan), AST_FLAG_BLOCKING);
ast_channel_unlock(chan);
res = ast_senddigit_end(chan, fr->subclass.integer, fr->len);
ast_channel_lock(chan);
@@ -4699,7 +4674,7 @@ int ast_write(struct ast_channel *chan, struct ast_frame *fr)
f = fr;
}
send_dtmf_event(chan, "Sent", fr->subclass.integer, "Yes", "No");
- ast_clear_flag(chan, AST_FLAG_BLOCKING);
+ ast_clear_flag(ast_channel_flags(chan), AST_FLAG_BLOCKING);
ast_channel_unlock(chan);
res = ast_senddigit_begin(chan, fr->subclass.integer);
ast_channel_lock(chan);
@@ -4715,7 +4690,7 @@ int ast_write(struct ast_channel *chan, struct ast_frame *fr)
}
}
send_dtmf_event(chan, "Sent", fr->subclass.integer, "No", "Yes");
- ast_clear_flag(chan, AST_FLAG_BLOCKING);
+ ast_clear_flag(ast_channel_flags(chan), AST_FLAG_BLOCKING);
ast_channel_unlock(chan);
res = ast_senddigit_end(chan, fr->subclass.integer, fr->len);
ast_channel_lock(chan);
@@ -4908,7 +4883,7 @@ int ast_write(struct ast_channel *chan, struct ast_frame *fr)
if (f && f != fr)
ast_frfree(f);
- ast_clear_flag(chan, AST_FLAG_BLOCKING);
+ ast_clear_flag(ast_channel_flags(chan), AST_FLAG_BLOCKING);
/* Consider a write failure to force a soft hangup */
if (res < 0) {
@@ -5208,7 +5183,7 @@ static void handle_cause(int cause, int *outstate)
*/
static void call_forward_inherit(struct ast_channel *new_chan, struct ast_channel *parent, struct ast_channel *orig)
{
- if (!ast_test_flag(parent, AST_FLAG_ZOMBIE) && !ast_check_hangup(parent)) {
+ if (!ast_test_flag(ast_channel_flags(parent), AST_FLAG_ZOMBIE) && !ast_check_hangup(parent)) {
struct ast_party_redirecting redirecting;
/*
@@ -5633,13 +5608,13 @@ int ast_call(struct ast_channel *chan, const char *addr, int timeout)
int res = -1;
/* Stop if we're a zombie or need a soft hangup */
ast_channel_lock(chan);
- if (!ast_test_flag(chan, AST_FLAG_ZOMBIE) && !ast_check_hangup(chan)) {
+ if (!ast_test_flag(ast_channel_flags(chan), AST_FLAG_ZOMBIE) && !ast_check_hangup(chan)) {
if (ast_channel_cdr(chan)) {
ast_set_flag(ast_channel_cdr(chan), AST_CDR_FLAG_DIALED);
}
if (ast_channel_tech(chan)->call)
res = ast_channel_tech(chan)->call(chan, addr, timeout);
- ast_set_flag(chan, AST_FLAG_OUTGOING);
+ ast_set_flag(ast_channel_flags(chan), AST_FLAG_OUTGOING);
}
ast_channel_unlock(chan);
return res;
@@ -5658,7 +5633,7 @@ int ast_transfer(struct ast_channel *chan, char *dest)
/* Stop if we're a zombie or need a soft hangup */
ast_channel_lock(chan);
- if (!ast_test_flag(chan, AST_FLAG_ZOMBIE) && !ast_check_hangup(chan)) {
+ if (!ast_test_flag(ast_channel_flags(chan), AST_FLAG_ZOMBIE) && !ast_check_hangup(chan)) {
if (ast_channel_tech(chan)->transfer) {
res = ast_channel_tech(chan)->transfer(chan, dest);
if (!res)
@@ -5714,7 +5689,7 @@ int ast_readstring_full(struct ast_channel *c, char *s, int len, int timeout, in
struct ast_silence_generator *silgen = NULL;
/* Stop if we're a zombie or need a soft hangup */
- if (ast_test_flag(c, AST_FLAG_ZOMBIE) || ast_check_hangup(c))
+ if (ast_test_flag(ast_channel_flags(c), AST_FLAG_ZOMBIE) || ast_check_hangup(c))
return -1;
if (!len)
return -1;
@@ -5870,8 +5845,8 @@ static int __ast_channel_masquerade(struct ast_channel *original, struct ast_cha
ast_channel_lock_both(original, clonechan);
- if (ast_test_flag(original, AST_FLAG_ZOMBIE)
- || ast_test_flag(clonechan, AST_FLAG_ZOMBIE)) {
+ if (ast_test_flag(ast_channel_flags(original), AST_FLAG_ZOMBIE)
+ || ast_test_flag(ast_channel_flags(clonechan), AST_FLAG_ZOMBIE)) {
/* Zombies! Run! */
ast_log(LOG_WARNING,
"Can't setup masquerade. One or both channels is dead. (%s <-- %s)\n",
@@ -5886,15 +5861,15 @@ static int __ast_channel_masquerade(struct ast_channel *original, struct ast_cha
* (i.e. chan_agent) and if so, we don't really want to
* masquerade it, but its proxy
*/
- if (original->_bridge
- && (original->_bridge != ast_bridged_channel(original))
- && (original->_bridge->_bridge != original)) {
- final_orig = original->_bridge;
+ if (ast_channel_internal_bridged_channel(original)
+ && (ast_channel_internal_bridged_channel(original) != ast_bridged_channel(original))
+ && (ast_channel_internal_bridged_channel(ast_channel_internal_bridged_channel(original)) != original)) {
+ final_orig = ast_channel_internal_bridged_channel(original);
}
- if (clonechan->_bridge
- && (clonechan->_bridge != ast_bridged_channel(clonechan))
- && (clonechan->_bridge->_bridge != clonechan)) {
- final_clone = clonechan->_bridge;
+ if (ast_channel_internal_bridged_channel(clonechan)
+ && (ast_channel_internal_bridged_channel(clonechan) != ast_bridged_channel(clonechan))
+ && (ast_channel_internal_bridged_channel(ast_channel_internal_bridged_channel(clonechan)) != clonechan)) {
+ final_clone = ast_channel_internal_bridged_channel(clonechan);
}
if (ast_channel_tech(final_clone)->get_base_channel
&& (base = ast_channel_tech(final_clone)->get_base_channel(final_clone))) {
@@ -5927,8 +5902,8 @@ static int __ast_channel_masquerade(struct ast_channel *original, struct ast_cha
original = final_orig;
clonechan = final_clone;
- if (ast_test_flag(original, AST_FLAG_ZOMBIE)
- || ast_test_flag(clonechan, AST_FLAG_ZOMBIE)) {
+ if (ast_test_flag(ast_channel_flags(original), AST_FLAG_ZOMBIE)
+ || ast_test_flag(ast_channel_flags(clonechan), AST_FLAG_ZOMBIE)) {
/* Zombies! Run! */
ast_log(LOG_WARNING,
"Can't setup masquerade. One or both channels is dead. (%s <-- %s)\n",
@@ -6263,14 +6238,14 @@ void ast_channel_set_linkgroup(struct ast_channel *chan, struct ast_channel *pee
linkedid = oldest_linkedid(ast_channel_linkedid(chan), ast_channel_linkedid(peer));
linkedid = oldest_linkedid(linkedid, ast_channel_uniqueid(chan));
linkedid = oldest_linkedid(linkedid, ast_channel_uniqueid(peer));
- if (chan->_bridge) {
+ if (ast_channel_internal_bridged_channel(chan)) {
bridged = ast_bridged_channel(chan);
if (bridged != peer) {
linkedid = oldest_linkedid(linkedid, ast_channel_linkedid(bridged));
linkedid = oldest_linkedid(linkedid, ast_channel_uniqueid(bridged));
}
}
- if (peer->_bridge) {
+ if (ast_channel_internal_bridged_channel(peer)) {
bridged = ast_bridged_channel(peer);
if (bridged != chan) {
linkedid = oldest_linkedid(linkedid, ast_channel_linkedid(bridged));
@@ -6283,13 +6258,13 @@ void ast_channel_set_linkgroup(struct ast_channel *chan, struct ast_channel *pee
ast_channel_change_linkedid(chan, linkedid);
ast_channel_change_linkedid(peer, linkedid);
- if (chan->_bridge) {
+ if (ast_channel_internal_bridged_channel(chan)) {
bridged = ast_bridged_channel(chan);
if (bridged != peer) {
ast_channel_change_linkedid(bridged, linkedid);
}
}
- if (peer->_bridge) {
+ if (ast_channel_internal_bridged_channel(peer)) {
bridged = ast_bridged_channel(peer);
if (bridged != chan) {
ast_channel_change_linkedid(bridged, linkedid);
@@ -6684,7 +6659,7 @@ int ast_do_masquerade(struct ast_channel *original)
/* XXX What about blocking, softhangup, blocker, and lock and blockproc? XXX */
/* Application and data remain the same */
/* Clone exception becomes real one, as with fdno */
- ast_set_flag(original, ast_test_flag(clonechan, AST_FLAG_EXCEPTION | AST_FLAG_OUTGOING));
+ ast_set_flag(ast_channel_flags(original), ast_test_flag(ast_channel_flags(clonechan), AST_FLAG_EXCEPTION | AST_FLAG_OUTGOING));
ast_channel_fdno_set(original, ast_channel_fdno(clonechan));
/* Schedule context remains the same */
/* Stream stuff stays the same */
@@ -6732,9 +6707,9 @@ int ast_do_masquerade(struct ast_channel *original)
/* copy over accuntcode and set peeraccount across the bridge */
ast_channel_accountcode_set(original, S_OR(ast_channel_accountcode(clonechan), ""));
- if (original->_bridge) {
- /* XXX - should we try to lock original->_bridge here? */
- ast_channel_peeraccount_set(original->_bridge, S_OR(ast_channel_accountcode(clonechan), ""));
+ if (ast_channel_internal_bridged_channel(original)) {
+ /* XXX - should we try to lock original's bridged channel here? */
+ ast_channel_peeraccount_set(ast_channel_internal_bridged_channel(original), S_OR(ast_channel_accountcode(clonechan), ""));
ast_cel_report_event(original, AST_CEL_BRIDGE_UPDATE, NULL, NULL, NULL);
}
@@ -6769,7 +6744,7 @@ int ast_do_masquerade(struct ast_channel *original)
/* Now, at this point, the "clone" channel is totally F'd up. We mark it as
a zombie so nothing tries to touch it. If it's already been marked as a
zombie, then free it now (since it already is considered invalid). */
- if (ast_test_flag(clonechan, AST_FLAG_ZOMBIE)) {
+ if (ast_test_flag(ast_channel_flags(clonechan), AST_FLAG_ZOMBIE)) {
ast_debug(1, "Destroying channel clone '%s'\n", ast_channel_name(clonechan));
ast_channel_unlock(clonechan);
ast_manager_event(clonechan, EVENT_FLAG_CALL, "Hangup",
@@ -6785,13 +6760,13 @@ int ast_do_masquerade(struct ast_channel *original)
clonechan = ast_channel_release(clonechan);
} else {
ast_debug(1, "Released clone lock on '%s'\n", ast_channel_name(clonechan));
- ast_set_flag(clonechan, AST_FLAG_ZOMBIE);
+ ast_set_flag(ast_channel_flags(clonechan), AST_FLAG_ZOMBIE);
ast_queue_frame(clonechan, &ast_null_frame);
}
/* Signal any blocker */
- if (ast_test_flag(original, AST_FLAG_BLOCKING))
- pthread_kill(original->blocker, SIGURG);
+ if (ast_test_flag(ast_channel_flags(original), AST_FLAG_BLOCKING))
+ pthread_kill(ast_channel_blocker(original), SIGURG);
ast_debug(1, "Done Masquerading %s (%d)\n", ast_channel_name(original), ast_channel_state(original));
if ((bridged = ast_bridged_channel(original))) {
@@ -6942,7 +6917,7 @@ int ast_setstate(struct ast_channel *chan, enum ast_channel_state state)
struct ast_channel *ast_bridged_channel(struct ast_channel *chan)
{
struct ast_channel *bridged;
- bridged = chan->_bridge;
+ bridged = ast_channel_internal_bridged_channel(chan);
if (bridged && ast_channel_tech(bridged)->bridged_channel)
bridged = ast_channel_tech(bridged)->bridged_channel(chan, bridged);
return bridged;
@@ -7086,8 +7061,8 @@ static enum ast_bridge_result ast_generic_bridge(struct ast_channel *c0, struct
if (ast_channel_softhangup_internal_flag(c1) & AST_SOFTHANGUP_UNBRIDGE) {
ast_channel_clear_softhangup(c1, AST_SOFTHANGUP_UNBRIDGE);
}
- c0->_bridge = c1;
- c1->_bridge = c0;
+ ast_channel_internal_bridged_channel_set(c0, c1);
+ ast_channel_internal_bridged_channel_set(c1, c0);
}
continue;
}
@@ -7307,20 +7282,20 @@ enum ast_bridge_result ast_channel_bridge(struct ast_channel *c0, struct ast_cha
*fo = NULL;
- if (c0->_bridge) {
+ if (ast_channel_internal_bridged_channel(c0)) {
ast_log(LOG_WARNING, "%s is already in a bridge with %s\n",
- ast_channel_name(c0), ast_channel_name(c0->_bridge));
+ ast_channel_name(c0), ast_channel_name(ast_channel_internal_bridged_channel(c0)));
return -1;
}
- if (c1->_bridge) {
+ if (ast_channel_internal_bridged_channel(c1)) {
ast_log(LOG_WARNING, "%s is already in a bridge with %s\n",
- ast_channel_name(c1), ast_channel_name(c1->_bridge));
+ ast_channel_name(c1), ast_channel_name(ast_channel_internal_bridged_channel(c1)));
return -1;
}
/* Stop if we're a zombie or need a soft hangup */
- if (ast_test_flag(c0, AST_FLAG_ZOMBIE) || ast_check_hangup_locked(c0) ||
- ast_test_flag(c1, AST_FLAG_ZOMBIE) || ast_check_hangup_locked(c1))
+ if (ast_test_flag(ast_channel_flags(c0), AST_FLAG_ZOMBIE) || ast_check_hangup_locked(c0) ||
+ ast_test_flag(ast_channel_flags(c1), AST_FLAG_ZOMBIE) || ast_check_hangup_locked(c1))
return -1;
o0nativeformats = ast_format_cap_dup(ast_channel_nativeformats(c0));
@@ -7348,8 +7323,8 @@ enum ast_bridge_result ast_channel_bridge(struct ast_channel *c0, struct ast_cha
}
/* Keep track of bridge */
- c0->_bridge = c1;
- c1->_bridge = c0;
+ ast_channel_internal_bridged_channel_set(c0, c1);
+ ast_channel_internal_bridged_channel_set(c1, c0);
ast_set_owners_and_peers(c0, c1);
@@ -7375,9 +7350,9 @@ enum ast_bridge_result ast_channel_bridge(struct ast_channel *c0, struct ast_cha
}
if (!ast_channel_tech(c0)->send_digit_begin)
- ast_set_flag(c1, AST_FLAG_END_DTMF_ONLY);
+ ast_set_flag(ast_channel_flags(c1), AST_FLAG_END_DTMF_ONLY);
if (!ast_channel_tech(c1)->send_digit_begin)
- ast_set_flag(c0, AST_FLAG_END_DTMF_ONLY);
+ ast_set_flag(ast_channel_flags(c0), AST_FLAG_END_DTMF_ONLY);
manager_bridge_event(1, 1, c0, c1);
/* Before we enter in and bridge these two together tell them both the source of audio has changed */
@@ -7442,22 +7417,22 @@ enum ast_bridge_result ast_channel_bridge(struct ast_channel *c0, struct ast_cha
if (ast_channel_softhangup_internal_flag(c1) & AST_SOFTHANGUP_UNBRIDGE) {
ast_channel_clear_softhangup(c1, AST_SOFTHANGUP_UNBRIDGE);
}
- c0->_bridge = c1;
- c1->_bridge = c0;
+ ast_channel_internal_bridged_channel_set(c0, c1);
+ ast_channel_internal_bridged_channel_set(c1, c0);
ast_debug(1, "Unbridge signal received. Ending native bridge.\n");
continue;
}
/* Stop if we're a zombie or need a soft hangup */
- if (ast_test_flag(c0, AST_FLAG_ZOMBIE) || ast_check_hangup_locked(c0) ||
- ast_test_flag(c1, AST_FLAG_ZOMBIE) || ast_check_hangup_locked(c1)) {
+ if (ast_test_flag(ast_channel_flags(c0), AST_FLAG_ZOMBIE) || ast_check_hangup_locked(c0) ||
+ ast_test_flag(ast_channel_flags(c1), AST_FLAG_ZOMBIE) || ast_check_hangup_locked(c1)) {
*fo = NULL;
res = 0;
ast_debug(1, "Bridge stops because we're zombie or need a soft hangup: c0=%s, c1=%s, flags: %s,%s,%s,%s\n",
ast_channel_name(c0), ast_channel_name(c1),
- ast_test_flag(c0, AST_FLAG_ZOMBIE) ? "Yes" : "No",
+ ast_test_flag(ast_channel_flags(c0), AST_FLAG_ZOMBIE) ? "Yes" : "No",
ast_check_hangup(c0) ? "Yes" : "No",
- ast_test_flag(c1, AST_FLAG_ZOMBIE) ? "Yes" : "No",
+ ast_test_flag(ast_channel_flags(c1), AST_FLAG_ZOMBIE) ? "Yes" : "No",
ast_check_hangup(c1) ? "Yes" : "No");
break;
}
@@ -7476,27 +7451,27 @@ enum ast_bridge_result ast_channel_bridge(struct ast_channel *c0, struct ast_cha
!ast_channel_masq(c0) && !ast_channel_masqr(c0) && !ast_channel_masq(c1) && !ast_channel_masqr(c1)) {
int timeoutms = to - 1000 > 0 ? to - 1000 : to;
/* Looks like they share a bridge method and nothing else is in the way */
- ast_set_flag(c0, AST_FLAG_NBRIDGE);
- ast_set_flag(c1, AST_FLAG_NBRIDGE);
+ ast_set_flag(ast_channel_flags(c0), AST_FLAG_NBRIDGE);
+ ast_set_flag(ast_channel_flags(c1), AST_FLAG_NBRIDGE);
if ((res = ast_channel_tech(c0)->bridge(c0, c1, config->flags, fo, rc, timeoutms)) == AST_BRIDGE_COMPLETE) {
manager_bridge_event(0, 1, c0, c1);
ast_debug(1, "Returning from native bridge, channels: %s, %s\n", ast_channel_name(c0), ast_channel_name(c1));
- ast_clear_flag(c0, AST_FLAG_NBRIDGE);
- ast_clear_flag(c1, AST_FLAG_NBRIDGE);
+ ast_clear_flag(ast_channel_flags(c0), AST_FLAG_NBRIDGE);
+ ast_clear_flag(ast_channel_flags(c1), AST_FLAG_NBRIDGE);
if ((ast_channel_softhangup_internal_flag(c0) | ast_channel_softhangup_internal_flag(c1)) & AST_SOFTHANGUP_UNBRIDGE) {/* Bit operators are intentional. */
continue;
}
- c0->_bridge = NULL;
- c1->_bridge = NULL;
+ ast_channel_internal_bridged_channel_set(c0, NULL);
+ ast_channel_internal_bridged_channel_set(c1, NULL);
ast_format_cap_destroy(o0nativeformats);
ast_format_cap_destroy(o1nativeformats);
return res;
} else {
- ast_clear_flag(c0, AST_FLAG_NBRIDGE);
- ast_clear_flag(c1, AST_FLAG_NBRIDGE);
+ ast_clear_flag(ast_channel_flags(c0), AST_FLAG_NBRIDGE);
+ ast_clear_flag(ast_channel_flags(c1), AST_FLAG_NBRIDGE);
}
switch (res) {
case AST_BRIDGE_RETRY:
@@ -7540,15 +7515,15 @@ enum ast_bridge_result ast_channel_bridge(struct ast_channel *c0, struct ast_cha
}
}
- ast_clear_flag(c0, AST_FLAG_END_DTMF_ONLY);
- ast_clear_flag(c1, AST_FLAG_END_DTMF_ONLY);
+ ast_clear_flag(ast_channel_flags(c0), AST_FLAG_END_DTMF_ONLY);
+ ast_clear_flag(ast_channel_flags(c1), AST_FLAG_END_DTMF_ONLY);
/* Now that we have broken the bridge the source will change yet again */
ast_indicate(c0, AST_CONTROL_SRCUPDATE);
ast_indicate(c1, AST_CONTROL_SRCUPDATE);
- c0->_bridge = NULL;
- c1->_bridge = NULL;
+ ast_channel_internal_bridged_channel_set(c0, NULL);
+ ast_channel_internal_bridged_channel_set(c1, NULL);
manager_bridge_event(0, 1, c0, c1);
ast_debug(1, "Bridge stops bridging channels %s and %s\n", ast_channel_name(c0), ast_channel_name(c1));
@@ -7658,7 +7633,7 @@ static void *tonepair_alloc(struct ast_channel *chan, void *params)
ts->modulate = 0;
}
/* Let interrupts interrupt :) */
- ast_set_flag(chan, AST_FLAG_WRITE_INT);
+ ast_set_flag(ast_channel_flags(chan), AST_FLAG_WRITE_INT);
return ts;
}
diff --git a/main/channel_internal_api.c b/main/channel_internal_api.c
index 0a7060e29..4f89ca788 100644
--- a/main/channel_internal_api.c
+++ b/main/channel_internal_api.c
@@ -38,6 +38,154 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
#include "asterisk/stringfields.h"
#include "asterisk/data.h"
#include "asterisk/indications.h"
+#include "asterisk/channel_internal.h"
+
+/*!
+ * \brief Main Channel structure associated with a channel.
+ *
+ * \note XXX It is important to remember to increment .cleancount each time
+ * this structure is changed. XXX
+ *
+ * \note When adding fields to this structure, it is important to add the field
+ * 'in position' with like-aligned fields, so as to keep the compiler from
+ * having to add padding to align fields. The structure's fields are sorted
+ * in this order: pointers, structures, long, int/enum, short, char. This
+ * is especially important on 64-bit architectures, where mixing 4-byte
+ * and 8-byte fields causes 4 bytes of padding to be added before many
+ * 8-byte fields.
+ */
+struct ast_channel {
+ const struct ast_channel_tech *tech; /*!< Technology (point to channel driver) */
+ void *tech_pvt; /*!< Private data used by the technology driver */
+ void *music_state; /*!< Music State*/
+ void *generatordata; /*!< Current generator data if there is any */
+ struct ast_generator *generator; /*!< Current active data generator */
+ struct ast_channel * bridged_channel; /*!< Who are we bridged to, if we're bridged.
+ * Who is proxying for us, if we are proxied (i.e. chan_agent).
+ * Do not access directly, use ast_bridged_channel(chan) */
+ struct ast_channel *masq; /*!< Channel that will masquerade as us */
+ struct ast_channel *masqr; /*!< Who we are masquerading as */
+ const char *blockproc; /*!< Procedure causing blocking */
+ const char *appl; /*!< Current application */
+ const char *data; /*!< Data passed to current application */
+ struct ast_sched_context *sched; /*!< Schedule context */
+ struct ast_filestream *stream; /*!< Stream itself. */
+ struct ast_filestream *vstream; /*!< Video Stream itself. */
+ ast_timing_func_t timingfunc;
+ void *timingdata;
+ struct ast_pbx *pbx; /*!< PBX private structure for this channel */
+ struct ast_trans_pvt *writetrans; /*!< Write translation path */
+ struct ast_trans_pvt *readtrans; /*!< Read translation path */
+ struct ast_audiohook_list *audiohooks;
+ struct ast_framehook_list *framehooks;
+ struct ast_cdr *cdr; /*!< Call Detail Record */
+ struct ast_tone_zone *zone; /*!< Tone zone as set in indications.conf or
+ * in the CHANNEL dialplan function */
+ struct ast_channel_monitor *monitor; /*!< Channel monitoring */
+#ifdef HAVE_EPOLL
+ struct ast_epoll_data *epfd_data[AST_MAX_FDS];
+#endif
+
+ AST_DECLARE_STRING_FIELDS(
+ AST_STRING_FIELD(name); /*!< ASCII unique channel name */
+ AST_STRING_FIELD(language); /*!< Language requested for voice prompts */
+ AST_STRING_FIELD(musicclass); /*!< Default music class */
+ AST_STRING_FIELD(accountcode); /*!< Account code for billing */
+ AST_STRING_FIELD(peeraccount); /*!< Peer account code for billing */
+ AST_STRING_FIELD(userfield); /*!< Userfield for CEL billing */
+ AST_STRING_FIELD(call_forward); /*!< Where to forward to if asked to dial on this interface */
+ AST_STRING_FIELD(uniqueid); /*!< Unique Channel Identifier */
+ AST_STRING_FIELD(linkedid); /*!< Linked Channel Identifier -- gets propagated by linkage */
+ AST_STRING_FIELD(parkinglot); /*! Default parking lot, if empty, default parking lot */
+ AST_STRING_FIELD(hangupsource); /*! Who is responsible for hanging up this channel */
+ AST_STRING_FIELD(dialcontext); /*!< Dial: Extension context that we were called from */
+ );
+
+ struct timeval whentohangup; /*!< Non-zero, set to actual time when channel is to be hung up */
+ pthread_t blocker; /*!< If anyone is blocking, this is them */
+
+ /*!
+ * \brief Dialed/Called information.
+ * \note Set on incoming channels to indicate the originally dialed party.
+ * \note Dialed Number Identifier (DNID)
+ */
+ struct ast_party_dialed dialed;
+
+ /*!
+ * \brief Channel Caller ID information.
+ * \note The caller id information is the caller id of this
+ * channel when it is used to initiate a call.
+ */
+ struct ast_party_caller caller;
+
+ /*!
+ * \brief Channel Connected Line ID information.
+ * \note The connected line information identifies the channel
+ * connected/bridged to this channel.
+ */
+ struct ast_party_connected_line connected;
+
+ /*! \brief Redirecting/Diversion information */
+ struct ast_party_redirecting redirecting;
+
+ struct ast_frame dtmff; /*!< DTMF frame */
+ struct varshead varshead; /*!< A linked list for channel variables. See \ref AstChanVar */
+ ast_group_t callgroup; /*!< Call group for call pickups */
+ ast_group_t pickupgroup; /*!< Pickup group - which calls groups can be picked up? */
+ struct ast_readq_list readq;
+ struct ast_jb jb; /*!< The jitterbuffer state */
+ struct timeval dtmf_tv; /*!< The time that an in process digit began, or the last digit ended */
+ struct ast_datastore_list datastores; /*!< Data stores on the channel */
+ struct ast_autochan_list autochans; /*!< Autochans on the channel */
+ unsigned long insmpl; /*!< Track the read/written samples for monitor use */
+ unsigned long outsmpl; /*!< Track the read/written samples for monitor use */
+
+ int fds[AST_MAX_FDS]; /*!< File descriptors for channel -- Drivers will poll on
+ * these file descriptors, so at least one must be non -1.
+ * See \arg \ref AstFileDesc */
+ int softhangup; /*!< Whether or not we have been hung up... Do not set this value
+ * directly, use ast_softhangup() */
+ int fdno; /*!< Which fd had an event detected on */
+ int streamid; /*!< For streaming playback, the schedule ID */
+ int vstreamid; /*!< For streaming video playback, the schedule ID */
+ struct ast_format oldwriteformat; /*!< Original writer format */
+ int timingfd; /*!< Timing fd */
+ enum ast_channel_state state; /*!< State of line -- Don't write directly, use ast_setstate() */
+ int rings; /*!< Number of rings so far */
+ int priority; /*!< Dialplan: Current extension priority */
+ int macropriority; /*!< Macro: Current non-macro priority. See app_macro.c */
+ int amaflags; /*!< Set BEFORE PBX is started to determine AMA flags */
+ enum ast_channel_adsicpe adsicpe; /*!< Whether or not ADSI is detected on CPE */
+ unsigned int fin; /*!< Frames in counters. The high bit is a debug mask, so
+ * the counter is only in the remaining bits */
+ unsigned int fout; /*!< Frames out counters. The high bit is a debug mask, so
+ * the counter is only in the remaining bits */
+ int hangupcause; /*!< Why is the channel hanged up. See causes.h */
+ unsigned int finalized:1; /*!< Whether or not the channel has been successfully allocated */
+ struct ast_flags flags; /*!< channel flags of AST_FLAG_ type */
+ int alertpipe[2];
+ struct ast_format_cap *nativeformats; /*!< Kinds of data this channel can natively handle */
+ struct ast_format readformat; /*!< Requested read format (after translation) */
+ struct ast_format writeformat; /*!< Requested write format (after translation) */
+ struct ast_format rawreadformat; /*!< Raw read format (before translation) */
+ struct ast_format rawwriteformat; /*!< Raw write format (before translation) */
+ unsigned int emulate_dtmf_duration; /*!< Number of ms left to emulate DTMF for */
+#ifdef HAVE_EPOLL
+ int epfd;
+#endif
+ int visible_indication; /*!< Indication currently playing on the channel */
+
+ unsigned short transfercapability; /*!< ISDN Transfer Capability - AST_FLAG_DIGITAL is not enough */
+
+ struct ast_bridge *bridge; /*!< Bridge this channel is participating in */
+ struct ast_timer *timer; /*!< timer object that provided timingfd */
+
+ char context[AST_MAX_CONTEXT]; /*!< Dialplan: Current extension context */
+ char exten[AST_MAX_EXTENSION]; /*!< Dialplan: Current extension number */
+ char macrocontext[AST_MAX_CONTEXT]; /*!< Macro: Current non-macro context. See app_macro.c */
+ char macroexten[AST_MAX_EXTENSION]; /*!< Macro: Current non-macro extension. See app_macro.c */
+ char dtmf_digit_to_emulate; /*!< Digit being emulated */
+};
/* AST_DATA definitions, which will probably have to be re-thought since the channel will be opaque */
@@ -55,57 +203,57 @@ AST_DATA_STRUCTURE(ast_callerid, DATA_EXPORT_CALLERID);
#endif
#define DATA_EXPORT_CHANNEL(MEMBER) \
- MEMBER(ast_channel, __do_not_use_blockproc, AST_DATA_STRING) \
- MEMBER(ast_channel, __do_not_use_appl, AST_DATA_STRING) \
- MEMBER(ast_channel, __do_not_use_data, AST_DATA_STRING) \
- MEMBER(ast_channel, __do_not_use_name, AST_DATA_STRING) \
- MEMBER(ast_channel, __do_not_use_language, AST_DATA_STRING) \
- MEMBER(ast_channel, __do_not_use_musicclass, AST_DATA_STRING) \
- MEMBER(ast_channel, __do_not_use_accountcode, AST_DATA_STRING) \
- MEMBER(ast_channel, __do_not_use_peeraccount, AST_DATA_STRING) \
- MEMBER(ast_channel, __do_not_use_userfield, AST_DATA_STRING) \
- MEMBER(ast_channel, __do_not_use_call_forward, AST_DATA_STRING) \
- MEMBER(ast_channel, __do_not_use_uniqueid, AST_DATA_STRING) \
- MEMBER(ast_channel, __do_not_use_linkedid, AST_DATA_STRING) \
- MEMBER(ast_channel, __do_not_use_parkinglot, AST_DATA_STRING) \
- MEMBER(ast_channel, __do_not_use_hangupsource, AST_DATA_STRING) \
- MEMBER(ast_channel, __do_not_use_dialcontext, AST_DATA_STRING) \
- MEMBER(ast_channel, __do_not_use_rings, AST_DATA_INTEGER) \
- MEMBER(ast_channel, __do_not_use_priority, AST_DATA_INTEGER) \
- MEMBER(ast_channel, __do_not_use_macropriority, AST_DATA_INTEGER) \
- MEMBER(ast_channel, __do_not_use_adsicpe, AST_DATA_INTEGER) \
- MEMBER(ast_channel, __do_not_use_fin, AST_DATA_UNSIGNED_INTEGER) \
- MEMBER(ast_channel, __do_not_use_fout, AST_DATA_UNSIGNED_INTEGER) \
- MEMBER(ast_channel, __do_not_use_emulate_dtmf_duration, AST_DATA_UNSIGNED_INTEGER) \
- MEMBER(ast_channel, __do_not_use_visible_indication, AST_DATA_INTEGER) \
- MEMBER(ast_channel, __do_not_use_context, AST_DATA_STRING) \
- MEMBER(ast_channel, __do_not_use_exten, AST_DATA_STRING) \
- MEMBER(ast_channel, __do_not_use_macrocontext, AST_DATA_STRING) \
- MEMBER(ast_channel, __do_not_use_macroexten, AST_DATA_STRING)
+ MEMBER(ast_channel, blockproc, AST_DATA_STRING) \
+ MEMBER(ast_channel, appl, AST_DATA_STRING) \
+ MEMBER(ast_channel, data, AST_DATA_STRING) \
+ MEMBER(ast_channel, name, AST_DATA_STRING) \
+ MEMBER(ast_channel, language, AST_DATA_STRING) \
+ MEMBER(ast_channel, musicclass, AST_DATA_STRING) \
+ MEMBER(ast_channel, accountcode, AST_DATA_STRING) \
+ MEMBER(ast_channel, peeraccount, AST_DATA_STRING) \
+ MEMBER(ast_channel, userfield, AST_DATA_STRING) \
+ MEMBER(ast_channel, call_forward, AST_DATA_STRING) \
+ MEMBER(ast_channel, uniqueid, AST_DATA_STRING) \
+ MEMBER(ast_channel, linkedid, AST_DATA_STRING) \
+ MEMBER(ast_channel, parkinglot, AST_DATA_STRING) \
+ MEMBER(ast_channel, hangupsource, AST_DATA_STRING) \
+ MEMBER(ast_channel, dialcontext, AST_DATA_STRING) \
+ MEMBER(ast_channel, rings, AST_DATA_INTEGER) \
+ MEMBER(ast_channel, priority, AST_DATA_INTEGER) \
+ MEMBER(ast_channel, macropriority, AST_DATA_INTEGER) \
+ MEMBER(ast_channel, adsicpe, AST_DATA_INTEGER) \
+ MEMBER(ast_channel, fin, AST_DATA_UNSIGNED_INTEGER) \
+ MEMBER(ast_channel, fout, AST_DATA_UNSIGNED_INTEGER) \
+ MEMBER(ast_channel, emulate_dtmf_duration, AST_DATA_UNSIGNED_INTEGER) \
+ MEMBER(ast_channel, visible_indication, AST_DATA_INTEGER) \
+ MEMBER(ast_channel, context, AST_DATA_STRING) \
+ MEMBER(ast_channel, exten, AST_DATA_STRING) \
+ MEMBER(ast_channel, macrocontext, AST_DATA_STRING) \
+ MEMBER(ast_channel, macroexten, AST_DATA_STRING)
AST_DATA_STRUCTURE(ast_channel, DATA_EXPORT_CHANNEL);
static void channel_data_add_flags(struct ast_data *tree,
struct ast_channel *chan)
{
- ast_data_add_bool(tree, "DEFER_DTMF", ast_test_flag(chan, AST_FLAG_DEFER_DTMF));
- ast_data_add_bool(tree, "WRITE_INT", ast_test_flag(chan, AST_FLAG_WRITE_INT));
- ast_data_add_bool(tree, "BLOCKING", ast_test_flag(chan, AST_FLAG_BLOCKING));
- ast_data_add_bool(tree, "ZOMBIE", ast_test_flag(chan, AST_FLAG_ZOMBIE));
- ast_data_add_bool(tree, "EXCEPTION", ast_test_flag(chan, AST_FLAG_EXCEPTION));
- ast_data_add_bool(tree, "MOH", ast_test_flag(chan, AST_FLAG_MOH));
- ast_data_add_bool(tree, "SPYING", ast_test_flag(chan, AST_FLAG_SPYING));
- ast_data_add_bool(tree, "NBRIDGE", ast_test_flag(chan, AST_FLAG_NBRIDGE));
- ast_data_add_bool(tree, "IN_AUTOLOOP", ast_test_flag(chan, AST_FLAG_IN_AUTOLOOP));
- ast_data_add_bool(tree, "OUTGOING", ast_test_flag(chan, AST_FLAG_OUTGOING));
- ast_data_add_bool(tree, "IN_DTMF", ast_test_flag(chan, AST_FLAG_IN_DTMF));
- ast_data_add_bool(tree, "EMULATE_DTMF", ast_test_flag(chan, AST_FLAG_EMULATE_DTMF));
- ast_data_add_bool(tree, "END_DTMF_ONLY", ast_test_flag(chan, AST_FLAG_END_DTMF_ONLY));
- ast_data_add_bool(tree, "ANSWERED_ELSEWHERE", ast_test_flag(chan, AST_FLAG_ANSWERED_ELSEWHERE));
- ast_data_add_bool(tree, "MASQ_NOSTREAM", ast_test_flag(chan, AST_FLAG_MASQ_NOSTREAM));
- ast_data_add_bool(tree, "BRIDGE_HANGUP_RUN", ast_test_flag(chan, AST_FLAG_BRIDGE_HANGUP_RUN));
- ast_data_add_bool(tree, "BRIDGE_HANGUP_DONT", ast_test_flag(chan, AST_FLAG_BRIDGE_HANGUP_DONT));
- ast_data_add_bool(tree, "DISABLE_WORKAROUNDS", ast_test_flag(chan, AST_FLAG_DISABLE_WORKAROUNDS));
+ ast_data_add_bool(tree, "DEFER_DTMF", ast_test_flag(ast_channel_flags(chan), AST_FLAG_DEFER_DTMF));
+ ast_data_add_bool(tree, "WRITE_INT", ast_test_flag(ast_channel_flags(chan), AST_FLAG_WRITE_INT));
+ ast_data_add_bool(tree, "BLOCKING", ast_test_flag(ast_channel_flags(chan), AST_FLAG_BLOCKING));
+ ast_data_add_bool(tree, "ZOMBIE", ast_test_flag(ast_channel_flags(chan), AST_FLAG_ZOMBIE));
+ ast_data_add_bool(tree, "EXCEPTION", ast_test_flag(ast_channel_flags(chan), AST_FLAG_EXCEPTION));
+ ast_data_add_bool(tree, "MOH", ast_test_flag(ast_channel_flags(chan), AST_FLAG_MOH));
+ ast_data_add_bool(tree, "SPYING", ast_test_flag(ast_channel_flags(chan), AST_FLAG_SPYING));
+ ast_data_add_bool(tree, "NBRIDGE", ast_test_flag(ast_channel_flags(chan), AST_FLAG_NBRIDGE));
+ ast_data_add_bool(tree, "IN_AUTOLOOP", ast_test_flag(ast_channel_flags(chan), AST_FLAG_IN_AUTOLOOP));
+ ast_data_add_bool(tree, "OUTGOING", ast_test_flag(ast_channel_flags(chan), AST_FLAG_OUTGOING));
+ ast_data_add_bool(tree, "IN_DTMF", ast_test_flag(ast_channel_flags(chan), AST_FLAG_IN_DTMF));
+ ast_data_add_bool(tree, "EMULATE_DTMF", ast_test_flag(ast_channel_flags(chan), AST_FLAG_EMULATE_DTMF));
+ ast_data_add_bool(tree, "END_DTMF_ONLY", ast_test_flag(ast_channel_flags(chan), AST_FLAG_END_DTMF_ONLY));
+ ast_data_add_bool(tree, "ANSWERED_ELSEWHERE", ast_test_flag(ast_channel_flags(chan), AST_FLAG_ANSWERED_ELSEWHERE));
+ ast_data_add_bool(tree, "MASQ_NOSTREAM", ast_test_flag(ast_channel_flags(chan), AST_FLAG_MASQ_NOSTREAM));
+ ast_data_add_bool(tree, "BRIDGE_HANGUP_RUN", ast_test_flag(ast_channel_flags(chan), AST_FLAG_BRIDGE_HANGUP_RUN));
+ ast_data_add_bool(tree, "BRIDGE_HANGUP_DONT", ast_test_flag(ast_channel_flags(chan), AST_FLAG_BRIDGE_HANGUP_DONT));
+ ast_data_add_bool(tree, "DISABLE_WORKAROUNDS", ast_test_flag(ast_channel_flags(chan), AST_FLAG_DISABLE_WORKAROUNDS));
}
int ast_channel_data_add_structure(struct ast_data *tree,
@@ -251,12 +399,12 @@ int ast_channel_data_cmp_structure(const struct ast_data_search *tree,
#define DEFINE_STRINGFIELD_SETTERS_FOR(field) \
void ast_channel_##field##_set(struct ast_channel *chan, const char *value) \
{ \
- ast_string_field_set(chan, __do_not_use_##field, value); \
+ ast_string_field_set(chan, field, value); \
} \
\
void ast_channel_##field##_build_va(struct ast_channel *chan, const char *fmt, va_list ap) \
{ \
- ast_string_field_build_va(chan, __do_not_use_##field, fmt, ap); \
+ ast_string_field_build_va(chan, field, fmt, ap); \
} \
void ast_channel_##field##_build(struct ast_channel *chan, const char *fmt, ...) \
{ \
@@ -266,573 +414,571 @@ void ast_channel_##field##_build(struct ast_channel *chan, const char *fmt, ...)
va_end(ap); \
}
-DEFINE_STRINGFIELD_SETTERS_FOR(name)
-DEFINE_STRINGFIELD_SETTERS_FOR(language)
-DEFINE_STRINGFIELD_SETTERS_FOR(musicclass)
-DEFINE_STRINGFIELD_SETTERS_FOR(accountcode)
-DEFINE_STRINGFIELD_SETTERS_FOR(peeraccount)
-DEFINE_STRINGFIELD_SETTERS_FOR(userfield)
-DEFINE_STRINGFIELD_SETTERS_FOR(call_forward)
-DEFINE_STRINGFIELD_SETTERS_FOR(uniqueid)
-DEFINE_STRINGFIELD_SETTERS_FOR(linkedid)
-DEFINE_STRINGFIELD_SETTERS_FOR(parkinglot)
-DEFINE_STRINGFIELD_SETTERS_FOR(hangupsource)
-DEFINE_STRINGFIELD_SETTERS_FOR(dialcontext)
+DEFINE_STRINGFIELD_SETTERS_FOR(name);
+DEFINE_STRINGFIELD_SETTERS_FOR(language);
+DEFINE_STRINGFIELD_SETTERS_FOR(musicclass);
+DEFINE_STRINGFIELD_SETTERS_FOR(accountcode);
+DEFINE_STRINGFIELD_SETTERS_FOR(peeraccount);
+DEFINE_STRINGFIELD_SETTERS_FOR(userfield);
+DEFINE_STRINGFIELD_SETTERS_FOR(call_forward);
+DEFINE_STRINGFIELD_SETTERS_FOR(uniqueid);
+DEFINE_STRINGFIELD_SETTERS_FOR(linkedid);
+DEFINE_STRINGFIELD_SETTERS_FOR(parkinglot);
+DEFINE_STRINGFIELD_SETTERS_FOR(hangupsource);
+DEFINE_STRINGFIELD_SETTERS_FOR(dialcontext);
#define DEFINE_STRINGFIELD_GETTER_FOR(field) const char *ast_channel_##field(const struct ast_channel *chan) \
{ \
- return chan->__do_not_use_##field; \
-}
-
-DEFINE_STRINGFIELD_GETTER_FOR(name)
-DEFINE_STRINGFIELD_GETTER_FOR(language)
-DEFINE_STRINGFIELD_GETTER_FOR(musicclass)
-DEFINE_STRINGFIELD_GETTER_FOR(accountcode)
-DEFINE_STRINGFIELD_GETTER_FOR(peeraccount)
-DEFINE_STRINGFIELD_GETTER_FOR(userfield)
-DEFINE_STRINGFIELD_GETTER_FOR(call_forward)
-DEFINE_STRINGFIELD_GETTER_FOR(uniqueid)
-DEFINE_STRINGFIELD_GETTER_FOR(linkedid)
-DEFINE_STRINGFIELD_GETTER_FOR(parkinglot)
-DEFINE_STRINGFIELD_GETTER_FOR(hangupsource)
-DEFINE_STRINGFIELD_GETTER_FOR(dialcontext)
+ return chan->field; \
+}
+
+DEFINE_STRINGFIELD_GETTER_FOR(name);
+DEFINE_STRINGFIELD_GETTER_FOR(language);
+DEFINE_STRINGFIELD_GETTER_FOR(musicclass);
+DEFINE_STRINGFIELD_GETTER_FOR(accountcode);
+DEFINE_STRINGFIELD_GETTER_FOR(peeraccount);
+DEFINE_STRINGFIELD_GETTER_FOR(userfield);
+DEFINE_STRINGFIELD_GETTER_FOR(call_forward);
+DEFINE_STRINGFIELD_GETTER_FOR(uniqueid);
+DEFINE_STRINGFIELD_GETTER_FOR(linkedid);
+DEFINE_STRINGFIELD_GETTER_FOR(parkinglot);
+DEFINE_STRINGFIELD_GETTER_FOR(hangupsource);
+DEFINE_STRINGFIELD_GETTER_FOR(dialcontext);
const char *ast_channel_appl(const struct ast_channel *chan)
{
- return chan->__do_not_use_appl;
+ return chan->appl;
}
void ast_channel_appl_set(struct ast_channel *chan, const char *value)
{
- chan->__do_not_use_appl = value;
+ chan->appl = value;
}
const char *ast_channel_blockproc(const struct ast_channel *chan)
{
- return chan->__do_not_use_blockproc;
+ return chan->blockproc;
}
void ast_channel_blockproc_set(struct ast_channel *chan, const char *value)
{
- chan->__do_not_use_blockproc = value;
+ chan->blockproc = value;
}
const char *ast_channel_data(const struct ast_channel *chan)
{
- return chan->__do_not_use_data;
+ return chan->data;
}
void ast_channel_data_set(struct ast_channel *chan, const char *value)
{
- chan->__do_not_use_data = value;
+ chan->data = value;
}
-
const char *ast_channel_context(const struct ast_channel *chan)
{
- return chan->__do_not_use_context;
+ return chan->context;
}
void ast_channel_context_set(struct ast_channel *chan, const char *value)
{
- ast_copy_string(chan->__do_not_use_context, value, sizeof(chan->__do_not_use_context));
+ ast_copy_string(chan->context, value, sizeof(chan->context));
}
const char *ast_channel_exten(const struct ast_channel *chan)
{
- return chan->__do_not_use_exten;
+ return chan->exten;
}
void ast_channel_exten_set(struct ast_channel *chan, const char *value)
{
- ast_copy_string(chan->__do_not_use_exten, value, sizeof(chan->__do_not_use_exten));
+ ast_copy_string(chan->exten, value, sizeof(chan->exten));
}
const char *ast_channel_macrocontext(const struct ast_channel *chan)
{
- return chan->__do_not_use_macrocontext;
+ return chan->macrocontext;
}
void ast_channel_macrocontext_set(struct ast_channel *chan, const char *value)
{
- ast_copy_string(chan->__do_not_use_macrocontext, value, sizeof(chan->__do_not_use_macrocontext));
+ ast_copy_string(chan->macrocontext, value, sizeof(chan->macrocontext));
}
const char *ast_channel_macroexten(const struct ast_channel *chan)
{
- return chan->__do_not_use_macroexten;
+ return chan->macroexten;
}
void ast_channel_macroexten_set(struct ast_channel *chan, const char *value)
{
- ast_copy_string(chan->__do_not_use_macroexten, value, sizeof(chan->__do_not_use_macroexten));
+ ast_copy_string(chan->macroexten, value, sizeof(chan->macroexten));
}
-
char ast_channel_dtmf_digit_to_emulate(const struct ast_channel *chan)
{
- return chan->__do_not_use_dtmf_digit_to_emulate;
+ return chan->dtmf_digit_to_emulate;
}
void ast_channel_dtmf_digit_to_emulate_set(struct ast_channel *chan, char value)
{
- chan->__do_not_use_dtmf_digit_to_emulate = value;
+ chan->dtmf_digit_to_emulate = value;
}
int ast_channel_amaflags(const struct ast_channel *chan)
{
- return chan->__do_not_use_amaflags;
+ return chan->amaflags;
}
void ast_channel_amaflags_set(struct ast_channel *chan, int value)
{
- chan->__do_not_use_amaflags = value;
+ chan->amaflags = value;
}
#ifdef HAVE_EPOLL
int ast_channel_epfd(const struct ast_channel *chan)
{
- return chan->__do_not_use_epfd;
+ return chan->epfd;
}
void ast_channel_epfd_set(struct ast_channel *chan, int value)
{
- chan->__do_not_use_epfd = value;
+ chan->epfd = value;
}
#endif
int ast_channel_fdno(const struct ast_channel *chan)
{
- return chan->__do_not_use_fdno;
+ return chan->fdno;
}
void ast_channel_fdno_set(struct ast_channel *chan, int value)
{
- chan->__do_not_use_fdno = value;
+ chan->fdno = value;
}
int ast_channel_hangupcause(const struct ast_channel *chan)
{
- return chan->__do_not_use_hangupcause;
+ return chan->hangupcause;
}
void ast_channel_hangupcause_set(struct ast_channel *chan, int value)
{
- chan->__do_not_use_hangupcause = value;
+ chan->hangupcause = value;
}
int ast_channel_macropriority(const struct ast_channel *chan)
{
- return chan->__do_not_use_macropriority;
+ return chan->macropriority;
}
void ast_channel_macropriority_set(struct ast_channel *chan, int value)
{
- chan->__do_not_use_macropriority = value;
+ chan->macropriority = value;
}
int ast_channel_priority(const struct ast_channel *chan)
{
- return chan->__do_not_use_priority;
+ return chan->priority;
}
void ast_channel_priority_set(struct ast_channel *chan, int value)
{
- chan->__do_not_use_priority = value;
+ chan->priority = value;
}
int ast_channel_rings(const struct ast_channel *chan)
{
- return chan->__do_not_use_rings;
+ return chan->rings;
}
void ast_channel_rings_set(struct ast_channel *chan, int value)
{
- chan->__do_not_use_rings = value;
+ chan->rings = value;
}
int ast_channel_streamid(const struct ast_channel *chan)
{
- return chan->__do_not_use_streamid;
+ return chan->streamid;
}
void ast_channel_streamid_set(struct ast_channel *chan, int value)
{
- chan->__do_not_use_streamid = value;
+ chan->streamid = value;
}
int ast_channel_timingfd(const struct ast_channel *chan)
{
- return chan->__do_not_use_timingfd;
+ return chan->timingfd;
}
void ast_channel_timingfd_set(struct ast_channel *chan, int value)
{
- chan->__do_not_use_timingfd = value;
+ chan->timingfd = value;
}
int ast_channel_visible_indication(const struct ast_channel *chan)
{
- return chan->__do_not_use_visible_indication;
+ return chan->visible_indication;
}
void ast_channel_visible_indication_set(struct ast_channel *chan, int value)
{
- chan->__do_not_use_visible_indication = value;
+ chan->visible_indication = value;
}
int ast_channel_vstreamid(const struct ast_channel *chan)
{
- return chan->__do_not_use_vstreamid;
+ return chan->vstreamid;
}
void ast_channel_vstreamid_set(struct ast_channel *chan, int value)
{
- chan->__do_not_use_vstreamid = value;
+ chan->vstreamid = value;
}
unsigned short ast_channel_transfercapability(const struct ast_channel *chan)
{
- return chan->__do_not_use_transfercapability;
+ return chan->transfercapability;
}
void ast_channel_transfercapability_set(struct ast_channel *chan, unsigned short value)
{
- chan->__do_not_use_transfercapability = value;
+ chan->transfercapability = value;
}
unsigned int ast_channel_emulate_dtmf_duration(const struct ast_channel *chan)
{
- return chan->__do_not_use_emulate_dtmf_duration;
+ return chan->emulate_dtmf_duration;
}
void ast_channel_emulate_dtmf_duration_set(struct ast_channel *chan, unsigned int value)
{
- chan->__do_not_use_emulate_dtmf_duration = value;
+ chan->emulate_dtmf_duration = value;
}
unsigned int ast_channel_fin(const struct ast_channel *chan)
{
- return chan->__do_not_use_fin;
+ return chan->fin;
}
void ast_channel_fin_set(struct ast_channel *chan, unsigned int value)
{
- chan->__do_not_use_fin = value;
+ chan->fin = value;
}
unsigned int ast_channel_fout(const struct ast_channel *chan)
{
- return chan->__do_not_use_fout;
+ return chan->fout;
}
void ast_channel_fout_set(struct ast_channel *chan, unsigned int value)
{
- chan->__do_not_use_fout = value;
+ chan->fout = value;
}
unsigned long ast_channel_insmpl(const struct ast_channel *chan)
{
- return chan->__do_not_use_insmpl;
+ return chan->insmpl;
}
void ast_channel_insmpl_set(struct ast_channel *chan, unsigned long value)
{
- chan->__do_not_use_insmpl = value;
+ chan->insmpl = value;
}
unsigned long ast_channel_outsmpl(const struct ast_channel *chan)
{
- return chan->__do_not_use_outsmpl;
+ return chan->outsmpl;
}
void ast_channel_outsmpl_set(struct ast_channel *chan, unsigned long value)
{
- chan->__do_not_use_outsmpl = value;
+ chan->outsmpl = value;
}
void *ast_channel_generatordata(const struct ast_channel *chan)
{
- return chan->__do_not_use_generatordata;
+ return chan->generatordata;
}
void ast_channel_generatordata_set(struct ast_channel *chan, void *value)
{
- chan->__do_not_use_generatordata = value;
+ chan->generatordata = value;
}
void *ast_channel_music_state(const struct ast_channel *chan)
{
- return chan->__do_not_use_music_state;
+ return chan->music_state;
}
void ast_channel_music_state_set(struct ast_channel *chan, void *value)
{
- chan->__do_not_use_music_state = value;
+ chan->music_state = value;
}
void *ast_channel_tech_pvt(const struct ast_channel *chan)
{
- return chan->__do_not_use_tech_pvt;
+ return chan->tech_pvt;
}
void ast_channel_tech_pvt_set(struct ast_channel *chan, void *value)
{
- chan->__do_not_use_tech_pvt = value;
+ chan->tech_pvt = value;
}
void *ast_channel_timingdata(const struct ast_channel *chan)
{
- return chan->__do_not_use_timingdata;
+ return chan->timingdata;
}
void ast_channel_timingdata_set(struct ast_channel *chan, void *value)
{
- chan->__do_not_use_timingdata = value;
+ chan->timingdata = value;
}
struct ast_audiohook_list *ast_channel_audiohooks(const struct ast_channel *chan)
{
- return chan->__do_not_use_audiohooks;
+ return chan->audiohooks;
}
void ast_channel_audiohooks_set(struct ast_channel *chan, struct ast_audiohook_list *value)
{
- chan->__do_not_use_audiohooks = value;
+ chan->audiohooks = value;
}
struct ast_cdr *ast_channel_cdr(const struct ast_channel *chan)
{
- return chan->__do_not_use_cdr;
+ return chan->cdr;
}
void ast_channel_cdr_set(struct ast_channel *chan, struct ast_cdr *value)
{
- chan->__do_not_use_cdr = value;
+ chan->cdr = value;
}
struct ast_channel *ast_channel_masq(const struct ast_channel *chan)
{
- return chan->__do_not_use_masq;
+ return chan->masq;
}
void ast_channel_masq_set(struct ast_channel *chan, struct ast_channel *value)
{
- chan->__do_not_use_masq = value;
+ chan->masq = value;
}
struct ast_channel *ast_channel_masqr(const struct ast_channel *chan)
{
- return chan->__do_not_use_masqr;
+ return chan->masqr;
}
void ast_channel_masqr_set(struct ast_channel *chan, struct ast_channel *value)
{
- chan->__do_not_use_masqr = value;
+ chan->masqr = value;
}
struct ast_channel_monitor *ast_channel_monitor(const struct ast_channel *chan)
{
- return chan->__do_not_use_monitor;
+ return chan->monitor;
}
void ast_channel_monitor_set(struct ast_channel *chan, struct ast_channel_monitor *value)
{
- chan->__do_not_use_monitor = value;
+ chan->monitor = value;
}
struct ast_filestream *ast_channel_stream(const struct ast_channel *chan)
{
- return chan->__do_not_use_stream;
+ return chan->stream;
}
void ast_channel_stream_set(struct ast_channel *chan, struct ast_filestream *value)
{
- chan->__do_not_use_stream = value;
+ chan->stream = value;
}
struct ast_filestream *ast_channel_vstream(const struct ast_channel *chan)
{
- return chan->__do_not_use_vstream;
+ return chan->vstream;
}
void ast_channel_vstream_set(struct ast_channel *chan, struct ast_filestream *value)
{
- chan->__do_not_use_vstream = value;
+ chan->vstream = value;
}
struct ast_format_cap *ast_channel_nativeformats(const struct ast_channel *chan)
{
- return chan->__do_not_use_nativeformats;
+ return chan->nativeformats;
}
void ast_channel_nativeformats_set(struct ast_channel *chan, struct ast_format_cap *value)
{
- chan->__do_not_use_nativeformats = value;
+ chan->nativeformats = value;
}
struct ast_framehook_list *ast_channel_framehooks(const struct ast_channel *chan)
{
- return chan->__do_not_use_framehooks;
+ return chan->framehooks;
}
void ast_channel_framehooks_set(struct ast_channel *chan, struct ast_framehook_list *value)
{
- chan->__do_not_use_framehooks = value;
+ chan->framehooks = value;
}
struct ast_generator *ast_channel_generator(const struct ast_channel *chan)
{
- return chan->__do_not_use_generator;
+ return chan->generator;
}
void ast_channel_generator_set(struct ast_channel *chan, struct ast_generator *value)
{
- chan->__do_not_use_generator = value;
+ chan->generator = value;
}
struct ast_pbx *ast_channel_pbx(const struct ast_channel *chan)
{
- return chan->__do_not_use_pbx;
+ return chan->pbx;
}
void ast_channel_pbx_set(struct ast_channel *chan, struct ast_pbx *value)
{
- chan->__do_not_use_pbx = value;
+ chan->pbx = value;
}
struct ast_sched_context *ast_channel_sched(const struct ast_channel *chan)
{
- return chan->__do_not_use_sched;
+ return chan->sched;
}
void ast_channel_sched_set(struct ast_channel *chan, struct ast_sched_context *value)
{
- chan->__do_not_use_sched = value;
+ chan->sched = value;
}
struct ast_timer *ast_channel_timer(const struct ast_channel *chan)
{
- return chan->__do_not_use_timer;
+ return chan->timer;
}
void ast_channel_timer_set(struct ast_channel *chan, struct ast_timer *value)
{
- chan->__do_not_use_timer = value;
+ chan->timer = value;
}
struct ast_tone_zone *ast_channel_zone(const struct ast_channel *chan)
{
- return chan->__do_not_use_zone;
+ return chan->zone;
}
void ast_channel_zone_set(struct ast_channel *chan, struct ast_tone_zone *value)
{
- chan->__do_not_use_zone = value;
+ chan->zone = value;
}
struct ast_trans_pvt *ast_channel_readtrans(const struct ast_channel *chan)
{
- return chan->__do_not_use_readtrans;
+ return chan->readtrans;
}
void ast_channel_readtrans_set(struct ast_channel *chan, struct ast_trans_pvt *value)
{
- chan->__do_not_use_readtrans = value;
+ chan->readtrans = value;
}
struct ast_trans_pvt *ast_channel_writetrans(const struct ast_channel *chan)
{
- return chan->__do_not_use_writetrans;
+ return chan->writetrans;
}
void ast_channel_writetrans_set(struct ast_channel *chan, struct ast_trans_pvt *value)
{
- chan->__do_not_use_writetrans = value;
+ chan->writetrans = value;
}
const struct ast_channel_tech *ast_channel_tech(const struct ast_channel *chan)
{
- return chan->__do_not_use_tech;
+ return chan->tech;
}
void ast_channel_tech_set(struct ast_channel *chan, const struct ast_channel_tech *value)
{
- chan->__do_not_use_tech = value;
+ chan->tech = value;
}
enum ast_channel_adsicpe ast_channel_adsicpe(const struct ast_channel *chan)
{
- return chan->__do_not_use_adsicpe;
+ return chan->adsicpe;
}
void ast_channel_adsicpe_set(struct ast_channel *chan, enum ast_channel_adsicpe value)
{
- chan->__do_not_use_adsicpe = value;
+ chan->adsicpe = value;
}
enum ast_channel_state ast_channel_state(const struct ast_channel *chan)
{
- return chan->__do_not_use_state;
+ return chan->state;
}
void ast_channel_state_set(struct ast_channel *chan, enum ast_channel_state value)
{
- chan->__do_not_use_state = value;
+ chan->state = value;
}
struct ast_format *ast_channel_oldwriteformat(struct ast_channel *chan)
{
- return &chan->__do_not_use_oldwriteformat;
+ return &chan->oldwriteformat;
}
struct ast_format *ast_channel_rawreadformat(struct ast_channel *chan)
{
- return &chan->__do_not_use_rawreadformat;
+ return &chan->rawreadformat;
}
struct ast_format *ast_channel_rawwriteformat(struct ast_channel *chan)
{
- return &chan->__do_not_use_rawwriteformat;
+ return &chan->rawwriteformat;
}
struct ast_format *ast_channel_readformat(struct ast_channel *chan)
{
- return &chan->__do_not_use_readformat;
+ return &chan->readformat;
}
struct ast_format *ast_channel_writeformat(struct ast_channel *chan)
{
- return &chan->__do_not_use_writeformat;
+ return &chan->writeformat;
}
struct ast_datastore_list *ast_channel_datastores(struct ast_channel *chan)
{
- return &chan->__do_not_use_datastores;
+ return &chan->datastores;
}
struct ast_autochan_list *ast_channel_autochans(struct ast_channel *chan)
{
- return &chan->__do_not_use_autochans;
+ return &chan->autochans;
}
struct ast_readq_list *ast_channel_readq(struct ast_channel *chan)
{
- return &chan->__do_not_use_readq;
+ return &chan->readq;
}
struct ast_frame *ast_channel_dtmff(struct ast_channel *chan)
{
- return &chan->__do_not_use_dtmff;
+ return &chan->dtmff;
}
struct ast_jb *ast_channel_jb(struct ast_channel *chan)
{
- return &chan->__do_not_use_jb;
+ return &chan->jb;
}
struct ast_party_caller *ast_channel_caller(struct ast_channel *chan)
{
- return &chan->__do_not_use_caller;
+ return &chan->caller;
}
struct ast_party_connected_line *ast_channel_connected(struct ast_channel *chan)
{
- return &chan->__do_not_use_connected;
+ return &chan->connected;
}
struct ast_party_dialed *ast_channel_dialed(struct ast_channel *chan)
{
- return &chan->__do_not_use_dialed;
+ return &chan->dialed;
}
struct ast_party_redirecting *ast_channel_redirecting(struct ast_channel *chan)
{
- return &chan->__do_not_use_redirecting;
+ return &chan->redirecting;
}
struct timeval *ast_channel_dtmf_tv(struct ast_channel *chan)
{
- return &chan->__do_not_use_dtmf_tv;
+ return &chan->dtmf_tv;
}
struct timeval *ast_channel_whentohangup(struct ast_channel *chan)
{
- return &chan->__do_not_use_whentohangup;
+ return &chan->whentohangup;
}
struct varshead *ast_channel_varshead(struct ast_channel *chan)
{
- return &chan->__do_not_use_varshead;
+ return &chan->varshead;
}
void ast_channel_dtmff_set(struct ast_channel *chan, struct ast_frame *value)
{
- memcpy(&chan->__do_not_use_dtmff, value, sizeof(chan->__do_not_use_dtmff));
+ chan->dtmff = *value;
}
void ast_channel_jb_set(struct ast_channel *chan, struct ast_jb *value)
{
- memcpy(&chan->__do_not_use_jb, value, sizeof(chan->__do_not_use_jb));
+ chan->jb = *value;
}
void ast_channel_caller_set(struct ast_channel *chan, struct ast_party_caller *value)
{
- memcpy(&chan->__do_not_use_caller, value, sizeof(chan->__do_not_use_caller));
+ chan->caller = *value;
}
void ast_channel_connected_set(struct ast_channel *chan, struct ast_party_connected_line *value)
{
- memcpy(&chan->__do_not_use_connected, value, sizeof(chan->__do_not_use_connected));
+ chan->connected = *value;
}
void ast_channel_dialed_set(struct ast_channel *chan, struct ast_party_dialed *value)
{
- memcpy(&chan->__do_not_use_dialed, value, sizeof(chan->__do_not_use_dialed));
+ chan->dialed = *value;
}
void ast_channel_redirecting_set(struct ast_channel *chan, struct ast_party_redirecting *value)
{
- memcpy(&chan->__do_not_use_redirecting, value, sizeof(chan->__do_not_use_redirecting));
+ chan->redirecting = *value;
}
void ast_channel_dtmf_tv_set(struct ast_channel *chan, struct timeval *value)
{
- memcpy(&chan->__do_not_use_dtmf_tv, value, sizeof(chan->__do_not_use_dtmf_tv));
+ chan->dtmf_tv = *value;
}
void ast_channel_whentohangup_set(struct ast_channel *chan, struct timeval *value)
{
- memcpy(&chan->__do_not_use_whentohangup, value, sizeof(chan->__do_not_use_whentohangup));
+ chan->whentohangup = *value;
}
void ast_channel_varshead_set(struct ast_channel *chan, struct varshead *value)
{
- memcpy(&chan->__do_not_use_varshead, value, sizeof(chan->__do_not_use_varshead));
+ chan->varshead = *value;
}
/* Evil softhangup accessors */
-int ast_channel_softhangup_internal_flag(struct ast_channel * chan)
+int ast_channel_softhangup_internal_flag(struct ast_channel *chan)
{
- return chan->__do_not_use_softhangup;
+ return chan->softhangup;
}
void ast_channel_softhangup_internal_flag_set(struct ast_channel *chan, int value)
{
- chan->__do_not_use_softhangup = value;
+ chan->softhangup = value;
}
void ast_channel_softhangup_internal_flag_add(struct ast_channel *chan, int value)
{
- chan->__do_not_use_softhangup |= value;
+ chan->softhangup |= value;
}
void ast_channel_softhangup_internal_flag_clear(struct ast_channel *chan, int value)
{
- chan ->__do_not_use_softhangup &= ~value;
+ chan ->softhangup &= ~value;
}
/* Typedef accessors */
ast_group_t ast_channel_callgroup(const struct ast_channel *chan)
{
- return chan->__do_not_use_callgroup;
+ return chan->callgroup;
}
void ast_channel_callgroup_set(struct ast_channel *chan, ast_group_t value)
{
- chan->__do_not_use_callgroup = value;
+ chan->callgroup = value;
}
ast_group_t ast_channel_pickupgroup(const struct ast_channel *chan)
{
- return chan->__do_not_use_pickupgroup;
+ return chan->pickupgroup;
}
void ast_channel_pickupgroup_set(struct ast_channel *chan, ast_group_t value)
{
- chan->__do_not_use_pickupgroup = value;
+ chan->pickupgroup = value;
}
/* Alertpipe functions */
int ast_channel_alert_write(struct ast_channel *chan)
{
char blah = 0x7F;
- return ast_channel_alert_writable(chan) && write(chan->__do_not_use_alertpipe[1], &blah, sizeof(blah)) != sizeof(blah);
+ return ast_channel_alert_writable(chan) && write(chan->alertpipe[1], &blah, sizeof(blah)) != sizeof(blah);
}
ast_alert_status_t ast_channel_internal_alert_read(struct ast_channel *chan)
@@ -844,17 +990,17 @@ ast_alert_status_t ast_channel_internal_alert_read(struct ast_channel *chan)
return AST_ALERT_NOT_READABLE;
}
- flags = fcntl(chan->__do_not_use_alertpipe[0], F_GETFL);
+ flags = fcntl(chan->alertpipe[0], F_GETFL);
/* For some odd reason, the alertpipe occasionally loses nonblocking status,
* which immediately causes a deadlock scenario. Detect and prevent this. */
if ((flags & O_NONBLOCK) == 0) {
ast_log(LOG_ERROR, "Alertpipe on channel %s lost O_NONBLOCK?!!\n", ast_channel_name(chan));
- if (fcntl(chan->__do_not_use_alertpipe[0], F_SETFL, flags | O_NONBLOCK) < 0) {
+ if (fcntl(chan->alertpipe[0], F_SETFL, flags | O_NONBLOCK) < 0) {
ast_log(LOG_WARNING, "Unable to set alertpipe nonblocking! (%d: %s)\n", errno, strerror(errno));
return AST_ALERT_READ_FATAL;
}
}
- if (read(chan->__do_not_use_alertpipe[0], &blah, sizeof(blah)) < 0) {
+ if (read(chan->alertpipe[0], &blah, sizeof(blah)) < 0) {
if (errno != EINTR && errno != EAGAIN) {
ast_log(LOG_WARNING, "read() failed: %s\n", strerror(errno));
return AST_ALERT_READ_FAIL;
@@ -866,42 +1012,42 @@ ast_alert_status_t ast_channel_internal_alert_read(struct ast_channel *chan)
int ast_channel_alert_writable(struct ast_channel *chan)
{
- return chan->__do_not_use_alertpipe[1] > -1;
+ return chan->alertpipe[1] > -1;
}
int ast_channel_internal_alert_readable(struct ast_channel *chan)
{
- return chan->__do_not_use_alertpipe[0] > -1;
+ return chan->alertpipe[0] > -1;
}
void ast_channel_internal_alertpipe_clear(struct ast_channel *chan)
{
- chan->__do_not_use_alertpipe[0] = chan->__do_not_use_alertpipe[1] = -1;
+ chan->alertpipe[0] = chan->alertpipe[1] = -1;
}
void ast_channel_internal_alertpipe_close(struct ast_channel *chan)
{
if (ast_channel_internal_alert_readable(chan)) {
- close(chan->__do_not_use_alertpipe[0]);
+ close(chan->alertpipe[0]);
}
if (ast_channel_alert_writable(chan)) {
- close(chan->__do_not_use_alertpipe[1]);
+ close(chan->alertpipe[1]);
}
}
int ast_channel_internal_alertpipe_init(struct ast_channel *chan)
{
- if (pipe(chan->__do_not_use_alertpipe)) {
+ if (pipe(chan->alertpipe)) {
ast_log(LOG_WARNING, "Channel allocation failed: Can't create alert pipe! Try increasing max file descriptors with ulimit -n\n");
return -1;
} else {
- int flags = fcntl(chan->__do_not_use_alertpipe[0], F_GETFL);
- if (fcntl(chan->__do_not_use_alertpipe[0], F_SETFL, flags | O_NONBLOCK) < 0) {
+ int flags = fcntl(chan->alertpipe[0], F_GETFL);
+ if (fcntl(chan->alertpipe[0], F_SETFL, flags | O_NONBLOCK) < 0) {
ast_log(LOG_WARNING, "Channel allocation failed: Unable to set alertpipe nonblocking! (%d: %s)\n", errno, strerror(errno));
return -1;
}
- flags = fcntl(chan->__do_not_use_alertpipe[1], F_GETFL);
- if (fcntl(chan->__do_not_use_alertpipe[1], F_SETFL, flags | O_NONBLOCK) < 0) {
+ flags = fcntl(chan->alertpipe[1], F_GETFL);
+ if (fcntl(chan->alertpipe[1], F_SETFL, flags | O_NONBLOCK) < 0) {
ast_log(LOG_WARNING, "Channel allocation failed: Unable to set alertpipe nonblocking! (%d: %s)\n", errno, strerror(errno));
return -1;
}
@@ -911,21 +1057,21 @@ int ast_channel_internal_alertpipe_init(struct ast_channel *chan)
int ast_channel_internal_alert_readfd(struct ast_channel *chan)
{
- return chan->__do_not_use_alertpipe[0];
+ return chan->alertpipe[0];
}
void ast_channel_internal_alertpipe_swap(struct ast_channel *chan1, struct ast_channel *chan2)
{
int i;
- for (i = 0; i < ARRAY_LEN(chan1->__do_not_use_alertpipe); i++) {
- SWAP(chan1->__do_not_use_alertpipe[i], chan2->__do_not_use_alertpipe[i]);
+ for (i = 0; i < ARRAY_LEN(chan1->alertpipe); i++) {
+ SWAP(chan1->alertpipe[i], chan2->alertpipe[i]);
}
}
/* file descriptor array accessors */
void ast_channel_internal_fd_set(struct ast_channel *chan, int which, int value)
{
- chan->__do_not_use_fds[which] = value;
+ chan->fds[which] = value;
}
void ast_channel_internal_fd_clear(struct ast_channel *chan, int which)
{
@@ -940,7 +1086,7 @@ void ast_channel_internal_fd_clear_all(struct ast_channel *chan)
}
int ast_channel_fd(const struct ast_channel *chan, int which)
{
- return chan->__do_not_use_fds[which];
+ return chan->fds[which];
}
int ast_channel_fd_isset(const struct ast_channel *chan, int which)
{
@@ -950,10 +1096,86 @@ int ast_channel_fd_isset(const struct ast_channel *chan, int which)
#ifdef HAVE_EPOLL
struct ast_epoll_data *ast_channel_internal_epfd_data(const struct ast_channel *chan, int which)
{
- return chan->__do_not_use_epfd_data[which];
+ return chan->epfd_data[which];
}
void ast_channel_internal_epfd_data_set(struct ast_channel *chan, int which , struct ast_epoll_data *value)
{
- chan->__do_not_use_epfd_data[which] = value;
+ chan->epfd_data[which] = value;
}
#endif
+
+pthread_t ast_channel_blocker(const struct ast_channel *chan)
+{
+ return chan->blocker;
+}
+void ast_channel_blocker_set(struct ast_channel *chan, pthread_t value)
+{
+ chan->blocker = value;
+}
+
+ast_timing_func_t ast_channel_timingfunc(const struct ast_channel *chan)
+{
+ return chan->timingfunc;
+}
+void ast_channel_timingfunc_set(struct ast_channel *chan, ast_timing_func_t value)
+{
+ chan->timingfunc = value;
+}
+
+struct ast_bridge *ast_channel_internal_bridge(const struct ast_channel *chan)
+{
+ return chan->bridge;
+}
+void ast_channel_internal_bridge_set(struct ast_channel *chan, struct ast_bridge *value)
+{
+ chan->bridge = value;
+}
+
+struct ast_channel *ast_channel_internal_bridged_channel(const struct ast_channel *chan)
+{
+ return chan->bridged_channel;
+}
+void ast_channel_internal_bridged_channel_set(struct ast_channel *chan, struct ast_channel *value)
+{
+ chan->bridged_channel = value;
+}
+
+struct ast_flags *ast_channel_flags(struct ast_channel *chan)
+{
+ return &chan->flags;
+}
+
+struct ast_channel *__ast_channel_internal_alloc(void (*destructor)(void *obj), const char *file, int line, const char *function)
+{
+ struct ast_channel *tmp;
+#if defined(REF_DEBUG)
+ tmp = __ao2_alloc_debug(sizeof(*tmp), destructor,
+ AO2_ALLOC_OPT_LOCK_MUTEX, "", file, line, function, 1);
+#elif defined(__AST_DEBUG_MALLOC)
+ tmp = __ao2_alloc_debug(sizeof(*tmp), destructor,
+ AO2_ALLOC_OPT_LOCK_MUTEX, "", file, line, function, 0);
+#else
+ tmp = ao2_alloc(sizeof(*tmp), destructor);
+#endif
+
+ if ((ast_string_field_init(tmp, 128))) {
+ return ast_channel_unref(tmp);
+ }
+
+ return tmp;
+}
+
+void ast_channel_internal_cleanup(struct ast_channel *chan)
+{
+ ast_string_field_free_memory(chan);
+}
+
+void ast_channel_internal_finalize(struct ast_channel *chan)
+{
+ chan->finalized = 1;
+}
+
+int ast_channel_internal_is_finalized(struct ast_channel *chan)
+{
+ return chan->finalized;
+}
diff --git a/main/cli.c b/main/cli.c
index 591f6d556..248094927 100644
--- a/main/cli.c
+++ b/main/cli.c
@@ -1494,10 +1494,10 @@ static char *handle_showchan(struct ast_cli_entry *e, int cmd, struct ast_cli_ar
ast_channel_fin(c) & ~DEBUGCHAN_FLAG, (ast_channel_fin(c) & DEBUGCHAN_FLAG) ? " (DEBUGGED)" : "",
ast_channel_fout(c) & ~DEBUGCHAN_FLAG, (ast_channel_fout(c) & DEBUGCHAN_FLAG) ? " (DEBUGGED)" : "",
(long)ast_channel_whentohangup(c)->tv_sec,
- cdrtime, c->_bridge ? ast_channel_name(c->_bridge) : "<none>", ast_bridged_channel(c) ? ast_channel_name(ast_bridged_channel(c)) : "<none>",
+ cdrtime, ast_channel_internal_bridged_channel(c) ? ast_channel_name(ast_channel_internal_bridged_channel(c)) : "<none>", ast_bridged_channel(c) ? ast_channel_name(ast_bridged_channel(c)) : "<none>",
ast_channel_context(c), ast_channel_exten(c), ast_channel_priority(c), ast_channel_callgroup(c), ast_channel_pickupgroup(c), (ast_channel_appl(c) ? ast_channel_appl(c) : "(N/A)" ),
(ast_channel_data(c) ? S_OR(ast_channel_data(c), "(Empty)") : "(None)"),
- (ast_test_flag(c, AST_FLAG_BLOCKING) ? ast_channel_blockproc(c) : "(Not Blocking)"));
+ (ast_test_flag(ast_channel_flags(c), AST_FLAG_BLOCKING) ? ast_channel_blockproc(c) : "(Not Blocking)"));
if (pbx_builtin_serialize_variables(c, &obuf)) {
ast_str_append(&output, 0, " Variables:\n%s\n", ast_str_buffer(obuf));
diff --git a/main/features.c b/main/features.c
index 03627ee38..7e8a978a0 100644
--- a/main/features.c
+++ b/main/features.c
@@ -892,7 +892,7 @@ static void check_goto_on_transfer(struct ast_channel *chan)
}
ast_parseable_goto(xferchan, goto_on_transfer);
ast_channel_state_set(xferchan, AST_STATE_UP);
- ast_clear_flag(xferchan, AST_FLAGS_ALL);
+ ast_clear_flag(ast_channel_flags(xferchan), AST_FLAGS_ALL);
ast_channel_clear_softhangup(xferchan, AST_SOFTHANGUP_ALL);
if (ast_do_masquerade(xferchan) || ast_pbx_start(xferchan)) {
@@ -1547,10 +1547,10 @@ static int park_call_full(struct ast_channel *chan, struct ast_channel *peer, st
* parking space number do not continue playing it back. This
* is the case if an attended transfer occurs.
*/
- ast_set_flag(peer, AST_FLAG_MASQ_NOSTREAM);
+ ast_set_flag(ast_channel_flags(peer), AST_FLAG_MASQ_NOSTREAM);
/* Tell the peer channel the number of the parking space */
ast_say_digits(peer, pu->parkingnum, "", ast_channel_language(peer));
- ast_clear_flag(peer, AST_FLAG_MASQ_NOSTREAM);
+ ast_clear_flag(ast_channel_flags(peer), AST_FLAG_MASQ_NOSTREAM);
}
if (peer == chan) { /* pu->notquiteyet = 1 */
/* Wake up parking thread if we're really done */
@@ -2354,7 +2354,7 @@ static int builtin_blindtransfer(struct ast_channel *chan, struct ast_channel *p
} else {
/* Set the transferee's new extension, since it exists, using transferer context */
ast_debug(1, "About to explicit goto %s, it has a PBX.\n", ast_channel_name(transferee));
- ast_set_flag(transferee, AST_FLAG_BRIDGE_HANGUP_DONT); /* don't let the after-bridge code run the h-exten */
+ ast_set_flag(ast_channel_flags(transferee), AST_FLAG_BRIDGE_HANGUP_DONT); /* don't let the after-bridge code run the h-exten */
set_c_e_p(transferee, transferer_real_context, xferto, 0);
/*
@@ -2586,13 +2586,13 @@ static int builtin_atxfer(struct ast_channel *chan, struct ast_channel *peer, st
/* ast_bridge_call clears AST_FLAG_BRIDGE_HANGUP_DONT, but we don't
want that to happen here because we're also in another bridge already
*/
- if (ast_test_flag(chan, AST_FLAG_BRIDGE_HANGUP_DONT)) {
+ if (ast_test_flag(ast_channel_flags(chan), AST_FLAG_BRIDGE_HANGUP_DONT)) {
hangup_dont = 1;
}
/* Let party B and party C talk as long as they want. */
ast_bridge_call(transferer, newchan, &bconfig);
if (hangup_dont) {
- ast_set_flag(chan, AST_FLAG_BRIDGE_HANGUP_DONT);
+ ast_set_flag(ast_channel_flags(chan), AST_FLAG_BRIDGE_HANGUP_DONT);
}
if (ast_check_hangup(newchan) || !ast_check_hangup(transferer)) {
@@ -2733,13 +2733,13 @@ static int builtin_atxfer(struct ast_channel *chan, struct ast_channel *peer, st
ast_channel_masquerade(xferchan, transferee);
ast_explicit_goto(xferchan, ast_channel_context(transferee), ast_channel_exten(transferee), ast_channel_priority(transferee));
ast_channel_state_set(xferchan, AST_STATE_UP);
- ast_clear_flag(xferchan, AST_FLAGS_ALL);
+ ast_clear_flag(ast_channel_flags(xferchan), AST_FLAGS_ALL);
/* Do the masquerade manually to make sure that is is completed. */
ast_do_masquerade(xferchan);
ast_channel_state_set(newchan, AST_STATE_UP);
- ast_clear_flag(newchan, AST_FLAGS_ALL);
+ ast_clear_flag(ast_channel_flags(newchan), AST_FLAGS_ALL);
tobj = ast_calloc(1, sizeof(*tobj));
if (!tobj) {
ast_hangup(xferchan);
@@ -3714,13 +3714,13 @@ void ast_channel_log(char *title, struct ast_channel *chan) /* for debug, this i
ast_channel_accountcode(chan), ast_channel_dialcontext(chan), ast_channel_amaflags(chan), ast_channel_macrocontext(chan), ast_channel_macroexten(chan), ast_channel_macropriority(chan));
ast_log(LOG_NOTICE, "CHAN: masq: %p; masqr: %p; _bridge: %p; uniqueID: %s; linkedID:%s\n",
ast_channel_masq(chan), ast_channel_masqr(chan),
- chan->_bridge, ast_channel_uniqueid(chan), ast_channel_linkedid(chan));
+ ast_channel_internal_bridged_channel(chan), ast_channel_uniqueid(chan), ast_channel_linkedid(chan));
if (ast_channel_masqr(chan)) {
ast_log(LOG_NOTICE, "CHAN: masquerading as: %s; cdr: %p;\n",
ast_channel_name(ast_channel_masqr(chan)), ast_channel_cdr(ast_channel_masqr(chan)));
}
- if (chan->_bridge) {
- ast_log(LOG_NOTICE, "CHAN: Bridged to %s\n", ast_channel_name(chan->_bridge));
+ if (ast_channel_internal_bridged_channel(chan)) {
+ ast_log(LOG_NOTICE, "CHAN: Bridged to %s\n", ast_channel_name(ast_channel_internal_bridged_channel(chan)));
}
ast_log(LOG_NOTICE, "===== done ====\n");
@@ -4024,7 +4024,7 @@ int ast_bridge_call(struct ast_channel *chan, struct ast_channel *peer, struct a
ast_cdr_answer(chan_cdr); /* for the sake of cli status checks */
}
}
- if (ast_test_flag(chan,AST_FLAG_BRIDGE_HANGUP_DONT) && (chan_cdr || peer_cdr)) {
+ if (ast_test_flag(ast_channel_flags(chan), AST_FLAG_BRIDGE_HANGUP_DONT) && (chan_cdr || peer_cdr)) {
if (chan_cdr) {
ast_set_flag(chan_cdr, AST_CDR_FLAG_BRIDGED);
}
@@ -4051,8 +4051,8 @@ int ast_bridge_call(struct ast_channel *chan, struct ast_channel *peer, struct a
res = ast_channel_bridge(chan, peer, config, &f, &who);
- if (ast_test_flag(chan, AST_FLAG_ZOMBIE)
- || ast_test_flag(peer, AST_FLAG_ZOMBIE)) {
+ if (ast_test_flag(ast_channel_flags(chan), AST_FLAG_ZOMBIE)
+ || ast_test_flag(ast_channel_flags(peer), AST_FLAG_ZOMBIE)) {
/* Zombies are present time to leave! */
res = -1;
if (f) {
@@ -4122,7 +4122,7 @@ int ast_bridge_call(struct ast_channel *chan, struct ast_channel *peer, struct a
}
}
if (res < 0) {
- if (!ast_test_flag(chan, AST_FLAG_ZOMBIE) && !ast_test_flag(peer, AST_FLAG_ZOMBIE) && !ast_check_hangup(chan) && !ast_check_hangup(peer)) {
+ if (!ast_test_flag(ast_channel_flags(chan), AST_FLAG_ZOMBIE) && !ast_test_flag(ast_channel_flags(peer), AST_FLAG_ZOMBIE) && !ast_check_hangup(chan) && !ast_check_hangup(peer)) {
ast_log(LOG_WARNING, "Bridge failed on channels %s and %s\n", ast_channel_name(chan), ast_channel_name(peer));
}
goto before_you_go;
@@ -4139,7 +4139,7 @@ int ast_bridge_call(struct ast_channel *chan, struct ast_channel *peer, struct a
*/
ast_channel_lock(chan);
if (ast_channel_softhangup_internal_flag(chan) & (AST_SOFTHANGUP_ASYNCGOTO | AST_SOFTHANGUP_UNBRIDGE)) {
- ast_set_flag(chan, AST_FLAG_BRIDGE_HANGUP_DONT);
+ ast_set_flag(ast_channel_flags(chan), AST_FLAG_BRIDGE_HANGUP_DONT);
}
ast_channel_unlock(chan);
res = -1;
@@ -4300,8 +4300,8 @@ before_you_go:
silgen = NULL;
}
- if (ast_test_flag(chan,AST_FLAG_BRIDGE_HANGUP_DONT)) {
- ast_clear_flag(chan,AST_FLAG_BRIDGE_HANGUP_DONT); /* its job is done */
+ if (ast_test_flag(ast_channel_flags(chan), AST_FLAG_BRIDGE_HANGUP_DONT)) {
+ ast_clear_flag(ast_channel_flags(chan), AST_FLAG_BRIDGE_HANGUP_DONT); /* its job is done */
if (bridge_cdr) {
ast_cdr_discard(bridge_cdr);
/* QUESTION: should we copy bridge_cdr fields to the peer before we throw it away? */
@@ -4345,8 +4345,8 @@ before_you_go:
*/
ast_softhangup(chan, AST_SOFTHANGUP_APPUNLOAD);
- autoloopflag = ast_test_flag(chan, AST_FLAG_IN_AUTOLOOP);
- ast_set_flag(chan, AST_FLAG_IN_AUTOLOOP);
+ autoloopflag = ast_test_flag(ast_channel_flags(chan), AST_FLAG_IN_AUTOLOOP);
+ ast_set_flag(ast_channel_flags(chan), AST_FLAG_IN_AUTOLOOP);
if (bridge_cdr && ast_opt_end_cdr_before_h_exten) {
ast_cdr_end(bridge_cdr);
}
@@ -4395,7 +4395,7 @@ before_you_go:
}
}
/* An "h" exten has been run, so indicate that one has been run. */
- ast_set_flag(chan, AST_FLAG_BRIDGE_HANGUP_RUN);
+ ast_set_flag(ast_channel_flags(chan), AST_FLAG_BRIDGE_HANGUP_RUN);
ast_channel_unlock(chan);
/* protect the lastapp/lastdata against the effects of the hangup/dialplan code */
@@ -4403,7 +4403,7 @@ before_you_go:
ast_copy_string(bridge_cdr->lastapp, savelastapp, sizeof(bridge_cdr->lastapp));
ast_copy_string(bridge_cdr->lastdata, savelastdata, sizeof(bridge_cdr->lastdata));
}
- ast_set2_flag(chan, autoloopflag, AST_FLAG_IN_AUTOLOOP);
+ ast_set2_flag(ast_channel_flags(chan), autoloopflag, AST_FLAG_IN_AUTOLOOP);
}
/* obey the NoCDR() wishes. -- move the DISABLED flag to the bridge CDR if it was set on the channel during the bridge... */
@@ -4747,9 +4747,9 @@ static int manage_parked_call(struct parkeduser *pu, const struct pollfd *pfds,
}
if (pfds[y].revents & POLLPRI) {
- ast_set_flag(chan, AST_FLAG_EXCEPTION);
+ ast_set_flag(ast_channel_flags(chan), AST_FLAG_EXCEPTION);
} else {
- ast_clear_flag(chan, AST_FLAG_EXCEPTION);
+ ast_clear_flag(ast_channel_flags(chan), AST_FLAG_EXCEPTION);
}
ast_channel_fdno_set(chan, x);
@@ -7227,7 +7227,7 @@ static const struct ast_datastore_info pickup_active = {
int ast_can_pickup(struct ast_channel *chan)
{
- if (!ast_channel_pbx(chan) && !ast_channel_masq(chan) && !ast_test_flag(chan, AST_FLAG_ZOMBIE)
+ if (!ast_channel_pbx(chan) && !ast_channel_masq(chan) && !ast_test_flag(ast_channel_flags(chan), AST_FLAG_ZOMBIE)
&& (ast_channel_state(chan) == AST_STATE_RINGING
|| ast_channel_state(chan) == AST_STATE_RING
/*
@@ -7353,7 +7353,7 @@ int ast_do_pickup(struct ast_channel *chan, struct ast_channel *target)
}
/* setting this flag to generate a reason header in the cancel message to the ringing channel */
- ast_set_flag(chan, AST_FLAG_ANSWERED_ELSEWHERE);
+ ast_set_flag(ast_channel_flags(chan), AST_FLAG_ANSWERED_ELSEWHERE);
if (ast_channel_masquerade(target, chan)) {
ast_log(LOG_WARNING, "Unable to masquerade '%s' into '%s'\n", chan_name,
diff --git a/main/file.c b/main/file.c
index 82f2aab86..aaccb11fe 100644
--- a/main/file.c
+++ b/main/file.c
@@ -1040,7 +1040,7 @@ int ast_streamfile(struct ast_channel *chan, const char *filename, const char *p
ast_debug(1, "Ooh, found a video stream, too, format %s\n", ast_getformatname(&vfs->fmt->format));
}
- if (ast_test_flag(chan, AST_FLAG_MASQ_NOSTREAM))
+ if (ast_test_flag(ast_channel_flags(chan), AST_FLAG_MASQ_NOSTREAM))
fs->orig_chan_name = ast_strdup(ast_channel_name(chan));
if (ast_applystream(chan, fs))
return -1;
@@ -1252,9 +1252,9 @@ static int waitstream_core(struct ast_channel *c, const char *breakon,
reverse = "";
/* Switch the channel to end DTMF frame only. waitstream_core doesn't care about the start of DTMF. */
- ast_set_flag(c, AST_FLAG_END_DTMF_ONLY);
+ ast_set_flag(ast_channel_flags(c), AST_FLAG_END_DTMF_ONLY);
- if (ast_test_flag(c, AST_FLAG_MASQ_NOSTREAM))
+ if (ast_test_flag(ast_channel_flags(c), AST_FLAG_MASQ_NOSTREAM))
orig_chan_name = ast_strdupa(ast_channel_name(c));
while (ast_channel_stream(c)) {
@@ -1269,7 +1269,7 @@ static int waitstream_core(struct ast_channel *c, const char *breakon,
ms = ast_sched_wait(ast_channel_sched(c));
- if (ms < 0 && !c->timingfunc) {
+ if (ms < 0 && !ast_channel_timingfunc(c)) {
ast_stopstream(c);
break;
}
@@ -1279,7 +1279,7 @@ static int waitstream_core(struct ast_channel *c, const char *breakon,
res = ast_waitfor(c, ms);
if (res < 0) {
ast_log(LOG_WARNING, "Select failed (%s)\n", strerror(errno));
- ast_clear_flag(c, AST_FLAG_END_DTMF_ONLY);
+ ast_clear_flag(ast_channel_flags(c), AST_FLAG_END_DTMF_ONLY);
return res;
}
} else {
@@ -1290,11 +1290,11 @@ static int waitstream_core(struct ast_channel *c, const char *breakon,
if (errno == EINTR)
continue;
ast_log(LOG_WARNING, "Wait failed (%s)\n", strerror(errno));
- ast_clear_flag(c, AST_FLAG_END_DTMF_ONLY);
+ ast_clear_flag(ast_channel_flags(c), AST_FLAG_END_DTMF_ONLY);
return -1;
} else if (outfd > -1) { /* this requires cmdfd set */
/* The FD we were watching has something waiting */
- ast_clear_flag(c, AST_FLAG_END_DTMF_ONLY);
+ ast_clear_flag(ast_channel_flags(c), AST_FLAG_END_DTMF_ONLY);
return 1;
}
/* if rchan is set, it is 'c' */
@@ -1303,7 +1303,7 @@ static int waitstream_core(struct ast_channel *c, const char *breakon,
if (res > 0) {
struct ast_frame *fr = ast_read(c);
if (!fr) {
- ast_clear_flag(c, AST_FLAG_END_DTMF_ONLY);
+ ast_clear_flag(ast_channel_flags(c), AST_FLAG_END_DTMF_ONLY);
return -1;
}
switch (fr->frametype) {
@@ -1314,7 +1314,7 @@ static int waitstream_core(struct ast_channel *c, const char *breakon,
S_COR(ast_channel_caller(c)->id.number.valid, ast_channel_caller(c)->id.number.str, NULL))) {
res = fr->subclass.integer;
ast_frfree(fr);
- ast_clear_flag(c, AST_FLAG_END_DTMF_ONLY);
+ ast_clear_flag(ast_channel_flags(c), AST_FLAG_END_DTMF_ONLY);
return res;
}
} else {
@@ -1332,7 +1332,7 @@ static int waitstream_core(struct ast_channel *c, const char *breakon,
ast_stream_rewind(ast_channel_stream(c), skip_ms);
} else if (strchr(breakon, res)) {
ast_frfree(fr);
- ast_clear_flag(c, AST_FLAG_END_DTMF_ONLY);
+ ast_clear_flag(ast_channel_flags(c), AST_FLAG_END_DTMF_ONLY);
return res;
}
}
@@ -1343,7 +1343,7 @@ static int waitstream_core(struct ast_channel *c, const char *breakon,
case AST_CONTROL_BUSY:
case AST_CONTROL_CONGESTION:
ast_frfree(fr);
- ast_clear_flag(c, AST_FLAG_END_DTMF_ONLY);
+ ast_clear_flag(ast_channel_flags(c), AST_FLAG_END_DTMF_ONLY);
return -1;
case AST_CONTROL_RINGING:
case AST_CONTROL_ANSWER:
@@ -1379,7 +1379,7 @@ static int waitstream_core(struct ast_channel *c, const char *breakon,
ast_sched_runq(ast_channel_sched(c));
}
- ast_clear_flag(c, AST_FLAG_END_DTMF_ONLY);
+ ast_clear_flag(ast_channel_flags(c), AST_FLAG_END_DTMF_ONLY);
return (err || ast_channel_softhangup_internal_flag(c)) ? -1 : 0;
}
diff --git a/main/indications.c b/main/indications.c
index 20ce4b894..c62a495c6 100644
--- a/main/indications.c
+++ b/main/indications.c
@@ -163,9 +163,9 @@ static void *playtones_alloc(struct ast_channel *chan, void *params)
/* Let interrupts interrupt :) */
if (pd->interruptible) {
- ast_set_flag(chan, AST_FLAG_WRITE_INT);
+ ast_set_flag(ast_channel_flags(chan), AST_FLAG_WRITE_INT);
} else {
- ast_clear_flag(chan, AST_FLAG_WRITE_INT);
+ ast_clear_flag(ast_channel_flags(chan), AST_FLAG_WRITE_INT);
}
return ps;
diff --git a/main/manager.c b/main/manager.c
index 482496dca..a5e30b06c 100644
--- a/main/manager.c
+++ b/main/manager.c
@@ -3321,8 +3321,8 @@ static int action_status(struct mansession *s, const struct message *m)
}
channels++;
- if (c->_bridge) {
- snprintf(bridge, sizeof(bridge), "BridgedChannel: %s\r\nBridgedUniqueid: %s\r\n", ast_channel_name(c->_bridge), ast_channel_uniqueid(c->_bridge));
+ if (ast_channel_internal_bridged_channel(c)) {
+ snprintf(bridge, sizeof(bridge), "BridgedChannel: %s\r\nBridgedUniqueid: %s\r\n", ast_channel_name(ast_channel_internal_bridged_channel(c)), ast_channel_uniqueid(ast_channel_internal_bridged_channel(c)));
} else {
bridge[0] = '\0';
}
@@ -3502,7 +3502,7 @@ static int action_redirect(struct mansession *s, const struct message *m)
if (ast_channel_pbx(chan)) {
ast_channel_lock(chan);
- ast_set_flag(chan, AST_FLAG_BRIDGE_HANGUP_DONT); /* don't let the after-bridge code run the h-exten */
+ ast_set_flag(ast_channel_flags(chan), AST_FLAG_BRIDGE_HANGUP_DONT); /* don't let the after-bridge code run the h-exten */
ast_channel_unlock(chan);
}
@@ -3512,7 +3512,7 @@ static int action_redirect(struct mansession *s, const struct message *m)
if (chan2) {
if (ast_channel_pbx(chan2)) {
ast_channel_lock(chan2);
- ast_set_flag(chan2, AST_FLAG_BRIDGE_HANGUP_DONT); /* don't let the after-bridge code run the h-exten */
+ ast_set_flag(ast_channel_flags(chan2), AST_FLAG_BRIDGE_HANGUP_DONT); /* don't let the after-bridge code run the h-exten */
ast_channel_unlock(chan2);
}
if (!ast_strlen_zero(context2)) {
diff --git a/main/pbx.c b/main/pbx.c
index d848fc3b6..221e5173f 100644
--- a/main/pbx.c
+++ b/main/pbx.c
@@ -5119,8 +5119,8 @@ static enum ast_pbx_result __ast_pbx_run(struct ast_channel *c,
ast_channel_pbx(c)->rtimeoutms = 10000;
ast_channel_pbx(c)->dtimeoutms = 5000;
- autoloopflag = ast_test_flag(c, AST_FLAG_IN_AUTOLOOP); /* save value to restore at the end */
- ast_set_flag(c, AST_FLAG_IN_AUTOLOOP);
+ autoloopflag = ast_test_flag(ast_channel_flags(c), AST_FLAG_IN_AUTOLOOP); /* save value to restore at the end */
+ ast_set_flag(ast_channel_flags(c), AST_FLAG_IN_AUTOLOOP);
if (ast_strlen_zero(ast_channel_exten(c))) {
/* If not successful fall back to 's' - but only if there is no given exten */
@@ -5370,7 +5370,7 @@ static enum ast_pbx_result __ast_pbx_run(struct ast_channel *c,
}
if ((!args || !args->no_hangup_chan)
- && !ast_test_flag(c, AST_FLAG_BRIDGE_HANGUP_RUN)
+ && !ast_test_flag(ast_channel_flags(c), AST_FLAG_BRIDGE_HANGUP_RUN)
&& ast_exists_extension(c, ast_channel_context(c), "h", 1,
S_COR(ast_channel_caller(c)->id.number.valid, ast_channel_caller(c)->id.number.str, NULL))) {
set_ext_pri(c, "h", 1);
@@ -5388,8 +5388,8 @@ static enum ast_pbx_result __ast_pbx_run(struct ast_channel *c,
ast_verb(2, "Spawn extension (%s, %s, %d) exited non-zero on '%s'\n", ast_channel_context(c), ast_channel_exten(c), ast_channel_priority(c), ast_channel_name(c));
}
}
- ast_set2_flag(c, autoloopflag, AST_FLAG_IN_AUTOLOOP);
- ast_clear_flag(c, AST_FLAG_BRIDGE_HANGUP_RUN); /* from one round to the next, make sure this gets cleared */
+ ast_set2_flag(ast_channel_flags(c), autoloopflag, AST_FLAG_IN_AUTOLOOP);
+ ast_clear_flag(ast_channel_flags(c), AST_FLAG_BRIDGE_HANGUP_RUN); /* from one round to the next, make sure this gets cleared */
pbx_destroy(ast_channel_pbx(c));
ast_channel_pbx_set(c, NULL);
@@ -8302,7 +8302,7 @@ int ast_explicit_goto(struct ast_channel *chan, const char *context, const char
if (priority > -1) {
ast_channel_priority_set(chan, priority);
/* see flag description in channel.h for explanation */
- if (ast_test_flag(chan, AST_FLAG_IN_AUTOLOOP)) {
+ if (ast_test_flag(ast_channel_flags(chan), AST_FLAG_IN_AUTOLOOP)) {
ast_channel_priority_set(chan, ast_channel_priority(chan) - 1);
}
}
@@ -9977,7 +9977,7 @@ static int pbx_builtin_background(struct ast_channel *chan, const char *data)
* users can EXEC Background and reasonably expect that the DTMF code will
* be returned (see #16434).
*/
- if (!ast_test_flag(chan, AST_FLAG_DISABLE_WORKAROUNDS)
+ if (!ast_test_flag(ast_channel_flags(chan), AST_FLAG_DISABLE_WORKAROUNDS)
&& (exten[0] = res)
&& ast_canmatch_extension(chan, args.context, exten, 1,
S_COR(ast_channel_caller(chan)->id.number.valid, ast_channel_caller(chan)->id.number.str, NULL))
diff --git a/main/rtp_engine.c b/main/rtp_engine.c
index e739c7014..fc3118d31 100644
--- a/main/rtp_engine.c
+++ b/main/rtp_engine.c
@@ -1245,7 +1245,7 @@ static enum ast_bridge_result remote_bridge_loop(struct ast_channel *c0,
cs[1] = cs[2];
}
- if (ast_test_flag(c0, AST_FLAG_ZOMBIE)) {
+ if (ast_test_flag(ast_channel_flags(c0), AST_FLAG_ZOMBIE)) {
ast_debug(1, "Channel '%s' Zombie cleardown from bridge\n", ast_channel_name(c0));
} else if (ast_channel_tech_pvt(c0) != pvt0) {
ast_debug(1, "Channel c0->'%s' pvt changed, in bridge with c1->'%s'\n", ast_channel_name(c0), ast_channel_name(c1));
@@ -1254,7 +1254,7 @@ static enum ast_bridge_result remote_bridge_loop(struct ast_channel *c0,
} else if (glue0->update_peer(c0, NULL, NULL, NULL, 0, 0)) {
ast_log(LOG_WARNING, "Channel '%s' failed to break RTP bridge\n", ast_channel_name(c0));
}
- if (ast_test_flag(c1, AST_FLAG_ZOMBIE)) {
+ if (ast_test_flag(ast_channel_flags(c1), AST_FLAG_ZOMBIE)) {
ast_debug(1, "Channel '%s' Zombie cleardown from bridge\n", ast_channel_name(c1));
} else if (ast_channel_tech_pvt(c1) != pvt1) {
ast_debug(1, "Channel c1->'%s' pvt changed, in bridge with c0->'%s'\n", ast_channel_name(c1), ast_channel_name(c0));