Finalize ast_channel opaquification

Review: https://reviewboard.asterisk.org/r/1786/


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@358907 65c4cc65-6c06-0410-ace0-fbb531ad65f3
certified/11.2
Terry Wilson 13 years ago
parent 73ec67e008
commit 786f5898d1

@ -97,7 +97,7 @@ static int asyncgoto_exec(struct ast_channel *chan, const char *data)
} }
if (ast_channel_pbx(chan2)) { 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); res = ast_async_parseable_goto(chan2, args.label);

@ -489,7 +489,7 @@ static int start_spying(struct ast_autochan *autochan, const char *spychan_name,
ast_set_flag(audiohook, AST_AUDIOHOOK_TRIGGER_SYNC | AST_AUDIOHOOK_SMALL_QUEUE); ast_set_flag(audiohook, AST_AUDIOHOOK_TRIGGER_SYNC | AST_AUDIOHOOK_SMALL_QUEUE);
res = ast_audiohook_attach(autochan->chan, audiohook); 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); ast_softhangup(peer, AST_SOFTHANGUP_UNBRIDGE);
} }
return res; return res;
@ -583,7 +583,7 @@ static int channel_spy(struct ast_channel *chan, struct ast_autochan *spyee_auto
} }
ast_channel_lock(chan); 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); ast_channel_unlock(chan);
csth.volfactor = *volfactor; csth.volfactor = *volfactor;
@ -699,7 +699,7 @@ static int channel_spy(struct ast_channel *chan, struct ast_autochan *spyee_auto
ast_deactivate_generator(chan); ast_deactivate_generator(chan);
ast_channel_lock(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); ast_channel_unlock(chan);
if (ast_test_flag(flags, OPTION_WHISPER | OPTION_BARGE | OPTION_DTMF_SWITCH_MODES)) { if (ast_test_flag(flags, OPTION_WHISPER | OPTION_BARGE | OPTION_DTMF_SWITCH_MODES)) {
@ -787,7 +787,7 @@ static int common_exec(struct ast_channel *chan, struct ast_flags *flags,
if (ast_channel_state(chan) != AST_STATE_UP) if (ast_channel_state(chan) != AST_STATE_UP)
ast_answer(chan); 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; waitms = 100;
@ -800,7 +800,7 @@ static int common_exec(struct ast_channel *chan, struct ast_flags *flags,
if (!res) if (!res)
res = ast_waitstream(chan, ""); res = ast_waitstream(chan, "");
else if (res < 0) { else if (res < 0) {
ast_clear_flag(chan, AST_FLAG_SPYING); ast_clear_flag(ast_channel_flags(chan), AST_FLAG_SPYING);
break; break;
} }
if (!ast_strlen_zero(exitcontext)) { if (!ast_strlen_zero(exitcontext)) {
@ -831,7 +831,7 @@ static int common_exec(struct ast_channel *chan, struct ast_flags *flags,
res = ast_waitfordigit(chan, waitms); res = ast_waitfordigit(chan, waitms);
if (res < 0) { if (res < 0) {
iter = ast_channel_iterator_destroy(iter); iter = ast_channel_iterator_destroy(iter);
ast_clear_flag(chan, AST_FLAG_SPYING); ast_clear_flag(ast_channel_flags(chan), AST_FLAG_SPYING);
break; break;
} }
if (!ast_strlen_zero(exitcontext)) { if (!ast_strlen_zero(exitcontext)) {
@ -873,7 +873,7 @@ static int common_exec(struct ast_channel *chan, struct ast_flags *flags,
continue; 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; continue;
} }
@ -1024,7 +1024,7 @@ static int common_exec(struct ast_channel *chan, struct ast_flags *flags,
} }
exit: 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); ast_channel_setoption(chan, AST_OPTION_TXGAIN, &zero_volume, sizeof(zero_volume), 0);

@ -1142,7 +1142,7 @@ static int alloc_playback_chan(struct conference_bridge *conference_bridge)
} }
cap = ast_format_cap_destroy(cap); 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)) { if (ast_call(conference_bridge->playback_chan, "", 0)) {
ast_hangup(conference_bridge->playback_chan); ast_hangup(conference_bridge->playback_chan);

@ -693,7 +693,7 @@ static void hanguptree(struct chanlist *outgoing, struct ast_channel *exception,
if (outgoing->chan && (outgoing->chan != exception)) { if (outgoing->chan && (outgoing->chan != exception)) {
if (answered_elsewhere) { if (answered_elsewhere) {
/* The flag is used for local channel inheritance and stuff */ /* 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 */ /* This is for the channel drivers */
ast_channel_hangupcause_set(outgoing->chan, AST_CAUSE_ANSWERED_ELSEWHERE); ast_channel_hangupcause_set(outgoing->chan, AST_CAUSE_ANSWERED_ELSEWHERE);
} }
@ -2327,12 +2327,12 @@ static int dial_exec_full(struct ast_channel *chan, const char *data, struct ast
if (outbound_group) if (outbound_group)
ast_app_group_set_channel(tc, 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 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)) if (ast_test_flag(ast_channel_flags(chan), AST_FLAG_ANSWERED_ELSEWHERE))
ast_set_flag(tc, AST_FLAG_ANSWERED_ELSEWHERE); ast_set_flag(ast_channel_flags(tc), AST_FLAG_ANSWERED_ELSEWHERE);
/* Check if we're forced by configuration */ /* Check if we're forced by configuration */
if (ast_test_flag64(&opts, OPT_CANCEL_ELSEWHERE)) 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 */ /* Inherit context and extension */
@ -2509,13 +2509,13 @@ static int dial_exec_full(struct ast_channel *chan, const char *data, struct ast
ast_log(LOG_ERROR, "error streaming file '%s' to callee\n", opt_args[OPT_ARG_ANNOUNCE]); 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)) { while (ast_channel_stream(peer)) {
int ms; int ms;
ms = ast_sched_wait(ast_channel_sched(peer)); ms = ast_sched_wait(ast_channel_sched(peer));
if (ms < 0 && !peer->timingfunc) { if (ms < 0 && !ast_channel_timingfunc(peer)) {
ast_stopstream(peer); ast_stopstream(peer);
break; break;
} }
@ -2557,7 +2557,7 @@ static int dial_exec_full(struct ast_channel *chan, const char *data, struct ast
} }
ast_sched_runq(ast_channel_sched(peer)); 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])) { if (chan && peer && ast_test_flag64(&opts, OPT_GOTO) && !ast_strlen_zero(opt_args[OPT_ARG_GOTO])) {
@ -2847,8 +2847,8 @@ static int dial_exec_full(struct ast_channel *chan, const char *data, struct ast
ast_channel_exten_set(peer, "h"); ast_channel_exten_set(peer, "h");
ast_channel_priority_set(peer, 1); ast_channel_priority_set(peer, 1);
autoloopflag = ast_test_flag(peer, AST_FLAG_IN_AUTOLOOP); /* save value to restore at the end */ autoloopflag = ast_test_flag(ast_channel_flags(peer), AST_FLAG_IN_AUTOLOOP); /* save value to restore at the end */
ast_set_flag(peer, AST_FLAG_IN_AUTOLOOP); 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), while ((res9 = ast_spawn_extension(peer, ast_channel_context(peer), ast_channel_exten(peer),
ast_channel_priority(peer), ast_channel_priority(peer),
@ -2862,7 +2862,7 @@ static int dial_exec_full(struct ast_channel *chan, const char *data, struct ast
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_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_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_check_hangup(peer) && ast_test_flag64(&opts, OPT_CALLEE_GO_ON)) {
if(!ast_strlen_zero(opt_args[OPT_ARG_CALLEE_GO_ON])) { if(!ast_strlen_zero(opt_args[OPT_ARG_CALLEE_GO_ON])) {
@ -2985,7 +2985,7 @@ static int retrydial_exec(struct ast_channel *chan, const char *data)
int continue_exec; int continue_exec;
ast_channel_data_set(chan, "Retrying"); 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); ast_moh_stop(chan);
res = dial_exec_full(chan, args.dialdata, &peerflags, &continue_exec); res = dial_exec_full(chan, args.dialdata, &peerflags, &continue_exec);
@ -3002,7 +3002,7 @@ static int retrydial_exec(struct ast_channel *chan, const char *data)
ast_log(LOG_WARNING, "Announce file \"%s\" specified in Retrydial does not exist\n", args.announce); ast_log(LOG_WARNING, "Announce file \"%s\" specified in Retrydial does not exist\n", args.announce);
} }
if (!res && sleepms) { 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); ast_moh_start(chan, NULL, NULL);
res = ast_waitfordigit(chan, sleepms); res = ast_waitfordigit(chan, sleepms);
} }
@ -3015,7 +3015,7 @@ static int retrydial_exec(struct ast_channel *chan, const char *data)
ast_log(LOG_WARNING, "Announce file \"%s\" specified in Retrydial does not exist\n", args.announce); ast_log(LOG_WARNING, "Announce file \"%s\" specified in Retrydial does not exist\n", args.announce);
} }
if (sleepms) { 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); ast_moh_start(chan, NULL, NULL);
if (!res) if (!res)
res = ast_waitfordigit(chan, sleepms); res = ast_waitfordigit(chan, sleepms);
@ -3038,7 +3038,7 @@ static int retrydial_exec(struct ast_channel *chan, const char *data)
else if (res == 1) else if (res == 1)
res = 0; 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); ast_moh_stop(chan);
done: done:
return res; return res;

@ -204,7 +204,7 @@ static int disa_exec(struct ast_channel *chan, const char *data)
play_dialtone(chan, args.mailbox); 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 (;;) { for (;;) {
/* if outa time, give em reorder */ /* if outa time, give em reorder */
@ -220,7 +220,7 @@ static int disa_exec(struct ast_channel *chan, const char *data)
} }
if (!(f = ast_read(chan))) { 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; return -1;
} }
@ -228,7 +228,7 @@ static int disa_exec(struct ast_channel *chan, const char *data)
if (f->data.uint32) if (f->data.uint32)
ast_channel_hangupcause_set(chan, f->data.uint32); ast_channel_hangupcause_set(chan, f->data.uint32);
ast_frfree(f); 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; return -1;
} }
@ -257,7 +257,7 @@ static int disa_exec(struct ast_channel *chan, const char *data)
fp = fopen(args.passcode,"r"); fp = fopen(args.passcode,"r");
if (!fp) { if (!fp) {
ast_log(LOG_WARNING,"DISA password file %s not found on chan %s\n",args.passcode,ast_channel_name(chan)); 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; return -1;
} }
pwline[0] = 0; pwline[0] = 0;
@ -353,7 +353,7 @@ static int disa_exec(struct ast_channel *chan, const char *data)
} }
} }
ast_clear_flag(chan, AST_FLAG_END_DTMF_ONLY); ast_clear_flag(ast_channel_flags(chan), AST_FLAG_END_DTMF_ONLY);
if (k == 3) { if (k == 3) {
int recheck = 0; int recheck = 0;

@ -158,7 +158,7 @@ static int serialize_showchan(struct ast_channel *c, char *buf, size_t size)
hour, hour,
min, min,
sec, 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_bridged_channel(c) ? ast_channel_name(ast_bridged_channel(c)) : "<none>",
ast_channel_context(c), ast_channel_context(c),
ast_channel_exten(c), ast_channel_exten(c),
@ -167,7 +167,7 @@ static int serialize_showchan(struct ast_channel *c, char *buf, size_t size)
ast_print_group(pgrp, sizeof(pgrp), ast_channel_pickupgroup(c)), ast_print_group(pgrp, sizeof(pgrp), ast_channel_pickupgroup(c)),
ast_channel_appl(c) ? ast_channel_appl(c) : "(N/A)", ast_channel_appl(c) ? ast_channel_appl(c) : "(N/A)",
ast_channel_data(c) ? S_OR(ast_channel_data(c), "(Empty)") : "(None)", 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; return 0;
} }

@ -640,7 +640,7 @@ static int eivr_comm(struct ast_channel *chan, struct ivr_localuser *u,
} }
while (1) { 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"); ast_chan_log(LOG_ERROR, chan, "Is a zombie\n");
break; break;
} }

@ -645,7 +645,7 @@ static struct ast_channel *wait_for_winner(struct findme_user_listptr *findme_us
tmpto = ast_sched_wait(ast_channel_sched(tmpuser->ochan)); tmpto = ast_sched_wait(ast_channel_sched(tmpuser->ochan));
if (tmpto > 0 && tmpto < to) if (tmpto > 0 && tmpto < to)
to = tmpto; to = tmpto;
else if (tmpto < 0 && !tmpuser->ochan->timingfunc) { else if (tmpto < 0 && !ast_channel_timingfunc(tmpuser->ochan)) {
ast_stopstream(tmpuser->ochan); ast_stopstream(tmpuser->ochan);
if (tmpuser->state == 1) { if (tmpuser->state == 1) {
ast_verb(3, "Playback of the call-from file appears to be done.\n"); ast_verb(3, "Playback of the call-from file appears to be done.\n");

@ -373,8 +373,8 @@ static int _macro_exec(struct ast_channel *chan, const char *data, int exclusive
argc++; argc++;
} }
ast_channel_unlock(chan); ast_channel_unlock(chan);
autoloopflag = ast_test_flag(chan, AST_FLAG_IN_AUTOLOOP); autoloopflag = ast_test_flag(ast_channel_flags(chan), AST_FLAG_IN_AUTOLOOP);
ast_set_flag(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), 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))) { S_COR(ast_channel_caller(chan)->id.number.valid, ast_channel_caller(chan)->id.number.str, NULL))) {
struct ast_context *c; struct ast_context *c;
@ -512,7 +512,7 @@ static int _macro_exec(struct ast_channel *chan, const char *data, int exclusive
/* Reset the depth back to what it was when the routine was entered (like if we called Macro recursively) */ /* 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); snprintf(depthc, sizeof(depthc), "%d", depth);
pbx_builtin_setvar_helper(chan, "MACRO_DEPTH", depthc); 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++) { for (x = 1; x < argc; x++) {
/* Restore old arguments and delete ours */ /* Restore old arguments and delete ours */

@ -375,7 +375,7 @@ static int startmon(struct ast_channel *chan, struct ast_audiohook *audiohook)
ast_audiohook_attach(chan, audiohook); 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); ast_softhangup(peer, AST_SOFTHANGUP_UNBRIDGE);
return res; return res;

@ -137,7 +137,7 @@ static int parkandannounce_exec(struct ast_channel *chan, const char *data)
ast_verb(3, "Dial Tech,String: (%s,%s)\n", dialtech, args.dial); ast_verb(3, "Dial Tech,String: (%s,%s)\n", dialtech, args.dial);
if (!ast_strlen_zero(args.return_context)) { 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); ast_parseable_goto(chan, args.return_context);
} }

@ -3023,7 +3023,7 @@ static void hangupcalls(struct callattempt *outgoing, struct ast_channel *except
/* Hangup any existing lines we have open */ /* Hangup any existing lines we have open */
if (outgoing->chan && (outgoing->chan != exception)) { if (outgoing->chan && (outgoing->chan != exception)) {
if (exception || cancel_answered_elsewhere) 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); ast_hangup(outgoing->chan);
} }
oo = outgoing; oo = outgoing;
@ -3273,7 +3273,7 @@ static int ring_entry(struct queue_ent *qe, struct callattempt *tmp, int *busies
ast_channel_lock_both(tmp->chan, qe->chan); ast_channel_lock_both(tmp->chan, qe->chan);
if (qe->cancel_answered_elsewhere) { 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_appl_set(tmp->chan, "AppQueue");
ast_channel_data_set(tmp->chan, "(Outgoing Line)"); ast_channel_data_set(tmp->chan, "(Outgoing Line)");
@ -4646,7 +4646,7 @@ static int try_calling(struct queue_ent *qe, const struct ast_flags opts, char *
/* if the calling channel has the ANSWERED_ELSEWHERE flag set, make sure this is inherited. /* if the calling channel has the ANSWERED_ELSEWHERE flag set, make sure this is inherited.
(this is mainly to support chan_local) (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; qe->cancel_answered_elsewhere = 1;
} }

@ -721,7 +721,7 @@ static int speech_background(struct ast_channel *chan, const char *data)
/* Okay it's streaming so go into a loop grabbing frames! */ /* Okay it's streaming so go into a loop grabbing frames! */
while (done == 0) { while (done == 0) {
/* If the filename is null and stream is not running, start up a new sound file */ /* 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 */ /* Discard old stream information */
ast_stopstream(chan); ast_stopstream(chan);
/* Start new stream */ /* Start new stream */
@ -769,7 +769,7 @@ static int speech_background(struct ast_channel *chan, const char *data)
switch (speech->state) { switch (speech->state) {
case AST_SPEECH_STATE_READY: case AST_SPEECH_STATE_READY:
/* If audio playback has stopped do a check for timeout purposes */ /* 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); ast_stopstream(chan);
if (!quieted && ast_channel_stream(chan) == NULL && timeout && started == 0 && !filename_tmp) { if (!quieted && ast_channel_stream(chan) == NULL && timeout && started == 0 && !filename_tmp) {
if (timeout == -1) { if (timeout == -1) {
@ -795,7 +795,7 @@ static int speech_background(struct ast_channel *chan, const char *data)
speech_streamfile(chan, speech->processing_sound, ast_channel_language(chan)); 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); ast_stopstream(chan);
if (speech->processing_sound != NULL) { if (speech->processing_sound != NULL) {
if (strlen(speech->processing_sound) > 0 && strcasecmp(speech->processing_sound, "none")) { if (strlen(speech->processing_sound) > 0 && strcasecmp(speech->processing_sound, "none")) {

@ -445,10 +445,10 @@ static int gosub_exec(struct ast_channel *chan, const char *data)
} }
if (!ast_exists_extension(chan, ast_channel_context(chan), ast_channel_exten(chan), 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))) { 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_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_context_set(chan, newframe->context);
ast_channel_exten_set(chan, newframe->extension); ast_channel_exten_set(chan, newframe->extension);
ast_channel_priority_set(chan, newframe->priority - 1); ast_channel_priority_set(chan, newframe->priority - 1);

@ -151,7 +151,7 @@ static int background_detect_exec(struct ast_channel *chan, const char *data)
detection_start = ast_tvnow(); detection_start = ast_tvnow();
while (ast_channel_stream(chan)) { while (ast_channel_stream(chan)) {
res = ast_sched_wait(ast_channel_sched(chan)); res = ast_sched_wait(ast_channel_sched(chan));
if ((res < 0) && !chan->timingfunc) { if ((res < 0) && !ast_channel_timingfunc(chan)) {
res = 0; res = 0;
break; break;
} }

@ -236,11 +236,11 @@ static void *multiplexed_thread_function(void *data)
} }
} }
} }
if (winner && winner->bridge) { if (winner && ast_channel_internal_bridge(winner)) {
struct ast_bridge *bridge = winner->bridge; struct ast_bridge *bridge = ast_channel_internal_bridge(winner);
int stop = 0; int stop = 0;
ao2_unlock(multiplexed_thread); ao2_unlock(multiplexed_thread);
while ((bridge = winner->bridge) && ao2_trylock(bridge)) { while ((bridge = ast_channel_internal_bridge(winner)) && ao2_trylock(bridge)) {
sched_yield(); sched_yield();
if (multiplexed_thread->thread == AST_PTHREADT_STOP) { if (multiplexed_thread->thread == AST_PTHREADT_STOP) {
stop = 1; stop = 1;

@ -601,7 +601,7 @@ static struct ast_frame *agent_read(struct ast_channel *ast)
p->start = cur_time; p->start = cur_time;
} }
if (p->chan) { 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)); 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); f = ast_read(p->chan);
} else } else
@ -609,7 +609,7 @@ static struct ast_frame *agent_read(struct ast_channel *ast)
if (!f) { if (!f) {
/* If there's a channel, make it NULL */ /* If there's a channel, make it NULL */
if (p->chan) { if (p->chan) {
p->chan->_bridge = NULL; ast_channel_internal_bridged_channel_set(p->chan, NULL);
p->chan = NULL; p->chan = NULL;
ast_devstate_changed(AST_DEVICE_UNAVAILABLE, "Agent/%s", p->agent); ast_devstate_changed(AST_DEVICE_UNAVAILABLE, "Agent/%s", p->agent);
p->acknowledged = 0; p->acknowledged = 0;
@ -697,11 +697,11 @@ static struct ast_frame *agent_read(struct ast_channel *ast)
} }
CLEANUP(ast,p); 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")) { 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) 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); ast_mutex_unlock(&p->lock);
@ -964,7 +964,7 @@ static int agent_hangup(struct ast_channel *ast)
} else } else
p->start = 0; p->start = 0;
if (p->chan) { 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 they're dead, go ahead and hang up on the agent now */
if (p->dead) { if (p->dead) {
ast_channel_lock(p->chan); ast_channel_lock(p->chan);
@ -1083,8 +1083,8 @@ static struct ast_channel *agent_bridgedchannel(struct ast_channel *chan, struct
if (p) { if (p) {
if (chan == p->chan) if (chan == p->chan)
ret = bridge->_bridge; ret = ast_channel_internal_bridged_channel(bridge);
else if (chan == bridge->_bridge) else if (chan == ast_channel_internal_bridged_channel(bridge))
ret = p->chan; ret = p->chan;
} }
@ -1586,7 +1586,7 @@ static int action_agents(struct mansession *s, const struct message *m)
if (p->chan) { if (p->chan) {
loginChan = ast_strdupa(ast_channel_name(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, talkingto = S_COR(ast_channel_caller(p->chan)->id.number.valid,
ast_channel_caller(p->chan)->id.number.str, "n/a"); ast_channel_caller(p->chan)->id.number.str, "n/a");
if ((bridge = ast_bridged_channel(owner))) { if ((bridge = ast_bridged_channel(owner))) {

@ -121,12 +121,12 @@ static int bridge_call(struct ast_channel *ast, const char *dest, int timeout)
struct bridge_pvt *p = ast_channel_tech_pvt(ast); struct bridge_pvt *p = ast_channel_tech_pvt(ast);
/* If no bridge has been provided on the input channel, bail out */ /* If no bridge has been provided on the input channel, bail out */
if (!ast->bridge) { if (!ast_channel_internal_bridge(ast)) {
return -1; return -1;
} }
/* Impart the output channel upon the given bridge of the input channel */ /* 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; return 0;
} }

@ -7741,7 +7741,7 @@ static int attempt_transfer(struct dahdi_pvt *p)
} else { } else {
ast_debug(1, "Neither %s nor %s are in a bridge, nothing to transfer\n", 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_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 -1;
} }
return 0; return 0;
@ -9150,7 +9150,7 @@ static struct ast_frame *dahdi_read(struct ast_channel *ast)
readbuf = ((unsigned char *)p->subs[idx].buffer) + AST_FRIENDLY_OFFSET; readbuf = ((unsigned char *)p->subs[idx].buffer) + AST_FRIENDLY_OFFSET;
CHECK_BLOCKING(ast); CHECK_BLOCKING(ast);
res = read(p->subs[idx].dfd, readbuf, p->subs[idx].linear ? READ_SIZE * 2 : READ_SIZE); 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 */ /* Check for hangup */
if (res < 0) { if (res < 0) {
f = NULL; f = NULL;
@ -10549,7 +10549,7 @@ static void *analog_ss_thread(void *data)
* emulation. The DTMF digits can come so fast that emulation * emulation. The DTMF digits can come so fast that emulation
* can drop some of them. * 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. */ res = 4000;/* This is a typical OFF time between rings. */
for (;;) { for (;;) {
struct ast_frame *f; struct ast_frame *f;
@ -10580,7 +10580,7 @@ static void *analog_ss_thread(void *data)
ast_channel_state(chan) == AST_STATE_RINGING) ast_channel_state(chan) == AST_STATE_RINGING)
break; /* Got ring */ 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'; dtmfbuf[k] = '\0';
dahdi_setlinear(p->subs[idx].dfd, p->subs[idx].linear); dahdi_setlinear(p->subs[idx].dfd, p->subs[idx].linear);
/* Got cid and ring. */ /* Got cid and ring. */

@ -339,8 +339,8 @@ static struct ast_channel *local_bridgedchannel(struct ast_channel *chan, struct
/* Now see if the opposite channel is bridged to anything */ /* Now see if the opposite channel is bridged to anything */
if (!bridged) { if (!bridged) {
bridged = bridge; bridged = bridge;
} else if (bridged->_bridge) { } else if (ast_channel_internal_bridged_channel(bridged)) {
bridged = bridged->_bridge; bridged = ast_channel_internal_bridged_channel(bridged);
} }
} }
@ -502,7 +502,7 @@ static void check_bridge(struct local_pvt *p)
/* since we had to unlock p to get the bridged chan, validate our /* 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 * data once again and verify the bridged channel is what we expect
* it to be in order to perform this optimization */ * 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; return;
} }
@ -511,24 +511,24 @@ static void check_bridge(struct local_pvt *p)
frames on the owner channel (because they would be transferred to the frames on the owner channel (because they would be transferred to the
outbound channel during the masquerade) 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 */ /* Masquerade bridged channel into owner */
/* Lock everything we need, one by one, and give up if /* Lock everything we need, one by one, and give up if
we can't get everything. Remember, we'll get another we can't get everything. Remember, we'll get another
chance in just a little bit */ chance in just a little bit */
if (!ast_channel_trylock(p->chan->_bridge)) { if (!ast_channel_trylock(ast_channel_internal_bridged_channel(p->chan))) {
if (!ast_check_hangup(p->chan->_bridge)) { if (!ast_check_hangup(ast_channel_internal_bridged_channel(p->chan))) {
if (!ast_channel_trylock(p->owner)) { if (!ast_channel_trylock(p->owner)) {
if (!ast_check_hangup(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 /* 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, * 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 * pre-swapping the monitors before the masquerade will ensure that the monitor
* ends up where it is expected. * ends up where it is expected.
*/ */
tmp = ast_channel_monitor(p->owner); tmp = ast_channel_monitor(p->owner);
ast_channel_monitor_set(p->owner, ast_channel_monitor(p->chan->_bridge)); ast_channel_monitor_set(p->owner, ast_channel_monitor(ast_channel_internal_bridged_channel(p->chan)));
ast_channel_monitor_set(p->chan->_bridge, tmp); ast_channel_monitor_set(ast_channel_internal_bridged_channel(p->chan), tmp);
} }
if (ast_channel_audiohooks(p->chan)) { if (ast_channel_audiohooks(p->chan)) {
struct ast_audiohook_list *audiohooks_swapper; struct ast_audiohook_list *audiohooks_swapper;
@ -547,26 +547,26 @@ static void check_bridge(struct local_pvt *p)
if (ast_channel_caller(p->owner)->id.name.valid || ast_channel_caller(p->owner)->id.number.valid 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)->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) { || 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 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)->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) { || 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) { 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_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_set_flag(p, LOCAL_ALREADY_MASQED);
} }
ast_channel_unlock(p->owner); ast_channel_unlock(p->owner);
} }
} }
ast_channel_unlock(p->chan->_bridge); ast_channel_unlock(ast_channel_internal_bridged_channel(p->chan));
} }
} }
} }
@ -629,7 +629,7 @@ static int local_fixup(struct ast_channel *oldchan, struct ast_channel *newchan)
} }
/* Do not let a masquerade cause a Local channel to be bridged to itself! */ /* 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"); ast_log(LOG_WARNING, "You can not bridge a Local channel to itself!\n");
ao2_unlock(p); ao2_unlock(p);
ast_queue_hangup(newchan); ast_queue_hangup(newchan);
@ -859,8 +859,8 @@ static int local_call(struct ast_channel *ast, const char *dest, int timeout)
ast_channel_cc_params_init(chan, ast_channel_get_cc_config_params(owner)); 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 */ /* 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)) { if (ast_test_flag(ast_channel_flags(ast), AST_FLAG_ANSWERED_ELSEWHERE)) {
ast_set_flag(chan, 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 */ /* copy the channel variables from the incoming channel to the outgoing channel */
@ -980,8 +980,8 @@ static int local_hangup(struct ast_channel *ast)
isoutbound = IS_OUTBOUND(ast, p); /* just comparing pointer of ast */ isoutbound = IS_OUTBOUND(ast, p); /* just comparing pointer of ast */
if (p->chan && ast_test_flag(ast, AST_FLAG_ANSWERED_ELSEWHERE)) { if (p->chan && ast_test_flag(ast_channel_flags(ast), AST_FLAG_ANSWERED_ELSEWHERE)) {
ast_set_flag(p->chan, 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"); ast_debug(2, "This local call has the ANSWERED_ELSEWHERE flag set.\n");
} }

@ -563,7 +563,7 @@ static struct ast_frame *phone_read(struct ast_channel *ast)
/* Try to read some data... */ /* Try to read some data... */
CHECK_BLOCKING(ast); CHECK_BLOCKING(ast);
res = read(p->fd, p->buf, PHONE_MAX_BUF); 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 (res < 0) {
#if 0 #if 0
if (errno == EAGAIN) { if (errno == EAGAIN) {

@ -6328,7 +6328,7 @@ static int sip_hangup(struct ast_channel *ast)
ast_debug(1, "Asked to hangup channel that was not connected\n"); ast_debug(1, "Asked to hangup channel that was not connected\n");
return 0; 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"); ast_debug(1, "This call was answered elsewhere");
if (ast_channel_hangupcause(ast) == AST_CAUSE_ANSWERED_ELSEWHERE) { if (ast_channel_hangupcause(ast) == AST_CAUSE_ANSWERED_ELSEWHERE) {
ast_debug(1, "####### It's the cause code, buddy. The cause code!!!\n"); ast_debug(1, "####### It's the cause code, buddy. The cause code!!!\n");
@ -6358,7 +6358,7 @@ static int sip_hangup(struct ast_channel *ast)
return 0; return 0;
} }
if (ast_test_flag(ast, AST_FLAG_ZOMBIE)) { if (ast_test_flag(ast_channel_flags(ast), AST_FLAG_ZOMBIE)) {
if (p->refer) 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); ast_debug(1, "SIP Transfer: Hanging up Zombie channel %s after transfer ... Call-ID: %s\n", ast_channel_name(ast), p->callid);
else else
@ -6690,9 +6690,9 @@ static int sip_fixup(struct ast_channel *oldchan, struct ast_channel *newchan)
int ret = -1; int ret = -1;
struct sip_pvt *p; 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"); 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"); ast_debug(1, "Old channel is zombie\n");
if (!newchan || !ast_channel_tech_pvt(newchan)) { if (!newchan || !ast_channel_tech_pvt(newchan)) {
@ -22415,7 +22415,7 @@ static int sip_pickup(struct ast_channel *chan)
static void ast_quiet_chan(struct ast_channel *chan) static void ast_quiet_chan(struct ast_channel *chan)
{ {
if (chan && ast_channel_state(chan) == AST_STATE_UP) { 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); ast_moh_stop(chan);
else if (ast_channel_generatordata(chan)) else if (ast_channel_generatordata(chan))
ast_deactivate_generator(chan); ast_deactivate_generator(chan);

@ -2306,7 +2306,7 @@ static int write_history(struct unistimsession *pte, char way, char ismissed)
static void unistim_quiet_chan(struct ast_channel *chan) static void unistim_quiet_chan(struct ast_channel *chan)
{ {
if (chan && ast_channel_state(chan) == AST_STATE_UP) { 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); ast_moh_stop(chan);
} else if (ast_channel_generatordata(chan)) { } else if (ast_channel_generatordata(chan)) {
ast_deactivate_generator(chan); ast_deactivate_generator(chan);
@ -2959,11 +2959,11 @@ static void swap_subs(struct unistim_subchannel *a, struct unistim_subchannel *b
/* Step 1 : Music On Hold for peer, Dialing screen for us */ /* Step 1 : Music On Hold for peer, Dialing screen for us */
static void transfer_call_step1(struct unistimsession *pte) 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; struct unistim_device *d = pte->device;
sub = get_sub(d, SUB_REAL); sub = get_sub(d, SUB_REAL);
sub_trans = get_sub(d, SUB_THREEWAY); /* sub_trans = get_sub(d, SUB_THREEWAY); */
if (!sub || !sub->owner) { if (!sub || !sub->owner) {
ast_log(LOG_WARNING, "Unable to find subchannel for music on hold\n"); ast_log(LOG_WARNING, "Unable to find subchannel for music on hold\n");
@ -4856,7 +4856,7 @@ static int unistim_hangup(struct ast_channel *ast)
refresh_all_favorite(s); /* Update favicons in case of DND keys */ refresh_all_favorite(s); /* Update favicons in case of DND keys */
if (s->state == STATE_RINGING && sub->subtype == SUB_RING) { if (s->state == STATE_RINGING && sub->subtype == SUB_RING) {
send_no_ring(s); 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++; d->missed_call++;
write_history(s, 'i', 1); write_history(s, 'i', 1);
} }
@ -5872,7 +5872,7 @@ static char *unistim_show_info(struct ast_cli_entry *e, int cmd, struct ast_cli_
if (!sub->owner) { if (!sub->owner) {
tmp = (void *) -42; tmp = (void *) -42;
} else { } else {
tmp = sub->owner->_bridge; tmp = ast_channel_internal_bridged_channel(sub->owner);
} }
ast_cli(a->fd, ast_cli(a->fd,
"-->subtype=%s chan=%p rtp=%p bridge=%p line=%p alreadygone=%d softkey=%d\n", "-->subtype=%s chan=%p rtp=%p bridge=%p line=%p alreadygone=%d softkey=%d\n",

@ -2257,8 +2257,8 @@ static void *do_chanreads(void *pvt)
bridgerec = 0; bridgerec = 0;
} else { } else {
ast_verb(5, "%s: chanreads: No native bridge.\n", p->dev); ast_verb(5, "%s: chanreads: No native bridge.\n", p->dev);
if (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(p->owner->_bridge)); 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; bridgerec = 1;
} else { } else {
bridgerec = 0; bridgerec = 0;

@ -2402,7 +2402,7 @@ static void *__analog_ss_thread(void *data)
* emulation. The DTMF digits can come so fast that emulation * emulation. The DTMF digits can come so fast that emulation
* can drop some of them. * 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. */ res = 4000;/* This is a typical OFF time between rings. */
for (;;) { for (;;) {
struct ast_frame *f; struct ast_frame *f;
@ -2435,7 +2435,7 @@ static void *__analog_ss_thread(void *data)
break; /* Got ring */ 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'; dtmfbuf[k] = '\0';
analog_set_linear_mode(p, idx, oldlinearity); analog_set_linear_mode(p, idx, oldlinearity);

@ -713,6 +713,7 @@ AST_LIST_HEAD_NOLOCK(ast_datastore_list, ast_datastore);
AST_LIST_HEAD_NOLOCK(ast_autochan_list, ast_autochan); AST_LIST_HEAD_NOLOCK(ast_autochan_list, ast_autochan);
AST_LIST_HEAD_NOLOCK(ast_readq_list, ast_frame); 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 * \page AstChannel ast_channel locking and reference tracking
* *
@ -764,151 +765,7 @@ AST_LIST_HEAD_NOLOCK(ast_readq_list, ast_frame);
* gets called before the channel goes away. * gets called before the channel goes away.
*/ */
/*! struct ast_channel;
* \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 */
};
/*! \brief ast_channel_tech Properties */ /*! \brief ast_channel_tech Properties */
enum { enum {
@ -2473,12 +2330,12 @@ static inline enum ast_t38_state ast_channel_get_t38_state(struct ast_channel *c
} }
#define CHECK_BLOCKING(c) do { \ #define CHECK_BLOCKING(c) do { \
if (ast_test_flag(c, AST_FLAG_BLOCKING)) {\ 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) (c)->blocker, ast_channel_blockproc(c)); \ 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 { \ } else { \
(c)->blocker = pthread_self(); \ ast_channel_blocker_set((c), pthread_self()); \
ast_channel_blockproc_set((c), __PRETTY_FUNCTION__); \ 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) } } while (0)
ast_group_t ast_get_group(const char *s); ast_group_t ast_get_group(const char *s);
@ -3739,50 +3596,50 @@ unsigned long ast_channel_insmpl(const struct ast_channel *chan);
void ast_channel_insmpl_set(struct ast_channel *chan, unsigned long value); void ast_channel_insmpl_set(struct ast_channel *chan, unsigned long value);
unsigned long ast_channel_outsmpl(const struct ast_channel *chan); 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_outsmpl_set(struct ast_channel *chan, unsigned long value);
void * ast_channel_generatordata(const struct ast_channel *chan); void *ast_channel_generatordata(const struct ast_channel *chan);
void ast_channel_generatordata_set(struct ast_channel *chan, void * value); 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(const struct ast_channel *chan);
void ast_channel_music_state_set(struct ast_channel *chan, void * value); 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(const struct ast_channel *chan);
void ast_channel_tech_pvt_set(struct ast_channel *chan, void * value); 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(const struct ast_channel *chan);
void ast_channel_timingdata_set(struct ast_channel *chan, void * value); void ast_channel_timingdata_set(struct ast_channel *chan, void *value);
struct ast_audiohook_list * ast_channel_audiohooks(const struct ast_channel *chan); 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); 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); struct ast_cdr *ast_channel_cdr(const struct ast_channel *chan);
void ast_channel_cdr_set(struct ast_channel *chan, struct ast_cdr * value); void ast_channel_cdr_set(struct ast_channel *chan, struct ast_cdr *value);
struct ast_channel * ast_channel__bridge(const struct ast_channel *chan); struct ast_channel *ast_channel__bridge(const struct ast_channel *chan);
void ast_channel__bridge_set(struct ast_channel *chan, struct ast_channel * value); void ast_channel__bridge_set(struct ast_channel *chan, struct ast_channel *value);
struct ast_channel * ast_channel_masq(const struct ast_channel *chan); struct ast_channel *ast_channel_masq(const struct ast_channel *chan);
void ast_channel_masq_set(struct ast_channel *chan, struct ast_channel * value); void ast_channel_masq_set(struct ast_channel *chan, struct ast_channel *value);
struct ast_channel * ast_channel_masqr(const struct ast_channel *chan); struct ast_channel *ast_channel_masqr(const struct ast_channel *chan);
void ast_channel_masqr_set(struct ast_channel *chan, struct ast_channel * value); 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); 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); 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); struct ast_filestream *ast_channel_stream(const struct ast_channel *chan);
void ast_channel_stream_set(struct ast_channel *chan, struct ast_filestream * value); void ast_channel_stream_set(struct ast_channel *chan, struct ast_filestream *value);
struct ast_filestream * ast_channel_vstream(const struct ast_channel *chan); struct ast_filestream *ast_channel_vstream(const struct ast_channel *chan);
void ast_channel_vstream_set(struct ast_channel *chan, struct ast_filestream * value); 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); 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); 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); 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); 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); struct ast_generator *ast_channel_generator(const struct ast_channel *chan);
void ast_channel_generator_set(struct ast_channel *chan, struct ast_generator * value); void ast_channel_generator_set(struct ast_channel *chan, struct ast_generator *value);
struct ast_pbx * ast_channel_pbx(const struct ast_channel *chan); struct ast_pbx *ast_channel_pbx(const struct ast_channel *chan);
void ast_channel_pbx_set(struct ast_channel *chan, struct ast_pbx * value); 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); 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); 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); struct ast_timer *ast_channel_timer(const struct ast_channel *chan);
void ast_channel_timer_set(struct ast_channel *chan, struct ast_timer * value); 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); 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); 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); 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); 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); 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); 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); 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_tech_set(struct ast_channel *chan, const struct ast_channel_tech *value);
enum ast_channel_adsicpe ast_channel_adsicpe(const struct ast_channel *chan); 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); 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); enum ast_channel_state ast_channel_state(const struct ast_channel *chan);
@ -3792,7 +3649,7 @@ void ast_channel_state_set(struct ast_channel *chan, enum ast_channel_state);
void ast_channel_softhangup_internal_flag_set(struct ast_channel *chan, int value); 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_add(struct ast_channel *chan, int value);
void ast_channel_softhangup_internal_flag_clear(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 */ /* Format getters */
struct ast_format *ast_channel_oldwriteformat(struct ast_channel *chan); struct ast_format *ast_channel_oldwriteformat(struct ast_channel *chan);
@ -3865,4 +3722,18 @@ int ast_channel_fd_isset(const struct ast_channel *chan, int which);
struct ast_epoll_data *ast_channel_internal_epfd_data(const struct ast_channel *chan, int which); 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); void ast_channel_internal_epfd_data_set(struct ast_channel *chan, int which , struct ast_epoll_data *value);
#endif #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 */ #endif /* _ASTERISK_CHANNEL_H */

@ -558,9 +558,9 @@ static void *linear_alloc(struct ast_channel *chan, void *params)
/* In this case, params is already malloc'd */ /* In this case, params is already malloc'd */
if (ls->allowoverride) { if (ls->allowoverride) {
ast_set_flag(chan, AST_FLAG_WRITE_INT); ast_set_flag(ast_channel_flags(chan), AST_FLAG_WRITE_INT);
} else { } 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)); ast_format_copy(&ls->origwfmt, ast_channel_writeformat(chan));

@ -198,9 +198,9 @@ int ast_autoservice_start(struct ast_channel *chan)
as->use_count = 1; as->use_count = 1;
ast_channel_lock(chan); 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) 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_channel_unlock(chan);
AST_LIST_LOCK(&aslist); AST_LIST_LOCK(&aslist);
@ -282,7 +282,7 @@ int ast_autoservice_stop(struct ast_channel *chan)
} }
if (!as->orig_end_dtmf_flag) { 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); ast_channel_lock(chan);

@ -818,7 +818,7 @@ static void bridge_channel_feature(struct ast_bridge *bridge, struct ast_bridge_
int look_for_dtmf = 1, dtmf_len = 0; 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 */ /* 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. */ /* 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) { while (look_for_dtmf) {
@ -863,7 +863,7 @@ static void bridge_channel_feature(struct ast_bridge *bridge, struct ast_bridge_
} }
/* Since we are done bringing DTMF in return to using both begin and end frames */ /* 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 a hook was actually matched execute it on this channel, otherwise stream up the DTMF to the other channels */
if (hook) { if (hook) {
@ -967,7 +967,7 @@ static enum ast_bridge_channel_state bridge_channel_join(struct ast_bridge_chann
/* Actually execute the respective threading model, and keep our bridge thread alive */ /* Actually execute the respective threading model, and keep our bridge thread alive */
while (bridge_channel->state == AST_BRIDGE_CHANNEL_STATE_WAIT) { while (bridge_channel->state == AST_BRIDGE_CHANNEL_STATE_WAIT) {
/* Update bridge pointer on channel */ /* 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 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)) { if (bridge_channel->bridge->thread == AST_PTHREADT_NULL && (bridge_channel->bridge->technology->capabilities & AST_BRIDGE_CAPABILITY_THREAD)) {
bridge_channel->bridge->stop = 0; bridge_channel->bridge->stop = 0;
@ -1006,7 +1006,7 @@ static enum ast_bridge_channel_state bridge_channel_join(struct ast_bridge_chann
} }
} }
bridge_channel->chan->bridge = NULL; ast_channel_internal_bridge_set(bridge_channel->chan, NULL);
/* See if we need to dissolve the bridge itself if they hung up */ /* See if we need to dissolve the bridge itself if they hung up */
if (bridge_channel->state == AST_BRIDGE_CHANNEL_STATE_END) { if (bridge_channel->state == AST_BRIDGE_CHANNEL_STATE_END) {

@ -67,6 +67,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
#include "asterisk/stringfields.h" #include "asterisk/stringfields.h"
#include "asterisk/global_datastores.h" #include "asterisk/global_datastores.h"
#include "asterisk/data.h" #include "asterisk/data.h"
#include "asterisk/channel_internal.h"
#ifdef HAVE_EPOLL #ifdef HAVE_EPOLL
#include <sys/epoll.h> #include <sys/epoll.h>
@ -928,21 +929,12 @@ __ast_channel_alloc_ap(int needqueue, int state, const char *cid_num, const char
struct ast_timer *timer; struct ast_timer *timer;
/* If shutting down, don't allocate any new channels */ /* 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"); ast_log(LOG_WARNING, "Channel allocation failed: Refusing due to active shutdown\n");
return NULL; return NULL;
} }
#if defined(REF_DEBUG) if (!(tmp = ast_channel_internal_alloc(ast_channel_destructor))) {
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) {
/* Channel structure allocation failure. */ /* Channel structure allocation failure. */
return NULL; return NULL;
} }
@ -999,10 +991,6 @@ __ast_channel_alloc_ap(int needqueue, int state, const char *cid_num, const char
ast_channel_timingfd_set(tmp, ast_timer_fd(ast_channel_timer(tmp))); 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. * This is the last place the channel constructor can fail.
* *
@ -1010,7 +998,8 @@ __ast_channel_alloc_ap(int needqueue, int state, const char *cid_num, const char
* AST_CEL_CHANNEL_END is not posted if we have not posted the * AST_CEL_CHANNEL_END is not posted if we have not posted the
* AST_CEL_CHANNEL_START yet. * 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); return ast_channel_unref(tmp);
} }
@ -1132,6 +1121,7 @@ __ast_channel_alloc_ap(int needqueue, int state, const char *cid_num, const char
ast_channel_uniqueid(tmp)); ast_channel_uniqueid(tmp));
} }
ast_channel_internal_finalize(tmp);
return tmp; return tmp;
} }
@ -1164,24 +1154,11 @@ struct ast_channel *ast_dummy_channel_alloc(void)
struct ast_channel *tmp; struct ast_channel *tmp;
struct varshead *headp; struct varshead *headp;
#if defined(REF_DEBUG) if (!(tmp = ast_channel_internal_alloc(ast_dummy_channel_destructor))) {
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) {
/* Dummy channel structure allocation failure. */ /* Dummy channel structure allocation failure. */
return NULL; return NULL;
} }
if ((ast_string_field_init(tmp, 128))) {
return ast_channel_unref(tmp);
}
headp = ast_channel_varshead(tmp); headp = ast_channel_varshead(tmp);
AST_LIST_HEAD_INIT_NOLOCK(headp); AST_LIST_HEAD_INIT_NOLOCK(headp);
@ -1196,7 +1173,7 @@ static int __ast_queue_frame(struct ast_channel *chan, struct ast_frame *fin, in
unsigned int new_voice_frames = 0; unsigned int new_voice_frames = 0;
unsigned int queued_frames = 0; unsigned int queued_frames = 0;
unsigned int queued_voice_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); ast_channel_lock(chan);
@ -1296,8 +1273,8 @@ static int __ast_queue_frame(struct ast_channel *chan, struct ast_frame *fin, in
} }
} else if (ast_channel_timingfd(chan) > -1) { } else if (ast_channel_timingfd(chan) > -1) {
ast_timer_enable_continuous(ast_channel_timer(chan)); ast_timer_enable_continuous(ast_channel_timer(chan));
} else if (ast_test_flag(chan, AST_FLAG_BLOCKING)) { } else if (ast_test_flag(ast_channel_flags(chan), AST_FLAG_BLOCKING)) {
pthread_kill(chan->blocker, SIGURG); pthread_kill(ast_channel_blocker(chan), SIGURG);
} }
ast_channel_unlock(chan); ast_channel_unlock(chan);
@ -1380,8 +1357,8 @@ int ast_channel_defer_dtmf(struct ast_channel *chan)
int pre = 0; int pre = 0;
if (chan) { if (chan) {
pre = ast_test_flag(chan, AST_FLAG_DEFER_DTMF); pre = ast_test_flag(ast_channel_flags(chan), AST_FLAG_DEFER_DTMF);
ast_set_flag(chan, AST_FLAG_DEFER_DTMF); ast_set_flag(ast_channel_flags(chan), AST_FLAG_DEFER_DTMF);
} }
return pre; return pre;
} }
@ -1390,7 +1367,7 @@ int ast_channel_defer_dtmf(struct ast_channel *chan)
void ast_channel_undefer_dtmf(struct ast_channel *chan) void ast_channel_undefer_dtmf(struct ast_channel *chan)
{ {
if (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_channel *ast_channel_callback(ao2_callback_data_fn *cb_fn, void *arg,
@ -2172,8 +2149,7 @@ static void ast_channel_destructor(void *obj)
struct ast_datastore *datastore; struct ast_datastore *datastore;
char device_name[AST_CHANNEL_NAME]; char device_name[AST_CHANNEL_NAME];
if (ast_channel_name(chan)) { if (ast_channel_internal_is_finalized(chan)) {
/* The string fields were initialized. */
ast_cel_report_event(chan, AST_CEL_CHANNEL_END, NULL, NULL, NULL); ast_cel_report_event(chan, AST_CEL_CHANNEL_END, NULL, NULL, NULL);
ast_cel_check_retire_linkedid(chan); ast_cel_check_retire_linkedid(chan);
} }
@ -2199,10 +2175,9 @@ static void ast_channel_destructor(void *obj)
ast_sched_context_destroy(ast_channel_sched(chan)); ast_sched_context_destroy(ast_channel_sched(chan));
} }
if (ast_channel_name(chan)) { if (ast_channel_internal_is_finalized(chan)) {
char *dashptr; char *dashptr;
/* The string fields were initialized. */
ast_copy_string(device_name, ast_channel_name(chan), sizeof(device_name)); ast_copy_string(device_name, ast_channel_name(chan), sizeof(device_name));
if ((dashptr = strrchr(device_name, '-'))) { if ((dashptr = strrchr(device_name, '-'))) {
*dashptr = '\0'; *dashptr = '\0';
@ -2268,7 +2243,7 @@ static void ast_channel_destructor(void *obj)
ast_channel_zone_set(chan, ast_tone_zone_unref(ast_channel_zone(chan))); ast_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]) { if (device_name[0]) {
/* /*
@ -2308,7 +2283,7 @@ static void ast_dummy_channel_destructor(void *obj)
ast_channel_cdr_set(chan, NULL); 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) struct ast_datastore *ast_channel_datastore_alloc(const struct ast_datastore_info *info, const char *uid)
@ -2490,8 +2465,8 @@ int ast_softhangup_nolock(struct ast_channel *chan, int cause)
ast_channel_softhangup_internal_flag_add(chan, cause); ast_channel_softhangup_internal_flag_add(chan, cause);
ast_queue_frame(chan, &ast_null_frame); ast_queue_frame(chan, &ast_null_frame);
/* Interrupt any poll call or such */ /* Interrupt any poll call or such */
if (ast_test_flag(chan, AST_FLAG_BLOCKING)) if (ast_test_flag(ast_channel_flags(chan), AST_FLAG_BLOCKING))
pthread_kill(chan->blocker, SIGURG); pthread_kill(ast_channel_blocker(chan), SIGURG);
return 0; return 0;
} }
@ -2597,14 +2572,14 @@ int ast_hangup(struct ast_channel *chan)
* Mark it as a zombie already so ast_do_masquerade() will know * Mark it as a zombie already so ast_do_masquerade() will know
* to free it later. * to free it later.
*/ */
ast_set_flag(chan, AST_FLAG_ZOMBIE); ast_set_flag(ast_channel_flags(chan), AST_FLAG_ZOMBIE);
destroy_hooks(chan); destroy_hooks(chan);
ast_channel_unlock(chan); ast_channel_unlock(chan);
return 0; return 0;
} }
if (!(was_zombie = ast_test_flag(chan, AST_FLAG_ZOMBIE))) { if (!(was_zombie = ast_test_flag(ast_channel_flags(chan), AST_FLAG_ZOMBIE))) {
ast_set_flag(chan, AST_FLAG_ZOMBIE); ast_set_flag(ast_channel_flags(chan), AST_FLAG_ZOMBIE);
} }
ast_channel_unlock(chan); ast_channel_unlock(chan);
@ -2640,11 +2615,11 @@ int ast_hangup(struct ast_channel *chan)
snprintf(extra_str, sizeof(extra_str), "%d,%s,%s", ast_channel_hangupcause(chan), ast_channel_hangupsource(chan), S_OR(pbx_builtin_getvar_helper(chan, "DIALSTATUS"), "")); 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); 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 " 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", "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)); (long) pthread_self(), ast_channel_name(chan), (long)ast_channel_blocker(chan), ast_channel_blockproc(chan));
ast_assert(ast_test_flag(chan, AST_FLAG_BLOCKING) == 0); ast_assert(ast_test_flag(ast_channel_flags(chan), AST_FLAG_BLOCKING) == 0);
} }
if (!was_zombie) { if (!was_zombie) {
ast_debug(1, "Hanging up channel '%s'\n", ast_channel_name(chan)); ast_debug(1, "Hanging up channel '%s'\n", ast_channel_name(chan));
@ -2700,13 +2675,13 @@ int ast_raw_answer(struct ast_channel *chan, int cdr_answer)
ast_channel_lock(chan); ast_channel_lock(chan);
/* You can't answer an outbound call */ /* 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); ast_channel_unlock(chan);
return 0; return 0;
} }
/* Stop if we're a zombie or need a soft hangup */ /* 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); ast_channel_unlock(chan);
return -1; return -1;
} }
@ -2860,7 +2835,7 @@ void ast_deactivate_generator(struct ast_channel *chan)
ast_channel_generatordata_set(chan, NULL); ast_channel_generatordata_set(chan, NULL);
ast_channel_generator_set(chan, NULL); ast_channel_generator_set(chan, NULL);
ast_channel_set_fd(chan, AST_GENERATOR_FD, -1); 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_settimeout(chan, 0, NULL, NULL);
} }
ast_channel_unlock(chan); ast_channel_unlock(chan);
@ -3044,7 +3019,7 @@ struct ast_channel *ast_waitfor_nandfds(struct ast_channel **c, int n, int *fds,
res = ast_poll(pfds, max, rms); res = ast_poll(pfds, max, rms);
} }
for (x = 0; x < n; x++) 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 (res < 0) { /* Simulate a timeout if we were interrupted */
if (errno != EINTR) if (errno != EINTR)
*ms = -1; *ms = -1;
@ -3076,9 +3051,9 @@ struct ast_channel *ast_waitfor_nandfds(struct ast_channel **c, int n, int *fds,
if (fdmap[x].chan >= 0) { /* this is a channel */ if (fdmap[x].chan >= 0) { /* this is a channel */
winner = c[fdmap[x].chan]; /* override previous winners */ winner = c[fdmap[x].chan]; /* override previous winners */
if (res & POLLPRI) if (res & POLLPRI)
ast_set_flag(winner, AST_FLAG_EXCEPTION); ast_set_flag(ast_channel_flags(winner), AST_FLAG_EXCEPTION);
else 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); ast_channel_fdno_set(winner, fdmap[x].fdno);
} else { /* this is an fd */ } else { /* this is an fd */
if (outfd) if (outfd)
@ -3140,7 +3115,7 @@ static struct ast_channel *ast_waitfor_nandfds_simple(struct ast_channel *chan,
res = epoll_wait(ast_channel_epfd(chan), ev, 1, rms); res = epoll_wait(ast_channel_epfd(chan), ev, 1, rms);
/* Stop blocking */ /* 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 */ /* Simulate a timeout if we were interrupted */
if (res < 0) { if (res < 0) {
@ -3167,9 +3142,9 @@ static struct ast_channel *ast_waitfor_nandfds_simple(struct ast_channel *chan,
aed = ev[0].data.ptr; aed = ev[0].data.ptr;
ast_channel_fdno_set(chan, aed->which); ast_channel_fdno_set(chan, aed->which);
if (ev[0].events & EPOLLPRI) if (ev[0].events & EPOLLPRI)
ast_set_flag(chan, AST_FLAG_EXCEPTION); ast_set_flag(ast_channel_flags(chan), AST_FLAG_EXCEPTION);
else else
ast_clear_flag(chan, AST_FLAG_EXCEPTION); ast_clear_flag(ast_channel_flags(chan), AST_FLAG_EXCEPTION);
if (*ms > 0) { if (*ms > 0) {
*ms -= ast_tvdiff_ms(ast_tvnow(), start); *ms -= ast_tvdiff_ms(ast_tvnow(), start);
@ -3225,7 +3200,7 @@ static struct ast_channel *ast_waitfor_nandfds_complex(struct ast_channel **c, i
res = epoll_wait(ast_channel_epfd(c[0]), ev, 25, rms); res = epoll_wait(ast_channel_epfd(c[0]), ev, 25, rms);
for (i = 0; i < n; i++) 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 (res < 0) {
if (errno != EINTR) if (errno != EINTR)
@ -3257,9 +3232,9 @@ static struct ast_channel *ast_waitfor_nandfds_complex(struct ast_channel **c, i
winner = aed->chan; winner = aed->chan;
if (ev[i].events & EPOLLPRI) if (ev[i].events & EPOLLPRI)
ast_set_flag(winner, AST_FLAG_EXCEPTION); ast_set_flag(ast_channel_flags(winner), AST_FLAG_EXCEPTION);
else 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); ast_channel_fdno_set(winner, aed->which);
} }
@ -3337,7 +3312,7 @@ int ast_settimeout(struct ast_channel *c, unsigned int rate, int (*func)(const v
res = ast_timer_set_rate(ast_channel_timer(c), real_rate); 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); ast_channel_timingdata_set(c, data);
if (func == NULL && rate == 0 && ast_channel_fdno(c) == AST_TIMING_FD) { if (func == NULL && rate == 0 && ast_channel_fdno(c) == AST_TIMING_FD) {
@ -3358,11 +3333,11 @@ int ast_settimeout(struct ast_channel *c, unsigned int rate, int (*func)(const v
int ast_waitfordigit_full(struct ast_channel *c, int ms, int audiofd, int cmdfd) 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 */ /* 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; return -1;
/* Only look for the end of DTMF, don't bother with the beginning and don't emulate things */ /* 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. */ /* Wait for a digit, no more than ms milliseconds total. */
@ -3377,12 +3352,12 @@ int ast_waitfordigit_full(struct ast_channel *c, int ms, int audiofd, int cmdfd)
if (errno == 0 || errno == EINTR) if (errno == 0 || errno == EINTR)
continue; continue;
ast_log(LOG_WARNING, "Wait failed (%s)\n", strerror(errno)); 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; return -1;
} else if (outfd > -1) { } else if (outfd > -1) {
/* The FD we were watching has something waiting */ /* 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_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; return 1;
} else if (rchan) { } else if (rchan) {
int res; int res;
@ -3396,13 +3371,13 @@ int ast_waitfordigit_full(struct ast_channel *c, int ms, int audiofd, int cmdfd)
case AST_FRAME_DTMF_END: case AST_FRAME_DTMF_END:
res = f->subclass.integer; res = f->subclass.integer;
ast_frfree(f); 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; return res;
case AST_FRAME_CONTROL: case AST_FRAME_CONTROL:
switch (f->subclass.integer) { switch (f->subclass.integer) {
case AST_CONTROL_HANGUP: case AST_CONTROL_HANGUP:
ast_frfree(f); 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; return -1;
case AST_CONTROL_RINGING: case AST_CONTROL_RINGING:
case AST_CONTROL_ANSWER: case AST_CONTROL_ANSWER:
@ -3436,7 +3411,7 @@ int ast_waitfordigit_full(struct ast_channel *c, int ms, int audiofd, int cmdfd)
} }
} }
ast_clear_flag(c, AST_FLAG_END_DTMF_ONLY); ast_clear_flag(ast_channel_flags(c), AST_FLAG_END_DTMF_ONLY);
return 0; /* Time is up */ return 0; /* Time is up */
} }
@ -3462,7 +3437,7 @@ static void ast_read_generator_actions(struct ast_channel *chan, struct ast_fram
int res; int res;
int samples; int samples;
if (chan->timingfunc) { if (ast_channel_timingfunc(chan)) {
ast_debug(1, "Generator got voice, switching to phase locked mode\n"); ast_debug(1, "Generator got voice, switching to phase locked mode\n");
ast_settimeout(chan, 0, NULL, NULL); ast_settimeout(chan, 0, NULL, NULL);
} }
@ -3495,7 +3470,7 @@ static void ast_read_generator_actions(struct ast_channel *chan, struct ast_fram
} }
} else if (f->frametype == AST_FRAME_CNG) { } 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_debug(1, "Generator got CNG, switching to timed mode\n");
ast_settimeout(chan, 50, generator_force, chan); ast_settimeout(chan, 50, generator_force, chan);
} }
@ -3522,7 +3497,7 @@ static inline void queue_dtmf_readq(struct ast_channel *chan, struct ast_frame *
*/ */
static inline int should_skip_dtmf(struct ast_channel *chan) 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 /* We're in the middle of emulating a digit, or DTMF has been
* explicitly deferred. Skip this digit, then. */ * explicitly deferred. Skip this digit, then. */
return 1; return 1;
@ -3582,7 +3557,7 @@ static struct ast_frame *__ast_read(struct ast_channel *chan, int dropaudio)
ast_channel_lock(chan); ast_channel_lock(chan);
/* Stop if we're a zombie or need a soft hangup */ /* 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)) if (ast_channel_generator(chan))
ast_deactivate_generator(chan); ast_deactivate_generator(chan);
@ -3627,7 +3602,7 @@ static struct ast_frame *__ast_read(struct ast_channel *chan, int dropaudio)
if (ast_channel_timingfd(chan) > -1 && ast_channel_fdno(chan) == AST_TIMING_FD) { if (ast_channel_timingfd(chan) > -1 && ast_channel_fdno(chan) == AST_TIMING_FD) {
enum ast_timer_event res; 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)); res = ast_timer_get_event(ast_channel_timer(chan));
@ -3635,9 +3610,9 @@ static struct ast_frame *__ast_read(struct ast_channel *chan, int dropaudio)
case AST_TIMING_EVENT_EXPIRED: case AST_TIMING_EVENT_EXPIRED:
ast_timer_ack(ast_channel_timer(chan), 1); 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 */ /* 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); void *data = ast_channel_timingdata(chan);
ast_channel_fdno_set(chan, -1); ast_channel_fdno_set(chan, -1);
ast_channel_unlock(chan); ast_channel_unlock(chan);
@ -3671,7 +3646,7 @@ static struct ast_frame *__ast_read(struct ast_channel *chan, int dropaudio)
ast_channel_fdno_set(chan, -1); ast_channel_fdno_set(chan, -1);
goto done; goto done;
} else if (ast_channel_fd_isset(chan, AST_JITTERBUFFER_FD) && ast_channel_fdno(chan) == AST_JITTERBUFFER_FD) { } 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 /* Read and ignore anything on the alertpipe, but read only
@ -3722,8 +3697,8 @@ static struct ast_frame *__ast_read(struct ast_channel *chan, int dropaudio)
} }
} }
} else { } else {
chan->blocker = pthread_self(); ast_channel_blocker_set(chan, pthread_self());
if (ast_test_flag(chan, AST_FLAG_EXCEPTION)) { if (ast_test_flag(ast_channel_flags(chan), AST_FLAG_EXCEPTION)) {
if (ast_channel_tech(chan)->exception) if (ast_channel_tech(chan)->exception)
f = ast_channel_tech(chan)->exception(chan); f = ast_channel_tech(chan)->exception(chan);
else { else {
@ -3731,7 +3706,7 @@ static struct ast_frame *__ast_read(struct ast_channel *chan, int dropaudio)
f = &ast_null_frame; f = &ast_null_frame;
} }
/* Clear the exception flag */ /* 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) } else if (ast_channel_tech(chan) && ast_channel_tech(chan)->read)
f = ast_channel_tech(chan)->read(chan); f = ast_channel_tech(chan)->read(chan);
else else
@ -3765,7 +3740,7 @@ static struct ast_frame *__ast_read(struct ast_channel *chan, int dropaudio)
switch (f->frametype) { switch (f->frametype) {
case AST_FRAME_CONTROL: case AST_FRAME_CONTROL:
if (f->subclass.integer == AST_CONTROL_ANSWER) { 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_debug(1, "Ignoring answer on an inbound call!\n");
ast_frfree(f); ast_frfree(f);
f = &ast_null_frame; f = &ast_null_frame;
@ -3807,11 +3782,11 @@ static struct ast_frame *__ast_read(struct ast_channel *chan, int dropaudio)
send_dtmf_event(chan, "Received", f->subclass.integer, "No", "Yes"); 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); 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. */ /* 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); queue_dtmf_readq(chan, f);
ast_frfree(f); ast_frfree(f);
f = &ast_null_frame; 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)) && if (!ast_tvzero(*ast_channel_dtmf_tv(chan)) &&
ast_tvdiff_ms(ast_tvnow(), *ast_channel_dtmf_tv(chan)) < AST_MIN_DTMF_GAP) { ast_tvdiff_ms(ast_tvnow(), *ast_channel_dtmf_tv(chan)) < AST_MIN_DTMF_GAP) {
/* If it hasn't been long enough, defer this digit */ /* If it hasn't been long enough, defer this digit */
@ -3822,7 +3797,7 @@ static struct ast_frame *__ast_read(struct ast_channel *chan, int dropaudio)
/* There was no begin, turn this into a begin and send the end later */ /* There was no begin, turn this into a begin and send the end later */
struct timeval tv = ast_tvnow(); struct timeval tv = ast_tvnow();
f->frametype = AST_FRAME_DTMF_BEGIN; 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_digit_to_emulate_set(chan, f->subclass.integer);
ast_channel_dtmf_tv_set(chan, &tv); ast_channel_dtmf_tv_set(chan, &tv);
if (f->len) { if (f->len) {
@ -3845,9 +3820,9 @@ static struct ast_frame *__ast_read(struct ast_channel *chan, int dropaudio)
} }
} else { } else {
struct timeval now = ast_tvnow(); 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_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) if (!f->len)
f->len = ast_tvdiff_ms(now, *ast_channel_dtmf_tv(chan)); f->len = ast_tvdiff_ms(now, *ast_channel_dtmf_tv(chan));
@ -3867,9 +3842,9 @@ static struct ast_frame *__ast_read(struct ast_channel *chan, int dropaudio)
ast_log(LOG_DTMF, "DTMF end accepted without begin '%c' on %s\n", f->subclass.integer, ast_channel_name(chan)); 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; 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_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_dtmf_digit_to_emulate_set(chan, f->subclass.integer);
ast_channel_emulate_dtmf_duration_set(chan, AST_MIN_DTMF_DURATION - f->len); ast_channel_emulate_dtmf_duration_set(chan, AST_MIN_DTMF_DURATION - f->len);
ast_frfree(f); ast_frfree(f);
@ -3892,7 +3867,7 @@ static struct ast_frame *__ast_read(struct ast_channel *chan, int dropaudio)
case AST_FRAME_DTMF_BEGIN: case AST_FRAME_DTMF_BEGIN:
send_dtmf_event(chan, "Received", f->subclass.integer, "Yes", "No"); 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)); 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_tvzero(*ast_channel_dtmf_tv(chan)) &&
ast_tvdiff_ms(ast_tvnow(), *ast_channel_dtmf_tv(chan)) < AST_MIN_DTMF_GAP) ) { ast_tvdiff_ms(ast_tvnow(), *ast_channel_dtmf_tv(chan)) < AST_MIN_DTMF_GAP) ) {
ast_log(LOG_DTMF, "DTMF begin ignored '%c' on %s\n", f->subclass.integer, ast_channel_name(chan)); ast_log(LOG_DTMF, "DTMF begin ignored '%c' on %s\n", f->subclass.integer, ast_channel_name(chan));
@ -3900,7 +3875,7 @@ static struct ast_frame *__ast_read(struct ast_channel *chan, int dropaudio)
f = &ast_null_frame; f = &ast_null_frame;
} else { } else {
struct timeval now = ast_tvnow(); 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_channel_dtmf_tv_set(chan, &now);
ast_log(LOG_DTMF, "DTMF begin passthrough '%c' on %s\n", f->subclass.integer, ast_channel_name(chan)); ast_log(LOG_DTMF, "DTMF begin passthrough '%c' on %s\n", f->subclass.integer, ast_channel_name(chan));
} }
@ -3910,10 +3885,10 @@ static struct ast_frame *__ast_read(struct ast_channel *chan, int dropaudio)
* is reached , because we want to make sure we pass at least one * 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 * voice frame through before starting the next digit, to ensure a gap
* between DTMF digits. */ * 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(); struct timeval now = ast_tvnow();
if (!ast_channel_emulate_dtmf_duration(chan)) { 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); 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)) { } else if (ast_tvdiff_ms(now, *ast_channel_dtmf_tv(chan)) >= ast_channel_emulate_dtmf_duration(chan)) {
ast_channel_emulate_dtmf_duration_set(chan, 0); ast_channel_emulate_dtmf_duration_set(chan, 0);
@ -3923,7 +3898,7 @@ static struct ast_frame *__ast_read(struct ast_channel *chan, int dropaudio)
f->subclass.integer = ast_channel_dtmf_digit_to_emulate(chan); f->subclass.integer = ast_channel_dtmf_digit_to_emulate(chan);
f->len = ast_tvdiff_ms(now, *ast_channel_dtmf_tv(chan)); f->len = ast_tvdiff_ms(now, *ast_channel_dtmf_tv(chan));
ast_channel_dtmf_tv_set(chan, &now); 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_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)); 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)) { if (ast_channel_audiohooks(chan)) {
@ -3941,19 +3916,19 @@ static struct ast_frame *__ast_read(struct ast_channel *chan, int dropaudio)
* is reached , because we want to make sure we pass at least one * 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 * voice frame through before starting the next digit, to ensure a gap
* between DTMF digits. */ * between DTMF digits. */
if (ast_test_flag(chan, AST_FLAG_EMULATE_DTMF) && !ast_channel_emulate_dtmf_duration(chan)) { if (ast_test_flag(ast_channel_flags(chan), AST_FLAG_EMULATE_DTMF) && !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); 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) if (dropaudio)
ast_read_generator_actions(chan, f); ast_read_generator_actions(chan, f);
ast_frfree(f); ast_frfree(f);
f = &ast_null_frame; 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(); struct timeval now = ast_tvnow();
if (ast_tvdiff_ms(now, *ast_channel_dtmf_tv(chan)) >= ast_channel_emulate_dtmf_duration(chan)) { if (ast_tvdiff_ms(now, *ast_channel_dtmf_tv(chan)) >= ast_channel_emulate_dtmf_duration(chan)) {
ast_channel_emulate_dtmf_duration_set(chan, 0); ast_channel_emulate_dtmf_duration_set(chan, 0);
@ -4162,7 +4137,7 @@ int ast_indicate_data(struct ast_channel *chan, int _condition,
ast_channel_lock(chan); ast_channel_lock(chan);
/* Don't bother if the channel is about to go away, anyway. */ /* 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; res = -1;
goto indicate_cleanup; goto indicate_cleanup;
} }
@ -4388,7 +4363,7 @@ int ast_sendtext(struct ast_channel *chan, const char *text)
ast_channel_lock(chan); ast_channel_lock(chan);
/* Stop if we're a zombie or need a soft hangup */ /* 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); ast_channel_unlock(chan);
return -1; return -1;
} }
@ -4415,7 +4390,7 @@ int ast_sendtext(struct ast_channel *chan, const char *text)
} else if (ast_channel_tech(chan)->send_text) { } else if (ast_channel_tech(chan)->send_text) {
res = ast_channel_tech(chan)->send_text(chan, 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); ast_channel_unlock(chan);
return res; return res;
} }
@ -4636,7 +4611,7 @@ int ast_write(struct ast_channel *chan, struct ast_frame *fr)
usleep(1); usleep(1);
} }
/* Stop if we're a zombie or need a soft hangup */ /* 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; goto done;
/* Handle any pending masquerades */ /* Handle any pending masquerades */
@ -4661,14 +4636,14 @@ int ast_write(struct ast_channel *chan, struct ast_frame *fr)
} }
if (ast_channel_generatordata(chan) && (!fr->src || strcasecmp(fr->src, "ast_prod"))) { if (ast_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); ast_deactivate_generator(chan);
} else { } else {
if (fr->frametype == AST_FRAME_DTMF_END) { if (fr->frametype == AST_FRAME_DTMF_END) {
/* There is a generator running while we're in the middle of a digit. /* 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 * It's probably inband DTMF, so go ahead and pass it so it can
* stop the generator */ * stop the generator */
ast_clear_flag(chan, AST_FLAG_BLOCKING); ast_clear_flag(ast_channel_flags(chan), AST_FLAG_BLOCKING);
ast_channel_unlock(chan); ast_channel_unlock(chan);
res = ast_senddigit_end(chan, fr->subclass.integer, fr->len); res = ast_senddigit_end(chan, fr->subclass.integer, fr->len);
ast_channel_lock(chan); ast_channel_lock(chan);
@ -4699,7 +4674,7 @@ int ast_write(struct ast_channel *chan, struct ast_frame *fr)
f = fr; f = fr;
} }
send_dtmf_event(chan, "Sent", fr->subclass.integer, "Yes", "No"); 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); ast_channel_unlock(chan);
res = ast_senddigit_begin(chan, fr->subclass.integer); res = ast_senddigit_begin(chan, fr->subclass.integer);
ast_channel_lock(chan); ast_channel_lock(chan);
@ -4715,7 +4690,7 @@ int ast_write(struct ast_channel *chan, struct ast_frame *fr)
} }
} }
send_dtmf_event(chan, "Sent", fr->subclass.integer, "No", "Yes"); 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); ast_channel_unlock(chan);
res = ast_senddigit_end(chan, fr->subclass.integer, fr->len); res = ast_senddigit_end(chan, fr->subclass.integer, fr->len);
ast_channel_lock(chan); ast_channel_lock(chan);
@ -4908,7 +4883,7 @@ int ast_write(struct ast_channel *chan, struct ast_frame *fr)
if (f && f != fr) if (f && f != fr)
ast_frfree(f); 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 */ /* Consider a write failure to force a soft hangup */
if (res < 0) { if (res < 0) {
@ -5208,7 +5183,7 @@ static void handle_cause(int cause, int *outstate)
*/ */
static void call_forward_inherit(struct ast_channel *new_chan, struct ast_channel *parent, struct ast_channel *orig) 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; struct ast_party_redirecting redirecting;
/* /*
@ -5633,13 +5608,13 @@ int ast_call(struct ast_channel *chan, const char *addr, int timeout)
int res = -1; int res = -1;
/* Stop if we're a zombie or need a soft hangup */ /* Stop if we're a zombie or need a soft hangup */
ast_channel_lock(chan); 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)) { if (ast_channel_cdr(chan)) {
ast_set_flag(ast_channel_cdr(chan), AST_CDR_FLAG_DIALED); ast_set_flag(ast_channel_cdr(chan), AST_CDR_FLAG_DIALED);
} }
if (ast_channel_tech(chan)->call) if (ast_channel_tech(chan)->call)
res = ast_channel_tech(chan)->call(chan, addr, timeout); 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); ast_channel_unlock(chan);
return res; return res;
@ -5658,7 +5633,7 @@ int ast_transfer(struct ast_channel *chan, char *dest)
/* Stop if we're a zombie or need a soft hangup */ /* Stop if we're a zombie or need a soft hangup */
ast_channel_lock(chan); 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) { if (ast_channel_tech(chan)->transfer) {
res = ast_channel_tech(chan)->transfer(chan, dest); res = ast_channel_tech(chan)->transfer(chan, dest);
if (!res) if (!res)
@ -5714,7 +5689,7 @@ int ast_readstring_full(struct ast_channel *c, char *s, int len, int timeout, in
struct ast_silence_generator *silgen = NULL; struct ast_silence_generator *silgen = NULL;
/* Stop if we're a zombie or need a soft hangup */ /* 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; return -1;
if (!len) if (!len)
return -1; return -1;
@ -5870,8 +5845,8 @@ static int __ast_channel_masquerade(struct ast_channel *original, struct ast_cha
ast_channel_lock_both(original, clonechan); ast_channel_lock_both(original, clonechan);
if (ast_test_flag(original, AST_FLAG_ZOMBIE) if (ast_test_flag(ast_channel_flags(original), AST_FLAG_ZOMBIE)
|| ast_test_flag(clonechan, AST_FLAG_ZOMBIE)) { || ast_test_flag(ast_channel_flags(clonechan), AST_FLAG_ZOMBIE)) {
/* Zombies! Run! */ /* Zombies! Run! */
ast_log(LOG_WARNING, ast_log(LOG_WARNING,
"Can't setup masquerade. One or both channels is dead. (%s <-- %s)\n", "Can't setup masquerade. One or both channels is dead. (%s <-- %s)\n",
@ -5886,15 +5861,15 @@ static int __ast_channel_masquerade(struct ast_channel *original, struct ast_cha
* (i.e. chan_agent) and if so, we don't really want to * (i.e. chan_agent) and if so, we don't really want to
* masquerade it, but its proxy * masquerade it, but its proxy
*/ */
if (original->_bridge if (ast_channel_internal_bridged_channel(original)
&& (original->_bridge != ast_bridged_channel(original)) && (ast_channel_internal_bridged_channel(original) != ast_bridged_channel(original))
&& (original->_bridge->_bridge != original)) { && (ast_channel_internal_bridged_channel(ast_channel_internal_bridged_channel(original)) != original)) {
final_orig = original->_bridge; final_orig = ast_channel_internal_bridged_channel(original);
} }
if (clonechan->_bridge if (ast_channel_internal_bridged_channel(clonechan)
&& (clonechan->_bridge != ast_bridged_channel(clonechan)) && (ast_channel_internal_bridged_channel(clonechan) != ast_bridged_channel(clonechan))
&& (clonechan->_bridge->_bridge != clonechan)) { && (ast_channel_internal_bridged_channel(ast_channel_internal_bridged_channel(clonechan)) != clonechan)) {
final_clone = clonechan->_bridge; final_clone = ast_channel_internal_bridged_channel(clonechan);
} }
if (ast_channel_tech(final_clone)->get_base_channel if (ast_channel_tech(final_clone)->get_base_channel
&& (base = ast_channel_tech(final_clone)->get_base_channel(final_clone))) { && (base = ast_channel_tech(final_clone)->get_base_channel(final_clone))) {
@ -5927,8 +5902,8 @@ static int __ast_channel_masquerade(struct ast_channel *original, struct ast_cha
original = final_orig; original = final_orig;
clonechan = final_clone; clonechan = final_clone;
if (ast_test_flag(original, AST_FLAG_ZOMBIE) if (ast_test_flag(ast_channel_flags(original), AST_FLAG_ZOMBIE)
|| ast_test_flag(clonechan, AST_FLAG_ZOMBIE)) { || ast_test_flag(ast_channel_flags(clonechan), AST_FLAG_ZOMBIE)) {
/* Zombies! Run! */ /* Zombies! Run! */
ast_log(LOG_WARNING, ast_log(LOG_WARNING,
"Can't setup masquerade. One or both channels is dead. (%s <-- %s)\n", "Can't setup masquerade. One or both channels is dead. (%s <-- %s)\n",
@ -6263,14 +6238,14 @@ void ast_channel_set_linkgroup(struct ast_channel *chan, struct ast_channel *pee
linkedid = oldest_linkedid(ast_channel_linkedid(chan), ast_channel_linkedid(peer)); linkedid = oldest_linkedid(ast_channel_linkedid(chan), ast_channel_linkedid(peer));
linkedid = oldest_linkedid(linkedid, ast_channel_uniqueid(chan)); linkedid = oldest_linkedid(linkedid, ast_channel_uniqueid(chan));
linkedid = oldest_linkedid(linkedid, ast_channel_uniqueid(peer)); linkedid = oldest_linkedid(linkedid, ast_channel_uniqueid(peer));
if (chan->_bridge) { if (ast_channel_internal_bridged_channel(chan)) {
bridged = ast_bridged_channel(chan); bridged = ast_bridged_channel(chan);
if (bridged != peer) { if (bridged != peer) {
linkedid = oldest_linkedid(linkedid, ast_channel_linkedid(bridged)); linkedid = oldest_linkedid(linkedid, ast_channel_linkedid(bridged));
linkedid = oldest_linkedid(linkedid, ast_channel_uniqueid(bridged)); linkedid = oldest_linkedid(linkedid, ast_channel_uniqueid(bridged));
} }
} }
if (peer->_bridge) { if (ast_channel_internal_bridged_channel(peer)) {
bridged = ast_bridged_channel(peer); bridged = ast_bridged_channel(peer);
if (bridged != chan) { if (bridged != chan) {
linkedid = oldest_linkedid(linkedid, ast_channel_linkedid(bridged)); linkedid = oldest_linkedid(linkedid, ast_channel_linkedid(bridged));
@ -6283,13 +6258,13 @@ void ast_channel_set_linkgroup(struct ast_channel *chan, struct ast_channel *pee
ast_channel_change_linkedid(chan, linkedid); ast_channel_change_linkedid(chan, linkedid);
ast_channel_change_linkedid(peer, linkedid); ast_channel_change_linkedid(peer, linkedid);
if (chan->_bridge) { if (ast_channel_internal_bridged_channel(chan)) {
bridged = ast_bridged_channel(chan); bridged = ast_bridged_channel(chan);
if (bridged != peer) { if (bridged != peer) {
ast_channel_change_linkedid(bridged, linkedid); ast_channel_change_linkedid(bridged, linkedid);
} }
} }
if (peer->_bridge) { if (ast_channel_internal_bridged_channel(peer)) {
bridged = ast_bridged_channel(peer); bridged = ast_bridged_channel(peer);
if (bridged != chan) { if (bridged != chan) {
ast_channel_change_linkedid(bridged, linkedid); ast_channel_change_linkedid(bridged, linkedid);
@ -6684,7 +6659,7 @@ int ast_do_masquerade(struct ast_channel *original)
/* XXX What about blocking, softhangup, blocker, and lock and blockproc? XXX */ /* XXX What about blocking, softhangup, blocker, and lock and blockproc? XXX */
/* Application and data remain the same */ /* Application and data remain the same */
/* Clone exception becomes real one, as with fdno */ /* 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)); ast_channel_fdno_set(original, ast_channel_fdno(clonechan));
/* Schedule context remains the same */ /* Schedule context remains the same */
/* Stream stuff stays the same */ /* Stream stuff stays the same */
@ -6732,9 +6707,9 @@ int ast_do_masquerade(struct ast_channel *original)
/* copy over accuntcode and set peeraccount across the bridge */ /* copy over accuntcode and set peeraccount across the bridge */
ast_channel_accountcode_set(original, S_OR(ast_channel_accountcode(clonechan), "")); ast_channel_accountcode_set(original, S_OR(ast_channel_accountcode(clonechan), ""));
if (original->_bridge) { if (ast_channel_internal_bridged_channel(original)) {
/* XXX - should we try to lock original->_bridge here? */ /* XXX - should we try to lock original's bridged channel here? */
ast_channel_peeraccount_set(original->_bridge, S_OR(ast_channel_accountcode(clonechan), "")); 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); ast_cel_report_event(original, AST_CEL_BRIDGE_UPDATE, NULL, NULL, NULL);
} }
@ -6769,7 +6744,7 @@ int ast_do_masquerade(struct ast_channel *original)
/* Now, at this point, the "clone" channel is totally F'd up. We mark it as /* 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 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). */ 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_debug(1, "Destroying channel clone '%s'\n", ast_channel_name(clonechan));
ast_channel_unlock(clonechan); ast_channel_unlock(clonechan);
ast_manager_event(clonechan, EVENT_FLAG_CALL, "Hangup", ast_manager_event(clonechan, EVENT_FLAG_CALL, "Hangup",
@ -6785,13 +6760,13 @@ int ast_do_masquerade(struct ast_channel *original)
clonechan = ast_channel_release(clonechan); clonechan = ast_channel_release(clonechan);
} else { } else {
ast_debug(1, "Released clone lock on '%s'\n", ast_channel_name(clonechan)); 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); ast_queue_frame(clonechan, &ast_null_frame);
} }
/* Signal any blocker */ /* Signal any blocker */
if (ast_test_flag(original, AST_FLAG_BLOCKING)) if (ast_test_flag(ast_channel_flags(original), AST_FLAG_BLOCKING))
pthread_kill(original->blocker, SIGURG); pthread_kill(ast_channel_blocker(original), SIGURG);
ast_debug(1, "Done Masquerading %s (%d)\n", ast_channel_name(original), ast_channel_state(original)); ast_debug(1, "Done Masquerading %s (%d)\n", ast_channel_name(original), ast_channel_state(original));
if ((bridged = ast_bridged_channel(original))) { if ((bridged = ast_bridged_channel(original))) {
@ -6942,7 +6917,7 @@ int ast_setstate(struct ast_channel *chan, enum ast_channel_state state)
struct ast_channel *ast_bridged_channel(struct ast_channel *chan) struct ast_channel *ast_bridged_channel(struct ast_channel *chan)
{ {
struct ast_channel *bridged; struct ast_channel *bridged;
bridged = chan->_bridge; bridged = ast_channel_internal_bridged_channel(chan);
if (bridged && ast_channel_tech(bridged)->bridged_channel) if (bridged && ast_channel_tech(bridged)->bridged_channel)
bridged = ast_channel_tech(bridged)->bridged_channel(chan, bridged); bridged = ast_channel_tech(bridged)->bridged_channel(chan, bridged);
return bridged; return bridged;
@ -7086,8 +7061,8 @@ static enum ast_bridge_result ast_generic_bridge(struct ast_channel *c0, struct
if (ast_channel_softhangup_internal_flag(c1) & AST_SOFTHANGUP_UNBRIDGE) { if (ast_channel_softhangup_internal_flag(c1) & AST_SOFTHANGUP_UNBRIDGE) {
ast_channel_clear_softhangup(c1, AST_SOFTHANGUP_UNBRIDGE); ast_channel_clear_softhangup(c1, AST_SOFTHANGUP_UNBRIDGE);
} }
c0->_bridge = c1; ast_channel_internal_bridged_channel_set(c0, c1);
c1->_bridge = c0; ast_channel_internal_bridged_channel_set(c1, c0);
} }
continue; continue;
} }
@ -7307,20 +7282,20 @@ enum ast_bridge_result ast_channel_bridge(struct ast_channel *c0, struct ast_cha
*fo = NULL; *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_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; 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_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; return -1;
} }
/* Stop if we're a zombie or need a soft hangup */ /* Stop if we're a zombie or need a soft hangup */
if (ast_test_flag(c0, AST_FLAG_ZOMBIE) || ast_check_hangup_locked(c0) || if (ast_test_flag(ast_channel_flags(c0), AST_FLAG_ZOMBIE) || ast_check_hangup_locked(c0) ||
ast_test_flag(c1, AST_FLAG_ZOMBIE) || ast_check_hangup_locked(c1)) ast_test_flag(ast_channel_flags(c1), AST_FLAG_ZOMBIE) || ast_check_hangup_locked(c1))
return -1; return -1;
o0nativeformats = ast_format_cap_dup(ast_channel_nativeformats(c0)); o0nativeformats = ast_format_cap_dup(ast_channel_nativeformats(c0));
@ -7348,8 +7323,8 @@ enum ast_bridge_result ast_channel_bridge(struct ast_channel *c0, struct ast_cha
} }
/* Keep track of bridge */ /* Keep track of bridge */
c0->_bridge = c1; ast_channel_internal_bridged_channel_set(c0, c1);
c1->_bridge = c0; ast_channel_internal_bridged_channel_set(c1, c0);
ast_set_owners_and_peers(c0, c1); ast_set_owners_and_peers(c0, c1);
@ -7375,9 +7350,9 @@ enum ast_bridge_result ast_channel_bridge(struct ast_channel *c0, struct ast_cha
} }
if (!ast_channel_tech(c0)->send_digit_begin) 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) 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); 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 */ /* Before we enter in and bridge these two together tell them both the source of audio has changed */
@ -7442,22 +7417,22 @@ enum ast_bridge_result ast_channel_bridge(struct ast_channel *c0, struct ast_cha
if (ast_channel_softhangup_internal_flag(c1) & AST_SOFTHANGUP_UNBRIDGE) { if (ast_channel_softhangup_internal_flag(c1) & AST_SOFTHANGUP_UNBRIDGE) {
ast_channel_clear_softhangup(c1, AST_SOFTHANGUP_UNBRIDGE); ast_channel_clear_softhangup(c1, AST_SOFTHANGUP_UNBRIDGE);
} }
c0->_bridge = c1; ast_channel_internal_bridged_channel_set(c0, c1);
c1->_bridge = c0; ast_channel_internal_bridged_channel_set(c1, c0);
ast_debug(1, "Unbridge signal received. Ending native bridge.\n"); ast_debug(1, "Unbridge signal received. Ending native bridge.\n");
continue; continue;
} }
/* Stop if we're a zombie or need a soft hangup */ /* Stop if we're a zombie or need a soft hangup */
if (ast_test_flag(c0, AST_FLAG_ZOMBIE) || ast_check_hangup_locked(c0) || if (ast_test_flag(ast_channel_flags(c0), AST_FLAG_ZOMBIE) || ast_check_hangup_locked(c0) ||
ast_test_flag(c1, AST_FLAG_ZOMBIE) || ast_check_hangup_locked(c1)) { ast_test_flag(ast_channel_flags(c1), AST_FLAG_ZOMBIE) || ast_check_hangup_locked(c1)) {
*fo = NULL; *fo = NULL;
res = 0; 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_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_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_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"); ast_check_hangup(c1) ? "Yes" : "No");
break; break;
} }
@ -7476,27 +7451,27 @@ enum ast_bridge_result ast_channel_bridge(struct ast_channel *c0, struct ast_cha
!ast_channel_masq(c0) && !ast_channel_masqr(c0) && !ast_channel_masq(c1) && !ast_channel_masqr(c1)) { !ast_channel_masq(c0) && !ast_channel_masqr(c0) && !ast_channel_masq(c1) && !ast_channel_masqr(c1)) {
int timeoutms = to - 1000 > 0 ? to - 1000 : to; int timeoutms = to - 1000 > 0 ? to - 1000 : to;
/* Looks like they share a bridge method and nothing else is in the way */ /* Looks like they share a bridge method and nothing else is in the way */
ast_set_flag(c0, AST_FLAG_NBRIDGE); ast_set_flag(ast_channel_flags(c0), AST_FLAG_NBRIDGE);
ast_set_flag(c1, 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) { if ((res = ast_channel_tech(c0)->bridge(c0, c1, config->flags, fo, rc, timeoutms)) == AST_BRIDGE_COMPLETE) {
manager_bridge_event(0, 1, c0, c1); 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_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(ast_channel_flags(c0), AST_FLAG_NBRIDGE);
ast_clear_flag(c1, 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. */ if ((ast_channel_softhangup_internal_flag(c0) | ast_channel_softhangup_internal_flag(c1)) & AST_SOFTHANGUP_UNBRIDGE) {/* Bit operators are intentional. */
continue; continue;
} }
c0->_bridge = NULL; ast_channel_internal_bridged_channel_set(c0, NULL);
c1->_bridge = NULL; ast_channel_internal_bridged_channel_set(c1, NULL);
ast_format_cap_destroy(o0nativeformats); ast_format_cap_destroy(o0nativeformats);
ast_format_cap_destroy(o1nativeformats); ast_format_cap_destroy(o1nativeformats);
return res; return res;
} else { } else {
ast_clear_flag(c0, AST_FLAG_NBRIDGE); ast_clear_flag(ast_channel_flags(c0), AST_FLAG_NBRIDGE);
ast_clear_flag(c1, AST_FLAG_NBRIDGE); ast_clear_flag(ast_channel_flags(c1), AST_FLAG_NBRIDGE);
} }
switch (res) { switch (res) {
case AST_BRIDGE_RETRY: case AST_BRIDGE_RETRY:
@ -7540,15 +7515,15 @@ enum ast_bridge_result ast_channel_bridge(struct ast_channel *c0, struct ast_cha
} }
} }
ast_clear_flag(c0, AST_FLAG_END_DTMF_ONLY); ast_clear_flag(ast_channel_flags(c0), AST_FLAG_END_DTMF_ONLY);
ast_clear_flag(c1, 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 */ /* Now that we have broken the bridge the source will change yet again */
ast_indicate(c0, AST_CONTROL_SRCUPDATE); ast_indicate(c0, AST_CONTROL_SRCUPDATE);
ast_indicate(c1, AST_CONTROL_SRCUPDATE); ast_indicate(c1, AST_CONTROL_SRCUPDATE);
c0->_bridge = NULL; ast_channel_internal_bridged_channel_set(c0, NULL);
c1->_bridge = NULL; ast_channel_internal_bridged_channel_set(c1, NULL);
manager_bridge_event(0, 1, c0, c1); 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)); ast_debug(1, "Bridge stops bridging channels %s and %s\n", ast_channel_name(c0), ast_channel_name(c1));
@ -7658,7 +7633,7 @@ static void *tonepair_alloc(struct ast_channel *chan, void *params)
ts->modulate = 0; ts->modulate = 0;
} }
/* Let interrupts interrupt :) */ /* Let interrupts interrupt :) */
ast_set_flag(chan, AST_FLAG_WRITE_INT); ast_set_flag(ast_channel_flags(chan), AST_FLAG_WRITE_INT);
return ts; return ts;
} }

File diff suppressed because it is too large Load Diff

@ -1494,10 +1494,10 @@ static char *handle_showchan(struct ast_cli_entry *e, int cmd, struct ast_cli_ar
ast_channel_fin(c) & ~DEBUGCHAN_FLAG, (ast_channel_fin(c) & DEBUGCHAN_FLAG) ? " (DEBUGGED)" : "", ast_channel_fin(c) & ~DEBUGCHAN_FLAG, (ast_channel_fin(c) & DEBUGCHAN_FLAG) ? " (DEBUGGED)" : "",
ast_channel_fout(c) & ~DEBUGCHAN_FLAG, (ast_channel_fout(c) & DEBUGCHAN_FLAG) ? " (DEBUGGED)" : "", ast_channel_fout(c) & ~DEBUGCHAN_FLAG, (ast_channel_fout(c) & DEBUGCHAN_FLAG) ? " (DEBUGGED)" : "",
(long)ast_channel_whentohangup(c)->tv_sec, (long)ast_channel_whentohangup(c)->tv_sec,
cdrtime, c->_bridge ? ast_channel_name(c->_bridge) : "<none>", ast_bridged_channel(c) ? ast_channel_name(ast_bridged_channel(c)) : "<none>", 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_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_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)) { if (pbx_builtin_serialize_variables(c, &obuf)) {
ast_str_append(&output, 0, " Variables:\n%s\n", ast_str_buffer(obuf)); ast_str_append(&output, 0, " Variables:\n%s\n", ast_str_buffer(obuf));

@ -892,7 +892,7 @@ static void check_goto_on_transfer(struct ast_channel *chan)
} }
ast_parseable_goto(xferchan, goto_on_transfer); ast_parseable_goto(xferchan, goto_on_transfer);
ast_channel_state_set(xferchan, AST_STATE_UP); 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); ast_channel_clear_softhangup(xferchan, AST_SOFTHANGUP_ALL);
if (ast_do_masquerade(xferchan) || ast_pbx_start(xferchan)) { if (ast_do_masquerade(xferchan) || ast_pbx_start(xferchan)) {
@ -1547,10 +1547,10 @@ static int park_call_full(struct ast_channel *chan, struct ast_channel *peer, st
* parking space number do not continue playing it back. This * parking space number do not continue playing it back. This
* is the case if an attended transfer occurs. * 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 */ /* Tell the peer channel the number of the parking space */
ast_say_digits(peer, pu->parkingnum, "", ast_channel_language(peer)); 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 */ if (peer == chan) { /* pu->notquiteyet = 1 */
/* Wake up parking thread if we're really done */ /* Wake up parking thread if we're really done */
@ -2354,7 +2354,7 @@ static int builtin_blindtransfer(struct ast_channel *chan, struct ast_channel *p
} else { } else {
/* Set the transferee's new extension, since it exists, using transferer context */ /* 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_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); set_c_e_p(transferee, transferer_real_context, xferto, 0);
/* /*
@ -2586,13 +2586,13 @@ static int builtin_atxfer(struct ast_channel *chan, struct ast_channel *peer, st
/* ast_bridge_call clears AST_FLAG_BRIDGE_HANGUP_DONT, but we don't /* 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 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; hangup_dont = 1;
} }
/* Let party B and party C talk as long as they want. */ /* Let party B and party C talk as long as they want. */
ast_bridge_call(transferer, newchan, &bconfig); ast_bridge_call(transferer, newchan, &bconfig);
if (hangup_dont) { 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)) { if (ast_check_hangup(newchan) || !ast_check_hangup(transferer)) {
@ -2733,13 +2733,13 @@ static int builtin_atxfer(struct ast_channel *chan, struct ast_channel *peer, st
ast_channel_masquerade(xferchan, transferee); ast_channel_masquerade(xferchan, transferee);
ast_explicit_goto(xferchan, ast_channel_context(transferee), ast_channel_exten(transferee), ast_channel_priority(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_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. */ /* Do the masquerade manually to make sure that is is completed. */
ast_do_masquerade(xferchan); ast_do_masquerade(xferchan);
ast_channel_state_set(newchan, AST_STATE_UP); 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)); tobj = ast_calloc(1, sizeof(*tobj));
if (!tobj) { if (!tobj) {
ast_hangup(xferchan); ast_hangup(xferchan);
@ -3714,13 +3714,13 @@ void ast_channel_log(char *title, struct ast_channel *chan) /* for debug, this i
ast_channel_accountcode(chan), ast_channel_dialcontext(chan), ast_channel_amaflags(chan), ast_channel_macrocontext(chan), ast_channel_macroexten(chan), ast_channel_macropriority(chan)); ast_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_log(LOG_NOTICE, "CHAN: masq: %p; masqr: %p; _bridge: %p; uniqueID: %s; linkedID:%s\n",
ast_channel_masq(chan), ast_channel_masqr(chan), 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)) { if (ast_channel_masqr(chan)) {
ast_log(LOG_NOTICE, "CHAN: masquerading as: %s; cdr: %p;\n", 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))); ast_channel_name(ast_channel_masqr(chan)), ast_channel_cdr(ast_channel_masqr(chan)));
} }
if (chan->_bridge) { if (ast_channel_internal_bridged_channel(chan)) {
ast_log(LOG_NOTICE, "CHAN: Bridged to %s\n", ast_channel_name(chan->_bridge)); 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_log(LOG_NOTICE, "===== done ====\n");
@ -4024,7 +4024,7 @@ int ast_bridge_call(struct ast_channel *chan, struct ast_channel *peer, struct a
ast_cdr_answer(chan_cdr); /* for the sake of cli status checks */ 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) { if (chan_cdr) {
ast_set_flag(chan_cdr, AST_CDR_FLAG_BRIDGED); ast_set_flag(chan_cdr, AST_CDR_FLAG_BRIDGED);
} }
@ -4051,8 +4051,8 @@ int ast_bridge_call(struct ast_channel *chan, struct ast_channel *peer, struct a
res = ast_channel_bridge(chan, peer, config, &f, &who); res = ast_channel_bridge(chan, peer, config, &f, &who);
if (ast_test_flag(chan, AST_FLAG_ZOMBIE) if (ast_test_flag(ast_channel_flags(chan), AST_FLAG_ZOMBIE)
|| ast_test_flag(peer, AST_FLAG_ZOMBIE)) { || ast_test_flag(ast_channel_flags(peer), AST_FLAG_ZOMBIE)) {
/* Zombies are present time to leave! */ /* Zombies are present time to leave! */
res = -1; res = -1;
if (f) { if (f) {
@ -4122,7 +4122,7 @@ int ast_bridge_call(struct ast_channel *chan, struct ast_channel *peer, struct a
} }
} }
if (res < 0) { 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)); ast_log(LOG_WARNING, "Bridge failed on channels %s and %s\n", ast_channel_name(chan), ast_channel_name(peer));
} }
goto before_you_go; goto before_you_go;
@ -4139,7 +4139,7 @@ int ast_bridge_call(struct ast_channel *chan, struct ast_channel *peer, struct a
*/ */
ast_channel_lock(chan); ast_channel_lock(chan);
if (ast_channel_softhangup_internal_flag(chan) & (AST_SOFTHANGUP_ASYNCGOTO | AST_SOFTHANGUP_UNBRIDGE)) { 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); ast_channel_unlock(chan);
res = -1; res = -1;
@ -4300,8 +4300,8 @@ before_you_go:
silgen = NULL; silgen = NULL;
} }
if (ast_test_flag(chan,AST_FLAG_BRIDGE_HANGUP_DONT)) { if (ast_test_flag(ast_channel_flags(chan), AST_FLAG_BRIDGE_HANGUP_DONT)) {
ast_clear_flag(chan,AST_FLAG_BRIDGE_HANGUP_DONT); /* its job is done */ ast_clear_flag(ast_channel_flags(chan), AST_FLAG_BRIDGE_HANGUP_DONT); /* its job is done */
if (bridge_cdr) { if (bridge_cdr) {
ast_cdr_discard(bridge_cdr); ast_cdr_discard(bridge_cdr);
/* QUESTION: should we copy bridge_cdr fields to the peer before we throw it away? */ /* QUESTION: should we copy bridge_cdr fields to the peer before we throw it away? */
@ -4345,8 +4345,8 @@ before_you_go:
*/ */
ast_softhangup(chan, AST_SOFTHANGUP_APPUNLOAD); ast_softhangup(chan, AST_SOFTHANGUP_APPUNLOAD);
autoloopflag = ast_test_flag(chan, AST_FLAG_IN_AUTOLOOP); autoloopflag = ast_test_flag(ast_channel_flags(chan), AST_FLAG_IN_AUTOLOOP);
ast_set_flag(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) { if (bridge_cdr && ast_opt_end_cdr_before_h_exten) {
ast_cdr_end(bridge_cdr); ast_cdr_end(bridge_cdr);
} }
@ -4395,7 +4395,7 @@ before_you_go:
} }
} }
/* An "h" exten has been run, so indicate that one has been run. */ /* 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); ast_channel_unlock(chan);
/* protect the lastapp/lastdata against the effects of the hangup/dialplan code */ /* protect the lastapp/lastdata against the effects of the hangup/dialplan code */
@ -4403,7 +4403,7 @@ before_you_go:
ast_copy_string(bridge_cdr->lastapp, savelastapp, sizeof(bridge_cdr->lastapp)); ast_copy_string(bridge_cdr->lastapp, savelastapp, sizeof(bridge_cdr->lastapp));
ast_copy_string(bridge_cdr->lastdata, savelastdata, sizeof(bridge_cdr->lastdata)); 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... */ /* obey the NoCDR() wishes. -- move the DISABLED flag to the bridge CDR if it was set on the channel during the bridge... */
@ -4747,9 +4747,9 @@ static int manage_parked_call(struct parkeduser *pu, const struct pollfd *pfds,
} }
if (pfds[y].revents & POLLPRI) { if (pfds[y].revents & POLLPRI) {
ast_set_flag(chan, AST_FLAG_EXCEPTION); ast_set_flag(ast_channel_flags(chan), AST_FLAG_EXCEPTION);
} else { } else {
ast_clear_flag(chan, AST_FLAG_EXCEPTION); ast_clear_flag(ast_channel_flags(chan), AST_FLAG_EXCEPTION);
} }
ast_channel_fdno_set(chan, x); ast_channel_fdno_set(chan, x);
@ -7227,7 +7227,7 @@ static const struct ast_datastore_info pickup_active = {
int ast_can_pickup(struct ast_channel *chan) 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_RINGING
|| ast_channel_state(chan) == AST_STATE_RING || ast_channel_state(chan) == AST_STATE_RING
/* /*
@ -7353,7 +7353,7 @@ int ast_do_pickup(struct ast_channel *chan, struct ast_channel *target)
} }
/* setting this flag to generate a reason header in the cancel message to the ringing channel */ /* 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)) { if (ast_channel_masquerade(target, chan)) {
ast_log(LOG_WARNING, "Unable to masquerade '%s' into '%s'\n", chan_name, ast_log(LOG_WARNING, "Unable to masquerade '%s' into '%s'\n", chan_name,

@ -1040,7 +1040,7 @@ int ast_streamfile(struct ast_channel *chan, const char *filename, const char *p
ast_debug(1, "Ooh, found a video stream, too, format %s\n", ast_getformatname(&vfs->fmt->format)); 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)); fs->orig_chan_name = ast_strdup(ast_channel_name(chan));
if (ast_applystream(chan, fs)) if (ast_applystream(chan, fs))
return -1; return -1;
@ -1252,9 +1252,9 @@ static int waitstream_core(struct ast_channel *c, const char *breakon,
reverse = ""; reverse = "";
/* Switch the channel to end DTMF frame only. waitstream_core doesn't care about the start of DTMF. */ /* 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)); orig_chan_name = ast_strdupa(ast_channel_name(c));
while (ast_channel_stream(c)) { while (ast_channel_stream(c)) {
@ -1269,7 +1269,7 @@ static int waitstream_core(struct ast_channel *c, const char *breakon,
ms = ast_sched_wait(ast_channel_sched(c)); ms = ast_sched_wait(ast_channel_sched(c));
if (ms < 0 && !c->timingfunc) { if (ms < 0 && !ast_channel_timingfunc(c)) {
ast_stopstream(c); ast_stopstream(c);
break; break;
} }
@ -1279,7 +1279,7 @@ static int waitstream_core(struct ast_channel *c, const char *breakon,
res = ast_waitfor(c, ms); res = ast_waitfor(c, ms);
if (res < 0) { if (res < 0) {
ast_log(LOG_WARNING, "Select failed (%s)\n", strerror(errno)); 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; return res;
} }
} else { } else {
@ -1290,11 +1290,11 @@ static int waitstream_core(struct ast_channel *c, const char *breakon,
if (errno == EINTR) if (errno == EINTR)
continue; continue;
ast_log(LOG_WARNING, "Wait failed (%s)\n", strerror(errno)); 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; return -1;
} else if (outfd > -1) { /* this requires cmdfd set */ } else if (outfd > -1) { /* this requires cmdfd set */
/* The FD we were watching has something waiting */ /* 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; return 1;
} }
/* if rchan is set, it is 'c' */ /* if rchan is set, it is 'c' */
@ -1303,7 +1303,7 @@ static int waitstream_core(struct ast_channel *c, const char *breakon,
if (res > 0) { if (res > 0) {
struct ast_frame *fr = ast_read(c); struct ast_frame *fr = ast_read(c);
if (!fr) { 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; return -1;
} }
switch (fr->frametype) { switch (fr->frametype) {
@ -1314,7 +1314,7 @@ static int waitstream_core(struct ast_channel *c, const char *breakon,
S_COR(ast_channel_caller(c)->id.number.valid, ast_channel_caller(c)->id.number.str, NULL))) { S_COR(ast_channel_caller(c)->id.number.valid, ast_channel_caller(c)->id.number.str, NULL))) {
res = fr->subclass.integer; res = fr->subclass.integer;
ast_frfree(fr); 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; return res;
} }
} else { } else {
@ -1332,7 +1332,7 @@ static int waitstream_core(struct ast_channel *c, const char *breakon,
ast_stream_rewind(ast_channel_stream(c), skip_ms); ast_stream_rewind(ast_channel_stream(c), skip_ms);
} else if (strchr(breakon, res)) { } else if (strchr(breakon, res)) {
ast_frfree(fr); 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; return res;
} }
} }
@ -1343,7 +1343,7 @@ static int waitstream_core(struct ast_channel *c, const char *breakon,
case AST_CONTROL_BUSY: case AST_CONTROL_BUSY:
case AST_CONTROL_CONGESTION: case AST_CONTROL_CONGESTION:
ast_frfree(fr); 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; return -1;
case AST_CONTROL_RINGING: case AST_CONTROL_RINGING:
case AST_CONTROL_ANSWER: case AST_CONTROL_ANSWER:
@ -1379,7 +1379,7 @@ static int waitstream_core(struct ast_channel *c, const char *breakon,
ast_sched_runq(ast_channel_sched(c)); ast_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; return (err || ast_channel_softhangup_internal_flag(c)) ? -1 : 0;
} }

@ -163,9 +163,9 @@ static void *playtones_alloc(struct ast_channel *chan, void *params)
/* Let interrupts interrupt :) */ /* Let interrupts interrupt :) */
if (pd->interruptible) { if (pd->interruptible) {
ast_set_flag(chan, AST_FLAG_WRITE_INT); ast_set_flag(ast_channel_flags(chan), AST_FLAG_WRITE_INT);
} else { } else {
ast_clear_flag(chan, AST_FLAG_WRITE_INT); ast_clear_flag(ast_channel_flags(chan), AST_FLAG_WRITE_INT);
} }
return ps; return ps;

@ -3321,8 +3321,8 @@ static int action_status(struct mansession *s, const struct message *m)
} }
channels++; channels++;
if (c->_bridge) { if (ast_channel_internal_bridged_channel(c)) {
snprintf(bridge, sizeof(bridge), "BridgedChannel: %s\r\nBridgedUniqueid: %s\r\n", ast_channel_name(c->_bridge), ast_channel_uniqueid(c->_bridge)); 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 { } else {
bridge[0] = '\0'; bridge[0] = '\0';
} }
@ -3502,7 +3502,7 @@ static int action_redirect(struct mansession *s, const struct message *m)
if (ast_channel_pbx(chan)) { if (ast_channel_pbx(chan)) {
ast_channel_lock(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); ast_channel_unlock(chan);
} }
@ -3512,7 +3512,7 @@ static int action_redirect(struct mansession *s, const struct message *m)
if (chan2) { if (chan2) {
if (ast_channel_pbx(chan2)) { if (ast_channel_pbx(chan2)) {
ast_channel_lock(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); ast_channel_unlock(chan2);
} }
if (!ast_strlen_zero(context2)) { if (!ast_strlen_zero(context2)) {

@ -5119,8 +5119,8 @@ static enum ast_pbx_result __ast_pbx_run(struct ast_channel *c,
ast_channel_pbx(c)->rtimeoutms = 10000; ast_channel_pbx(c)->rtimeoutms = 10000;
ast_channel_pbx(c)->dtimeoutms = 5000; ast_channel_pbx(c)->dtimeoutms = 5000;
autoloopflag = ast_test_flag(c, AST_FLAG_IN_AUTOLOOP); /* save value to restore at the end */ autoloopflag = ast_test_flag(ast_channel_flags(c), AST_FLAG_IN_AUTOLOOP); /* save value to restore at the end */
ast_set_flag(c, AST_FLAG_IN_AUTOLOOP); ast_set_flag(ast_channel_flags(c), AST_FLAG_IN_AUTOLOOP);
if (ast_strlen_zero(ast_channel_exten(c))) { if (ast_strlen_zero(ast_channel_exten(c))) {
/* If not successful fall back to 's' - but only if there is no given exten */ /* If not successful fall back to 's' - but only if there is no given exten */
@ -5370,7 +5370,7 @@ static enum ast_pbx_result __ast_pbx_run(struct ast_channel *c,
} }
if ((!args || !args->no_hangup_chan) 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, && 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))) { S_COR(ast_channel_caller(c)->id.number.valid, ast_channel_caller(c)->id.number.str, NULL))) {
set_ext_pri(c, "h", 1); set_ext_pri(c, "h", 1);
@ -5388,8 +5388,8 @@ static enum ast_pbx_result __ast_pbx_run(struct ast_channel *c,
ast_verb(2, "Spawn extension (%s, %s, %d) exited non-zero on '%s'\n", ast_channel_context(c), ast_channel_exten(c), ast_channel_priority(c), ast_channel_name(c)); ast_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_set2_flag(ast_channel_flags(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_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)); pbx_destroy(ast_channel_pbx(c));
ast_channel_pbx_set(c, NULL); ast_channel_pbx_set(c, NULL);
@ -8302,7 +8302,7 @@ int ast_explicit_goto(struct ast_channel *chan, const char *context, const char
if (priority > -1) { if (priority > -1) {
ast_channel_priority_set(chan, priority); ast_channel_priority_set(chan, priority);
/* see flag description in channel.h for explanation */ /* 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); ast_channel_priority_set(chan, ast_channel_priority(chan) - 1);
} }
} }
@ -9977,7 +9977,7 @@ static int pbx_builtin_background(struct ast_channel *chan, const char *data)
* users can EXEC Background and reasonably expect that the DTMF code will * users can EXEC Background and reasonably expect that the DTMF code will
* be returned (see #16434). * 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) && (exten[0] = res)
&& ast_canmatch_extension(chan, args.context, exten, 1, && 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)) S_COR(ast_channel_caller(chan)->id.number.valid, ast_channel_caller(chan)->id.number.str, NULL))

@ -1245,7 +1245,7 @@ static enum ast_bridge_result remote_bridge_loop(struct ast_channel *c0,
cs[1] = cs[2]; 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)); ast_debug(1, "Channel '%s' Zombie cleardown from bridge\n", ast_channel_name(c0));
} else if (ast_channel_tech_pvt(c0) != pvt0) { } 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)); ast_debug(1, "Channel c0->'%s' pvt changed, in bridge with c1->'%s'\n", ast_channel_name(c0), ast_channel_name(c1));
@ -1254,7 +1254,7 @@ static enum ast_bridge_result remote_bridge_loop(struct ast_channel *c0,
} else if (glue0->update_peer(c0, NULL, NULL, NULL, 0, 0)) { } 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)); 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)); ast_debug(1, "Channel '%s' Zombie cleardown from bridge\n", ast_channel_name(c1));
} else if (ast_channel_tech_pvt(c1) != pvt1) { } 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_debug(1, "Channel c1->'%s' pvt changed, in bridge with c0->'%s'\n", ast_channel_name(c1), ast_channel_name(c0));

@ -2496,8 +2496,8 @@ static int handle_exec(struct ast_channel *chan, AGI *agi, int argc, const char
ast_verb(3, "AGI Script Executing Application: (%s) Options: (%s)\n", argv[1], argc >= 3 ? argv[2] : ""); 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 ((app_to_exec = pbx_findapp(argv[1]))) {
if (!(workaround = ast_test_flag(chan, AST_FLAG_DISABLE_WORKAROUNDS))) { if (!(workaround = ast_test_flag(ast_channel_flags(chan), AST_FLAG_DISABLE_WORKAROUNDS))) {
ast_set_flag(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])) { if (ast_compat_res_agi && argc >= 3 && !ast_strlen_zero(argv[2])) {
char *compat = alloca(strlen(argv[2]) * 2 + 1), *cptr; char *compat = alloca(strlen(argv[2]) * 2 + 1), *cptr;
@ -2518,7 +2518,7 @@ static int handle_exec(struct ast_channel *chan, AGI *agi, int argc, const char
res = pbx_exec(chan, app_to_exec, argc == 2 ? "" : argv[2]); res = pbx_exec(chan, app_to_exec, argc == 2 ? "" : argv[2]);
} }
if (!workaround) { if (!workaround) {
ast_clear_flag(chan, AST_FLAG_DISABLE_WORKAROUNDS); ast_clear_flag(ast_channel_flags(chan), AST_FLAG_DISABLE_WORKAROUNDS);
} }
} else { } else {
ast_log(LOG_WARNING, "Could not find application (%s)\n", argv[1]); ast_log(LOG_WARNING, "Could not find application (%s)\n", argv[1]);
@ -3008,7 +3008,7 @@ static int handle_speechrecognize(struct ast_channel *chan, AGI *agi, int argc,
switch (speech->state) { switch (speech->state) {
case AST_SPEECH_STATE_READY: case AST_SPEECH_STATE_READY:
/* If the stream is done, start timeout calculation */ /* 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); ast_stopstream(chan);
time(&start); time(&start);
} }
@ -3018,7 +3018,7 @@ static int handle_speechrecognize(struct ast_channel *chan, AGI *agi, int argc,
break; break;
case AST_SPEECH_STATE_WAIT: case AST_SPEECH_STATE_WAIT:
/* Cue waiting sound if not already playing */ /* 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); ast_stopstream(chan);
/* If a processing sound exists, or is not none - play it */ /* If a processing sound exists, or is not none - play it */
if (!ast_strlen_zero(speech->processing_sound) && strcasecmp(speech->processing_sound, "none")) if (!ast_strlen_zero(speech->processing_sound) && strcasecmp(speech->processing_sound, "none"))

@ -1562,7 +1562,7 @@ static int local_ast_moh_start(struct ast_channel *chan, const char *mclass, con
ast_channel_name(chan), ast_channel_uniqueid(chan), ast_channel_name(chan), ast_channel_uniqueid(chan),
mohclass->name); mohclass->name);
ast_set_flag(chan, AST_FLAG_MOH); ast_set_flag(ast_channel_flags(chan), AST_FLAG_MOH);
if (mohclass->total_files) { if (mohclass->total_files) {
res = ast_activate_generator(chan, &moh_file_stream, mohclass); res = ast_activate_generator(chan, &moh_file_stream, mohclass);
@ -1577,7 +1577,7 @@ static int local_ast_moh_start(struct ast_channel *chan, const char *mclass, con
static void local_ast_moh_stop(struct ast_channel *chan) 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_deactivate_generator(chan);
ast_channel_lock(chan); ast_channel_lock(chan);

@ -503,10 +503,10 @@ static u_char *ast_var_channels_table(struct variable *vp, oid *name, size_t *le
case ASTCHANFLAGS: case ASTCHANFLAGS:
bits_ret[0] = 0; bits_ret[0] = 0;
for (bit = 0; bit < 8; bit++) 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; bits_ret[1] = 0;
for (bit = 0; bit < 8; bit++) 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; *var_len = 2;
ret = bits_ret; ret = bits_ret;
break; break;

Loading…
Cancel
Save