}
if (ast_channel_pbx(chan2)) {
- ast_set_flag(chan2, AST_FLAG_BRIDGE_HANGUP_DONT); /* don't let the after-bridge code run the h-exten */
+ ast_set_flag(ast_channel_flags(chan2), AST_FLAG_BRIDGE_HANGUP_DONT); /* don't let the after-bridge code run the h-exten */
}
res = ast_async_parseable_goto(chan2, args.label);
ast_set_flag(audiohook, AST_AUDIOHOOK_TRIGGER_SYNC | AST_AUDIOHOOK_SMALL_QUEUE);
res = ast_audiohook_attach(autochan->chan, audiohook);
- if (!res && ast_test_flag(autochan->chan, AST_FLAG_NBRIDGE) && (peer = ast_bridged_channel(autochan->chan))) {
+ if (!res && ast_test_flag(ast_channel_flags(autochan->chan), AST_FLAG_NBRIDGE) && (peer = ast_bridged_channel(autochan->chan))) {
ast_softhangup(peer, AST_SOFTHANGUP_UNBRIDGE);
}
return res;
}
ast_channel_lock(chan);
- ast_set_flag(chan, AST_FLAG_END_DTMF_ONLY);
+ ast_set_flag(ast_channel_flags(chan), AST_FLAG_END_DTMF_ONLY);
ast_channel_unlock(chan);
csth.volfactor = *volfactor;
ast_deactivate_generator(chan);
ast_channel_lock(chan);
- ast_clear_flag(chan, AST_FLAG_END_DTMF_ONLY);
+ ast_clear_flag(ast_channel_flags(chan), AST_FLAG_END_DTMF_ONLY);
ast_channel_unlock(chan);
if (ast_test_flag(flags, OPTION_WHISPER | OPTION_BARGE | OPTION_DTMF_SWITCH_MODES)) {
if (ast_channel_state(chan) != AST_STATE_UP)
ast_answer(chan);
- ast_set_flag(chan, AST_FLAG_SPYING); /* so nobody can spy on us while we are spying */
+ ast_set_flag(ast_channel_flags(chan), AST_FLAG_SPYING); /* so nobody can spy on us while we are spying */
waitms = 100;
if (!res)
res = ast_waitstream(chan, "");
else if (res < 0) {
- ast_clear_flag(chan, AST_FLAG_SPYING);
+ ast_clear_flag(ast_channel_flags(chan), AST_FLAG_SPYING);
break;
}
if (!ast_strlen_zero(exitcontext)) {
res = ast_waitfordigit(chan, waitms);
if (res < 0) {
iter = ast_channel_iterator_destroy(iter);
- ast_clear_flag(chan, AST_FLAG_SPYING);
+ ast_clear_flag(ast_channel_flags(chan), AST_FLAG_SPYING);
break;
}
if (!ast_strlen_zero(exitcontext)) {
continue;
}
- if (ast_check_hangup(autochan->chan) || ast_test_flag(autochan->chan, AST_FLAG_SPYING)) {
+ if (ast_check_hangup(autochan->chan) || ast_test_flag(ast_channel_flags(autochan->chan), AST_FLAG_SPYING)) {
continue;
}
}
exit:
- ast_clear_flag(chan, AST_FLAG_SPYING);
+ ast_clear_flag(ast_channel_flags(chan), AST_FLAG_SPYING);
ast_channel_setoption(chan, AST_OPTION_TXGAIN, &zero_volume, sizeof(zero_volume), 0);
}
cap = ast_format_cap_destroy(cap);
- conference_bridge->playback_chan->bridge = conference_bridge->bridge;
+ ast_channel_internal_bridge_set(conference_bridge->playback_chan, conference_bridge->bridge);
if (ast_call(conference_bridge->playback_chan, "", 0)) {
ast_hangup(conference_bridge->playback_chan);
if (outgoing->chan && (outgoing->chan != exception)) {
if (answered_elsewhere) {
/* The flag is used for local channel inheritance and stuff */
- ast_set_flag(outgoing->chan, AST_FLAG_ANSWERED_ELSEWHERE);
+ ast_set_flag(ast_channel_flags(outgoing->chan), AST_FLAG_ANSWERED_ELSEWHERE);
/* This is for the channel drivers */
ast_channel_hangupcause_set(outgoing->chan, AST_CAUSE_ANSWERED_ELSEWHERE);
}
if (outbound_group)
ast_app_group_set_channel(tc, outbound_group);
/* If the calling channel has the ANSWERED_ELSEWHERE flag set, inherit it. This is to support local channels */
- if (ast_test_flag(chan, AST_FLAG_ANSWERED_ELSEWHERE))
- ast_set_flag(tc, AST_FLAG_ANSWERED_ELSEWHERE);
+ if (ast_test_flag(ast_channel_flags(chan), AST_FLAG_ANSWERED_ELSEWHERE))
+ ast_set_flag(ast_channel_flags(tc), AST_FLAG_ANSWERED_ELSEWHERE);
/* Check if we're forced by configuration */
if (ast_test_flag64(&opts, OPT_CANCEL_ELSEWHERE))
- ast_set_flag(tc, AST_FLAG_ANSWERED_ELSEWHERE);
+ ast_set_flag(ast_channel_flags(tc), AST_FLAG_ANSWERED_ELSEWHERE);
/* Inherit context and extension */
ast_log(LOG_ERROR, "error streaming file '%s' to callee\n", opt_args[OPT_ARG_ANNOUNCE]);
}
- ast_set_flag(peer, AST_FLAG_END_DTMF_ONLY);
+ ast_set_flag(ast_channel_flags(peer), AST_FLAG_END_DTMF_ONLY);
while (ast_channel_stream(peer)) {
int ms;
ms = ast_sched_wait(ast_channel_sched(peer));
- if (ms < 0 && !peer->timingfunc) {
+ if (ms < 0 && !ast_channel_timingfunc(peer)) {
ast_stopstream(peer);
break;
}
}
ast_sched_runq(ast_channel_sched(peer));
}
- ast_clear_flag(peer, AST_FLAG_END_DTMF_ONLY);
+ ast_clear_flag(ast_channel_flags(peer), AST_FLAG_END_DTMF_ONLY);
}
if (chan && peer && ast_test_flag64(&opts, OPT_GOTO) && !ast_strlen_zero(opt_args[OPT_ARG_GOTO])) {
ast_channel_exten_set(peer, "h");
ast_channel_priority_set(peer, 1);
- autoloopflag = ast_test_flag(peer, AST_FLAG_IN_AUTOLOOP); /* save value to restore at the end */
- ast_set_flag(peer, AST_FLAG_IN_AUTOLOOP);
+ autoloopflag = ast_test_flag(ast_channel_flags(peer), AST_FLAG_IN_AUTOLOOP); /* save value to restore at the end */
+ ast_set_flag(ast_channel_flags(peer), AST_FLAG_IN_AUTOLOOP);
while ((res9 = ast_spawn_extension(peer, ast_channel_context(peer), ast_channel_exten(peer),
ast_channel_priority(peer),
ast_debug(1, "Spawn extension (%s,%s,%d) exited non-zero on '%s'\n", ast_channel_context(peer), ast_channel_exten(peer), ast_channel_priority(peer), ast_channel_name(peer));
ast_verb(2, "Spawn extension (%s, %s, %d) exited non-zero on '%s'\n", ast_channel_context(peer), ast_channel_exten(peer), ast_channel_priority(peer), ast_channel_name(peer));
}
- ast_set2_flag(peer, autoloopflag, AST_FLAG_IN_AUTOLOOP); /* set it back the way it was */
+ ast_set2_flag(ast_channel_flags(peer), autoloopflag, AST_FLAG_IN_AUTOLOOP); /* set it back the way it was */
}
if (!ast_check_hangup(peer) && ast_test_flag64(&opts, OPT_CALLEE_GO_ON)) {
if(!ast_strlen_zero(opt_args[OPT_ARG_CALLEE_GO_ON])) {
int continue_exec;
ast_channel_data_set(chan, "Retrying");
- if (ast_test_flag(chan, AST_FLAG_MOH))
+ if (ast_test_flag(ast_channel_flags(chan), AST_FLAG_MOH))
ast_moh_stop(chan);
res = dial_exec_full(chan, args.dialdata, &peerflags, &continue_exec);
ast_log(LOG_WARNING, "Announce file \"%s\" specified in Retrydial does not exist\n", args.announce);
}
if (!res && sleepms) {
- if (!ast_test_flag(chan, AST_FLAG_MOH))
+ if (!ast_test_flag(ast_channel_flags(chan), AST_FLAG_MOH))
ast_moh_start(chan, NULL, NULL);
res = ast_waitfordigit(chan, sleepms);
}
ast_log(LOG_WARNING, "Announce file \"%s\" specified in Retrydial does not exist\n", args.announce);
}
if (sleepms) {
- if (!ast_test_flag(chan, AST_FLAG_MOH))
+ if (!ast_test_flag(ast_channel_flags(chan), AST_FLAG_MOH))
ast_moh_start(chan, NULL, NULL);
if (!res)
res = ast_waitfordigit(chan, sleepms);
else if (res == 1)
res = 0;
- if (ast_test_flag(chan, AST_FLAG_MOH))
+ if (ast_test_flag(ast_channel_flags(chan), AST_FLAG_MOH))
ast_moh_stop(chan);
done:
return res;
play_dialtone(chan, args.mailbox);
- ast_set_flag(chan, AST_FLAG_END_DTMF_ONLY);
+ ast_set_flag(ast_channel_flags(chan), AST_FLAG_END_DTMF_ONLY);
for (;;) {
/* if outa time, give em reorder */
}
if (!(f = ast_read(chan))) {
- ast_clear_flag(chan, AST_FLAG_END_DTMF_ONLY);
+ ast_clear_flag(ast_channel_flags(chan), AST_FLAG_END_DTMF_ONLY);
return -1;
}
if (f->data.uint32)
ast_channel_hangupcause_set(chan, f->data.uint32);
ast_frfree(f);
- ast_clear_flag(chan, AST_FLAG_END_DTMF_ONLY);
+ ast_clear_flag(ast_channel_flags(chan), AST_FLAG_END_DTMF_ONLY);
return -1;
}
fp = fopen(args.passcode,"r");
if (!fp) {
ast_log(LOG_WARNING,"DISA password file %s not found on chan %s\n",args.passcode,ast_channel_name(chan));
- ast_clear_flag(chan, AST_FLAG_END_DTMF_ONLY);
+ ast_clear_flag(ast_channel_flags(chan), AST_FLAG_END_DTMF_ONLY);
return -1;
}
pwline[0] = 0;
}
}
- ast_clear_flag(chan, AST_FLAG_END_DTMF_ONLY);
+ ast_clear_flag(ast_channel_flags(chan), AST_FLAG_END_DTMF_ONLY);
if (k == 3) {
int recheck = 0;
hour,
min,
sec,
- c->_bridge ? ast_channel_name(c->_bridge) : "<none>",
+ ast_channel_internal_bridged_channel(c) ? ast_channel_name(ast_channel_internal_bridged_channel(c)) : "<none>",
ast_bridged_channel(c) ? ast_channel_name(ast_bridged_channel(c)) : "<none>",
ast_channel_context(c),
ast_channel_exten(c),
ast_print_group(pgrp, sizeof(pgrp), ast_channel_pickupgroup(c)),
ast_channel_appl(c) ? ast_channel_appl(c) : "(N/A)",
ast_channel_data(c) ? S_OR(ast_channel_data(c), "(Empty)") : "(None)",
- (ast_test_flag(c, AST_FLAG_BLOCKING) ? ast_channel_blockproc(c) : "(Not Blocking)"));
+ (ast_test_flag(ast_channel_flags(c), AST_FLAG_BLOCKING) ? ast_channel_blockproc(c) : "(Not Blocking)"));
return 0;
}
}
while (1) {
- if (ast_test_flag(chan, AST_FLAG_ZOMBIE)) {
+ if (ast_test_flag(ast_channel_flags(chan), AST_FLAG_ZOMBIE)) {
ast_chan_log(LOG_ERROR, chan, "Is a zombie\n");
break;
}
tmpto = ast_sched_wait(ast_channel_sched(tmpuser->ochan));
if (tmpto > 0 && tmpto < to)
to = tmpto;
- else if (tmpto < 0 && !tmpuser->ochan->timingfunc) {
+ else if (tmpto < 0 && !ast_channel_timingfunc(tmpuser->ochan)) {
ast_stopstream(tmpuser->ochan);
if (tmpuser->state == 1) {
ast_verb(3, "Playback of the call-from file appears to be done.\n");
argc++;
}
ast_channel_unlock(chan);
- autoloopflag = ast_test_flag(chan, AST_FLAG_IN_AUTOLOOP);
- ast_set_flag(chan, AST_FLAG_IN_AUTOLOOP);
+ autoloopflag = ast_test_flag(ast_channel_flags(chan), AST_FLAG_IN_AUTOLOOP);
+ ast_set_flag(ast_channel_flags(chan), AST_FLAG_IN_AUTOLOOP);
while (ast_exists_extension(chan, ast_channel_context(chan), ast_channel_exten(chan), ast_channel_priority(chan),
S_COR(ast_channel_caller(chan)->id.number.valid, ast_channel_caller(chan)->id.number.str, NULL))) {
struct ast_context *c;
/* Reset the depth back to what it was when the routine was entered (like if we called Macro recursively) */
snprintf(depthc, sizeof(depthc), "%d", depth);
pbx_builtin_setvar_helper(chan, "MACRO_DEPTH", depthc);
- ast_set2_flag(chan, autoloopflag, AST_FLAG_IN_AUTOLOOP);
+ ast_set2_flag(ast_channel_flags(chan), autoloopflag, AST_FLAG_IN_AUTOLOOP);
for (x = 1; x < argc; x++) {
/* Restore old arguments and delete ours */
ast_audiohook_attach(chan, audiohook);
- if (!res && ast_test_flag(chan, AST_FLAG_NBRIDGE) && (peer = ast_bridged_channel(chan)))
+ if (!res && ast_test_flag(ast_channel_flags(chan), AST_FLAG_NBRIDGE) && (peer = ast_bridged_channel(chan)))
ast_softhangup(peer, AST_SOFTHANGUP_UNBRIDGE);
return res;
ast_verb(3, "Dial Tech,String: (%s,%s)\n", dialtech, args.dial);
if (!ast_strlen_zero(args.return_context)) {
- ast_clear_flag(chan, AST_FLAG_IN_AUTOLOOP);
+ ast_clear_flag(ast_channel_flags(chan), AST_FLAG_IN_AUTOLOOP);
ast_parseable_goto(chan, args.return_context);
}
/* Hangup any existing lines we have open */
if (outgoing->chan && (outgoing->chan != exception)) {
if (exception || cancel_answered_elsewhere)
- ast_set_flag(outgoing->chan, AST_FLAG_ANSWERED_ELSEWHERE);
+ ast_set_flag(ast_channel_flags(outgoing->chan), AST_FLAG_ANSWERED_ELSEWHERE);
ast_hangup(outgoing->chan);
}
oo = outgoing;
ast_channel_lock_both(tmp->chan, qe->chan);
if (qe->cancel_answered_elsewhere) {
- ast_set_flag(tmp->chan, AST_FLAG_ANSWERED_ELSEWHERE);
+ ast_set_flag(ast_channel_flags(tmp->chan), AST_FLAG_ANSWERED_ELSEWHERE);
}
ast_channel_appl_set(tmp->chan, "AppQueue");
ast_channel_data_set(tmp->chan, "(Outgoing Line)");
/* if the calling channel has the ANSWERED_ELSEWHERE flag set, make sure this is inherited.
(this is mainly to support chan_local)
*/
- if (ast_test_flag(qe->chan, AST_FLAG_ANSWERED_ELSEWHERE)) {
+ if (ast_test_flag(ast_channel_flags(qe->chan), AST_FLAG_ANSWERED_ELSEWHERE)) {
qe->cancel_answered_elsewhere = 1;
}
/* Okay it's streaming so go into a loop grabbing frames! */
while (done == 0) {
/* If the filename is null and stream is not running, start up a new sound file */
- if (!quieted && (ast_channel_streamid(chan) == -1 && chan->timingfunc == NULL) && (filename = strsep(&filename_tmp, "&"))) {
+ if (!quieted && (ast_channel_streamid(chan) == -1 && ast_channel_timingfunc(chan) == NULL) && (filename = strsep(&filename_tmp, "&"))) {
/* Discard old stream information */
ast_stopstream(chan);
/* Start new stream */
switch (speech->state) {
case AST_SPEECH_STATE_READY:
/* If audio playback has stopped do a check for timeout purposes */
- if (ast_channel_streamid(chan) == -1 && chan->timingfunc == NULL)
+ if (ast_channel_streamid(chan) == -1 && ast_channel_timingfunc(chan) == NULL)
ast_stopstream(chan);
if (!quieted && ast_channel_stream(chan) == NULL && timeout && started == 0 && !filename_tmp) {
if (timeout == -1) {
speech_streamfile(chan, speech->processing_sound, ast_channel_language(chan));
}
}
- } else if (ast_channel_streamid(chan) == -1 && chan->timingfunc == NULL) {
+ } else if (ast_channel_streamid(chan) == -1 && ast_channel_timingfunc(chan) == NULL) {
ast_stopstream(chan);
if (speech->processing_sound != NULL) {
if (strlen(speech->processing_sound) > 0 && strcasecmp(speech->processing_sound, "none")) {
}
if (!ast_exists_extension(chan, ast_channel_context(chan), ast_channel_exten(chan),
- ast_test_flag(chan, AST_FLAG_IN_AUTOLOOP) ? ast_channel_priority(chan) + 1 : ast_channel_priority(chan),
+ ast_test_flag(ast_channel_flags(chan), AST_FLAG_IN_AUTOLOOP) ? ast_channel_priority(chan) + 1 : ast_channel_priority(chan),
S_COR(ast_channel_caller(chan)->id.number.valid, ast_channel_caller(chan)->id.number.str, NULL))) {
ast_log(LOG_ERROR, "Attempt to reach a non-existent destination for gosub: (Context:%s, Extension:%s, Priority:%d)\n",
- ast_channel_context(chan), ast_channel_exten(chan), ast_test_flag(chan, AST_FLAG_IN_AUTOLOOP) ? ast_channel_priority(chan) + 1 : ast_channel_priority(chan));
+ ast_channel_context(chan), ast_channel_exten(chan), ast_test_flag(ast_channel_flags(chan), AST_FLAG_IN_AUTOLOOP) ? ast_channel_priority(chan) + 1 : ast_channel_priority(chan));
ast_channel_context_set(chan, newframe->context);
ast_channel_exten_set(chan, newframe->extension);
ast_channel_priority_set(chan, newframe->priority - 1);
detection_start = ast_tvnow();
while (ast_channel_stream(chan)) {
res = ast_sched_wait(ast_channel_sched(chan));
- if ((res < 0) && !chan->timingfunc) {
+ if ((res < 0) && !ast_channel_timingfunc(chan)) {
res = 0;
break;
}
}
}
}
- if (winner && winner->bridge) {
- struct ast_bridge *bridge = winner->bridge;
+ if (winner && ast_channel_internal_bridge(winner)) {
+ struct ast_bridge *bridge = ast_channel_internal_bridge(winner);
int stop = 0;
ao2_unlock(multiplexed_thread);
- while ((bridge = winner->bridge) && ao2_trylock(bridge)) {
+ while ((bridge = ast_channel_internal_bridge(winner)) && ao2_trylock(bridge)) {
sched_yield();
if (multiplexed_thread->thread == AST_PTHREADT_STOP) {
stop = 1;
p->start = cur_time;
}
if (p->chan) {
- ast_copy_flags(p->chan, ast, AST_FLAG_EXCEPTION);
+ ast_copy_flags(ast_channel_flags(p->chan), ast_channel_flags(ast), AST_FLAG_EXCEPTION);
ast_channel_fdno_set(p->chan, (ast_channel_fdno(ast) == AST_AGENT_FD) ? AST_TIMING_FD : ast_channel_fdno(ast));
f = ast_read(p->chan);
} else
if (!f) {
/* If there's a channel, make it NULL */
if (p->chan) {
- p->chan->_bridge = NULL;
+ ast_channel_internal_bridged_channel_set(p->chan, NULL);
p->chan = NULL;
ast_devstate_changed(AST_DEVICE_UNAVAILABLE, "Agent/%s", p->agent);
p->acknowledged = 0;
}
CLEANUP(ast,p);
- if (p->chan && !p->chan->_bridge) {
+ if (p->chan && !ast_channel_internal_bridged_channel(p->chan)) {
if (strcasecmp(ast_channel_tech(p->chan)->type, "Local")) {
- p->chan->_bridge = ast;
+ ast_channel_internal_bridged_channel_set(p->chan, ast);
if (p->chan)
- ast_debug(1, "Bridge on '%s' being set to '%s' (3)\n", ast_channel_name(p->chan), ast_channel_name(p->chan->_bridge));
+ ast_debug(1, "Bridge on '%s' being set to '%s' (3)\n", ast_channel_name(p->chan), ast_channel_name(ast_channel_internal_bridged_channel(p->chan)));
}
}
ast_mutex_unlock(&p->lock);
} else
p->start = 0;
if (p->chan) {
- p->chan->_bridge = NULL;
+ ast_channel_internal_bridged_channel_set(p->chan, NULL);
/* If they're dead, go ahead and hang up on the agent now */
if (p->dead) {
ast_channel_lock(p->chan);
if (p) {
if (chan == p->chan)
- ret = bridge->_bridge;
- else if (chan == bridge->_bridge)
+ ret = ast_channel_internal_bridged_channel(bridge);
+ else if (chan == ast_channel_internal_bridged_channel(bridge))
ret = p->chan;
}
if (p->chan) {
loginChan = ast_strdupa(ast_channel_name(p->chan));
- if (owner && owner->_bridge) {
+ if (owner && ast_channel_internal_bridged_channel(owner)) {
talkingto = S_COR(ast_channel_caller(p->chan)->id.number.valid,
ast_channel_caller(p->chan)->id.number.str, "n/a");
if ((bridge = ast_bridged_channel(owner))) {
struct bridge_pvt *p = ast_channel_tech_pvt(ast);
/* If no bridge has been provided on the input channel, bail out */
- if (!ast->bridge) {
+ if (!ast_channel_internal_bridge(ast)) {
return -1;
}
/* Impart the output channel upon the given bridge of the input channel */
- ast_bridge_impart(p->input->bridge, p->output, NULL, NULL, 0);
+ ast_bridge_impart(ast_channel_internal_bridge(p->input), p->output, NULL, NULL, 0);
return 0;
}
} else {
ast_debug(1, "Neither %s nor %s are in a bridge, nothing to transfer\n",
ast_channel_name(p->subs[SUB_REAL].owner), ast_channel_name(p->subs[SUB_THREEWAY].owner));
- ast_channel_softhangup_internal_flag_set(p->subs[SUB_THREEWAY].owner, ast_channel_softhangup_internal_flag(p->subs[SUB_THREEWAY].owner) | AST_SOFTHANGUP_DEV);
+ ast_channel_softhangup_internal_flag_add(p->subs[SUB_THREEWAY].owner, AST_SOFTHANGUP_DEV);
return -1;
}
return 0;
readbuf = ((unsigned char *)p->subs[idx].buffer) + AST_FRIENDLY_OFFSET;
CHECK_BLOCKING(ast);
res = read(p->subs[idx].dfd, readbuf, p->subs[idx].linear ? READ_SIZE * 2 : READ_SIZE);
- ast_clear_flag(ast, AST_FLAG_BLOCKING);
+ ast_clear_flag(ast_channel_flags(ast), AST_FLAG_BLOCKING);
/* Check for hangup */
if (res < 0) {
f = NULL;
* emulation. The DTMF digits can come so fast that emulation
* can drop some of them.
*/
- ast_set_flag(chan, AST_FLAG_END_DTMF_ONLY);
+ ast_set_flag(ast_channel_flags(chan), AST_FLAG_END_DTMF_ONLY);
res = 4000;/* This is a typical OFF time between rings. */
for (;;) {
struct ast_frame *f;
ast_channel_state(chan) == AST_STATE_RINGING)
break; /* Got ring */
}
- ast_clear_flag(chan, AST_FLAG_END_DTMF_ONLY);
+ ast_clear_flag(ast_channel_flags(chan), AST_FLAG_END_DTMF_ONLY);
dtmfbuf[k] = '\0';
dahdi_setlinear(p->subs[idx].dfd, p->subs[idx].linear);
/* Got cid and ring. */
/* Now see if the opposite channel is bridged to anything */
if (!bridged) {
bridged = bridge;
- } else if (bridged->_bridge) {
- bridged = bridged->_bridge;
+ } else if (ast_channel_internal_bridged_channel(bridged)) {
+ bridged = ast_channel_internal_bridged_channel(bridged);
}
}
/* since we had to unlock p to get the bridged chan, validate our
* data once again and verify the bridged channel is what we expect
* it to be in order to perform this optimization */
- if (ast_test_flag(p, LOCAL_ALREADY_MASQED) || !p->owner || !p->chan || (p->chan->_bridge != bridged_chan)) {
+ if (ast_test_flag(p, LOCAL_ALREADY_MASQED) || !p->owner || !p->chan || (ast_channel_internal_bridged_channel(p->chan) != bridged_chan)) {
return;
}
frames on the owner channel (because they would be transferred to the
outbound channel during the masquerade)
*/
- if (p->chan->_bridge /* Not ast_bridged_channel! Only go one step! */ && AST_LIST_EMPTY(ast_channel_readq(p->owner))) {
+ if (ast_channel_internal_bridged_channel(p->chan) /* Not ast_bridged_channel! Only go one step! */ && AST_LIST_EMPTY(ast_channel_readq(p->owner))) {
/* Masquerade bridged channel into owner */
/* Lock everything we need, one by one, and give up if
we can't get everything. Remember, we'll get another
chance in just a little bit */
- if (!ast_channel_trylock(p->chan->_bridge)) {
- if (!ast_check_hangup(p->chan->_bridge)) {
+ if (!ast_channel_trylock(ast_channel_internal_bridged_channel(p->chan))) {
+ if (!ast_check_hangup(ast_channel_internal_bridged_channel(p->chan))) {
if (!ast_channel_trylock(p->owner)) {
if (!ast_check_hangup(p->owner)) {
- if (ast_channel_monitor(p->owner) && !ast_channel_monitor(p->chan->_bridge)) {
+ if (ast_channel_monitor(p->owner) && !ast_channel_monitor(ast_channel_internal_bridged_channel(p->chan))) {
/* If a local channel is being monitored, we don't want a masquerade
* to cause the monitor to go away. Since the masquerade swaps the monitors,
* pre-swapping the monitors before the masquerade will ensure that the monitor
* ends up where it is expected.
*/
tmp = ast_channel_monitor(p->owner);
- ast_channel_monitor_set(p->owner, ast_channel_monitor(p->chan->_bridge));
- ast_channel_monitor_set(p->chan->_bridge, tmp);
+ ast_channel_monitor_set(p->owner, ast_channel_monitor(ast_channel_internal_bridged_channel(p->chan)));
+ ast_channel_monitor_set(ast_channel_internal_bridged_channel(p->chan), tmp);
}
if (ast_channel_audiohooks(p->chan)) {
struct ast_audiohook_list *audiohooks_swapper;
if (ast_channel_caller(p->owner)->id.name.valid || ast_channel_caller(p->owner)->id.number.valid
|| ast_channel_caller(p->owner)->id.subaddress.valid || ast_channel_caller(p->owner)->ani.name.valid
|| ast_channel_caller(p->owner)->ani.number.valid || ast_channel_caller(p->owner)->ani.subaddress.valid) {
- SWAP(*ast_channel_caller(p->owner), *ast_channel_caller(p->chan->_bridge));
+ SWAP(*ast_channel_caller(p->owner), *ast_channel_caller(ast_channel_internal_bridged_channel(p->chan)));
}
if (ast_channel_redirecting(p->owner)->from.name.valid || ast_channel_redirecting(p->owner)->from.number.valid
|| ast_channel_redirecting(p->owner)->from.subaddress.valid || ast_channel_redirecting(p->owner)->to.name.valid
|| ast_channel_redirecting(p->owner)->to.number.valid || ast_channel_redirecting(p->owner)->to.subaddress.valid) {
- SWAP(*ast_channel_redirecting(p->owner), *ast_channel_redirecting(p->chan->_bridge));
+ SWAP(*ast_channel_redirecting(p->owner), *ast_channel_redirecting(ast_channel_internal_bridged_channel(p->chan)));
}
if (ast_channel_dialed(p->owner)->number.str || ast_channel_dialed(p->owner)->subaddress.valid) {
- SWAP(*ast_channel_dialed(p->owner), *ast_channel_dialed(p->chan->_bridge));
+ SWAP(*ast_channel_dialed(p->owner), *ast_channel_dialed(ast_channel_internal_bridged_channel(p->chan)));
}
ast_app_group_update(p->chan, p->owner);
- ast_channel_masquerade(p->owner, p->chan->_bridge);
+ ast_channel_masquerade(p->owner, ast_channel_internal_bridged_channel(p->chan));
ast_set_flag(p, LOCAL_ALREADY_MASQED);
}
ast_channel_unlock(p->owner);
}
}
- ast_channel_unlock(p->chan->_bridge);
+ ast_channel_unlock(ast_channel_internal_bridged_channel(p->chan));
}
}
}
}
/* Do not let a masquerade cause a Local channel to be bridged to itself! */
- if (!ast_check_hangup(newchan) && ((p->owner && p->owner->_bridge == p->chan) || (p->chan && p->chan->_bridge == p->owner))) {
+ if (!ast_check_hangup(newchan) && ((p->owner && ast_channel_internal_bridged_channel(p->owner) == p->chan) || (p->chan && ast_channel_internal_bridged_channel(p->chan) == p->owner))) {
ast_log(LOG_WARNING, "You can not bridge a Local channel to itself!\n");
ao2_unlock(p);
ast_queue_hangup(newchan);
ast_channel_cc_params_init(chan, ast_channel_get_cc_config_params(owner));
/* Make sure we inherit the ANSWERED_ELSEWHERE flag if it's set on the queue/dial call request in the dialplan */
- if (ast_test_flag(ast, AST_FLAG_ANSWERED_ELSEWHERE)) {
- ast_set_flag(chan, AST_FLAG_ANSWERED_ELSEWHERE);
+ if (ast_test_flag(ast_channel_flags(ast), AST_FLAG_ANSWERED_ELSEWHERE)) {
+ ast_set_flag(ast_channel_flags(chan), AST_FLAG_ANSWERED_ELSEWHERE);
}
/* copy the channel variables from the incoming channel to the outgoing channel */
isoutbound = IS_OUTBOUND(ast, p); /* just comparing pointer of ast */
- if (p->chan && ast_test_flag(ast, AST_FLAG_ANSWERED_ELSEWHERE)) {
- ast_set_flag(p->chan, AST_FLAG_ANSWERED_ELSEWHERE);
+ if (p->chan && ast_test_flag(ast_channel_flags(ast), AST_FLAG_ANSWERED_ELSEWHERE)) {
+ ast_set_flag(ast_channel_flags(p->chan), AST_FLAG_ANSWERED_ELSEWHERE);
ast_debug(2, "This local call has the ANSWERED_ELSEWHERE flag set.\n");
}
/* Try to read some data... */
CHECK_BLOCKING(ast);
res = read(p->fd, p->buf, PHONE_MAX_BUF);
- ast_clear_flag(ast, AST_FLAG_BLOCKING);
+ ast_clear_flag(ast_channel_flags(ast), AST_FLAG_BLOCKING);
if (res < 0) {
#if 0
if (errno == EAGAIN) {
ast_debug(1, "Asked to hangup channel that was not connected\n");
return 0;
}
- if (ast_test_flag(ast, AST_FLAG_ANSWERED_ELSEWHERE) || ast_channel_hangupcause(ast) == AST_CAUSE_ANSWERED_ELSEWHERE) {
+ if (ast_test_flag(ast_channel_flags(ast), AST_FLAG_ANSWERED_ELSEWHERE) || ast_channel_hangupcause(ast) == AST_CAUSE_ANSWERED_ELSEWHERE) {
ast_debug(1, "This call was answered elsewhere");
if (ast_channel_hangupcause(ast) == AST_CAUSE_ANSWERED_ELSEWHERE) {
ast_debug(1, "####### It's the cause code, buddy. The cause code!!!\n");
return 0;
}
- if (ast_test_flag(ast, AST_FLAG_ZOMBIE)) {
+ if (ast_test_flag(ast_channel_flags(ast), AST_FLAG_ZOMBIE)) {
if (p->refer)
ast_debug(1, "SIP Transfer: Hanging up Zombie channel %s after transfer ... Call-ID: %s\n", ast_channel_name(ast), p->callid);
else
int ret = -1;
struct sip_pvt *p;
- if (newchan && ast_test_flag(newchan, AST_FLAG_ZOMBIE))
+ if (newchan && ast_test_flag(ast_channel_flags(newchan), AST_FLAG_ZOMBIE))
ast_debug(1, "New channel is zombie\n");
- if (oldchan && ast_test_flag(oldchan, AST_FLAG_ZOMBIE))
+ if (oldchan && ast_test_flag(ast_channel_flags(oldchan), AST_FLAG_ZOMBIE))
ast_debug(1, "Old channel is zombie\n");
if (!newchan || !ast_channel_tech_pvt(newchan)) {
static void ast_quiet_chan(struct ast_channel *chan)
{
if (chan && ast_channel_state(chan) == AST_STATE_UP) {
- if (ast_test_flag(chan, AST_FLAG_MOH))
+ if (ast_test_flag(ast_channel_flags(chan), AST_FLAG_MOH))
ast_moh_stop(chan);
else if (ast_channel_generatordata(chan))
ast_deactivate_generator(chan);
static void unistim_quiet_chan(struct ast_channel *chan)
{
if (chan && ast_channel_state(chan) == AST_STATE_UP) {
- if (ast_test_flag(chan, AST_FLAG_MOH)) {
+ if (ast_test_flag(ast_channel_flags(chan), AST_FLAG_MOH)) {
ast_moh_stop(chan);
} else if (ast_channel_generatordata(chan)) {
ast_deactivate_generator(chan);
/* Step 1 : Music On Hold for peer, Dialing screen for us */
static void transfer_call_step1(struct unistimsession *pte)
{
- struct unistim_subchannel *sub, *sub_trans;
+ struct unistim_subchannel *sub /*, *sub_trans */;
struct unistim_device *d = pte->device;
sub = get_sub(d, SUB_REAL);
- sub_trans = get_sub(d, SUB_THREEWAY);
+ /* sub_trans = get_sub(d, SUB_THREEWAY); */
if (!sub || !sub->owner) {
ast_log(LOG_WARNING, "Unable to find subchannel for music on hold\n");
refresh_all_favorite(s); /* Update favicons in case of DND keys */
if (s->state == STATE_RINGING && sub->subtype == SUB_RING) {
send_no_ring(s);
- if (!ast_test_flag(ast, AST_FLAG_ANSWERED_ELSEWHERE) && ast_channel_hangupcause(ast) != AST_CAUSE_ANSWERED_ELSEWHERE) {
+ if (!ast_test_flag(ast_channel_flags(ast), AST_FLAG_ANSWERED_ELSEWHERE) && ast_channel_hangupcause(ast) != AST_CAUSE_ANSWERED_ELSEWHERE) {
d->missed_call++;
write_history(s, 'i', 1);
}
if (!sub->owner) {
tmp = (void *) -42;
} else {
- tmp = sub->owner->_bridge;
+ tmp = ast_channel_internal_bridged_channel(sub->owner);
}
ast_cli(a->fd,
"-->subtype=%s chan=%p rtp=%p bridge=%p line=%p alreadygone=%d softkey=%d\n",
bridgerec = 0;
} else {
ast_verb(5, "%s: chanreads: No native bridge.\n", p->dev);
- if (p->owner->_bridge) {
- ast_verb(5, "%s: chanreads: Got Asterisk bridge with [%s].\n", p->dev, ast_channel_name(p->owner->_bridge));
+ if (ast_channel_internal_bridged_channel(p->owner)) {
+ ast_verb(5, "%s: chanreads: Got Asterisk bridge with [%s].\n", p->dev, ast_channel_name(ast_channel_internal_bridged_channel(p->owner)));
bridgerec = 1;
} else {
bridgerec = 0;
* emulation. The DTMF digits can come so fast that emulation
* can drop some of them.
*/
- ast_set_flag(chan, AST_FLAG_END_DTMF_ONLY);
+ ast_set_flag(ast_channel_flags(chan), AST_FLAG_END_DTMF_ONLY);
res = 4000;/* This is a typical OFF time between rings. */
for (;;) {
struct ast_frame *f;
break; /* Got ring */
}
}
- ast_clear_flag(chan, AST_FLAG_END_DTMF_ONLY);
+ ast_clear_flag(ast_channel_flags(chan), AST_FLAG_END_DTMF_ONLY);
dtmfbuf[k] = '\0';
analog_set_linear_mode(p, idx, oldlinearity);
AST_LIST_HEAD_NOLOCK(ast_autochan_list, ast_autochan);
AST_LIST_HEAD_NOLOCK(ast_readq_list, ast_frame);
+typedef int(*ast_timing_func_t)(const void *data);
/*!
* \page AstChannel ast_channel locking and reference tracking
*
* gets called before the channel goes away.
*/
-/*!
- * \brief Main Channel structure associated with a channel.
- *
- * \note XXX It is important to remember to increment .cleancount each time
- * this structure is changed. XXX
- *
- * \note When adding fields to this structure, it is important to add the field
- * 'in position' with like-aligned fields, so as to keep the compiler from
- * having to add padding to align fields. The structure's fields are sorted
- * in this order: pointers, structures, long, int/enum, short, char. This
- * is especially important on 64-bit architectures, where mixing 4-byte
- * and 8-byte fields causes 4 bytes of padding to be added before many
- * 8-byte fields.
- */
-struct ast_channel {
- const struct ast_channel_tech *__do_not_use_tech; /*!< Technology (point to channel driver) */
- void *__do_not_use_tech_pvt; /*!< Private data used by the technology driver */
- void *__do_not_use_music_state; /*!< Music State*/
- void *__do_not_use_generatordata; /*!< Current generator data if there is any */
- struct ast_generator *__do_not_use_generator; /*!< Current active data generator */
- struct ast_channel * _bridge; /*!< Who are we bridged to, if we're bridged.
- * Who is proxying for us, if we are proxied (i.e. chan_agent).
- * Do not access directly, use ast_bridged_channel(chan) */
- struct ast_channel *__do_not_use_masq; /*!< Channel that will masquerade as us */
- struct ast_channel *__do_not_use_masqr; /*!< Who we are masquerading as */
- const char *__do_not_use_blockproc; /*!< Procedure causing blocking */
- const char *__do_not_use_appl; /*!< Current application */
- const char *__do_not_use_data; /*!< Data passed to current application */
- struct ast_sched_context *__do_not_use_sched; /*!< Schedule context */
- struct ast_filestream *__do_not_use_stream; /*!< Stream itself. */
- struct ast_filestream *__do_not_use_vstream; /*!< Video Stream itself. */
- int (*timingfunc)(const void *data);
- void *__do_not_use_timingdata;
- struct ast_pbx *__do_not_use_pbx; /*!< PBX private structure for this channel */
- struct ast_trans_pvt *__do_not_use_writetrans; /*!< Write translation path */
- struct ast_trans_pvt *__do_not_use_readtrans; /*!< Read translation path */
- struct ast_audiohook_list *__do_not_use_audiohooks;
- struct ast_framehook_list *__do_not_use_framehooks;
- struct ast_cdr *__do_not_use_cdr; /*!< Call Detail Record */
- struct ast_tone_zone *__do_not_use_zone; /*!< Tone zone as set in indications.conf or
- * in the CHANNEL dialplan function */
- struct ast_channel_monitor *__do_not_use_monitor; /*!< Channel monitoring */
-#ifdef HAVE_EPOLL
- struct ast_epoll_data *__do_not_use_epfd_data[AST_MAX_FDS];
-#endif
-
- AST_DECLARE_STRING_FIELDS(
- AST_STRING_FIELD(__do_not_use_name); /*!< ASCII unique channel name */
- AST_STRING_FIELD(__do_not_use_language); /*!< Language requested for voice prompts */
- AST_STRING_FIELD(__do_not_use_musicclass); /*!< Default music class */
- AST_STRING_FIELD(__do_not_use_accountcode); /*!< Account code for billing */
- AST_STRING_FIELD(__do_not_use_peeraccount); /*!< Peer account code for billing */
- AST_STRING_FIELD(__do_not_use_userfield); /*!< Userfield for CEL billing */
- AST_STRING_FIELD(__do_not_use_call_forward); /*!< Where to forward to if asked to dial on this interface */
- AST_STRING_FIELD(__do_not_use_uniqueid); /*!< Unique Channel Identifier */
- AST_STRING_FIELD(__do_not_use_linkedid); /*!< Linked Channel Identifier -- gets propagated by linkage */
- AST_STRING_FIELD(__do_not_use_parkinglot); /*! Default parking lot, if empty, default parking lot */
- AST_STRING_FIELD(__do_not_use_hangupsource); /*! Who is responsible for hanging up this channel */
- AST_STRING_FIELD(__do_not_use_dialcontext); /*!< Dial: Extension context that we were called from */
- );
-
- struct timeval __do_not_use_whentohangup; /*!< Non-zero, set to actual time when channel is to be hung up */
- pthread_t blocker; /*!< If anyone is blocking, this is them */
-
- /*!
- * \brief Dialed/Called information.
- * \note Set on incoming channels to indicate the originally dialed party.
- * \note Dialed Number Identifier (DNID)
- */
- struct ast_party_dialed __do_not_use_dialed;
-
- /*!
- * \brief Channel Caller ID information.
- * \note The caller id information is the caller id of this
- * channel when it is used to initiate a call.
- */
- struct ast_party_caller __do_not_use_caller;
-
- /*!
- * \brief Channel Connected Line ID information.
- * \note The connected line information identifies the channel
- * connected/bridged to this channel.
- */
- struct ast_party_connected_line __do_not_use_connected;
-
- /*! \brief Redirecting/Diversion information */
- struct ast_party_redirecting __do_not_use_redirecting;
-
- struct ast_frame __do_not_use_dtmff; /*!< DTMF frame */
- struct varshead __do_not_use_varshead; /*!< A linked list for channel variables. See \ref AstChanVar */
- ast_group_t __do_not_use_callgroup; /*!< Call group for call pickups */
- ast_group_t __do_not_use_pickupgroup; /*!< Pickup group - which calls groups can be picked up? */
- struct ast_readq_list __do_not_use_readq;
- struct ast_jb __do_not_use_jb; /*!< The jitterbuffer state */
- struct timeval __do_not_use_dtmf_tv; /*!< The time that an in process digit began, or the last digit ended */
- struct ast_datastore_list __do_not_use_datastores; /*!< Data stores on the channel */
- struct ast_autochan_list __do_not_use_autochans; /*!< Autochans on the channel */
- unsigned long __do_not_use_insmpl; /*!< Track the read/written samples for monitor use */
- unsigned long __do_not_use_outsmpl; /*!< Track the read/written samples for monitor use */
-
- int __do_not_use_fds[AST_MAX_FDS]; /*!< File descriptors for channel -- Drivers will poll on
- * these file descriptors, so at least one must be non -1.
- * See \arg \ref AstFileDesc */
- int __do_not_use_softhangup; /*!< Whether or not we have been hung up... Do not set this value
- * directly, use ast_softhangup() */
- int __do_not_use_fdno; /*!< Which fd had an event detected on */
- int __do_not_use_streamid; /*!< For streaming playback, the schedule ID */
- int __do_not_use_vstreamid; /*!< For streaming video playback, the schedule ID */
- struct ast_format __do_not_use_oldwriteformat; /*!< Original writer format */
- int __do_not_use_timingfd; /*!< Timing fd */
- enum ast_channel_state __do_not_use_state; /*!< State of line -- Don't write directly, use ast_setstate() */
- int __do_not_use_rings; /*!< Number of rings so far */
- int __do_not_use_priority; /*!< Dialplan: Current extension priority */
- int __do_not_use_macropriority; /*!< Macro: Current non-macro priority. See app_macro.c */
- int __do_not_use_amaflags; /*!< Set BEFORE PBX is started to determine AMA flags */
- enum ast_channel_adsicpe __do_not_use_adsicpe; /*!< Whether or not ADSI is detected on CPE */
- unsigned int __do_not_use_fin; /*!< Frames in counters. The high bit is a debug mask, so
- * the counter is only in the remaining bits */
- unsigned int __do_not_use_fout; /*!< Frames out counters. The high bit is a debug mask, so
- * the counter is only in the remaining bits */
- int __do_not_use_hangupcause; /*!< Why is the channel hanged up. See causes.h */
- unsigned int flags; /*!< channel flags of AST_FLAG_ type */
- int __do_not_use_alertpipe[2];
- struct ast_format_cap *__do_not_use_nativeformats; /*!< Kinds of data this channel can natively handle */
- struct ast_format __do_not_use_readformat; /*!< Requested read format (after translation) */
- struct ast_format __do_not_use_writeformat; /*!< Requested write format (after translation) */
- struct ast_format __do_not_use_rawreadformat; /*!< Raw read format (before translation) */
- struct ast_format __do_not_use_rawwriteformat; /*!< Raw write format (before translation) */
- unsigned int __do_not_use_emulate_dtmf_duration; /*!< Number of ms left to emulate DTMF for */
-#ifdef HAVE_EPOLL
- int __do_not_use_epfd;
-#endif
- int __do_not_use_visible_indication; /*!< Indication currently playing on the channel */
-
- unsigned short __do_not_use_transfercapability; /*!< ISDN Transfer Capability - AST_FLAG_DIGITAL is not enough */
-
- struct ast_bridge *bridge; /*!< Bridge this channel is participating in */
- struct ast_timer *__do_not_use_timer; /*!< timer object that provided timingfd */
-
- char __do_not_use_context[AST_MAX_CONTEXT]; /*!< Dialplan: Current extension context */
- char __do_not_use_exten[AST_MAX_EXTENSION]; /*!< Dialplan: Current extension number */
- char __do_not_use_macrocontext[AST_MAX_CONTEXT]; /*!< Macro: Current non-macro context. See app_macro.c */
- char __do_not_use_macroexten[AST_MAX_EXTENSION]; /*!< Macro: Current non-macro extension. See app_macro.c */
- char __do_not_use_dtmf_digit_to_emulate; /*!< Digit being emulated */
-};
+struct ast_channel;
/*! \brief ast_channel_tech Properties */
enum {
}
#define CHECK_BLOCKING(c) do { \
- if (ast_test_flag(c, AST_FLAG_BLOCKING)) {\
- ast_debug(1, "Thread %ld Blocking '%s', already blocked by thread %ld in procedure %s\n", (long) pthread_self(), ast_channel_name(c), (long) (c)->blocker, ast_channel_blockproc(c)); \
+ if (ast_test_flag(ast_channel_flags(c), AST_FLAG_BLOCKING)) {\
+ ast_debug(1, "Thread %ld Blocking '%s', already blocked by thread %ld in procedure %s\n", (long) pthread_self(), ast_channel_name(c), (long) ast_channel_blocker(c), ast_channel_blockproc(c)); \
} else { \
- (c)->blocker = pthread_self(); \
+ ast_channel_blocker_set((c), pthread_self()); \
ast_channel_blockproc_set((c), __PRETTY_FUNCTION__); \
- ast_set_flag(c, AST_FLAG_BLOCKING); \
+ ast_set_flag(ast_channel_flags(c), AST_FLAG_BLOCKING); \
} } while (0)
ast_group_t ast_get_group(const char *s);
void ast_channel_insmpl_set(struct ast_channel *chan, unsigned long value);
unsigned long ast_channel_outsmpl(const struct ast_channel *chan);
void ast_channel_outsmpl_set(struct ast_channel *chan, unsigned long value);
-void * ast_channel_generatordata(const struct ast_channel *chan);
-void ast_channel_generatordata_set(struct ast_channel *chan, void * value);
-void * ast_channel_music_state(const struct ast_channel *chan);
-void ast_channel_music_state_set(struct ast_channel *chan, void * value);
-void * ast_channel_tech_pvt(const struct ast_channel *chan);
-void ast_channel_tech_pvt_set(struct ast_channel *chan, void * value);
-void * ast_channel_timingdata(const struct ast_channel *chan);
-void ast_channel_timingdata_set(struct ast_channel *chan, void * value);
-struct ast_audiohook_list * ast_channel_audiohooks(const struct ast_channel *chan);
-void ast_channel_audiohooks_set(struct ast_channel *chan, struct ast_audiohook_list * value);
-struct ast_cdr * ast_channel_cdr(const struct ast_channel *chan);
-void ast_channel_cdr_set(struct ast_channel *chan, struct ast_cdr * value);
-struct ast_channel * ast_channel__bridge(const struct ast_channel *chan);
-void ast_channel__bridge_set(struct ast_channel *chan, struct ast_channel * value);
-struct ast_channel * ast_channel_masq(const struct ast_channel *chan);
-void ast_channel_masq_set(struct ast_channel *chan, struct ast_channel * value);
-struct ast_channel * ast_channel_masqr(const struct ast_channel *chan);
-void ast_channel_masqr_set(struct ast_channel *chan, struct ast_channel * value);
-struct ast_channel_monitor * ast_channel_monitor(const struct ast_channel *chan);
-void ast_channel_monitor_set(struct ast_channel *chan, struct ast_channel_monitor * value);
-struct ast_filestream * ast_channel_stream(const struct ast_channel *chan);
-void ast_channel_stream_set(struct ast_channel *chan, struct ast_filestream * value);
-struct ast_filestream * ast_channel_vstream(const struct ast_channel *chan);
-void ast_channel_vstream_set(struct ast_channel *chan, struct ast_filestream * value);
-struct ast_format_cap * ast_channel_nativeformats(const struct ast_channel *chan);
-void ast_channel_nativeformats_set(struct ast_channel *chan, struct ast_format_cap * value);
-struct ast_framehook_list * ast_channel_framehooks(const struct ast_channel *chan);
-void ast_channel_framehooks_set(struct ast_channel *chan, struct ast_framehook_list * value);
-struct ast_generator * ast_channel_generator(const struct ast_channel *chan);
-void ast_channel_generator_set(struct ast_channel *chan, struct ast_generator * value);
-struct ast_pbx * ast_channel_pbx(const struct ast_channel *chan);
-void ast_channel_pbx_set(struct ast_channel *chan, struct ast_pbx * value);
-struct ast_sched_context * ast_channel_sched(const struct ast_channel *chan);
-void ast_channel_sched_set(struct ast_channel *chan, struct ast_sched_context * value);
-struct ast_timer * ast_channel_timer(const struct ast_channel *chan);
-void ast_channel_timer_set(struct ast_channel *chan, struct ast_timer * value);
-struct ast_tone_zone * ast_channel_zone(const struct ast_channel *chan);
-void ast_channel_zone_set(struct ast_channel *chan, struct ast_tone_zone * value);
-struct ast_trans_pvt * ast_channel_readtrans(const struct ast_channel *chan);
-void ast_channel_readtrans_set(struct ast_channel *chan, struct ast_trans_pvt * value);
-struct ast_trans_pvt * ast_channel_writetrans(const struct ast_channel *chan);
-void ast_channel_writetrans_set(struct ast_channel *chan, struct ast_trans_pvt * value);
-const struct ast_channel_tech * ast_channel_tech(const struct ast_channel *chan);
-void ast_channel_tech_set(struct ast_channel *chan, const struct ast_channel_tech * value);
+void *ast_channel_generatordata(const struct ast_channel *chan);
+void ast_channel_generatordata_set(struct ast_channel *chan, void *value);
+void *ast_channel_music_state(const struct ast_channel *chan);
+void ast_channel_music_state_set(struct ast_channel *chan, void *value);
+void *ast_channel_tech_pvt(const struct ast_channel *chan);
+void ast_channel_tech_pvt_set(struct ast_channel *chan, void *value);
+void *ast_channel_timingdata(const struct ast_channel *chan);
+void ast_channel_timingdata_set(struct ast_channel *chan, void *value);
+struct ast_audiohook_list *ast_channel_audiohooks(const struct ast_channel *chan);
+void ast_channel_audiohooks_set(struct ast_channel *chan, struct ast_audiohook_list *value);
+struct ast_cdr *ast_channel_cdr(const struct ast_channel *chan);
+void ast_channel_cdr_set(struct ast_channel *chan, struct ast_cdr *value);
+struct ast_channel *ast_channel__bridge(const struct ast_channel *chan);
+void ast_channel__bridge_set(struct ast_channel *chan, struct ast_channel *value);
+struct ast_channel *ast_channel_masq(const struct ast_channel *chan);
+void ast_channel_masq_set(struct ast_channel *chan, struct ast_channel *value);
+struct ast_channel *ast_channel_masqr(const struct ast_channel *chan);
+void ast_channel_masqr_set(struct ast_channel *chan, struct ast_channel *value);
+struct ast_channel_monitor *ast_channel_monitor(const struct ast_channel *chan);
+void ast_channel_monitor_set(struct ast_channel *chan, struct ast_channel_monitor *value);
+struct ast_filestream *ast_channel_stream(const struct ast_channel *chan);
+void ast_channel_stream_set(struct ast_channel *chan, struct ast_filestream *value);
+struct ast_filestream *ast_channel_vstream(const struct ast_channel *chan);
+void ast_channel_vstream_set(struct ast_channel *chan, struct ast_filestream *value);
+struct ast_format_cap *ast_channel_nativeformats(const struct ast_channel *chan);
+void ast_channel_nativeformats_set(struct ast_channel *chan, struct ast_format_cap *value);
+struct ast_framehook_list *ast_channel_framehooks(const struct ast_channel *chan);
+void ast_channel_framehooks_set(struct ast_channel *chan, struct ast_framehook_list *value);
+struct ast_generator *ast_channel_generator(const struct ast_channel *chan);
+void ast_channel_generator_set(struct ast_channel *chan, struct ast_generator *value);
+struct ast_pbx *ast_channel_pbx(const struct ast_channel *chan);
+void ast_channel_pbx_set(struct ast_channel *chan, struct ast_pbx *value);
+struct ast_sched_context *ast_channel_sched(const struct ast_channel *chan);
+void ast_channel_sched_set(struct ast_channel *chan, struct ast_sched_context *value);
+struct ast_timer *ast_channel_timer(const struct ast_channel *chan);
+void ast_channel_timer_set(struct ast_channel *chan, struct ast_timer *value);
+struct ast_tone_zone *ast_channel_zone(const struct ast_channel *chan);
+void ast_channel_zone_set(struct ast_channel *chan, struct ast_tone_zone *value);
+struct ast_trans_pvt *ast_channel_readtrans(const struct ast_channel *chan);
+void ast_channel_readtrans_set(struct ast_channel *chan, struct ast_trans_pvt *value);
+struct ast_trans_pvt *ast_channel_writetrans(const struct ast_channel *chan);
+void ast_channel_writetrans_set(struct ast_channel *chan, struct ast_trans_pvt *value);
+const struct ast_channel_tech *ast_channel_tech(const struct ast_channel *chan);
+void ast_channel_tech_set(struct ast_channel *chan, const struct ast_channel_tech *value);
enum ast_channel_adsicpe ast_channel_adsicpe(const struct ast_channel *chan);
void ast_channel_adsicpe_set(struct ast_channel *chan, enum ast_channel_adsicpe value);
enum ast_channel_state ast_channel_state(const struct ast_channel *chan);
void ast_channel_softhangup_internal_flag_set(struct ast_channel *chan, int value);
void ast_channel_softhangup_internal_flag_add(struct ast_channel *chan, int value);
void ast_channel_softhangup_internal_flag_clear(struct ast_channel *chan, int value);
-int ast_channel_softhangup_internal_flag(struct ast_channel * chan);
+int ast_channel_softhangup_internal_flag(struct ast_channel *chan);
/* Format getters */
struct ast_format *ast_channel_oldwriteformat(struct ast_channel *chan);
struct ast_epoll_data *ast_channel_internal_epfd_data(const struct ast_channel *chan, int which);
void ast_channel_internal_epfd_data_set(struct ast_channel *chan, int which , struct ast_epoll_data *value);
#endif
+
+pthread_t ast_channel_blocker(const struct ast_channel *chan);
+void ast_channel_blocker_set(struct ast_channel *chan, pthread_t value);
+
+ast_timing_func_t ast_channel_timingfunc(const struct ast_channel *chan);
+void ast_channel_timingfunc_set(struct ast_channel *chan, ast_timing_func_t value);
+
+struct ast_bridge *ast_channel_internal_bridge(const struct ast_channel *chan);
+void ast_channel_internal_bridge_set(struct ast_channel *chan, struct ast_bridge *value);
+
+struct ast_channel *ast_channel_internal_bridged_channel(const struct ast_channel *chan);
+void ast_channel_internal_bridged_channel_set(struct ast_channel *chan, struct ast_channel *value);
+
+struct ast_flags *ast_channel_flags(struct ast_channel *chan);
#endif /* _ASTERISK_CHANNEL_H */
/* In this case, params is already malloc'd */
if (ls->allowoverride) {
- ast_set_flag(chan, AST_FLAG_WRITE_INT);
+ ast_set_flag(ast_channel_flags(chan), AST_FLAG_WRITE_INT);
} else {
- ast_clear_flag(chan, AST_FLAG_WRITE_INT);
+ ast_clear_flag(ast_channel_flags(chan), AST_FLAG_WRITE_INT);
}
ast_format_copy(&ls->origwfmt, ast_channel_writeformat(chan));
as->use_count = 1;
ast_channel_lock(chan);
- as->orig_end_dtmf_flag = ast_test_flag(chan, AST_FLAG_END_DTMF_ONLY) ? 1 : 0;
+ as->orig_end_dtmf_flag = ast_test_flag(ast_channel_flags(chan), AST_FLAG_END_DTMF_ONLY) ? 1 : 0;
if (!as->orig_end_dtmf_flag)
- ast_set_flag(chan, AST_FLAG_END_DTMF_ONLY);
+ ast_set_flag(ast_channel_flags(chan), AST_FLAG_END_DTMF_ONLY);
ast_channel_unlock(chan);
AST_LIST_LOCK(&aslist);
}
if (!as->orig_end_dtmf_flag) {
- ast_clear_flag(chan, AST_FLAG_END_DTMF_ONLY);
+ ast_clear_flag(ast_channel_flags(chan), AST_FLAG_END_DTMF_ONLY);
}
ast_channel_lock(chan);
int look_for_dtmf = 1, dtmf_len = 0;
/* The channel is now under our control and we don't really want any begin frames to do our DTMF matching so disable 'em at the core level */
- ast_set_flag(bridge_channel->chan, AST_FLAG_END_DTMF_ONLY);
+ ast_set_flag(ast_channel_flags(bridge_channel->chan), AST_FLAG_END_DTMF_ONLY);
/* Wait for DTMF on the channel and put it into a buffer. If the buffer matches any feature hook execute the hook. */
while (look_for_dtmf) {
}
/* Since we are done bringing DTMF in return to using both begin and end frames */
- ast_clear_flag(bridge_channel->chan, AST_FLAG_END_DTMF_ONLY);
+ ast_clear_flag(ast_channel_flags(bridge_channel->chan), AST_FLAG_END_DTMF_ONLY);
/* If a hook was actually matched execute it on this channel, otherwise stream up the DTMF to the other channels */
if (hook) {
/* Actually execute the respective threading model, and keep our bridge thread alive */
while (bridge_channel->state == AST_BRIDGE_CHANNEL_STATE_WAIT) {
/* Update bridge pointer on channel */
- bridge_channel->chan->bridge = bridge_channel->bridge;
+ ast_channel_internal_bridge_set(bridge_channel->chan, bridge_channel->bridge);
/* If the technology requires a thread and one is not running, start it up */
if (bridge_channel->bridge->thread == AST_PTHREADT_NULL && (bridge_channel->bridge->technology->capabilities & AST_BRIDGE_CAPABILITY_THREAD)) {
bridge_channel->bridge->stop = 0;
}
}
- bridge_channel->chan->bridge = NULL;
+ ast_channel_internal_bridge_set(bridge_channel->chan, NULL);
/* See if we need to dissolve the bridge itself if they hung up */
if (bridge_channel->state == AST_BRIDGE_CHANNEL_STATE_END) {
#include "asterisk/stringfields.h"
#include "asterisk/global_datastores.h"
#include "asterisk/data.h"
+#include "asterisk/channel_internal.h"
#ifdef HAVE_EPOLL
#include <sys/epoll.h>
struct ast_timer *timer;
/* If shutting down, don't allocate any new channels */
- if (shutting_down) {
+ if (ast_shutting_down()) {
ast_log(LOG_WARNING, "Channel allocation failed: Refusing due to active shutdown\n");
return NULL;
}
-#if defined(REF_DEBUG)
- tmp = __ao2_alloc_debug(sizeof(*tmp), ast_channel_destructor,
- AO2_ALLOC_OPT_LOCK_MUTEX, "", file, line, function, 1);
-#elif defined(__AST_DEBUG_MALLOC)
- tmp = __ao2_alloc_debug(sizeof(*tmp), ast_channel_destructor,
- AO2_ALLOC_OPT_LOCK_MUTEX, "", file, line, function, 0);
-#else
- tmp = ao2_alloc(sizeof(*tmp), ast_channel_destructor);
-#endif
- if (!tmp) {
+ if (!(tmp = ast_channel_internal_alloc(ast_channel_destructor))) {
/* Channel structure allocation failure. */
return NULL;
}
ast_channel_timingfd_set(tmp, ast_timer_fd(ast_channel_timer(tmp)));
}
- if (needqueue && ast_channel_internal_alertpipe_init(tmp)) {
- return ast_channel_unref(tmp);
- }
-
/*
* This is the last place the channel constructor can fail.
*
* AST_CEL_CHANNEL_END is not posted if we have not posted the
* AST_CEL_CHANNEL_START yet.
*/
- if ((ast_string_field_init(tmp, 128))) {
+
+ if (needqueue && ast_channel_internal_alertpipe_init(tmp)) {
return ast_channel_unref(tmp);
}
ast_channel_uniqueid(tmp));
}
+ ast_channel_internal_finalize(tmp);
return tmp;
}
struct ast_channel *tmp;
struct varshead *headp;
-#if defined(REF_DEBUG)
- tmp = __ao2_alloc_debug(sizeof(*tmp), ast_dummy_channel_destructor,
- AO2_ALLOC_OPT_LOCK_MUTEX, "dummy channel", file, line, function, 1);
-#elif defined(__AST_DEBUG_MALLOC)
- tmp = __ao2_alloc_debug(sizeof(*tmp), ast_dummy_channel_destructor,
- AO2_ALLOC_OPT_LOCK_MUTEX, "dummy channel", file, line, function, 0);
-#else
- tmp = ao2_alloc(sizeof(*tmp), ast_dummy_channel_destructor);
-#endif
- if (!tmp) {
+ if (!(tmp = ast_channel_internal_alloc(ast_dummy_channel_destructor))) {
/* Dummy channel structure allocation failure. */
return NULL;
}
- if ((ast_string_field_init(tmp, 128))) {
- return ast_channel_unref(tmp);
- }
-
headp = ast_channel_varshead(tmp);
AST_LIST_HEAD_INIT_NOLOCK(headp);
unsigned int new_voice_frames = 0;
unsigned int queued_frames = 0;
unsigned int queued_voice_frames = 0;
- AST_LIST_HEAD_NOLOCK(, ast_frame) frames;
+ AST_LIST_HEAD_NOLOCK(,ast_frame) frames;
ast_channel_lock(chan);
}
} else if (ast_channel_timingfd(chan) > -1) {
ast_timer_enable_continuous(ast_channel_timer(chan));
- } else if (ast_test_flag(chan, AST_FLAG_BLOCKING)) {
- pthread_kill(chan->blocker, SIGURG);
+ } else if (ast_test_flag(ast_channel_flags(chan), AST_FLAG_BLOCKING)) {
+ pthread_kill(ast_channel_blocker(chan), SIGURG);
}
ast_channel_unlock(chan);
int pre = 0;
if (chan) {
- pre = ast_test_flag(chan, AST_FLAG_DEFER_DTMF);
- ast_set_flag(chan, AST_FLAG_DEFER_DTMF);
+ pre = ast_test_flag(ast_channel_flags(chan), AST_FLAG_DEFER_DTMF);
+ ast_set_flag(ast_channel_flags(chan), AST_FLAG_DEFER_DTMF);
}
return pre;
}
void ast_channel_undefer_dtmf(struct ast_channel *chan)
{
if (chan)
- ast_clear_flag(chan, AST_FLAG_DEFER_DTMF);
+ ast_clear_flag(ast_channel_flags(chan), AST_FLAG_DEFER_DTMF);
}
struct ast_channel *ast_channel_callback(ao2_callback_data_fn *cb_fn, void *arg,
struct ast_datastore *datastore;
char device_name[AST_CHANNEL_NAME];
- if (ast_channel_name(chan)) {
- /* The string fields were initialized. */
+ if (ast_channel_internal_is_finalized(chan)) {
ast_cel_report_event(chan, AST_CEL_CHANNEL_END, NULL, NULL, NULL);
ast_cel_check_retire_linkedid(chan);
}
ast_sched_context_destroy(ast_channel_sched(chan));
}
- if (ast_channel_name(chan)) {
+ if (ast_channel_internal_is_finalized(chan)) {
char *dashptr;
- /* The string fields were initialized. */
ast_copy_string(device_name, ast_channel_name(chan), sizeof(device_name));
if ((dashptr = strrchr(device_name, '-'))) {
*dashptr = '\0';
ast_channel_zone_set(chan, ast_tone_zone_unref(ast_channel_zone(chan)));
}
- ast_string_field_free_memory(chan);
+ ast_channel_internal_cleanup(chan);
if (device_name[0]) {
/*
ast_channel_cdr_set(chan, NULL);
}
- ast_string_field_free_memory(chan);
+ ast_channel_internal_cleanup(chan);
}
struct ast_datastore *ast_channel_datastore_alloc(const struct ast_datastore_info *info, const char *uid)
ast_channel_softhangup_internal_flag_add(chan, cause);
ast_queue_frame(chan, &ast_null_frame);
/* Interrupt any poll call or such */
- if (ast_test_flag(chan, AST_FLAG_BLOCKING))
- pthread_kill(chan->blocker, SIGURG);
+ if (ast_test_flag(ast_channel_flags(chan), AST_FLAG_BLOCKING))
+ pthread_kill(ast_channel_blocker(chan), SIGURG);
return 0;
}
* Mark it as a zombie already so ast_do_masquerade() will know
* to free it later.
*/
- ast_set_flag(chan, AST_FLAG_ZOMBIE);
+ ast_set_flag(ast_channel_flags(chan), AST_FLAG_ZOMBIE);
destroy_hooks(chan);
ast_channel_unlock(chan);
return 0;
}
- if (!(was_zombie = ast_test_flag(chan, AST_FLAG_ZOMBIE))) {
- ast_set_flag(chan, AST_FLAG_ZOMBIE);
+ if (!(was_zombie = ast_test_flag(ast_channel_flags(chan), AST_FLAG_ZOMBIE))) {
+ ast_set_flag(ast_channel_flags(chan), AST_FLAG_ZOMBIE);
}
ast_channel_unlock(chan);
snprintf(extra_str, sizeof(extra_str), "%d,%s,%s", ast_channel_hangupcause(chan), ast_channel_hangupsource(chan), S_OR(pbx_builtin_getvar_helper(chan, "DIALSTATUS"), ""));
ast_cel_report_event(chan, AST_CEL_HANGUP, NULL, extra_str, NULL);
- if (ast_test_flag(chan, AST_FLAG_BLOCKING)) {
+ if (ast_test_flag(ast_channel_flags(chan), AST_FLAG_BLOCKING)) {
ast_log(LOG_WARNING, "Hard hangup called by thread %ld on %s, while fd "
"is blocked by thread %ld in procedure %s! Expect a failure\n",
- (long) pthread_self(), ast_channel_name(chan), (long)chan->blocker, ast_channel_blockproc(chan));
- ast_assert(ast_test_flag(chan, AST_FLAG_BLOCKING) == 0);
+ (long) pthread_self(), ast_channel_name(chan), (long)ast_channel_blocker(chan), ast_channel_blockproc(chan));
+ ast_assert(ast_test_flag(ast_channel_flags(chan), AST_FLAG_BLOCKING) == 0);
}
if (!was_zombie) {
ast_debug(1, "Hanging up channel '%s'\n", ast_channel_name(chan));
ast_channel_lock(chan);
/* You can't answer an outbound call */
- if (ast_test_flag(chan, AST_FLAG_OUTGOING)) {
+ if (ast_test_flag(ast_channel_flags(chan), AST_FLAG_OUTGOING)) {
ast_channel_unlock(chan);
return 0;
}
/* Stop if we're a zombie or need a soft hangup */
- if (ast_test_flag(chan, AST_FLAG_ZOMBIE) || ast_check_hangup(chan)) {
+ if (ast_test_flag(ast_channel_flags(chan), AST_FLAG_ZOMBIE) || ast_check_hangup(chan)) {
ast_channel_unlock(chan);
return -1;
}
ast_channel_generatordata_set(chan, NULL);
ast_channel_generator_set(chan, NULL);
ast_channel_set_fd(chan, AST_GENERATOR_FD, -1);
- ast_clear_flag(chan, AST_FLAG_WRITE_INT);
+ ast_clear_flag(ast_channel_flags(chan), AST_FLAG_WRITE_INT);
ast_settimeout(chan, 0, NULL, NULL);
}
ast_channel_unlock(chan);
res = ast_poll(pfds, max, rms);
}
for (x = 0; x < n; x++)
- ast_clear_flag(c[x], AST_FLAG_BLOCKING);
+ ast_clear_flag(ast_channel_flags(c[x]), AST_FLAG_BLOCKING);
if (res < 0) { /* Simulate a timeout if we were interrupted */
if (errno != EINTR)
*ms = -1;
if (fdmap[x].chan >= 0) { /* this is a channel */
winner = c[fdmap[x].chan]; /* override previous winners */
if (res & POLLPRI)
- ast_set_flag(winner, AST_FLAG_EXCEPTION);
+ ast_set_flag(ast_channel_flags(winner), AST_FLAG_EXCEPTION);
else
- ast_clear_flag(winner, AST_FLAG_EXCEPTION);
+ ast_clear_flag(ast_channel_flags(winner), AST_FLAG_EXCEPTION);
ast_channel_fdno_set(winner, fdmap[x].fdno);
} else { /* this is an fd */
if (outfd)
res = epoll_wait(ast_channel_epfd(chan), ev, 1, rms);
/* Stop blocking */
- ast_clear_flag(chan, AST_FLAG_BLOCKING);
+ ast_clear_flag(ast_channel_flags(chan), AST_FLAG_BLOCKING);
/* Simulate a timeout if we were interrupted */
if (res < 0) {
aed = ev[0].data.ptr;
ast_channel_fdno_set(chan, aed->which);
if (ev[0].events & EPOLLPRI)
- ast_set_flag(chan, AST_FLAG_EXCEPTION);
+ ast_set_flag(ast_channel_flags(chan), AST_FLAG_EXCEPTION);
else
- ast_clear_flag(chan, AST_FLAG_EXCEPTION);
+ ast_clear_flag(ast_channel_flags(chan), AST_FLAG_EXCEPTION);
if (*ms > 0) {
*ms -= ast_tvdiff_ms(ast_tvnow(), start);
res = epoll_wait(ast_channel_epfd(c[0]), ev, 25, rms);
for (i = 0; i < n; i++)
- ast_clear_flag(c[i], AST_FLAG_BLOCKING);
+ ast_clear_flag(ast_channel_flags(c[i]), AST_FLAG_BLOCKING);
if (res < 0) {
if (errno != EINTR)
winner = aed->chan;
if (ev[i].events & EPOLLPRI)
- ast_set_flag(winner, AST_FLAG_EXCEPTION);
+ ast_set_flag(ast_channel_flags(winner), AST_FLAG_EXCEPTION);
else
- ast_clear_flag(winner, AST_FLAG_EXCEPTION);
+ ast_clear_flag(ast_channel_flags(winner), AST_FLAG_EXCEPTION);
ast_channel_fdno_set(winner, aed->which);
}
res = ast_timer_set_rate(ast_channel_timer(c), real_rate);
- c->timingfunc = func;
+ ast_channel_timingfunc_set(c, func);
ast_channel_timingdata_set(c, data);
if (func == NULL && rate == 0 && ast_channel_fdno(c) == AST_TIMING_FD) {
int ast_waitfordigit_full(struct ast_channel *c, int ms, int audiofd, int cmdfd)
{
/* Stop if we're a zombie or need a soft hangup */
- if (ast_test_flag(c, AST_FLAG_ZOMBIE) || ast_check_hangup(c))
+ if (ast_test_flag(ast_channel_flags(c), AST_FLAG_ZOMBIE) || ast_check_hangup(c))
return -1;
/* Only look for the end of DTMF, don't bother with the beginning and don't emulate things */
- ast_set_flag(c, AST_FLAG_END_DTMF_ONLY);
+ ast_set_flag(ast_channel_flags(c), AST_FLAG_END_DTMF_ONLY);
/* Wait for a digit, no more than ms milliseconds total. */
if (errno == 0 || errno == EINTR)
continue;
ast_log(LOG_WARNING, "Wait failed (%s)\n", strerror(errno));
- ast_clear_flag(c, AST_FLAG_END_DTMF_ONLY);
+ ast_clear_flag(ast_channel_flags(c), AST_FLAG_END_DTMF_ONLY);
return -1;
} else if (outfd > -1) {
/* The FD we were watching has something waiting */
ast_log(LOG_WARNING, "The FD we were waiting for has something waiting. Waitfordigit returning numeric 1\n");
- ast_clear_flag(c, AST_FLAG_END_DTMF_ONLY);
+ ast_clear_flag(ast_channel_flags(c), AST_FLAG_END_DTMF_ONLY);
return 1;
} else if (rchan) {
int res;
case AST_FRAME_DTMF_END:
res = f->subclass.integer;
ast_frfree(f);
- ast_clear_flag(c, AST_FLAG_END_DTMF_ONLY);
+ ast_clear_flag(ast_channel_flags(c), AST_FLAG_END_DTMF_ONLY);
return res;
case AST_FRAME_CONTROL:
switch (f->subclass.integer) {
case AST_CONTROL_HANGUP:
ast_frfree(f);
- ast_clear_flag(c, AST_FLAG_END_DTMF_ONLY);
+ ast_clear_flag(ast_channel_flags(c), AST_FLAG_END_DTMF_ONLY);
return -1;
case AST_CONTROL_RINGING:
case AST_CONTROL_ANSWER:
}
}
- ast_clear_flag(c, AST_FLAG_END_DTMF_ONLY);
+ ast_clear_flag(ast_channel_flags(c), AST_FLAG_END_DTMF_ONLY);
return 0; /* Time is up */
}
int res;
int samples;
- if (chan->timingfunc) {
+ if (ast_channel_timingfunc(chan)) {
ast_debug(1, "Generator got voice, switching to phase locked mode\n");
ast_settimeout(chan, 0, NULL, NULL);
}
}
} else if (f->frametype == AST_FRAME_CNG) {
- if (ast_channel_generator(chan) && !chan->timingfunc && (ast_channel_timingfd(chan) > -1)) {
+ if (ast_channel_generator(chan) && !ast_channel_timingfunc(chan) && (ast_channel_timingfd(chan) > -1)) {
ast_debug(1, "Generator got CNG, switching to timed mode\n");
ast_settimeout(chan, 50, generator_force, chan);
}
*/
static inline int should_skip_dtmf(struct ast_channel *chan)
{
- if (ast_test_flag(chan, AST_FLAG_DEFER_DTMF | AST_FLAG_EMULATE_DTMF)) {
+ if (ast_test_flag(ast_channel_flags(chan), AST_FLAG_DEFER_DTMF | AST_FLAG_EMULATE_DTMF)) {
/* We're in the middle of emulating a digit, or DTMF has been
* explicitly deferred. Skip this digit, then. */
return 1;
ast_channel_lock(chan);
/* Stop if we're a zombie or need a soft hangup */
- if (ast_test_flag(chan, AST_FLAG_ZOMBIE) || ast_check_hangup(chan)) {
+ if (ast_test_flag(ast_channel_flags(chan), AST_FLAG_ZOMBIE) || ast_check_hangup(chan)) {
if (ast_channel_generator(chan))
ast_deactivate_generator(chan);
if (ast_channel_timingfd(chan) > -1 && ast_channel_fdno(chan) == AST_TIMING_FD) {
enum ast_timer_event res;
- ast_clear_flag(chan, AST_FLAG_EXCEPTION);
+ ast_clear_flag(ast_channel_flags(chan), AST_FLAG_EXCEPTION);
res = ast_timer_get_event(ast_channel_timer(chan));
case AST_TIMING_EVENT_EXPIRED:
ast_timer_ack(ast_channel_timer(chan), 1);
- if (chan->timingfunc) {
+ if (ast_channel_timingfunc(chan)) {
/* save a copy of func/data before unlocking the channel */
- int (*func)(const void *) = chan->timingfunc;
+ ast_timing_func_t func = ast_channel_timingfunc(chan);
void *data = ast_channel_timingdata(chan);
ast_channel_fdno_set(chan, -1);
ast_channel_unlock(chan);
ast_channel_fdno_set(chan, -1);
goto done;
} else if (ast_channel_fd_isset(chan, AST_JITTERBUFFER_FD) && ast_channel_fdno(chan) == AST_JITTERBUFFER_FD) {
- ast_clear_flag(chan, AST_FLAG_EXCEPTION);
+ ast_clear_flag(ast_channel_flags(chan), AST_FLAG_EXCEPTION);
}
/* Read and ignore anything on the alertpipe, but read only
}
}
} else {
- chan->blocker = pthread_self();
- if (ast_test_flag(chan, AST_FLAG_EXCEPTION)) {
+ ast_channel_blocker_set(chan, pthread_self());
+ if (ast_test_flag(ast_channel_flags(chan), AST_FLAG_EXCEPTION)) {
if (ast_channel_tech(chan)->exception)
f = ast_channel_tech(chan)->exception(chan);
else {
f = &ast_null_frame;
}
/* Clear the exception flag */
- ast_clear_flag(chan, AST_FLAG_EXCEPTION);
+ ast_clear_flag(ast_channel_flags(chan), AST_FLAG_EXCEPTION);
} else if (ast_channel_tech(chan) && ast_channel_tech(chan)->read)
f = ast_channel_tech(chan)->read(chan);
else
switch (f->frametype) {
case AST_FRAME_CONTROL:
if (f->subclass.integer == AST_CONTROL_ANSWER) {
- if (!ast_test_flag(chan, AST_FLAG_OUTGOING)) {
+ if (!ast_test_flag(ast_channel_flags(chan), AST_FLAG_OUTGOING)) {
ast_debug(1, "Ignoring answer on an inbound call!\n");
ast_frfree(f);
f = &ast_null_frame;
send_dtmf_event(chan, "Received", f->subclass.integer, "No", "Yes");
ast_log(LOG_DTMF, "DTMF end '%c' received on %s, duration %ld ms\n", f->subclass.integer, ast_channel_name(chan), f->len);
/* Queue it up if DTMF is deferred, or if DTMF emulation is forced. */
- if (ast_test_flag(chan, AST_FLAG_DEFER_DTMF) || ast_test_flag(chan, AST_FLAG_EMULATE_DTMF)) {
+ if (ast_test_flag(ast_channel_flags(chan), AST_FLAG_DEFER_DTMF) || ast_test_flag(ast_channel_flags(chan), AST_FLAG_EMULATE_DTMF)) {
queue_dtmf_readq(chan, f);
ast_frfree(f);
f = &ast_null_frame;
- } else if (!ast_test_flag(chan, AST_FLAG_IN_DTMF | AST_FLAG_END_DTMF_ONLY)) {
+ } else if (!ast_test_flag(ast_channel_flags(chan), AST_FLAG_IN_DTMF | AST_FLAG_END_DTMF_ONLY)) {
if (!ast_tvzero(*ast_channel_dtmf_tv(chan)) &&
ast_tvdiff_ms(ast_tvnow(), *ast_channel_dtmf_tv(chan)) < AST_MIN_DTMF_GAP) {
/* If it hasn't been long enough, defer this digit */
/* There was no begin, turn this into a begin and send the end later */
struct timeval tv = ast_tvnow();
f->frametype = AST_FRAME_DTMF_BEGIN;
- ast_set_flag(chan, AST_FLAG_EMULATE_DTMF);
+ ast_set_flag(ast_channel_flags(chan), AST_FLAG_EMULATE_DTMF);
ast_channel_dtmf_digit_to_emulate_set(chan, f->subclass.integer);
ast_channel_dtmf_tv_set(chan, &tv);
if (f->len) {
}
} else {
struct timeval now = ast_tvnow();
- if (ast_test_flag(chan, AST_FLAG_IN_DTMF)) {
+ if (ast_test_flag(ast_channel_flags(chan), AST_FLAG_IN_DTMF)) {
ast_log(LOG_DTMF, "DTMF end accepted with begin '%c' on %s\n", f->subclass.integer, ast_channel_name(chan));
- ast_clear_flag(chan, AST_FLAG_IN_DTMF);
+ ast_clear_flag(ast_channel_flags(chan), AST_FLAG_IN_DTMF);
if (!f->len)
f->len = ast_tvdiff_ms(now, *ast_channel_dtmf_tv(chan));
ast_log(LOG_DTMF, "DTMF end accepted without begin '%c' on %s\n", f->subclass.integer, ast_channel_name(chan));
f->len = AST_MIN_DTMF_DURATION;
}
- if (f->len < AST_MIN_DTMF_DURATION && !ast_test_flag(chan, AST_FLAG_END_DTMF_ONLY)) {
+ if (f->len < AST_MIN_DTMF_DURATION && !ast_test_flag(ast_channel_flags(chan), AST_FLAG_END_DTMF_ONLY)) {
ast_log(LOG_DTMF, "DTMF end '%c' has duration %ld but want minimum %d, emulating on %s\n", f->subclass.integer, f->len, AST_MIN_DTMF_DURATION, ast_channel_name(chan));
- ast_set_flag(chan, AST_FLAG_EMULATE_DTMF);
+ ast_set_flag(ast_channel_flags(chan), AST_FLAG_EMULATE_DTMF);
ast_channel_dtmf_digit_to_emulate_set(chan, f->subclass.integer);
ast_channel_emulate_dtmf_duration_set(chan, AST_MIN_DTMF_DURATION - f->len);
ast_frfree(f);
case AST_FRAME_DTMF_BEGIN:
send_dtmf_event(chan, "Received", f->subclass.integer, "Yes", "No");
ast_log(LOG_DTMF, "DTMF begin '%c' received on %s\n", f->subclass.integer, ast_channel_name(chan));
- if ( ast_test_flag(chan, AST_FLAG_DEFER_DTMF | AST_FLAG_END_DTMF_ONLY | AST_FLAG_EMULATE_DTMF) ||
+ if (ast_test_flag(ast_channel_flags(chan), AST_FLAG_DEFER_DTMF | AST_FLAG_END_DTMF_ONLY | AST_FLAG_EMULATE_DTMF) ||
(!ast_tvzero(*ast_channel_dtmf_tv(chan)) &&
ast_tvdiff_ms(ast_tvnow(), *ast_channel_dtmf_tv(chan)) < AST_MIN_DTMF_GAP) ) {
ast_log(LOG_DTMF, "DTMF begin ignored '%c' on %s\n", f->subclass.integer, ast_channel_name(chan));
f = &ast_null_frame;
} else {
struct timeval now = ast_tvnow();
- ast_set_flag(chan, AST_FLAG_IN_DTMF);
+ ast_set_flag(ast_channel_flags(chan), AST_FLAG_IN_DTMF);
ast_channel_dtmf_tv_set(chan, &now);
ast_log(LOG_DTMF, "DTMF begin passthrough '%c' on %s\n", f->subclass.integer, ast_channel_name(chan));
}
* is reached , because we want to make sure we pass at least one
* voice frame through before starting the next digit, to ensure a gap
* between DTMF digits. */
- if (ast_test_flag(chan, AST_FLAG_EMULATE_DTMF)) {
+ if (ast_test_flag(ast_channel_flags(chan), AST_FLAG_EMULATE_DTMF)) {
struct timeval now = ast_tvnow();
if (!ast_channel_emulate_dtmf_duration(chan)) {
- ast_clear_flag(chan, AST_FLAG_EMULATE_DTMF);
+ ast_clear_flag(ast_channel_flags(chan), AST_FLAG_EMULATE_DTMF);
ast_channel_dtmf_digit_to_emulate_set(chan, 0);
} else if (ast_tvdiff_ms(now, *ast_channel_dtmf_tv(chan)) >= ast_channel_emulate_dtmf_duration(chan)) {
ast_channel_emulate_dtmf_duration_set(chan, 0);
f->subclass.integer = ast_channel_dtmf_digit_to_emulate(chan);
f->len = ast_tvdiff_ms(now, *ast_channel_dtmf_tv(chan));
ast_channel_dtmf_tv_set(chan, &now);
- ast_clear_flag(chan, AST_FLAG_EMULATE_DTMF);
+ ast_clear_flag(ast_channel_flags(chan), AST_FLAG_EMULATE_DTMF);
ast_channel_dtmf_digit_to_emulate_set(chan, 0);
ast_log(LOG_DTMF, "DTMF end emulation of '%c' queued on %s\n", f->subclass.integer, ast_channel_name(chan));
if (ast_channel_audiohooks(chan)) {
* is reached , because we want to make sure we pass at least one
* voice frame through before starting the next digit, to ensure a gap
* between DTMF digits. */
- if (ast_test_flag(chan, AST_FLAG_EMULATE_DTMF) && !ast_channel_emulate_dtmf_duration(chan)) {
- ast_clear_flag(chan, AST_FLAG_EMULATE_DTMF);
+ if (ast_test_flag(ast_channel_flags(chan), AST_FLAG_EMULATE_DTMF) && !ast_channel_emulate_dtmf_duration(chan)) {
+ ast_clear_flag(ast_channel_flags(chan), AST_FLAG_EMULATE_DTMF);
ast_channel_dtmf_digit_to_emulate_set(chan, 0);
}
- if (dropaudio || ast_test_flag(chan, AST_FLAG_IN_DTMF)) {
+ if (dropaudio || ast_test_flag(ast_channel_flags(chan), AST_FLAG_IN_DTMF)) {
if (dropaudio)
ast_read_generator_actions(chan, f);
ast_frfree(f);
f = &ast_null_frame;
}
- if (ast_test_flag(chan, AST_FLAG_EMULATE_DTMF) && !ast_test_flag(chan, AST_FLAG_IN_DTMF)) {
+ if (ast_test_flag(ast_channel_flags(chan), AST_FLAG_EMULATE_DTMF) && !ast_test_flag(ast_channel_flags(chan), AST_FLAG_IN_DTMF)) {
struct timeval now = ast_tvnow();
if (ast_tvdiff_ms(now, *ast_channel_dtmf_tv(chan)) >= ast_channel_emulate_dtmf_duration(chan)) {
ast_channel_emulate_dtmf_duration_set(chan, 0);
ast_channel_lock(chan);
/* Don't bother if the channel is about to go away, anyway. */
- if (ast_test_flag(chan, AST_FLAG_ZOMBIE) || ast_check_hangup(chan)) {
+ if (ast_test_flag(ast_channel_flags(chan), AST_FLAG_ZOMBIE) || ast_check_hangup(chan)) {
res = -1;
goto indicate_cleanup;
}
ast_channel_lock(chan);
/* Stop if we're a zombie or need a soft hangup */
- if (ast_test_flag(chan, AST_FLAG_ZOMBIE) || ast_check_hangup(chan)) {
+ if (ast_test_flag(ast_channel_flags(chan), AST_FLAG_ZOMBIE) || ast_check_hangup(chan)) {
ast_channel_unlock(chan);
return -1;
}
} else if (ast_channel_tech(chan)->send_text) {
res = ast_channel_tech(chan)->send_text(chan, text);
}
- ast_clear_flag(chan, AST_FLAG_BLOCKING);
+ ast_clear_flag(ast_channel_flags(chan), AST_FLAG_BLOCKING);
ast_channel_unlock(chan);
return res;
}
usleep(1);
}
/* Stop if we're a zombie or need a soft hangup */
- if (ast_test_flag(chan, AST_FLAG_ZOMBIE) || ast_check_hangup(chan))
+ if (ast_test_flag(ast_channel_flags(chan), AST_FLAG_ZOMBIE) || ast_check_hangup(chan))
goto done;
/* Handle any pending masquerades */
}
if (ast_channel_generatordata(chan) && (!fr->src || strcasecmp(fr->src, "ast_prod"))) {
- if (ast_test_flag(chan, AST_FLAG_WRITE_INT)) {
+ if (ast_test_flag(ast_channel_flags(chan), AST_FLAG_WRITE_INT)) {
ast_deactivate_generator(chan);
} else {
if (fr->frametype == AST_FRAME_DTMF_END) {
/* There is a generator running while we're in the middle of a digit.
* It's probably inband DTMF, so go ahead and pass it so it can
* stop the generator */
- ast_clear_flag(chan, AST_FLAG_BLOCKING);
+ ast_clear_flag(ast_channel_flags(chan), AST_FLAG_BLOCKING);
ast_channel_unlock(chan);
res = ast_senddigit_end(chan, fr->subclass.integer, fr->len);
ast_channel_lock(chan);
f = fr;
}
send_dtmf_event(chan, "Sent", fr->subclass.integer, "Yes", "No");
- ast_clear_flag(chan, AST_FLAG_BLOCKING);
+ ast_clear_flag(ast_channel_flags(chan), AST_FLAG_BLOCKING);
ast_channel_unlock(chan);
res = ast_senddigit_begin(chan, fr->subclass.integer);
ast_channel_lock(chan);
}
}
send_dtmf_event(chan, "Sent", fr->subclass.integer, "No", "Yes");
- ast_clear_flag(chan, AST_FLAG_BLOCKING);
+ ast_clear_flag(ast_channel_flags(chan), AST_FLAG_BLOCKING);
ast_channel_unlock(chan);
res = ast_senddigit_end(chan, fr->subclass.integer, fr->len);
ast_channel_lock(chan);
if (f && f != fr)
ast_frfree(f);
- ast_clear_flag(chan, AST_FLAG_BLOCKING);
+ ast_clear_flag(ast_channel_flags(chan), AST_FLAG_BLOCKING);
/* Consider a write failure to force a soft hangup */
if (res < 0) {
*/
static void call_forward_inherit(struct ast_channel *new_chan, struct ast_channel *parent, struct ast_channel *orig)
{
- if (!ast_test_flag(parent, AST_FLAG_ZOMBIE) && !ast_check_hangup(parent)) {
+ if (!ast_test_flag(ast_channel_flags(parent), AST_FLAG_ZOMBIE) && !ast_check_hangup(parent)) {
struct ast_party_redirecting redirecting;
/*
int res = -1;
/* Stop if we're a zombie or need a soft hangup */
ast_channel_lock(chan);
- if (!ast_test_flag(chan, AST_FLAG_ZOMBIE) && !ast_check_hangup(chan)) {
+ if (!ast_test_flag(ast_channel_flags(chan), AST_FLAG_ZOMBIE) && !ast_check_hangup(chan)) {
if (ast_channel_cdr(chan)) {
ast_set_flag(ast_channel_cdr(chan), AST_CDR_FLAG_DIALED);
}
if (ast_channel_tech(chan)->call)
res = ast_channel_tech(chan)->call(chan, addr, timeout);
- ast_set_flag(chan, AST_FLAG_OUTGOING);
+ ast_set_flag(ast_channel_flags(chan), AST_FLAG_OUTGOING);
}
ast_channel_unlock(chan);
return res;
/* Stop if we're a zombie or need a soft hangup */
ast_channel_lock(chan);
- if (!ast_test_flag(chan, AST_FLAG_ZOMBIE) && !ast_check_hangup(chan)) {
+ if (!ast_test_flag(ast_channel_flags(chan), AST_FLAG_ZOMBIE) && !ast_check_hangup(chan)) {
if (ast_channel_tech(chan)->transfer) {
res = ast_channel_tech(chan)->transfer(chan, dest);
if (!res)
struct ast_silence_generator *silgen = NULL;
/* Stop if we're a zombie or need a soft hangup */
- if (ast_test_flag(c, AST_FLAG_ZOMBIE) || ast_check_hangup(c))
+ if (ast_test_flag(ast_channel_flags(c), AST_FLAG_ZOMBIE) || ast_check_hangup(c))
return -1;
if (!len)
return -1;
ast_channel_lock_both(original, clonechan);
- if (ast_test_flag(original, AST_FLAG_ZOMBIE)
- || ast_test_flag(clonechan, AST_FLAG_ZOMBIE)) {
+ if (ast_test_flag(ast_channel_flags(original), AST_FLAG_ZOMBIE)
+ || ast_test_flag(ast_channel_flags(clonechan), AST_FLAG_ZOMBIE)) {
/* Zombies! Run! */
ast_log(LOG_WARNING,
"Can't setup masquerade. One or both channels is dead. (%s <-- %s)\n",
* (i.e. chan_agent) and if so, we don't really want to
* masquerade it, but its proxy
*/
- if (original->_bridge
- && (original->_bridge != ast_bridged_channel(original))
- && (original->_bridge->_bridge != original)) {
- final_orig = original->_bridge;
+ if (ast_channel_internal_bridged_channel(original)
+ && (ast_channel_internal_bridged_channel(original) != ast_bridged_channel(original))
+ && (ast_channel_internal_bridged_channel(ast_channel_internal_bridged_channel(original)) != original)) {
+ final_orig = ast_channel_internal_bridged_channel(original);
}
- if (clonechan->_bridge
- && (clonechan->_bridge != ast_bridged_channel(clonechan))
- && (clonechan->_bridge->_bridge != clonechan)) {
- final_clone = clonechan->_bridge;
+ if (ast_channel_internal_bridged_channel(clonechan)
+ && (ast_channel_internal_bridged_channel(clonechan) != ast_bridged_channel(clonechan))
+ && (ast_channel_internal_bridged_channel(ast_channel_internal_bridged_channel(clonechan)) != clonechan)) {
+ final_clone = ast_channel_internal_bridged_channel(clonechan);
}
if (ast_channel_tech(final_clone)->get_base_channel
&& (base = ast_channel_tech(final_clone)->get_base_channel(final_clone))) {
original = final_orig;
clonechan = final_clone;
- if (ast_test_flag(original, AST_FLAG_ZOMBIE)
- || ast_test_flag(clonechan, AST_FLAG_ZOMBIE)) {
+ if (ast_test_flag(ast_channel_flags(original), AST_FLAG_ZOMBIE)
+ || ast_test_flag(ast_channel_flags(clonechan), AST_FLAG_ZOMBIE)) {
/* Zombies! Run! */
ast_log(LOG_WARNING,
"Can't setup masquerade. One or both channels is dead. (%s <-- %s)\n",
linkedid = oldest_linkedid(ast_channel_linkedid(chan), ast_channel_linkedid(peer));
linkedid = oldest_linkedid(linkedid, ast_channel_uniqueid(chan));
linkedid = oldest_linkedid(linkedid, ast_channel_uniqueid(peer));
- if (chan->_bridge) {
+ if (ast_channel_internal_bridged_channel(chan)) {
bridged = ast_bridged_channel(chan);
if (bridged != peer) {
linkedid = oldest_linkedid(linkedid, ast_channel_linkedid(bridged));
linkedid = oldest_linkedid(linkedid, ast_channel_uniqueid(bridged));
}
}
- if (peer->_bridge) {
+ if (ast_channel_internal_bridged_channel(peer)) {
bridged = ast_bridged_channel(peer);
if (bridged != chan) {
linkedid = oldest_linkedid(linkedid, ast_channel_linkedid(bridged));
ast_channel_change_linkedid(chan, linkedid);
ast_channel_change_linkedid(peer, linkedid);
- if (chan->_bridge) {
+ if (ast_channel_internal_bridged_channel(chan)) {
bridged = ast_bridged_channel(chan);
if (bridged != peer) {
ast_channel_change_linkedid(bridged, linkedid);
}
}
- if (peer->_bridge) {
+ if (ast_channel_internal_bridged_channel(peer)) {
bridged = ast_bridged_channel(peer);
if (bridged != chan) {
ast_channel_change_linkedid(bridged, linkedid);
/* XXX What about blocking, softhangup, blocker, and lock and blockproc? XXX */
/* Application and data remain the same */
/* Clone exception becomes real one, as with fdno */
- ast_set_flag(original, ast_test_flag(clonechan, AST_FLAG_EXCEPTION | AST_FLAG_OUTGOING));
+ ast_set_flag(ast_channel_flags(original), ast_test_flag(ast_channel_flags(clonechan), AST_FLAG_EXCEPTION | AST_FLAG_OUTGOING));
ast_channel_fdno_set(original, ast_channel_fdno(clonechan));
/* Schedule context remains the same */
/* Stream stuff stays the same */
/* copy over accuntcode and set peeraccount across the bridge */
ast_channel_accountcode_set(original, S_OR(ast_channel_accountcode(clonechan), ""));
- if (original->_bridge) {
- /* XXX - should we try to lock original->_bridge here? */
- ast_channel_peeraccount_set(original->_bridge, S_OR(ast_channel_accountcode(clonechan), ""));
+ if (ast_channel_internal_bridged_channel(original)) {
+ /* XXX - should we try to lock original's bridged channel here? */
+ ast_channel_peeraccount_set(ast_channel_internal_bridged_channel(original), S_OR(ast_channel_accountcode(clonechan), ""));
ast_cel_report_event(original, AST_CEL_BRIDGE_UPDATE, NULL, NULL, NULL);
}
/* Now, at this point, the "clone" channel is totally F'd up. We mark it as
a zombie so nothing tries to touch it. If it's already been marked as a
zombie, then free it now (since it already is considered invalid). */
- if (ast_test_flag(clonechan, AST_FLAG_ZOMBIE)) {
+ if (ast_test_flag(ast_channel_flags(clonechan), AST_FLAG_ZOMBIE)) {
ast_debug(1, "Destroying channel clone '%s'\n", ast_channel_name(clonechan));
ast_channel_unlock(clonechan);
ast_manager_event(clonechan, EVENT_FLAG_CALL, "Hangup",
clonechan = ast_channel_release(clonechan);
} else {
ast_debug(1, "Released clone lock on '%s'\n", ast_channel_name(clonechan));
- ast_set_flag(clonechan, AST_FLAG_ZOMBIE);
+ ast_set_flag(ast_channel_flags(clonechan), AST_FLAG_ZOMBIE);
ast_queue_frame(clonechan, &ast_null_frame);
}
/* Signal any blocker */
- if (ast_test_flag(original, AST_FLAG_BLOCKING))
- pthread_kill(original->blocker, SIGURG);
+ if (ast_test_flag(ast_channel_flags(original), AST_FLAG_BLOCKING))
+ pthread_kill(ast_channel_blocker(original), SIGURG);
ast_debug(1, "Done Masquerading %s (%d)\n", ast_channel_name(original), ast_channel_state(original));
if ((bridged = ast_bridged_channel(original))) {
struct ast_channel *ast_bridged_channel(struct ast_channel *chan)
{
struct ast_channel *bridged;
- bridged = chan->_bridge;
+ bridged = ast_channel_internal_bridged_channel(chan);
if (bridged && ast_channel_tech(bridged)->bridged_channel)
bridged = ast_channel_tech(bridged)->bridged_channel(chan, bridged);
return bridged;
if (ast_channel_softhangup_internal_flag(c1) & AST_SOFTHANGUP_UNBRIDGE) {
ast_channel_clear_softhangup(c1, AST_SOFTHANGUP_UNBRIDGE);
}
- c0->_bridge = c1;
- c1->_bridge = c0;
+ ast_channel_internal_bridged_channel_set(c0, c1);
+ ast_channel_internal_bridged_channel_set(c1, c0);
}
continue;
}
*fo = NULL;
- if (c0->_bridge) {
+ if (ast_channel_internal_bridged_channel(c0)) {
ast_log(LOG_WARNING, "%s is already in a bridge with %s\n",
- ast_channel_name(c0), ast_channel_name(c0->_bridge));
+ ast_channel_name(c0), ast_channel_name(ast_channel_internal_bridged_channel(c0)));
return -1;
}
- if (c1->_bridge) {
+ if (ast_channel_internal_bridged_channel(c1)) {
ast_log(LOG_WARNING, "%s is already in a bridge with %s\n",
- ast_channel_name(c1), ast_channel_name(c1->_bridge));
+ ast_channel_name(c1), ast_channel_name(ast_channel_internal_bridged_channel(c1)));
return -1;
}
/* Stop if we're a zombie or need a soft hangup */
- if (ast_test_flag(c0, AST_FLAG_ZOMBIE) || ast_check_hangup_locked(c0) ||
- ast_test_flag(c1, AST_FLAG_ZOMBIE) || ast_check_hangup_locked(c1))
+ if (ast_test_flag(ast_channel_flags(c0), AST_FLAG_ZOMBIE) || ast_check_hangup_locked(c0) ||
+ ast_test_flag(ast_channel_flags(c1), AST_FLAG_ZOMBIE) || ast_check_hangup_locked(c1))
return -1;
o0nativeformats = ast_format_cap_dup(ast_channel_nativeformats(c0));
}
/* Keep track of bridge */
- c0->_bridge = c1;
- c1->_bridge = c0;
+ ast_channel_internal_bridged_channel_set(c0, c1);
+ ast_channel_internal_bridged_channel_set(c1, c0);
ast_set_owners_and_peers(c0, c1);
}
if (!ast_channel_tech(c0)->send_digit_begin)
- ast_set_flag(c1, AST_FLAG_END_DTMF_ONLY);
+ ast_set_flag(ast_channel_flags(c1), AST_FLAG_END_DTMF_ONLY);
if (!ast_channel_tech(c1)->send_digit_begin)
- ast_set_flag(c0, AST_FLAG_END_DTMF_ONLY);
+ ast_set_flag(ast_channel_flags(c0), AST_FLAG_END_DTMF_ONLY);
manager_bridge_event(1, 1, c0, c1);
/* Before we enter in and bridge these two together tell them both the source of audio has changed */
if (ast_channel_softhangup_internal_flag(c1) & AST_SOFTHANGUP_UNBRIDGE) {
ast_channel_clear_softhangup(c1, AST_SOFTHANGUP_UNBRIDGE);
}
- c0->_bridge = c1;
- c1->_bridge = c0;
+ ast_channel_internal_bridged_channel_set(c0, c1);
+ ast_channel_internal_bridged_channel_set(c1, c0);
ast_debug(1, "Unbridge signal received. Ending native bridge.\n");
continue;
}
/* Stop if we're a zombie or need a soft hangup */
- if (ast_test_flag(c0, AST_FLAG_ZOMBIE) || ast_check_hangup_locked(c0) ||
- ast_test_flag(c1, AST_FLAG_ZOMBIE) || ast_check_hangup_locked(c1)) {
+ if (ast_test_flag(ast_channel_flags(c0), AST_FLAG_ZOMBIE) || ast_check_hangup_locked(c0) ||
+ ast_test_flag(ast_channel_flags(c1), AST_FLAG_ZOMBIE) || ast_check_hangup_locked(c1)) {
*fo = NULL;
res = 0;
ast_debug(1, "Bridge stops because we're zombie or need a soft hangup: c0=%s, c1=%s, flags: %s,%s,%s,%s\n",
ast_channel_name(c0), ast_channel_name(c1),
- ast_test_flag(c0, AST_FLAG_ZOMBIE) ? "Yes" : "No",
+ ast_test_flag(ast_channel_flags(c0), AST_FLAG_ZOMBIE) ? "Yes" : "No",
ast_check_hangup(c0) ? "Yes" : "No",
- ast_test_flag(c1, AST_FLAG_ZOMBIE) ? "Yes" : "No",
+ ast_test_flag(ast_channel_flags(c1), AST_FLAG_ZOMBIE) ? "Yes" : "No",
ast_check_hangup(c1) ? "Yes" : "No");
break;
}
!ast_channel_masq(c0) && !ast_channel_masqr(c0) && !ast_channel_masq(c1) && !ast_channel_masqr(c1)) {
int timeoutms = to - 1000 > 0 ? to - 1000 : to;
/* Looks like they share a bridge method and nothing else is in the way */
- ast_set_flag(c0, AST_FLAG_NBRIDGE);
- ast_set_flag(c1, AST_FLAG_NBRIDGE);
+ ast_set_flag(ast_channel_flags(c0), AST_FLAG_NBRIDGE);
+ ast_set_flag(ast_channel_flags(c1), AST_FLAG_NBRIDGE);
if ((res = ast_channel_tech(c0)->bridge(c0, c1, config->flags, fo, rc, timeoutms)) == AST_BRIDGE_COMPLETE) {
manager_bridge_event(0, 1, c0, c1);
ast_debug(1, "Returning from native bridge, channels: %s, %s\n", ast_channel_name(c0), ast_channel_name(c1));
- ast_clear_flag(c0, AST_FLAG_NBRIDGE);
- ast_clear_flag(c1, AST_FLAG_NBRIDGE);
+ ast_clear_flag(ast_channel_flags(c0), AST_FLAG_NBRIDGE);
+ ast_clear_flag(ast_channel_flags(c1), AST_FLAG_NBRIDGE);
if ((ast_channel_softhangup_internal_flag(c0) | ast_channel_softhangup_internal_flag(c1)) & AST_SOFTHANGUP_UNBRIDGE) {/* Bit operators are intentional. */
continue;
}
- c0->_bridge = NULL;
- c1->_bridge = NULL;
+ ast_channel_internal_bridged_channel_set(c0, NULL);
+ ast_channel_internal_bridged_channel_set(c1, NULL);
ast_format_cap_destroy(o0nativeformats);
ast_format_cap_destroy(o1nativeformats);
return res;
} else {
- ast_clear_flag(c0, AST_FLAG_NBRIDGE);
- ast_clear_flag(c1, AST_FLAG_NBRIDGE);
+ ast_clear_flag(ast_channel_flags(c0), AST_FLAG_NBRIDGE);
+ ast_clear_flag(ast_channel_flags(c1), AST_FLAG_NBRIDGE);
}
switch (res) {
case AST_BRIDGE_RETRY:
}
}
- ast_clear_flag(c0, AST_FLAG_END_DTMF_ONLY);
- ast_clear_flag(c1, AST_FLAG_END_DTMF_ONLY);
+ ast_clear_flag(ast_channel_flags(c0), AST_FLAG_END_DTMF_ONLY);
+ ast_clear_flag(ast_channel_flags(c1), AST_FLAG_END_DTMF_ONLY);
/* Now that we have broken the bridge the source will change yet again */
ast_indicate(c0, AST_CONTROL_SRCUPDATE);
ast_indicate(c1, AST_CONTROL_SRCUPDATE);
- c0->_bridge = NULL;
- c1->_bridge = NULL;
+ ast_channel_internal_bridged_channel_set(c0, NULL);
+ ast_channel_internal_bridged_channel_set(c1, NULL);
manager_bridge_event(0, 1, c0, c1);
ast_debug(1, "Bridge stops bridging channels %s and %s\n", ast_channel_name(c0), ast_channel_name(c1));
ts->modulate = 0;
}
/* Let interrupts interrupt :) */
- ast_set_flag(chan, AST_FLAG_WRITE_INT);
+ ast_set_flag(ast_channel_flags(chan), AST_FLAG_WRITE_INT);
return ts;
}
#include "asterisk/stringfields.h"
#include "asterisk/data.h"
#include "asterisk/indications.h"
+#include "asterisk/channel_internal.h"
+
+/*!
+ * \brief Main Channel structure associated with a channel.
+ *
+ * \note XXX It is important to remember to increment .cleancount each time
+ * this structure is changed. XXX
+ *
+ * \note When adding fields to this structure, it is important to add the field
+ * 'in position' with like-aligned fields, so as to keep the compiler from
+ * having to add padding to align fields. The structure's fields are sorted
+ * in this order: pointers, structures, long, int/enum, short, char. This
+ * is especially important on 64-bit architectures, where mixing 4-byte
+ * and 8-byte fields causes 4 bytes of padding to be added before many
+ * 8-byte fields.
+ */
+struct ast_channel {
+ const struct ast_channel_tech *tech; /*!< Technology (point to channel driver) */
+ void *tech_pvt; /*!< Private data used by the technology driver */
+ void *music_state; /*!< Music State*/
+ void *generatordata; /*!< Current generator data if there is any */
+ struct ast_generator *generator; /*!< Current active data generator */
+ struct ast_channel * bridged_channel; /*!< Who are we bridged to, if we're bridged.
+ * Who is proxying for us, if we are proxied (i.e. chan_agent).
+ * Do not access directly, use ast_bridged_channel(chan) */
+ struct ast_channel *masq; /*!< Channel that will masquerade as us */
+ struct ast_channel *masqr; /*!< Who we are masquerading as */
+ const char *blockproc; /*!< Procedure causing blocking */
+ const char *appl; /*!< Current application */
+ const char *data; /*!< Data passed to current application */
+ struct ast_sched_context *sched; /*!< Schedule context */
+ struct ast_filestream *stream; /*!< Stream itself. */
+ struct ast_filestream *vstream; /*!< Video Stream itself. */
+ ast_timing_func_t timingfunc;
+ void *timingdata;
+ struct ast_pbx *pbx; /*!< PBX private structure for this channel */
+ struct ast_trans_pvt *writetrans; /*!< Write translation path */
+ struct ast_trans_pvt *readtrans; /*!< Read translation path */
+ struct ast_audiohook_list *audiohooks;
+ struct ast_framehook_list *framehooks;
+ struct ast_cdr *cdr; /*!< Call Detail Record */
+ struct ast_tone_zone *zone; /*!< Tone zone as set in indications.conf or
+ * in the CHANNEL dialplan function */
+ struct ast_channel_monitor *monitor; /*!< Channel monitoring */
+#ifdef HAVE_EPOLL
+ struct ast_epoll_data *epfd_data[AST_MAX_FDS];
+#endif
+
+ AST_DECLARE_STRING_FIELDS(
+ AST_STRING_FIELD(name); /*!< ASCII unique channel name */
+ AST_STRING_FIELD(language); /*!< Language requested for voice prompts */
+ AST_STRING_FIELD(musicclass); /*!< Default music class */
+ AST_STRING_FIELD(accountcode); /*!< Account code for billing */
+ AST_STRING_FIELD(peeraccount); /*!< Peer account code for billing */
+ AST_STRING_FIELD(userfield); /*!< Userfield for CEL billing */
+ AST_STRING_FIELD(call_forward); /*!< Where to forward to if asked to dial on this interface */
+ AST_STRING_FIELD(uniqueid); /*!< Unique Channel Identifier */
+ AST_STRING_FIELD(linkedid); /*!< Linked Channel Identifier -- gets propagated by linkage */
+ AST_STRING_FIELD(parkinglot); /*! Default parking lot, if empty, default parking lot */
+ AST_STRING_FIELD(hangupsource); /*! Who is responsible for hanging up this channel */
+ AST_STRING_FIELD(dialcontext); /*!< Dial: Extension context that we were called from */
+ );
+
+ struct timeval whentohangup; /*!< Non-zero, set to actual time when channel is to be hung up */
+ pthread_t blocker; /*!< If anyone is blocking, this is them */
+
+ /*!
+ * \brief Dialed/Called information.
+ * \note Set on incoming channels to indicate the originally dialed party.
+ * \note Dialed Number Identifier (DNID)
+ */
+ struct ast_party_dialed dialed;
+
+ /*!
+ * \brief Channel Caller ID information.
+ * \note The caller id information is the caller id of this
+ * channel when it is used to initiate a call.
+ */
+ struct ast_party_caller caller;
+
+ /*!
+ * \brief Channel Connected Line ID information.
+ * \note The connected line information identifies the channel
+ * connected/bridged to this channel.
+ */
+ struct ast_party_connected_line connected;
+
+ /*! \brief Redirecting/Diversion information */
+ struct ast_party_redirecting redirecting;
+
+ struct ast_frame dtmff; /*!< DTMF frame */
+ struct varshead varshead; /*!< A linked list for channel variables. See \ref AstChanVar */
+ ast_group_t callgroup; /*!< Call group for call pickups */
+ ast_group_t pickupgroup; /*!< Pickup group - which calls groups can be picked up? */
+ struct ast_readq_list readq;
+ struct ast_jb jb; /*!< The jitterbuffer state */
+ struct timeval dtmf_tv; /*!< The time that an in process digit began, or the last digit ended */
+ struct ast_datastore_list datastores; /*!< Data stores on the channel */
+ struct ast_autochan_list autochans; /*!< Autochans on the channel */
+ unsigned long insmpl; /*!< Track the read/written samples for monitor use */
+ unsigned long outsmpl; /*!< Track the read/written samples for monitor use */
+
+ int fds[AST_MAX_FDS]; /*!< File descriptors for channel -- Drivers will poll on
+ * these file descriptors, so at least one must be non -1.
+ * See \arg \ref AstFileDesc */
+ int softhangup; /*!< Whether or not we have been hung up... Do not set this value
+ * directly, use ast_softhangup() */
+ int fdno; /*!< Which fd had an event detected on */
+ int streamid; /*!< For streaming playback, the schedule ID */
+ int vstreamid; /*!< For streaming video playback, the schedule ID */
+ struct ast_format oldwriteformat; /*!< Original writer format */
+ int timingfd; /*!< Timing fd */
+ enum ast_channel_state state; /*!< State of line -- Don't write directly, use ast_setstate() */
+ int rings; /*!< Number of rings so far */
+ int priority; /*!< Dialplan: Current extension priority */
+ int macropriority; /*!< Macro: Current non-macro priority. See app_macro.c */
+ int amaflags; /*!< Set BEFORE PBX is started to determine AMA flags */
+ enum ast_channel_adsicpe adsicpe; /*!< Whether or not ADSI is detected on CPE */
+ unsigned int fin; /*!< Frames in counters. The high bit is a debug mask, so
+ * the counter is only in the remaining bits */
+ unsigned int fout; /*!< Frames out counters. The high bit is a debug mask, so
+ * the counter is only in the remaining bits */
+ int hangupcause; /*!< Why is the channel hanged up. See causes.h */
+ unsigned int finalized:1; /*!< Whether or not the channel has been successfully allocated */
+ struct ast_flags flags; /*!< channel flags of AST_FLAG_ type */
+ int alertpipe[2];
+ struct ast_format_cap *nativeformats; /*!< Kinds of data this channel can natively handle */
+ struct ast_format readformat; /*!< Requested read format (after translation) */
+ struct ast_format writeformat; /*!< Requested write format (after translation) */
+ struct ast_format rawreadformat; /*!< Raw read format (before translation) */
+ struct ast_format rawwriteformat; /*!< Raw write format (before translation) */
+ unsigned int emulate_dtmf_duration; /*!< Number of ms left to emulate DTMF for */
+#ifdef HAVE_EPOLL
+ int epfd;
+#endif
+ int visible_indication; /*!< Indication currently playing on the channel */
+
+ unsigned short transfercapability; /*!< ISDN Transfer Capability - AST_FLAG_DIGITAL is not enough */
+
+ struct ast_bridge *bridge; /*!< Bridge this channel is participating in */
+ struct ast_timer *timer; /*!< timer object that provided timingfd */
+
+ char context[AST_MAX_CONTEXT]; /*!< Dialplan: Current extension context */
+ char exten[AST_MAX_EXTENSION]; /*!< Dialplan: Current extension number */
+ char macrocontext[AST_MAX_CONTEXT]; /*!< Macro: Current non-macro context. See app_macro.c */
+ char macroexten[AST_MAX_EXTENSION]; /*!< Macro: Current non-macro extension. See app_macro.c */
+ char dtmf_digit_to_emulate; /*!< Digit being emulated */
+};
/* AST_DATA definitions, which will probably have to be re-thought since the channel will be opaque */
#endif
#define DATA_EXPORT_CHANNEL(MEMBER) \
- MEMBER(ast_channel, __do_not_use_blockproc, AST_DATA_STRING) \
- MEMBER(ast_channel, __do_not_use_appl, AST_DATA_STRING) \
- MEMBER(ast_channel, __do_not_use_data, AST_DATA_STRING) \
- MEMBER(ast_channel, __do_not_use_name, AST_DATA_STRING) \
- MEMBER(ast_channel, __do_not_use_language, AST_DATA_STRING) \
- MEMBER(ast_channel, __do_not_use_musicclass, AST_DATA_STRING) \
- MEMBER(ast_channel, __do_not_use_accountcode, AST_DATA_STRING) \
- MEMBER(ast_channel, __do_not_use_peeraccount, AST_DATA_STRING) \
- MEMBER(ast_channel, __do_not_use_userfield, AST_DATA_STRING) \
- MEMBER(ast_channel, __do_not_use_call_forward, AST_DATA_STRING) \
- MEMBER(ast_channel, __do_not_use_uniqueid, AST_DATA_STRING) \
- MEMBER(ast_channel, __do_not_use_linkedid, AST_DATA_STRING) \
- MEMBER(ast_channel, __do_not_use_parkinglot, AST_DATA_STRING) \
- MEMBER(ast_channel, __do_not_use_hangupsource, AST_DATA_STRING) \
- MEMBER(ast_channel, __do_not_use_dialcontext, AST_DATA_STRING) \
- MEMBER(ast_channel, __do_not_use_rings, AST_DATA_INTEGER) \
- MEMBER(ast_channel, __do_not_use_priority, AST_DATA_INTEGER) \
- MEMBER(ast_channel, __do_not_use_macropriority, AST_DATA_INTEGER) \
- MEMBER(ast_channel, __do_not_use_adsicpe, AST_DATA_INTEGER) \
- MEMBER(ast_channel, __do_not_use_fin, AST_DATA_UNSIGNED_INTEGER) \
- MEMBER(ast_channel, __do_not_use_fout, AST_DATA_UNSIGNED_INTEGER) \
- MEMBER(ast_channel, __do_not_use_emulate_dtmf_duration, AST_DATA_UNSIGNED_INTEGER) \
- MEMBER(ast_channel, __do_not_use_visible_indication, AST_DATA_INTEGER) \
- MEMBER(ast_channel, __do_not_use_context, AST_DATA_STRING) \
- MEMBER(ast_channel, __do_not_use_exten, AST_DATA_STRING) \
- MEMBER(ast_channel, __do_not_use_macrocontext, AST_DATA_STRING) \
- MEMBER(ast_channel, __do_not_use_macroexten, AST_DATA_STRING)
+ MEMBER(ast_channel, blockproc, AST_DATA_STRING) \
+ MEMBER(ast_channel, appl, AST_DATA_STRING) \
+ MEMBER(ast_channel, data, AST_DATA_STRING) \
+ MEMBER(ast_channel, name, AST_DATA_STRING) \
+ MEMBER(ast_channel, language, AST_DATA_STRING) \
+ MEMBER(ast_channel, musicclass, AST_DATA_STRING) \
+ MEMBER(ast_channel, accountcode, AST_DATA_STRING) \
+ MEMBER(ast_channel, peeraccount, AST_DATA_STRING) \
+ MEMBER(ast_channel, userfield, AST_DATA_STRING) \
+ MEMBER(ast_channel, call_forward, AST_DATA_STRING) \
+ MEMBER(ast_channel, uniqueid, AST_DATA_STRING) \
+ MEMBER(ast_channel, linkedid, AST_DATA_STRING) \
+ MEMBER(ast_channel, parkinglot, AST_DATA_STRING) \
+ MEMBER(ast_channel, hangupsource, AST_DATA_STRING) \
+ MEMBER(ast_channel, dialcontext, AST_DATA_STRING) \
+ MEMBER(ast_channel, rings, AST_DATA_INTEGER) \
+ MEMBER(ast_channel, priority, AST_DATA_INTEGER) \
+ MEMBER(ast_channel, macropriority, AST_DATA_INTEGER) \
+ MEMBER(ast_channel, adsicpe, AST_DATA_INTEGER) \
+ MEMBER(ast_channel, fin, AST_DATA_UNSIGNED_INTEGER) \
+ MEMBER(ast_channel, fout, AST_DATA_UNSIGNED_INTEGER) \
+ MEMBER(ast_channel, emulate_dtmf_duration, AST_DATA_UNSIGNED_INTEGER) \
+ MEMBER(ast_channel, visible_indication, AST_DATA_INTEGER) \
+ MEMBER(ast_channel, context, AST_DATA_STRING) \
+ MEMBER(ast_channel, exten, AST_DATA_STRING) \
+ MEMBER(ast_channel, macrocontext, AST_DATA_STRING) \
+ MEMBER(ast_channel, macroexten, AST_DATA_STRING)
AST_DATA_STRUCTURE(ast_channel, DATA_EXPORT_CHANNEL);
static void channel_data_add_flags(struct ast_data *tree,
struct ast_channel *chan)
{
- ast_data_add_bool(tree, "DEFER_DTMF", ast_test_flag(chan, AST_FLAG_DEFER_DTMF));
- ast_data_add_bool(tree, "WRITE_INT", ast_test_flag(chan, AST_FLAG_WRITE_INT));
- ast_data_add_bool(tree, "BLOCKING", ast_test_flag(chan, AST_FLAG_BLOCKING));
- ast_data_add_bool(tree, "ZOMBIE", ast_test_flag(chan, AST_FLAG_ZOMBIE));
- ast_data_add_bool(tree, "EXCEPTION", ast_test_flag(chan, AST_FLAG_EXCEPTION));
- ast_data_add_bool(tree, "MOH", ast_test_flag(chan, AST_FLAG_MOH));
- ast_data_add_bool(tree, "SPYING", ast_test_flag(chan, AST_FLAG_SPYING));
- ast_data_add_bool(tree, "NBRIDGE", ast_test_flag(chan, AST_FLAG_NBRIDGE));
- ast_data_add_bool(tree, "IN_AUTOLOOP", ast_test_flag(chan, AST_FLAG_IN_AUTOLOOP));
- ast_data_add_bool(tree, "OUTGOING", ast_test_flag(chan, AST_FLAG_OUTGOING));
- ast_data_add_bool(tree, "IN_DTMF", ast_test_flag(chan, AST_FLAG_IN_DTMF));
- ast_data_add_bool(tree, "EMULATE_DTMF", ast_test_flag(chan, AST_FLAG_EMULATE_DTMF));
- ast_data_add_bool(tree, "END_DTMF_ONLY", ast_test_flag(chan, AST_FLAG_END_DTMF_ONLY));
- ast_data_add_bool(tree, "ANSWERED_ELSEWHERE", ast_test_flag(chan, AST_FLAG_ANSWERED_ELSEWHERE));
- ast_data_add_bool(tree, "MASQ_NOSTREAM", ast_test_flag(chan, AST_FLAG_MASQ_NOSTREAM));
- ast_data_add_bool(tree, "BRIDGE_HANGUP_RUN", ast_test_flag(chan, AST_FLAG_BRIDGE_HANGUP_RUN));
- ast_data_add_bool(tree, "BRIDGE_HANGUP_DONT", ast_test_flag(chan, AST_FLAG_BRIDGE_HANGUP_DONT));
- ast_data_add_bool(tree, "DISABLE_WORKAROUNDS", ast_test_flag(chan, AST_FLAG_DISABLE_WORKAROUNDS));
+ ast_data_add_bool(tree, "DEFER_DTMF", ast_test_flag(ast_channel_flags(chan), AST_FLAG_DEFER_DTMF));
+ ast_data_add_bool(tree, "WRITE_INT", ast_test_flag(ast_channel_flags(chan), AST_FLAG_WRITE_INT));
+ ast_data_add_bool(tree, "BLOCKING", ast_test_flag(ast_channel_flags(chan), AST_FLAG_BLOCKING));
+ ast_data_add_bool(tree, "ZOMBIE", ast_test_flag(ast_channel_flags(chan), AST_FLAG_ZOMBIE));
+ ast_data_add_bool(tree, "EXCEPTION", ast_test_flag(ast_channel_flags(chan), AST_FLAG_EXCEPTION));
+ ast_data_add_bool(tree, "MOH", ast_test_flag(ast_channel_flags(chan), AST_FLAG_MOH));
+ ast_data_add_bool(tree, "SPYING", ast_test_flag(ast_channel_flags(chan), AST_FLAG_SPYING));
+ ast_data_add_bool(tree, "NBRIDGE", ast_test_flag(ast_channel_flags(chan), AST_FLAG_NBRIDGE));
+ ast_data_add_bool(tree, "IN_AUTOLOOP", ast_test_flag(ast_channel_flags(chan), AST_FLAG_IN_AUTOLOOP));
+ ast_data_add_bool(tree, "OUTGOING", ast_test_flag(ast_channel_flags(chan), AST_FLAG_OUTGOING));
+ ast_data_add_bool(tree, "IN_DTMF", ast_test_flag(ast_channel_flags(chan), AST_FLAG_IN_DTMF));
+ ast_data_add_bool(tree, "EMULATE_DTMF", ast_test_flag(ast_channel_flags(chan), AST_FLAG_EMULATE_DTMF));
+ ast_data_add_bool(tree, "END_DTMF_ONLY", ast_test_flag(ast_channel_flags(chan), AST_FLAG_END_DTMF_ONLY));
+ ast_data_add_bool(tree, "ANSWERED_ELSEWHERE", ast_test_flag(ast_channel_flags(chan), AST_FLAG_ANSWERED_ELSEWHERE));
+ ast_data_add_bool(tree, "MASQ_NOSTREAM", ast_test_flag(ast_channel_flags(chan), AST_FLAG_MASQ_NOSTREAM));
+ ast_data_add_bool(tree, "BRIDGE_HANGUP_RUN", ast_test_flag(ast_channel_flags(chan), AST_FLAG_BRIDGE_HANGUP_RUN));
+ ast_data_add_bool(tree, "BRIDGE_HANGUP_DONT", ast_test_flag(ast_channel_flags(chan), AST_FLAG_BRIDGE_HANGUP_DONT));
+ ast_data_add_bool(tree, "DISABLE_WORKAROUNDS", ast_test_flag(ast_channel_flags(chan), AST_FLAG_DISABLE_WORKAROUNDS));
}
int ast_channel_data_add_structure(struct ast_data *tree,
#define DEFINE_STRINGFIELD_SETTERS_FOR(field) \
void ast_channel_##field##_set(struct ast_channel *chan, const char *value) \
{ \
- ast_string_field_set(chan, __do_not_use_##field, value); \
+ ast_string_field_set(chan, field, value); \
} \
\
void ast_channel_##field##_build_va(struct ast_channel *chan, const char *fmt, va_list ap) \
{ \
- ast_string_field_build_va(chan, __do_not_use_##field, fmt, ap); \
+ ast_string_field_build_va(chan, field, fmt, ap); \
} \
void ast_channel_##field##_build(struct ast_channel *chan, const char *fmt, ...) \
{ \
va_end(ap); \
}
-DEFINE_STRINGFIELD_SETTERS_FOR(name)
-DEFINE_STRINGFIELD_SETTERS_FOR(language)
-DEFINE_STRINGFIELD_SETTERS_FOR(musicclass)
-DEFINE_STRINGFIELD_SETTERS_FOR(accountcode)
-DEFINE_STRINGFIELD_SETTERS_FOR(peeraccount)
-DEFINE_STRINGFIELD_SETTERS_FOR(userfield)
-DEFINE_STRINGFIELD_SETTERS_FOR(call_forward)
-DEFINE_STRINGFIELD_SETTERS_FOR(uniqueid)
-DEFINE_STRINGFIELD_SETTERS_FOR(linkedid)
-DEFINE_STRINGFIELD_SETTERS_FOR(parkinglot)
-DEFINE_STRINGFIELD_SETTERS_FOR(hangupsource)
-DEFINE_STRINGFIELD_SETTERS_FOR(dialcontext)
+DEFINE_STRINGFIELD_SETTERS_FOR(name);
+DEFINE_STRINGFIELD_SETTERS_FOR(language);
+DEFINE_STRINGFIELD_SETTERS_FOR(musicclass);
+DEFINE_STRINGFIELD_SETTERS_FOR(accountcode);
+DEFINE_STRINGFIELD_SETTERS_FOR(peeraccount);
+DEFINE_STRINGFIELD_SETTERS_FOR(userfield);
+DEFINE_STRINGFIELD_SETTERS_FOR(call_forward);
+DEFINE_STRINGFIELD_SETTERS_FOR(uniqueid);
+DEFINE_STRINGFIELD_SETTERS_FOR(linkedid);
+DEFINE_STRINGFIELD_SETTERS_FOR(parkinglot);
+DEFINE_STRINGFIELD_SETTERS_FOR(hangupsource);
+DEFINE_STRINGFIELD_SETTERS_FOR(dialcontext);
#define DEFINE_STRINGFIELD_GETTER_FOR(field) const char *ast_channel_##field(const struct ast_channel *chan) \
{ \
- return chan->__do_not_use_##field; \
-}
-
-DEFINE_STRINGFIELD_GETTER_FOR(name)
-DEFINE_STRINGFIELD_GETTER_FOR(language)
-DEFINE_STRINGFIELD_GETTER_FOR(musicclass)
-DEFINE_STRINGFIELD_GETTER_FOR(accountcode)
-DEFINE_STRINGFIELD_GETTER_FOR(peeraccount)
-DEFINE_STRINGFIELD_GETTER_FOR(userfield)
-DEFINE_STRINGFIELD_GETTER_FOR(call_forward)
-DEFINE_STRINGFIELD_GETTER_FOR(uniqueid)
-DEFINE_STRINGFIELD_GETTER_FOR(linkedid)
-DEFINE_STRINGFIELD_GETTER_FOR(parkinglot)
-DEFINE_STRINGFIELD_GETTER_FOR(hangupsource)
-DEFINE_STRINGFIELD_GETTER_FOR(dialcontext)
+ return chan->field; \
+}
+
+DEFINE_STRINGFIELD_GETTER_FOR(name);
+DEFINE_STRINGFIELD_GETTER_FOR(language);
+DEFINE_STRINGFIELD_GETTER_FOR(musicclass);
+DEFINE_STRINGFIELD_GETTER_FOR(accountcode);
+DEFINE_STRINGFIELD_GETTER_FOR(peeraccount);
+DEFINE_STRINGFIELD_GETTER_FOR(userfield);
+DEFINE_STRINGFIELD_GETTER_FOR(call_forward);
+DEFINE_STRINGFIELD_GETTER_FOR(uniqueid);
+DEFINE_STRINGFIELD_GETTER_FOR(linkedid);
+DEFINE_STRINGFIELD_GETTER_FOR(parkinglot);
+DEFINE_STRINGFIELD_GETTER_FOR(hangupsource);
+DEFINE_STRINGFIELD_GETTER_FOR(dialcontext);
const char *ast_channel_appl(const struct ast_channel *chan)
{
- return chan->__do_not_use_appl;
+ return chan->appl;
}
void ast_channel_appl_set(struct ast_channel *chan, const char *value)
{
- chan->__do_not_use_appl = value;
+ chan->appl = value;
}
const char *ast_channel_blockproc(const struct ast_channel *chan)
{
- return chan->__do_not_use_blockproc;
+ return chan->blockproc;
}
void ast_channel_blockproc_set(struct ast_channel *chan, const char *value)
{
- chan->__do_not_use_blockproc = value;
+ chan->blockproc = value;
}
const char *ast_channel_data(const struct ast_channel *chan)
{
- return chan->__do_not_use_data;
+ return chan->data;
}
void ast_channel_data_set(struct ast_channel *chan, const char *value)
{
- chan->__do_not_use_data = value;
+ chan->data = value;
}
-
const char *ast_channel_context(const struct ast_channel *chan)
{
- return chan->__do_not_use_context;
+ return chan->context;
}
void ast_channel_context_set(struct ast_channel *chan, const char *value)
{
- ast_copy_string(chan->__do_not_use_context, value, sizeof(chan->__do_not_use_context));
+ ast_copy_string(chan->context, value, sizeof(chan->context));
}
const char *ast_channel_exten(const struct ast_channel *chan)
{
- return chan->__do_not_use_exten;
+ return chan->exten;
}
void ast_channel_exten_set(struct ast_channel *chan, const char *value)
{
- ast_copy_string(chan->__do_not_use_exten, value, sizeof(chan->__do_not_use_exten));
+ ast_copy_string(chan->exten, value, sizeof(chan->exten));
}
const char *ast_channel_macrocontext(const struct ast_channel *chan)
{
- return chan->__do_not_use_macrocontext;
+ return chan->macrocontext;
}
void ast_channel_macrocontext_set(struct ast_channel *chan, const char *value)
{
- ast_copy_string(chan->__do_not_use_macrocontext, value, sizeof(chan->__do_not_use_macrocontext));
+ ast_copy_string(chan->macrocontext, value, sizeof(chan->macrocontext));
}
const char *ast_channel_macroexten(const struct ast_channel *chan)
{
- return chan->__do_not_use_macroexten;
+ return chan->macroexten;
}
void ast_channel_macroexten_set(struct ast_channel *chan, const char *value)
{
- ast_copy_string(chan->__do_not_use_macroexten, value, sizeof(chan->__do_not_use_macroexten));
+ ast_copy_string(chan->macroexten, value, sizeof(chan->macroexten));
}
-
char ast_channel_dtmf_digit_to_emulate(const struct ast_channel *chan)
{
- return chan->__do_not_use_dtmf_digit_to_emulate;
+ return chan->dtmf_digit_to_emulate;
}
void ast_channel_dtmf_digit_to_emulate_set(struct ast_channel *chan, char value)
{
- chan->__do_not_use_dtmf_digit_to_emulate = value;
+ chan->dtmf_digit_to_emulate = value;
}
int ast_channel_amaflags(const struct ast_channel *chan)
{
- return chan->__do_not_use_amaflags;
+ return chan->amaflags;
}
void ast_channel_amaflags_set(struct ast_channel *chan, int value)
{
- chan->__do_not_use_amaflags = value;
+ chan->amaflags = value;
}
#ifdef HAVE_EPOLL
int ast_channel_epfd(const struct ast_channel *chan)
{
- return chan->__do_not_use_epfd;
+ return chan->epfd;
}
void ast_channel_epfd_set(struct ast_channel *chan, int value)
{
- chan->__do_not_use_epfd = value;
+ chan->epfd = value;
}
#endif
int ast_channel_fdno(const struct ast_channel *chan)
{
- return chan->__do_not_use_fdno;
+ return chan->fdno;
}
void ast_channel_fdno_set(struct ast_channel *chan, int value)
{
- chan->__do_not_use_fdno = value;
+ chan->fdno = value;
}
int ast_channel_hangupcause(const struct ast_channel *chan)
{
- return chan->__do_not_use_hangupcause;
+ return chan->hangupcause;
}
void ast_channel_hangupcause_set(struct ast_channel *chan, int value)
{
- chan->__do_not_use_hangupcause = value;
+ chan->hangupcause = value;
}
int ast_channel_macropriority(const struct ast_channel *chan)
{
- return chan->__do_not_use_macropriority;
+ return chan->macropriority;
}
void ast_channel_macropriority_set(struct ast_channel *chan, int value)
{
- chan->__do_not_use_macropriority = value;
+ chan->macropriority = value;
}
int ast_channel_priority(const struct ast_channel *chan)
{
- return chan->__do_not_use_priority;
+ return chan->priority;
}
void ast_channel_priority_set(struct ast_channel *chan, int value)
{
- chan->__do_not_use_priority = value;
+ chan->priority = value;
}
int ast_channel_rings(const struct ast_channel *chan)
{
- return chan->__do_not_use_rings;
+ return chan->rings;
}
void ast_channel_rings_set(struct ast_channel *chan, int value)
{
- chan->__do_not_use_rings = value;
+ chan->rings = value;
}
int ast_channel_streamid(const struct ast_channel *chan)
{
- return chan->__do_not_use_streamid;
+ return chan->streamid;
}
void ast_channel_streamid_set(struct ast_channel *chan, int value)
{
- chan->__do_not_use_streamid = value;
+ chan->streamid = value;
}
int ast_channel_timingfd(const struct ast_channel *chan)
{
- return chan->__do_not_use_timingfd;
+ return chan->timingfd;
}
void ast_channel_timingfd_set(struct ast_channel *chan, int value)
{
- chan->__do_not_use_timingfd = value;
+ chan->timingfd = value;
}
int ast_channel_visible_indication(const struct ast_channel *chan)
{
- return chan->__do_not_use_visible_indication;
+ return chan->visible_indication;
}
void ast_channel_visible_indication_set(struct ast_channel *chan, int value)
{
- chan->__do_not_use_visible_indication = value;
+ chan->visible_indication = value;
}
int ast_channel_vstreamid(const struct ast_channel *chan)
{
- return chan->__do_not_use_vstreamid;
+ return chan->vstreamid;
}
void ast_channel_vstreamid_set(struct ast_channel *chan, int value)
{
- chan->__do_not_use_vstreamid = value;
+ chan->vstreamid = value;
}
unsigned short ast_channel_transfercapability(const struct ast_channel *chan)
{
- return chan->__do_not_use_transfercapability;
+ return chan->transfercapability;
}
void ast_channel_transfercapability_set(struct ast_channel *chan, unsigned short value)
{
- chan->__do_not_use_transfercapability = value;
+ chan->transfercapability = value;
}
unsigned int ast_channel_emulate_dtmf_duration(const struct ast_channel *chan)
{
- return chan->__do_not_use_emulate_dtmf_duration;
+ return chan->emulate_dtmf_duration;
}
void ast_channel_emulate_dtmf_duration_set(struct ast_channel *chan, unsigned int value)
{
- chan->__do_not_use_emulate_dtmf_duration = value;
+ chan->emulate_dtmf_duration = value;
}
unsigned int ast_channel_fin(const struct ast_channel *chan)
{
- return chan->__do_not_use_fin;
+ return chan->fin;
}
void ast_channel_fin_set(struct ast_channel *chan, unsigned int value)
{
- chan->__do_not_use_fin = value;
+ chan->fin = value;
}
unsigned int ast_channel_fout(const struct ast_channel *chan)
{
- return chan->__do_not_use_fout;
+ return chan->fout;
}
void ast_channel_fout_set(struct ast_channel *chan, unsigned int value)
{
- chan->__do_not_use_fout = value;
+ chan->fout = value;
}
unsigned long ast_channel_insmpl(const struct ast_channel *chan)
{
- return chan->__do_not_use_insmpl;
+ return chan->insmpl;
}
void ast_channel_insmpl_set(struct ast_channel *chan, unsigned long value)
{
- chan->__do_not_use_insmpl = value;
+ chan->insmpl = value;
}
unsigned long ast_channel_outsmpl(const struct ast_channel *chan)
{
- return chan->__do_not_use_outsmpl;
+ return chan->outsmpl;
}
void ast_channel_outsmpl_set(struct ast_channel *chan, unsigned long value)
{
- chan->__do_not_use_outsmpl = value;
+ chan->outsmpl = value;
}
void *ast_channel_generatordata(const struct ast_channel *chan)
{
- return chan->__do_not_use_generatordata;
+ return chan->generatordata;
}
void ast_channel_generatordata_set(struct ast_channel *chan, void *value)
{
- chan->__do_not_use_generatordata = value;
+ chan->generatordata = value;
}
void *ast_channel_music_state(const struct ast_channel *chan)
{
- return chan->__do_not_use_music_state;
+ return chan->music_state;
}
void ast_channel_music_state_set(struct ast_channel *chan, void *value)
{
- chan->__do_not_use_music_state = value;
+ chan->music_state = value;
}
void *ast_channel_tech_pvt(const struct ast_channel *chan)
{
- return chan->__do_not_use_tech_pvt;
+ return chan->tech_pvt;
}
void ast_channel_tech_pvt_set(struct ast_channel *chan, void *value)
{
- chan->__do_not_use_tech_pvt = value;
+ chan->tech_pvt = value;
}
void *ast_channel_timingdata(const struct ast_channel *chan)
{
- return chan->__do_not_use_timingdata;
+ return chan->timingdata;
}
void ast_channel_timingdata_set(struct ast_channel *chan, void *value)
{
- chan->__do_not_use_timingdata = value;
+ chan->timingdata = value;
}
struct ast_audiohook_list *ast_channel_audiohooks(const struct ast_channel *chan)
{
- return chan->__do_not_use_audiohooks;
+ return chan->audiohooks;
}
void ast_channel_audiohooks_set(struct ast_channel *chan, struct ast_audiohook_list *value)
{
- chan->__do_not_use_audiohooks = value;
+ chan->audiohooks = value;
}
struct ast_cdr *ast_channel_cdr(const struct ast_channel *chan)
{
- return chan->__do_not_use_cdr;
+ return chan->cdr;
}
void ast_channel_cdr_set(struct ast_channel *chan, struct ast_cdr *value)
{
- chan->__do_not_use_cdr = value;
+ chan->cdr = value;
}
struct ast_channel *ast_channel_masq(const struct ast_channel *chan)
{
- return chan->__do_not_use_masq;
+ return chan->masq;
}
void ast_channel_masq_set(struct ast_channel *chan, struct ast_channel *value)
{
- chan->__do_not_use_masq = value;
+ chan->masq = value;
}
struct ast_channel *ast_channel_masqr(const struct ast_channel *chan)
{
- return chan->__do_not_use_masqr;
+ return chan->masqr;
}
void ast_channel_masqr_set(struct ast_channel *chan, struct ast_channel *value)
{
- chan->__do_not_use_masqr = value;
+ chan->masqr = value;
}
struct ast_channel_monitor *ast_channel_monitor(const struct ast_channel *chan)
{
- return chan->__do_not_use_monitor;
+ return chan->monitor;
}
void ast_channel_monitor_set(struct ast_channel *chan, struct ast_channel_monitor *value)
{
- chan->__do_not_use_monitor = value;
+ chan->monitor = value;
}
struct ast_filestream *ast_channel_stream(const struct ast_channel *chan)
{
- return chan->__do_not_use_stream;
+ return chan->stream;
}
void ast_channel_stream_set(struct ast_channel *chan, struct ast_filestream *value)
{
- chan->__do_not_use_stream = value;
+ chan->stream = value;
}
struct ast_filestream *ast_channel_vstream(const struct ast_channel *chan)
{
- return chan->__do_not_use_vstream;
+ return chan->vstream;
}
void ast_channel_vstream_set(struct ast_channel *chan, struct ast_filestream *value)
{
- chan->__do_not_use_vstream = value;
+ chan->vstream = value;
}
struct ast_format_cap *ast_channel_nativeformats(const struct ast_channel *chan)
{
- return chan->__do_not_use_nativeformats;
+ return chan->nativeformats;
}
void ast_channel_nativeformats_set(struct ast_channel *chan, struct ast_format_cap *value)
{
- chan->__do_not_use_nativeformats = value;
+ chan->nativeformats = value;
}
struct ast_framehook_list *ast_channel_framehooks(const struct ast_channel *chan)
{
- return chan->__do_not_use_framehooks;
+ return chan->framehooks;
}
void ast_channel_framehooks_set(struct ast_channel *chan, struct ast_framehook_list *value)
{
- chan->__do_not_use_framehooks = value;
+ chan->framehooks = value;
}
struct ast_generator *ast_channel_generator(const struct ast_channel *chan)
{
- return chan->__do_not_use_generator;
+ return chan->generator;
}
void ast_channel_generator_set(struct ast_channel *chan, struct ast_generator *value)
{
- chan->__do_not_use_generator = value;
+ chan->generator = value;
}
struct ast_pbx *ast_channel_pbx(const struct ast_channel *chan)
{
- return chan->__do_not_use_pbx;
+ return chan->pbx;
}
void ast_channel_pbx_set(struct ast_channel *chan, struct ast_pbx *value)
{
- chan->__do_not_use_pbx = value;
+ chan->pbx = value;
}
struct ast_sched_context *ast_channel_sched(const struct ast_channel *chan)
{
- return chan->__do_not_use_sched;
+ return chan->sched;
}
void ast_channel_sched_set(struct ast_channel *chan, struct ast_sched_context *value)
{
- chan->__do_not_use_sched = value;
+ chan->sched = value;
}
struct ast_timer *ast_channel_timer(const struct ast_channel *chan)
{
- return chan->__do_not_use_timer;
+ return chan->timer;
}
void ast_channel_timer_set(struct ast_channel *chan, struct ast_timer *value)
{
- chan->__do_not_use_timer = value;
+ chan->timer = value;
}
struct ast_tone_zone *ast_channel_zone(const struct ast_channel *chan)
{
- return chan->__do_not_use_zone;
+ return chan->zone;
}
void ast_channel_zone_set(struct ast_channel *chan, struct ast_tone_zone *value)
{
- chan->__do_not_use_zone = value;
+ chan->zone = value;
}
struct ast_trans_pvt *ast_channel_readtrans(const struct ast_channel *chan)
{
- return chan->__do_not_use_readtrans;
+ return chan->readtrans;
}
void ast_channel_readtrans_set(struct ast_channel *chan, struct ast_trans_pvt *value)
{
- chan->__do_not_use_readtrans = value;
+ chan->readtrans = value;
}
struct ast_trans_pvt *ast_channel_writetrans(const struct ast_channel *chan)
{
- return chan->__do_not_use_writetrans;
+ return chan->writetrans;
}
void ast_channel_writetrans_set(struct ast_channel *chan, struct ast_trans_pvt *value)
{
- chan->__do_not_use_writetrans = value;
+ chan->writetrans = value;
}
const struct ast_channel_tech *ast_channel_tech(const struct ast_channel *chan)
{
- return chan->__do_not_use_tech;
+ return chan->tech;
}
void ast_channel_tech_set(struct ast_channel *chan, const struct ast_channel_tech *value)
{
- chan->__do_not_use_tech = value;
+ chan->tech = value;
}
enum ast_channel_adsicpe ast_channel_adsicpe(const struct ast_channel *chan)
{
- return chan->__do_not_use_adsicpe;
+ return chan->adsicpe;
}
void ast_channel_adsicpe_set(struct ast_channel *chan, enum ast_channel_adsicpe value)
{
- chan->__do_not_use_adsicpe = value;
+ chan->adsicpe = value;
}
enum ast_channel_state ast_channel_state(const struct ast_channel *chan)
{
- return chan->__do_not_use_state;
+ return chan->state;
}
void ast_channel_state_set(struct ast_channel *chan, enum ast_channel_state value)
{
- chan->__do_not_use_state = value;
+ chan->state = value;
}
struct ast_format *ast_channel_oldwriteformat(struct ast_channel *chan)
{
- return &chan->__do_not_use_oldwriteformat;
+ return &chan->oldwriteformat;
}
struct ast_format *ast_channel_rawreadformat(struct ast_channel *chan)
{
- return &chan->__do_not_use_rawreadformat;
+ return &chan->rawreadformat;
}
struct ast_format *ast_channel_rawwriteformat(struct ast_channel *chan)
{
- return &chan->__do_not_use_rawwriteformat;
+ return &chan->rawwriteformat;
}
struct ast_format *ast_channel_readformat(struct ast_channel *chan)
{
- return &chan->__do_not_use_readformat;
+ return &chan->readformat;
}
struct ast_format *ast_channel_writeformat(struct ast_channel *chan)
{
- return &chan->__do_not_use_writeformat;
+ return &chan->writeformat;
}
struct ast_datastore_list *ast_channel_datastores(struct ast_channel *chan)
{
- return &chan->__do_not_use_datastores;
+ return &chan->datastores;
}
struct ast_autochan_list *ast_channel_autochans(struct ast_channel *chan)
{
- return &chan->__do_not_use_autochans;
+ return &chan->autochans;
}
struct ast_readq_list *ast_channel_readq(struct ast_channel *chan)
{
- return &chan->__do_not_use_readq;
+ return &chan->readq;
}
struct ast_frame *ast_channel_dtmff(struct ast_channel *chan)
{
- return &chan->__do_not_use_dtmff;
+ return &chan->dtmff;
}
struct ast_jb *ast_channel_jb(struct ast_channel *chan)
{
- return &chan->__do_not_use_jb;
+ return &chan->jb;
}
struct ast_party_caller *ast_channel_caller(struct ast_channel *chan)
{
- return &chan->__do_not_use_caller;
+ return &chan->caller;
}
struct ast_party_connected_line *ast_channel_connected(struct ast_channel *chan)
{
- return &chan->__do_not_use_connected;
+ return &chan->connected;
}
struct ast_party_dialed *ast_channel_dialed(struct ast_channel *chan)
{
- return &chan->__do_not_use_dialed;
+ return &chan->dialed;
}
struct ast_party_redirecting *ast_channel_redirecting(struct ast_channel *chan)
{
- return &chan->__do_not_use_redirecting;
+ return &chan->redirecting;
}
struct timeval *ast_channel_dtmf_tv(struct ast_channel *chan)
{
- return &chan->__do_not_use_dtmf_tv;
+ return &chan->dtmf_tv;
}
struct timeval *ast_channel_whentohangup(struct ast_channel *chan)
{
- return &chan->__do_not_use_whentohangup;
+ return &chan->whentohangup;
}
struct varshead *ast_channel_varshead(struct ast_channel *chan)
{
- return &chan->__do_not_use_varshead;
+ return &chan->varshead;
}
void ast_channel_dtmff_set(struct ast_channel *chan, struct ast_frame *value)
{
- memcpy(&chan->__do_not_use_dtmff, value, sizeof(chan->__do_not_use_dtmff));
+ chan->dtmff = *value;
}
void ast_channel_jb_set(struct ast_channel *chan, struct ast_jb *value)
{
- memcpy(&chan->__do_not_use_jb, value, sizeof(chan->__do_not_use_jb));
+ chan->jb = *value;
}
void ast_channel_caller_set(struct ast_channel *chan, struct ast_party_caller *value)
{
- memcpy(&chan->__do_not_use_caller, value, sizeof(chan->__do_not_use_caller));
+ chan->caller = *value;
}
void ast_channel_connected_set(struct ast_channel *chan, struct ast_party_connected_line *value)
{
- memcpy(&chan->__do_not_use_connected, value, sizeof(chan->__do_not_use_connected));
+ chan->connected = *value;
}
void ast_channel_dialed_set(struct ast_channel *chan, struct ast_party_dialed *value)
{
- memcpy(&chan->__do_not_use_dialed, value, sizeof(chan->__do_not_use_dialed));
+ chan->dialed = *value;
}
void ast_channel_redirecting_set(struct ast_channel *chan, struct ast_party_redirecting *value)
{
- memcpy(&chan->__do_not_use_redirecting, value, sizeof(chan->__do_not_use_redirecting));
+ chan->redirecting = *value;
}
void ast_channel_dtmf_tv_set(struct ast_channel *chan, struct timeval *value)
{
- memcpy(&chan->__do_not_use_dtmf_tv, value, sizeof(chan->__do_not_use_dtmf_tv));
+ chan->dtmf_tv = *value;
}
void ast_channel_whentohangup_set(struct ast_channel *chan, struct timeval *value)
{
- memcpy(&chan->__do_not_use_whentohangup, value, sizeof(chan->__do_not_use_whentohangup));
+ chan->whentohangup = *value;
}
void ast_channel_varshead_set(struct ast_channel *chan, struct varshead *value)
{
- memcpy(&chan->__do_not_use_varshead, value, sizeof(chan->__do_not_use_varshead));
+ chan->varshead = *value;
}
/* Evil softhangup accessors */
-int ast_channel_softhangup_internal_flag(struct ast_channel * chan)
+int ast_channel_softhangup_internal_flag(struct ast_channel *chan)
{
- return chan->__do_not_use_softhangup;
+ return chan->softhangup;
}
void ast_channel_softhangup_internal_flag_set(struct ast_channel *chan, int value)
{
- chan->__do_not_use_softhangup = value;
+ chan->softhangup = value;
}
void ast_channel_softhangup_internal_flag_add(struct ast_channel *chan, int value)
{
- chan->__do_not_use_softhangup |= value;
+ chan->softhangup |= value;
}
void ast_channel_softhangup_internal_flag_clear(struct ast_channel *chan, int value)
{
- chan ->__do_not_use_softhangup &= ~value;
+ chan ->softhangup &= ~value;
}
/* Typedef accessors */
ast_group_t ast_channel_callgroup(const struct ast_channel *chan)
{
- return chan->__do_not_use_callgroup;
+ return chan->callgroup;
}
void ast_channel_callgroup_set(struct ast_channel *chan, ast_group_t value)
{
- chan->__do_not_use_callgroup = value;
+ chan->callgroup = value;
}
ast_group_t ast_channel_pickupgroup(const struct ast_channel *chan)
{
- return chan->__do_not_use_pickupgroup;
+ return chan->pickupgroup;
}
void ast_channel_pickupgroup_set(struct ast_channel *chan, ast_group_t value)
{
- chan->__do_not_use_pickupgroup = value;
+ chan->pickupgroup = value;
}
/* Alertpipe functions */
int ast_channel_alert_write(struct ast_channel *chan)
{
char blah = 0x7F;
- return ast_channel_alert_writable(chan) && write(chan->__do_not_use_alertpipe[1], &blah, sizeof(blah)) != sizeof(blah);
+ return ast_channel_alert_writable(chan) && write(chan->alertpipe[1], &blah, sizeof(blah)) != sizeof(blah);
}
ast_alert_status_t ast_channel_internal_alert_read(struct ast_channel *chan)
return AST_ALERT_NOT_READABLE;
}
- flags = fcntl(chan->__do_not_use_alertpipe[0], F_GETFL);
+ flags = fcntl(chan->alertpipe[0], F_GETFL);
/* For some odd reason, the alertpipe occasionally loses nonblocking status,
* which immediately causes a deadlock scenario. Detect and prevent this. */
if ((flags & O_NONBLOCK) == 0) {
ast_log(LOG_ERROR, "Alertpipe on channel %s lost O_NONBLOCK?!!\n", ast_channel_name(chan));
- if (fcntl(chan->__do_not_use_alertpipe[0], F_SETFL, flags | O_NONBLOCK) < 0) {
+ if (fcntl(chan->alertpipe[0], F_SETFL, flags | O_NONBLOCK) < 0) {
ast_log(LOG_WARNING, "Unable to set alertpipe nonblocking! (%d: %s)\n", errno, strerror(errno));
return AST_ALERT_READ_FATAL;
}
}
- if (read(chan->__do_not_use_alertpipe[0], &blah, sizeof(blah)) < 0) {
+ if (read(chan->alertpipe[0], &blah, sizeof(blah)) < 0) {
if (errno != EINTR && errno != EAGAIN) {
ast_log(LOG_WARNING, "read() failed: %s\n", strerror(errno));
return AST_ALERT_READ_FAIL;
int ast_channel_alert_writable(struct ast_channel *chan)
{
- return chan->__do_not_use_alertpipe[1] > -1;
+ return chan->alertpipe[1] > -1;
}
int ast_channel_internal_alert_readable(struct ast_channel *chan)
{
- return chan->__do_not_use_alertpipe[0] > -1;
+ return chan->alertpipe[0] > -1;
}
void ast_channel_internal_alertpipe_clear(struct ast_channel *chan)
{
- chan->__do_not_use_alertpipe[0] = chan->__do_not_use_alertpipe[1] = -1;
+ chan->alertpipe[0] = chan->alertpipe[1] = -1;
}
void ast_channel_internal_alertpipe_close(struct ast_channel *chan)
{
if (ast_channel_internal_alert_readable(chan)) {
- close(chan->__do_not_use_alertpipe[0]);
+ close(chan->alertpipe[0]);
}
if (ast_channel_alert_writable(chan)) {
- close(chan->__do_not_use_alertpipe[1]);
+ close(chan->alertpipe[1]);
}
}
int ast_channel_internal_alertpipe_init(struct ast_channel *chan)
{
- if (pipe(chan->__do_not_use_alertpipe)) {
+ if (pipe(chan->alertpipe)) {
ast_log(LOG_WARNING, "Channel allocation failed: Can't create alert pipe! Try increasing max file descriptors with ulimit -n\n");
return -1;
} else {
- int flags = fcntl(chan->__do_not_use_alertpipe[0], F_GETFL);
- if (fcntl(chan->__do_not_use_alertpipe[0], F_SETFL, flags | O_NONBLOCK) < 0) {
+ int flags = fcntl(chan->alertpipe[0], F_GETFL);
+ if (fcntl(chan->alertpipe[0], F_SETFL, flags | O_NONBLOCK) < 0) {
ast_log(LOG_WARNING, "Channel allocation failed: Unable to set alertpipe nonblocking! (%d: %s)\n", errno, strerror(errno));
return -1;
}
- flags = fcntl(chan->__do_not_use_alertpipe[1], F_GETFL);
- if (fcntl(chan->__do_not_use_alertpipe[1], F_SETFL, flags | O_NONBLOCK) < 0) {
+ flags = fcntl(chan->alertpipe[1], F_GETFL);
+ if (fcntl(chan->alertpipe[1], F_SETFL, flags | O_NONBLOCK) < 0) {
ast_log(LOG_WARNING, "Channel allocation failed: Unable to set alertpipe nonblocking! (%d: %s)\n", errno, strerror(errno));
return -1;
}
int ast_channel_internal_alert_readfd(struct ast_channel *chan)
{
- return chan->__do_not_use_alertpipe[0];
+ return chan->alertpipe[0];
}
void ast_channel_internal_alertpipe_swap(struct ast_channel *chan1, struct ast_channel *chan2)
{
int i;
- for (i = 0; i < ARRAY_LEN(chan1->__do_not_use_alertpipe); i++) {
- SWAP(chan1->__do_not_use_alertpipe[i], chan2->__do_not_use_alertpipe[i]);
+ for (i = 0; i < ARRAY_LEN(chan1->alertpipe); i++) {
+ SWAP(chan1->alertpipe[i], chan2->alertpipe[i]);
}
}
/* file descriptor array accessors */
void ast_channel_internal_fd_set(struct ast_channel *chan, int which, int value)
{
- chan->__do_not_use_fds[which] = value;
+ chan->fds[which] = value;
}
void ast_channel_internal_fd_clear(struct ast_channel *chan, int which)
{
}
int ast_channel_fd(const struct ast_channel *chan, int which)
{
- return chan->__do_not_use_fds[which];
+ return chan->fds[which];
}
int ast_channel_fd_isset(const struct ast_channel *chan, int which)
{
#ifdef HAVE_EPOLL
struct ast_epoll_data *ast_channel_internal_epfd_data(const struct ast_channel *chan, int which)
{
- return chan->__do_not_use_epfd_data[which];
+ return chan->epfd_data[which];
}
void ast_channel_internal_epfd_data_set(struct ast_channel *chan, int which , struct ast_epoll_data *value)
{
- chan->__do_not_use_epfd_data[which] = value;
+ chan->epfd_data[which] = value;
}
#endif
+
+pthread_t ast_channel_blocker(const struct ast_channel *chan)
+{
+ return chan->blocker;
+}
+void ast_channel_blocker_set(struct ast_channel *chan, pthread_t value)
+{
+ chan->blocker = value;
+}
+
+ast_timing_func_t ast_channel_timingfunc(const struct ast_channel *chan)
+{
+ return chan->timingfunc;
+}
+void ast_channel_timingfunc_set(struct ast_channel *chan, ast_timing_func_t value)
+{
+ chan->timingfunc = value;
+}
+
+struct ast_bridge *ast_channel_internal_bridge(const struct ast_channel *chan)
+{
+ return chan->bridge;
+}
+void ast_channel_internal_bridge_set(struct ast_channel *chan, struct ast_bridge *value)
+{
+ chan->bridge = value;
+}
+
+struct ast_channel *ast_channel_internal_bridged_channel(const struct ast_channel *chan)
+{
+ return chan->bridged_channel;
+}
+void ast_channel_internal_bridged_channel_set(struct ast_channel *chan, struct ast_channel *value)
+{
+ chan->bridged_channel = value;
+}
+
+struct ast_flags *ast_channel_flags(struct ast_channel *chan)
+{
+ return &chan->flags;
+}
+
+struct ast_channel *__ast_channel_internal_alloc(void (*destructor)(void *obj), const char *file, int line, const char *function)
+{
+ struct ast_channel *tmp;
+#if defined(REF_DEBUG)
+ tmp = __ao2_alloc_debug(sizeof(*tmp), destructor,
+ AO2_ALLOC_OPT_LOCK_MUTEX, "", file, line, function, 1);
+#elif defined(__AST_DEBUG_MALLOC)
+ tmp = __ao2_alloc_debug(sizeof(*tmp), destructor,
+ AO2_ALLOC_OPT_LOCK_MUTEX, "", file, line, function, 0);
+#else
+ tmp = ao2_alloc(sizeof(*tmp), destructor);
+#endif
+
+ if ((ast_string_field_init(tmp, 128))) {
+ return ast_channel_unref(tmp);
+ }
+
+ return tmp;
+}
+
+void ast_channel_internal_cleanup(struct ast_channel *chan)
+{
+ ast_string_field_free_memory(chan);
+}
+
+void ast_channel_internal_finalize(struct ast_channel *chan)
+{
+ chan->finalized = 1;
+}
+
+int ast_channel_internal_is_finalized(struct ast_channel *chan)
+{
+ return chan->finalized;
+}
ast_channel_fin(c) & ~DEBUGCHAN_FLAG, (ast_channel_fin(c) & DEBUGCHAN_FLAG) ? " (DEBUGGED)" : "",
ast_channel_fout(c) & ~DEBUGCHAN_FLAG, (ast_channel_fout(c) & DEBUGCHAN_FLAG) ? " (DEBUGGED)" : "",
(long)ast_channel_whentohangup(c)->tv_sec,
- cdrtime, c->_bridge ? ast_channel_name(c->_bridge) : "<none>", ast_bridged_channel(c) ? ast_channel_name(ast_bridged_channel(c)) : "<none>",
+ cdrtime, ast_channel_internal_bridged_channel(c) ? ast_channel_name(ast_channel_internal_bridged_channel(c)) : "<none>", ast_bridged_channel(c) ? ast_channel_name(ast_bridged_channel(c)) : "<none>",
ast_channel_context(c), ast_channel_exten(c), ast_channel_priority(c), ast_channel_callgroup(c), ast_channel_pickupgroup(c), (ast_channel_appl(c) ? ast_channel_appl(c) : "(N/A)" ),
(ast_channel_data(c) ? S_OR(ast_channel_data(c), "(Empty)") : "(None)"),
- (ast_test_flag(c, AST_FLAG_BLOCKING) ? ast_channel_blockproc(c) : "(Not Blocking)"));
+ (ast_test_flag(ast_channel_flags(c), AST_FLAG_BLOCKING) ? ast_channel_blockproc(c) : "(Not Blocking)"));
if (pbx_builtin_serialize_variables(c, &obuf)) {
ast_str_append(&output, 0, " Variables:\n%s\n", ast_str_buffer(obuf));
}
ast_parseable_goto(xferchan, goto_on_transfer);
ast_channel_state_set(xferchan, AST_STATE_UP);
- ast_clear_flag(xferchan, AST_FLAGS_ALL);
+ ast_clear_flag(ast_channel_flags(xferchan), AST_FLAGS_ALL);
ast_channel_clear_softhangup(xferchan, AST_SOFTHANGUP_ALL);
if (ast_do_masquerade(xferchan) || ast_pbx_start(xferchan)) {
* parking space number do not continue playing it back. This
* is the case if an attended transfer occurs.
*/
- ast_set_flag(peer, AST_FLAG_MASQ_NOSTREAM);
+ ast_set_flag(ast_channel_flags(peer), AST_FLAG_MASQ_NOSTREAM);
/* Tell the peer channel the number of the parking space */
ast_say_digits(peer, pu->parkingnum, "", ast_channel_language(peer));
- ast_clear_flag(peer, AST_FLAG_MASQ_NOSTREAM);
+ ast_clear_flag(ast_channel_flags(peer), AST_FLAG_MASQ_NOSTREAM);
}
if (peer == chan) { /* pu->notquiteyet = 1 */
/* Wake up parking thread if we're really done */
} else {
/* Set the transferee's new extension, since it exists, using transferer context */
ast_debug(1, "About to explicit goto %s, it has a PBX.\n", ast_channel_name(transferee));
- ast_set_flag(transferee, AST_FLAG_BRIDGE_HANGUP_DONT); /* don't let the after-bridge code run the h-exten */
+ ast_set_flag(ast_channel_flags(transferee), AST_FLAG_BRIDGE_HANGUP_DONT); /* don't let the after-bridge code run the h-exten */
set_c_e_p(transferee, transferer_real_context, xferto, 0);
/*
/* ast_bridge_call clears AST_FLAG_BRIDGE_HANGUP_DONT, but we don't
want that to happen here because we're also in another bridge already
*/
- if (ast_test_flag(chan, AST_FLAG_BRIDGE_HANGUP_DONT)) {
+ if (ast_test_flag(ast_channel_flags(chan), AST_FLAG_BRIDGE_HANGUP_DONT)) {
hangup_dont = 1;
}
/* Let party B and party C talk as long as they want. */
ast_bridge_call(transferer, newchan, &bconfig);
if (hangup_dont) {
- ast_set_flag(chan, AST_FLAG_BRIDGE_HANGUP_DONT);
+ ast_set_flag(ast_channel_flags(chan), AST_FLAG_BRIDGE_HANGUP_DONT);
}
if (ast_check_hangup(newchan) || !ast_check_hangup(transferer)) {
ast_channel_masquerade(xferchan, transferee);
ast_explicit_goto(xferchan, ast_channel_context(transferee), ast_channel_exten(transferee), ast_channel_priority(transferee));
ast_channel_state_set(xferchan, AST_STATE_UP);
- ast_clear_flag(xferchan, AST_FLAGS_ALL);
+ ast_clear_flag(ast_channel_flags(xferchan), AST_FLAGS_ALL);
/* Do the masquerade manually to make sure that is is completed. */
ast_do_masquerade(xferchan);
ast_channel_state_set(newchan, AST_STATE_UP);
- ast_clear_flag(newchan, AST_FLAGS_ALL);
+ ast_clear_flag(ast_channel_flags(newchan), AST_FLAGS_ALL);
tobj = ast_calloc(1, sizeof(*tobj));
if (!tobj) {
ast_hangup(xferchan);
ast_channel_accountcode(chan), ast_channel_dialcontext(chan), ast_channel_amaflags(chan), ast_channel_macrocontext(chan), ast_channel_macroexten(chan), ast_channel_macropriority(chan));
ast_log(LOG_NOTICE, "CHAN: masq: %p; masqr: %p; _bridge: %p; uniqueID: %s; linkedID:%s\n",
ast_channel_masq(chan), ast_channel_masqr(chan),
- chan->_bridge, ast_channel_uniqueid(chan), ast_channel_linkedid(chan));
+ ast_channel_internal_bridged_channel(chan), ast_channel_uniqueid(chan), ast_channel_linkedid(chan));
if (ast_channel_masqr(chan)) {
ast_log(LOG_NOTICE, "CHAN: masquerading as: %s; cdr: %p;\n",
ast_channel_name(ast_channel_masqr(chan)), ast_channel_cdr(ast_channel_masqr(chan)));
}
- if (chan->_bridge) {
- ast_log(LOG_NOTICE, "CHAN: Bridged to %s\n", ast_channel_name(chan->_bridge));
+ if (ast_channel_internal_bridged_channel(chan)) {
+ ast_log(LOG_NOTICE, "CHAN: Bridged to %s\n", ast_channel_name(ast_channel_internal_bridged_channel(chan)));
}
ast_log(LOG_NOTICE, "===== done ====\n");
ast_cdr_answer(chan_cdr); /* for the sake of cli status checks */
}
}
- if (ast_test_flag(chan,AST_FLAG_BRIDGE_HANGUP_DONT) && (chan_cdr || peer_cdr)) {
+ if (ast_test_flag(ast_channel_flags(chan), AST_FLAG_BRIDGE_HANGUP_DONT) && (chan_cdr || peer_cdr)) {
if (chan_cdr) {
ast_set_flag(chan_cdr, AST_CDR_FLAG_BRIDGED);
}
res = ast_channel_bridge(chan, peer, config, &f, &who);
- if (ast_test_flag(chan, AST_FLAG_ZOMBIE)
- || ast_test_flag(peer, AST_FLAG_ZOMBIE)) {
+ if (ast_test_flag(ast_channel_flags(chan), AST_FLAG_ZOMBIE)
+ || ast_test_flag(ast_channel_flags(peer), AST_FLAG_ZOMBIE)) {
/* Zombies are present time to leave! */
res = -1;
if (f) {
}
}
if (res < 0) {
- if (!ast_test_flag(chan, AST_FLAG_ZOMBIE) && !ast_test_flag(peer, AST_FLAG_ZOMBIE) && !ast_check_hangup(chan) && !ast_check_hangup(peer)) {
+ if (!ast_test_flag(ast_channel_flags(chan), AST_FLAG_ZOMBIE) && !ast_test_flag(ast_channel_flags(peer), AST_FLAG_ZOMBIE) && !ast_check_hangup(chan) && !ast_check_hangup(peer)) {
ast_log(LOG_WARNING, "Bridge failed on channels %s and %s\n", ast_channel_name(chan), ast_channel_name(peer));
}
goto before_you_go;
*/
ast_channel_lock(chan);
if (ast_channel_softhangup_internal_flag(chan) & (AST_SOFTHANGUP_ASYNCGOTO | AST_SOFTHANGUP_UNBRIDGE)) {
- ast_set_flag(chan, AST_FLAG_BRIDGE_HANGUP_DONT);
+ ast_set_flag(ast_channel_flags(chan), AST_FLAG_BRIDGE_HANGUP_DONT);
}
ast_channel_unlock(chan);
res = -1;
silgen = NULL;
}
- if (ast_test_flag(chan,AST_FLAG_BRIDGE_HANGUP_DONT)) {
- ast_clear_flag(chan,AST_FLAG_BRIDGE_HANGUP_DONT); /* its job is done */
+ if (ast_test_flag(ast_channel_flags(chan), AST_FLAG_BRIDGE_HANGUP_DONT)) {
+ ast_clear_flag(ast_channel_flags(chan), AST_FLAG_BRIDGE_HANGUP_DONT); /* its job is done */
if (bridge_cdr) {
ast_cdr_discard(bridge_cdr);
/* QUESTION: should we copy bridge_cdr fields to the peer before we throw it away? */
*/
ast_softhangup(chan, AST_SOFTHANGUP_APPUNLOAD);
- autoloopflag = ast_test_flag(chan, AST_FLAG_IN_AUTOLOOP);
- ast_set_flag(chan, AST_FLAG_IN_AUTOLOOP);
+ autoloopflag = ast_test_flag(ast_channel_flags(chan), AST_FLAG_IN_AUTOLOOP);
+ ast_set_flag(ast_channel_flags(chan), AST_FLAG_IN_AUTOLOOP);
if (bridge_cdr && ast_opt_end_cdr_before_h_exten) {
ast_cdr_end(bridge_cdr);
}
}
}
/* An "h" exten has been run, so indicate that one has been run. */
- ast_set_flag(chan, AST_FLAG_BRIDGE_HANGUP_RUN);
+ ast_set_flag(ast_channel_flags(chan), AST_FLAG_BRIDGE_HANGUP_RUN);
ast_channel_unlock(chan);
/* protect the lastapp/lastdata against the effects of the hangup/dialplan code */
ast_copy_string(bridge_cdr->lastapp, savelastapp, sizeof(bridge_cdr->lastapp));
ast_copy_string(bridge_cdr->lastdata, savelastdata, sizeof(bridge_cdr->lastdata));
}
- ast_set2_flag(chan, autoloopflag, AST_FLAG_IN_AUTOLOOP);
+ ast_set2_flag(ast_channel_flags(chan), autoloopflag, AST_FLAG_IN_AUTOLOOP);
}
/* obey the NoCDR() wishes. -- move the DISABLED flag to the bridge CDR if it was set on the channel during the bridge... */
}
if (pfds[y].revents & POLLPRI) {
- ast_set_flag(chan, AST_FLAG_EXCEPTION);
+ ast_set_flag(ast_channel_flags(chan), AST_FLAG_EXCEPTION);
} else {
- ast_clear_flag(chan, AST_FLAG_EXCEPTION);
+ ast_clear_flag(ast_channel_flags(chan), AST_FLAG_EXCEPTION);
}
ast_channel_fdno_set(chan, x);
int ast_can_pickup(struct ast_channel *chan)
{
- if (!ast_channel_pbx(chan) && !ast_channel_masq(chan) && !ast_test_flag(chan, AST_FLAG_ZOMBIE)
+ if (!ast_channel_pbx(chan) && !ast_channel_masq(chan) && !ast_test_flag(ast_channel_flags(chan), AST_FLAG_ZOMBIE)
&& (ast_channel_state(chan) == AST_STATE_RINGING
|| ast_channel_state(chan) == AST_STATE_RING
/*
}
/* setting this flag to generate a reason header in the cancel message to the ringing channel */
- ast_set_flag(chan, AST_FLAG_ANSWERED_ELSEWHERE);
+ ast_set_flag(ast_channel_flags(chan), AST_FLAG_ANSWERED_ELSEWHERE);
if (ast_channel_masquerade(target, chan)) {
ast_log(LOG_WARNING, "Unable to masquerade '%s' into '%s'\n", chan_name,
ast_debug(1, "Ooh, found a video stream, too, format %s\n", ast_getformatname(&vfs->fmt->format));
}
- if (ast_test_flag(chan, AST_FLAG_MASQ_NOSTREAM))
+ if (ast_test_flag(ast_channel_flags(chan), AST_FLAG_MASQ_NOSTREAM))
fs->orig_chan_name = ast_strdup(ast_channel_name(chan));
if (ast_applystream(chan, fs))
return -1;
reverse = "";
/* Switch the channel to end DTMF frame only. waitstream_core doesn't care about the start of DTMF. */
- ast_set_flag(c, AST_FLAG_END_DTMF_ONLY);
+ ast_set_flag(ast_channel_flags(c), AST_FLAG_END_DTMF_ONLY);
- if (ast_test_flag(c, AST_FLAG_MASQ_NOSTREAM))
+ if (ast_test_flag(ast_channel_flags(c), AST_FLAG_MASQ_NOSTREAM))
orig_chan_name = ast_strdupa(ast_channel_name(c));
while (ast_channel_stream(c)) {
ms = ast_sched_wait(ast_channel_sched(c));
- if (ms < 0 && !c->timingfunc) {
+ if (ms < 0 && !ast_channel_timingfunc(c)) {
ast_stopstream(c);
break;
}
res = ast_waitfor(c, ms);
if (res < 0) {
ast_log(LOG_WARNING, "Select failed (%s)\n", strerror(errno));
- ast_clear_flag(c, AST_FLAG_END_DTMF_ONLY);
+ ast_clear_flag(ast_channel_flags(c), AST_FLAG_END_DTMF_ONLY);
return res;
}
} else {
if (errno == EINTR)
continue;
ast_log(LOG_WARNING, "Wait failed (%s)\n", strerror(errno));
- ast_clear_flag(c, AST_FLAG_END_DTMF_ONLY);
+ ast_clear_flag(ast_channel_flags(c), AST_FLAG_END_DTMF_ONLY);
return -1;
} else if (outfd > -1) { /* this requires cmdfd set */
/* The FD we were watching has something waiting */
- ast_clear_flag(c, AST_FLAG_END_DTMF_ONLY);
+ ast_clear_flag(ast_channel_flags(c), AST_FLAG_END_DTMF_ONLY);
return 1;
}
/* if rchan is set, it is 'c' */
if (res > 0) {
struct ast_frame *fr = ast_read(c);
if (!fr) {
- ast_clear_flag(c, AST_FLAG_END_DTMF_ONLY);
+ ast_clear_flag(ast_channel_flags(c), AST_FLAG_END_DTMF_ONLY);
return -1;
}
switch (fr->frametype) {
S_COR(ast_channel_caller(c)->id.number.valid, ast_channel_caller(c)->id.number.str, NULL))) {
res = fr->subclass.integer;
ast_frfree(fr);
- ast_clear_flag(c, AST_FLAG_END_DTMF_ONLY);
+ ast_clear_flag(ast_channel_flags(c), AST_FLAG_END_DTMF_ONLY);
return res;
}
} else {
ast_stream_rewind(ast_channel_stream(c), skip_ms);
} else if (strchr(breakon, res)) {
ast_frfree(fr);
- ast_clear_flag(c, AST_FLAG_END_DTMF_ONLY);
+ ast_clear_flag(ast_channel_flags(c), AST_FLAG_END_DTMF_ONLY);
return res;
}
}
case AST_CONTROL_BUSY:
case AST_CONTROL_CONGESTION:
ast_frfree(fr);
- ast_clear_flag(c, AST_FLAG_END_DTMF_ONLY);
+ ast_clear_flag(ast_channel_flags(c), AST_FLAG_END_DTMF_ONLY);
return -1;
case AST_CONTROL_RINGING:
case AST_CONTROL_ANSWER:
ast_sched_runq(ast_channel_sched(c));
}
- ast_clear_flag(c, AST_FLAG_END_DTMF_ONLY);
+ ast_clear_flag(ast_channel_flags(c), AST_FLAG_END_DTMF_ONLY);
return (err || ast_channel_softhangup_internal_flag(c)) ? -1 : 0;
}
/* Let interrupts interrupt :) */
if (pd->interruptible) {
- ast_set_flag(chan, AST_FLAG_WRITE_INT);
+ ast_set_flag(ast_channel_flags(chan), AST_FLAG_WRITE_INT);
} else {
- ast_clear_flag(chan, AST_FLAG_WRITE_INT);
+ ast_clear_flag(ast_channel_flags(chan), AST_FLAG_WRITE_INT);
}
return ps;
}
channels++;
- if (c->_bridge) {
- snprintf(bridge, sizeof(bridge), "BridgedChannel: %s\r\nBridgedUniqueid: %s\r\n", ast_channel_name(c->_bridge), ast_channel_uniqueid(c->_bridge));
+ if (ast_channel_internal_bridged_channel(c)) {
+ snprintf(bridge, sizeof(bridge), "BridgedChannel: %s\r\nBridgedUniqueid: %s\r\n", ast_channel_name(ast_channel_internal_bridged_channel(c)), ast_channel_uniqueid(ast_channel_internal_bridged_channel(c)));
} else {
bridge[0] = '\0';
}
if (ast_channel_pbx(chan)) {
ast_channel_lock(chan);
- ast_set_flag(chan, AST_FLAG_BRIDGE_HANGUP_DONT); /* don't let the after-bridge code run the h-exten */
+ ast_set_flag(ast_channel_flags(chan), AST_FLAG_BRIDGE_HANGUP_DONT); /* don't let the after-bridge code run the h-exten */
ast_channel_unlock(chan);
}
if (chan2) {
if (ast_channel_pbx(chan2)) {
ast_channel_lock(chan2);
- ast_set_flag(chan2, AST_FLAG_BRIDGE_HANGUP_DONT); /* don't let the after-bridge code run the h-exten */
+ ast_set_flag(ast_channel_flags(chan2), AST_FLAG_BRIDGE_HANGUP_DONT); /* don't let the after-bridge code run the h-exten */
ast_channel_unlock(chan2);
}
if (!ast_strlen_zero(context2)) {
ast_channel_pbx(c)->rtimeoutms = 10000;
ast_channel_pbx(c)->dtimeoutms = 5000;
- autoloopflag = ast_test_flag(c, AST_FLAG_IN_AUTOLOOP); /* save value to restore at the end */
- ast_set_flag(c, AST_FLAG_IN_AUTOLOOP);
+ autoloopflag = ast_test_flag(ast_channel_flags(c), AST_FLAG_IN_AUTOLOOP); /* save value to restore at the end */
+ ast_set_flag(ast_channel_flags(c), AST_FLAG_IN_AUTOLOOP);
if (ast_strlen_zero(ast_channel_exten(c))) {
/* If not successful fall back to 's' - but only if there is no given exten */
}
if ((!args || !args->no_hangup_chan)
- && !ast_test_flag(c, AST_FLAG_BRIDGE_HANGUP_RUN)
+ && !ast_test_flag(ast_channel_flags(c), AST_FLAG_BRIDGE_HANGUP_RUN)
&& ast_exists_extension(c, ast_channel_context(c), "h", 1,
S_COR(ast_channel_caller(c)->id.number.valid, ast_channel_caller(c)->id.number.str, NULL))) {
set_ext_pri(c, "h", 1);
ast_verb(2, "Spawn extension (%s, %s, %d) exited non-zero on '%s'\n", ast_channel_context(c), ast_channel_exten(c), ast_channel_priority(c), ast_channel_name(c));
}
}
- ast_set2_flag(c, autoloopflag, AST_FLAG_IN_AUTOLOOP);
- ast_clear_flag(c, AST_FLAG_BRIDGE_HANGUP_RUN); /* from one round to the next, make sure this gets cleared */
+ ast_set2_flag(ast_channel_flags(c), autoloopflag, AST_FLAG_IN_AUTOLOOP);
+ ast_clear_flag(ast_channel_flags(c), AST_FLAG_BRIDGE_HANGUP_RUN); /* from one round to the next, make sure this gets cleared */
pbx_destroy(ast_channel_pbx(c));
ast_channel_pbx_set(c, NULL);
if (priority > -1) {
ast_channel_priority_set(chan, priority);
/* see flag description in channel.h for explanation */
- if (ast_test_flag(chan, AST_FLAG_IN_AUTOLOOP)) {
+ if (ast_test_flag(ast_channel_flags(chan), AST_FLAG_IN_AUTOLOOP)) {
ast_channel_priority_set(chan, ast_channel_priority(chan) - 1);
}
}
* users can EXEC Background and reasonably expect that the DTMF code will
* be returned (see #16434).
*/
- if (!ast_test_flag(chan, AST_FLAG_DISABLE_WORKAROUNDS)
+ if (!ast_test_flag(ast_channel_flags(chan), AST_FLAG_DISABLE_WORKAROUNDS)
&& (exten[0] = res)
&& ast_canmatch_extension(chan, args.context, exten, 1,
S_COR(ast_channel_caller(chan)->id.number.valid, ast_channel_caller(chan)->id.number.str, NULL))
cs[1] = cs[2];
}
- if (ast_test_flag(c0, AST_FLAG_ZOMBIE)) {
+ if (ast_test_flag(ast_channel_flags(c0), AST_FLAG_ZOMBIE)) {
ast_debug(1, "Channel '%s' Zombie cleardown from bridge\n", ast_channel_name(c0));
} else if (ast_channel_tech_pvt(c0) != pvt0) {
ast_debug(1, "Channel c0->'%s' pvt changed, in bridge with c1->'%s'\n", ast_channel_name(c0), ast_channel_name(c1));
} else if (glue0->update_peer(c0, NULL, NULL, NULL, 0, 0)) {
ast_log(LOG_WARNING, "Channel '%s' failed to break RTP bridge\n", ast_channel_name(c0));
}
- if (ast_test_flag(c1, AST_FLAG_ZOMBIE)) {
+ if (ast_test_flag(ast_channel_flags(c1), AST_FLAG_ZOMBIE)) {
ast_debug(1, "Channel '%s' Zombie cleardown from bridge\n", ast_channel_name(c1));
} else if (ast_channel_tech_pvt(c1) != pvt1) {
ast_debug(1, "Channel c1->'%s' pvt changed, in bridge with c0->'%s'\n", ast_channel_name(c1), ast_channel_name(c0));
ast_verb(3, "AGI Script Executing Application: (%s) Options: (%s)\n", argv[1], argc >= 3 ? argv[2] : "");
if ((app_to_exec = pbx_findapp(argv[1]))) {
- if (!(workaround = ast_test_flag(chan, AST_FLAG_DISABLE_WORKAROUNDS))) {
- ast_set_flag(chan, AST_FLAG_DISABLE_WORKAROUNDS);
+ if (!(workaround = ast_test_flag(ast_channel_flags(chan), AST_FLAG_DISABLE_WORKAROUNDS))) {
+ ast_set_flag(ast_channel_flags(chan), AST_FLAG_DISABLE_WORKAROUNDS);
}
if (ast_compat_res_agi && argc >= 3 && !ast_strlen_zero(argv[2])) {
char *compat = alloca(strlen(argv[2]) * 2 + 1), *cptr;
res = pbx_exec(chan, app_to_exec, argc == 2 ? "" : argv[2]);
}
if (!workaround) {
- ast_clear_flag(chan, AST_FLAG_DISABLE_WORKAROUNDS);
+ ast_clear_flag(ast_channel_flags(chan), AST_FLAG_DISABLE_WORKAROUNDS);
}
} else {
ast_log(LOG_WARNING, "Could not find application (%s)\n", argv[1]);
switch (speech->state) {
case AST_SPEECH_STATE_READY:
/* If the stream is done, start timeout calculation */
- if ((timeout > 0) && start == 0 && ((!ast_channel_stream(chan)) || (ast_channel_streamid(chan) == -1 && chan->timingfunc == NULL))) {
+ if ((timeout > 0) && start == 0 && ((!ast_channel_stream(chan)) || (ast_channel_streamid(chan) == -1 && ast_channel_timingfunc(chan) == NULL))) {
ast_stopstream(chan);
time(&start);
}
break;
case AST_SPEECH_STATE_WAIT:
/* Cue waiting sound if not already playing */
- if ((!ast_channel_stream(chan)) || (ast_channel_streamid(chan) == -1 && chan->timingfunc == NULL)) {
+ if ((!ast_channel_stream(chan)) || (ast_channel_streamid(chan) == -1 && ast_channel_timingfunc(chan) == NULL)) {
ast_stopstream(chan);
/* If a processing sound exists, or is not none - play it */
if (!ast_strlen_zero(speech->processing_sound) && strcasecmp(speech->processing_sound, "none"))
ast_channel_name(chan), ast_channel_uniqueid(chan),
mohclass->name);
- ast_set_flag(chan, AST_FLAG_MOH);
+ ast_set_flag(ast_channel_flags(chan), AST_FLAG_MOH);
if (mohclass->total_files) {
res = ast_activate_generator(chan, &moh_file_stream, mohclass);
static void local_ast_moh_stop(struct ast_channel *chan)
{
- ast_clear_flag(chan, AST_FLAG_MOH);
+ ast_clear_flag(ast_channel_flags(chan), AST_FLAG_MOH);
ast_deactivate_generator(chan);
ast_channel_lock(chan);
case ASTCHANFLAGS:
bits_ret[0] = 0;
for (bit = 0; bit < 8; bit++)
- bits_ret[0] |= ((chan->flags & (1 << bit)) >> bit) << (7 - bit);
+ bits_ret[0] |= ((ast_channel_flags(chan)->flags & (1 << bit)) >> bit) << (7 - bit);
bits_ret[1] = 0;
for (bit = 0; bit < 8; bit++)
- bits_ret[1] |= (((chan->flags >> 8) & (1 << bit)) >> bit) << (7 - bit);
+ bits_ret[1] |= (((ast_channel_flags(chan)->flags >> 8) & (1 << bit)) >> bit) << (7 - bit);
*var_len = 2;
ret = bits_ret;
break;