diff options
Diffstat (limited to 'apps')
51 files changed, 354 insertions, 352 deletions
diff --git a/apps/app_alarmreceiver.c b/apps/app_alarmreceiver.c index 44782f0c7..c4309e065 100644 --- a/apps/app_alarmreceiver.c +++ b/apps/app_alarmreceiver.c @@ -266,7 +266,7 @@ static int receive_dtmf_digits(struct ast_channel *chan, char *digit_string, int /* If they hung up, leave */ if ((f->frametype == AST_FRAME_CONTROL) && (f->subclass.integer == AST_CONTROL_HANGUP)) { if (f->data.uint32) { - chan->hangupcause = f->data.uint32; + ast_channel_hangupcause_set(chan, f->data.uint32); } ast_frfree(f); res = -1; @@ -597,7 +597,7 @@ static int alarmreceiver_exec(struct ast_channel *chan, const char *data) /* Answer the channel if it is not already */ ast_verb(4, "AlarmReceiver: Answering channel\n"); - if (chan->_state != AST_STATE_UP) { + if (ast_channel_state(chan) != AST_STATE_UP) { if ((res = ast_answer(chan))) return -1; } diff --git a/apps/app_authenticate.c b/apps/app_authenticate.c index 45e6d9602..fbb430089 100644 --- a/apps/app_authenticate.c +++ b/apps/app_authenticate.c @@ -133,7 +133,7 @@ static int auth_exec(struct ast_channel *chan, const char *data) return -1; } - if (chan->_state != AST_STATE_UP) { + if (ast_channel_state(chan) != AST_STATE_UP) { if ((res = ast_answer(chan))) return -1; } diff --git a/apps/app_cdr.c b/apps/app_cdr.c index 2f227b049..3c244712b 100644 --- a/apps/app_cdr.c +++ b/apps/app_cdr.c @@ -52,8 +52,8 @@ static const char nocdr_app[] = "NoCDR"; static int nocdr_exec(struct ast_channel *chan, const char *data) { - if (chan->cdr) - ast_set_flag(chan->cdr, AST_CDR_FLAG_POST_DISABLED); + if (ast_channel_cdr(chan)) + ast_set_flag(ast_channel_cdr(chan), AST_CDR_FLAG_POST_DISABLED); return 0; } diff --git a/apps/app_chanisavail.c b/apps/app_chanisavail.c index 37ba214ca..fd88b91e1 100644 --- a/apps/app_chanisavail.c +++ b/apps/app_chanisavail.c @@ -169,7 +169,7 @@ static int chanavail_exec(struct ast_channel *chan, const char *data) } snprintf(tmp, sizeof(tmp), "%d", status); ast_str_append(&tmp_availstat, 0, "%s%s", ast_str_strlen(tmp_availstat) ? "&" : "", tmp); - if ((inuse <= 1) && (tempchan = ast_request(tech, chan->nativeformats, chan, number, &status))) { + if ((inuse <= 1) && (tempchan = ast_request(tech, ast_channel_nativeformats(chan), chan, number, &status))) { ast_str_append(&tmp_availchan, 0, "%s%s", ast_str_strlen(tmp_availchan) ? "&" : "", ast_channel_name(tempchan)); snprintf(tmp, sizeof(tmp), "%s/%s", tech, number); diff --git a/apps/app_channelredirect.c b/apps/app_channelredirect.c index 8fe543dab..bea7a91f1 100644 --- a/apps/app_channelredirect.c +++ b/apps/app_channelredirect.c @@ -96,7 +96,7 @@ static int asyncgoto_exec(struct ast_channel *chan, const char *data) return 0; } - if (chan2->pbx) { + 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 */ } diff --git a/apps/app_chanspy.c b/apps/app_chanspy.c index b56672dd2..621f98b2c 100644 --- a/apps/app_chanspy.c +++ b/apps/app_chanspy.c @@ -787,7 +787,7 @@ static int common_exec(struct ast_channel *chan, struct ast_flags *flags, ast_channel_unlock(chan); } - if (chan->_state != AST_STATE_UP) + if (ast_channel_state(chan) != AST_STATE_UP) ast_answer(chan); ast_set_flag(chan, AST_FLAG_SPYING); /* so nobody can spy on us while we are spying */ diff --git a/apps/app_confbridge.c b/apps/app_confbridge.c index 8c03509c9..4e9d5a5e0 100644 --- a/apps/app_confbridge.c +++ b/apps/app_confbridge.c @@ -378,8 +378,8 @@ static struct ast_channel *rec_request(const char *type, struct ast_format_cap * return NULL; } ast_format_set(&fmt, AST_FORMAT_SLINEAR, 0); - tmp->tech = &record_tech; - ast_format_cap_add_all(tmp->nativeformats); + ast_channel_tech_set(tmp, &record_tech); + ast_format_cap_add_all(ast_channel_nativeformats(tmp)); ast_format_copy(&tmp->writeformat, &fmt); ast_format_copy(&tmp->rawwriteformat, &fmt); ast_format_copy(&tmp->readformat, &fmt); @@ -873,7 +873,7 @@ static void destroy_conference_bridge(void *obj) ast_mutex_destroy(&conference_bridge->playback_lock); if (conference_bridge->playback_chan) { - struct ast_channel *underlying_channel = conference_bridge->playback_chan->tech->bridged_channel(conference_bridge->playback_chan, NULL); + struct ast_channel *underlying_channel = ast_channel_tech(conference_bridge->playback_chan)->bridged_channel(conference_bridge->playback_chan, NULL); if (underlying_channel) { ast_hangup(underlying_channel); } @@ -1159,10 +1159,10 @@ static int play_sound_helper(struct conference_bridge *conference_bridge, const ast_mutex_unlock(&conference_bridge->playback_lock); return -1; } - underlying_channel = conference_bridge->playback_chan->tech->bridged_channel(conference_bridge->playback_chan, NULL); + underlying_channel = ast_channel_tech(conference_bridge->playback_chan)->bridged_channel(conference_bridge->playback_chan, NULL); } else { /* Channel was already available so we just need to add it back into the bridge */ - underlying_channel = conference_bridge->playback_chan->tech->bridged_channel(conference_bridge->playback_chan, NULL); + underlying_channel = ast_channel_tech(conference_bridge->playback_chan)->bridged_channel(conference_bridge->playback_chan, NULL); ast_bridge_impart(conference_bridge->bridge, underlying_channel, NULL, NULL, 0); } @@ -1333,7 +1333,7 @@ static int confbridge_exec(struct ast_channel *chan, const char *data) ); ast_bridge_features_init(&conference_bridge_user.features); - if (chan->_state != AST_STATE_UP) { + if (ast_channel_state(chan) != AST_STATE_UP) { ast_answer(chan); } @@ -1729,14 +1729,14 @@ static int action_dialplan_exec(struct ast_bridge_channel *bridge_channel, struc /*save off*/ exten = ast_strdupa(ast_channel_exten(bridge_channel->chan)); context = ast_strdupa(ast_channel_context(bridge_channel->chan)); - priority = bridge_channel->chan->priority; - pbx = bridge_channel->chan->pbx; - bridge_channel->chan->pbx = NULL; + priority = ast_channel_priority(bridge_channel->chan); + pbx = ast_channel_pbx(bridge_channel->chan); + ast_channel_pbx_set(bridge_channel->chan, NULL); /*set new*/ ast_channel_exten_set(bridge_channel->chan, menu_action->data.dialplan_args.exten); ast_channel_context_set(bridge_channel->chan, menu_action->data.dialplan_args.context); - bridge_channel->chan->priority = menu_action->data.dialplan_args.priority; + ast_channel_priority_set(bridge_channel->chan, menu_action->data.dialplan_args.priority); ast_channel_unlock(bridge_channel->chan); @@ -1748,8 +1748,8 @@ static int action_dialplan_exec(struct ast_bridge_channel *bridge_channel, struc ast_channel_exten_set(bridge_channel->chan, exten); ast_channel_context_set(bridge_channel->chan, context); - bridge_channel->chan->priority = priority; - bridge_channel->chan->pbx = pbx; + ast_channel_priority_set(bridge_channel->chan, priority); + ast_channel_pbx_set(bridge_channel->chan, pbx); ast_channel_unlock(bridge_channel->chan); diff --git a/apps/app_dahdibarge.c b/apps/app_dahdibarge.c index 5384c6814..4fde46687 100644 --- a/apps/app_dahdibarge.c +++ b/apps/app_dahdibarge.c @@ -127,7 +127,7 @@ static int conf_run(struct ast_channel *chan, int confno, int confflags) goto outrun; } ast_indicate(chan, -1); - retrydahdi = strcasecmp(chan->tech->type, "DAHDI"); + retrydahdi = strcasecmp(ast_channel_tech(chan)->type, "DAHDI"); dahdiretry: origfd = chan->fds[0]; if (retrydahdi) { @@ -277,7 +277,7 @@ static int conf_exec(struct ast_channel *chan, const char *data) } } - if (chan->_state != AST_STATE_UP) + if (ast_channel_state(chan) != AST_STATE_UP) ast_answer(chan); while(!confno && (++retrycnt < 4)) { diff --git a/apps/app_dahdiras.c b/apps/app_dahdiras.c index dcf0cafb3..e6b080f81 100644 --- a/apps/app_dahdiras.c +++ b/apps/app_dahdiras.c @@ -200,9 +200,9 @@ static int dahdiras_exec(struct ast_channel *chan, const char *data) args = ast_strdupa(data); /* Answer the channel if it's not up */ - if (chan->_state != AST_STATE_UP) + if (ast_channel_state(chan) != AST_STATE_UP) ast_answer(chan); - if (strcasecmp(chan->tech->type, "DAHDI")) { + if (strcasecmp(ast_channel_tech(chan)->type, "DAHDI")) { /* If it's not a DAHDI channel, we're done. Wait a couple of seconds and then hangup... */ ast_verb(2, "Channel %s is not a DAHDI channel\n", ast_channel_name(chan)); diff --git a/apps/app_dial.c b/apps/app_dial.c index 7543bd22b..03eae32ea 100644 --- a/apps/app_dial.c +++ b/apps/app_dial.c @@ -658,8 +658,8 @@ END_OPTIONS ); OPT_CALLER_HANGUP | OPT_CALLEE_TRANSFER | OPT_CALLER_TRANSFER | \ OPT_CALLEE_MONITOR | OPT_CALLER_MONITOR | OPT_CALLEE_PARK | \ OPT_CALLER_PARK | OPT_ANNOUNCE | OPT_CALLEE_MACRO | OPT_CALLEE_GOSUB) && \ - !chan->audiohooks && !peer->audiohooks && \ - ast_framehook_list_is_empty(chan->framehooks) && ast_framehook_list_is_empty(peer->framehooks)) + !ast_channel_audiohooks(chan) && !ast_channel_audiohooks(peer) && \ + ast_framehook_list_is_empty(ast_channel_framehooks(chan)) && ast_framehook_list_is_empty(ast_channel_framehooks(peer))) /* * The list of active channels @@ -695,7 +695,7 @@ static void hanguptree(struct chanlist *outgoing, struct ast_channel *exception, /* The flag is used for local channel inheritance and stuff */ ast_set_flag(outgoing->chan, AST_FLAG_ANSWERED_ELSEWHERE); /* This is for the channel drivers */ - outgoing->chan->hangupcause = AST_CAUSE_ANSWERED_ELSEWHERE; + ast_channel_hangupcause_set(outgoing->chan, AST_CAUSE_ANSWERED_ELSEWHERE); } ast_hangup(outgoing->chan); } @@ -719,7 +719,7 @@ struct cause_args { static void handle_cause(int cause, struct cause_args *num) { - struct ast_cdr *cdr = num->chan->cdr; + struct ast_cdr *cdr = ast_channel_cdr(num->chan); switch(cause) { case AST_CAUSE_BUSY: @@ -869,7 +869,7 @@ static void do_forward(struct chanlist *o, cause = AST_CAUSE_BUSY; } else { /* Setup parameters */ - c = o->chan = ast_request(tech, in->nativeformats, in, stuff, &cause); + c = o->chan = ast_request(tech, ast_channel_nativeformats(in), in, stuff, &cause); if (c) { if (single) ast_channel_make_compatible(o->chan, in); @@ -1039,7 +1039,7 @@ static struct ast_channel *wait_for_answer(struct ast_channel *in, */ *to = -1; strcpy(pa->status, "CONGESTION"); - ast_cdr_failed(in->cdr); + ast_cdr_failed(ast_channel_cdr(in)); return NULL; } } @@ -1100,7 +1100,7 @@ static struct ast_channel *wait_for_answer(struct ast_channel *in, if (c == NULL) continue; - if (ast_test_flag64(o, DIAL_STILLGOING) && c->_state == AST_STATE_UP) { + if (ast_test_flag64(o, DIAL_STILLGOING) && ast_channel_state(c) == AST_STATE_UP) { if (!peer) { ast_verb(3, "%s answered %s\n", ast_channel_name(c), ast_channel_name(in)); if (!single && !ast_test_flag64(peerflags, OPT_IGNORE_CONNECTEDLINE)) { @@ -1157,14 +1157,14 @@ static struct ast_channel *wait_for_answer(struct ast_channel *in, } f = ast_read(winner); if (!f) { - in->hangupcause = c->hangupcause; + ast_channel_hangupcause_set(in, ast_channel_hangupcause(c)); #ifdef HAVE_EPOLL ast_poll_channel_del(in, c); #endif ast_hangup(c); c = o->chan = NULL; ast_clear_flag64(o, DIAL_STILLGOING); - handle_cause(in->hangupcause, &num); + handle_cause(ast_channel_hangupcause(in), &num); continue; } if (f->frametype == AST_FRAME_CONTROL) { @@ -1196,9 +1196,9 @@ static struct ast_channel *wait_for_answer(struct ast_channel *in, } } peer = c; - if (peer->cdr) { - peer->cdr->answer = ast_tvnow(); - peer->cdr->disposition = AST_CDR_ANSWERED; + if (ast_channel_cdr(peer)) { + ast_channel_cdr(peer)->answer = ast_tvnow(); + ast_channel_cdr(peer)->disposition = AST_CDR_ANSWERED; } ast_copy_flags64(peerflags, o, OPT_CALLEE_TRANSFER | OPT_CALLER_TRANSFER | @@ -1214,12 +1214,12 @@ static struct ast_channel *wait_for_answer(struct ast_channel *in, ast_channel_early_bridge(in, peer); } /* If call has been answered, then the eventual hangup is likely to be normal hangup */ - in->hangupcause = AST_CAUSE_NORMAL_CLEARING; - c->hangupcause = AST_CAUSE_NORMAL_CLEARING; + ast_channel_hangupcause_set(in, AST_CAUSE_NORMAL_CLEARING); + ast_channel_hangupcause_set(c, AST_CAUSE_NORMAL_CLEARING); break; case AST_CONTROL_BUSY: ast_verb(3, "%s is busy\n", ast_channel_name(c)); - in->hangupcause = c->hangupcause; + ast_channel_hangupcause_set(in, ast_channel_hangupcause(c)); ast_hangup(c); c = o->chan = NULL; ast_clear_flag64(o, DIAL_STILLGOING); @@ -1227,7 +1227,7 @@ static struct ast_channel *wait_for_answer(struct ast_channel *in, break; case AST_CONTROL_CONGESTION: ast_verb(3, "%s is circuit-busy\n", ast_channel_name(c)); - in->hangupcause = c->hangupcause; + ast_channel_hangupcause_set(in, ast_channel_hangupcause(c)); ast_hangup(c); c = o->chan = NULL; ast_clear_flag64(o, DIAL_STILLGOING); @@ -1404,10 +1404,10 @@ static struct ast_channel *wait_for_answer(struct ast_channel *in, /* Got hung up */ *to = -1; strcpy(pa->status, "CANCEL"); - ast_cdr_noanswer(in->cdr); + ast_cdr_noanswer(ast_channel_cdr(in)); if (f) { if (f->data.uint32) { - in->hangupcause = f->data.uint32; + ast_channel_hangupcause_set(in, f->data.uint32); } ast_frfree(f); } @@ -1426,7 +1426,7 @@ static struct ast_channel *wait_for_answer(struct ast_channel *in, if (onedigit_goto(in, context, (char) f->subclass.integer, 1)) { ast_verb(3, "User hit %c to disconnect call.\n", f->subclass.integer); *to = 0; - ast_cdr_noanswer(in->cdr); + ast_cdr_noanswer(ast_channel_cdr(in)); *result = f->subclass.integer; strcpy(pa->status, "CANCEL"); ast_frfree(f); @@ -1444,7 +1444,7 @@ static struct ast_channel *wait_for_answer(struct ast_channel *in, ast_verb(3, "User requested call disconnect.\n"); *to = 0; strcpy(pa->status, "CANCEL"); - ast_cdr_noanswer(in->cdr); + ast_cdr_noanswer(ast_channel_cdr(in)); ast_frfree(f); if (is_cc_recall) { ast_cc_completed(in, "CC completed, but the caller hung up with DTMF"); @@ -1510,7 +1510,7 @@ static struct ast_channel *wait_for_answer(struct ast_channel *in, if (!*to) ast_verb(3, "Nobody picked up in %d ms\n", orig); if (!*to || ast_check_hangup(in)) - ast_cdr_noanswer(in->cdr); + ast_cdr_noanswer(ast_channel_cdr(in)); } #ifdef HAVE_EPOLL @@ -1807,20 +1807,20 @@ static void end_bridge_callback(void *data) time_t end; struct ast_channel *chan = data; - if (!chan->cdr) { + if (!ast_channel_cdr(chan)) { return; } time(&end); ast_channel_lock(chan); - if (chan->cdr->answer.tv_sec) { - snprintf(buf, sizeof(buf), "%ld", (long) end - chan->cdr->answer.tv_sec); + if (ast_channel_cdr(chan)->answer.tv_sec) { + snprintf(buf, sizeof(buf), "%ld", (long) end - ast_channel_cdr(chan)->answer.tv_sec); pbx_builtin_setvar_helper(chan, "ANSWEREDTIME", buf); } - if (chan->cdr->start.tv_sec) { - snprintf(buf, sizeof(buf), "%ld", (long) end - chan->cdr->start.tv_sec); + if (ast_channel_cdr(chan)->start.tv_sec) { + snprintf(buf, sizeof(buf), "%ld", (long) end - ast_channel_cdr(chan)->start.tv_sec); pbx_builtin_setvar_helper(chan, "DIALEDTIME", buf); } ast_channel_unlock(chan); @@ -1841,7 +1841,7 @@ static int dial_handle_playtones(struct ast_channel *chan, const char *data) return -1; } - ts = ast_get_indication_tone(chan->zone, str); + ts = ast_get_indication_tone(ast_channel_zone(chan), str); if (ts && ts->data[0]) { res = ast_playtones_start(chan, 0, ts->data, 0); @@ -2081,8 +2081,8 @@ static int dial_exec_full(struct ast_channel *chan, const char *data, struct ast ast_channel_unlock(chan); } - if (ast_test_flag64(&opts, OPT_RESETCDR) && chan->cdr) - ast_cdr_reset(chan->cdr, NULL); + if (ast_test_flag64(&opts, OPT_RESETCDR) && ast_channel_cdr(chan)) + ast_cdr_reset(ast_channel_cdr(chan), NULL); if (ast_test_flag64(&opts, OPT_PRIVACY) && ast_strlen_zero(opt_args[OPT_ARG_PRIVACY])) opt_args[OPT_ARG_PRIVACY] = ast_strdupa(ast_channel_exten(chan)); @@ -2211,14 +2211,14 @@ static int dial_exec_full(struct ast_channel *chan, const char *data, struct ast AST_LIST_UNLOCK(dialed_interfaces); } - tc = ast_request(tech, chan->nativeformats, chan, numsubst, &cause); + tc = ast_request(tech, ast_channel_nativeformats(chan), chan, numsubst, &cause); if (!tc) { /* If we can't, just go on to the next call */ ast_log(LOG_WARNING, "Unable to create channel of type '%s' (cause %d - %s)\n", tech, cause, ast_cause2str(cause)); handle_cause(cause, &num); if (!rest) /* we are on the last destination */ - chan->hangupcause = cause; + ast_channel_hangupcause_set(chan, cause); chanlist_free(tmp); if (!ignore_cc && (cause == AST_CAUSE_BUSY || cause == AST_CAUSE_CONGESTION)) { if (!ast_cc_callback(chan, tech, numsubst, ast_cc_busy_interface)) { @@ -2312,8 +2312,8 @@ static int dial_exec_full(struct ast_channel *chan, const char *data, struct ast ast_channel_musicclass_set(tc, ast_channel_musicclass(chan)); /* Pass ADSI CPE and transfer capability */ - tc->adsicpe = chan->adsicpe; - tc->transfercapability = chan->transfercapability; + ast_channel_adsicpe_set(tc, ast_channel_adsicpe(chan)); + ast_channel_transfercapability_set(tc, ast_channel_transfercapability(chan)); /* If we have an outbound group, set this peer channel to it */ if (outbound_group) @@ -2340,16 +2340,16 @@ static int dial_exec_full(struct ast_channel *chan, const char *data, struct ast ast_channel_lock(chan); /* Save the info in cdr's that we called them */ - if (chan->cdr) - ast_cdr_setdestchan(chan->cdr, ast_channel_name(tc)); + if (ast_channel_cdr(chan)) + ast_cdr_setdestchan(ast_channel_cdr(chan), ast_channel_name(tc)); /* check the results of ast_call */ if (res) { /* Again, keep going even if there's an error */ ast_debug(1, "ast call on peer returned %d\n", res); ast_verb(3, "Couldn't call %s/%s\n", tech, numsubst); - if (tc->hangupcause) { - chan->hangupcause = tc->hangupcause; + if (ast_channel_hangupcause(tc)) { + ast_channel_hangupcause_set(chan, ast_channel_hangupcause(tc)); } ast_channel_unlock(chan); ast_cc_call_failed(chan, tc, interface); @@ -2370,7 +2370,7 @@ static int dial_exec_full(struct ast_channel *chan, const char *data, struct ast tmp->next = outgoing; outgoing = tmp; /* If this line is up, don't try anybody else */ - if (outgoing->chan->_state == AST_STATE_UP) + if (ast_channel_state(outgoing->chan) == AST_STATE_UP) break; } @@ -2458,9 +2458,9 @@ static int dial_exec_full(struct ast_channel *chan, const char *data, struct ast hanguptree(outgoing, peer, 1); outgoing = NULL; /* If appropriate, log that we have a destination channel and set the answer time */ - if (chan->cdr) { - ast_cdr_setdestchan(chan->cdr, ast_channel_name(peer)); - ast_cdr_setanswer(chan->cdr, peer->cdr->answer); + if (ast_channel_cdr(chan)) { + ast_cdr_setdestchan(ast_channel_cdr(chan), ast_channel_name(peer)); + ast_cdr_setanswer(ast_channel_cdr(chan), ast_channel_cdr(peer)->answer); } if (ast_channel_name(peer)) pbx_builtin_setvar_helper(chan, "DIALEDPEERNAME", ast_channel_name(peer)); @@ -2502,10 +2502,10 @@ static int dial_exec_full(struct ast_channel *chan, const char *data, struct ast } ast_set_flag(peer, AST_FLAG_END_DTMF_ONLY); - while (peer->stream) { + while (ast_channel_stream(peer)) { int ms; - ms = ast_sched_wait(peer->sched); + ms = ast_sched_wait(ast_channel_sched(peer)); if (ms < 0 && !peer->timingfunc) { ast_stopstream(peer); @@ -2547,7 +2547,7 @@ static int dial_exec_full(struct ast_channel *chan, const char *data, struct ast } ast_frfree(fr); } - ast_sched_runq(peer->sched); + ast_sched_runq(ast_channel_sched(peer)); } ast_clear_flag(peer, AST_FLAG_END_DTMF_ONLY); } @@ -2555,15 +2555,15 @@ static int dial_exec_full(struct ast_channel *chan, const char *data, struct ast if (chan && peer && ast_test_flag64(&opts, OPT_GOTO) && !ast_strlen_zero(opt_args[OPT_ARG_GOTO])) { /* chan and peer are going into the PBX, they both * should probably get CDR records. */ - ast_clear_flag(chan->cdr, AST_CDR_FLAG_DIALED); - ast_clear_flag(peer->cdr, AST_CDR_FLAG_DIALED); + ast_clear_flag(ast_channel_cdr(chan), AST_CDR_FLAG_DIALED); + ast_clear_flag(ast_channel_cdr(peer), AST_CDR_FLAG_DIALED); replace_macro_delimiter(opt_args[OPT_ARG_GOTO]); ast_parseable_goto(chan, opt_args[OPT_ARG_GOTO]); /* peer goes to the same context and extension as chan, so just copy info from chan*/ ast_channel_context_set(peer, ast_channel_context(chan)); ast_channel_exten_set(peer, ast_channel_exten(chan)); - peer->priority = chan->priority + 2; + ast_channel_priority_set(peer, ast_channel_priority(chan) + 2); ast_pbx_start(peer); hanguptree(outgoing, NULL, ast_test_flag64(&opts, OPT_CANCEL_ELSEWHERE) ? 1 : 0); if (continue_exec) @@ -2659,7 +2659,7 @@ static int dial_exec_full(struct ast_channel *chan, const char *data, struct ast /* Set where we came from */ ast_channel_context_set(peer, "app_dial_gosub_virtual_context"); ast_channel_exten_set(peer, "s"); - peer->priority = 0; + ast_channel_priority_set(peer, 0); gosub_argstart = strchr(opt_args[OPT_ARG_CALLEE_GOSUB], ','); if (gosub_argstart) { @@ -2808,7 +2808,7 @@ static int dial_exec_full(struct ast_channel *chan, const char *data, struct ast } /* Be sure no generators are left on it and reset the visible indication */ ast_deactivate_generator(chan); - chan->visible_indication = 0; + ast_channel_visible_indication_set(chan, 0); /* Make sure channels are compatible */ res = ast_channel_make_compatible(chan, peer); if (res < 0) { @@ -2838,21 +2838,21 @@ static int dial_exec_full(struct ast_channel *chan, const char *data, struct ast int res9; ast_channel_exten_set(peer, "h"); - peer->priority = 1; + ast_channel_priority_set(peer, 1); autoloopflag = ast_test_flag(peer, AST_FLAG_IN_AUTOLOOP); /* save value to restore at the end */ ast_set_flag(peer, AST_FLAG_IN_AUTOLOOP); while ((res9 = ast_spawn_extension(peer, ast_channel_context(peer), ast_channel_exten(peer), - peer->priority, + ast_channel_priority(peer), S_COR(peer->caller.id.number.valid, peer->caller.id.number.str, NULL), &found, 1)) == 0) { - peer->priority++; + ast_channel_priority_set(peer, ast_channel_priority(peer) + 1); } if (found && res9) { /* Something bad happened, or a hangup has been requested. */ - ast_debug(1, "Spawn extension (%s,%s,%d) exited non-zero on '%s'\n", ast_channel_context(peer), ast_channel_exten(peer), peer->priority, 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), peer->priority, 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_set2_flag(peer, autoloopflag, AST_FLAG_IN_AUTOLOOP); /* set it back the way it was */ } @@ -2862,7 +2862,7 @@ static int dial_exec_full(struct ast_channel *chan, const char *data, struct ast ast_parseable_goto(peer, opt_args[OPT_ARG_CALLEE_GO_ON]); } else { /* F() */ int res; - res = ast_goto_if_exists(peer, ast_channel_context(chan), ast_channel_exten(chan), (chan->priority) + 1); + res = ast_goto_if_exists(peer, ast_channel_context(chan), ast_channel_exten(chan), (ast_channel_priority(chan)) + 1); if (res == AST_PBX_GOTO_FAILED) { ast_hangup(peer); goto out; @@ -2871,7 +2871,7 @@ static int dial_exec_full(struct ast_channel *chan, const char *data, struct ast ast_pbx_start(peer); } else { if (!ast_check_hangup(chan)) - chan->hangupcause = peer->hangupcause; + ast_channel_hangupcause_set(chan, ast_channel_hangupcause(peer)); ast_hangup(peer); } } diff --git a/apps/app_dictate.c b/apps/app_dictate.c index 6b2001774..2158b8c86 100644 --- a/apps/app_dictate.c +++ b/apps/app_dictate.c @@ -132,7 +132,7 @@ static int dictate_exec(struct ast_channel *chan, const char *data) return -1; } - if (chan->_state != AST_STATE_UP) { + if (ast_channel_state(chan) != AST_STATE_UP) { ast_answer(chan); } ast_safe_sleep(chan, 200); @@ -278,7 +278,7 @@ static int dictate_exec(struct ast_channel *chan, const char *data) if (!(fs = ast_openstream(chan, path, ast_channel_language(chan)))) break; ast_seekstream(fs, samples, SEEK_SET); - chan->stream = NULL; + ast_channel_stream_set(chan, NULL); } lastop = DMODE_PLAY; } diff --git a/apps/app_directory.c b/apps/app_directory.c index 4db404cff..52e8722c2 100644 --- a/apps/app_directory.c +++ b/apps/app_directory.c @@ -824,7 +824,7 @@ static int directory_exec(struct ast_channel *chan, const char *data) } digits[7] = digit + '0'; - if (chan->_state != AST_STATE_UP) { + if (ast_channel_state(chan) != AST_STATE_UP) { if (!ast_test_flag(&flags, OPT_NOANSWER)) { /* Otherwise answer unless we're supposed to read while on-hook */ res = ast_answer(chan); diff --git a/apps/app_disa.c b/apps/app_disa.c index 7d92b7642..5de3acfa5 100644 --- a/apps/app_disa.c +++ b/apps/app_disa.c @@ -131,9 +131,9 @@ static void play_dialtone(struct ast_channel *chan, char *mailbox) struct ast_tone_zone_sound *ts = NULL; if (ast_app_has_voicemail(mailbox, NULL)) { - ts = ast_get_indication_tone(chan->zone, "dialrecall"); + ts = ast_get_indication_tone(ast_channel_zone(chan), "dialrecall"); } else { - ts = ast_get_indication_tone(chan->zone, "dial"); + ts = ast_get_indication_tone(ast_channel_zone(chan), "dial"); } if (ts) { @@ -147,8 +147,8 @@ static void play_dialtone(struct ast_channel *chan, char *mailbox) static int disa_exec(struct ast_channel *chan, const char *data) { int i = 0, j, k = 0, did_ignore = 0, special_noanswer = 0; - int firstdigittimeout = (chan->pbx ? chan->pbx->rtimeoutms : 20000); - int digittimeout = (chan->pbx ? chan->pbx->dtimeoutms : 10000); + int firstdigittimeout = (ast_channel_pbx(chan) ? ast_channel_pbx(chan)->rtimeoutms : 20000); + int digittimeout = (ast_channel_pbx(chan) ? ast_channel_pbx(chan)->dtimeoutms : 10000); struct ast_flags flags; char *tmp, exten[AST_MAX_EXTENSION] = "", acctcode[20]=""; char pwline[256]; @@ -187,7 +187,7 @@ static int disa_exec(struct ast_channel *chan, const char *data) ast_debug(1, "Mailbox: %s\n",args.mailbox); if (!ast_test_flag(&flags, NOANSWER_FLAG)) { - if (chan->_state != AST_STATE_UP) { + if (ast_channel_state(chan) != AST_STATE_UP) { /* answer */ ast_answer(chan); } @@ -226,7 +226,7 @@ static int disa_exec(struct ast_channel *chan, const char *data) if ((f->frametype == AST_FRAME_CONTROL) && (f->subclass.integer == AST_CONTROL_HANGUP)) { if (f->data.uint32) - chan->hangupcause = f->data.uint32; + ast_channel_hangupcause_set(chan, f->data.uint32); ast_frfree(f); ast_clear_flag(chan, AST_FLAG_END_DTMF_ONLY); return -1; @@ -380,7 +380,7 @@ static int disa_exec(struct ast_channel *chan, const char *data) ast_channel_accountcode_set(chan, acctcode); if (special_noanswer) cdr_flags.flags = 0; - ast_cdr_reset(chan->cdr, &cdr_flags); + ast_cdr_reset(ast_channel_cdr(chan), &cdr_flags); ast_explicit_goto(chan, args.context, exten, 1); return 0; } diff --git a/apps/app_dumpchan.c b/apps/app_dumpchan.c index 8e9c749ae..27e79e198 100644 --- a/apps/app_dumpchan.c +++ b/apps/app_dumpchan.c @@ -83,8 +83,8 @@ static int serialize_showchan(struct ast_channel *c, char *buf, size_t size) if (!c) return 0; - if (c->cdr) { - elapsed_seconds = now.tv_sec - c->cdr->start.tv_sec; + if (ast_channel_cdr(c)) { + elapsed_seconds = now.tv_sec - ast_channel_cdr(c)->start.tv_sec; hour = elapsed_seconds / 3600; min = (elapsed_seconds % 3600) / 60; sec = elapsed_seconds % 60; @@ -128,7 +128,7 @@ static int serialize_showchan(struct ast_channel *c, char *buf, size_t size) "Data= %s\n" "Blocking_in= %s\n", ast_channel_name(c), - c->tech->type, + ast_channel_tech(c)->type, ast_channel_uniqueid(c), ast_channel_linkedid(c), S_COR(c->caller.id.number.valid, c->caller.id.number.str, "(N/A)"), @@ -139,21 +139,21 @@ static int serialize_showchan(struct ast_channel *c, char *buf, size_t size) S_COR(c->redirecting.from.number.valid, c->redirecting.from.number.str, "(N/A)"), ast_channel_parkinglot(c), ast_channel_language(c), - ast_state2str(c->_state), - c->_state, - c->rings, - ast_getformatname_multiple(nf, sizeof(nf), c->nativeformats), + ast_state2str(ast_channel_state(c)), + ast_channel_state(c), + ast_channel_rings(c), + ast_getformatname_multiple(nf, sizeof(nf), ast_channel_nativeformats(c)), ast_getformatname(&c->writeformat), ast_getformatname(&c->readformat), ast_getformatname(&c->rawwriteformat), ast_getformatname(&c->rawreadformat), - c->writetrans ? "Yes" : "No", - ast_translate_path_to_str(c->writetrans, &write_transpath), - c->readtrans ? "Yes" : "No", - ast_translate_path_to_str(c->readtrans, &read_transpath), + ast_channel_writetrans(c) ? "Yes" : "No", + ast_translate_path_to_str(ast_channel_writetrans(c), &write_transpath), + ast_channel_readtrans(c) ? "Yes" : "No", + ast_translate_path_to_str(ast_channel_readtrans(c), &read_transpath), c->fds[0], - c->fin & ~DEBUGCHAN_FLAG, (c->fin & DEBUGCHAN_FLAG) ? " (DEBUGGED)" : "", - c->fout & ~DEBUGCHAN_FLAG, (c->fout & 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)" : "", (long)c->whentohangup.tv_sec, hour, min, @@ -162,7 +162,7 @@ static int serialize_showchan(struct ast_channel *c, char *buf, size_t size) ast_bridged_channel(c) ? ast_channel_name(ast_bridged_channel(c)) : "<none>", ast_channel_context(c), ast_channel_exten(c), - c->priority, + ast_channel_priority(c), ast_print_group(cgrp, sizeof(cgrp), c->callgroup), ast_print_group(pgrp, sizeof(pgrp), c->pickupgroup), ast_channel_appl(c) ? ast_channel_appl(c) : "(N/A)", diff --git a/apps/app_echo.c b/apps/app_echo.c index 2f34b9fe4..a8a7fd84d 100644 --- a/apps/app_echo.c +++ b/apps/app_echo.c @@ -59,7 +59,7 @@ static int echo_exec(struct ast_channel *chan, const char *data) int res = -1; struct ast_format format; - ast_best_codec(chan->nativeformats, &format); + ast_best_codec(ast_channel_nativeformats(chan), &format); ast_set_write_format(chan, &format); ast_set_read_format(chan, &format); diff --git a/apps/app_externalivr.c b/apps/app_externalivr.c index 9377d2320..5873a6408 100644 --- a/apps/app_externalivr.c +++ b/apps/app_externalivr.c @@ -188,7 +188,7 @@ static void gen_closestream(struct gen_state *state) return; ast_closestream(state->stream); - state->u->chan->stream = NULL; + ast_channel_stream_set(state->u->chan, NULL); state->stream = NULL; } @@ -477,7 +477,7 @@ static int app_exec(struct ast_channel *chan, const char *data) if (!(ast_test_flag(&flags, noanswer))) { ast_verb(3, "Answering channel and starting generator\n"); - if (chan->_state != AST_STATE_UP) { + if (ast_channel_state(chan) != AST_STATE_UP) { if (ast_test_flag(&flags, run_dead)) { ast_chan_log(LOG_ERROR, chan, "Running ExternalIVR with 'd'ead flag on non-hungup channel isn't supported\n"); goto exit; @@ -663,7 +663,7 @@ static int eivr_comm(struct ast_channel *chan, struct ivr_localuser *u, rchan = ast_waitfor_nandfds(&chan, 1, waitfds, (eivr_errors_fd) ? 2 : 1, &exception, &ready_fd, &ms); - if (chan->_state == AST_STATE_UP && !AST_LIST_EMPTY(&u->finishlist)) { + if (ast_channel_state(chan) == AST_STATE_UP && !AST_LIST_EMPTY(&u->finishlist)) { AST_LIST_LOCK(&u->finishlist); while ((entry = AST_LIST_REMOVE_HEAD(&u->finishlist, list))) { send_eivr_event(eivr_events, 'F', entry->filename, chan); @@ -672,7 +672,7 @@ static int eivr_comm(struct ast_channel *chan, struct ivr_localuser *u, AST_LIST_UNLOCK(&u->finishlist); } - if (chan->_state == AST_STATE_UP && !(ast_check_hangup(chan)) && rchan) { + if (ast_channel_state(chan) == AST_STATE_UP && !(ast_check_hangup(chan)) && rchan) { /* the channel has something */ f = ast_read(chan); if (!f) { @@ -702,7 +702,7 @@ static int eivr_comm(struct ast_channel *chan, struct ivr_localuser *u, ast_verb(3, "Got AST_CONTROL_HANGUP\n"); send_eivr_event(eivr_events, 'H', NULL, chan); if (f->data.uint32) { - chan->hangupcause = f->data.uint32; + ast_channel_hangupcause_set(chan, f->data.uint32); } ast_frfree(f); break; @@ -735,7 +735,7 @@ static int eivr_comm(struct ast_channel *chan, struct ivr_localuser *u, ast_eivr_senddtmf(chan, &input[2]); } else if (input[0] == EIVR_CMD_ANS) { ast_verb(3, "Answering channel if needed and starting generator\n"); - if (chan->_state != AST_STATE_UP) { + if (ast_channel_state(chan) != AST_STATE_UP) { if (ast_test_flag(&flags, run_dead)) { ast_chan_log(LOG_WARNING, chan, "Running ExternalIVR with 'd'ead flag on non-hungup channel isn't supported\n"); send_eivr_event(eivr_events, 'Z', "ANSWER_FAILURE", chan); @@ -756,7 +756,7 @@ static int eivr_comm(struct ast_channel *chan, struct ivr_localuser *u, } } } else if (input[0] == EIVR_CMD_SQUE) { - if (chan->_state != AST_STATE_UP || ast_check_hangup(chan)) { + if (ast_channel_state(chan) != AST_STATE_UP || ast_check_hangup(chan)) { ast_chan_log(LOG_WARNING, chan, "Queue re'S'et called on unanswered channel\n"); send_eivr_event(eivr_events, 'Z', NULL, chan); continue; @@ -786,7 +786,7 @@ static int eivr_comm(struct ast_channel *chan, struct ivr_localuser *u, AST_LIST_UNLOCK(&u->playlist); } } else if (input[0] == EIVR_CMD_APND) { - if (chan->_state != AST_STATE_UP || ast_check_hangup(chan)) { + if (ast_channel_state(chan) != AST_STATE_UP || ast_check_hangup(chan)) { ast_chan_log(LOG_WARNING, chan, "Queue 'A'ppend called on unanswered channel\n"); send_eivr_event(eivr_events, 'Z', NULL, chan); continue; @@ -827,7 +827,7 @@ static int eivr_comm(struct ast_channel *chan, struct ivr_localuser *u, send_eivr_event(eivr_events, 'H', NULL, chan); break; } else if (input[0] == EIVR_CMD_OPT) { - if (chan->_state != AST_STATE_UP || ast_check_hangup(chan)) { + if (ast_channel_state(chan) != AST_STATE_UP || ast_check_hangup(chan)) { ast_chan_log(LOG_WARNING, chan, "Option called on unanswered channel\n"); send_eivr_event(eivr_events, 'Z', NULL, chan); continue; diff --git a/apps/app_fax.c b/apps/app_fax.c index 3183a5638..2c2960e78 100644 --- a/apps/app_fax.c +++ b/apps/app_fax.c @@ -797,7 +797,7 @@ static int transmit(fax_session *s) pbx_builtin_setvar_helper(s->chan, "FAXRESOLUTION", NULL); pbx_builtin_setvar_helper(s->chan, "FAXBITRATE", NULL); - if (s->chan->_state != AST_STATE_UP) { + if (ast_channel_state(s->chan) != AST_STATE_UP) { /* Shouldn't need this, but checking to see if channel is already answered * Theoretically asterisk should already have answered before running the app */ res = ast_answer(s->chan); diff --git a/apps/app_festival.c b/apps/app_festival.c index d609b3fe4..cd1cfa051 100644 --- a/apps/app_festival.c +++ b/apps/app_festival.c @@ -185,7 +185,7 @@ static int send_waveform_to_channel(struct ast_channel *chan, char *waveform, in } /* Answer if it's not already going */ - if (chan->_state != AST_STATE_UP) + if (ast_channel_state(chan) != AST_STATE_UP) ast_answer(chan); ast_stopstream(chan); ast_indicate(chan, -1); diff --git a/apps/app_flash.c b/apps/app_flash.c index 283953b39..1ee834bbf 100644 --- a/apps/app_flash.c +++ b/apps/app_flash.c @@ -79,7 +79,7 @@ static int flash_exec(struct ast_channel *chan, const char *data) int x; struct dahdi_params dahdip; - if (strcasecmp(chan->tech->type, "DAHDI")) { + if (strcasecmp(ast_channel_tech(chan)->type, "DAHDI")) { ast_log(LOG_WARNING, "%s is not a DAHDI channel\n", ast_channel_name(chan)); return -1; } diff --git a/apps/app_followme.c b/apps/app_followme.c index 878e2eef1..1bf9547a9 100644 --- a/apps/app_followme.c +++ b/apps/app_followme.c @@ -520,23 +520,23 @@ static void clear_caller(struct findme_user *tmpuser) if (tmpuser && tmpuser->ochan && tmpuser->state >= 0) { outbound = tmpuser->ochan; ast_channel_lock(outbound); - if (!outbound->cdr) { - outbound->cdr = ast_cdr_alloc(); - if (outbound->cdr) { - ast_cdr_init(outbound->cdr, outbound); + if (!ast_channel_cdr(outbound)) { + ast_channel_cdr_set(outbound, ast_cdr_alloc()); + if (ast_channel_cdr(outbound)) { + ast_cdr_init(ast_channel_cdr(outbound), outbound); } } - if (outbound->cdr) { + if (ast_channel_cdr(outbound)) { char tmp[256]; snprintf(tmp, sizeof(tmp), "%s/%s", "Local", tmpuser->dialarg); - ast_cdr_setapp(outbound->cdr, "FollowMe", tmp); + ast_cdr_setapp(ast_channel_cdr(outbound), "FollowMe", tmp); ast_cdr_update(outbound); - ast_cdr_start(outbound->cdr); - ast_cdr_end(outbound->cdr); + ast_cdr_start(ast_channel_cdr(outbound)); + ast_cdr_end(ast_channel_cdr(outbound)); /* If the cause wasn't handled properly */ - if (ast_cdr_disposition(outbound->cdr, outbound->hangupcause)) { - ast_cdr_failed(outbound->cdr); + if (ast_cdr_disposition(ast_channel_cdr(outbound), ast_channel_hangupcause(outbound))) { + ast_cdr_failed(ast_channel_cdr(outbound)); } } else { ast_log(LOG_WARNING, "Unable to create Call Detail Record\n"); @@ -624,7 +624,7 @@ static struct ast_channel *wait_for_winner(struct findme_user_listptr *findme_us tmpuser->state = 1; tmpuser->digts = 0; if (!ast_streamfile(tmpuser->ochan, callfromname, ast_channel_language(tmpuser->ochan))) { - ast_sched_runq(tmpuser->ochan->sched); + ast_sched_runq(ast_channel_sched(tmpuser->ochan)); } else { ast_log(LOG_WARNING, "Unable to playback %s.\n", callfromname); return NULL; @@ -633,16 +633,16 @@ static struct ast_channel *wait_for_winner(struct findme_user_listptr *findme_us tmpuser->state = 2; tmpuser->digts = 0; if (!ast_streamfile(tmpuser->ochan, tpargs->norecordingprompt, ast_channel_language(tmpuser->ochan))) - ast_sched_runq(tmpuser->ochan->sched); + ast_sched_runq(ast_channel_sched(tmpuser->ochan)); else { ast_log(LOG_WARNING, "Unable to playback %s.\n", tpargs->norecordingprompt); return NULL; } } } - if (tmpuser->ochan->stream) { - ast_sched_runq(tmpuser->ochan->sched); - tmpto = ast_sched_wait(tmpuser->ochan->sched); + if (ast_channel_stream(tmpuser->ochan)) { + ast_sched_runq(ast_channel_sched(tmpuser->ochan)); + tmpto = ast_sched_wait(ast_channel_sched(tmpuser->ochan)); if (tmpto > 0 && tmpto < to) to = tmpto; else if (tmpto < 0 && !tmpuser->ochan->timingfunc) { @@ -721,7 +721,7 @@ static struct ast_channel *wait_for_winner(struct findme_user_listptr *findme_us case AST_CONTROL_HANGUP: ast_verb(3, "%s received a hangup frame.\n", ast_channel_name(winner)); if (f->data.uint32) { - winner->hangupcause = f->data.uint32; + ast_channel_hangupcause_set(winner, f->data.uint32); } if (dg == 0) { ast_verb(3, "The calling channel hungup. Need to drop everyone else.\n"); @@ -732,13 +732,13 @@ static struct ast_channel *wait_for_winner(struct findme_user_listptr *findme_us case AST_CONTROL_ANSWER: ast_verb(3, "%s answered %s\n", ast_channel_name(winner), ast_channel_name(caller)); /* If call has been answered, then the eventual hangup is likely to be normal hangup */ - winner->hangupcause = AST_CAUSE_NORMAL_CLEARING; - caller->hangupcause = AST_CAUSE_NORMAL_CLEARING; + ast_channel_hangupcause_set(winner, AST_CAUSE_NORMAL_CLEARING); + ast_channel_hangupcause_set(caller, AST_CAUSE_NORMAL_CLEARING); ast_verb(3, "Starting playback of %s\n", callfromname); if (dg > 0) { if (!ast_strlen_zero(namerecloc)) { if (!ast_streamfile(winner, callfromname, ast_channel_language(winner))) { - ast_sched_runq(winner->sched); + ast_sched_runq(ast_channel_sched(winner)); tmpuser->state = 1; } else { ast_log(LOG_WARNING, "Unable to playback %s.\n", callfromname); @@ -748,7 +748,7 @@ static struct ast_channel *wait_for_winner(struct findme_user_listptr *findme_us } else { tmpuser->state = 2; if (!ast_streamfile(tmpuser->ochan, tpargs->norecordingprompt, ast_channel_language(tmpuser->ochan))) - ast_sched_runq(tmpuser->ochan->sched); + ast_sched_runq(ast_channel_sched(tmpuser->ochan)); else { ast_log(LOG_WARNING, "Unable to playback %s.\n", tpargs->norecordingprompt); ast_frfree(f); @@ -838,7 +838,7 @@ static struct ast_channel *wait_for_winner(struct findme_user_listptr *findme_us } } if (tmpuser && tmpuser->state == 3 && f->frametype == AST_FRAME_DTMF) { - if (winner->stream) + if (ast_channel_stream(winner)) ast_stopstream(winner); tmpuser->digts = 0; ast_debug(1, "DTMF received: %c\n", (char) f->subclass.integer); @@ -953,7 +953,7 @@ static void findmeexec(struct fm_args *tpargs) continue; } - outbound = ast_request("Local", caller->nativeformats, caller, dialarg, &dg); + outbound = ast_request("Local", ast_channel_nativeformats(caller), caller, dialarg, &dg); if (outbound) { ast_channel_lock_both(caller, outbound); ast_connected_line_copy_from_caller(&outbound->connected, &caller->caller); @@ -974,21 +974,21 @@ static void findmeexec(struct fm_args *tpargs) } else { ast_verb(3, "couldn't reach at this number.\n"); ast_channel_lock(outbound); - if (!outbound->cdr) { - outbound->cdr = ast_cdr_alloc(); + if (!ast_channel_cdr(outbound)) { + ast_channel_cdr_set(outbound, ast_cdr_alloc()); } - if (outbound->cdr) { + if (ast_channel_cdr(outbound)) { char tmp[256]; - ast_cdr_init(outbound->cdr, outbound); + ast_cdr_init(ast_channel_cdr(outbound), outbound); snprintf(tmp, sizeof(tmp), "%s/%s", "Local", dialarg); - ast_cdr_setapp(outbound->cdr, "FollowMe", tmp); + ast_cdr_setapp(ast_channel_cdr(outbound), "FollowMe", tmp); ast_cdr_update(outbound); - ast_cdr_start(outbound->cdr); - ast_cdr_end(outbound->cdr); + ast_cdr_start(ast_channel_cdr(outbound)); + ast_cdr_end(ast_channel_cdr(outbound)); /* If the cause wasn't handled properly */ - if (ast_cdr_disposition(outbound->cdr, outbound->hangupcause)) { - ast_cdr_failed(outbound->cdr); + if (ast_cdr_disposition(ast_channel_cdr(outbound), ast_channel_hangupcause(outbound))) { + ast_cdr_failed(ast_channel_cdr(outbound)); } } else { ast_log(LOG_ERROR, "Unable to create Call Detail Record\n"); @@ -1130,13 +1130,13 @@ static void end_bridge_callback(void *data) time(&end); ast_channel_lock(chan); - if (chan->cdr->answer.tv_sec) { - snprintf(buf, sizeof(buf), "%ld", (long) end - chan->cdr->answer.tv_sec); + if (ast_channel_cdr(chan)->answer.tv_sec) { + snprintf(buf, sizeof(buf), "%ld", (long) end - ast_channel_cdr(chan)->answer.tv_sec); pbx_builtin_setvar_helper(chan, "ANSWEREDTIME", buf); } - if (chan->cdr->start.tv_sec) { - snprintf(buf, sizeof(buf), "%ld", (long) end - chan->cdr->start.tv_sec); + if (ast_channel_cdr(chan)->start.tv_sec) { + snprintf(buf, sizeof(buf), "%ld", (long) end - ast_channel_cdr(chan)->start.tv_sec); pbx_builtin_setvar_helper(chan, "DIALEDTIME", buf); } ast_channel_unlock(chan); @@ -1223,7 +1223,7 @@ static int app_exec(struct ast_channel *chan, const char *data) ast_mutex_unlock(&f->lock); /* Forget the 'N' option if the call is already up. */ - if (chan->_state == AST_STATE_UP) { + if (ast_channel_state(chan) == AST_STATE_UP) { ast_clear_flag(&targs.followmeflags, FOLLOWMEFLAG_NOANSWER); } @@ -1232,7 +1232,7 @@ static int app_exec(struct ast_channel *chan, const char *data) ast_indicate(chan, AST_CONTROL_RINGING); } else { /* Answer the call */ - if (chan->_state != AST_STATE_UP) { + if (ast_channel_state(chan) != AST_STATE_UP) { ast_answer(chan); } @@ -1279,7 +1279,7 @@ static int app_exec(struct ast_channel *chan, const char *data) if (targs.status != 100) { if (ast_test_flag(&targs.followmeflags, FOLLOWMEFLAG_NOANSWER)) { - if (chan->_state != AST_STATE_UP) { + if (ast_channel_state(chan) != AST_STATE_UP) { ast_answer(chan); } } else { @@ -1310,7 +1310,7 @@ static int app_exec(struct ast_channel *chan, const char *data) } if (ast_test_flag(&targs.followmeflags, FOLLOWMEFLAG_NOANSWER)) { - if (caller->_state != AST_STATE_UP) { + if (ast_channel_state(caller) != AST_STATE_UP) { ast_answer(caller); } } else { diff --git a/apps/app_forkcdr.c b/apps/app_forkcdr.c index ffeeca8ec..c75553c34 100644 --- a/apps/app_forkcdr.c +++ b/apps/app_forkcdr.c @@ -183,7 +183,7 @@ static void ast_cdr_fork(struct ast_channel *chan, struct ast_flags optflags, ch struct ast_cdr *newcdr; struct ast_flags flags = { AST_CDR_FLAG_KEEP_VARS }; - cdr = chan->cdr; + cdr = ast_channel_cdr(chan); while (cdr->next) cdr = cdr->next; @@ -240,7 +240,7 @@ static int forkcdr_exec(struct ast_channel *chan, const char *data) AST_APP_ARG(options); ); - if (!chan->cdr) { + if (!ast_channel_cdr(chan)) { ast_log(LOG_WARNING, "Channel does not have a CDR\n"); return 0; } @@ -256,7 +256,7 @@ static int forkcdr_exec(struct ast_channel *chan, const char *data) if (!ast_strlen_zero(data)) { int keepvars = ast_test_flag(&flags, OPT_KEEPVARS) ? 1 : 0; - ast_set2_flag(chan->cdr, keepvars, AST_CDR_FLAG_KEEP_VARS); + ast_set2_flag(ast_channel_cdr(chan), keepvars, AST_CDR_FLAG_KEEP_VARS); } ast_cdr_fork(chan, flags, opts[OPT_ARG_VARSET]); diff --git a/apps/app_ices.c b/apps/app_ices.c index 52c03ae09..13b27fe25 100644 --- a/apps/app_ices.c +++ b/apps/app_ices.c @@ -135,7 +135,7 @@ static int ices_exec(struct ast_channel *chan, const char *data) ast_stopstream(chan); - if (chan->_state != AST_STATE_UP) + if (ast_channel_state(chan) != AST_STATE_UP) res = ast_answer(chan); if (res) { diff --git a/apps/app_ivrdemo.c b/apps/app_ivrdemo.c index d035df91f..099c67d48 100644 --- a/apps/app_ivrdemo.c +++ b/apps/app_ivrdemo.c @@ -108,7 +108,7 @@ static int skel_exec(struct ast_channel *chan, const char *data) /* Do our thing here */ - if (chan->_state != AST_STATE_UP) + if (ast_channel_state(chan) != AST_STATE_UP) res = ast_answer(chan); if (!res) res = ast_ivr_menu_run(chan, &ivr_demo, tmp); diff --git a/apps/app_macro.c b/apps/app_macro.c index e2b9c92a7..c324a36c3 100644 --- a/apps/app_macro.c +++ b/apps/app_macro.c @@ -329,13 +329,13 @@ static int _macro_exec(struct ast_channel *chan, const char *data, int exclusive } /* Save old info */ - oldpriority = chan->priority; + oldpriority = ast_channel_priority(chan); ast_copy_string(oldexten, ast_channel_exten(chan), sizeof(oldexten)); ast_copy_string(oldcontext, ast_channel_context(chan), sizeof(oldcontext)); if (ast_strlen_zero(ast_channel_macrocontext(chan))) { ast_channel_macrocontext_set(chan, ast_channel_context(chan)); ast_channel_macroexten_set(chan, ast_channel_exten(chan)); - chan->macropriority = chan->priority; + ast_channel_macropriority_set(chan, ast_channel_priority(chan)); setmacrocontext=1; } argc = 1; @@ -358,7 +358,7 @@ static int _macro_exec(struct ast_channel *chan, const char *data, int exclusive /* Setup environment for new run */ ast_channel_exten_set(chan, "s"); ast_channel_context_set(chan, fullmacro); - chan->priority = 1; + ast_channel_priority_set(chan, 1); ast_channel_lock(chan); while((cur = strsep(&rest, ",")) && (argc < MAX_ARGS)) { @@ -375,7 +375,7 @@ static int _macro_exec(struct ast_channel *chan, const char *data, int exclusive ast_channel_unlock(chan); autoloopflag = ast_test_flag(chan, AST_FLAG_IN_AUTOLOOP); ast_set_flag(chan, AST_FLAG_IN_AUTOLOOP); - while (ast_exists_extension(chan, ast_channel_context(chan), ast_channel_exten(chan), chan->priority, + while (ast_exists_extension(chan, ast_channel_context(chan), ast_channel_exten(chan), ast_channel_priority(chan), S_COR(chan->caller.id.number.valid, chan->caller.id.number.str, NULL))) { struct ast_context *c; struct ast_exten *e; @@ -392,7 +392,7 @@ static int _macro_exec(struct ast_channel *chan, const char *data, int exclusive if (ast_rdlock_context(c)) { ast_log(LOG_WARNING, "Unable to lock context?\n"); } else { - e = find_matching_priority(c, ast_channel_exten(chan), chan->priority, + e = find_matching_priority(c, ast_channel_exten(chan), ast_channel_priority(chan), S_COR(chan->caller.id.number.valid, chan->caller.id.number.str, NULL)); if (e) { /* This will only be undefined for pbx_realtime, which is majorly broken. */ ast_copy_string(runningapp, ast_get_extension_app(e), sizeof(runningapp)); @@ -409,7 +409,7 @@ static int _macro_exec(struct ast_channel *chan, const char *data, int exclusive /* Reset the macro depth, if it was changed in the last iteration */ pbx_builtin_setvar_helper(chan, "MACRO_DEPTH", depthc); - res = ast_spawn_extension(chan, ast_channel_context(chan), ast_channel_exten(chan), chan->priority, + res = ast_spawn_extension(chan, ast_channel_context(chan), ast_channel_exten(chan), ast_channel_priority(chan), S_COR(chan->caller.id.number.valid, chan->caller.id.number.str, NULL), &foundx, 1); if (res) { @@ -425,8 +425,8 @@ static int _macro_exec(struct ast_channel *chan, const char *data, int exclusive res = 0; goto out; default: - ast_debug(2, "Spawn extension (%s,%s,%d) exited non-zero on '%s' in macro '%s'\n", ast_channel_context(chan), ast_channel_exten(chan), chan->priority, ast_channel_name(chan), macro); - ast_verb(2, "Spawn extension (%s, %s, %d) exited non-zero on '%s' in macro '%s'\n", ast_channel_context(chan), ast_channel_exten(chan), chan->priority, ast_channel_name(chan), macro); + ast_debug(2, "Spawn extension (%s,%s,%d) exited non-zero on '%s' in macro '%s'\n", ast_channel_context(chan), ast_channel_exten(chan), ast_channel_priority(chan), ast_channel_name(chan), macro); + ast_verb(2, "Spawn extension (%s, %s, %d) exited non-zero on '%s' in macro '%s'\n", ast_channel_context(chan), ast_channel_exten(chan), ast_channel_priority(chan), ast_channel_name(chan), macro); goto out; } } @@ -499,10 +499,10 @@ static int _macro_exec(struct ast_channel *chan, const char *data, int exclusive /* don't stop executing extensions when we're in "h" */ if (ast_check_hangup(chan) && !inhangup) { - ast_debug(1, "Extension %s, macroexten %s, priority %d returned normally even though call was hung up\n", ast_channel_exten(chan), ast_channel_macroexten(chan), chan->priority); + ast_debug(1, "Extension %s, macroexten %s, priority %d returned normally even though call was hung up\n", ast_channel_exten(chan), ast_channel_macroexten(chan), ast_channel_priority(chan)); goto out; } - chan->priority++; + ast_channel_priority_set(chan, ast_channel_priority(chan) + 1); } out: @@ -539,14 +539,14 @@ static int _macro_exec(struct ast_channel *chan, const char *data, int exclusive if (setmacrocontext) { ast_channel_macrocontext_set(chan, ""); ast_channel_macroexten_set(chan, ""); - chan->macropriority = 0; + ast_channel_macropriority_set(chan, 0); } if (!strcasecmp(ast_channel_context(chan), fullmacro)) { const char *offsets; /* If we're leaving the macro normally, restore original information */ - chan->priority = oldpriority; + ast_channel_priority_set(chan, oldpriority); ast_channel_context_set(chan, oldcontext); ast_channel_exten_set(chan, oldexten); if ((offsets = pbx_builtin_getvar_helper(chan, "MACRO_OFFSET"))) { @@ -554,9 +554,9 @@ static int _macro_exec(struct ast_channel *chan, const char *data, int exclusive normally if there is any problem */ if (sscanf(offsets, "%30d", &offset) == 1) { if (ast_exists_extension(chan, ast_channel_context(chan), ast_channel_exten(chan), - chan->priority + offset + 1, + ast_channel_priority(chan) + offset + 1, S_COR(chan->caller.id.number.valid, chan->caller.id.number.str, NULL))) { - chan->priority += offset; + ast_channel_priority_set(chan, ast_channel_priority(chan) + offset); } } } diff --git a/apps/app_meetme.c b/apps/app_meetme.c index 3c8b73f20..b6e0c13cb 100644 --- a/apps/app_meetme.c +++ b/apps/app_meetme.c @@ -2174,7 +2174,7 @@ static int can_write(struct ast_channel *chan, struct ast_flags64 *confflags) return 1; } - return (chan->_state == AST_STATE_UP); + return (ast_channel_state(chan) == AST_STATE_UP); } static void send_talking_event(struct ast_channel *chan, struct ast_conference *conf, struct ast_conf_user *user, int talking) @@ -2677,7 +2677,7 @@ static int conf_run(struct ast_channel *chan, struct ast_conference *conf, struc ast_func_write(chan, "DENOISE(rx)", "on"); } - retrydahdi = (strcasecmp(chan->tech->type, "DAHDI") || (chan->audiohooks || chan->monitor) ? 1 : 0); + retrydahdi = (strcasecmp(ast_channel_tech(chan)->type, "DAHDI") || (ast_channel_audiohooks(chan) || ast_channel_monitor(chan)) ? 1 : 0); user->dahdichannel = !retrydahdi; dahdiretry: @@ -3218,14 +3218,14 @@ static int conf_run(struct ast_channel *chan, struct ast_conference *conf, struc if (c) { char dtmfstr[2] = ""; - if (c->fds[0] != origfd || (user->dahdichannel && (c->audiohooks || c->monitor))) { + if (c->fds[0] != origfd || (user->dahdichannel && (ast_channel_audiohooks(c) || ast_channel_monitor(c)))) { if (using_pseudo) { /* Kill old pseudo */ close(fd); using_pseudo = 0; } ast_debug(1, "Ooh, something swapped out under us, starting over\n"); - retrydahdi = (strcasecmp(c->tech->type, "DAHDI") || (c->audiohooks || c->monitor) ? 1 : 0); + retrydahdi = (strcasecmp(ast_channel_tech(c)->type, "DAHDI") || (ast_channel_audiohooks(c) || ast_channel_monitor(c)) ? 1 : 0); user->dahdichannel = !retrydahdi; goto dahdiretry; } @@ -4244,7 +4244,7 @@ static int count_exec(struct ast_channel *chan, const char *data) snprintf(val, sizeof(val), "%d", count); pbx_builtin_setvar_helper(chan, args.varname, val); } else { - if (chan->_state != AST_STATE_UP) { + if (ast_channel_state(chan) != AST_STATE_UP) { ast_answer(chan); } res = ast_say_number(chan, count, "", ast_channel_language(chan), (char *) NULL); /* Needs gender */ @@ -4282,7 +4282,7 @@ static int conf_exec(struct ast_channel *chan, const char *data) notdata = data; } - if (chan->_state != AST_STATE_UP) + if (ast_channel_state(chan) != AST_STATE_UP) ast_answer(chan); info = ast_strdupa(notdata); diff --git a/apps/app_milliwatt.c b/apps/app_milliwatt.c index 412ac1ef4..421414126 100644 --- a/apps/app_milliwatt.c +++ b/apps/app_milliwatt.c @@ -127,7 +127,7 @@ static int old_milliwatt_exec(struct ast_channel *chan) ast_set_write_format_by_id(chan, AST_FORMAT_ULAW); ast_set_read_format_by_id(chan, AST_FORMAT_ULAW); - if (chan->_state != AST_STATE_UP) { + if (ast_channel_state(chan) != AST_STATE_UP) { ast_answer(chan); } diff --git a/apps/app_minivm.c b/apps/app_minivm.c index 9c87a7464..bf408f81f 100644 --- a/apps/app_minivm.c +++ b/apps/app_minivm.c @@ -1945,7 +1945,7 @@ static int leave_voicemail(struct ast_channel *chan, char *username, struct leav ast_channel_context(chan), ast_channel_macrocontext(chan), ast_channel_exten(chan), - chan->priority, + ast_channel_priority(chan), ast_channel_name(chan), callerid, date, @@ -2172,7 +2172,7 @@ static int minivm_record_exec(struct ast_channel *chan, const char *data) memset(&leave_options, 0, sizeof(leave_options)); /* Answer channel if it's not already answered */ - if (chan->_state != AST_STATE_UP) + if (ast_channel_state(chan) != AST_STATE_UP) ast_answer(chan); if (ast_strlen_zero(data)) { @@ -2274,7 +2274,7 @@ static int minivm_greet_exec(struct ast_channel *chan, const char *data) } /* Answer channel if it's not already answered */ - if (chan->_state != AST_STATE_UP) + if (ast_channel_state(chan) != AST_STATE_UP) ast_answer(chan); /* Setup pre-file if appropriate */ @@ -2377,7 +2377,7 @@ static int minivm_greet_exec(struct ast_channel *chan, const char *data) } else if (ausemacro && !ast_strlen_zero(ast_channel_macrocontext(chan))) { ast_channel_context_set(chan, ast_channel_macrocontext(chan)); } - chan->priority = 0; + ast_channel_priority_set(chan, 0); pbx_builtin_setvar_helper(chan, "MVM_GREET_STATUS", "USEREXIT"); res = 0; } else if (res == '0') { /* Check for a '0' here */ @@ -2389,7 +2389,7 @@ static int minivm_greet_exec(struct ast_channel *chan, const char *data) ast_channel_context_set(chan, ast_channel_macrocontext(chan)); } ast_play_and_wait(chan, "transfer"); - chan->priority = 0; + ast_channel_priority_set(chan, 0); pbx_builtin_setvar_helper(chan, "MVM_GREET_STATUS", "USEREXIT"); } res = 0; @@ -2518,7 +2518,7 @@ static int minivm_accmess_exec(struct ast_channel *chan, const char *data) } /* Answer channel if it's not already answered */ - if (chan->_state != AST_STATE_UP) + if (ast_channel_state(chan) != AST_STATE_UP) ast_answer(chan); /* Here's where the action is */ diff --git a/apps/app_osplookup.c b/apps/app_osplookup.c index a74d1b501..23f8838bc 100644 --- a/apps/app_osplookup.c +++ b/apps/app_osplookup.c @@ -2878,9 +2878,9 @@ static int ospfinished_exec( } ast_debug(1, "OSPFinish: cause '%d'\n", cause); - if (chan->cdr) { - start = chan->cdr->start.tv_sec; - connect = chan->cdr->answer.tv_sec; + if (ast_channel_cdr(chan)) { + start = ast_channel_cdr(chan)->start.tv_sec; + connect = ast_channel_cdr(chan)->answer.tv_sec; if (connect) { end = time(NULL); } else { diff --git a/apps/app_parkandannounce.c b/apps/app_parkandannounce.c index 4b779bd32..508c31a5b 100644 --- a/apps/app_parkandannounce.c +++ b/apps/app_parkandannounce.c @@ -142,9 +142,9 @@ static int parkandannounce_exec(struct ast_channel *chan, const char *data) } ast_verb(3, "Return Context: (%s,%s,%d) ID: %s\n", ast_channel_context(chan), ast_channel_exten(chan), - chan->priority, + ast_channel_priority(chan), S_COR(chan->caller.id.number.valid, chan->caller.id.number.str, "")); - if (!ast_exists_extension(chan, ast_channel_context(chan), ast_channel_exten(chan), chan->priority, + if (!ast_exists_extension(chan, ast_channel_context(chan), ast_channel_exten(chan), ast_channel_priority(chan), S_COR(chan->caller.id.number.valid, chan->caller.id.number.str, NULL))) { ast_verb(3, "Warning: Return Context Invalid, call will return to default|s\n"); } @@ -182,7 +182,7 @@ static int parkandannounce_exec(struct ast_channel *chan, const char *data) ast_variables_destroy(oh.vars); ast_party_id_free(&caller_id); if (dchan) { - if (dchan->_state == AST_STATE_UP) { + if (ast_channel_state(dchan) == AST_STATE_UP) { ast_verb(4, "Channel %s was answered.\n", ast_channel_name(dchan)); } else { ast_verb(4, "Channel %s was never answered.\n", ast_channel_name(dchan)); diff --git a/apps/app_playback.c b/apps/app_playback.c index e9d4d8752..18d4c8eb5 100644 --- a/apps/app_playback.c +++ b/apps/app_playback.c @@ -454,7 +454,7 @@ static int playback_exec(struct ast_channel *chan, const char *data) if (strcasestr(args.options, "noanswer")) option_noanswer = 1; } - if (chan->_state != AST_STATE_UP) { + if (ast_channel_state(chan) != AST_STATE_UP) { if (option_skip) { /* At the user's option, skip if the line is not up */ goto done; diff --git a/apps/app_playtones.c b/apps/app_playtones.c index 1e142de23..fd947dd66 100644 --- a/apps/app_playtones.c +++ b/apps/app_playtones.c @@ -87,7 +87,7 @@ static int handle_playtones(struct ast_channel *chan, const char *data) return -1; } - ts = ast_get_indication_tone(chan->zone, str); + ts = ast_get_indication_tone(ast_channel_zone(chan), str); if (ts) { res = ast_playtones_start(chan, 0, ts->data, 0); diff --git a/apps/app_privacy.c b/apps/app_privacy.c index 6c2c95814..d287c56fd 100644 --- a/apps/app_privacy.c +++ b/apps/app_privacy.c @@ -108,7 +108,7 @@ static int privacy_exec(struct ast_channel *chan, const char *data) ast_verb(3, "CallerID number present: Skipping\n"); } else { /*Answer the channel if it is not already*/ - if (chan->_state != AST_STATE_UP) { + if (ast_channel_state(chan) != AST_STATE_UP) { if ((res = ast_answer(chan))) { return -1; } diff --git a/apps/app_queue.c b/apps/app_queue.c index 2a8b51322..0add6c209 100644 --- a/apps/app_queue.c +++ b/apps/app_queue.c @@ -3096,8 +3096,8 @@ static int ring_entry(struct queue_ent *qe, struct callattempt *tmp, int *busies /* on entry here, we know that tmp->chan == NULL */ if (tmp->member->paused) { ast_debug(1, "%s paused, can't receive call\n", tmp->interface); - if (qe->chan->cdr) { - ast_cdr_busy(qe->chan->cdr); + if (ast_channel_cdr(qe->chan)) { + ast_cdr_busy(ast_channel_cdr(qe->chan)); } tmp->stillgoing = 0; return 0; @@ -3107,8 +3107,8 @@ static int ring_entry(struct queue_ent *qe, struct callattempt *tmp, int *busies (!tmp->lastqueue && qe->parent->wrapuptime && (time(NULL) - tmp->lastcall < qe->parent->wrapuptime))) { ast_debug(1, "Wrapuptime not yet expired on queue %s for %s\n", (tmp->lastqueue ? tmp->lastqueue->name : qe->parent->name), tmp->interface); - if (qe->chan->cdr) { - ast_cdr_busy(qe->chan->cdr); + if (ast_channel_cdr(qe->chan)) { + ast_cdr_busy(ast_channel_cdr(qe->chan)); } tmp->stillgoing = 0; (*busies)++; @@ -3126,8 +3126,8 @@ static int ring_entry(struct queue_ent *qe, struct callattempt *tmp, int *busies } if ((tmp->member->status != AST_DEVICE_NOT_INUSE) && (tmp->member->status != AST_DEVICE_UNKNOWN)) { ast_debug(1, "%s in use, can't receive call\n", tmp->interface); - if (qe->chan->cdr) { - ast_cdr_busy(qe->chan->cdr); + if (ast_channel_cdr(qe->chan)) { + ast_cdr_busy(ast_channel_cdr(qe->chan)); } tmp->stillgoing = 0; return 0; @@ -3136,8 +3136,8 @@ static int ring_entry(struct queue_ent *qe, struct callattempt *tmp, int *busies if (use_weight && compare_weight(qe->parent,tmp->member)) { ast_debug(1, "Priority queue delaying call to %s:%s\n", qe->parent->name, tmp->interface); - if (qe->chan->cdr) { - ast_cdr_busy(qe->chan->cdr); + if (ast_channel_cdr(qe->chan)) { + ast_cdr_busy(ast_channel_cdr(qe->chan)); } tmp->stillgoing = 0; (*busies)++; @@ -3151,10 +3151,10 @@ static int ring_entry(struct queue_ent *qe, struct callattempt *tmp, int *busies location = ""; /* Request the peer */ - tmp->chan = ast_request(tech, qe->chan->nativeformats, qe->chan, location, &status); + tmp->chan = ast_request(tech, ast_channel_nativeformats(qe->chan), qe->chan, location, &status); if (!tmp->chan) { /* If we can't, just go on to the next call */ - if (qe->chan->cdr) { - ast_cdr_busy(qe->chan->cdr); + if (ast_channel_cdr(qe->chan)) { + ast_cdr_busy(ast_channel_cdr(qe->chan)); } tmp->stillgoing = 0; @@ -3205,7 +3205,7 @@ static int ring_entry(struct queue_ent *qe, struct callattempt *tmp, int *busies ast_channel_datastore_inherit(qe->chan, tmp->chan); /* Presense of ADSI CPE on outgoing channel follows ours */ - tmp->chan->adsicpe = qe->chan->adsicpe; + ast_channel_adsicpe_set(tmp->chan, ast_channel_adsicpe(qe->chan)); /* Inherit context and extension */ macrocontext = pbx_builtin_getvar_helper(qe->chan, "MACRO_CONTEXT"); @@ -3218,17 +3218,17 @@ static int ring_entry(struct queue_ent *qe, struct callattempt *tmp, int *busies if (ast_cdr_isset_unanswered()) { /* they want to see the unanswered dial attempts! */ /* set up the CDR fields on all the CDRs to give sensical information */ - ast_cdr_setdestchan(tmp->chan->cdr, ast_channel_name(tmp->chan)); - strcpy(tmp->chan->cdr->clid, qe->chan->cdr->clid); - strcpy(tmp->chan->cdr->channel, qe->chan->cdr->channel); - strcpy(tmp->chan->cdr->src, qe->chan->cdr->src); - strcpy(tmp->chan->cdr->dst, ast_channel_exten(qe->chan)); - strcpy(tmp->chan->cdr->dcontext, ast_channel_context(qe->chan)); - strcpy(tmp->chan->cdr->lastapp, qe->chan->cdr->lastapp); - strcpy(tmp->chan->cdr->lastdata, qe->chan->cdr->lastdata); - tmp->chan->cdr->amaflags = qe->chan->cdr->amaflags; - strcpy(tmp->chan->cdr->accountcode, qe->chan->cdr->accountcode); - strcpy(tmp->chan->cdr->userfield, qe->chan->cdr->userfield); + ast_cdr_setdestchan(ast_channel_cdr(tmp->chan), ast_channel_name(tmp->chan)); + strcpy(ast_channel_cdr(tmp->chan)->clid, ast_channel_cdr(qe->chan)->clid); + strcpy(ast_channel_cdr(tmp->chan)->channel, ast_channel_cdr(qe->chan)->channel); + strcpy(ast_channel_cdr(tmp->chan)->src, ast_channel_cdr(qe->chan)->src); + strcpy(ast_channel_cdr(tmp->chan)->dst, ast_channel_exten(qe->chan)); + strcpy(ast_channel_cdr(tmp->chan)->dcontext, ast_channel_context(qe->chan)); + strcpy(ast_channel_cdr(tmp->chan)->lastapp, ast_channel_cdr(qe->chan)->lastapp); + strcpy(ast_channel_cdr(tmp->chan)->lastdata, ast_channel_cdr(qe->chan)->lastdata); + ast_channel_cdr(tmp->chan)->amaflags = ast_channel_cdr(qe->chan)->amaflags; + strcpy(ast_channel_cdr(tmp->chan)->accountcode, ast_channel_cdr(qe->chan)->accountcode); + strcpy(ast_channel_cdr(tmp->chan)->userfield, ast_channel_cdr(qe->chan)->userfield); } ast_channel_unlock(tmp->chan); @@ -3268,7 +3268,7 @@ static int ring_entry(struct queue_ent *qe, struct callattempt *tmp, int *busies S_COR(qe->chan->caller.id.name.valid, qe->chan->caller.id.name.str, "unknown"), S_COR(qe->chan->connected.id.number.valid, qe->chan->connected.id.number.str, "unknown"), S_COR(qe->chan->connected.id.name.valid, qe->chan->connected.id.name.str, "unknown"), - ast_channel_context(qe->chan), ast_channel_exten(qe->chan), qe->chan->priority, ast_channel_uniqueid(qe->chan), + ast_channel_context(qe->chan), ast_channel_exten(qe->chan), ast_channel_priority(qe->chan), ast_channel_uniqueid(qe->chan), qe->parent->eventwhencalled == QUEUE_EVENT_VARIABLES ? vars2manager(qe->chan, vars, sizeof(vars)) : ""); ast_channel_unlock(tmp->chan); @@ -3640,7 +3640,7 @@ static struct callattempt *wait_for_answer(struct queue_ent *qe, struct callatte ast_copy_string(ochan_name, ast_channel_name(o->chan), sizeof(ochan_name)); ast_channel_unlock(o->chan); } - if (o->stillgoing && (o->chan) && (o->chan->_state == AST_STATE_UP)) { + if (o->stillgoing && (o->chan) && (ast_channel_state(o->chan) == AST_STATE_UP)) { if (!peer) { ast_verb(3, "%s answered %s\n", ochan_name, inchan_name); if (update_connectedline) { @@ -3699,7 +3699,7 @@ static struct callattempt *wait_for_answer(struct queue_ent *qe, struct callatte /* Before processing channel, go ahead and check for forwarding */ ast_verb(3, "Now forwarding %s to '%s/%s' (thanks to %s)\n", inchan_name, tech, stuff, ochan_name); /* Setup parameters */ - o->chan = ast_request(tech, in->nativeformats, in, stuff, &status); + o->chan = ast_request(tech, ast_channel_nativeformats(in), in, stuff, &status); if (!o->chan) { ast_log(LOG_NOTICE, "Forwarding failed to create channel to dial '%s/%s'\n", @@ -3799,8 +3799,8 @@ static struct callattempt *wait_for_answer(struct queue_ent *qe, struct callatte break; case AST_CONTROL_BUSY: ast_verb(3, "%s is busy\n", ochan_name); - if (in->cdr) - ast_cdr_busy(in->cdr); + if (ast_channel_cdr(in)) + ast_cdr_busy(ast_channel_cdr(in)); do_hang(o); endtime = (long) time(NULL); endtime -= starttime; @@ -3818,8 +3818,8 @@ static struct callattempt *wait_for_answer(struct queue_ent *qe, struct callatte break; case AST_CONTROL_CONGESTION: ast_verb(3, "%s is circuit-busy\n", ochan_name); - if (in->cdr) - ast_cdr_busy(in->cdr); + if (ast_channel_cdr(in)) + ast_cdr_busy(ast_channel_cdr(in)); endtime = (long) time(NULL); endtime -= starttime; rna(endtime * 1000, qe, on, membername, qe->parent->autopauseunavail); @@ -3914,7 +3914,7 @@ static struct callattempt *wait_for_answer(struct queue_ent *qe, struct callatte *to = -1; if (f) { if (f->data.uint32) { - in->hangupcause = f->data.uint32; + ast_channel_hangupcause_set(in, f->data.uint32); } ast_frfree(f); } @@ -4648,7 +4648,7 @@ static int try_calling(struct queue_ent *qe, const char *options, char *announce tmp->q_next = outgoing; outgoing = tmp; /* If this line is up, don't try anybody else */ - if (outgoing->chan && (outgoing->chan->_state == AST_STATE_UP)) + if (outgoing->chan && (ast_channel_state(outgoing->chan) == AST_STATE_UP)) break; } else { callattempt_free(tmp); @@ -4717,8 +4717,8 @@ static int try_calling(struct queue_ent *qe, const char *options, char *announce if (!o->chan) { continue; } - if (strcmp(o->chan->cdr->dstchannel, qe->chan->cdr->dstchannel) == 0) { - ast_set_flag(o->chan->cdr, AST_CDR_FLAG_POST_DISABLED); + if (strcmp(ast_channel_cdr(o->chan)->dstchannel, ast_channel_cdr(qe->chan)->dstchannel) == 0) { + ast_set_flag(ast_channel_cdr(o->chan), AST_CDR_FLAG_POST_DISABLED); break; } } @@ -4727,9 +4727,9 @@ static int try_calling(struct queue_ent *qe, const char *options, char *announce /* Ah ha! Someone answered within the desired timeframe. Of course after this we will always return with -1 so that it is hung up properly after the conversation. */ - if (!strcmp(qe->chan->tech->type, "DAHDI")) + if (!strcmp(ast_channel_tech(qe->chan)->type, "DAHDI")) ast_channel_setoption(qe->chan, AST_OPTION_TONE_VERIFY, &nondataquality, sizeof(nondataquality), 0); - if (!strcmp(peer->tech->type, "DAHDI")) + if (!strcmp(ast_channel_tech(peer)->type, "DAHDI")) ast_channel_setoption(peer, AST_OPTION_TONE_VERIFY, &nondataquality, sizeof(nondataquality), 0); /* Update parameters for the queue */ time(&now); @@ -4806,8 +4806,8 @@ static int try_calling(struct queue_ent *qe, const char *options, char *announce else ast_moh_stop(qe->chan); /* If appropriate, log that we have a destination channel */ - if (qe->chan->cdr) { - ast_cdr_setdestchan(qe->chan->cdr, ast_channel_name(peer)); + if (ast_channel_cdr(qe->chan)) { + ast_cdr_setdestchan(ast_channel_cdr(qe->chan), ast_channel_name(peer)); } /* Make sure channels are compatible */ res = ast_channel_make_compatible(qe->chan, peer); @@ -4815,7 +4815,7 @@ static int try_calling(struct queue_ent *qe, const char *options, char *announce ast_queue_log(queuename, ast_channel_uniqueid(qe->chan), member->membername, "SYSCOMPAT", "%s", ""); ast_log(LOG_WARNING, "Had to drop call because I couldn't make %s compatible with %s\n", ast_channel_name(qe->chan), ast_channel_name(peer)); record_abandoned(qe); - ast_cdr_failed(qe->chan->cdr); + ast_cdr_failed(ast_channel_cdr(qe->chan)); ast_hangup(peer); ao2_ref(member, -1); return -1; @@ -4872,8 +4872,8 @@ static int try_calling(struct queue_ent *qe, const char *options, char *announce ast_channel_unlock(qe->chan); if (monitorfilename) { ast_monitor_start(which, qe->parent->monfmt, monitorfilename, 1, X_REC_IN | X_REC_OUT); - } else if (qe->chan->cdr) { - ast_monitor_start(which, qe->parent->monfmt, qe->chan->cdr->uniqueid, 1, X_REC_IN | X_REC_OUT); + } else if (ast_channel_cdr(qe->chan)) { + ast_monitor_start(which, qe->parent->monfmt, ast_channel_cdr(qe->chan)->uniqueid, 1, X_REC_IN | X_REC_OUT); } else { /* Last ditch effort -- no CDR, make up something */ snprintf(tmpid, sizeof(tmpid), "chan-%lx", ast_random()); @@ -4888,8 +4888,8 @@ static int try_calling(struct queue_ent *qe, const char *options, char *announce if (mixmonapp) { ast_debug(1, "Starting MixMonitor as requested.\n"); if (!monitorfilename) { - if (qe->chan->cdr) { - ast_copy_string(tmpid, qe->chan->cdr->uniqueid, sizeof(tmpid)); + if (ast_channel_cdr(qe->chan)) { + ast_copy_string(tmpid, ast_channel_cdr(qe->chan)->uniqueid, sizeof(tmpid)); } else { snprintf(tmpid, sizeof(tmpid), "chan-%lx", ast_random()); } @@ -4959,12 +4959,12 @@ static int try_calling(struct queue_ent *qe, const char *options, char *announce ast_debug(1, "Arguments being passed to MixMonitor: %s\n", mixmonargs); /* We purposely lock the CDR so that pbx_exec does not update the application data */ - if (qe->chan->cdr) { - ast_set_flag(qe->chan->cdr, AST_CDR_FLAG_LOCKED); + if (ast_channel_cdr(qe->chan)) { + ast_set_flag(ast_channel_cdr(qe->chan), AST_CDR_FLAG_LOCKED); } pbx_exec(qe->chan, mixmonapp, mixmonargs); - if (qe->chan->cdr) { - ast_clear_flag(qe->chan->cdr, AST_CDR_FLAG_LOCKED); + if (ast_channel_cdr(qe->chan)) { + ast_clear_flag(ast_channel_cdr(qe->chan), AST_CDR_FLAG_LOCKED); } } else { ast_log(LOG_WARNING, "Asked to run MixMonitor on this call, but cannot find the MixMonitor app!\n"); @@ -5039,7 +5039,7 @@ static int try_calling(struct queue_ent *qe, const char *options, char *announce /* Set where we came from */ ast_channel_context_set(peer, "app_queue_gosub_virtual_context"); ast_channel_exten_set(peer, "s"); - peer->priority = 0; + ast_channel_priority_set(peer, 0); gosub_argstart = strchr(gosubexec, ','); if (gosub_argstart) { @@ -5102,12 +5102,12 @@ static int try_calling(struct queue_ent *qe, const char *options, char *announce ast_queue_log(queuename, ast_channel_uniqueid(qe->chan), member->membername, "CONNECT", "%ld|%s|%ld", (long) time(NULL) - qe->start, ast_channel_uniqueid(peer), (long)(orig - to > 0 ? (orig - to) / 1000 : 0)); - if (qe->chan->cdr) { + if (ast_channel_cdr(qe->chan)) { struct ast_cdr *cdr; struct ast_cdr *newcdr; /* Only work with the last CDR in the stack*/ - cdr = qe->chan->cdr; + cdr = ast_channel_cdr(qe->chan); while (cdr->next) { cdr = cdr->next; } diff --git a/apps/app_read.c b/apps/app_read.c index 813d37565..d2a1de7b6 100644 --- a/apps/app_read.c +++ b/apps/app_read.c @@ -191,10 +191,10 @@ static int read_exec(struct ast_channel *chan, const char *data) } if (ast_test_flag(&flags, OPT_INDICATION)) { if (!ast_strlen_zero(arglist.filename)) { - ts = ast_get_indication_tone(chan->zone, arglist.filename); + ts = ast_get_indication_tone(ast_channel_zone(chan), arglist.filename); } } - if (chan->_state != AST_STATE_UP) { + if (ast_channel_state(chan) != AST_STATE_UP) { if (ast_test_flag(&flags, OPT_SKIP)) { /* At the user's option, skip if the line is not up */ pbx_builtin_setvar_helper(chan, arglist.variable, ""); @@ -210,7 +210,7 @@ static int read_exec(struct ast_channel *chan, const char *data) ast_stopstream(chan); if (ts && ts->data[0]) { if (!to) - to = chan->pbx ? chan->pbx->rtimeoutms : 6000; + to = ast_channel_pbx(chan) ? ast_channel_pbx(chan)->rtimeoutms : 6000; res = ast_playtones_start(chan, 0, ts->data, 0); for (x = 0; x < maxdigits; ) { res = ast_waitfordigit(chan, to); diff --git a/apps/app_readexten.c b/apps/app_readexten.c index 5e6f3ed44..a894ba48c 100644 --- a/apps/app_readexten.c +++ b/apps/app_readexten.c @@ -164,17 +164,17 @@ static int readexten_exec(struct ast_channel *chan, const char *data) } if (timeout <= 0) - timeout = chan->pbx ? chan->pbx->rtimeoutms : 10000; + timeout = ast_channel_pbx(chan) ? ast_channel_pbx(chan)->rtimeoutms : 10000; if (digit_timeout <= 0) - digit_timeout = chan->pbx ? chan->pbx->dtimeoutms : 5000; + digit_timeout = ast_channel_pbx(chan) ? ast_channel_pbx(chan)->dtimeoutms : 5000; if (ast_test_flag(&flags, OPT_INDICATION) && !ast_strlen_zero(arglist.filename)) { - ts = ast_get_indication_tone(chan->zone, arglist.filename); + ts = ast_get_indication_tone(ast_channel_zone(chan), arglist.filename); } do { - if (chan->_state != AST_STATE_UP) { + if (ast_channel_state(chan) != AST_STATE_UP) { if (ast_test_flag(&flags, OPT_SKIP)) { /* At the user's option, skip if the line is not up */ pbx_builtin_setvar_helper(chan, arglist.variable, ""); diff --git a/apps/app_record.c b/apps/app_record.c index 420ed0e62..b7c6bfab7 100644 --- a/apps/app_record.c +++ b/apps/app_record.c @@ -260,7 +260,7 @@ static int record_exec(struct ast_channel *chan, const char *data) ast_copy_string(tmp, args.filename, sizeof(tmp)); /* end of routine mentioned */ - if (chan->_state != AST_STATE_UP) { + if (ast_channel_state(chan) != AST_STATE_UP) { if (ast_test_flag(&flags, OPTION_SKIP)) { /* At the user's option, skip if the line is not up */ pbx_builtin_setvar_helper(chan, "RECORD_STATUS", "SKIP"); diff --git a/apps/app_rpt.c b/apps/app_rpt.c index 5556a8d7d..48d31d2a4 100644 --- a/apps/app_rpt.c +++ b/apps/app_rpt.c @@ -1380,7 +1380,7 @@ static int priority_jump(struct rpt *myrpt, struct ast_channel *chan) int res=0; // if (ast_test_flag(&flags,OPT_JUMP) && ast_goto_if_exists(chan, chan->context, chan->exten, chan->priority + 101) == 0){ - if (ast_goto_if_exists(chan, ast_channel_context(chan), ast_channel_exten(chan), chan->priority + 101) == 0){ + if (ast_goto_if_exists(chan, ast_channel_context(chan), ast_channel_exten(chan), ast_channel_priority(chan) + 101) == 0){ res = 0; } else { res = -1; @@ -3278,7 +3278,7 @@ static int play_tone_pair(struct ast_channel *chan, int f1, int f2, int duration if ((res = ast_tonepair_start(chan, f1, f2, duration, amplitude))) return res; - while(chan->generatordata) { + while(ast_channel_generatordata(chan)) { if (ast_safe_sleep(chan,1)) return -1; } @@ -4035,8 +4035,8 @@ struct ast_format_cap *cap = NULL; pthread_exit(NULL); } #ifdef AST_CDR_FLAG_POST_DISABLED - if (mychannel->cdr) - ast_set_flag(mychannel->cdr,AST_CDR_FLAG_POST_DISABLED); + if (ast_channel_cdr(mychannel)) + ast_set_flag(ast_channel_cdr(mychannel),AST_CDR_FLAG_POST_DISABLED); #endif rpt_mutex_lock(&myrpt->lock); mytele->chan = mychannel; @@ -5172,7 +5172,7 @@ struct ast_format_cap *cap = NULL; myrpt->stopgen = 0; break; } - while(mychannel->generatordata && (myrpt->stopgen <= 0)) { + while(ast_channel_generatordata(mychannel) && (myrpt->stopgen <= 0)) { if (ast_safe_sleep(mychannel,1)) break; imdone = 1; } @@ -5317,8 +5317,8 @@ struct ast_format_cap *cap = NULL; pthread_exit(NULL); } #ifdef AST_CDR_FLAG_POST_DISABLED - if (mychannel->cdr) - ast_set_flag(mychannel->cdr,AST_CDR_FLAG_POST_DISABLED); + if (ast_channel_cdr(mychannel)) + ast_set_flag(ast_channel_cdr(mychannel),AST_CDR_FLAG_POST_DISABLED); #endif ci.chan = 0; ci.confno = myrpt->conf; /* use the pseudo conference */ @@ -5345,8 +5345,8 @@ struct ast_format_cap *cap = NULL; pthread_exit(NULL); } #ifdef AST_CDR_FLAG_POST_DISABLED - if (genchannel->cdr) - ast_set_flag(genchannel->cdr,AST_CDR_FLAG_POST_DISABLED); + if (ast_channel_cdr(genchannel)) + ast_set_flag(ast_channel_cdr(genchannel),AST_CDR_FLAG_POST_DISABLED); #endif ci.chan = 0; ci.confno = myrpt->conf; @@ -5492,7 +5492,7 @@ struct ast_format_cap *cap = NULL; if (myrpt->p.acctcode) ast_cdr_setaccount(mychannel,myrpt->p.acctcode); - mychannel->priority = 1; + ast_channel_priority_set(mychannel, 1); ast_channel_undefer_dtmf(mychannel); if (ast_pbx_start(mychannel) < 0) { @@ -5542,7 +5542,7 @@ struct ast_format_cap *cap = NULL; } while(myrpt->callmode) { - if ((!mychannel->pbx) && (myrpt->callmode != 4)) + if ((!ast_channel_pbx(mychannel)) && (myrpt->callmode != 4)) { /* If patch is setup for far end disconnect */ if(myrpt->patchfarenddisconnect || (myrpt->p.duplex < 2)){ @@ -5586,7 +5586,7 @@ struct ast_format_cap *cap = NULL; ast_log(LOG_NOTICE, "exit channel loop\n"); rpt_mutex_unlock(&myrpt->lock); tone_zone_play_tone(genchannel->fds[0],-1); - if (mychannel->pbx) ast_softhangup(mychannel,AST_SOFTHANGUP_DEV); + if (ast_channel_pbx(mychannel)) ast_softhangup(mychannel,AST_SOFTHANGUP_DEV); ast_hangup(genchannel); rpt_mutex_lock(&myrpt->lock); myrpt->callmode = 0; @@ -5819,8 +5819,8 @@ static int connect_link(struct rpt *myrpt, char* node, int mode, int perma) ast_set_read_format_by_id(l->chan, AST_FORMAT_SLINEAR); ast_set_write_format_by_id(l->chan, AST_FORMAT_SLINEAR); #ifdef AST_CDR_FLAG_POST_DISABLED - if (l->chan->cdr) - ast_set_flag(l->chan->cdr,AST_CDR_FLAG_POST_DISABLED); + if (ast_channel_cdr(l->chan)) + ast_set_flag(ast_channel_cdr(l->chan),AST_CDR_FLAG_POST_DISABLED); #endif #ifndef NEW_ASTERISK l->chan->whentohangup = 0; @@ -5860,8 +5860,8 @@ static int connect_link(struct rpt *myrpt, char* node, int mode, int perma) ast_set_read_format_by_id(l->pchan, AST_FORMAT_SLINEAR); ast_set_write_format_by_id(l->pchan, AST_FORMAT_SLINEAR); #ifdef AST_CDR_FLAG_POST_DISABLED - if (l->pchan->cdr) - ast_set_flag(l->pchan->cdr,AST_CDR_FLAG_POST_DISABLED); + if (ast_channel_cdr(l->pchan)) + ast_set_flag(ast_channel_cdr(l->pchan),AST_CDR_FLAG_POST_DISABLED); #endif /* make a conference for the tx */ ci.chan = 0; @@ -13366,7 +13366,7 @@ static int rpt_exec(struct ast_channel *chan, const char *data) if ((!myrpt->p.nobusyout) && m) { - if (chan->_state != AST_STATE_UP) + if (ast_channel_state(chan) != AST_STATE_UP) { ast_indicate(chan,AST_CONTROL_BUSY); } @@ -13374,7 +13374,7 @@ static int rpt_exec(struct ast_channel *chan, const char *data) return -1; } - if (chan->_state != AST_STATE_UP) + if (ast_channel_state(chan) != AST_STATE_UP) { ast_answer(chan); if (!phone_mode) send_newkey(chan); @@ -13429,7 +13429,7 @@ static int rpt_exec(struct ast_channel *chan, const char *data) return -1; } /* At this point we have a priority and maybe an extension and a context */ - chan->priority = atoi(priority); + ast_channel_priority_set(chan, atoi(priority)); #ifdef OLD_ASTERISK if(exten && strcasecmp(exten, "BYEXTENSION")) #else @@ -13439,13 +13439,13 @@ static int rpt_exec(struct ast_channel *chan, const char *data) if(context) ast_channel_context_set(chan, context); } else { /* increment the priority by default*/ - chan->priority++; + ast_channel_priority(chan)++; } ast_verb(3, "Return Context: (%s,%s,%d) ID: %s\n", - ast_channel_context(chan), ast_channel_exten(chan), chan->priority, + ast_channel_context(chan), ast_channel_exten(chan), ast_channel_priority(chan), S_COR(chan->caller.id.number.valid, chan->caller.id.number.str, "")); - if (!ast_exists_extension(chan, ast_channel_context(chan), ast_channel_exten(chan), chan->priority, + if (!ast_exists_extension(chan, ast_channel_context(chan), ast_channel_exten(chan), ast_channel_priority(chan), S_COR(chan->caller.id.number.valid, chan->caller.id.number.str, NULL))) { ast_verb(3, "Warning: Return Context Invalid, call will return to default|s\n"); } @@ -13673,8 +13673,8 @@ static int rpt_exec(struct ast_channel *chan, const char *data) ast_set_read_format_by_id(l->pchan,AST_FORMAT_SLINEAR); ast_set_write_format_by_id(l->pchan,AST_FORMAT_SLINEAR); #ifdef AST_CDR_FLAG_POST_DISABLED - if (l->pchan->cdr) - ast_set_flag(l->pchan->cdr,AST_CDR_FLAG_POST_DISABLED); + if (ast_channel_cdr(l->pchan)) + ast_set_flag(ast_channel_cdr(l->pchan),AST_CDR_FLAG_POST_DISABLED); #endif /* make a conference for the tx */ ci.chan = 0; @@ -13693,7 +13693,7 @@ static int rpt_exec(struct ast_channel *chan, const char *data) insque((struct qelem *)l,(struct qelem *)myrpt->links.next); __kickshort(myrpt); rpt_mutex_unlock(&myrpt->lock); - if (chan->_state != AST_STATE_UP) { + if (ast_channel_state(chan) != AST_STATE_UP) { ast_answer(chan); if (!phone_mode) send_newkey(chan); } @@ -13721,8 +13721,8 @@ static int rpt_exec(struct ast_channel *chan, const char *data) { ast_log(LOG_WARNING, "Trying to use busy link on %s\n",tmp); #ifdef AST_CDR_FLAG_POST_DISABLED - if (chan->cdr) - ast_set_flag(chan->cdr,AST_CDR_FLAG_POST_DISABLED); + if (ast_channel_cdr(chan)) + ast_set_flag(ast_channel_cdr(chan),AST_CDR_FLAG_POST_DISABLED); #endif return -1; } @@ -13747,8 +13747,8 @@ static int rpt_exec(struct ast_channel *chan, const char *data) rpt_mutex_unlock(&myrpt->lock); ast_log(LOG_WARNING, "Trying to use busy link (repeater node %s) on %s\n",rpt_vars[i].name,tmp); #ifdef AST_CDR_FLAG_POST_DISABLED - if (chan->cdr) - ast_set_flag(chan->cdr,AST_CDR_FLAG_POST_DISABLED); + if (ast_channel_cdr(chan)) + ast_set_flag(ast_channel_cdr(chan),AST_CDR_FLAG_POST_DISABLED); #endif return -1; } @@ -13764,8 +13764,8 @@ static int rpt_exec(struct ast_channel *chan, const char *data) if (ast_safe_sleep(chan,500) == -1) { #ifdef AST_CDR_FLAG_POST_DISABLED - if (chan->cdr) - ast_set_flag(chan->cdr,AST_CDR_FLAG_POST_DISABLED); + if (ast_channel_cdr(chan)) + ast_set_flag(ast_channel_cdr(chan),AST_CDR_FLAG_POST_DISABLED); #endif return -1; } @@ -13818,8 +13818,8 @@ static int rpt_exec(struct ast_channel *chan, const char *data) ast_set_read_format_by_id(myrpt->rxchannel,AST_FORMAT_SLINEAR); ast_set_write_format_by_id(myrpt->rxchannel,AST_FORMAT_SLINEAR); #ifdef AST_CDR_FLAG_POST_DISABLED - if (myrpt->rxchannel->cdr) - ast_set_flag(myrpt->rxchannel->cdr,AST_CDR_FLAG_POST_DISABLED); + if (ast_channel_cdr(myrpt->rxchannel)) + ast_set_flag(ast_channel_cdr(myrpt->rxchannel),AST_CDR_FLAG_POST_DISABLED); #endif #ifndef NEW_ASTERISK myrpt->rxchannel->whentohangup = 0; @@ -13860,8 +13860,8 @@ static int rpt_exec(struct ast_channel *chan, const char *data) ast_set_read_format_by_id(myrpt->txchannel,AST_FORMAT_SLINEAR); ast_set_write_format_by_id(myrpt->txchannel,AST_FORMAT_SLINEAR); #ifdef AST_CDR_FLAG_POST_DISABLED - if (myrpt->txchannel->cdr) - ast_set_flag(myrpt->txchannel->cdr,AST_CDR_FLAG_POST_DISABLED); + if (ast_channel_cdr(myrpt->txchannel)) + ast_set_flag(ast_channel_cdr(myrpt->txchannel),AST_CDR_FLAG_POST_DISABLED); #endif #ifndef NEW_ASTERISK myrpt->txchannel->whentohangup = 0; @@ -13904,8 +13904,8 @@ static int rpt_exec(struct ast_channel *chan, const char *data) ast_set_read_format_by_id(myrpt->pchannel,AST_FORMAT_SLINEAR); ast_set_write_format_by_id(myrpt->pchannel,AST_FORMAT_SLINEAR); #ifdef AST_CDR_FLAG_POST_DISABLED - if (myrpt->pchannel->cdr) - ast_set_flag(myrpt->pchannel->cdr,AST_CDR_FLAG_POST_DISABLED); + if (ast_channel_cdr(myrpt->pchannel)) + ast_set_flag(ast_channel_cdr(myrpt->pchannel),AST_CDR_FLAG_POST_DISABLED); #endif if (!myrpt->dahdirxchannel) myrpt->dahdirxchannel = myrpt->pchannel; if (!myrpt->dahditxchannel) myrpt->dahditxchannel = myrpt->pchannel; @@ -14028,7 +14028,7 @@ static int rpt_exec(struct ast_channel *chan, const char *data) i = 128; ioctl(myrpt->dahdirxchannel->fds[0],DAHDI_ECHOCANCEL,&i); } - if (chan->_state != AST_STATE_UP) { + if (ast_channel_state(chan) != AST_STATE_UP) { ast_answer(chan); if (!phone_mode) send_newkey(chan); } diff --git a/apps/app_sayunixtime.c b/apps/app_sayunixtime.c index 32119aca0..7d34ed9cd 100644 --- a/apps/app_sayunixtime.c +++ b/apps/app_sayunixtime.c @@ -148,7 +148,7 @@ static int sayunixtime_exec(struct ast_channel *chan, const char *data) ast_get_time_t(ast_strlen_zero(args.timeval) ? NULL : args.timeval, &unixtime, time(NULL), NULL); - if (chan->_state != AST_STATE_UP) { + if (ast_channel_state(chan) != AST_STATE_UP) { res = ast_answer(chan); } diff --git a/apps/app_sendtext.c b/apps/app_sendtext.c index a723de5b9..98b7b2fad 100644 --- a/apps/app_sendtext.c +++ b/apps/app_sendtext.c @@ -95,7 +95,7 @@ static int sendtext_exec(struct ast_channel *chan, const char *data) ast_str_get_encoded_str(&str, -1, data); ast_channel_lock(chan); - if (!chan->tech->send_text) { + if (!ast_channel_tech(chan)->send_text) { ast_channel_unlock(chan); /* Does not support transport */ pbx_builtin_setvar_helper(chan, "SENDTEXTSTATUS", status); diff --git a/apps/app_sms.c b/apps/app_sms.c index 68770da30..946677a61 100644 --- a/apps/app_sms.c +++ b/apps/app_sms.c @@ -1988,7 +1988,7 @@ static int sms_exec(struct ast_channel *chan, const char *data) goto done; } - if (chan->_state != AST_STATE_UP) { /* make sure channel is answered before any TX */ + if (ast_channel_state(chan) != AST_STATE_UP) { /* make sure channel is answered before any TX */ ast_answer(chan); } diff --git a/apps/app_softhangup.c b/apps/app_softhangup.c index 2a4befa9e..f3fc4c18f 100644 --- a/apps/app_softhangup.c +++ b/apps/app_softhangup.c @@ -107,7 +107,7 @@ static int softhangup_exec(struct ast_channel *chan, const char *data) ast_copy_string(name, ast_channel_name(c), sizeof(name)); if (ast_test_flag(&flags, OPTION_ALL)) { /* CAPI is set up like CAPI[foo/bar]/clcnt */ - if (!strcmp(c->tech->type, "CAPI")) { + if (!strcmp(ast_channel_tech(c)->type, "CAPI")) { cut = strrchr(name, '/'); /* Basically everything else is Foo/Bar-Z */ } else { diff --git a/apps/app_speech_utils.c b/apps/app_speech_utils.c index 078fcf2e9..8e6113be8 100644 --- a/apps/app_speech_utils.c +++ b/apps/app_speech_utils.c @@ -491,7 +491,7 @@ static int speech_create(struct ast_channel *chan, const char *data) struct ast_datastore *datastore = NULL; /* Request a speech object */ - speech = ast_speech_new(data, chan->nativeformats); + speech = ast_speech_new(data, ast_channel_nativeformats(chan)); if (speech == NULL) { /* Not available */ pbx_builtin_setvar_helper(chan, "ERROR", "1"); @@ -672,7 +672,7 @@ static int speech_background(struct ast_channel *chan, const char *data) } /* If channel is not already answered, then answer it */ - if (chan->_state != AST_STATE_UP && !ast_test_flag(&options, SB_OPT_NOANSWER) + if (ast_channel_state(chan) != AST_STATE_UP && !ast_test_flag(&options, SB_OPT_NOANSWER) && ast_answer(chan)) { return -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! */ while (done == 0) { /* If the filename is null and stream is not running, start up a new sound file */ - if (!quieted && (chan->streamid == -1 && chan->timingfunc == NULL) && (filename = strsep(&filename_tmp, "&"))) { + if (!quieted && (ast_channel_streamid(chan) == -1 && chan->timingfunc == NULL) && (filename = strsep(&filename_tmp, "&"))) { /* Discard old stream information */ ast_stopstream(chan); /* Start new stream */ @@ -729,10 +729,10 @@ static int speech_background(struct ast_channel *chan, const char *data) } /* Run scheduled stuff */ - ast_sched_runq(chan->sched); + ast_sched_runq(ast_channel_sched(chan)); /* Yay scheduling */ - res = ast_sched_wait(chan->sched); + res = ast_sched_wait(ast_channel_sched(chan)); if (res < 0) res = 1000; @@ -760,7 +760,7 @@ static int speech_background(struct ast_channel *chan, const char *data) /* Do checks on speech structure to see if it's changed */ ast_mutex_lock(&speech->lock); if (ast_test_flag(speech, AST_SPEECH_QUIET)) { - if (chan->stream) + if (ast_channel_stream(chan)) ast_stopstream(chan); ast_clear_flag(speech, AST_SPEECH_QUIET); quieted = 1; @@ -769,9 +769,9 @@ static int speech_background(struct ast_channel *chan, const char *data) switch (speech->state) { case AST_SPEECH_STATE_READY: /* If audio playback has stopped do a check for timeout purposes */ - if (chan->streamid == -1 && chan->timingfunc == NULL) + if (ast_channel_streamid(chan) == -1 && chan->timingfunc == NULL) ast_stopstream(chan); - if (!quieted && chan->stream == NULL && timeout && started == 0 && !filename_tmp) { + if (!quieted && ast_channel_stream(chan) == NULL && timeout && started == 0 && !filename_tmp) { if (timeout == -1) { done = 1; if (f) @@ -789,13 +789,13 @@ static int speech_background(struct ast_channel *chan, const char *data) case AST_SPEECH_STATE_WAIT: /* Cue up waiting sound if not already playing */ if (!strlen(dtmf)) { - if (chan->stream == NULL) { + if (ast_channel_stream(chan) == NULL) { if (speech->processing_sound != NULL) { if (strlen(speech->processing_sound) > 0 && strcasecmp(speech->processing_sound, "none")) { speech_streamfile(chan, speech->processing_sound, ast_channel_language(chan)); } } - } else if (chan->streamid == -1 && chan->timingfunc == NULL) { + } else if (ast_channel_streamid(chan) == -1 && chan->timingfunc == NULL) { ast_stopstream(chan); if (speech->processing_sound != NULL) { if (strlen(speech->processing_sound) > 0 && strcasecmp(speech->processing_sound, "none")) { @@ -814,7 +814,7 @@ static int speech_background(struct ast_channel *chan, const char *data) /* Break out of our background too */ done = 1; /* Stop audio playback */ - if (chan->stream != NULL) { + if (ast_channel_stream(chan) != NULL) { ast_stopstream(chan); } } @@ -833,12 +833,12 @@ static int speech_background(struct ast_channel *chan, const char *data) done = 1; } else { quieted = 1; - if (chan->stream != NULL) { + if (ast_channel_stream(chan) != NULL) { ast_stopstream(chan); } if (!started) { /* Change timeout to be 5 seconds for DTMF input */ - timeout = (chan->pbx && chan->pbx->dtimeoutms) ? chan->pbx->dtimeoutms : 5000; + timeout = (ast_channel_pbx(chan) && ast_channel_pbx(chan)->dtimeoutms) ? ast_channel_pbx(chan)->dtimeoutms : 5000; started = 1; } start = ast_tvnow(); diff --git a/apps/app_stack.c b/apps/app_stack.c index f45c07817..06febbaeb 100644 --- a/apps/app_stack.c +++ b/apps/app_stack.c @@ -402,7 +402,7 @@ static int gosub_exec(struct ast_channel *chan, const char *data) } /* Create the return address, but don't save it until we know that the Gosub destination exists */ - newframe = gosub_allocate_frame(ast_channel_context(chan), ast_channel_exten(chan), chan->priority + 1, max_argc); + newframe = gosub_allocate_frame(ast_channel_context(chan), ast_channel_exten(chan), ast_channel_priority(chan) + 1, max_argc); if (!newframe) { return -1; @@ -415,13 +415,13 @@ static int gosub_exec(struct ast_channel *chan, const char *data) } if (!ast_exists_extension(chan, ast_channel_context(chan), ast_channel_exten(chan), - ast_test_flag(chan, AST_FLAG_IN_AUTOLOOP) ? chan->priority + 1 : chan->priority, + ast_test_flag(chan, AST_FLAG_IN_AUTOLOOP) ? ast_channel_priority(chan) + 1 : ast_channel_priority(chan), S_COR(chan->caller.id.number.valid, chan->caller.id.number.str, NULL))) { ast_log(LOG_ERROR, "Attempt to reach a non-existent destination for gosub: (Context:%s, Extension:%s, Priority:%d)\n", - ast_channel_context(chan), ast_channel_exten(chan), ast_test_flag(chan, AST_FLAG_IN_AUTOLOOP) ? chan->priority + 1 : chan->priority); + 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_set(chan, newframe->context); ast_channel_exten_set(chan, newframe->extension); - chan->priority = newframe->priority; + ast_channel_priority_set(chan, newframe->priority); ast_free(newframe); return -1; } @@ -607,7 +607,7 @@ static int handle_gosub(struct ast_channel *chan, AGI *agi, int argc, const char /* Save previous location, since we're going to change it */ ast_copy_string(old_context, ast_channel_context(chan), sizeof(old_context)); ast_copy_string(old_extension, ast_channel_exten(chan), sizeof(old_extension)); - old_priority = chan->priority; + old_priority = ast_channel_priority(chan); if (!(theapp = pbx_findapp("Gosub"))) { ast_log(LOG_ERROR, "Gosub() cannot be found in the list of loaded applications\n"); @@ -622,12 +622,12 @@ static int handle_gosub(struct ast_channel *chan, AGI *agi, int argc, const char * call a Gosub for the CALLEE channel in Dial or Queue. */ if (argc == 5) { - if (asprintf(&gosub_args, "%s,%s,%d(%s)", argv[1], argv[2], priority + (chan->pbx ? 1 : 0), argv[4]) < 0) { + if (asprintf(&gosub_args, "%s,%s,%d(%s)", argv[1], argv[2], priority + (ast_channel_pbx(chan) ? 1 : 0), argv[4]) < 0) { ast_log(LOG_WARNING, "asprintf() failed: %s\n", strerror(errno)); gosub_args = NULL; } } else { - if (asprintf(&gosub_args, "%s,%s,%d", argv[1], argv[2], priority + (chan->pbx ? 1 : 0)) < 0) { + if (asprintf(&gosub_args, "%s,%s,%d", argv[1], argv[2], priority + (ast_channel_pbx(chan) ? 1 : 0)) < 0) { ast_log(LOG_WARNING, "asprintf() failed: %s\n", strerror(errno)); gosub_args = NULL; } @@ -639,7 +639,7 @@ static int handle_gosub(struct ast_channel *chan, AGI *agi, int argc, const char ast_debug(1, "Trying gosub with arguments '%s'\n", gosub_args); if ((res = pbx_exec(chan, theapp, gosub_args)) == 0) { - struct ast_pbx *pbx = chan->pbx; + struct ast_pbx *pbx = ast_channel_pbx(chan); struct ast_pbx_args args; struct ast_datastore *stack_store = ast_channel_datastore_find(chan, &stack_info, NULL); AST_LIST_HEAD(, gosub_stack_frame) *oldlist = stack_store->data; @@ -649,14 +649,14 @@ static int handle_gosub(struct ast_channel *chan, AGI *agi, int argc, const char memset(&args, 0, sizeof(args)); args.no_hangup_chan = 1; /* Suppress warning about PBX already existing */ - chan->pbx = NULL; + ast_channel_pbx_set(chan, NULL); ast_agi_send(agi->fd, chan, "100 result=0 Trying...\n"); ast_pbx_run_args(chan, &args); ast_agi_send(agi->fd, chan, "200 result=0 Gosub complete\n"); - if (chan->pbx) { - ast_free(chan->pbx); + if (ast_channel_pbx(chan)) { + ast_free(ast_channel_pbx(chan)); } - chan->pbx = pbx; + ast_channel_pbx_set(chan, pbx); } else { ast_agi_send(agi->fd, chan, "200 result=%d Gosub failed\n", res); } @@ -669,7 +669,7 @@ static int handle_gosub(struct ast_channel *chan, AGI *agi, int argc, const char /* Restore previous location */ ast_channel_context_set(chan, old_context); ast_channel_exten_set(chan, old_extension); - chan->priority = old_priority; + ast_channel_priority_set(chan, old_priority); return RESULT_SUCCESS; } diff --git a/apps/app_talkdetect.c b/apps/app_talkdetect.c index 5c0ee339b..0250f2262 100644 --- a/apps/app_talkdetect.c +++ b/apps/app_talkdetect.c @@ -125,7 +125,7 @@ static int background_detect_exec(struct ast_channel *chan, const char *data) ast_debug(1, "Preparing detect of '%s', sil=%d, min=%d, max=%d, analysistime=%d\n", args.filename, sil, min, max, analysistime); do { - if (chan->_state != AST_STATE_UP) { + if (ast_channel_state(chan) != AST_STATE_UP) { if ((res = ast_answer(chan))) { break; } @@ -149,8 +149,8 @@ static int background_detect_exec(struct ast_channel *chan, const char *data) break; } detection_start = ast_tvnow(); - while (chan->stream) { - res = ast_sched_wait(chan->sched); + while (ast_channel_stream(chan)) { + res = ast_sched_wait(ast_channel_sched(chan)); if ((res < 0) && !chan->timingfunc) { res = 0; break; @@ -227,7 +227,7 @@ static int background_detect_exec(struct ast_channel *chan, const char *data) } ast_frfree(fr); } - ast_sched_runq(chan->sched); + ast_sched_runq(ast_channel_sched(chan)); } ast_stopstream(chan); } while (0); diff --git a/apps/app_test.c b/apps/app_test.c index 9e118669e..bf66824ec 100644 --- a/apps/app_test.c +++ b/apps/app_test.c @@ -162,7 +162,7 @@ static int testclient_exec(struct ast_channel *chan, const char *data) return -1; } - if (chan->_state != AST_STATE_UP) + if (ast_channel_state(chan) != AST_STATE_UP) res = ast_answer(chan); /* Wait a few just to be sure things get started */ @@ -329,7 +329,7 @@ static int testserver_exec(struct ast_channel *chan, const char *data) char testid[80]=""; char fn[80]; FILE *f; - if (chan->_state != AST_STATE_UP) + if (ast_channel_state(chan) != AST_STATE_UP) res = ast_answer(chan); /* Read version */ ast_debug(1, "Read client version\n"); diff --git a/apps/app_transfer.c b/apps/app_transfer.c index f072eb27f..15c3245dd 100644 --- a/apps/app_transfer.c +++ b/apps/app_transfer.c @@ -106,14 +106,14 @@ static int transfer_exec(struct ast_channel *chan, const char *data) tech = dest; dest = slash + 1; /* Allow execution only if the Tech/destination agrees with the type of the channel */ - if (strncasecmp(chan->tech->type, tech, len)) { + if (strncasecmp(ast_channel_tech(chan)->type, tech, len)) { pbx_builtin_setvar_helper(chan, "TRANSFERSTATUS", "FAILURE"); return 0; } } /* Check if the channel supports transfer before we try it */ - if (!chan->tech->transfer) { + if (!ast_channel_tech(chan)->transfer) { pbx_builtin_setvar_helper(chan, "TRANSFERSTATUS", "UNSUPPORTED"); return 0; } diff --git a/apps/app_verbose.c b/apps/app_verbose.c index 14ff2fb05..b981fb9c8 100644 --- a/apps/app_verbose.c +++ b/apps/app_verbose.c @@ -158,7 +158,7 @@ static int log_exec(struct ast_channel *chan, const char *data) snprintf(context, sizeof(context), "@ %s", ast_channel_context(chan)); snprintf(extension, sizeof(extension), "Ext. %s", ast_channel_exten(chan)); - ast_log(lnum, extension, chan->priority, context, "%s\n", args.msg); + ast_log(lnum, extension, ast_channel_priority(chan), context, "%s\n", args.msg); } return 0; diff --git a/apps/app_voicemail.c b/apps/app_voicemail.c index 484f4499f..3a90b9944 100644 --- a/apps/app_voicemail.c +++ b/apps/app_voicemail.c @@ -4756,7 +4756,7 @@ static void make_email_file(FILE *p, char *srcemail, struct ast_vm_user *vmu, in #endif /* flag added for Urgent */ fprintf(p, "X-Asterisk-VM-Flag: %s" ENDL, flag); - fprintf(p, "X-Asterisk-VM-Priority: %d" ENDL, chan->priority); + fprintf(p, "X-Asterisk-VM-Priority: %d" ENDL, ast_channel_priority(chan)); fprintf(p, "X-Asterisk-VM-Caller-channel: %s" ENDL, ast_channel_name(chan)); fprintf(p, "X-Asterisk-VM-Caller-ID-Num: %s" ENDL, enc_cidnum); fprintf(p, "X-Asterisk-VM-Caller-ID-Name: %s" ENDL, enc_cidname); @@ -5897,7 +5897,7 @@ static int leave_voicemail(struct ast_channel *chan, char *ext, struct leave_vm_ } else if (ausemacro && !ast_strlen_zero(ast_channel_macrocontext(chan))) { ast_channel_context_set(chan, ast_channel_macrocontext(chan)); } - chan->priority = 0; + ast_channel_priority_set(chan, 0); free_user(vmu); pbx_builtin_setvar_helper(chan, "VMSTATUS", "USEREXIT"); ast_free(tmp); @@ -5915,7 +5915,7 @@ static int leave_voicemail(struct ast_channel *chan, char *ext, struct leave_vm_ ast_channel_context_set(chan, ast_channel_macrocontext(chan)); } ast_play_and_wait(chan, "transfer"); - chan->priority = 0; + ast_channel_priority_set(chan, 0); free_user(vmu); pbx_builtin_setvar_helper(chan, "VMSTATUS", "USEREXIT"); } @@ -6009,7 +6009,7 @@ static int leave_voicemail(struct ast_channel *chan, char *ext, struct leave_vm_ /* Store information in real-time storage */ if (ast_check_realtime("voicemail_data")) { - snprintf(priority, sizeof(priority), "%d", chan->priority); + snprintf(priority, sizeof(priority), "%d", ast_channel_priority(chan)); snprintf(origtime, sizeof(origtime), "%ld", (long) time(NULL)); get_date(date, sizeof(date)); ast_callerid_merge(callerid, sizeof(callerid), @@ -6061,7 +6061,7 @@ static int leave_voicemail(struct ast_channel *chan, char *ext, struct leave_vm_ ast_channel_exten(chan), S_COR(chan->redirecting.from.number.valid, chan->redirecting.from.number.str, "unknown"), - chan->priority, + ast_channel_priority(chan), ast_channel_name(chan), callerid, date, (long) time(NULL), @@ -7319,7 +7319,7 @@ static int forward_message(struct ast_channel *chan, char *context, struct vm_st /* make backup copies */ old_context = ast_strdupa(ast_channel_context(chan)); old_exten = ast_strdupa(ast_channel_exten(chan)); - old_priority = chan->priority; + old_priority = ast_channel_priority(chan); /* call the the Directory, changes the channel */ snprintf(vmcontext, sizeof(vmcontext), "%s,,v", context ? context : "default"); @@ -7330,7 +7330,7 @@ static int forward_message(struct ast_channel *chan, char *context, struct vm_st /* restore the old context, exten, and priority */ ast_channel_context_set(chan, old_context); ast_channel_exten_set(chan, old_exten); - chan->priority = old_priority; + ast_channel_priority_set(chan, old_priority); } else { ast_log(AST_LOG_WARNING, "Could not find the Directory application, disabling directory_forward\n"); ast_clear_flag((&globalflags), VM_DIRECFORWARD); @@ -9996,7 +9996,7 @@ static int vm_execmain(struct ast_channel *chan, const char *data) memset(&vmus, 0, sizeof(vmus)); ast_test_suite_event_notify("START", "Message: vm_execmain started"); - if (chan->_state != AST_STATE_UP) { + if (ast_channel_state(chan) != AST_STATE_UP) { ast_debug(1, "Before ast_answer\n"); ast_answer(chan); } @@ -10727,7 +10727,7 @@ static int vm_exec(struct ast_channel *chan, const char *data) memset(&leave_options, 0, sizeof(leave_options)); - if (chan->_state != AST_STATE_UP) + if (ast_channel_state(chan) != AST_STATE_UP) ast_answer(chan); if (!ast_strlen_zero(data)) { @@ -12789,6 +12789,7 @@ AST_TEST_DEFINE(test_voicemail_vmsayname) struct ast_channel *test_channel1 = NULL; int res = -1; + struct ast_format_cap *nativeformats; static const struct ast_channel_tech fake_tech = { .write = fake_write, @@ -12814,11 +12815,12 @@ AST_TEST_DEFINE(test_voicemail_vmsayname) /* normally this is done in the channel driver */ ast_format_set(&test_channel1->writeformat, AST_FORMAT_GSM, 0); - ast_format_cap_add(test_channel1->nativeformats, &test_channel1->writeformat); + nativeformats = ast_channel_nativeformats(test_channel1); + ast_format_cap_add(nativeformats, &test_channel1->writeformat); ast_format_set(&test_channel1->rawwriteformat, AST_FORMAT_GSM, 0); ast_format_set(&test_channel1->readformat, AST_FORMAT_GSM, 0); ast_format_set(&test_channel1->rawreadformat, AST_FORMAT_GSM, 0); - test_channel1->tech = &fake_tech; + ast_channel_tech_set(test_channel1, &fake_tech); ast_test_status_update(test, "Test playing of extension when greeting is not available...\n"); snprintf(dir, sizeof(dir), "%s@%s", TEST_EXTENSION, TEST_CONTEXT); /* not a dir, don't get confused */ @@ -13446,7 +13448,7 @@ static int dialout(struct ast_channel *chan, struct ast_vm_user *vmu, char *num, ast_verb(3, "Placing outgoing call to extension '%s' in context '%s' from context '%s'\n", destination, outgoing_context, ast_channel_context(chan)); ast_channel_exten_set(chan, destination); ast_channel_context_set(chan, outgoing_context); - chan->priority = 0; + ast_channel_priority_set(chan, 0); return 9; } return 0; diff --git a/apps/app_waitforsilence.c b/apps/app_waitforsilence.c index 3d3aa75df..1964376aa 100644 --- a/apps/app_waitforsilence.c +++ b/apps/app_waitforsilence.c @@ -215,7 +215,7 @@ static int waitfor_exec(struct ast_channel *chan, const char *data, int wait_for time_t waitstart; struct ast_silence_generator *silgen = NULL; - if (chan->_state != AST_STATE_UP) { + if (ast_channel_state(chan) != AST_STATE_UP) { res = ast_answer(chan); /* Answer the channel */ } diff --git a/apps/app_while.c b/apps/app_while.c index 25d7c433b..5e8fb9bb4 100644 --- a/apps/app_while.c +++ b/apps/app_while.c @@ -165,7 +165,7 @@ static int find_matching_endwhile(struct ast_channel *chan) if (!ast_rdlock_context(c)) { if (!strcmp(ast_get_context_name(c), ast_channel_context(chan))) { /* This is the matching context we want */ - int cur_priority = chan->priority + 1, level=1; + int cur_priority = ast_channel_priority(chan) + 1, level=1; for (e = find_matching_priority(c, ast_channel_exten(chan), cur_priority, S_COR(chan->caller.id.number.valid, chan->caller.id.number.str, NULL)); @@ -238,7 +238,7 @@ static int _while_exec(struct ast_channel *chan, const char *data, int end) size = strlen(ast_channel_context(chan)) + strlen(ast_channel_exten(chan)) + 32; my_name = alloca(size); memset(my_name, 0, size); - snprintf(my_name, size, "%s_%s_%d", ast_channel_context(chan), ast_channel_exten(chan), chan->priority); + snprintf(my_name, size, "%s_%s_%d", ast_channel_context(chan), ast_channel_exten(chan), ast_channel_priority(chan)); ast_channel_lock(chan); if (end) { @@ -269,9 +269,9 @@ static int _while_exec(struct ast_channel *chan, const char *data, int end) int pri = find_matching_endwhile(chan); if (pri > 0) { ast_verb(3, "Jumping to priority %d\n", pri); - chan->priority = pri; + ast_channel_priority_set(chan, pri); } else { - ast_log(LOG_WARNING, "Couldn't find matching EndWhile? (While at %s@%s priority %d)\n", ast_channel_context(chan), ast_channel_exten(chan), chan->priority); + ast_log(LOG_WARNING, "Couldn't find matching EndWhile? (While at %s@%s priority %d)\n", ast_channel_context(chan), ast_channel_exten(chan), ast_channel_priority(chan)); } } ast_channel_unlock(chan); @@ -283,7 +283,7 @@ static int _while_exec(struct ast_channel *chan, const char *data, int end) size = strlen(ast_channel_context(chan)) + strlen(ast_channel_exten(chan)) + 32; goto_str = alloca(size); memset(goto_str, 0, size); - snprintf(goto_str, size, "%s,%s,%d", ast_channel_context(chan), ast_channel_exten(chan), chan->priority); + snprintf(goto_str, size, "%s,%s,%d", ast_channel_context(chan), ast_channel_exten(chan), ast_channel_priority(chan)); pbx_builtin_setvar_helper(chan, varname, goto_str); } @@ -295,7 +295,7 @@ static int _while_exec(struct ast_channel *chan, const char *data, int end) size = strlen(ast_channel_context(chan)) + strlen(ast_channel_exten(chan)) + 32; goto_str = alloca(size); memset(goto_str, 0, size); - snprintf(goto_str, size, "%s,%s,%d", ast_channel_context(chan), ast_channel_exten(chan), chan->priority+1); + snprintf(goto_str, size, "%s,%s,%d", ast_channel_context(chan), ast_channel_exten(chan), ast_channel_priority(chan)+1); pbx_builtin_setvar_helper(chan, end_varname, goto_str); } ast_parseable_goto(chan, while_pri); diff --git a/apps/app_zapateller.c b/apps/app_zapateller.c index b102ea426..775fd55a3 100644 --- a/apps/app_zapateller.c +++ b/apps/app_zapateller.c @@ -98,7 +98,7 @@ static int zapateller_exec(struct ast_channel *chan, const char *data) pbx_builtin_setvar_helper(chan, "ZAPATELLERSTATUS", "NOTHING"); ast_stopstream(chan); - if (chan->_state != AST_STATE_UP) { + if (ast_channel_state(chan) != AST_STATE_UP) { if (answer) { res = ast_answer(chan); pbx_builtin_setvar_helper(chan, "ZAPATELLERSTATUS", "ANSWERED"); |