summaryrefslogtreecommitdiff
path: root/main
diff options
context:
space:
mode:
authorTerry Wilson <twilson@digium.com>2012-02-29 16:52:47 +0000
committerTerry Wilson <twilson@digium.com>2012-02-29 16:52:47 +0000
commita9d607a35764d93790172cab1f630e14fb8e043c (patch)
treedadea55813cfc525898844c51eec824d468455cb /main
parent0b988da21c1ec856b7b8bad2434bf93498d17cfd (diff)
Opaquify ast_channel structs and lists
Review: https://reviewboard.asterisk.org/r/1773/ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@357542 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'main')
-rw-r--r--main/abstract_jb.c30
-rw-r--r--main/app.c4
-rw-r--r--main/autochan.c8
-rw-r--r--main/ccss.c8
-rw-r--r--main/cdr.c16
-rw-r--r--main/cel.c30
-rw-r--r--main/channel.c331
-rw-r--r--main/channel_internal_api.c74
-rw-r--r--main/cli.c16
-rw-r--r--main/dial.c8
-rw-r--r--main/features.c72
-rw-r--r--main/file.c2
-rw-r--r--main/manager.c24
-rw-r--r--main/message.c4
-rw-r--r--main/pbx.c90
15 files changed, 398 insertions, 319 deletions
diff --git a/main/abstract_jb.c b/main/abstract_jb.c
index c35b1d8aa..fa5597d0c 100644
--- a/main/abstract_jb.c
+++ b/main/abstract_jb.c
@@ -134,7 +134,7 @@ static long get_now(struct ast_jb *jb, struct timeval *tv);
static void jb_choose_impl(struct ast_channel *chan)
{
- struct ast_jb *jb = &chan->jb;
+ struct ast_jb *jb = ast_channel_jb(chan);
struct ast_jb_conf *jbconf = &jb->conf;
const struct ast_jb_impl *test_impl;
int i, avail_impl_count = ARRAY_LEN(avail_impl);
@@ -156,8 +156,8 @@ static void jb_choose_impl(struct ast_channel *chan)
int ast_jb_do_usecheck(struct ast_channel *c0, struct ast_channel *c1)
{
- struct ast_jb *jb0 = &c0->jb;
- struct ast_jb *jb1 = &c1->jb;
+ struct ast_jb *jb0 = ast_channel_jb(c0);
+ struct ast_jb *jb1 = ast_channel_jb(c1);
struct ast_jb_conf *conf0 = &jb0->conf;
struct ast_jb_conf *conf1 = &jb1->conf;
int c0_wants_jitter = ast_channel_tech(c0)->properties & AST_CHAN_TP_WANTSJITTER;
@@ -217,8 +217,8 @@ int ast_jb_do_usecheck(struct ast_channel *c0, struct ast_channel *c1)
int ast_jb_get_when_to_wakeup(struct ast_channel *c0, struct ast_channel *c1, int time_left)
{
- struct ast_jb *jb0 = &c0->jb;
- struct ast_jb *jb1 = &c1->jb;
+ struct ast_jb *jb0 = ast_channel_jb(c0);
+ struct ast_jb *jb1 = ast_channel_jb(c1);
int c0_use_jb = ast_test_flag(jb0, JB_USE);
int c0_jb_is_created = ast_test_flag(jb0, JB_CREATED);
int c1_use_jb = ast_test_flag(jb1, JB_USE);
@@ -257,7 +257,7 @@ int ast_jb_get_when_to_wakeup(struct ast_channel *c0, struct ast_channel *c1, in
int ast_jb_put(struct ast_channel *chan, struct ast_frame *f)
{
- struct ast_jb *jb = &chan->jb;
+ struct ast_jb *jb = ast_channel_jb(chan);
const struct ast_jb_impl *jbimpl = jb->impl;
void *jbobj = jb->jbobj;
struct ast_frame *frr;
@@ -322,8 +322,8 @@ int ast_jb_put(struct ast_channel *chan, struct ast_frame *f)
void ast_jb_get_and_deliver(struct ast_channel *c0, struct ast_channel *c1)
{
- struct ast_jb *jb0 = &c0->jb;
- struct ast_jb *jb1 = &c1->jb;
+ struct ast_jb *jb0 = ast_channel_jb(c0);
+ struct ast_jb *jb1 = ast_channel_jb(c1);
int c0_use_jb = ast_test_flag(jb0, JB_USE);
int c0_jb_is_created = ast_test_flag(jb0, JB_CREATED);
int c1_use_jb = ast_test_flag(jb1, JB_USE);
@@ -339,7 +339,7 @@ void ast_jb_get_and_deliver(struct ast_channel *c0, struct ast_channel *c1)
static void jb_get_and_deliver(struct ast_channel *chan)
{
- struct ast_jb *jb = &chan->jb;
+ struct ast_jb *jb = ast_channel_jb(chan);
const struct ast_jb_impl *jbimpl = jb->impl;
void *jbobj = jb->jbobj;
struct ast_frame *f, finterp = { .frametype = AST_FRAME_VOICE, };
@@ -399,7 +399,7 @@ static void jb_get_and_deliver(struct ast_channel *chan)
static int create_jb(struct ast_channel *chan, struct ast_frame *frr)
{
- struct ast_jb *jb = &chan->jb;
+ struct ast_jb *jb = ast_channel_jb(chan);
struct ast_jb_conf *jbconf = &jb->conf;
const struct ast_jb_impl *jbimpl = jb->impl;
void *jbobj;
@@ -486,7 +486,7 @@ static int create_jb(struct ast_channel *chan, struct ast_frame *frr)
void ast_jb_destroy(struct ast_channel *chan)
{
- struct ast_jb *jb = &chan->jb;
+ struct ast_jb *jb = ast_channel_jb(chan);
const struct ast_jb_impl *jbimpl = jb->impl;
void *jbobj = jb->jbobj;
struct ast_frame *f;
@@ -566,19 +566,19 @@ int ast_jb_read_conf(struct ast_jb_conf *conf, const char *varname, const char *
void ast_jb_configure(struct ast_channel *chan, const struct ast_jb_conf *conf)
{
- memcpy(&chan->jb.conf, conf, sizeof(*conf));
+ memcpy(&ast_channel_jb(chan)->conf, conf, sizeof(*conf));
}
void ast_jb_get_config(const struct ast_channel *chan, struct ast_jb_conf *conf)
{
- memcpy(conf, &chan->jb.conf, sizeof(*conf));
+ memcpy(conf, &ast_channel_jb((struct ast_channel *) chan)->conf, sizeof(*conf));
}
void ast_jb_empty_and_reset(struct ast_channel *c0, struct ast_channel *c1)
{
- struct ast_jb *jb0 = &c0->jb;
- struct ast_jb *jb1 = &c1->jb;
+ struct ast_jb *jb0 = ast_channel_jb(c0);
+ struct ast_jb *jb1 = ast_channel_jb(c1);
int c0_use_jb = ast_test_flag(jb0, JB_USE);
int c0_jb_is_created = ast_test_flag(jb0, JB_CREATED);
int c1_use_jb = ast_test_flag(jb1, JB_USE);
diff --git a/main/app.c b/main/app.c
index f937b0e30..1719a11f1 100644
--- a/main/app.c
+++ b/main/app.c
@@ -149,14 +149,14 @@ int ast_app_dtget(struct ast_channel *chan, const char *context, char *collect,
}
collect[x++] = res;
if (!ast_matchmore_extension(chan, context, collect, 1,
- S_COR(chan->caller.id.number.valid, chan->caller.id.number.str, NULL))) {
+ S_COR(ast_channel_caller(chan)->id.number.valid, ast_channel_caller(chan)->id.number.str, NULL))) {
break;
}
}
if (res >= 0) {
res = ast_exists_extension(chan, context, collect, 1,
- S_COR(chan->caller.id.number.valid, chan->caller.id.number.str, NULL)) ? 1 : 0;
+ S_COR(ast_channel_caller(chan)->id.number.valid, ast_channel_caller(chan)->id.number.str, NULL)) ? 1 : 0;
}
return res;
diff --git a/main/autochan.c b/main/autochan.c
index 31f11573f..a1cd033a2 100644
--- a/main/autochan.c
+++ b/main/autochan.c
@@ -48,7 +48,7 @@ struct ast_autochan *ast_autochan_setup(struct ast_channel *chan)
autochan->chan = ast_channel_ref(chan);
ast_channel_lock(autochan->chan);
- AST_LIST_INSERT_TAIL(&autochan->chan->autochans, autochan, list);
+ AST_LIST_INSERT_TAIL(ast_channel_autochans(autochan->chan), autochan, list);
ast_channel_unlock(autochan->chan);
ast_debug(1, "Created autochan %p to hold channel %s (%p)\n", autochan, ast_channel_name(chan), chan);
@@ -61,7 +61,7 @@ void ast_autochan_destroy(struct ast_autochan *autochan)
struct ast_autochan *autochan_iter;
ast_channel_lock(autochan->chan);
- AST_LIST_TRAVERSE_SAFE_BEGIN(&autochan->chan->autochans, autochan_iter, list) {
+ AST_LIST_TRAVERSE_SAFE_BEGIN(ast_channel_autochans(autochan->chan), autochan_iter, list) {
if (autochan_iter == autochan) {
AST_LIST_REMOVE_CURRENT(list);
ast_debug(1, "Removed autochan %p from the list, about to free it\n", autochan);
@@ -80,9 +80,9 @@ void ast_autochan_new_channel(struct ast_channel *old_chan, struct ast_channel *
{
struct ast_autochan *autochan;
- AST_LIST_APPEND_LIST(&new_chan->autochans, &old_chan->autochans, list);
+ AST_LIST_APPEND_LIST(ast_channel_autochans(new_chan), ast_channel_autochans(old_chan), list);
- AST_LIST_TRAVERSE(&new_chan->autochans, autochan, list) {
+ AST_LIST_TRAVERSE(ast_channel_autochans(new_chan), autochan, list) {
if (autochan->chan == old_chan) {
autochan->chan = ast_channel_unref(old_chan);
autochan->chan = ast_channel_ref(new_chan);
diff --git a/main/ccss.c b/main/ccss.c
index ad3e82ec0..31270c41e 100644
--- a/main/ccss.c
+++ b/main/ccss.c
@@ -2531,11 +2531,11 @@ static int cc_generic_agent_init(struct ast_cc_agent *agent, struct ast_channel
}
generic_pvt->offer_timer_id = -1;
- if (chan->caller.id.number.valid && chan->caller.id.number.str) {
- ast_copy_string(generic_pvt->cid_num, chan->caller.id.number.str, sizeof(generic_pvt->cid_num));
+ if (ast_channel_caller(chan)->id.number.valid && ast_channel_caller(chan)->id.number.str) {
+ ast_copy_string(generic_pvt->cid_num, ast_channel_caller(chan)->id.number.str, sizeof(generic_pvt->cid_num));
}
- if (chan->caller.id.name.valid && chan->caller.id.name.str) {
- ast_copy_string(generic_pvt->cid_name, chan->caller.id.name.str, sizeof(generic_pvt->cid_name));
+ if (ast_channel_caller(chan)->id.name.valid && ast_channel_caller(chan)->id.name.str) {
+ ast_copy_string(generic_pvt->cid_name, ast_channel_caller(chan)->id.name.str, sizeof(generic_pvt->cid_name));
}
ast_copy_string(generic_pvt->exten, S_OR(ast_channel_macroexten(chan), ast_channel_exten(chan)), sizeof(generic_pvt->exten));
ast_copy_string(generic_pvt->context, S_OR(ast_channel_macrocontext(chan), ast_channel_context(chan)), sizeof(generic_pvt->context));
diff --git a/main/cdr.c b/main/cdr.c
index af6885308..29deb2fe9 100644
--- a/main/cdr.c
+++ b/main/cdr.c
@@ -893,18 +893,18 @@ static void set_one_cid(struct ast_cdr *cdr, struct ast_channel *c)
}
/* Grab source from ANI or normal Caller*ID */
- num = S_COR(c->caller.ani.number.valid, c->caller.ani.number.str,
- S_COR(c->caller.id.number.valid, c->caller.id.number.str, NULL));
+ num = S_COR(ast_channel_caller(c)->ani.number.valid, ast_channel_caller(c)->ani.number.str,
+ S_COR(ast_channel_caller(c)->id.number.valid, ast_channel_caller(c)->id.number.str, NULL));
ast_callerid_merge(cdr->clid, sizeof(cdr->clid),
- S_COR(c->caller.id.name.valid, c->caller.id.name.str, NULL), num, "");
+ S_COR(ast_channel_caller(c)->id.name.valid, ast_channel_caller(c)->id.name.str, NULL), num, "");
ast_copy_string(cdr->src, S_OR(num, ""), sizeof(cdr->src));
- ast_cdr_setvar(cdr, "dnid", S_OR(c->dialed.number.str, ""), 0);
+ ast_cdr_setvar(cdr, "dnid", S_OR(ast_channel_dialed(c)->number.str, ""), 0);
- if (c->caller.id.subaddress.valid) {
- ast_cdr_setvar(cdr, "callingsubaddr", S_OR(c->caller.id.subaddress.str, ""), 0);
+ if (ast_channel_caller(c)->id.subaddress.valid) {
+ ast_cdr_setvar(cdr, "callingsubaddr", S_OR(ast_channel_caller(c)->id.subaddress.str, ""), 0);
}
- if (c->dialed.subaddress.valid) {
- ast_cdr_setvar(cdr, "calledsubaddr", S_OR(c->dialed.subaddress.str, ""), 0);
+ if (ast_channel_dialed(c)->subaddress.valid) {
+ ast_cdr_setvar(cdr, "calledsubaddr", S_OR(ast_channel_dialed(c)->subaddress.str, ""), 0);
}
}
diff --git a/main/cel.c b/main/cel.c
index fdf1bf0f1..efc7e7447 100644
--- a/main/cel.c
+++ b/main/cel.c
@@ -414,7 +414,7 @@ struct ast_channel *ast_cel_fabricate_channel_from_event(const struct ast_event
return NULL;
}
- headp = &tchan->varshead;
+ headp = ast_channel_varshead(tchan);
/* first, get the variables from the event */
if (ast_cel_fill_record(event, &record)) {
@@ -452,15 +452,15 @@ struct ast_channel *ast_cel_fabricate_channel_from_event(const struct ast_event
AST_LIST_INSERT_HEAD(headp, newvariable, entries);
}
- tchan->caller.id.name.valid = 1;
- tchan->caller.id.name.str = ast_strdup(record.caller_id_name);
- tchan->caller.id.number.valid = 1;
- tchan->caller.id.number.str = ast_strdup(record.caller_id_num);
- tchan->caller.ani.number.valid = 1;
- tchan->caller.ani.number.str = ast_strdup(record.caller_id_ani);
- tchan->redirecting.from.number.valid = 1;
- tchan->redirecting.from.number.str = ast_strdup(record.caller_id_rdnis);
- tchan->dialed.number.str = ast_strdup(record.caller_id_dnid);
+ ast_channel_caller(tchan)->id.name.valid = 1;
+ ast_channel_caller(tchan)->id.name.str = ast_strdup(record.caller_id_name);
+ ast_channel_caller(tchan)->id.number.valid = 1;
+ ast_channel_caller(tchan)->id.number.str = ast_strdup(record.caller_id_num);
+ ast_channel_caller(tchan)->ani.number.valid = 1;
+ ast_channel_caller(tchan)->ani.number.str = ast_strdup(record.caller_id_ani);
+ ast_channel_redirecting(tchan)->from.number.valid = 1;
+ ast_channel_redirecting(tchan)->from.number.str = ast_strdup(record.caller_id_rdnis);
+ ast_channel_dialed(tchan)->number.str = ast_strdup(record.caller_id_dnid);
ast_channel_exten_set(tchan, record.extension);
ast_channel_context_set(tchan, record.context);
@@ -552,15 +552,15 @@ int ast_cel_report_event(struct ast_channel *chan, enum ast_cel_event_type event
AST_EVENT_IE_CEL_EVENT_TIME_USEC, AST_EVENT_IE_PLTYPE_UINT, eventtime.tv_usec,
AST_EVENT_IE_CEL_USEREVENT_NAME, AST_EVENT_IE_PLTYPE_STR, userdefevname,
AST_EVENT_IE_CEL_CIDNAME, AST_EVENT_IE_PLTYPE_STR,
- S_COR(chan->caller.id.name.valid, chan->caller.id.name.str, ""),
+ S_COR(ast_channel_caller(chan)->id.name.valid, ast_channel_caller(chan)->id.name.str, ""),
AST_EVENT_IE_CEL_CIDNUM, AST_EVENT_IE_PLTYPE_STR,
- S_COR(chan->caller.id.number.valid, chan->caller.id.number.str, ""),
+ S_COR(ast_channel_caller(chan)->id.number.valid, ast_channel_caller(chan)->id.number.str, ""),
AST_EVENT_IE_CEL_CIDANI, AST_EVENT_IE_PLTYPE_STR,
- S_COR(chan->caller.ani.number.valid, chan->caller.ani.number.str, ""),
+ S_COR(ast_channel_caller(chan)->ani.number.valid, ast_channel_caller(chan)->ani.number.str, ""),
AST_EVENT_IE_CEL_CIDRDNIS, AST_EVENT_IE_PLTYPE_STR,
- S_COR(chan->redirecting.from.number.valid, chan->redirecting.from.number.str, ""),
+ S_COR(ast_channel_redirecting(chan)->from.number.valid, ast_channel_redirecting(chan)->from.number.str, ""),
AST_EVENT_IE_CEL_CIDDNID, AST_EVENT_IE_PLTYPE_STR,
- S_OR(chan->dialed.number.str, ""),
+ S_OR(ast_channel_dialed(chan)->number.str, ""),
AST_EVENT_IE_CEL_EXTEN, AST_EVENT_IE_PLTYPE_STR, ast_channel_exten(chan),
AST_EVENT_IE_CEL_CONTEXT, AST_EVENT_IE_PLTYPE_STR, ast_channel_context(chan),
AST_EVENT_IE_CEL_CHANNAME, AST_EVENT_IE_PLTYPE_STR, ast_channel_name(chan),
diff --git a/main/channel.c b/main/channel.c
index c900d0e65..387b98bea 100644
--- a/main/channel.c
+++ b/main/channel.c
@@ -585,11 +585,11 @@ int ast_check_hangup(struct ast_channel *chan)
{
if (chan->_softhangup) /* yes if soft hangup flag set */
return 1;
- if (ast_tvzero(chan->whentohangup)) /* no if no hangup scheduled */
+ if (ast_tvzero(*ast_channel_whentohangup(chan))) /* no if no hangup scheduled */
return 0;
- if (ast_tvdiff_ms(chan->whentohangup, ast_tvnow()) > 0) /* no if hangup time has not come yet. */
+ if (ast_tvdiff_ms(*ast_channel_whentohangup(chan), ast_tvnow()) > 0) /* no if hangup time has not come yet. */
return 0;
- ast_debug(4, "Hangup time has come: %" PRIi64 "\n", ast_tvdiff_ms(chan->whentohangup, ast_tvnow()));
+ ast_debug(4, "Hangup time has come: %" PRIi64 "\n", ast_tvdiff_ms(*ast_channel_whentohangup(chan), ast_tvnow()));
chan->_softhangup |= AST_SOFTHANGUP_TIMEOUT; /* record event */
return 1;
}
@@ -642,7 +642,12 @@ int ast_shutting_down(void)
/*! \brief Set when to hangup channel */
void ast_channel_setwhentohangup_tv(struct ast_channel *chan, struct timeval offset)
{
- chan->whentohangup = ast_tvzero(offset) ? offset : ast_tvadd(offset, ast_tvnow());
+ if (ast_tvzero(offset)) {
+ ast_channel_whentohangup_set(chan, &offset);
+ } else {
+ struct timeval tv = ast_tvadd(offset, ast_tvnow());
+ ast_channel_whentohangup_set(chan, &tv);
+ }
ast_queue_frame(chan, &ast_null_frame);
return;
}
@@ -658,7 +663,7 @@ int ast_channel_cmpwhentohangup_tv(struct ast_channel *chan, struct timeval offs
{
struct timeval whentohangup;
- if (ast_tvzero(chan->whentohangup))
+ if (ast_tvzero(*ast_channel_whentohangup(chan)))
return ast_tvzero(offset) ? 0 : -1;
if (ast_tvzero(offset))
@@ -666,7 +671,7 @@ int ast_channel_cmpwhentohangup_tv(struct ast_channel *chan, struct timeval offs
whentohangup = ast_tvadd(offset, ast_tvnow());
- return ast_tvdiff_ms(whentohangup, chan->whentohangup);
+ return ast_tvdiff_ms(whentohangup, *ast_channel_whentohangup(chan));
}
int ast_channel_cmpwhentohangup(struct ast_channel *chan, time_t offset)
@@ -971,22 +976,22 @@ __ast_channel_alloc_ap(int needqueue, int state, const char *cid_num, const char
}
ast_channel_sched_set(tmp, schedctx);
- ast_party_dialed_init(&tmp->dialed);
- ast_party_caller_init(&tmp->caller);
- ast_party_connected_line_init(&tmp->connected);
- ast_party_redirecting_init(&tmp->redirecting);
+ ast_party_dialed_init(ast_channel_dialed(tmp));
+ ast_party_caller_init(ast_channel_caller(tmp));
+ ast_party_connected_line_init(ast_channel_connected(tmp));
+ ast_party_redirecting_init(ast_channel_redirecting(tmp));
if (cid_name) {
- tmp->caller.id.name.valid = 1;
- tmp->caller.id.name.str = ast_strdup(cid_name);
- if (!tmp->caller.id.name.str) {
+ ast_channel_caller(tmp)->id.name.valid = 1;
+ ast_channel_caller(tmp)->id.name.str = ast_strdup(cid_name);
+ if (!ast_channel_caller(tmp)->id.name.str) {
return ast_channel_unref(tmp);
}
}
if (cid_num) {
- tmp->caller.id.number.valid = 1;
- tmp->caller.id.number.str = ast_strdup(cid_num);
- if (!tmp->caller.id.number.str) {
+ ast_channel_caller(tmp)->id.number.valid = 1;
+ ast_channel_caller(tmp)->id.number.str = ast_strdup(cid_num);
+ if (!ast_channel_caller(tmp)->id.number.str) {
return ast_channel_unref(tmp);
}
}
@@ -1105,12 +1110,12 @@ __ast_channel_alloc_ap(int needqueue, int state, const char *cid_num, const char
ast_cel_report_event(tmp, AST_CEL_CHANNEL_START, NULL, NULL, NULL);
- headp = &tmp->varshead;
+ headp = ast_channel_varshead(tmp);
AST_LIST_HEAD_INIT_NOLOCK(headp);
- AST_LIST_HEAD_INIT_NOLOCK(&tmp->datastores);
+ AST_LIST_HEAD_INIT_NOLOCK(ast_channel_datastores(tmp));
- AST_LIST_HEAD_INIT_NOLOCK(&tmp->autochans);
+ AST_LIST_HEAD_INIT_NOLOCK(ast_channel_autochans(tmp));
ast_channel_language_set(tmp, defaultlanguage);
@@ -1196,7 +1201,7 @@ struct ast_channel *ast_dummy_channel_alloc(void)
return ast_channel_unref(tmp);
}
- headp = &tmp->varshead;
+ headp = ast_channel_varshead(tmp);
AST_LIST_HEAD_INIT_NOLOCK(headp);
return tmp;
@@ -1218,7 +1223,7 @@ static int __ast_queue_frame(struct ast_channel *chan, struct ast_frame *fin, in
* Check the last frame on the queue if we are queuing the new
* frames after it.
*/
- cur = AST_LIST_LAST(&chan->readq);
+ cur = AST_LIST_LAST(ast_channel_readq(chan));
if (cur && cur->frametype == AST_FRAME_CONTROL && !head && (!after || after == cur)) {
switch (cur->subclass.integer) {
case AST_CONTROL_END_OF_Q:
@@ -1228,7 +1233,7 @@ static int __ast_queue_frame(struct ast_channel *chan, struct ast_frame *fin, in
* Destroy the end-of-Q marker frame so we can queue the hangup
* frame in its place.
*/
- AST_LIST_REMOVE(&chan->readq, cur, frame_list);
+ AST_LIST_REMOVE(ast_channel_readq(chan), cur, frame_list);
ast_frfree(cur);
/*
@@ -1268,7 +1273,7 @@ static int __ast_queue_frame(struct ast_channel *chan, struct ast_frame *fin, in
}
/* Count how many frames exist on the queue */
- AST_LIST_TRAVERSE(&chan->readq, cur, frame_list) {
+ AST_LIST_TRAVERSE(ast_channel_readq(chan), cur, frame_list) {
queued_frames++;
if (cur->frametype == AST_FRAME_VOICE) {
queued_voice_frames++;
@@ -1278,7 +1283,7 @@ static int __ast_queue_frame(struct ast_channel *chan, struct ast_frame *fin, in
if ((queued_frames + new_frames > 128 || queued_voice_frames + new_voice_frames > 96)) {
int count = 0;
ast_log(LOG_WARNING, "Exceptionally long %squeue length queuing to %s\n", queued_frames + new_frames > 128 ? "" : "voice ", ast_channel_name(chan));
- AST_LIST_TRAVERSE_SAFE_BEGIN(&chan->readq, cur, frame_list) {
+ AST_LIST_TRAVERSE_SAFE_BEGIN(ast_channel_readq(chan), cur, frame_list) {
/* Save the most recent frame */
if (!AST_LIST_NEXT(cur, frame_list)) {
break;
@@ -1294,13 +1299,13 @@ static int __ast_queue_frame(struct ast_channel *chan, struct ast_frame *fin, in
}
if (after) {
- AST_LIST_INSERT_LIST_AFTER(&chan->readq, &frames, after, frame_list);
+ AST_LIST_INSERT_LIST_AFTER(ast_channel_readq(chan), &frames, after, frame_list);
} else {
if (head) {
- AST_LIST_APPEND_LIST(&frames, &chan->readq, frame_list);
- AST_LIST_HEAD_INIT_NOLOCK(&chan->readq);
+ AST_LIST_APPEND_LIST(&frames, ast_channel_readq(chan), frame_list);
+ AST_LIST_HEAD_INIT_NOLOCK(ast_channel_readq(chan));
}
- AST_LIST_APPEND_LIST(&chan->readq, &frames, frame_list);
+ AST_LIST_APPEND_LIST(ast_channel_readq(chan), &frames, frame_list);
}
if (chan->alertpipe[1] > -1) {
@@ -2198,7 +2203,7 @@ static void ast_channel_destructor(void *obj)
/* Get rid of each of the data stores on the channel */
ast_channel_lock(chan);
- while ((datastore = AST_LIST_REMOVE_HEAD(&chan->datastores, entry)))
+ while ((datastore = AST_LIST_REMOVE_HEAD(ast_channel_datastores(chan), entry)))
/* Free the data store */
ast_datastore_free(datastore);
ast_channel_unlock(chan);
@@ -2245,10 +2250,10 @@ static void ast_channel_destructor(void *obj)
if (ast_channel_pbx(chan))
ast_log(LOG_WARNING, "PBX may not have been terminated properly on '%s'\n", ast_channel_name(chan));
- ast_party_dialed_free(&chan->dialed);
- ast_party_caller_free(&chan->caller);
- ast_party_connected_line_free(&chan->connected);
- ast_party_redirecting_free(&chan->redirecting);
+ ast_party_dialed_free(ast_channel_dialed(chan));
+ ast_party_caller_free(ast_channel_caller(chan));
+ ast_party_connected_line_free(ast_channel_connected(chan));
+ ast_party_redirecting_free(ast_channel_redirecting(chan));
/* Close pipes if appropriate */
if ((fd = chan->alertpipe[0]) > -1)
@@ -2265,12 +2270,12 @@ static void ast_channel_destructor(void *obj)
}
close(ast_channel_epfd(chan));
#endif
- while ((f = AST_LIST_REMOVE_HEAD(&chan->readq, frame_list)))
+ while ((f = AST_LIST_REMOVE_HEAD(ast_channel_readq(chan), frame_list)))
ast_frfree(f);
/* loop over the variables list, freeing all data and deleting list items */
/* no need to lock the list, as the channel is already locked */
- headp = &chan->varshead;
+ headp = ast_channel_varshead(chan);
while ((vardata = AST_LIST_REMOVE_HEAD(headp, entries)))
ast_var_delete(vardata);
@@ -2311,12 +2316,12 @@ static void ast_dummy_channel_destructor(void *obj)
struct ast_var_t *vardata;
struct varshead *headp;
- headp = &chan->varshead;
+ headp = ast_channel_varshead(chan);
- ast_party_dialed_free(&chan->dialed);
- ast_party_caller_free(&chan->caller);
- ast_party_connected_line_free(&chan->connected);
- ast_party_redirecting_free(&chan->redirecting);
+ ast_party_dialed_free(ast_channel_dialed(chan));
+ ast_party_caller_free(ast_channel_caller(chan));
+ ast_party_connected_line_free(ast_channel_connected(chan));
+ ast_party_redirecting_free(ast_channel_redirecting(chan));
/* loop over the variables list, freeing all data and deleting list items */
/* no need to lock the list, as the channel is already locked */
@@ -2345,13 +2350,13 @@ int ast_channel_datastore_inherit(struct ast_channel *from, struct ast_channel *
{
struct ast_datastore *datastore = NULL, *datastore2;
- AST_LIST_TRAVERSE(&from->datastores, datastore, entry) {
+ AST_LIST_TRAVERSE(ast_channel_datastores(from), datastore, entry) {
if (datastore->inheritance > 0) {
datastore2 = ast_datastore_alloc(datastore->info, datastore->uid);
if (datastore2) {
datastore2->data = datastore->info->duplicate ? datastore->info->duplicate(datastore->data) : NULL;
datastore2->inheritance = datastore->inheritance == DATASTORE_INHERIT_FOREVER ? DATASTORE_INHERIT_FOREVER : datastore->inheritance - 1;
- AST_LIST_INSERT_TAIL(&to->datastores, datastore2, entry);
+ AST_LIST_INSERT_TAIL(ast_channel_datastores(to), datastore2, entry);
}
}
}
@@ -2362,14 +2367,14 @@ int ast_channel_datastore_add(struct ast_channel *chan, struct ast_datastore *da
{
int res = 0;
- AST_LIST_INSERT_HEAD(&chan->datastores, datastore, entry);
+ AST_LIST_INSERT_HEAD(ast_channel_datastores(chan), datastore, entry);
return res;
}
int ast_channel_datastore_remove(struct ast_channel *chan, struct ast_datastore *datastore)
{
- return AST_LIST_REMOVE(&chan->datastores, datastore, entry) ? 0 : -1;
+ return AST_LIST_REMOVE(ast_channel_datastores(chan), datastore, entry) ? 0 : -1;
}
struct ast_datastore *ast_channel_datastore_find(struct ast_channel *chan, const struct ast_datastore_info *info, const char *uid)
@@ -2379,7 +2384,7 @@ struct ast_datastore *ast_channel_datastore_find(struct ast_channel *chan, const
if (info == NULL)
return NULL;
- AST_LIST_TRAVERSE(&chan->datastores, datastore, entry) {
+ AST_LIST_TRAVERSE(ast_channel_datastores(chan), datastore, entry) {
if (datastore->info != info) {
continue;
}
@@ -2489,10 +2494,10 @@ void ast_channel_clear_softhangup(struct ast_channel *chan, int flag)
* pulling the END_OF_Q frame out of the channel frame queue if it
* still happens to be there. */
- fr = AST_LIST_LAST(&chan->readq);
+ fr = AST_LIST_LAST(ast_channel_readq(chan));
if (fr && fr->frametype == AST_FRAME_CONTROL &&
fr->subclass.integer == AST_CONTROL_END_OF_Q) {
- AST_LIST_REMOVE(&chan->readq, fr, frame_list);
+ AST_LIST_REMOVE(ast_channel_readq(chan), fr, frame_list);
ast_frfree(fr);
}
}
@@ -2688,10 +2693,10 @@ int ast_hangup(struct ast_channel *chan)
"Cause-txt: %s\r\n",
ast_channel_name(chan),
ast_channel_uniqueid(chan),
- S_COR(chan->caller.id.number.valid, chan->caller.id.number.str, "<unknown>"),
- S_COR(chan->caller.id.name.valid, chan->caller.id.name.str, "<unknown>"),
- S_COR(chan->connected.id.number.valid, chan->connected.id.number.str, "<unknown>"),
- S_COR(chan->connected.id.name.valid, chan->connected.id.name.str, "<unknown>"),
+ S_COR(ast_channel_caller(chan)->id.number.valid, ast_channel_caller(chan)->id.number.str, "<unknown>"),
+ S_COR(ast_channel_caller(chan)->id.name.valid, ast_channel_caller(chan)->id.name.str, "<unknown>"),
+ S_COR(ast_channel_connected(chan)->id.number.valid, ast_channel_connected(chan)->id.number.str, "<unknown>"),
+ S_COR(ast_channel_connected(chan)->id.name.valid, ast_channel_connected(chan)->id.name.str, "<unknown>"),
ast_channel_hangupcause(chan),
ast_cause2str(ast_channel_hangupcause(chan))
);
@@ -3001,10 +3006,10 @@ struct ast_channel *ast_waitfor_nandfds(struct ast_channel **c, int n, int *fds,
}
ast_channel_lock(c[x]);
- if (!ast_tvzero(c[x]->whentohangup)) {
+ if (!ast_tvzero(*ast_channel_whentohangup(c[x]))) {
if (ast_tvzero(whentohangup))
now = ast_tvnow();
- diff = ast_tvsub(c[x]->whentohangup, now);
+ diff = ast_tvsub(*ast_channel_whentohangup(c[x]), now);
if (diff.tv_sec < 0 || ast_tvzero(diff)) {
/* Should already be hungup */
c[x]->_softhangup |= AST_SOFTHANGUP_TIMEOUT;
@@ -3073,7 +3078,7 @@ struct ast_channel *ast_waitfor_nandfds(struct ast_channel **c, int n, int *fds,
if (!ast_tvzero(whentohangup)) { /* if we have a timeout, check who expired */
now = ast_tvnow();
for (x = 0; x < n; x++) {
- if (!ast_tvzero(c[x]->whentohangup) && ast_tvcmp(c[x]->whentohangup, now) <= 0) {
+ if (!ast_tvzero(*ast_channel_whentohangup(c[x])) && ast_tvcmp(*ast_channel_whentohangup(c[x]), now) <= 0) {
c[x]->_softhangup |= AST_SOFTHANGUP_TIMEOUT;
if (winner == NULL)
winner = c[x];
@@ -3136,8 +3141,8 @@ static struct ast_channel *ast_waitfor_nandfds_simple(struct ast_channel *chan,
ast_channel_lock(chan);
/* Figure out their timeout */
- if (!ast_tvzero(chan->whentohangup)) {
- if ((diff = ast_tvdiff_ms(chan->whentohangup, ast_tvnow())) < 0) {
+ if (!ast_tvzero(*ast_channel_whentohangup(chan))) {
+ if ((diff = ast_tvdiff_ms(*ast_channel_whentohangup(chan), ast_tvnow())) < 0) {
/* They should already be hungup! */
chan->_softhangup |= AST_SOFTHANGUP_TIMEOUT;
ast_channel_unlock(chan);
@@ -3170,8 +3175,8 @@ static struct ast_channel *ast_waitfor_nandfds_simple(struct ast_channel *chan,
}
/* If this channel has a timeout see if it expired */
- if (!ast_tvzero(chan->whentohangup)) {
- if (ast_tvdiff_ms(ast_tvnow(), chan->whentohangup) >= 0) {
+ if (!ast_tvzero(*ast_channel_whentohangup(chan))) {
+ if (ast_tvdiff_ms(ast_tvnow(), *ast_channel_whentohangup(chan)) >= 0) {
chan->_softhangup |= AST_SOFTHANGUP_TIMEOUT;
winner = chan;
}
@@ -3217,10 +3222,10 @@ static struct ast_channel *ast_waitfor_nandfds_complex(struct ast_channel **c, i
}
ast_channel_lock(c[i]);
- if (!ast_tvzero(c[i]->whentohangup)) {
+ if (!ast_tvzero(*ast_channel_whentohangup(c[i]))) {
if (whentohangup == 0)
now = ast_tvnow();
- if ((diff = ast_tvdiff_ms(c[i]->whentohangup, now)) < 0) {
+ if ((diff = ast_tvdiff_ms(*ast_channel_whentohangup(c[i]), now)) < 0) {
c[i]->_softhangup |= AST_SOFTHANGUP_TIMEOUT;
ast_channel_unlock(c[i]);
return c[i];
@@ -3256,7 +3261,7 @@ static struct ast_channel *ast_waitfor_nandfds_complex(struct ast_channel **c, i
if (whentohangup) {
now = ast_tvnow();
for (i = 0; i < n; i++) {
- if (!ast_tvzero(c[i]->whentohangup) && ast_tvdiff_ms(now, c[i]->whentohangup) >= 0) {
+ if (!ast_tvzero(*ast_channel_whentohangup(c[i])) && ast_tvdiff_ms(now, *ast_channel_whentohangup(c[i])) >= 0) {
c[i]->_softhangup |= AST_SOFTHANGUP_TIMEOUT;
if (!winner)
winner = c[i];
@@ -3512,7 +3517,7 @@ static void ast_read_generator_actions(struct ast_channel *chan, struct ast_fram
static inline void queue_dtmf_readq(struct ast_channel *chan, struct ast_frame *f)
{
- struct ast_frame *fr = &chan->dtmff;
+ struct ast_frame *fr = ast_channel_dtmff(chan);
fr->frametype = AST_FRAME_DTMF_END;
fr->subclass.integer = f->subclass.integer;
@@ -3536,8 +3541,8 @@ static inline int should_skip_dtmf(struct ast_channel *chan)
return 1;
}
- if (!ast_tvzero(chan->dtmf_tv) &&
- ast_tvdiff_ms(ast_tvnow(), chan->dtmf_tv) < AST_MIN_DTMF_GAP) {
+ if (!ast_tvzero(*ast_channel_dtmf_tv(chan)) &&
+ ast_tvdiff_ms(ast_tvnow(), *ast_channel_dtmf_tv(chan)) < AST_MIN_DTMF_GAP) {
/* We're not in the middle of a digit, but it hasn't been long enough
* since the last digit, so we'll have to skip DTMF for now. */
return 1;
@@ -3681,8 +3686,8 @@ static struct ast_frame *__ast_read(struct ast_channel *chan, int dropaudio)
return &ast_null_frame;
case AST_TIMING_EVENT_CONTINUOUS:
- if (AST_LIST_EMPTY(&chan->readq) ||
- !AST_LIST_NEXT(AST_LIST_FIRST(&chan->readq), frame_list)) {
+ if (AST_LIST_EMPTY(ast_channel_readq(chan)) ||
+ !AST_LIST_NEXT(AST_LIST_FIRST(ast_channel_readq(chan)), frame_list)) {
ast_timer_disable_continuous(ast_channel_timer(chan));
}
break;
@@ -3704,10 +3709,10 @@ static struct ast_frame *__ast_read(struct ast_channel *chan, int dropaudio)
}
/* Check for pending read queue */
- if (!AST_LIST_EMPTY(&chan->readq)) {
+ if (!AST_LIST_EMPTY(ast_channel_readq(chan))) {
int skip_dtmf = should_skip_dtmf(chan);
- AST_LIST_TRAVERSE_SAFE_BEGIN(&chan->readq, f, frame_list) {
+ AST_LIST_TRAVERSE_SAFE_BEGIN(ast_channel_readq(chan), f, frame_list) {
/* We have to be picky about which frame we pull off of the readq because
* there are cases where we want to leave DTMF frames on the queue until
* some later time. */
@@ -3778,7 +3783,7 @@ static struct ast_frame *__ast_read(struct ast_channel *chan, int dropaudio)
ast_channel_fdno_set(chan, -1);
if (f) {
- struct ast_frame *readq_tail = AST_LIST_LAST(&chan->readq);
+ struct ast_frame *readq_tail = AST_LIST_LAST(ast_channel_readq(chan));
struct ast_control_read_action_payload *read_action_payload;
struct ast_party_connected_line connected;
@@ -3813,7 +3818,7 @@ static struct ast_frame *__ast_read(struct ast_channel *chan, int dropaudio)
switch (read_action_payload->action) {
case AST_FRAME_READ_ACTION_CONNECTED_LINE_MACRO:
ast_party_connected_line_init(&connected);
- ast_party_connected_line_copy(&connected, &chan->connected);
+ ast_party_connected_line_copy(&connected, ast_channel_connected(chan));
if (ast_connected_line_parse_data(read_action_payload->payload,
read_action_payload->payload_size, &connected)) {
ast_party_connected_line_free(&connected);
@@ -3841,18 +3846,19 @@ static struct ast_frame *__ast_read(struct ast_channel *chan, int dropaudio)
ast_frfree(f);
f = &ast_null_frame;
} else if (!ast_test_flag(chan, AST_FLAG_IN_DTMF | AST_FLAG_END_DTMF_ONLY)) {
- if (!ast_tvzero(chan->dtmf_tv) &&
- ast_tvdiff_ms(ast_tvnow(), chan->dtmf_tv) < AST_MIN_DTMF_GAP) {
+ 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 */
queue_dtmf_readq(chan, f);
ast_frfree(f);
f = &ast_null_frame;
} else {
/* 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_channel_dtmf_digit_to_emulate_set(chan, f->subclass.integer);
- chan->dtmf_tv = ast_tvnow();
+ ast_channel_dtmf_tv_set(chan, &tv);
if (f->len) {
if (f->len > AST_MIN_DTMF_DURATION)
ast_channel_emulate_dtmf_duration_set(chan, f->len);
@@ -3877,7 +3883,7 @@ static struct ast_frame *__ast_read(struct ast_channel *chan, int dropaudio)
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);
if (!f->len)
- f->len = ast_tvdiff_ms(now, chan->dtmf_tv);
+ f->len = ast_tvdiff_ms(now, *ast_channel_dtmf_tv(chan));
/* detect tones that were received on
* the wire with durations shorter than
@@ -3887,8 +3893,8 @@ static struct ast_frame *__ast_read(struct ast_channel *chan, int dropaudio)
* dtmf emulation to be triggered later
* on.
*/
- if (ast_tvdiff_ms(now, chan->dtmf_tv) < AST_MIN_DTMF_DURATION) {
- f->len = ast_tvdiff_ms(now, chan->dtmf_tv);
+ if (ast_tvdiff_ms(now, *ast_channel_dtmf_tv(chan)) < AST_MIN_DTMF_DURATION) {
+ f->len = ast_tvdiff_ms(now, *ast_channel_dtmf_tv(chan));
ast_log(LOG_DTMF, "DTMF end '%c' detected to have actual duration %ld on the wire, emulation will be triggered on %s\n", f->subclass.integer, f->len, ast_channel_name(chan));
}
} else if (!f->len) {
@@ -3907,7 +3913,7 @@ static struct ast_frame *__ast_read(struct ast_channel *chan, int dropaudio)
if (f->len < AST_MIN_DTMF_DURATION) {
f->len = AST_MIN_DTMF_DURATION;
}
- chan->dtmf_tv = now;
+ ast_channel_dtmf_tv_set(chan, &now);
}
if (ast_channel_audiohooks(chan)) {
struct ast_frame *old_frame = f;
@@ -3921,14 +3927,15 @@ static struct ast_frame *__ast_read(struct ast_channel *chan, int dropaudio)
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) ||
- (!ast_tvzero(chan->dtmf_tv) &&
- ast_tvdiff_ms(ast_tvnow(), chan->dtmf_tv) < AST_MIN_DTMF_GAP) ) {
+ (!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));
ast_frfree(f);
f = &ast_null_frame;
} else {
+ struct timeval now = ast_tvnow();
ast_set_flag(chan, AST_FLAG_IN_DTMF);
- chan->dtmf_tv = ast_tvnow();
+ 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));
}
break;
@@ -3942,14 +3949,14 @@ static struct ast_frame *__ast_read(struct ast_channel *chan, int dropaudio)
if (!ast_channel_emulate_dtmf_duration(chan)) {
ast_clear_flag(chan, AST_FLAG_EMULATE_DTMF);
ast_channel_dtmf_digit_to_emulate_set(chan, 0);
- } else if (ast_tvdiff_ms(now, chan->dtmf_tv) >= ast_channel_emulate_dtmf_duration(chan)) {
+ } 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);
ast_frfree(f);
- f = &chan->dtmff;
+ f = ast_channel_dtmff(chan);
f->frametype = AST_FRAME_DTMF_END;
f->subclass.integer = ast_channel_dtmf_digit_to_emulate(chan);
- f->len = ast_tvdiff_ms(now, chan->dtmf_tv);
- chan->dtmf_tv = now;
+ 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_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));
@@ -3982,14 +3989,14 @@ static struct ast_frame *__ast_read(struct ast_channel *chan, int dropaudio)
if (ast_test_flag(chan, AST_FLAG_EMULATE_DTMF) && !ast_test_flag(chan, AST_FLAG_IN_DTMF)) {
struct timeval now = ast_tvnow();
- if (ast_tvdiff_ms(now, chan->dtmf_tv) >= ast_channel_emulate_dtmf_duration(chan)) {
+ if (ast_tvdiff_ms(now, *ast_channel_dtmf_tv(chan)) >= ast_channel_emulate_dtmf_duration(chan)) {
ast_channel_emulate_dtmf_duration_set(chan, 0);
ast_frfree(f);
- f = &chan->dtmff;
+ f = ast_channel_dtmff(chan);
f->frametype = AST_FRAME_DTMF_END;
f->subclass.integer = ast_channel_dtmf_digit_to_emulate(chan);
- f->len = ast_tvdiff_ms(now, chan->dtmf_tv);
- chan->dtmf_tv = now;
+ f->len = ast_tvdiff_ms(now, *ast_channel_dtmf_tv(chan));
+ ast_channel_dtmf_tv_set(chan, &now);
if (ast_channel_audiohooks(chan)) {
struct ast_frame *old_frame = f;
f = ast_audiohook_write_list(chan, ast_channel_audiohooks(chan), AST_AUDIOHOOK_DIRECTION_READ, f);
@@ -4224,7 +4231,7 @@ int ast_indicate_data(struct ast_channel *chan, int _condition,
{
struct ast_party_connected_line connected;
- ast_party_connected_line_set_init(&connected, &chan->connected);
+ ast_party_connected_line_set_init(&connected, ast_channel_connected(chan));
res = ast_connected_line_parse_data(data, datalen, &connected);
if (!res) {
ast_channel_set_connected_line(chan, &connected, NULL);
@@ -4237,7 +4244,7 @@ int ast_indicate_data(struct ast_channel *chan, int _condition,
{
struct ast_party_redirecting redirecting;
- ast_party_redirecting_set_init(&redirecting, &chan->redirecting);
+ ast_party_redirecting_set_init(&redirecting, ast_channel_redirecting(chan));
res = ast_redirecting_parse_data(data, datalen, &redirecting);
if (!res) {
ast_channel_set_redirecting(chan, &redirecting, NULL);
@@ -5236,7 +5243,7 @@ static void call_forward_inherit(struct ast_channel *new_chan, struct ast_channe
*/
ast_party_redirecting_init(&redirecting);
ast_channel_lock(orig);
- ast_party_redirecting_copy(&redirecting, &orig->redirecting);
+ ast_party_redirecting_copy(&redirecting, ast_channel_redirecting(orig));
ast_channel_unlock(orig);
if (ast_channel_redirecting_sub(orig, parent, &redirecting, 0) &&
ast_channel_redirecting_macro(orig, parent, &redirecting, 1, 0)) {
@@ -5302,8 +5309,8 @@ struct ast_channel *ast_call_forward(struct ast_channel *caller, struct ast_chan
ast_channel_lock_both(orig, new_chan);
ast_copy_flags(ast_channel_cdr(new_chan), ast_channel_cdr(orig), AST_CDR_FLAG_ORIGINATED);
ast_channel_accountcode_set(new_chan, ast_channel_accountcode(orig));
- ast_party_connected_line_copy(&new_chan->connected, &orig->connected);
- ast_party_redirecting_copy(&new_chan->redirecting, &orig->redirecting);
+ ast_party_connected_line_copy(ast_channel_connected(new_chan), ast_channel_connected(orig));
+ ast_party_redirecting_copy(ast_channel_redirecting(new_chan), ast_channel_redirecting(orig));
ast_channel_unlock(new_chan);
ast_channel_unlock(orig);
@@ -5382,7 +5389,7 @@ struct ast_channel *__ast_request_and_dial(const char *type, struct ast_format_c
ast_set_callerid(chan, cid_num, cid_name, cid_num);
ast_set_flag(ast_channel_cdr(chan), AST_CDR_FLAG_ORIGINATED);
- ast_party_connected_line_set_init(&connected, &chan->connected);
+ ast_party_connected_line_set_init(&connected, ast_channel_connected(chan));
if (cid_num) {
connected.id.number.valid = 1;
connected.id.number.str = (char *) cid_num;
@@ -6135,7 +6142,7 @@ void ast_channel_inherit_variables(const struct ast_channel *parent, struct ast_
struct ast_var_t *current, *newvar;
const char *varname;
- AST_LIST_TRAVERSE(&parent->varshead, current, entries) {
+ AST_LIST_TRAVERSE(ast_channel_varshead((struct ast_channel *) parent), current, entries) {
int vartype = 0;
varname = ast_var_full_name(current);
@@ -6152,14 +6159,14 @@ void ast_channel_inherit_variables(const struct ast_channel *parent, struct ast_
case 1:
newvar = ast_var_assign(&varname[1], ast_var_value(current));
if (newvar) {
- AST_LIST_INSERT_TAIL(&child->varshead, newvar, entries);
+ AST_LIST_INSERT_TAIL(ast_channel_varshead(child), newvar, entries);
ast_debug(1, "Copying soft-transferable variable %s.\n", ast_var_name(newvar));
}
break;
case 2:
newvar = ast_var_assign(varname, ast_var_value(current));
if (newvar) {
- AST_LIST_INSERT_TAIL(&child->varshead, newvar, entries);
+ AST_LIST_INSERT_TAIL(ast_channel_varshead(child), newvar, entries);
ast_debug(1, "Copying hard-transferable variable %s.\n", ast_var_name(newvar));
}
break;
@@ -6184,15 +6191,15 @@ static void clone_variables(struct ast_channel *original, struct ast_channel *cl
struct ast_var_t *current, *newvar;
/* Append variables from clone channel into original channel */
/* XXX Is this always correct? We have to in order to keep MACROS working XXX */
- if (AST_LIST_FIRST(&clonechan->varshead))
- AST_LIST_APPEND_LIST(&original->varshead, &clonechan->varshead, entries);
+ if (AST_LIST_FIRST(ast_channel_varshead(clonechan)))
+ AST_LIST_APPEND_LIST(ast_channel_varshead(original), ast_channel_varshead(clonechan), entries);
/* then, dup the varshead list into the clone */
- AST_LIST_TRAVERSE(&original->varshead, current, entries) {
+ AST_LIST_TRAVERSE(ast_channel_varshead(original), current, entries) {
newvar = ast_var_assign(current->name, current->value);
if (newvar)
- AST_LIST_INSERT_TAIL(&clonechan->varshead, newvar, entries);
+ AST_LIST_INSERT_TAIL(ast_channel_varshead(clonechan), newvar, entries);
}
}
@@ -6359,7 +6366,7 @@ static void report_new_callerid(struct ast_channel *chan)
{
int pres;
- pres = ast_party_id_presentation(&chan->caller.id);
+ pres = ast_party_id_presentation(&ast_channel_caller(chan)->id);
ast_manager_event(chan, EVENT_FLAG_CALL, "NewCallerid",
"Channel: %s\r\n"
"CallerIDNum: %s\r\n"
@@ -6367,8 +6374,8 @@ static void report_new_callerid(struct ast_channel *chan)
"Uniqueid: %s\r\n"
"CID-CallingPres: %d (%s)\r\n",
ast_channel_name(chan),
- S_COR(chan->caller.id.number.valid, chan->caller.id.number.str, ""),
- S_COR(chan->caller.id.name.valid, chan->caller.id.name.str, ""),
+ S_COR(ast_channel_caller(chan)->id.number.valid, ast_channel_caller(chan)->id.number.str, ""),
+ S_COR(ast_channel_caller(chan)->id.name.valid, ast_channel_caller(chan)->id.name.str, ""),
ast_channel_uniqueid(chan),
pres,
ast_describe_caller_presentation(pres)
@@ -6614,14 +6621,14 @@ int ast_do_masquerade(struct ast_channel *original)
* old (clone) channel.
*/
{
- AST_LIST_HEAD_NOLOCK(, ast_frame) tmp_readq;
+ AST_LIST_HEAD_NOLOCK(,ast_frame) tmp_readq;
AST_LIST_HEAD_SET_NOLOCK(&tmp_readq, NULL);
- AST_LIST_APPEND_LIST(&tmp_readq, &original->readq, frame_list);
- AST_LIST_APPEND_LIST(&original->readq, &clonechan->readq, frame_list);
+ AST_LIST_APPEND_LIST(&tmp_readq, ast_channel_readq(original), frame_list);
+ AST_LIST_APPEND_LIST(ast_channel_readq(original), ast_channel_readq(clonechan), frame_list);
while ((current = AST_LIST_REMOVE_HEAD(&tmp_readq, frame_list))) {
- AST_LIST_INSERT_TAIL(&original->readq, current, frame_list);
+ AST_LIST_INSERT_TAIL(ast_channel_readq(original), current, frame_list);
if (original->alertpipe[1] > -1) {
int poke = 0;
@@ -6688,17 +6695,17 @@ int ast_do_masquerade(struct ast_channel *original)
ast_app_group_update(clonechan, original);
/* Move data stores over */
- if (AST_LIST_FIRST(&clonechan->datastores)) {
+ if (AST_LIST_FIRST(ast_channel_datastores(clonechan))) {
struct ast_datastore *ds;
/* We use a safe traversal here because some fixup routines actually
* remove the datastore from the list and free them.
*/
- AST_LIST_TRAVERSE_SAFE_BEGIN(&clonechan->datastores, ds, entry) {
+ AST_LIST_TRAVERSE_SAFE_BEGIN(ast_channel_datastores(clonechan), ds, entry) {
if (ds->info->chan_fixup)
ds->info->chan_fixup(ds->data, clonechan, original);
}
AST_LIST_TRAVERSE_SAFE_END;
- AST_LIST_APPEND_LIST(&original->datastores, &clonechan->datastores, entry);
+ AST_LIST_APPEND_LIST(ast_channel_datastores(original), ast_channel_datastores(clonechan), entry);
}
ast_autochan_new_channel(clonechan, original);
@@ -6721,21 +6728,21 @@ int ast_do_masquerade(struct ast_channel *original)
* Just swap the whole structures, nevermind the allocations,
* they'll work themselves out.
*/
- exchange.dialed = original->dialed;
- original->dialed = clonechan->dialed;
- clonechan->dialed = exchange.dialed;
+ exchange.dialed = *ast_channel_dialed(original);
+ ast_channel_dialed_set(original, ast_channel_dialed(clonechan));
+ ast_channel_dialed_set(clonechan, &exchange.dialed);
- exchange.caller = original->caller;
- original->caller = clonechan->caller;
- clonechan->caller = exchange.caller;
+ exchange.caller = *ast_channel_caller(original);
+ ast_channel_caller_set(original, ast_channel_caller(clonechan));
+ ast_channel_caller_set(clonechan, &exchange.caller);
- exchange.connected = original->connected;
- original->connected = clonechan->connected;
- clonechan->connected = exchange.connected;
+ exchange.connected = *ast_channel_connected(original);
+ ast_channel_connected_set(original, ast_channel_connected(clonechan));
+ ast_channel_connected_set(clonechan, &exchange.connected);
- exchange.redirecting = original->redirecting;
- original->redirecting = clonechan->redirecting;
- clonechan->redirecting = exchange.redirecting;
+ exchange.redirecting = *ast_channel_redirecting(original);
+ ast_channel_redirecting_set(original, ast_channel_redirecting(clonechan));
+ ast_channel_redirecting_set(clonechan, &exchange.redirecting);
report_new_callerid(original);
@@ -6862,19 +6869,19 @@ void ast_set_callerid(struct ast_channel *chan, const char *cid_num, const char
ast_channel_lock(chan);
if (cid_num) {
- chan->caller.id.number.valid = 1;
- ast_free(chan->caller.id.number.str);
- chan->caller.id.number.str = ast_strdup(cid_num);
+ ast_channel_caller(chan)->id.number.valid = 1;
+ ast_free(ast_channel_caller(chan)->id.number.str);
+ ast_channel_caller(chan)->id.number.str = ast_strdup(cid_num);
}
if (cid_name) {
- chan->caller.id.name.valid = 1;
- ast_free(chan->caller.id.name.str);
- chan->caller.id.name.str = ast_strdup(cid_name);
+ ast_channel_caller(chan)->id.name.valid = 1;
+ ast_free(ast_channel_caller(chan)->id.name.str);
+ ast_channel_caller(chan)->id.name.str = ast_strdup(cid_name);
}
if (cid_ani) {
- chan->caller.ani.number.valid = 1;
- ast_free(chan->caller.ani.number.str);
- chan->caller.ani.number.str = ast_strdup(cid_ani);
+ ast_channel_caller(chan)->ani.number.valid = 1;
+ ast_free(ast_channel_caller(chan)->ani.number.str);
+ ast_channel_caller(chan)->ani.number.str = ast_strdup(cid_ani);
}
if (ast_channel_cdr(chan)) {
ast_cdr_setcid(ast_channel_cdr(chan), chan);
@@ -6887,13 +6894,13 @@ void ast_set_callerid(struct ast_channel *chan, const char *cid_num, const char
void ast_channel_set_caller(struct ast_channel *chan, const struct ast_party_caller *caller, const struct ast_set_party_caller *update)
{
- if (&chan->caller == caller) {
+ if (ast_channel_caller(chan) == caller) {
/* Don't set to self */
return;
}
ast_channel_lock(chan);
- ast_party_caller_set(&chan->caller, caller, update);
+ ast_party_caller_set(ast_channel_caller(chan), caller, update);
ast_channel_unlock(chan);
}
@@ -6902,19 +6909,19 @@ void ast_channel_set_caller_event(struct ast_channel *chan, const struct ast_par
const char *pre_set_number;
const char *pre_set_name;
- if (&chan->caller == caller) {
+ if (ast_channel_caller(chan) == caller) {
/* Don't set to self */
return;
}
ast_channel_lock(chan);
pre_set_number =
- S_COR(chan->caller.id.number.valid, chan->caller.id.number.str, NULL);
- pre_set_name = S_COR(chan->caller.id.name.valid, chan->caller.id.name.str, NULL);
- ast_party_caller_set(&chan->caller, caller, update);
- if (S_COR(chan->caller.id.number.valid, chan->caller.id.number.str, NULL)
+ S_COR(ast_channel_caller(chan)->id.number.valid, ast_channel_caller(chan)->id.number.str, NULL);
+ pre_set_name = S_COR(ast_channel_caller(chan)->id.name.valid, ast_channel_caller(chan)->id.name.str, NULL);
+ ast_party_caller_set(ast_channel_caller(chan), caller, update);
+ if (S_COR(ast_channel_caller(chan)->id.number.valid, ast_channel_caller(chan)->id.number.str, NULL)
!= pre_set_number
- || S_COR(chan->caller.id.name.valid, chan->caller.id.name.str, NULL)
+ || S_COR(ast_channel_caller(chan)->id.name.valid, ast_channel_caller(chan)->id.name.str, NULL)
!= pre_set_name) {
/* The caller id name or number changed. */
report_new_callerid(chan);
@@ -6956,10 +6963,10 @@ int ast_setstate(struct ast_channel *chan, enum ast_channel_state state)
"ConnectedLineName: %s\r\n"
"Uniqueid: %s\r\n",
ast_channel_name(chan), ast_channel_state(chan), ast_state2str(ast_channel_state(chan)),
- S_COR(chan->caller.id.number.valid, chan->caller.id.number.str, ""),
- S_COR(chan->caller.id.name.valid, chan->caller.id.name.str, ""),
- S_COR(chan->connected.id.number.valid, chan->connected.id.number.str, ""),
- S_COR(chan->connected.id.name.valid, chan->connected.id.name.str, ""),
+ S_COR(ast_channel_caller(chan)->id.number.valid, ast_channel_caller(chan)->id.number.str, ""),
+ S_COR(ast_channel_caller(chan)->id.name.valid, ast_channel_caller(chan)->id.name.str, ""),
+ S_COR(ast_channel_connected(chan)->id.number.valid, ast_channel_connected(chan)->id.number.str, ""),
+ S_COR(ast_channel_connected(chan)->id.name.valid, ast_channel_connected(chan)->id.name.str, ""),
ast_channel_uniqueid(chan));
return 0;
@@ -7253,8 +7260,8 @@ static void manager_bridge_event(int onoff, int type, struct ast_channel *c0, st
type == 1 ? "core" : "native",
ast_channel_name(c0), ast_channel_name(c1),
ast_channel_uniqueid(c0), ast_channel_uniqueid(c1),
- S_COR(c0->caller.id.number.valid, c0->caller.id.number.str, ""),
- S_COR(c1->caller.id.number.valid, c1->caller.id.number.str, ""));
+ S_COR(ast_channel_caller(c0)->id.number.valid, ast_channel_caller(c0)->id.number.str, ""),
+ S_COR(ast_channel_caller(c1)->id.number.valid, ast_channel_caller(c1)->id.number.str, ""));
}
static void update_bridge_vars(struct ast_channel *c0, struct ast_channel *c1)
@@ -8216,13 +8223,13 @@ void ast_connected_line_copy_to_caller(struct ast_party_caller *dest, const stru
void ast_channel_set_connected_line(struct ast_channel *chan, const struct ast_party_connected_line *connected, const struct ast_set_party_connected_line *update)
{
- if (&chan->connected == connected) {
+ if (ast_channel_connected(chan) == connected) {
/* Don't set to self */
return;
}
ast_channel_lock(chan);
- ast_party_connected_line_set(&chan->connected, connected, update);
+ ast_party_connected_line_set(ast_channel_connected(chan), connected, update);
ast_channel_unlock(chan);
}
@@ -8869,13 +8876,13 @@ void ast_channel_queue_connected_line_update(struct ast_channel *chan, const str
void ast_channel_set_redirecting(struct ast_channel *chan, const struct ast_party_redirecting *redirecting, const struct ast_set_party_redirecting *update)
{
- if (&chan->redirecting == redirecting) {
+ if (ast_channel_redirecting(chan) == redirecting) {
/* Don't set to self */
return;
}
ast_channel_lock(chan);
- ast_party_redirecting_set(&chan->redirecting, redirecting, update);
+ ast_party_redirecting_set(ast_channel_redirecting(chan), redirecting, update);
ast_channel_unlock(chan);
}
@@ -9401,17 +9408,17 @@ int ast_channel_connected_line_macro(struct ast_channel *autoservice_chan, struc
if (is_frame) {
const struct ast_frame *frame = connected_info;
- ast_connected_line_parse_data(frame->data.ptr, frame->datalen, &macro_chan->connected);
+ ast_connected_line_parse_data(frame->data.ptr, frame->datalen, ast_channel_connected(macro_chan));
} else {
const struct ast_party_connected_line *connected = connected_info;
- ast_party_connected_line_copy(&macro_chan->connected, connected);
+ ast_party_connected_line_copy(ast_channel_connected(macro_chan), connected);
}
ast_channel_unlock(macro_chan);
if (!(retval = ast_app_run_macro(autoservice_chan, macro_chan, macro, macro_args))) {
ast_channel_lock(macro_chan);
- ast_channel_update_connected_line(macro_chan, &macro_chan->connected, NULL);
+ ast_channel_update_connected_line(macro_chan, ast_channel_connected(macro_chan), NULL);
ast_channel_unlock(macro_chan);
}
@@ -9445,18 +9452,18 @@ int ast_channel_redirecting_macro(struct ast_channel *autoservice_chan, struct a
if (is_frame) {
const struct ast_frame *frame = redirecting_info;
- ast_redirecting_parse_data(frame->data.ptr, frame->datalen, &macro_chan->redirecting);
+ ast_redirecting_parse_data(frame->data.ptr, frame->datalen, ast_channel_redirecting(macro_chan));
} else {
const struct ast_party_redirecting *redirecting = redirecting_info;
- ast_party_redirecting_copy(&macro_chan->redirecting, redirecting);
+ ast_party_redirecting_copy(ast_channel_redirecting(macro_chan), redirecting);
}
ast_channel_unlock(macro_chan);
retval = ast_app_run_macro(autoservice_chan, macro_chan, macro, macro_args);
if (!retval) {
ast_channel_lock(macro_chan);
- ast_channel_update_redirecting(macro_chan, &macro_chan->redirecting, NULL);
+ ast_channel_update_redirecting(macro_chan, ast_channel_redirecting(macro_chan), NULL);
ast_channel_unlock(macro_chan);
}
@@ -9483,17 +9490,17 @@ int ast_channel_connected_line_sub(struct ast_channel *autoservice_chan, struct
if (is_frame) {
const struct ast_frame *frame = connected_info;
- ast_connected_line_parse_data(frame->data.ptr, frame->datalen, &sub_chan->connected);
+ ast_connected_line_parse_data(frame->data.ptr, frame->datalen, ast_channel_connected(sub_chan));
} else {
const struct ast_party_connected_line *connected = connected_info;
- ast_party_connected_line_copy(&sub_chan->connected, connected);
+ ast_party_connected_line_copy(ast_channel_connected(sub_chan), connected);
}
ast_channel_unlock(sub_chan);
if (!(retval = ast_app_run_sub(autoservice_chan, sub_chan, sub, sub_args))) {
ast_channel_lock(sub_chan);
- ast_channel_update_connected_line(sub_chan, &sub_chan->connected, NULL);
+ ast_channel_update_connected_line(sub_chan, ast_channel_connected(sub_chan), NULL);
ast_channel_unlock(sub_chan);
}
@@ -9520,18 +9527,18 @@ int ast_channel_redirecting_sub(struct ast_channel *autoservice_chan, struct ast
if (is_frame) {
const struct ast_frame *frame = redirecting_info;
- ast_redirecting_parse_data(frame->data.ptr, frame->datalen, &sub_chan->redirecting);
+ ast_redirecting_parse_data(frame->data.ptr, frame->datalen, ast_channel_redirecting(sub_chan));
} else {
const struct ast_party_redirecting *redirecting = redirecting_info;
- ast_party_redirecting_copy(&sub_chan->redirecting, redirecting);
+ ast_party_redirecting_copy(ast_channel_redirecting(sub_chan), redirecting);
}
ast_channel_unlock(sub_chan);
retval = ast_app_run_sub(autoservice_chan, sub_chan, sub, sub_args);
if (!retval) {
ast_channel_lock(sub_chan);
- ast_channel_update_redirecting(sub_chan, &sub_chan->redirecting, NULL);
+ ast_channel_update_redirecting(sub_chan, ast_channel_redirecting(sub_chan), NULL);
ast_channel_unlock(sub_chan);
}
diff --git a/main/channel_internal_api.c b/main/channel_internal_api.c
index df6345b33..bec785fb5 100644
--- a/main/channel_internal_api.c
+++ b/main/channel_internal_api.c
@@ -196,7 +196,7 @@ int ast_channel_data_add_structure(struct ast_data *tree,
}
channel_data_add_flags(data_flags, chan);
- ast_data_add_uint(tree, "timetohangup", chan->whentohangup.tv_sec);
+ ast_data_add_uint(tree, "timetohangup", ast_channel_whentohangup(chan)->tv_sec);
#if 0 /* XXX AstData: ast_callerid no longer exists. (Equivalent code not readily apparent.) */
/* callerid */
@@ -704,3 +704,75 @@ struct ast_format *ast_channel_writeformat(struct ast_channel *chan)
{
return &chan->__do_not_use_writeformat;
}
+struct ast_datastore_list *ast_channel_datastores(struct ast_channel *chan)
+{
+ return &chan->__do_not_use_datastores;
+}
+struct ast_autochan_list *ast_channel_autochans(struct ast_channel *chan)
+{
+ return &chan->__do_not_use_autochans;
+}
+struct ast_readq_list *ast_channel_readq(struct ast_channel *chan)
+{
+ return &chan->__do_not_use_readq;
+}
+struct ast_frame *ast_channel_dtmff(struct ast_channel *chan)
+{
+ return &chan->__do_not_use_dtmff;
+}
+struct ast_jb *ast_channel_jb(struct ast_channel *chan)
+{
+ return &chan->__do_not_use_jb;
+}
+struct ast_party_caller *ast_channel_caller(struct ast_channel *chan)
+{
+ return &chan->__do_not_use_caller;
+}
+struct ast_party_connected_line *ast_channel_connected(struct ast_channel *chan)
+{
+ return &chan->__do_not_use_connected;
+}
+struct ast_party_dialed *ast_channel_dialed(struct ast_channel *chan)
+{
+ return &chan->__do_not_use_dialed;
+}
+struct ast_party_redirecting *ast_channel_redirecting(struct ast_channel *chan)
+{
+ return &chan->__do_not_use_redirecting;
+}
+struct timeval *ast_channel_dtmf_tv(struct ast_channel *chan)
+{
+ return &chan->__do_not_use_dtmf_tv;
+}
+struct timeval *ast_channel_whentohangup(struct ast_channel *chan)
+{
+ return &chan->__do_not_use_whentohangup;
+}
+struct varshead *ast_channel_varshead(struct ast_channel *chan)
+{
+ return &chan->__do_not_use_varshead;
+}
+void ast_channel_caller_set(struct ast_channel *chan, struct ast_party_caller *value)
+{
+ chan->__do_not_use_caller = *value;
+}
+void ast_channel_connected_set(struct ast_channel *chan, struct ast_party_connected_line *value)
+{
+ chan->__do_not_use_connected = *value;
+}
+void ast_channel_dialed_set(struct ast_channel *chan, struct ast_party_dialed *value)
+{
+ chan->__do_not_use_dialed = *value;
+}
+void ast_channel_redirecting_set(struct ast_channel *chan, struct ast_party_redirecting *value)
+{
+ chan->__do_not_use_redirecting = *value;
+}
+void ast_channel_dtmf_tv_set(struct ast_channel *chan, struct timeval *value)
+{
+ chan->__do_not_use_dtmf_tv = *value;
+}
+void ast_channel_whentohangup_set(struct ast_channel *chan, struct timeval *value)
+{
+ chan->__do_not_use_whentohangup = *value;
+}
diff --git a/main/cli.c b/main/cli.c
index ae9e9d383..bfb4d6d07 100644
--- a/main/cli.c
+++ b/main/cli.c
@@ -917,7 +917,7 @@ static char *handle_chanlist(struct ast_cli_entry *e, int cmd, struct ast_cli_ar
ast_cli(a->fd, CONCISE_FORMAT_STRING, ast_channel_name(c), ast_channel_context(c), ast_channel_exten(c), ast_channel_priority(c), ast_state2str(ast_channel_state(c)),
ast_channel_appl(c) ? ast_channel_appl(c) : "(None)",
S_OR(ast_channel_data(c), ""), /* XXX different from verbose ? */
- S_COR(c->caller.id.number.valid, c->caller.id.number.str, ""),
+ S_COR(ast_channel_caller(c)->id.number.valid, ast_channel_caller(c)->id.number.str, ""),
S_OR(ast_channel_accountcode(c), ""),
S_OR(ast_channel_peeraccount(c), ""),
ast_channel_amaflags(c),
@@ -928,7 +928,7 @@ static char *handle_chanlist(struct ast_cli_entry *e, int cmd, struct ast_cli_ar
ast_cli(a->fd, VERBOSE_FORMAT_STRING, ast_channel_name(c), ast_channel_context(c), ast_channel_exten(c), ast_channel_priority(c), ast_state2str(ast_channel_state(c)),
ast_channel_appl(c) ? ast_channel_appl(c) : "(None)",
ast_channel_data(c) ? S_OR(ast_channel_data(c), "(Empty)" ): "(None)",
- S_COR(c->caller.id.number.valid, c->caller.id.number.str, ""),
+ S_COR(ast_channel_caller(c)->id.number.valid, ast_channel_caller(c)->id.number.str, ""),
durbuf,
S_OR(ast_channel_accountcode(c), ""),
S_OR(ast_channel_peeraccount(c), ""),
@@ -1476,11 +1476,11 @@ static char *handle_showchan(struct ast_cli_entry *e, int cmd, struct ast_cli_ar
" Data: %s\n"
" Blocking in: %s\n",
ast_channel_name(c), ast_channel_tech(c)->type, ast_channel_uniqueid(c), ast_channel_linkedid(c),
- S_COR(c->caller.id.number.valid, c->caller.id.number.str, "(N/A)"),
- S_COR(c->caller.id.name.valid, c->caller.id.name.str, "(N/A)"),
- S_COR(c->connected.id.number.valid, c->connected.id.number.str, "(N/A)"),
- S_COR(c->connected.id.name.valid, c->connected.id.name.str, "(N/A)"),
- S_OR(c->dialed.number.str, "(N/A)"),
+ S_COR(ast_channel_caller(c)->id.number.valid, ast_channel_caller(c)->id.number.str, "(N/A)"),
+ S_COR(ast_channel_caller(c)->id.name.valid, ast_channel_caller(c)->id.name.str, "(N/A)"),
+ S_COR(ast_channel_connected(c)->id.number.valid, ast_channel_connected(c)->id.number.str, "(N/A)"),
+ S_COR(ast_channel_connected(c)->id.name.valid, ast_channel_connected(c)->id.name.str, "(N/A)"),
+ S_OR(ast_channel_dialed(c)->number.str, "(N/A)"),
ast_channel_language(c),
ast_state2str(ast_channel_state(c)), ast_channel_state(c), ast_channel_rings(c),
ast_getformatname_multiple(nf, sizeof(nf), ast_channel_nativeformats(c)),
@@ -1493,7 +1493,7 @@ static char *handle_showchan(struct ast_cli_entry *e, int cmd, struct ast_cli_ar
c->fds[0],
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)c->whentohangup.tv_sec,
+ (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>",
ast_channel_context(c), ast_channel_exten(c), ast_channel_priority(c), c->callgroup, c->pickupgroup, (ast_channel_appl(c) ? ast_channel_appl(c) : "(N/A)" ),
(ast_channel_data(c) ? S_OR(ast_channel_data(c), "(Empty)") : "(None)"),
diff --git a/main/dial.c b/main/dial.c
index fe8a74faf..24dbf2841 100644
--- a/main/dial.c
+++ b/main/dial.c
@@ -272,7 +272,7 @@ static int begin_dial_channel(struct ast_dial_channel *channel, struct ast_chann
ast_channel_appl_set(channel->owner, "AppDial2");
ast_channel_data_set(channel->owner, "(Outgoing Line)");
- memset(&channel->owner->whentohangup, 0, sizeof(channel->owner->whentohangup));
+ memset(ast_channel_whentohangup(channel->owner), 0, sizeof(*ast_channel_whentohangup(channel->owner)));
/* Inherit everything from he who spawned this dial */
if (chan) {
@@ -280,11 +280,11 @@ static int begin_dial_channel(struct ast_dial_channel *channel, struct ast_chann
ast_channel_datastore_inherit(chan, channel->owner);
/* Copy over callerid information */
- ast_party_redirecting_copy(&channel->owner->redirecting, &chan->redirecting);
+ ast_party_redirecting_copy(ast_channel_redirecting(channel->owner), ast_channel_redirecting(chan));
- channel->owner->dialed.transit_network_select = chan->dialed.transit_network_select;
+ ast_channel_dialed(channel->owner)->transit_network_select = ast_channel_dialed(chan)->transit_network_select;
- ast_connected_line_copy_from_caller(&channel->owner->connected, &chan->caller);
+ ast_connected_line_copy_from_caller(ast_channel_connected(channel->owner), ast_channel_caller(chan));
ast_channel_language_set(channel->owner, ast_channel_language(chan));
ast_channel_accountcode_set(channel->owner, ast_channel_accountcode(chan));
diff --git a/main/features.c b/main/features.c
index 6f3d0f9cb..aa2810d18 100644
--- a/main/features.c
+++ b/main/features.c
@@ -1510,10 +1510,10 @@ static int park_call_full(struct ast_channel *chan, struct ast_channel *peer, st
"Uniqueid: %s\r\n",
pu->parkingexten, ast_channel_name(chan), pu->parkinglot->name, event_from,
(long)pu->start.tv_sec + (long)(pu->parkingtime/1000) - (long)time(NULL),
- S_COR(chan->caller.id.number.valid, chan->caller.id.number.str, "<unknown>"),
- S_COR(chan->caller.id.name.valid, chan->caller.id.name.str, "<unknown>"),
- S_COR(chan->connected.id.number.valid, chan->connected.id.number.str, "<unknown>"),
- S_COR(chan->connected.id.name.valid, chan->connected.id.name.str, "<unknown>"),
+ S_COR(ast_channel_caller(chan)->id.number.valid, ast_channel_caller(chan)->id.number.str, "<unknown>"),
+ S_COR(ast_channel_caller(chan)->id.name.valid, ast_channel_caller(chan)->id.name.str, "<unknown>"),
+ S_COR(ast_channel_connected(chan)->id.number.valid, ast_channel_connected(chan)->id.number.str, "<unknown>"),
+ S_COR(ast_channel_connected(chan)->id.name.valid, ast_channel_connected(chan)->id.name.str, "<unknown>"),
ast_channel_uniqueid(chan)
);
ast_debug(4, "peer: %s\n", peer ? ast_channel_name(peer) : "-No peer-");
@@ -2069,10 +2069,10 @@ static int builtin_automonitor(struct ast_channel *chan, struct ast_channel *pee
snprintf(touch_filename, len, "%s-%ld-%s", S_OR(touch_monitor_prefix, "auto"), (long)time(NULL), touch_monitor);
snprintf(args, len, "%s,%s,m", S_OR(touch_format, "wav"), touch_filename);
} else {
- caller_chan_id = ast_strdupa(S_COR(caller_chan->caller.id.number.valid,
- caller_chan->caller.id.number.str, ast_channel_name(caller_chan)));
- callee_chan_id = ast_strdupa(S_COR(callee_chan->caller.id.number.valid,
- callee_chan->caller.id.number.str, ast_channel_name(callee_chan)));
+ caller_chan_id = ast_strdupa(S_COR(ast_channel_caller(caller_chan)->id.number.valid,
+ ast_channel_caller(caller_chan)->id.number.str, ast_channel_name(caller_chan)));
+ callee_chan_id = ast_strdupa(S_COR(ast_channel_caller(callee_chan)->id.number.valid,
+ ast_channel_caller(callee_chan)->id.number.str, ast_channel_name(callee_chan)));
len = strlen(caller_chan_id) + strlen(callee_chan_id) + 50;
args = alloca(len);
touch_filename = alloca(len);
@@ -2185,10 +2185,10 @@ static int builtin_automixmonitor(struct ast_channel *chan, struct ast_channel *
snprintf(touch_filename, len, "auto-%ld-%s", (long)time(NULL), touch_monitor);
snprintf(args, len, "%s.%s,b", touch_filename, (touch_format) ? touch_format : "wav");
} else {
- caller_chan_id = ast_strdupa(S_COR(caller_chan->caller.id.number.valid,
- caller_chan->caller.id.number.str, ast_channel_name(caller_chan)));
- callee_chan_id = ast_strdupa(S_COR(callee_chan->caller.id.number.valid,
- callee_chan->caller.id.number.str, ast_channel_name(callee_chan)));
+ caller_chan_id = ast_strdupa(S_COR(ast_channel_caller(caller_chan)->id.number.valid,
+ ast_channel_caller(caller_chan)->id.number.str, ast_channel_name(caller_chan)));
+ callee_chan_id = ast_strdupa(S_COR(ast_channel_caller(callee_chan)->id.number.valid,
+ ast_channel_caller(callee_chan)->id.number.str, ast_channel_name(callee_chan)));
len = strlen(caller_chan_id) + strlen(callee_chan_id) + 50;
args = alloca(len);
touch_filename = alloca(len);
@@ -2532,7 +2532,7 @@ static int builtin_atxfer(struct ast_channel *chan, struct ast_channel *peer, st
/* Save connected line info for party B about party A in case transfer fails. */
ast_party_connected_line_init(&connected_line);
ast_channel_lock(transferer);
- ast_party_connected_line_copy(&connected_line, &transferer->connected);
+ ast_party_connected_line_copy(&connected_line, ast_channel_connected(transferer));
ast_channel_unlock(transferer);
connected_line.source = AST_CONNECTED_LINE_UPDATE_SOURCE_TRANSFER;
@@ -2814,7 +2814,7 @@ static int builtin_atxfer(struct ast_channel *chan, struct ast_channel *peer, st
* Due to a limitation regarding when callerID is set on a Local channel,
* we use the transferer's connected line information here.
*/
- ast_party_connected_line_copy(&connected_line, &transferer->connected);
+ ast_party_connected_line_copy(&connected_line, ast_channel_connected(transferer));
ast_channel_unlock(transferer);
connected_line.source = AST_CONNECTED_LINE_UPDATE_SOURCE_TRANSFER;
if (ast_channel_connected_line_sub(newchan, xferchan, &connected_line, 0) &&
@@ -2824,7 +2824,7 @@ static int builtin_atxfer(struct ast_channel *chan, struct ast_channel *peer, st
/* Transfer party A connected line to party C */
ast_channel_lock(xferchan);
- ast_connected_line_copy_from_caller(&connected_line, &xferchan->caller);
+ ast_connected_line_copy_from_caller(&connected_line, ast_channel_caller(xferchan));
ast_channel_unlock(xferchan);
connected_line.source = AST_CONNECTED_LINE_UPDATE_SOURCE_TRANSFER;
if (ast_channel_connected_line_sub(xferchan, newchan, &connected_line, 0) &&
@@ -3457,7 +3457,7 @@ static struct ast_channel *feature_request_and_dial(struct ast_channel *caller,
pbx_builtin_setvar_helper(chan, "TRANSFERERNAME", caller_name);
ast_channel_lock(chan);
- ast_connected_line_copy_from_caller(&chan->connected, &requestor->caller);
+ ast_connected_line_copy_from_caller(ast_channel_connected(chan), ast_channel_caller(requestor));
ast_channel_unlock(chan);
if (ast_call(chan, addr, timeout)) {
@@ -3608,7 +3608,7 @@ static struct ast_channel *feature_request_and_dial(struct ast_channel *caller,
struct ast_party_connected_line connected;
/* Just save it for the transfer. */
- ast_party_connected_line_set_init(&connected, &caller->connected);
+ ast_party_connected_line_set_init(&connected, ast_channel_connected(caller));
res = ast_connected_line_parse_data(f->data.ptr, f->datalen,
&connected);
if (!res) {
@@ -4320,11 +4320,11 @@ before_you_go:
if (ast_test_flag(&config->features_caller, AST_FEATURE_NO_H_EXTEN)) {
h_context = NULL;
} else if (ast_exists_extension(chan, ast_channel_context(chan), "h", 1,
- S_COR(chan->caller.id.number.valid, chan->caller.id.number.str, NULL))) {
+ S_COR(ast_channel_caller(chan)->id.number.valid, ast_channel_caller(chan)->id.number.str, NULL))) {
h_context = ast_channel_context(chan);
} else if (!ast_strlen_zero(ast_channel_macrocontext(chan))
&& ast_exists_extension(chan, ast_channel_macrocontext(chan), "h", 1,
- S_COR(chan->caller.id.number.valid, chan->caller.id.number.str, NULL))) {
+ S_COR(ast_channel_caller(chan)->id.number.valid, ast_channel_caller(chan)->id.number.str, NULL))) {
h_context = ast_channel_macrocontext(chan);
} else {
h_context = NULL;
@@ -4372,7 +4372,7 @@ before_you_go:
while ((spawn_error = ast_spawn_extension(chan, ast_channel_context(chan), ast_channel_exten(chan),
ast_channel_priority(chan),
- S_COR(chan->caller.id.number.valid, chan->caller.id.number.str, NULL),
+ S_COR(ast_channel_caller(chan)->id.number.valid, ast_channel_caller(chan)->id.number.str, NULL),
&found, 1)) == 0) {
ast_channel_priority_set(chan, ast_channel_priority(chan) + 1);
}
@@ -4530,10 +4530,10 @@ static void post_manager_event(const char *s, struct parkeduser *pu)
pu->parkingexten,
ast_channel_name(pu->chan),
pu->parkinglot->name,
- S_COR(pu->chan->caller.id.number.valid, pu->chan->caller.id.number.str, "<unknown>"),
- S_COR(pu->chan->caller.id.name.valid, pu->chan->caller.id.name.str, "<unknown>"),
- S_COR(pu->chan->connected.id.number.valid, pu->chan->connected.id.number.str, "<unknown>"),
- S_COR(pu->chan->connected.id.name.valid, pu->chan->connected.id.name.str, "<unknown>"),
+ S_COR(ast_channel_caller(pu->chan)->id.number.valid, ast_channel_caller(pu->chan)->id.number.str, "<unknown>"),
+ S_COR(ast_channel_caller(pu->chan)->id.name.valid, ast_channel_caller(pu->chan)->id.name.str, "<unknown>"),
+ S_COR(ast_channel_connected(pu->chan)->id.number.valid, ast_channel_connected(pu->chan)->id.number.str, "<unknown>"),
+ S_COR(ast_channel_connected(pu->chan)->id.name.valid, ast_channel_connected(pu->chan)->id.name.str, "<unknown>"),
ast_channel_uniqueid(pu->chan)
);
}
@@ -5141,10 +5141,10 @@ static int parked_call_exec(struct ast_channel *chan, const char *data)
"Uniqueid: %s\r\n",
pu->parkingexten, ast_channel_name(pu->chan), pu->parkinglot->name,
ast_channel_name(chan),
- S_COR(pu->chan->caller.id.number.valid, pu->chan->caller.id.number.str, "<unknown>"),
- S_COR(pu->chan->caller.id.name.valid, pu->chan->caller.id.name.str, "<unknown>"),
- S_COR(pu->chan->connected.id.number.valid, pu->chan->connected.id.number.str, "<unknown>"),
- S_COR(pu->chan->connected.id.name.valid, pu->chan->connected.id.name.str, "<unknown>"),
+ S_COR(ast_channel_caller(pu->chan)->id.number.valid, ast_channel_caller(pu->chan)->id.number.str, "<unknown>"),
+ S_COR(ast_channel_caller(pu->chan)->id.name.valid, ast_channel_caller(pu->chan)->id.name.str, "<unknown>"),
+ S_COR(ast_channel_connected(pu->chan)->id.number.valid, ast_channel_connected(pu->chan)->id.number.str, "<unknown>"),
+ S_COR(ast_channel_connected(pu->chan)->id.name.valid, ast_channel_connected(pu->chan)->id.name.str, "<unknown>"),
ast_channel_uniqueid(pu->chan)
);
@@ -5174,7 +5174,7 @@ static int parked_call_exec(struct ast_channel *chan, const char *data)
/* Send our caller-id to peer. */
ast_channel_lock(chan);
- ast_connected_line_copy_from_caller(&connected, &chan->caller);
+ ast_connected_line_copy_from_caller(&connected, ast_channel_caller(chan));
ast_channel_unlock(chan);
connected.source = AST_CONNECTED_LINE_UPDATE_SOURCE_ANSWER;
if (ast_channel_connected_line_sub(chan, peer, &connected, 0) &&
@@ -5190,7 +5190,7 @@ static int parked_call_exec(struct ast_channel *chan, const char *data)
* connected line information after connection.
*/
ast_channel_lock(peer);
- ast_connected_line_copy_from_caller(&connected, &peer->caller);
+ ast_connected_line_copy_from_caller(&connected, ast_channel_caller(peer));
ast_channel_unlock(peer);
connected.source = AST_CONNECTED_LINE_UPDATE_SOURCE_ANSWER;
if (ast_channel_connected_line_sub(peer, chan, &connected, 0) &&
@@ -7099,10 +7099,10 @@ static int manager_parking_status(struct mansession *s, const struct message *m)
curlot->name,
cur->parkingnum, ast_channel_name(cur->chan), cur->peername,
(long) cur->start.tv_sec + (long) (cur->parkingtime / 1000) - (long) time(NULL),
- S_COR(cur->chan->caller.id.number.valid, cur->chan->caller.id.number.str, ""), /* XXX in other places it is <unknown> */
- S_COR(cur->chan->caller.id.name.valid, cur->chan->caller.id.name.str, ""),
- S_COR(cur->chan->connected.id.number.valid, cur->chan->connected.id.number.str, ""), /* XXX in other places it is <unknown> */
- S_COR(cur->chan->connected.id.name.valid, cur->chan->connected.id.name.str, ""),
+ S_COR(ast_channel_caller(cur->chan)->id.number.valid, ast_channel_caller(cur->chan)->id.number.str, ""), /* XXX in other places it is <unknown> */
+ S_COR(ast_channel_caller(cur->chan)->id.name.valid, ast_channel_caller(cur->chan)->id.name.str, ""),
+ S_COR(ast_channel_connected(cur->chan)->id.number.valid, ast_channel_connected(cur->chan)->id.number.str, ""), /* XXX in other places it is <unknown> */
+ S_COR(ast_channel_connected(cur->chan)->id.name.valid, ast_channel_connected(cur->chan)->id.name.str, ""),
idText);
++numparked;
}
@@ -7323,7 +7323,7 @@ int ast_do_pickup(struct ast_channel *chan, struct ast_channel *target)
ast_channel_datastore_add(target, ds_pickup);
ast_party_connected_line_init(&connected_caller);
- ast_party_connected_line_copy(&connected_caller, &target->connected);
+ ast_party_connected_line_copy(&connected_caller, ast_channel_connected(target));
ast_channel_unlock(target);/* The pickup race is avoided so we do not need the lock anymore. */
connected_caller.source = AST_CONNECTED_LINE_UPDATE_SOURCE_ANSWER;
if (ast_channel_connected_line_sub(NULL, chan, &connected_caller, 0) &&
@@ -7334,7 +7334,7 @@ int ast_do_pickup(struct ast_channel *chan, struct ast_channel *target)
ast_channel_lock(chan);
chan_name = ast_strdupa(ast_channel_name(chan));
- ast_connected_line_copy_from_caller(&connected_caller, &chan->caller);
+ ast_connected_line_copy_from_caller(&connected_caller, ast_channel_caller(chan));
ast_channel_unlock(chan);
connected_caller.source = AST_CONNECTED_LINE_UPDATE_SOURCE_ANSWER;
ast_channel_queue_connected_line_update(chan, &connected_caller, NULL);
diff --git a/main/file.c b/main/file.c
index bf9f6831a..588dfe2f7 100644
--- a/main/file.c
+++ b/main/file.c
@@ -1311,7 +1311,7 @@ static int waitstream_core(struct ast_channel *c, const char *breakon,
if (context) {
const char exten[2] = { fr->subclass.integer, '\0' };
if (ast_exists_extension(c, context, exten, 1,
- S_COR(c->caller.id.number.valid, c->caller.id.number.str, NULL))) {
+ 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);
diff --git a/main/manager.c b/main/manager.c
index 8fa1041c4..bafe827d7 100644
--- a/main/manager.c
+++ b/main/manager.c
@@ -3351,10 +3351,10 @@ static int action_status(struct mansession *s, const struct message *m)
"%s"
"\r\n",
ast_channel_name(c),
- S_COR(c->caller.id.number.valid, c->caller.id.number.str, "<unknown>"),
- S_COR(c->caller.id.name.valid, c->caller.id.name.str, "<unknown>"),
- S_COR(c->connected.id.number.valid, c->connected.id.number.str, "<unknown>"),
- S_COR(c->connected.id.name.valid, c->connected.id.name.str, "<unknown>"),
+ S_COR(ast_channel_caller(c)->id.number.valid, ast_channel_caller(c)->id.number.str, "<unknown>"),
+ S_COR(ast_channel_caller(c)->id.name.valid, ast_channel_caller(c)->id.name.str, "<unknown>"),
+ S_COR(ast_channel_connected(c)->id.number.valid, ast_channel_connected(c)->id.number.str, "<unknown>"),
+ S_COR(ast_channel_connected(c)->id.name.valid, ast_channel_connected(c)->id.name.str, "<unknown>"),
ast_channel_accountcode(c),
ast_channel_state(c),
ast_state2str(ast_channel_state(c)), ast_channel_context(c),
@@ -3376,10 +3376,10 @@ static int action_status(struct mansession *s, const struct message *m)
"%s"
"\r\n",
ast_channel_name(c),
- S_COR(c->caller.id.number.valid, c->caller.id.number.str, "<unknown>"),
- S_COR(c->caller.id.name.valid, c->caller.id.name.str, "<unknown>"),
- S_COR(c->connected.id.number.valid, c->connected.id.number.str, "<unknown>"),
- S_COR(c->connected.id.name.valid, c->connected.id.name.str, "<unknown>"),
+ S_COR(ast_channel_caller(c)->id.number.valid, ast_channel_caller(c)->id.number.str, "<unknown>"),
+ S_COR(ast_channel_caller(c)->id.name.valid, ast_channel_caller(c)->id.name.str, "<unknown>"),
+ S_COR(ast_channel_connected(c)->id.number.valid, ast_channel_connected(c)->id.number.str, "<unknown>"),
+ S_COR(ast_channel_connected(c)->id.name.valid, ast_channel_connected(c)->id.name.str, "<unknown>"),
ast_channel_accountcode(c),
ast_state2str(ast_channel_state(c)), bridge, ast_channel_uniqueid(c),
ast_str_buffer(str), idText);
@@ -4607,10 +4607,10 @@ static int action_coreshowchannels(struct mansession *s, const struct message *m
"BridgedUniqueID: %s\r\n"
"\r\n", idText, ast_channel_name(c), ast_channel_uniqueid(c), ast_channel_context(c), ast_channel_exten(c), ast_channel_priority(c), ast_channel_state(c),
ast_state2str(ast_channel_state(c)), ast_channel_appl(c) ? ast_channel_appl(c) : "", ast_channel_data(c) ? S_OR(ast_channel_data(c), "") : "",
- S_COR(c->caller.id.number.valid, c->caller.id.number.str, ""),
- S_COR(c->caller.id.name.valid, c->caller.id.name.str, ""),
- S_COR(c->connected.id.number.valid, c->connected.id.number.str, ""),
- S_COR(c->connected.id.name.valid, c->connected.id.name.str, ""),
+ S_COR(ast_channel_caller(c)->id.number.valid, ast_channel_caller(c)->id.number.str, ""),
+ S_COR(ast_channel_caller(c)->id.name.valid, ast_channel_caller(c)->id.name.str, ""),
+ S_COR(ast_channel_connected(c)->id.number.valid, ast_channel_connected(c)->id.number.str, ""),
+ S_COR(ast_channel_connected(c)->id.name.valid, ast_channel_connected(c)->id.name.str, ""),
durbuf, S_OR(ast_channel_accountcode(c), ""), bc ? ast_channel_name(bc) : "", bc ? ast_channel_uniqueid(bc) : "");
ast_channel_unlock(c);
diff --git a/main/message.c b/main/message.c
index 1e575f2e2..67655f79d 100644
--- a/main/message.c
+++ b/main/message.c
@@ -676,14 +676,14 @@ static void chan_cleanup(struct ast_channel *chan)
/*
* Destroy all other datastores.
*/
- while ((ds = AST_LIST_REMOVE_HEAD(&chan->datastores, entry))) {
+ while ((ds = AST_LIST_REMOVE_HEAD(ast_channel_datastores(chan), entry))) {
ast_datastore_free(ds);
}
/*
* Destroy all channel variables.
*/
- headp = &chan->varshead;
+ headp = ast_channel_varshead(chan);
while ((vardata = AST_LIST_REMOVE_HEAD(headp, entries))) {
ast_var_delete(vardata);
}
diff --git a/main/pbx.c b/main/pbx.c
index bbf5ad74b..a5a2c08fd 100644
--- a/main/pbx.c
+++ b/main/pbx.c
@@ -3260,7 +3260,7 @@ const char *ast_str_retrieve_variable(struct ast_str **str, ssize_t maxlen, stru
if (c) {
ast_channel_lock(c);
- places[0] = &c->varshead;
+ places[0] = ast_channel_varshead(c);
}
/*
* Make a copy of var because parse_variable_name() modifies the string.
@@ -3292,16 +3292,16 @@ const char *ast_str_retrieve_variable(struct ast_str **str, ssize_t maxlen, stru
if (!strncmp(var + 4, "ING", 3)) {
if (!strcmp(var + 7, "PRES")) { /* CALLINGPRES */
ast_str_set(str, maxlen, "%d",
- ast_party_id_presentation(&c->caller.id));
+ ast_party_id_presentation(&ast_channel_caller(c)->id));
s = ast_str_buffer(*str);
} else if (!strcmp(var + 7, "ANI2")) { /* CALLINGANI2 */
- ast_str_set(str, maxlen, "%d", c->caller.ani2);
+ ast_str_set(str, maxlen, "%d", ast_channel_caller(c)->ani2);
s = ast_str_buffer(*str);
} else if (!strcmp(var + 7, "TON")) { /* CALLINGTON */
- ast_str_set(str, maxlen, "%d", c->caller.id.number.plan);
+ ast_str_set(str, maxlen, "%d", ast_channel_caller(c)->id.number.plan);
s = ast_str_buffer(*str);
} else if (!strcmp(var + 7, "TNS")) { /* CALLINGTNS */
- ast_str_set(str, maxlen, "%d", c->dialed.transit_network_select);
+ ast_str_set(str, maxlen, "%d", ast_channel_dialed(c)->transit_network_select);
s = ast_str_buffer(*str);
}
}
@@ -3987,11 +3987,11 @@ void ast_str_substitute_variables_full(struct ast_str **buf, ssize_t maxlen, str
struct varshead old;
struct ast_channel *bogus = ast_dummy_channel_alloc();
if (bogus) {
- memcpy(&old, &bogus->varshead, sizeof(old));
- memcpy(&bogus->varshead, headp, sizeof(bogus->varshead));
+ memcpy(&old, ast_channel_varshead(bogus), sizeof(old));
+ memcpy(ast_channel_varshead(bogus), headp, sizeof(*ast_channel_varshead(bogus)));
cp4 = ast_func_read2(c, finalvars, &substr3, 0) ? NULL : ast_str_buffer(substr3);
/* Don't deallocate the varshead that was passed in */
- memcpy(&bogus->varshead, &old, sizeof(bogus->varshead));
+ memcpy(ast_channel_varshead(bogus), &old, sizeof(*ast_channel_varshead(bogus)));
ast_channel_unref(bogus);
} else {
ast_log(LOG_ERROR, "Unable to allocate bogus channel for variable substitution. Function results may be blank.\n");
@@ -4186,11 +4186,11 @@ void pbx_substitute_variables_helper_full(struct ast_channel *c, struct varshead
struct varshead old;
struct ast_channel *c = ast_dummy_channel_alloc();
if (c) {
- memcpy(&old, &c->varshead, sizeof(old));
- memcpy(&c->varshead, headp, sizeof(c->varshead));
+ memcpy(&old, ast_channel_varshead(c), sizeof(old));
+ memcpy(ast_channel_varshead(c), headp, sizeof(*ast_channel_varshead(c)));
cp4 = ast_func_read(c, vars, workspace, VAR_BUF_SIZE) ? NULL : workspace;
/* Don't deallocate the varshead that was passed in */
- memcpy(&c->varshead, &old, sizeof(c->varshead));
+ memcpy(ast_channel_varshead(c), &old, sizeof(*ast_channel_varshead(c)));
c = ast_channel_unref(c);
} else {
ast_log(LOG_ERROR, "Unable to allocate bogus channel for variable substitution. Function results may be blank.\n");
@@ -4277,7 +4277,7 @@ void pbx_substitute_variables_helper_full(struct ast_channel *c, struct varshead
void pbx_substitute_variables_helper(struct ast_channel *c, const char *cp1, char *cp2, int count)
{
size_t used;
- pbx_substitute_variables_helper_full(c, (c) ? &c->varshead : NULL, cp1, cp2, count, &used);
+ pbx_substitute_variables_helper_full(c, (c) ? ast_channel_varshead(c) : NULL, cp1, cp2, count, &used);
}
void pbx_substitute_variables_varshead(struct varshead *headp, const char *cp1, char *cp2, int count)
@@ -5075,7 +5075,7 @@ static int collect_digits(struct ast_channel *c, int waittime, char *buf, int bu
buf[pos] = '\0'; /* make sure it is properly terminated */
while (ast_matchmore_extension(c, ast_channel_context(c), buf, 1,
- S_COR(c->caller.id.number.valid, c->caller.id.number.str, NULL))) {
+ S_COR(ast_channel_caller(c)->id.number.valid, ast_channel_caller(c)->id.number.str, NULL))) {
/* As long as we're willing to wait, and as long as it's not defined,
keep reading digits until we can't possibly get a right answer anymore. */
digit = ast_waitfordigit(c, waittime);
@@ -5147,7 +5147,7 @@ static enum ast_pbx_result __ast_pbx_run(struct ast_channel *c,
/* loop on priorities in this context/exten */
while (!(res = ast_spawn_extension(c, ast_channel_context(c), ast_channel_exten(c), ast_channel_priority(c),
- S_COR(c->caller.id.number.valid, c->caller.id.number.str, NULL),
+ S_COR(ast_channel_caller(c)->id.number.valid, ast_channel_caller(c)->id.number.str, NULL),
&found, 1))) {
if (!ast_check_hangup(c)) {
ast_channel_priority_set(c, ast_channel_priority(c) + 1);
@@ -5161,17 +5161,17 @@ static enum ast_pbx_result __ast_pbx_run(struct ast_channel *c,
}
if (c->_softhangup & AST_SOFTHANGUP_TIMEOUT) {
if (ast_exists_extension(c, ast_channel_context(c), "T", 1,
- S_COR(c->caller.id.number.valid, c->caller.id.number.str, NULL))) {
+ S_COR(ast_channel_caller(c)->id.number.valid, ast_channel_caller(c)->id.number.str, NULL))) {
set_ext_pri(c, "T", 1);
/* If the AbsoluteTimeout is not reset to 0, we'll get an infinite loop */
- memset(&c->whentohangup, 0, sizeof(c->whentohangup));
+ memset(ast_channel_whentohangup(c), 0, sizeof(*ast_channel_whentohangup(c)));
ast_channel_clear_softhangup(c, AST_SOFTHANGUP_TIMEOUT);
continue;
} else if (ast_exists_extension(c, ast_channel_context(c), "e", 1,
- S_COR(c->caller.id.number.valid, c->caller.id.number.str, NULL))) {
+ S_COR(ast_channel_caller(c)->id.number.valid, ast_channel_caller(c)->id.number.str, NULL))) {
raise_exception(c, "ABSOLUTETIMEOUT", 1);
/* If the AbsoluteTimeout is not reset to 0, we'll get an infinite loop */
- memset(&c->whentohangup, 0, sizeof(c->whentohangup));
+ memset(ast_channel_whentohangup(c), 0, sizeof(*ast_channel_whentohangup(c)));
ast_channel_clear_softhangup(c, AST_SOFTHANGUP_TIMEOUT);
continue;
}
@@ -5198,7 +5198,7 @@ static enum ast_pbx_result __ast_pbx_run(struct ast_channel *c,
/* Don't cycle on incomplete - this will happen if the only extension that matches is our "incomplete" extension */
if (!ast_matchmore_extension(c, ast_channel_context(c), ast_channel_exten(c), 1,
- S_COR(c->caller.id.number.valid, c->caller.id.number.str, NULL))) {
+ S_COR(ast_channel_caller(c)->id.number.valid, ast_channel_caller(c)->id.number.str, NULL))) {
invalid = 1;
} else {
ast_copy_string(dst_exten, ast_channel_exten(c), sizeof(dst_exten));
@@ -5211,7 +5211,7 @@ static enum ast_pbx_result __ast_pbx_run(struct ast_channel *c,
if ((res == AST_PBX_ERROR)
&& ast_exists_extension(c, ast_channel_context(c), "e", 1,
- S_COR(c->caller.id.number.valid, c->caller.id.number.str, NULL))) {
+ S_COR(ast_channel_caller(c)->id.number.valid, ast_channel_caller(c)->id.number.str, NULL))) {
/* if we are already on the 'e' exten, don't jump to it again */
if (!strcmp(ast_channel_exten(c), "e")) {
ast_verb(2, "Spawn extension (%s, %s, %d) exited ERROR while already on 'e' exten on '%s'\n", ast_channel_context(c), ast_channel_exten(c), ast_channel_priority(c), ast_channel_name(c));
@@ -5228,17 +5228,17 @@ static enum ast_pbx_result __ast_pbx_run(struct ast_channel *c,
}
if (c->_softhangup & AST_SOFTHANGUP_TIMEOUT) {
if (ast_exists_extension(c, ast_channel_context(c), "T", 1,
- S_COR(c->caller.id.number.valid, c->caller.id.number.str, NULL))) {
+ S_COR(ast_channel_caller(c)->id.number.valid, ast_channel_caller(c)->id.number.str, NULL))) {
set_ext_pri(c, "T", 1);
/* If the AbsoluteTimeout is not reset to 0, we'll get an infinite loop */
- memset(&c->whentohangup, 0, sizeof(c->whentohangup));
+ memset(ast_channel_whentohangup(c), 0, sizeof(*ast_channel_whentohangup(c)));
ast_channel_clear_softhangup(c, AST_SOFTHANGUP_TIMEOUT);
continue;
} else if (ast_exists_extension(c, ast_channel_context(c), "e", 1,
- S_COR(c->caller.id.number.valid, c->caller.id.number.str, NULL))) {
+ S_COR(ast_channel_caller(c)->id.number.valid, ast_channel_caller(c)->id.number.str, NULL))) {
raise_exception(c, "ABSOLUTETIMEOUT", 1);
/* If the AbsoluteTimeout is not reset to 0, we'll get an infinite loop */
- memset(&c->whentohangup, 0, sizeof(c->whentohangup));
+ memset(ast_channel_whentohangup(c), 0, sizeof(*ast_channel_whentohangup(c)));
ast_channel_clear_softhangup(c, AST_SOFTHANGUP_TIMEOUT);
continue;
}
@@ -5263,19 +5263,19 @@ static enum ast_pbx_result __ast_pbx_run(struct ast_channel *c,
if (invalid
|| !ast_exists_extension(c, ast_channel_context(c), ast_channel_exten(c), 1,
- S_COR(c->caller.id.number.valid, c->caller.id.number.str, NULL))) {
+ S_COR(ast_channel_caller(c)->id.number.valid, ast_channel_caller(c)->id.number.str, NULL))) {
/*!\note
* If there is no match at priority 1, it is not a valid extension anymore.
* Try to continue at "i" (for invalid) or "e" (for exception) or exit if
* neither exist.
*/
if (ast_exists_extension(c, ast_channel_context(c), "i", 1,
- S_COR(c->caller.id.number.valid, c->caller.id.number.str, NULL))) {
+ S_COR(ast_channel_caller(c)->id.number.valid, ast_channel_caller(c)->id.number.str, NULL))) {
ast_verb(3, "Sent into invalid extension '%s' in context '%s' on %s\n", ast_channel_exten(c), ast_channel_context(c), ast_channel_name(c));
pbx_builtin_setvar_helper(c, "INVALID_EXTEN", ast_channel_exten(c));
set_ext_pri(c, "i", 1);
} else if (ast_exists_extension(c, ast_channel_context(c), "e", 1,
- S_COR(c->caller.id.number.valid, c->caller.id.number.str, NULL))) {
+ S_COR(ast_channel_caller(c)->id.number.valid, ast_channel_caller(c)->id.number.str, NULL))) {
raise_exception(c, "INVALID", 1);
} else {
ast_log(LOG_WARNING, "Channel '%s' sent into invalid extension '%s' in context '%s', but no invalid handler\n",
@@ -5313,19 +5313,19 @@ static enum ast_pbx_result __ast_pbx_run(struct ast_channel *c,
timeout = 1;
if (!timeout
&& ast_exists_extension(c, ast_channel_context(c), dst_exten, 1,
- S_COR(c->caller.id.number.valid, c->caller.id.number.str, NULL))) { /* Prepare the next cycle */
+ S_COR(ast_channel_caller(c)->id.number.valid, ast_channel_caller(c)->id.number.str, NULL))) { /* Prepare the next cycle */
set_ext_pri(c, dst_exten, 1);
} else {
/* No such extension */
if (!timeout && !ast_strlen_zero(dst_exten)) {
/* An invalid extension */
if (ast_exists_extension(c, ast_channel_context(c), "i", 1,
- S_COR(c->caller.id.number.valid, c->caller.id.number.str, NULL))) {
+ S_COR(ast_channel_caller(c)->id.number.valid, ast_channel_caller(c)->id.number.str, NULL))) {
ast_verb(3, "Invalid extension '%s' in context '%s' on %s\n", dst_exten, ast_channel_context(c), ast_channel_name(c));
pbx_builtin_setvar_helper(c, "INVALID_EXTEN", dst_exten);
set_ext_pri(c, "i", 1);
} else if (ast_exists_extension(c, ast_channel_context(c), "e", 1,
- S_COR(c->caller.id.number.valid, c->caller.id.number.str, NULL))) {
+ S_COR(ast_channel_caller(c)->id.number.valid, ast_channel_caller(c)->id.number.str, NULL))) {
raise_exception(c, "INVALID", 1);
} else {
ast_log(LOG_WARNING,
@@ -5337,11 +5337,11 @@ static enum ast_pbx_result __ast_pbx_run(struct ast_channel *c,
} else {
/* A simple timeout */
if (ast_exists_extension(c, ast_channel_context(c), "t", 1,
- S_COR(c->caller.id.number.valid, c->caller.id.number.str, NULL))) {
+ S_COR(ast_channel_caller(c)->id.number.valid, ast_channel_caller(c)->id.number.str, NULL))) {
ast_verb(3, "Timeout on %s\n", ast_channel_name(c));
set_ext_pri(c, "t", 1);
} else if (ast_exists_extension(c, ast_channel_context(c), "e", 1,
- S_COR(c->caller.id.number.valid, c->caller.id.number.str, NULL))) {
+ S_COR(ast_channel_caller(c)->id.number.valid, ast_channel_caller(c)->id.number.str, NULL))) {
raise_exception(c, "RESPONSETIMEOUT", 1);
} else {
ast_log(LOG_WARNING,
@@ -5372,13 +5372,13 @@ 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_exists_extension(c, ast_channel_context(c), "h", 1,
- S_COR(c->caller.id.number.valid, c->caller.id.number.str, NULL))) {
+ S_COR(ast_channel_caller(c)->id.number.valid, ast_channel_caller(c)->id.number.str, NULL))) {
set_ext_pri(c, "h", 1);
if (ast_channel_cdr(c) && ast_opt_end_cdr_before_h_exten) {
ast_cdr_end(ast_channel_cdr(c));
}
while ((res = ast_spawn_extension(c, ast_channel_context(c), ast_channel_exten(c), ast_channel_priority(c),
- S_COR(c->caller.id.number.valid, c->caller.id.number.str, NULL),
+ S_COR(ast_channel_caller(c)->id.number.valid, ast_channel_caller(c)->id.number.str, NULL),
&found, 1)) == 0) {
ast_channel_priority_set(c, ast_channel_priority(c) + 1);
}
@@ -9854,14 +9854,14 @@ static int pbx_builtin_waitexten(struct ast_channel *chan, const char *data)
/* Call is hungup for some reason. */
res = -1;
} else if (ast_exists_extension(chan, ast_channel_context(chan), ast_channel_exten(chan), ast_channel_priority(chan) + 1,
- S_COR(chan->caller.id.number.valid, chan->caller.id.number.str, NULL))) {
+ S_COR(ast_channel_caller(chan)->id.number.valid, ast_channel_caller(chan)->id.number.str, NULL))) {
ast_verb(3, "Timeout on %s, continuing...\n", ast_channel_name(chan));
} else if (ast_exists_extension(chan, ast_channel_context(chan), "t", 1,
- S_COR(chan->caller.id.number.valid, chan->caller.id.number.str, NULL))) {
+ S_COR(ast_channel_caller(chan)->id.number.valid, ast_channel_caller(chan)->id.number.str, NULL))) {
ast_verb(3, "Timeout on %s, going to 't'\n", ast_channel_name(chan));
set_ext_pri(chan, "t", 0); /* 0 will become 1, next time through the loop */
} else if (ast_exists_extension(chan, ast_channel_context(chan), "e", 1,
- S_COR(chan->caller.id.number.valid, chan->caller.id.number.str, NULL))) {
+ S_COR(ast_channel_caller(chan)->id.number.valid, ast_channel_caller(chan)->id.number.str, NULL))) {
raise_exception(chan, "RESPONSETIMEOUT", 0); /* 0 will become 1, next time through the loop */
} else {
ast_log(LOG_WARNING, "Timeout but no rule 't' or 'e' in context '%s'\n",
@@ -9980,9 +9980,9 @@ static int pbx_builtin_background(struct ast_channel *chan, const char *data)
if (!ast_test_flag(chan, AST_FLAG_DISABLE_WORKAROUNDS)
&& (exten[0] = res)
&& ast_canmatch_extension(chan, args.context, exten, 1,
- S_COR(chan->caller.id.number.valid, chan->caller.id.number.str, NULL))
+ S_COR(ast_channel_caller(chan)->id.number.valid, ast_channel_caller(chan)->id.number.str, NULL))
&& !ast_matchmore_extension(chan, args.context, exten, 1,
- S_COR(chan->caller.id.number.valid, chan->caller.id.number.str, NULL))) {
+ S_COR(ast_channel_caller(chan)->id.number.valid, ast_channel_caller(chan)->id.number.str, NULL))) {
char buf[2] = { 0, };
snprintf(buf, sizeof(buf), "%c", res);
ast_channel_exten_set(chan, buf);
@@ -10020,7 +10020,7 @@ int pbx_builtin_serialize_variables(struct ast_channel *chan, struct ast_str **b
ast_channel_lock(chan);
- AST_LIST_TRAVERSE(&chan->varshead, variables, entries) {
+ AST_LIST_TRAVERSE(ast_channel_varshead(chan), variables, entries) {
if ((var = ast_var_name(variables)) && (val = ast_var_value(variables))
/* && !ast_strlen_zero(var) && !ast_strlen_zero(val) */
) {
@@ -10050,7 +10050,7 @@ const char *pbx_builtin_getvar_helper(struct ast_channel *chan, const char *name
if (chan) {
ast_channel_lock(chan);
- places[0] = &chan->varshead;
+ places[0] = ast_channel_varshead(chan);
}
for (i = 0; i < 2; i++) {
@@ -10091,7 +10091,7 @@ void pbx_builtin_pushvar_helper(struct ast_channel *chan, const char *name, cons
if (chan) {
ast_channel_lock(chan);
- headp = &chan->varshead;
+ headp = ast_channel_varshead(chan);
} else {
ast_rwlock_wrlock(&globalslock);
headp = &globals;
@@ -10124,7 +10124,7 @@ int pbx_builtin_setvar_helper(struct ast_channel *chan, const char *name, const
if (chan) {
ast_channel_lock(chan);
- headp = &chan->varshead;
+ headp = ast_channel_varshead(chan);
} else {
ast_rwlock_wrlock(&globalslock);
headp = &globals;
@@ -10699,7 +10699,7 @@ static int __ast_goto_if_exists(struct ast_channel *chan, const char *context, c
goto_func = (async) ? ast_async_goto : ast_explicit_goto;
if (ast_exists_extension(chan, context, exten, priority,
- S_COR(chan->caller.id.number.valid, chan->caller.id.number.str, NULL)))
+ S_COR(ast_channel_caller(chan)->id.number.valid, ast_channel_caller(chan)->id.number.str, NULL)))
return goto_func(chan, context, exten, priority);
else {
return AST_PBX_GOTO_FAILED;
@@ -10750,7 +10750,7 @@ static int pbx_parseable_goto(struct ast_channel *chan, const char *goto_string,
if (sscanf(pri, "%30d", &ipri) != 1) {
ipri = ast_findlabel_extension(chan, context ? context : ast_channel_context(chan),
exten ? exten : ast_channel_exten(chan), pri,
- S_COR(chan->caller.id.number.valid, chan->caller.id.number.str, NULL));
+ S_COR(ast_channel_caller(chan)->id.number.valid, ast_channel_caller(chan)->id.number.str, NULL));
if (ipri < 1) {
ast_log(LOG_WARNING, "Priority '%s' must be a number > 0, or valid label\n", pri);
return -1;