From a9d607a35764d93790172cab1f630e14fb8e043c Mon Sep 17 00:00:00 2001 From: Terry Wilson Date: Wed, 29 Feb 2012 16:52:47 +0000 Subject: Opaquify ast_channel structs and lists Review: https://reviewboard.asterisk.org/r/1773/ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@357542 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- addons/chan_ooh323.c | 32 ++-- apps/app_alarmreceiver.c | 4 +- apps/app_amd.c | 4 +- apps/app_confbridge.c | 14 +- apps/app_dial.c | 118 +++++++------- apps/app_disa.c | 10 +- apps/app_dumpchan.c | 14 +- apps/app_fax.c | 8 +- apps/app_followme.c | 6 +- apps/app_macro.c | 10 +- apps/app_meetme.c | 48 +++--- apps/app_minivm.c | 28 ++-- apps/app_mixmonitor.c | 2 +- apps/app_osplookup.c | 12 +- apps/app_parkandannounce.c | 6 +- apps/app_privacy.c | 10 +- apps/app_queue.c | 88 +++++----- apps/app_readexten.c | 6 +- apps/app_rpt.c | 36 ++--- apps/app_setcallerid.c | 4 +- apps/app_sms.c | 2 +- apps/app_stack.c | 12 +- apps/app_talkdetect.c | 2 +- apps/app_voicemail.c | 50 +++--- apps/app_while.c | 4 +- apps/app_zapateller.c | 4 +- bridges/bridge_builtin_features.c | 2 +- channels/chan_agent.c | 10 +- channels/chan_console.c | 4 +- channels/chan_dahdi.c | 72 ++++----- channels/chan_gtalk.c | 6 +- channels/chan_h323.c | 32 ++-- channels/chan_iax2.c | 54 +++---- channels/chan_jingle.c | 14 +- channels/chan_local.c | 51 +++--- channels/chan_mgcp.c | 26 +-- channels/chan_misdn.c | 156 +++++++++--------- channels/chan_oss.c | 16 +- channels/chan_phone.c | 14 +- channels/chan_sip.c | 86 +++++----- channels/chan_skinny.c | 64 ++++---- channels/chan_unistim.c | 30 ++-- channels/chan_usbradio.c | 6 +- channels/chan_vpb.cc | 16 +- channels/console_video.c | 8 +- channels/sig_analog.c | 68 ++++---- channels/sig_pri.c | 68 ++++---- channels/sig_ss7.c | 8 +- funcs/func_blacklist.c | 8 +- funcs/func_callerid.c | 66 ++++---- funcs/func_dialplan.c | 8 +- funcs/func_strings.c | 12 +- funcs/func_timeout.c | 6 +- include/asterisk/channel.h | 52 ++++-- include/asterisk/utils.h | 2 + main/abstract_jb.c | 30 ++-- main/app.c | 4 +- main/autochan.c | 8 +- main/ccss.c | 8 +- main/cdr.c | 16 +- main/cel.c | 30 ++-- main/channel.c | 331 +++++++++++++++++++------------------- main/channel_internal_api.c | 74 ++++++++- main/cli.c | 16 +- main/dial.c | 8 +- main/features.c | 72 ++++----- main/file.c | 2 +- main/manager.c | 24 +-- main/message.c | 4 +- main/pbx.c | 90 +++++------ pbx/pbx_lua.c | 4 +- res/res_agi.c | 18 +-- res/res_fax.c | 2 +- res/snmp/agent.c | 32 ++-- tests/test_substitution.c | 6 +- 75 files changed, 1188 insertions(+), 1090 deletions(-) diff --git a/addons/chan_ooh323.c b/addons/chan_ooh323.c index 59fc0bcd7..dc465f095 100644 --- a/addons/chan_ooh323.c +++ b/addons/chan_ooh323.c @@ -945,23 +945,23 @@ static int ooh323_call(struct ast_channel *ast, const char *dest, int timeout) } ast_mutex_lock(&p->lock); ast_set_flag(p, H323_OUTGOING); - if (ast->connected.id.number.valid && ast->connected.id.number.str) { + if (ast_channel_connected(ast)->id.number.valid && ast_channel_connected(ast)->id.number.str) { free(p->callerid_num); - p->callerid_num = strdup(ast->connected.id.number.str); + p->callerid_num = strdup(ast_channel_connected(ast)->id.number.str); } - if (ast->connected.id.name.valid && ast->connected.id.name.str) { + if (ast_channel_connected(ast)->id.name.valid && ast_channel_connected(ast)->id.name.str) { free(p->callerid_name); - p->callerid_name = strdup(ast->connected.id.name.str); - } else if (ast->connected.id.number.valid && ast->connected.id.number.str) { + p->callerid_name = strdup(ast_channel_connected(ast)->id.name.str); + } else if (ast_channel_connected(ast)->id.number.valid && ast_channel_connected(ast)->id.number.str) { free(p->callerid_name); - p->callerid_name = strdup(ast->connected.id.number.str); + p->callerid_name = strdup(ast_channel_connected(ast)->id.number.str); } else { - ast->connected.id.name.valid = 1; - free(ast->connected.id.name.str); - ast->connected.id.name.str = strdup(gCallerID); + ast_channel_connected(ast)->id.name.valid = 1; + free(ast_channel_connected(ast)->id.name.str); + ast_channel_connected(ast)->id.name.str = strdup(gCallerID); free(p->callerid_name); - p->callerid_name = strdup(ast->connected.id.name.str); + p->callerid_name = strdup(ast_channel_connected(ast)->id.name.str); } /* Retrieve vars */ @@ -1294,15 +1294,15 @@ static int ooh323_indicate(struct ast_channel *ast, int condition, const void *d } break; case AST_CONTROL_CONNECTED_LINE: - if (!ast->connected.id.name.valid - || ast_strlen_zero(ast->connected.id.name.str)) { + if (!ast_channel_connected(ast)->id.name.valid + || ast_strlen_zero(ast_channel_connected(ast)->id.name.str)) { break; } if (gH323Debug) { ast_debug(1, "Sending connected line info for %s (%s)\n", - callToken, ast->connected.id.name.str); + callToken, ast_channel_connected(ast)->id.name.str); } - ooSetANI(callToken, ast->connected.id.name.str); + ooSetANI(callToken, ast_channel_connected(ast)->id.name.str); break; case AST_CONTROL_T38_PARAMETERS: @@ -4661,7 +4661,7 @@ struct ast_frame *ooh323_rtp_read(struct ast_channel *ast, struct ooh323_pvt *p) const char *target_context = S_OR(ast_channel_macrocontext(p->owner), ast_channel_context(p->owner)); if ((strcmp(ast_channel_exten(p->owner), "fax")) && (ast_exists_extension(p->owner, target_context, "fax", 1, - S_COR(p->owner->caller.id.number.valid, p->owner->caller.id.number.str, NULL)))) { + S_COR(ast_channel_caller(p->owner)->id.number.valid, ast_channel_caller(p->owner)->id.number.str, NULL)))) { ast_verb(2, "Redirecting '%s' to fax extension due to CNG detection\n", ast_channel_name(p->owner)); pbx_builtin_setvar_helper(p->owner, "FAXEXTEN", ast_channel_exten(p->owner)); if (ast_async_goto(p->owner, target_context, "fax", 1)) { @@ -4739,7 +4739,7 @@ void onModeChanged(ooCallData *call, int t38mode) { target_context = S_OR(ast_channel_macrocontext(p->owner), ast_channel_context(p->owner)); if ((strcmp(ast_channel_exten(p->owner), "fax")) && (ast_exists_extension(p->owner, target_context, "fax", 1, - S_COR(p->owner->caller.id.number.valid, p->owner->caller.id.number.str, NULL)))) { + S_COR(ast_channel_caller(p->owner)->id.number.valid, ast_channel_caller(p->owner)->id.number.str, NULL)))) { ast_verb(2, "Redirecting '%s' to fax extension due to CNG detection\n", ast_channel_name(p->owner)); pbx_builtin_setvar_helper(p->owner, "FAXEXTEN", ast_channel_exten(p->owner)); if (ast_async_goto(p->owner, target_context, "fax", 1)) { diff --git a/apps/app_alarmreceiver.c b/apps/app_alarmreceiver.c index c4309e065..574a59d35 100644 --- a/apps/app_alarmreceiver.c +++ b/apps/app_alarmreceiver.c @@ -309,7 +309,7 @@ static int write_metadata( FILE *logfile, char *signalling_type, struct ast_chan /* Extract the caller ID location */ ast_copy_string(workstring, - S_COR(chan->caller.id.number.valid, chan->caller.id.number.str, ""), + S_COR(ast_channel_caller(chan)->id.number.valid, ast_channel_caller(chan)->id.number.str, ""), sizeof(workstring)); ast_shrink_phone_number(workstring); if (ast_strlen_zero(workstring)) { @@ -317,7 +317,7 @@ static int write_metadata( FILE *logfile, char *signalling_type, struct ast_chan } else { cl = workstring; } - cn = S_COR(chan->caller.id.name.valid, chan->caller.id.name.str, ""); + cn = S_COR(ast_channel_caller(chan)->id.name.valid, ast_channel_caller(chan)->id.name.str, ""); /* Get the current time */ t = ast_tvnow(); diff --git a/apps/app_amd.c b/apps/app_amd.c index 6aefe9ac9..597aac39c 100644 --- a/apps/app_amd.c +++ b/apps/app_amd.c @@ -193,8 +193,8 @@ static void isAnsweringMachine(struct ast_channel *chan, const char *data) ast_format_clear(&readFormat); ast_verb(3, "AMD: %s %s %s (Fmt: %s)\n", ast_channel_name(chan), - S_COR(chan->caller.ani.number.valid, chan->caller.ani.number.str, "(N/A)"), - S_COR(chan->redirecting.from.number.valid, chan->redirecting.from.number.str, "(N/A)"), + S_COR(ast_channel_caller(chan)->ani.number.valid, ast_channel_caller(chan)->ani.number.str, "(N/A)"), + S_COR(ast_channel_redirecting(chan)->from.number.valid, ast_channel_redirecting(chan)->from.number.str, "(N/A)"), ast_getformatname(ast_channel_readformat(chan))); /* Lets parse the arguments. */ diff --git a/apps/app_confbridge.c b/apps/app_confbridge.c index 299864022..b5b27ed2f 100644 --- a/apps/app_confbridge.c +++ b/apps/app_confbridge.c @@ -548,8 +548,8 @@ static void send_join_event(struct ast_channel *chan, const char *conf_name) ast_channel_name(chan), ast_channel_uniqueid(chan), conf_name, - S_COR(chan->caller.id.number.valid, chan->caller.id.number.str, ""), - S_COR(chan->caller.id.name.valid, chan->caller.id.name.str, "") + S_COR(ast_channel_caller(chan)->id.number.valid, ast_channel_caller(chan)->id.number.str, ""), + S_COR(ast_channel_caller(chan)->id.name.valid, ast_channel_caller(chan)->id.name.str, "") ); } @@ -564,8 +564,8 @@ static void send_leave_event(struct ast_channel *chan, const char *conf_name) ast_channel_name(chan), ast_channel_uniqueid(chan), conf_name, - S_COR(chan->caller.id.number.valid, chan->caller.id.number.str, ""), - S_COR(chan->caller.id.name.valid, chan->caller.id.name.str, "") + S_COR(ast_channel_caller(chan)->id.number.valid, ast_channel_caller(chan)->id.number.str, ""), + S_COR(ast_channel_caller(chan)->id.name.valid, ast_channel_caller(chan)->id.name.str, "") ); } @@ -2008,7 +2008,7 @@ static char *handle_cli_confbridge_list(struct ast_cli_entry *e, int cmd, struct ast_cli(a->fd, "%-17s", participant->u_profile.name); ast_cli(a->fd, "%-17s", participant->b_profile.name); ast_cli(a->fd, "%-17s", participant->menu_name); - ast_cli(a->fd, "%-17s", S_COR(participant->chan->caller.id.number.valid, participant->chan->caller.id.number.str, "")); + ast_cli(a->fd, "%-17s", S_COR(ast_channel_caller(participant->chan)->id.number.valid, ast_channel_caller(participant->chan)->id.number.str, "")); ast_cli(a->fd, "\n"); } ao2_unlock(bridge); @@ -2346,8 +2346,8 @@ static int action_confbridgelist(struct mansession *s, const struct message *m) "\r\n", id_text, bridge->name, - S_COR(participant->chan->caller.id.number.valid, participant->chan->caller.id.number.str, ""), - S_COR(participant->chan->caller.id.name.valid, participant->chan->caller.id.name.str, ""), + S_COR(ast_channel_caller(participant->chan)->id.number.valid, ast_channel_caller(participant->chan)->id.number.str, ""), + S_COR(ast_channel_caller(participant->chan)->id.name.valid, ast_channel_caller(participant->chan)->id.name.str, ""), ast_channel_name(participant->chan), ast_test_flag(&participant->u_profile, USER_OPT_ADMIN) ? "Yes" : "No", ast_test_flag(&participant->u_profile, USER_OPT_MARKEDUSER) ? "Yes" : "No"); diff --git a/apps/app_dial.c b/apps/app_dial.c index 20747c0f6..d12ea9c58 100644 --- a/apps/app_dial.c +++ b/apps/app_dial.c @@ -802,10 +802,10 @@ static void senddialevent(struct ast_channel *src, struct ast_channel *dst, cons "DestUniqueID: %s\r\n" "Dialstring: %s\r\n", ast_channel_name(src), ast_channel_name(dst), - S_COR(src->caller.id.number.valid, src->caller.id.number.str, ""), - S_COR(src->caller.id.name.valid, src->caller.id.name.str, ""), - S_COR(src->connected.id.number.valid, src->connected.id.number.str, ""), - S_COR(src->connected.id.name.valid, src->connected.id.name.str, ""), + S_COR(ast_channel_caller(src)->id.number.valid, ast_channel_caller(src)->id.number.str, ""), + S_COR(ast_channel_caller(src)->id.name.valid, ast_channel_caller(src)->id.name.str, ""), + S_COR(ast_channel_connected(src)->id.number.valid, ast_channel_connected(src)->id.number.str, ""), + S_COR(ast_channel_connected(src)->id.name.valid, ast_channel_connected(src)->id.name.str, ""), ast_channel_uniqueid(src), ast_channel_uniqueid(dst), dialstring ? dialstring : ""); } @@ -897,33 +897,33 @@ static void do_forward(struct chanlist *o, ast_rtp_instance_early_bridge_make_compatible(c, in); } - ast_channel_set_redirecting(c, &original->redirecting, NULL); + ast_channel_set_redirecting(c, ast_channel_redirecting(original), NULL); ast_channel_lock(c); while (ast_channel_trylock(in)) { CHANNEL_DEADLOCK_AVOIDANCE(c); } - if (!c->redirecting.from.number.valid - || ast_strlen_zero(c->redirecting.from.number.str)) { + if (!ast_channel_redirecting(c)->from.number.valid + || ast_strlen_zero(ast_channel_redirecting(c)->from.number.str)) { /* * The call was not previously redirected so it is * now redirected from this number. */ - ast_party_number_free(&c->redirecting.from.number); - ast_party_number_init(&c->redirecting.from.number); - c->redirecting.from.number.valid = 1; - c->redirecting.from.number.str = + ast_party_number_free(&ast_channel_redirecting(c)->from.number); + ast_party_number_init(&ast_channel_redirecting(c)->from.number); + ast_channel_redirecting(c)->from.number.valid = 1; + ast_channel_redirecting(c)->from.number.str = ast_strdup(S_OR(ast_channel_macroexten(in), ast_channel_exten(in))); } - c->dialed.transit_network_select = in->dialed.transit_network_select; + ast_channel_dialed(c)->transit_network_select = ast_channel_dialed(in)->transit_network_select; /* Determine CallerID to store in outgoing channel. */ - ast_party_caller_set_init(&caller, &c->caller); + ast_party_caller_set_init(&caller, ast_channel_caller(c)); if (ast_test_flag64(peerflags, OPT_ORIGINAL_CLID)) { caller.id = *stored_clid; ast_channel_set_caller_event(c, &caller, NULL); - } else if (ast_strlen_zero(S_COR(c->caller.id.number.valid, - c->caller.id.number.str, NULL))) { + } else if (ast_strlen_zero(S_COR(ast_channel_caller(c)->id.number.valid, + ast_channel_caller(c)->id.number.str, NULL))) { /* * The new channel has no preset CallerID number by the channel * driver. Use the dialplan extension and hint name. @@ -938,9 +938,9 @@ static void do_forward(struct chanlist *o, ast_party_connected_line_init(&connected); connected.id = *forced_clid; - ast_party_connected_line_copy(&c->connected, &connected); + ast_party_connected_line_copy(ast_channel_connected(c), &connected); } else { - ast_connected_line_copy_from_caller(&c->connected, &in->caller); + ast_connected_line_copy_from_caller(ast_channel_connected(c), ast_channel_caller(in)); } ast_channel_accountcode_set(c, ast_channel_accountcode(in)); @@ -954,7 +954,7 @@ static void do_forward(struct chanlist *o, * here. */ ast_party_redirecting_init(&redirecting); - ast_party_redirecting_copy(&redirecting, &c->redirecting); + ast_party_redirecting_copy(&redirecting, ast_channel_redirecting(c)); ast_channel_unlock(c); if (ast_channel_redirecting_sub(c, in, &redirecting, 0) && ast_channel_redirecting_macro(c, in, &redirecting, 1, 0)) { @@ -1047,7 +1047,7 @@ static struct ast_channel *wait_for_answer(struct ast_channel *in, if (!ast_test_flag64(peerflags, OPT_IGNORE_CONNECTEDLINE) && !ast_test_flag64(outgoing, DIAL_CALLERID_ABSENT)) { ast_channel_lock(outgoing->chan); - ast_connected_line_copy_from_caller(&connected_caller, &outgoing->chan->caller); + ast_connected_line_copy_from_caller(&connected_caller, ast_channel_caller(outgoing->chan)); ast_channel_unlock(outgoing->chan); connected_caller.source = AST_CONNECTED_LINE_UPDATE_SOURCE_ANSWER; ast_channel_update_connected_line(in, &connected_caller, NULL); @@ -1112,7 +1112,7 @@ static struct ast_channel *wait_for_answer(struct ast_channel *in, } } else if (!ast_test_flag64(o, DIAL_CALLERID_ABSENT)) { ast_channel_lock(c); - ast_connected_line_copy_from_caller(&connected_caller, &c->caller); + ast_connected_line_copy_from_caller(&connected_caller, ast_channel_caller(c)); ast_channel_unlock(c); connected_caller.source = AST_CONNECTED_LINE_UPDATE_SOURCE_ANSWER; ast_channel_update_connected_line(in, &connected_caller, NULL); @@ -1183,7 +1183,7 @@ static struct ast_channel *wait_for_answer(struct ast_channel *in, } } else if (!ast_test_flag64(o, DIAL_CALLERID_ABSENT)) { ast_channel_lock(c); - ast_connected_line_copy_from_caller(&connected_caller, &c->caller); + ast_connected_line_copy_from_caller(&connected_caller, ast_channel_caller(c)); ast_channel_unlock(c); connected_caller.source = AST_CONNECTED_LINE_UPDATE_SOURCE_ANSWER; ast_channel_update_connected_line(in, &connected_caller, NULL); @@ -1714,9 +1714,9 @@ static int setup_privacy_args(struct privacy_args *pa, int res; char *l; - if (chan->caller.id.number.valid - && !ast_strlen_zero(chan->caller.id.number.str)) { - l = ast_strdupa(chan->caller.id.number.str); + if (ast_channel_caller(chan)->id.number.valid + && !ast_strlen_zero(ast_channel_caller(chan)->id.number.str)) { + l = ast_strdupa(ast_channel_caller(chan)->id.number.str); ast_shrink_phone_number(l); if (ast_test_flag64(opts, OPT_PRIVACY) ) { ast_verb(3, "Privacy DB is '%s', clid is '%s'\n", opt_args[OPT_ARG_PRIVACY], l); @@ -2044,18 +2044,18 @@ static int dial_exec_full(struct ast_channel *chan, const char *data, struct ast if (ast_test_flag64(&opts, OPT_ORIGINAL_CLID)) { if (ast_strlen_zero(opt_args[OPT_ARG_ORIGINAL_CLID])) { ast_channel_lock(chan); - ast_party_id_set_init(&stored_clid, &chan->caller.id); - if (!ast_strlen_zero(chan->caller.id.name.str)) { - stored_clid.name.str = ast_strdupa(chan->caller.id.name.str); + ast_party_id_set_init(&stored_clid, &ast_channel_caller(chan)->id); + if (!ast_strlen_zero(ast_channel_caller(chan)->id.name.str)) { + stored_clid.name.str = ast_strdupa(ast_channel_caller(chan)->id.name.str); } - if (!ast_strlen_zero(chan->caller.id.number.str)) { - stored_clid.number.str = ast_strdupa(chan->caller.id.number.str); + if (!ast_strlen_zero(ast_channel_caller(chan)->id.number.str)) { + stored_clid.number.str = ast_strdupa(ast_channel_caller(chan)->id.number.str); } - if (!ast_strlen_zero(chan->caller.id.subaddress.str)) { - stored_clid.subaddress.str = ast_strdupa(chan->caller.id.subaddress.str); + if (!ast_strlen_zero(ast_channel_caller(chan)->id.subaddress.str)) { + stored_clid.subaddress.str = ast_strdupa(ast_channel_caller(chan)->id.subaddress.str); } - if (!ast_strlen_zero(chan->caller.id.tag)) { - stored_clid.tag = ast_strdupa(chan->caller.id.tag); + if (!ast_strlen_zero(ast_channel_caller(chan)->id.tag)) { + stored_clid.tag = ast_strdupa(ast_channel_caller(chan)->id.tag); } ast_channel_unlock(chan); } else { @@ -2127,7 +2127,7 @@ static int dial_exec_full(struct ast_channel *chan, const char *data, struct ast char *tech = strsep(&number, "/"); /* find if we already dialed this interface */ struct ast_dialed_interface *di; - AST_LIST_HEAD(, ast_dialed_interface) *dialed_interfaces; + AST_LIST_HEAD(,ast_dialed_interface) *dialed_interfaces; num_dialed++; if (ast_strlen_zero(number)) { ast_log(LOG_WARNING, "Dial argument takes format (technology/[device:]number1)\n"); @@ -2157,7 +2157,7 @@ static int dial_exec_full(struct ast_channel *chan, const char *data, struct ast * previously acquired connected line info could have been set * through the CONNECTED_LINE dialplan function. */ - ast_party_connected_line_copy(&tmp->connected, &chan->connected); + ast_party_connected_line_copy(&tmp->connected, ast_channel_connected(chan)); ast_channel_unlock(chan); if (datastore) @@ -2255,44 +2255,44 @@ static int dial_exec_full(struct ast_channel *chan, const char *data, struct ast ast_channel_appl_set(tc, "AppDial"); ast_channel_data_set(tc, "(Outgoing Line)"); - memset(&tc->whentohangup, 0, sizeof(tc->whentohangup)); + memset(ast_channel_whentohangup(tc), 0, sizeof(*ast_channel_whentohangup(tc))); /* Determine CallerID to store in outgoing channel. */ - ast_party_caller_set_init(&caller, &tc->caller); + ast_party_caller_set_init(&caller, ast_channel_caller(tc)); if (ast_test_flag64(peerflags, OPT_ORIGINAL_CLID)) { caller.id = stored_clid; ast_channel_set_caller_event(tc, &caller, NULL); ast_set_flag64(tmp, DIAL_CALLERID_ABSENT); - } else if (ast_strlen_zero(S_COR(tc->caller.id.number.valid, - tc->caller.id.number.str, NULL))) { + } else if (ast_strlen_zero(S_COR(ast_channel_caller(tc)->id.number.valid, + ast_channel_caller(tc)->id.number.str, NULL))) { /* * The new channel has no preset CallerID number by the channel * driver. Use the dialplan extension and hint name. */ caller.id = stored_clid; if (!caller.id.name.valid - && !ast_strlen_zero(S_COR(chan->connected.id.name.valid, - chan->connected.id.name.str, NULL))) { + && !ast_strlen_zero(S_COR(ast_channel_connected(chan)->id.name.valid, + ast_channel_connected(chan)->id.name.str, NULL))) { /* * No hint name available. We have a connected name supplied by * the dialplan we can use instead. */ caller.id.name.valid = 1; - caller.id.name = chan->connected.id.name; + caller.id.name = ast_channel_connected(chan)->id.name; } ast_channel_set_caller_event(tc, &caller, NULL); ast_set_flag64(tmp, DIAL_CALLERID_ABSENT); - } else if (ast_strlen_zero(S_COR(tc->caller.id.name.valid, tc->caller.id.name.str, + } else if (ast_strlen_zero(S_COR(ast_channel_caller(tc)->id.name.valid, ast_channel_caller(tc)->id.name.str, NULL))) { /* The new channel has no preset CallerID name by the channel driver. */ - if (!ast_strlen_zero(S_COR(chan->connected.id.name.valid, - chan->connected.id.name.str, NULL))) { + if (!ast_strlen_zero(S_COR(ast_channel_connected(chan)->id.name.valid, + ast_channel_connected(chan)->id.name.str, NULL))) { /* * We have a connected name supplied by the dialplan we can * use instead. */ caller.id.name.valid = 1; - caller.id.name = chan->connected.id.name; + caller.id.name = ast_channel_connected(chan)->id.name; ast_channel_set_caller_event(tc, &caller, NULL); } } @@ -2301,16 +2301,16 @@ static int dial_exec_full(struct ast_channel *chan, const char *data, struct ast if (ast_test_flag64(peerflags, OPT_FORCECLID) && !force_forwards_only) { struct ast_party_connected_line connected; - ast_party_connected_line_set_init(&connected, &tc->connected); + ast_party_connected_line_set_init(&connected, ast_channel_connected(tc)); connected.id = forced_clid; ast_channel_set_connected_line(tc, &connected, NULL); } else { - ast_connected_line_copy_from_caller(&tc->connected, &chan->caller); + ast_connected_line_copy_from_caller(ast_channel_connected(tc), ast_channel_caller(chan)); } - ast_party_redirecting_copy(&tc->redirecting, &chan->redirecting); + ast_party_redirecting_copy(ast_channel_redirecting(tc), ast_channel_redirecting(chan)); - tc->dialed.transit_network_select = chan->dialed.transit_network_select; + ast_channel_dialed(tc)->transit_network_select = ast_channel_dialed(chan)->transit_network_select; if (!ast_strlen_zero(ast_channel_accountcode(chan))) { ast_channel_peeraccount_set(tc, ast_channel_accountcode(chan)); @@ -2672,8 +2672,8 @@ static int dial_exec_full(struct ast_channel *chan, const char *data, struct ast if (gosub_argstart) { const char *what_is_s = "s"; *gosub_argstart = 0; - if (!ast_exists_extension(peer, opt_args[OPT_ARG_CALLEE_GOSUB], "s", 1, S_COR(peer->caller.id.number.valid, peer->caller.id.number.str, NULL)) && - ast_exists_extension(peer, opt_args[OPT_ARG_CALLEE_GOSUB], "~~s~~", 1, S_COR(peer->caller.id.number.valid, peer->caller.id.number.str, NULL))) { + if (!ast_exists_extension(peer, opt_args[OPT_ARG_CALLEE_GOSUB], "s", 1, S_COR(ast_channel_caller(peer)->id.number.valid, ast_channel_caller(peer)->id.number.str, NULL)) && + ast_exists_extension(peer, opt_args[OPT_ARG_CALLEE_GOSUB], "~~s~~", 1, S_COR(ast_channel_caller(peer)->id.number.valid, ast_channel_caller(peer)->id.number.str, NULL))) { what_is_s = "~~s~~"; } if (asprintf(&gosub_args, "%s,%s,1(%s)", opt_args[OPT_ARG_CALLEE_GOSUB], what_is_s, gosub_argstart + 1) < 0) { @@ -2683,8 +2683,8 @@ static int dial_exec_full(struct ast_channel *chan, const char *data, struct ast *gosub_argstart = ','; } else { const char *what_is_s = "s"; - if (!ast_exists_extension(peer, opt_args[OPT_ARG_CALLEE_GOSUB], "s", 1, S_COR(peer->caller.id.number.valid, peer->caller.id.number.str, NULL)) && - ast_exists_extension(peer, opt_args[OPT_ARG_CALLEE_GOSUB], "~~s~~", 1, S_COR(peer->caller.id.number.valid, peer->caller.id.number.str, NULL))) { + if (!ast_exists_extension(peer, opt_args[OPT_ARG_CALLEE_GOSUB], "s", 1, S_COR(ast_channel_caller(peer)->id.number.valid, ast_channel_caller(peer)->id.number.str, NULL)) && + ast_exists_extension(peer, opt_args[OPT_ARG_CALLEE_GOSUB], "~~s~~", 1, S_COR(ast_channel_caller(peer)->id.number.valid, ast_channel_caller(peer)->id.number.str, NULL))) { what_is_s = "~~s~~"; } if (asprintf(&gosub_args, "%s,%s,1", opt_args[OPT_ARG_CALLEE_GOSUB], what_is_s) < 0) { @@ -2763,8 +2763,8 @@ static int dial_exec_full(struct ast_channel *chan, const char *data, struct ast if (!res) { if (!ast_tvzero(calldurationlimit)) { - struct timeval whentohangup = calldurationlimit; - peer->whentohangup = ast_tvadd(ast_tvnow(), whentohangup); + struct timeval whentohangup = ast_tvadd(ast_tvnow(), calldurationlimit); + ast_channel_whentohangup_set(peer, &whentohangup); } if (!ast_strlen_zero(dtmfcalled)) { ast_verb(3, "Sending DTMF '%s' to the called party.\n", dtmfcalled); @@ -2839,7 +2839,7 @@ static int dial_exec_full(struct ast_channel *chan, const char *data, struct ast if (ast_test_flag64(&opts, OPT_PEER_H) && ast_exists_extension(peer, ast_channel_context(peer), "h", 1, - S_COR(peer->caller.id.number.valid, peer->caller.id.number.str, NULL))) { + S_COR(ast_channel_caller(peer)->id.number.valid, ast_channel_caller(peer)->id.number.str, NULL))) { int autoloopflag; int found; int res9; @@ -2851,7 +2851,7 @@ static int dial_exec_full(struct ast_channel *chan, const char *data, struct ast while ((res9 = ast_spawn_extension(peer, ast_channel_context(peer), ast_channel_exten(peer), ast_channel_priority(peer), - S_COR(peer->caller.id.number.valid, peer->caller.id.number.str, NULL), + S_COR(ast_channel_caller(peer)->id.number.valid, ast_channel_caller(peer)->id.number.str, NULL), &found, 1)) == 0) { ast_channel_priority_set(peer, ast_channel_priority(peer) + 1); } @@ -2908,7 +2908,7 @@ out: if ((ast_test_flag64(peerflags, OPT_GO_ON)) && !ast_check_hangup(chan) && (res != AST_PBX_INCOMPLETE)) { if (!ast_tvzero(calldurationlimit)) - memset(&chan->whentohangup, 0, sizeof(chan->whentohangup)); + memset(ast_channel_whentohangup(chan), 0, sizeof(*ast_channel_whentohangup(chan))); res = 0; } diff --git a/apps/app_disa.c b/apps/app_disa.c index 5de3acfa5..0432a0b61 100644 --- a/apps/app_disa.c +++ b/apps/app_disa.c @@ -314,9 +314,9 @@ static int disa_exec(struct ast_channel *chan, const char *data) if (j == '#') { /* end of extension .. maybe */ if (i == 0 && (ast_matchmore_extension(chan, args.context, "#", 1, - S_COR(chan->caller.id.number.valid, chan->caller.id.number.str, NULL)) + S_COR(ast_channel_caller(chan)->id.number.valid, ast_channel_caller(chan)->id.number.str, NULL)) || ast_exists_extension(chan, args.context, "#", 1, - S_COR(chan->caller.id.number.valid, chan->caller.id.number.str, NULL))) ) { + S_COR(ast_channel_caller(chan)->id.number.valid, ast_channel_caller(chan)->id.number.str, NULL))) ) { /* Let the # be the part of, or the entire extension */ } else { break; @@ -347,7 +347,7 @@ static int disa_exec(struct ast_channel *chan, const char *data) /* if can do some more, do it */ if (!ast_matchmore_extension(chan, args.context, exten, 1, - S_COR(chan->caller.id.number.valid, chan->caller.id.number.str, NULL))) { + S_COR(ast_channel_caller(chan)->id.number.valid, ast_channel_caller(chan)->id.number.str, NULL))) { break; } } @@ -360,7 +360,7 @@ static int disa_exec(struct ast_channel *chan, const char *data) struct ast_flags cdr_flags = { AST_CDR_FLAG_POSTED }; if (!ast_exists_extension(chan, args.context, exten, 1, - S_COR(chan->caller.id.number.valid, chan->caller.id.number.str, NULL))) { + S_COR(ast_channel_caller(chan)->id.number.valid, ast_channel_caller(chan)->id.number.str, NULL))) { pbx_builtin_setvar_helper(chan, "INVALID_EXTEN", exten); exten[0] = 'i'; exten[1] = '\0'; @@ -368,7 +368,7 @@ static int disa_exec(struct ast_channel *chan, const char *data) } if (!recheck || ast_exists_extension(chan, args.context, exten, 1, - S_COR(chan->caller.id.number.valid, chan->caller.id.number.str, NULL))) { + S_COR(ast_channel_caller(chan)->id.number.valid, ast_channel_caller(chan)->id.number.str, NULL))) { ast_playtones_stop(chan); /* We're authenticated and have a target extension */ if (!ast_strlen_zero(args.cid)) { diff --git a/apps/app_dumpchan.c b/apps/app_dumpchan.c index c16318f68..42f889926 100644 --- a/apps/app_dumpchan.c +++ b/apps/app_dumpchan.c @@ -131,12 +131,12 @@ static int serialize_showchan(struct ast_channel *c, char *buf, size_t size) ast_channel_tech(c)->type, ast_channel_uniqueid(c), ast_channel_linkedid(c), - S_COR(c->caller.id.number.valid, c->caller.id.number.str, "(N/A)"), - S_COR(c->caller.id.name.valid, c->caller.id.name.str, "(N/A)"), - S_COR(c->connected.id.number.valid, c->connected.id.number.str, "(N/A)"), - S_COR(c->connected.id.name.valid, c->connected.id.name.str, "(N/A)"), - S_OR(c->dialed.number.str, "(N/A)"), - S_COR(c->redirecting.from.number.valid, c->redirecting.from.number.str, "(N/A)"), + S_COR(ast_channel_caller(c)->id.number.valid, ast_channel_caller(c)->id.number.str, "(N/A)"), + S_COR(ast_channel_caller(c)->id.name.valid, ast_channel_caller(c)->id.name.str, "(N/A)"), + S_COR(ast_channel_connected(c)->id.number.valid, ast_channel_connected(c)->id.number.str, "(N/A)"), + S_COR(ast_channel_connected(c)->id.name.valid, ast_channel_connected(c)->id.name.str, "(N/A)"), + S_OR(ast_channel_dialed(c)->number.str, "(N/A)"), + S_COR(ast_channel_redirecting(c)->from.number.valid, ast_channel_redirecting(c)->from.number.str, "(N/A)"), ast_channel_parkinglot(c), ast_channel_language(c), ast_state2str(ast_channel_state(c)), @@ -154,7 +154,7 @@ static int serialize_showchan(struct ast_channel *c, char *buf, size_t size) c->fds[0], ast_channel_fin(c) & ~DEBUGCHAN_FLAG, (ast_channel_fin(c) & DEBUGCHAN_FLAG) ? " (DEBUGGED)" : "", ast_channel_fout(c) & ~DEBUGCHAN_FLAG, (ast_channel_fout(c) & DEBUGCHAN_FLAG) ? " (DEBUGGED)" : "", - (long)c->whentohangup.tv_sec, + (long)ast_channel_whentohangup(c)->tv_sec, hour, min, sec, diff --git a/apps/app_fax.c b/apps/app_fax.c index 4d7382b5e..9d63a3c23 100644 --- a/apps/app_fax.c +++ b/apps/app_fax.c @@ -267,10 +267,10 @@ static void phase_e_handler(t30_state_t *f, void *user_data, int result) "FileName: %s\r\n", ast_channel_name(s->chan), ast_channel_exten(s->chan), - S_COR(s->chan->caller.id.number.valid, s->chan->caller.id.number.str, ""), - S_COR(s->chan->caller.id.name.valid, s->chan->caller.id.name.str, ""), - S_COR(s->chan->connected.id.number.valid, s->chan->connected.id.number.str, ""), - S_COR(s->chan->connected.id.name.valid, s->chan->connected.id.name.str, ""), + S_COR(ast_channel_caller(s->chan)->id.number.valid, ast_channel_caller(s->chan)->id.number.str, ""), + S_COR(ast_channel_caller(s->chan)->id.name.valid, ast_channel_caller(s->chan)->id.name.str, ""), + S_COR(ast_channel_connected(s->chan)->id.number.valid, ast_channel_connected(s->chan)->id.number.str, ""), + S_COR(ast_channel_connected(s->chan)->id.name.valid, ast_channel_connected(s->chan)->id.name.str, ""), far_ident, local_ident, pages_transferred, diff --git a/apps/app_followme.c b/apps/app_followme.c index dc824f573..c4d1a2d67 100644 --- a/apps/app_followme.c +++ b/apps/app_followme.c @@ -937,7 +937,7 @@ static void findmeexec(struct fm_args *tpargs) } /* We check if the extension exists, before creating the ast_channel struct */ - if (!ast_exists_extension(caller, tpargs->context, number, 1, S_COR(caller->caller.id.number.valid, caller->caller.id.number.str, NULL))) { + if (!ast_exists_extension(caller, tpargs->context, number, 1, S_COR(ast_channel_caller(caller)->id.number.valid, ast_channel_caller(caller)->id.number.str, NULL))) { ast_log(LOG_ERROR, "Extension '%s@%s' doesn't exist\n", number, tpargs->context); continue; } @@ -956,7 +956,7 @@ static void findmeexec(struct fm_args *tpargs) 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); + ast_connected_line_copy_from_caller(ast_channel_connected(outbound), ast_channel_caller(caller)); ast_channel_inherit_variables(caller, outbound); ast_channel_datastore_inherit(caller, outbound); ast_channel_language_set(outbound, ast_channel_language(caller)); @@ -1266,7 +1266,7 @@ static int app_exec(struct ast_channel *chan, const char *data) targs.chan = chan; ast_copy_string(targs.namerecloc, namerecloc, sizeof(targs.namerecloc)); ast_channel_lock(chan); - ast_connected_line_copy_from_caller(&targs.connected_in, &chan->caller); + ast_connected_line_copy_from_caller(&targs.connected_in, ast_channel_caller(chan)); ast_channel_unlock(chan); findmeexec(&targs); diff --git a/apps/app_macro.c b/apps/app_macro.c index c324a36c3..cebfae7af 100644 --- a/apps/app_macro.c +++ b/apps/app_macro.c @@ -304,7 +304,7 @@ static int _macro_exec(struct ast_channel *chan, const char *data, int exclusive snprintf(fullmacro, sizeof(fullmacro), "macro-%s", macro); if (!ast_exists_extension(chan, fullmacro, "s", 1, - S_COR(chan->caller.id.number.valid, chan->caller.id.number.str, NULL))) { + S_COR(ast_channel_caller(chan)->id.number.valid, ast_channel_caller(chan)->id.number.str, NULL))) { if (!ast_context_find(fullmacro)) ast_log(LOG_WARNING, "No such context '%s' for macro '%s'. Was called by %s@%s\n", fullmacro, macro, ast_channel_exten(chan), ast_channel_context(chan)); else @@ -376,7 +376,7 @@ static int _macro_exec(struct ast_channel *chan, const char *data, int exclusive 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), ast_channel_priority(chan), - S_COR(chan->caller.id.number.valid, chan->caller.id.number.str, NULL))) { + S_COR(ast_channel_caller(chan)->id.number.valid, ast_channel_caller(chan)->id.number.str, NULL))) { struct ast_context *c; struct ast_exten *e; int foundx; @@ -393,7 +393,7 @@ static int _macro_exec(struct ast_channel *chan, const char *data, int exclusive ast_log(LOG_WARNING, "Unable to lock context?\n"); } else { 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)); + S_COR(ast_channel_caller(chan)->id.number.valid, ast_channel_caller(chan)->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)); ast_copy_string(runningdata, ast_get_extension_app_data(e), sizeof(runningdata)); @@ -410,7 +410,7 @@ static int _macro_exec(struct ast_channel *chan, const char *data, int exclusive pbx_builtin_setvar_helper(chan, "MACRO_DEPTH", depthc); 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), + S_COR(ast_channel_caller(chan)->id.number.valid, ast_channel_caller(chan)->id.number.str, NULL), &foundx, 1); if (res) { /* Something bad happened, or a hangup has been requested. */ @@ -555,7 +555,7 @@ static int _macro_exec(struct ast_channel *chan, const char *data, int exclusive if (sscanf(offsets, "%30d", &offset) == 1) { if (ast_exists_extension(chan, ast_channel_context(chan), ast_channel_exten(chan), ast_channel_priority(chan) + offset + 1, - S_COR(chan->caller.id.number.valid, chan->caller.id.number.str, NULL))) { + S_COR(ast_channel_caller(chan)->id.number.valid, ast_channel_caller(chan)->id.number.str, NULL))) { ast_channel_priority_set(chan, ast_channel_priority(chan) + offset); } } diff --git a/apps/app_meetme.c b/apps/app_meetme.c index 5b3fa25bd..1eb10a593 100644 --- a/apps/app_meetme.c +++ b/apps/app_meetme.c @@ -1509,8 +1509,8 @@ static char *meetme_show_cmd(struct ast_cli_entry *e, int cmd, struct ast_cli_ar if (!concise) { ast_cli(a->fd, "User #: %-2.2d %12.12s %-20.20s Channel: %s %s %s %s %s %s %02d:%02d:%02d\n", user->user_no, - S_COR(user->chan->caller.id.number.valid, user->chan->caller.id.number.str, ""), - S_COR(user->chan->caller.id.name.valid, user->chan->caller.id.name.str, ""), + S_COR(ast_channel_caller(user->chan)->id.number.valid, ast_channel_caller(user->chan)->id.number.str, ""), + S_COR(ast_channel_caller(user->chan)->id.name.valid, ast_channel_caller(user->chan)->id.name.str, ""), ast_channel_name(user->chan), ast_test_flag64(&user->userflags, CONFFLAG_ADMIN) ? "(Admin)" : "", ast_test_flag64(&user->userflags, CONFFLAG_MONITOR) ? "(Listen only)" : "", @@ -1520,8 +1520,8 @@ static char *meetme_show_cmd(struct ast_cli_entry *e, int cmd, struct ast_cli_ar } else { ast_cli(a->fd, "%d!%s!%s!%s!%s!%s!%s!%s!%d!%02d:%02d:%02d\n", user->user_no, - S_COR(user->chan->caller.id.number.valid, user->chan->caller.id.number.str, ""), - S_COR(user->chan->caller.id.name.valid, user->chan->caller.id.name.str, ""), + S_COR(ast_channel_caller(user->chan)->id.number.valid, ast_channel_caller(user->chan)->id.number.str, ""), + S_COR(ast_channel_caller(user->chan)->id.name.valid, ast_channel_caller(user->chan)->id.name.str, ""), ast_channel_name(user->chan), ast_test_flag64(&user->userflags, CONFFLAG_ADMIN) ? "1" : "", ast_test_flag64(&user->userflags, CONFFLAG_MONITOR) ? "1" : "", @@ -2788,10 +2788,10 @@ static int conf_run(struct ast_channel *chan, struct ast_conference *conf, struc "ConnectedLineName: %s\r\n", ast_channel_name(chan), ast_channel_uniqueid(chan), conf->confno, user->user_no, - S_COR(user->chan->caller.id.number.valid, user->chan->caller.id.number.str, ""), - S_COR(user->chan->caller.id.name.valid, user->chan->caller.id.name.str, ""), - S_COR(user->chan->connected.id.number.valid, user->chan->connected.id.number.str, ""), - S_COR(user->chan->connected.id.name.valid, user->chan->connected.id.name.str, "") + S_COR(ast_channel_caller(user->chan)->id.number.valid, ast_channel_caller(user->chan)->id.number.str, ""), + S_COR(ast_channel_caller(user->chan)->id.name.valid, ast_channel_caller(user->chan)->id.name.str, ""), + S_COR(ast_channel_connected(user->chan)->id.number.valid, ast_channel_connected(user->chan)->id.number.str, ""), + S_COR(ast_channel_connected(user->chan)->id.name.valid, ast_channel_connected(user->chan)->id.name.str, "") ); sent_event = 1; } @@ -3862,10 +3862,10 @@ bailoutandtrynormal: "Duration: %ld\r\n", ast_channel_name(chan), ast_channel_uniqueid(chan), conf->confno, user->user_no, - S_COR(user->chan->caller.id.number.valid, user->chan->caller.id.number.str, ""), - S_COR(user->chan->caller.id.name.valid, user->chan->caller.id.name.str, ""), - S_COR(user->chan->connected.id.number.valid, user->chan->connected.id.number.str, ""), - S_COR(user->chan->connected.id.name.valid, user->chan->connected.id.name.str, ""), + S_COR(ast_channel_caller(user->chan)->id.number.valid, ast_channel_caller(user->chan)->id.number.str, ""), + S_COR(ast_channel_caller(user->chan)->id.name.valid, ast_channel_caller(user->chan)->id.name.str, ""), + S_COR(ast_channel_connected(user->chan)->id.number.valid, ast_channel_connected(user->chan)->id.number.str, ""), + S_COR(ast_channel_connected(user->chan)->id.name.valid, ast_channel_connected(user->chan)->id.name.str, ""), (long)(now.tv_sec - user->jointime)); } @@ -4960,10 +4960,10 @@ static int action_meetmelist(struct mansession *s, const struct message *m) idText, cnf->confno, user->user_no, - S_COR(user->chan->caller.id.number.valid, user->chan->caller.id.number.str, ""), - S_COR(user->chan->caller.id.name.valid, user->chan->caller.id.name.str, ""), - S_COR(user->chan->connected.id.number.valid, user->chan->connected.id.number.str, ""), - S_COR(user->chan->connected.id.name.valid, user->chan->connected.id.name.str, ""), + S_COR(ast_channel_caller(user->chan)->id.number.valid, ast_channel_caller(user->chan)->id.number.str, ""), + S_COR(ast_channel_caller(user->chan)->id.name.valid, ast_channel_caller(user->chan)->id.name.str, ""), + S_COR(ast_channel_connected(user->chan)->id.number.valid, ast_channel_connected(user->chan)->id.number.str, ""), + S_COR(ast_channel_connected(user->chan)->id.name.valid, ast_channel_connected(user->chan)->id.name.str, ""), ast_channel_name(user->chan), ast_test_flag64(&user->userflags, CONFFLAG_ADMIN) ? "Yes" : "No", ast_test_flag64(&user->userflags, CONFFLAG_MONITOR) ? "Listen only" : ast_test_flag64(&user->userflags, CONFFLAG_TALKER) ? "Talk only" : "Talk and listen", @@ -5662,16 +5662,16 @@ static int sla_ring_station(struct sla_ringing_trunk *ringing_trunk, struct sla_ caller_is_saved = 0; if (!sla.attempt_callerid) { caller_is_saved = 1; - caller = ringing_trunk->trunk->chan->caller; - ast_party_caller_init(&ringing_trunk->trunk->chan->caller); + caller = *ast_channel_caller(ringing_trunk->trunk->chan); + ast_party_caller_init(ast_channel_caller(ringing_trunk->trunk->chan)); } res = ast_dial_run(dial, ringing_trunk->trunk->chan, 1); /* Restore saved caller ID */ if (caller_is_saved) { - ast_party_caller_free(&ringing_trunk->trunk->chan->caller); - ringing_trunk->trunk->chan->caller = caller; + ast_party_caller_free(ast_channel_caller(ringing_trunk->trunk->chan)); + ast_channel_caller_set(ringing_trunk->trunk->chan, &caller); } if (res != AST_DIAL_RESULT_TRYING) { @@ -6201,16 +6201,16 @@ static void *dial_trunk(void *data) caller_is_saved = 0; if (!sla.attempt_callerid) { caller_is_saved = 1; - caller = trunk_ref->chan->caller; - ast_party_caller_init(&trunk_ref->chan->caller); + caller = *ast_channel_caller(trunk_ref->chan); + ast_party_caller_init(ast_channel_caller(trunk_ref->chan)); } dial_res = ast_dial_run(dial, trunk_ref->chan, 1); /* Restore saved caller ID */ if (caller_is_saved) { - ast_party_caller_free(&trunk_ref->chan->caller); - trunk_ref->chan->caller = caller; + ast_party_caller_free(ast_channel_caller(trunk_ref->chan)); + ast_channel_caller_set(trunk_ref->chan, &caller); } if (dial_res != AST_DIAL_RESULT_TRYING) { diff --git a/apps/app_minivm.c b/apps/app_minivm.c index bf408f81f..cd613b67d 100644 --- a/apps/app_minivm.c +++ b/apps/app_minivm.c @@ -1746,10 +1746,10 @@ static void run_externnotify(struct ast_channel *chan, struct minivm_account *vm snprintf(arguments, sizeof(arguments), "%s %s@%s %s %s&", ast_strlen_zero(vmu->externnotify) ? global_externnotify : vmu->externnotify, vmu->username, vmu->domain, - (chan->caller.id.name.valid && chan->caller.id.name.str) - ? chan->caller.id.name.str : "", - (chan->caller.id.number.valid && chan->caller.id.number.str) - ? chan->caller.id.number.str : ""); + (ast_channel_caller(chan)->id.name.valid && ast_channel_caller(chan)->id.name.str) + ? ast_channel_caller(chan)->id.name.str : "", + (ast_channel_caller(chan)->id.number.valid && ast_channel_caller(chan)->id.number.str) + ? ast_channel_caller(chan)->id.number.str : ""); ast_debug(1, "Executing: %s\n", arguments); ast_safe_system(arguments); @@ -1935,8 +1935,8 @@ static int leave_voicemail(struct ast_channel *chan, char *username, struct leav ast_strftime(timebuf, sizeof(timebuf), "%H:%M:%S", &tm); ast_callerid_merge(callerid, sizeof(callerid), - S_COR(chan->caller.id.name.valid, chan->caller.id.name.str, NULL), - S_COR(chan->caller.id.number.valid, chan->caller.id.number.str, NULL), + S_COR(ast_channel_caller(chan)->id.name.valid, ast_channel_caller(chan)->id.name.str, NULL), + S_COR(ast_channel_caller(chan)->id.number.valid, ast_channel_caller(chan)->id.number.str, NULL), "Unknown"); snprintf(logbuf, sizeof(logbuf), /* "Mailbox:domain:macrocontext:exten:priority:callerchan:callerid:origdate:origtime:duration:durationstatus:accountcode" */ @@ -2141,8 +2141,8 @@ static int minivm_notify_exec(struct ast_channel *chan, const char *data) ast_channel_unlock(chan); res = notify_new_message(chan, template, vmu, filename, atoi(duration_string), format, - S_COR(chan->caller.id.number.valid, chan->caller.id.number.str, NULL), - S_COR(chan->caller.id.name.valid, chan->caller.id.name.str, NULL)); + S_COR(ast_channel_caller(chan)->id.number.valid, ast_channel_caller(chan)->id.number.str, NULL), + S_COR(ast_channel_caller(chan)->id.name.valid, ast_channel_caller(chan)->id.name.str, NULL)); } pbx_builtin_setvar_helper(chan, "MVM_NOTIFY_STATUS", res == 0 ? "SUCCESS" : "FAILED"); @@ -2304,18 +2304,18 @@ static int minivm_greet_exec(struct ast_channel *chan, const char *data) if (ast_test_flag(vmu, MVM_OPERATOR)) { if (!ast_strlen_zero(vmu->exit)) { if (ast_exists_extension(chan, vmu->exit, "o", 1, - S_COR(chan->caller.id.number.valid, chan->caller.id.number.str, NULL))) { + S_COR(ast_channel_caller(chan)->id.number.valid, ast_channel_caller(chan)->id.number.str, NULL))) { strncat(ecodes, "0", sizeof(ecodes) - strlen(ecodes) - 1); ouseexten = 1; } } else if (ast_exists_extension(chan, ast_channel_context(chan), "o", 1, - S_COR(chan->caller.id.number.valid, chan->caller.id.number.str, NULL))) { + S_COR(ast_channel_caller(chan)->id.number.valid, ast_channel_caller(chan)->id.number.str, NULL))) { strncat(ecodes, "0", sizeof(ecodes) - strlen(ecodes) - 1); ouseexten = 1; } else if (!ast_strlen_zero(ast_channel_macrocontext(chan)) && ast_exists_extension(chan, ast_channel_macrocontext(chan), "o", 1, - S_COR(chan->caller.id.number.valid, chan->caller.id.number.str, NULL))) { + S_COR(ast_channel_caller(chan)->id.number.valid, ast_channel_caller(chan)->id.number.str, NULL))) { strncat(ecodes, "0", sizeof(ecodes) - strlen(ecodes) - 1); ousemacro = 1; } @@ -2323,15 +2323,15 @@ static int minivm_greet_exec(struct ast_channel *chan, const char *data) if (!ast_strlen_zero(vmu->exit)) { if (ast_exists_extension(chan, vmu->exit, "a", 1, - S_COR(chan->caller.id.number.valid, chan->caller.id.number.str, NULL))) { + S_COR(ast_channel_caller(chan)->id.number.valid, ast_channel_caller(chan)->id.number.str, NULL))) { strncat(ecodes, "*", sizeof(ecodes) - strlen(ecodes) - 1); } } else if (ast_exists_extension(chan, ast_channel_context(chan), "a", 1, - S_COR(chan->caller.id.number.valid, chan->caller.id.number.str, NULL))) { + S_COR(ast_channel_caller(chan)->id.number.valid, ast_channel_caller(chan)->id.number.str, NULL))) { strncat(ecodes, "*", sizeof(ecodes) - strlen(ecodes) - 1); } else if (!ast_strlen_zero(ast_channel_macrocontext(chan)) && ast_exists_extension(chan, ast_channel_macrocontext(chan), "a", 1, - S_COR(chan->caller.id.number.valid, chan->caller.id.number.str, NULL))) { + S_COR(ast_channel_caller(chan)->id.number.valid, ast_channel_caller(chan)->id.number.str, NULL))) { strncat(ecodes, "*", sizeof(ecodes) - strlen(ecodes) - 1); ausemacro = 1; } diff --git a/apps/app_mixmonitor.c b/apps/app_mixmonitor.c index 4515805bc..88c8f88df 100644 --- a/apps/app_mixmonitor.c +++ b/apps/app_mixmonitor.c @@ -884,7 +884,7 @@ static char *handle_cli_mixmonitor(struct ast_cli_entry *e, int cmd, struct ast_ } else if (!strcasecmp(a->argv[1], "list")) { ast_cli(a->fd, "MixMonitor ID\tFile\tReceive File\tTransmit File\n"); ast_cli(a->fd, "=========================================================================\n"); - AST_LIST_TRAVERSE(&chan->datastores, datastore, entry) { + AST_LIST_TRAVERSE(ast_channel_datastores(chan), datastore, entry) { if (datastore->info == &mixmonitor_ds_info) { char *filename = ""; char *filename_read = ""; diff --git a/apps/app_osplookup.c b/apps/app_osplookup.c index 23f8838bc..ba7bb03cb 100644 --- a/apps/app_osplookup.c +++ b/apps/app_osplookup.c @@ -2282,7 +2282,7 @@ static int ospauth_exec( } ast_debug(1, "OSPAuth: provider '%s'\n", provider); - headp = &chan->varshead; + headp = ast_channel_varshead(chan); AST_LIST_TRAVERSE(headp, current, entries) { if (!strcasecmp(ast_var_name(current), "OSPINPEERIP")) { source = ast_var_value(current); @@ -2295,7 +2295,7 @@ static int ospauth_exec( ast_debug(1, "OSPAuth: token size '%zd'\n", strlen(token)); res = osp_auth(provider, &handle, source, - S_COR(chan->caller.id.number.valid, chan->caller.id.number.str, NULL), + S_COR(ast_channel_caller(chan)->id.number.valid, ast_channel_caller(chan)->id.number.str, NULL), ast_channel_exten(chan), token, &timelimit); if (res > 0) { status = AST_OSP_SUCCESS; @@ -2409,7 +2409,7 @@ static int osplookup_exec( headers.divhost = ""; headers.pciuser = ""; - headp = &chan->varshead; + headp = ast_channel_varshead(chan); AST_LIST_TRAVERSE(headp, current, entries) { if (!strcasecmp(ast_var_name(current), "OSPINACTUALSRC")) { actualsrc = ast_var_value(current); @@ -2509,7 +2509,7 @@ static int osplookup_exec( } res = osp_lookup(provider, callidtypes, actualsrc, srcdev, - S_COR(chan->caller.id.number.valid, chan->caller.id.number.str, NULL), + S_COR(ast_channel_caller(chan)->id.number.valid, ast_channel_caller(chan)->id.number.str, NULL), args.exten, snetid, &np, &headers, cinfo, &results); if (res > 0) { status = AST_OSP_SUCCESS; @@ -2676,7 +2676,7 @@ static int ospnext_exec( results.intimelimit = OSP_DEF_TIMELIMIT; results.numdests = 0; - headp = &chan->varshead; + headp = ast_channel_varshead(chan); AST_LIST_TRAVERSE(headp, current, entries) { if (!strcasecmp(ast_var_name(current), "OSPINHANDLE")) { if (sscanf(ast_var_value(current), "%30d", &results.inhandle) != 1) { @@ -2843,7 +2843,7 @@ static int ospfinished_exec( AST_STANDARD_APP_ARGS(args, tmp); - headp = &chan->varshead; + headp = ast_channel_varshead(chan); AST_LIST_TRAVERSE(headp, current, entries) { if (!strcasecmp(ast_var_name(current), "OSPINHANDLE")) { if (sscanf(ast_var_value(current), "%30d", &inhandle) != 1) { diff --git a/apps/app_parkandannounce.c b/apps/app_parkandannounce.c index 508c31a5b..dce000970 100644 --- a/apps/app_parkandannounce.c +++ b/apps/app_parkandannounce.c @@ -143,16 +143,16 @@ 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), ast_channel_priority(chan), - S_COR(chan->caller.id.number.valid, chan->caller.id.number.str, "")); + S_COR(ast_channel_caller(chan)->id.number.valid, ast_channel_caller(chan)->id.number.str, "")); 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))) { + S_COR(ast_channel_caller(chan)->id.number.valid, ast_channel_caller(chan)->id.number.str, NULL))) { ast_verb(3, "Warning: Return Context Invalid, call will return to default|s\n"); } /* Save the CallerID because the masquerade turns chan into a ZOMBIE. */ ast_party_id_init(&caller_id); ast_channel_lock(chan); - ast_party_id_copy(&caller_id, &chan->caller.id); + ast_party_id_copy(&caller_id, &ast_channel_caller(chan)->id); ast_channel_unlock(chan); /* we are using masq_park here to protect * from touching the channel once we park it. If the channel comes out of timeout diff --git a/apps/app_privacy.c b/apps/app_privacy.c index d287c56fd..0e04df60b 100644 --- a/apps/app_privacy.c +++ b/apps/app_privacy.c @@ -103,8 +103,8 @@ static int privacy_exec(struct ast_channel *chan, const char *data) AST_APP_ARG(checkcontext); ); - if (chan->caller.id.number.valid - && !ast_strlen_zero(chan->caller.id.number.str)) { + if (ast_channel_caller(chan)->id.number.valid + && !ast_strlen_zero(ast_channel_caller(chan)->id.number.str)) { ast_verb(3, "CallerID number present: Skipping\n"); } else { /*Answer the channel if it is not already*/ @@ -195,9 +195,9 @@ static int privacy_exec(struct ast_channel *chan, const char *data) * be passed out to other channels. This is the point of the * privacy application. */ - chan->caller.id.name.presentation = AST_PRES_ALLOWED_USER_NUMBER_NOT_SCREENED; - chan->caller.id.number.presentation = AST_PRES_ALLOWED_USER_NUMBER_NOT_SCREENED; - chan->caller.id.number.plan = 0;/* Unknown */ + ast_channel_caller(chan)->id.name.presentation = AST_PRES_ALLOWED_USER_NUMBER_NOT_SCREENED; + ast_channel_caller(chan)->id.number.presentation = AST_PRES_ALLOWED_USER_NUMBER_NOT_SCREENED; + ast_channel_caller(chan)->id.number.plan = 0;/* Unknown */ ast_set_callerid(chan, phone, "Privacy Manager", NULL); diff --git a/apps/app_queue.c b/apps/app_queue.c index f042c06de..ea2dd54e1 100644 --- a/apps/app_queue.c +++ b/apps/app_queue.c @@ -2610,10 +2610,10 @@ static int join_queue(char *queuename, struct queue_ent *qe, enum queue_result * "Count: %d\r\n" "Uniqueid: %s\r\n", ast_channel_name(qe->chan), - S_COR(qe->chan->caller.id.number.valid, qe->chan->caller.id.number.str, "unknown"),/* XXX somewhere else it is */ - 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"),/* XXX somewhere else it is */ - S_COR(qe->chan->connected.id.name.valid, qe->chan->connected.id.name.str, "unknown"), + S_COR(ast_channel_caller(qe->chan)->id.number.valid, ast_channel_caller(qe->chan)->id.number.str, "unknown"),/* XXX somewhere else it is */ + S_COR(ast_channel_caller(qe->chan)->id.name.valid, ast_channel_caller(qe->chan)->id.name.str, "unknown"), + S_COR(ast_channel_connected(qe->chan)->id.number.valid, ast_channel_connected(qe->chan)->id.number.str, "unknown"),/* XXX somewhere else it is */ + S_COR(ast_channel_connected(qe->chan)->id.name.valid, ast_channel_connected(qe->chan)->id.name.str, "unknown"), q->name, qe->pos, q->count, ast_channel_uniqueid(qe->chan)); ast_debug(1, "Queue '%s' Join, Channel '%s', Position '%d'\n", q->name, ast_channel_name(qe->chan), qe->pos ); } @@ -2670,7 +2670,7 @@ static int valid_exit(struct queue_ent *qe, char digit) /* If the extension is bad, then reset the digits to blank */ if (!ast_canmatch_extension(qe->chan, qe->context, qe->digits, 1, - S_COR(qe->chan->caller.id.number.valid, qe->chan->caller.id.number.str, NULL))) { + S_COR(ast_channel_caller(qe->chan)->id.number.valid, ast_channel_caller(qe->chan)->id.number.str, NULL))) { qe->digits[0] = '\0'; return 0; } @@ -3190,30 +3190,30 @@ static int ring_entry(struct queue_ent *qe, struct callattempt *tmp, int *busies } ast_channel_appl_set(tmp->chan, "AppQueue"); ast_channel_data_set(tmp->chan, "(Outgoing Line)"); - memset(&tmp->chan->whentohangup, 0, sizeof(tmp->chan->whentohangup)); + memset(ast_channel_whentohangup(tmp->chan), 0, sizeof(*ast_channel_whentohangup(tmp->chan))); /* If the new channel has no callerid, try to guess what it should be */ - if (!tmp->chan->caller.id.number.valid) { - if (qe->chan->connected.id.number.valid) { + if (!ast_channel_caller(tmp->chan)->id.number.valid) { + if (ast_channel_connected(qe->chan)->id.number.valid) { struct ast_party_caller caller; - ast_party_caller_set_init(&caller, &tmp->chan->caller); - caller.id = qe->chan->connected.id; - caller.ani = qe->chan->connected.ani; + ast_party_caller_set_init(&caller, ast_channel_caller(tmp->chan)); + caller.id = ast_channel_connected(qe->chan)->id; + caller.ani = ast_channel_connected(qe->chan)->ani; ast_channel_set_caller_event(tmp->chan, &caller, NULL); - } else if (!ast_strlen_zero(qe->chan->dialed.number.str)) { - ast_set_callerid(tmp->chan, qe->chan->dialed.number.str, NULL, NULL); + } else if (!ast_strlen_zero(ast_channel_dialed(qe->chan)->number.str)) { + ast_set_callerid(tmp->chan, ast_channel_dialed(qe->chan)->number.str, NULL, NULL); } else if (!ast_strlen_zero(S_OR(ast_channel_macroexten(qe->chan), ast_channel_exten(qe->chan)))) { ast_set_callerid(tmp->chan, S_OR(ast_channel_macroexten(qe->chan), ast_channel_exten(qe->chan)), NULL, NULL); } tmp->dial_callerid_absent = 1; } - ast_party_redirecting_copy(&tmp->chan->redirecting, &qe->chan->redirecting); + ast_party_redirecting_copy(ast_channel_redirecting(tmp->chan), ast_channel_redirecting(qe->chan)); - tmp->chan->dialed.transit_network_select = qe->chan->dialed.transit_network_select; + ast_channel_dialed(tmp->chan)->transit_network_select = ast_channel_dialed(qe->chan)->transit_network_select; - ast_connected_line_copy_from_caller(&tmp->chan->connected, &qe->chan->caller); + ast_connected_line_copy_from_caller(ast_channel_connected(tmp->chan), ast_channel_caller(qe->chan)); /* Inherit specially named variables from parent channel */ ast_channel_inherit_variables(qe->chan, tmp->chan); @@ -3279,10 +3279,10 @@ static int ring_entry(struct queue_ent *qe, struct callattempt *tmp, int *busies "Uniqueid: %s\r\n" "%s", qe->parent->name, tmp->interface, tmp->member->membername, ast_channel_name(qe->chan), ast_channel_name(tmp->chan), - S_COR(qe->chan->caller.id.number.valid, qe->chan->caller.id.number.str, "unknown"), - 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"), + S_COR(ast_channel_caller(qe->chan)->id.number.valid, ast_channel_caller(qe->chan)->id.number.str, "unknown"), + S_COR(ast_channel_caller(qe->chan)->id.name.valid, ast_channel_caller(qe->chan)->id.name.str, "unknown"), + S_COR(ast_channel_connected(qe->chan)->id.number.valid, ast_channel_connected(qe->chan)->id.number.str, "unknown"), + S_COR(ast_channel_connected(qe->chan)->id.name.valid, ast_channel_connected(qe->chan)->id.name.str, "unknown"), 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)) : ""); @@ -3666,7 +3666,7 @@ static struct callattempt *wait_for_answer(struct queue_ent *qe, struct callatte } } else if (!o->dial_callerid_absent) { ast_channel_lock(o->chan); - ast_connected_line_copy_from_caller(&connected_caller, &o->chan->caller); + ast_connected_line_copy_from_caller(&connected_caller, ast_channel_caller(o->chan)); ast_channel_unlock(o->chan); connected_caller.source = AST_CONNECTED_LINE_UPDATE_SOURCE_ANSWER; ast_channel_update_connected_line(in, &connected_caller, NULL); @@ -3731,24 +3731,24 @@ static struct callattempt *wait_for_answer(struct queue_ent *qe, struct callatte ast_channel_accountcode_set(o->chan, ast_channel_accountcode(in)); - ast_channel_set_redirecting(o->chan, &original->redirecting, NULL); - if (!o->chan->redirecting.from.number.valid - || ast_strlen_zero(o->chan->redirecting.from.number.str)) { + ast_channel_set_redirecting(o->chan, ast_channel_redirecting(original), NULL); + if (!ast_channel_redirecting(o->chan)->from.number.valid + || ast_strlen_zero(ast_channel_redirecting(o->chan)->from.number.str)) { /* * The call was not previously redirected so it is * now redirected from this number. */ - ast_party_number_free(&o->chan->redirecting.from.number); - ast_party_number_init(&o->chan->redirecting.from.number); - o->chan->redirecting.from.number.valid = 1; - o->chan->redirecting.from.number.str = + ast_party_number_free(&ast_channel_redirecting(o->chan)->from.number); + ast_party_number_init(&ast_channel_redirecting(o->chan)->from.number); + ast_channel_redirecting(o->chan)->from.number.valid = 1; + ast_channel_redirecting(o->chan)->from.number.str = ast_strdup(S_OR(ast_channel_macroexten(in), ast_channel_exten(in))); } - o->chan->dialed.transit_network_select = in->dialed.transit_network_select; + ast_channel_dialed(o->chan)->transit_network_select = ast_channel_dialed(in)->transit_network_select; - ast_party_caller_copy(&o->chan->caller, &in->caller); - ast_party_connected_line_copy(&o->chan->connected, &original->connected); + ast_party_caller_copy(ast_channel_caller(o->chan), ast_channel_caller(in)); + ast_party_connected_line_copy(ast_channel_connected(o->chan), ast_channel_connected(original)); /* * We must unlock o->chan before calling @@ -3758,7 +3758,7 @@ static struct callattempt *wait_for_answer(struct queue_ent *qe, struct callatte * seem a bit unusual here. */ ast_party_redirecting_init(&redirecting); - ast_party_redirecting_copy(&redirecting, &o->chan->redirecting); + ast_party_redirecting_copy(&redirecting, ast_channel_redirecting(o->chan)); ast_channel_unlock(o->chan); if ((res = ast_channel_redirecting_sub(o->chan, in, &redirecting, 0)) && (res = ast_channel_redirecting_macro(o->chan, in, &redirecting, 1, 0))) { @@ -3796,7 +3796,7 @@ static struct callattempt *wait_for_answer(struct queue_ent *qe, struct callatte } } else if (!o->dial_callerid_absent) { ast_channel_lock(o->chan); - ast_connected_line_copy_from_caller(&connected_caller, &o->chan->caller); + ast_connected_line_copy_from_caller(&connected_caller, ast_channel_caller(o->chan)); ast_channel_unlock(o->chan); connected_caller.source = AST_CONNECTED_LINE_UPDATE_SOURCE_ANSWER; ast_channel_update_connected_line(in, &connected_caller, NULL); @@ -4576,7 +4576,7 @@ static int try_calling(struct queue_ent *qe, const char *options, char *announce while ((cur = ao2_iterator_next(&memi))) { struct callattempt *tmp = ast_calloc(1, sizeof(*tmp)); struct ast_dialed_interface *di; - AST_LIST_HEAD(, ast_dialed_interface) *dialed_interfaces; + AST_LIST_HEAD(,ast_dialed_interface) *dialed_interfaces; if (!tmp) { ao2_ref(cur, -1); ao2_iterator_destroy(&memi); @@ -4650,7 +4650,7 @@ static int try_calling(struct queue_ent *qe, const char *options, char *announce * previously acquired connected line info could have been set * through the CONNECTED_LINE dialplan function. */ - ast_party_connected_line_copy(&tmp->connected, &qe->chan->connected); + ast_party_connected_line_copy(&tmp->connected, ast_channel_connected(qe->chan)); ast_channel_unlock(qe->chan); tmp->stillgoing = -1; @@ -5064,8 +5064,8 @@ static int try_calling(struct queue_ent *qe, const char *options, char *announce if (gosub_argstart) { const char *what_is_s = "s"; *gosub_argstart = 0; - if (!ast_exists_extension(peer, gosubexec, "s", 1, S_COR(peer->caller.id.number.valid, peer->caller.id.number.str, NULL)) && - ast_exists_extension(peer, gosubexec, "~~s~~", 1, S_COR(peer->caller.id.number.valid, peer->caller.id.number.str, NULL))) { + if (!ast_exists_extension(peer, gosubexec, "s", 1, S_COR(ast_channel_caller(peer)->id.number.valid, ast_channel_caller(peer)->id.number.str, NULL)) && + ast_exists_extension(peer, gosubexec, "~~s~~", 1, S_COR(ast_channel_caller(peer)->id.number.valid, ast_channel_caller(peer)->id.number.str, NULL))) { what_is_s = "~~s~~"; } if (asprintf(&gosub_args, "%s,%s,1(%s)", gosubexec, what_is_s, gosub_argstart + 1) < 0) { @@ -5075,8 +5075,8 @@ static int try_calling(struct queue_ent *qe, const char *options, char *announce *gosub_argstart = ','; } else { const char *what_is_s = "s"; - if (!ast_exists_extension(peer, gosubexec, "s", 1, S_COR(peer->caller.id.number.valid, peer->caller.id.number.str, NULL)) && - ast_exists_extension(peer, gosubexec, "~~s~~", 1, S_COR(peer->caller.id.number.valid, peer->caller.id.number.str, NULL))) { + if (!ast_exists_extension(peer, gosubexec, "s", 1, S_COR(ast_channel_caller(peer)->id.number.valid, ast_channel_caller(peer)->id.number.str, NULL)) && + ast_exists_extension(peer, gosubexec, "~~s~~", 1, S_COR(ast_channel_caller(peer)->id.number.valid, ast_channel_caller(peer)->id.number.str, NULL))) { what_is_s = "~~s~~"; } if (asprintf(&gosub_args, "%s,%s,1", gosubexec, what_is_s) < 0) { @@ -6135,7 +6135,7 @@ static int queue_exec(struct ast_channel *chan, const char *data) } ast_queue_log(args.queuename, ast_channel_uniqueid(chan), "NONE", "ENTERQUEUE", "%s|%s|%d", S_OR(args.url, ""), - S_COR(chan->caller.id.number.valid, chan->caller.id.number.str, ""), + S_COR(ast_channel_caller(chan)->id.number.valid, ast_channel_caller(chan)->id.number.str, ""), qe.opos); copy_rules(&qe, args.rule); qe.pr = AST_LIST_FIRST(&qe.qe_rules); @@ -7615,10 +7615,10 @@ static int manager_queues_status(struct mansession *s, const struct message *m) "%s" "\r\n", q->name, pos++, ast_channel_name(qe->chan), ast_channel_uniqueid(qe->chan), - S_COR(qe->chan->caller.id.number.valid, qe->chan->caller.id.number.str, "unknown"), - 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"), + S_COR(ast_channel_caller(qe->chan)->id.number.valid, ast_channel_caller(qe->chan)->id.number.str, "unknown"), + S_COR(ast_channel_caller(qe->chan)->id.name.valid, ast_channel_caller(qe->chan)->id.name.str, "unknown"), + S_COR(ast_channel_connected(qe->chan)->id.number.valid, ast_channel_connected(qe->chan)->id.number.str, "unknown"), + S_COR(ast_channel_connected(qe->chan)->id.name.valid, ast_channel_connected(qe->chan)->id.name.str, "unknown"), (long) (now - qe->start), idText); } } diff --git a/apps/app_readexten.c b/apps/app_readexten.c index a894ba48c..deaf83f53 100644 --- a/apps/app_readexten.c +++ b/apps/app_readexten.c @@ -230,9 +230,9 @@ static int readexten_exec(struct ast_channel *chan, const char *data) exten[x] = res; if (!ast_matchmore_extension(chan, arglist.context, exten, 1 /* priority */, - S_COR(chan->caller.id.number.valid, chan->caller.id.number.str, NULL))) { + S_COR(ast_channel_caller(chan)->id.number.valid, ast_channel_caller(chan)->id.number.str, NULL))) { if (!ast_exists_extension(chan, arglist.context, exten, 1, - S_COR(chan->caller.id.number.valid, chan->caller.id.number.str, NULL)) + S_COR(ast_channel_caller(chan)->id.number.valid, ast_channel_caller(chan)->id.number.str, NULL)) && res == '#') { exten[x] = '\0'; } @@ -244,7 +244,7 @@ static int readexten_exec(struct ast_channel *chan, const char *data) break; if (ast_exists_extension(chan, arglist.context, exten, 1, - S_COR(chan->caller.id.number.valid, chan->caller.id.number.str, NULL))) { + S_COR(ast_channel_caller(chan)->id.number.valid, ast_channel_caller(chan)->id.number.str, NULL))) { ast_debug(3, "User entered valid extension '%s'\n", exten); pbx_builtin_setvar_helper(chan, arglist.variable, exten); status = "OK"; diff --git a/apps/app_rpt.c b/apps/app_rpt.c index 48e398e55..6b01c83e1 100644 --- a/apps/app_rpt.c +++ b/apps/app_rpt.c @@ -5465,14 +5465,14 @@ struct ast_format_cap *cap = NULL; if(instr){ ast_callerid_parse(instr, &name, &loc); if(loc){ - mychannel->caller.id.number.valid = 1; - ast_free(mychannel->caller.id.number.str); - mychannel->caller.id.number.str = ast_strdup(loc); + ast_channel_caller(mychannel)->id.number.valid = 1; + ast_free(ast_channel_caller(mychannel)->id.number.str); + ast_channel_caller(mychannel)->id.number.str = ast_strdup(loc); } if(name){ - mychannel->caller.id.name.valid = 1; - ast_free(mychannel->caller.id.name.str); - mychannel->caller.id.name.str = ast_strdup(name); + ast_channel_caller(mychannel)->id.name.valid = 1; + ast_free(ast_channel_caller(mychannel)->id.name.str); + ast_channel_caller(mychannel)->id.name.str = ast_strdup(name); } ast_free(instr); } @@ -5821,9 +5821,9 @@ static int connect_link(struct rpt *myrpt, char* node, int mode, int perma) if (debug > 3) ast_log(LOG_NOTICE, "rpt (remote) initiating call to %s/%s on %s\n", deststr, tele, ast_channel_name(l->chan)); - l->chan->caller.id.number.valid = 1; - ast_free(l->chan->caller.id.number.str); - l->chan->caller.id.number.str = ast_strdup(myrpt->name); + ast_channel_caller(l->chan)->id.number.valid = 1; + ast_free(ast_channel_caller(l->chan)->id.number.str); + ast_channel_caller(l->chan)->id.number.str = ast_strdup(myrpt->name); ast_call(l->chan,tele,999); } else { @@ -10374,9 +10374,9 @@ static int attempt_reconnect(struct rpt *myrpt, struct rpt_link *l) ast_channel_data_set(l->chan, "(Remote Rx)"); ast_verb(3, "rpt (attempt_reconnect) initiating call to %s/%s on %s\n", deststr, tele, ast_channel_name(l->chan)); - l->chan->caller.id.number.valid = 1; - ast_free(l->chan->caller.id.number.str); - l->chan->caller.id.number.str = ast_strdup(myrpt->name); + ast_channel_caller(l->chan)->id.number.valid = 1; + ast_free(ast_channel_caller(l->chan)->id.number.str); + ast_channel_caller(l->chan)->id.number.str = ast_strdup(myrpt->name); ast_call(l->chan,tele,999); } @@ -13405,9 +13405,9 @@ static int rpt_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), ast_channel_priority(chan), - S_COR(chan->caller.id.number.valid, chan->caller.id.number.str, "")); + S_COR(ast_channel_caller(chan)->id.number.valid, ast_channel_caller(chan)->id.number.str, "")); 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))) { + S_COR(ast_channel_caller(chan)->id.number.valid, ast_channel_caller(chan)->id.number.str, NULL))) { ast_verb(3, "Warning: Return Context Invalid, call will return to default|s\n"); } @@ -13436,7 +13436,7 @@ static int rpt_exec(struct ast_channel *chan, const char *data) char hisip[100],nodeip[100],*val, *s, *s1, *s2, *s3, *b,*b1; /* look at callerid to see what node this comes from */ - b = S_COR(chan->caller.id.number.valid, chan->caller.id.number.str, NULL); + b = S_COR(ast_channel_caller(chan)->id.number.valid, ast_channel_caller(chan)->id.number.str, NULL); if (!b) /* if doesn't have caller id */ { ast_log(LOG_WARNING, "Does not have callerid on %s\n",tmp); @@ -13558,7 +13558,7 @@ static int rpt_exec(struct ast_channel *chan, const char *data) return -1; } /* look at callerid to see what node this comes from */ - b = S_COR(chan->caller.id.number.valid, chan->caller.id.number.str, NULL); + b = S_COR(ast_channel_caller(chan)->id.number.valid, ast_channel_caller(chan)->id.number.str, NULL); if (!b) /* if doesn't have caller id */ { ast_log(LOG_WARNING, "Doesnt have callerid on %s\n",tmp); @@ -14033,7 +14033,7 @@ static int rpt_exec(struct ast_channel *chan, const char *data) ast_cli_command(nullfd,mycmd); } else ast_cli_command(nullfd,mycmd); /* look at callerid to see what node this comes from */ - b = S_COR(chan->caller.id.number.valid, chan->caller.id.number.str, NULL); + b = S_COR(ast_channel_caller(chan)->id.number.valid, ast_channel_caller(chan)->id.number.str, NULL); if (!b) /* if doesn't have caller id */ { b1 = "0"; @@ -14544,7 +14544,7 @@ static int rpt_exec(struct ast_channel *chan, const char *data) char mycmd[100],*b,*b1; /* look at callerid to see what node this comes from */ - b = S_COR(chan->caller.id.number.valid, chan->caller.id.number.str, NULL); + b = S_COR(ast_channel_caller(chan)->id.number.valid, ast_channel_caller(chan)->id.number.str, NULL); if (!b) /* if doesn't have caller id */ { b1 = "0"; diff --git a/apps/app_setcallerid.c b/apps/app_setcallerid.c index cfcd2b47d..6fa3170f7 100644 --- a/apps/app_setcallerid.c +++ b/apps/app_setcallerid.c @@ -112,8 +112,8 @@ static int setcallerid_pres_exec(struct ast_channel *chan, const char *data) } /* Set the combined caller id presentation. */ - chan->caller.id.name.presentation = pres; - chan->caller.id.number.presentation = pres; + ast_channel_caller(chan)->id.name.presentation = pres; + ast_channel_caller(chan)->id.number.presentation = pres; return 0; } diff --git a/apps/app_sms.c b/apps/app_sms.c index 946677a61..d5fc353ac 100644 --- a/apps/app_sms.c +++ b/apps/app_sms.c @@ -1895,7 +1895,7 @@ static int sms_exec(struct ast_channel *chan, const char *data) h.dcs = 0xF1; /* default */ ast_copy_string(h.cli, - S_COR(chan->caller.id.number.valid, chan->caller.id.number.str, ""), + S_COR(ast_channel_caller(chan)->id.number.valid, ast_channel_caller(chan)->id.number.str, ""), sizeof(h.cli)); if (ast_strlen_zero(sms_args.queue)) { diff --git a/apps/app_stack.c b/apps/app_stack.c index 0ae2f5a74..827bb508a 100644 --- a/apps/app_stack.c +++ b/apps/app_stack.c @@ -344,7 +344,7 @@ static int return_exec(struct ast_channel *chan, const char *data) static int gosub_exec(struct ast_channel *chan, const char *data) { struct ast_datastore *stack_store = ast_channel_datastore_find(chan, &stack_info, NULL); - AST_LIST_HEAD(, gosub_stack_frame) *oldlist; + AST_LIST_HEAD(,gosub_stack_frame) *oldlist; struct gosub_stack_frame *newframe, *lastframe; char argname[15], *tmp = ast_strdupa(data), *label, *endparen; int i, max_argc = 0; @@ -416,7 +416,7 @@ 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) ? ast_channel_priority(chan) + 1 : ast_channel_priority(chan), - S_COR(chan->caller.id.number.valid, chan->caller.id.number.str, NULL))) { + S_COR(ast_channel_caller(chan)->id.number.valid, ast_channel_caller(chan)->id.number.str, NULL))) { ast_log(LOG_ERROR, "Attempt to reach a non-existent destination for gosub: (Context:%s, Extension:%s, Priority:%d)\n", ast_channel_context(chan), ast_channel_exten(chan), ast_test_flag(chan, AST_FLAG_IN_AUTOLOOP) ? ast_channel_priority(chan) + 1 : ast_channel_priority(chan)); ast_channel_context_set(chan, newframe->context); @@ -561,7 +561,7 @@ static int peek_read(struct ast_channel *chan, const char *cmd, char *data, char *buf = '\0'; ast_channel_lock(chan); - AST_LIST_TRAVERSE(&chan->varshead, variables, entries) { + AST_LIST_TRAVERSE(ast_channel_varshead(chan), variables, entries) { if (!strcmp(args.name, ast_var_name(variables)) && ++found > n) { ast_copy_string(buf, ast_var_value(variables), len); break; @@ -592,14 +592,14 @@ static int handle_gosub(struct ast_channel *chan, AGI *agi, int argc, const char if (sscanf(argv[3], "%30d", &priority) != 1 || priority < 1) { /* Lookup the priority label */ priority = ast_findlabel_extension(chan, argv[1], argv[2], argv[3], - S_COR(chan->caller.id.number.valid, chan->caller.id.number.str, NULL)); + S_COR(ast_channel_caller(chan)->id.number.valid, ast_channel_caller(chan)->id.number.str, NULL)); if (priority < 0) { ast_log(LOG_ERROR, "Priority '%s' not found in '%s@%s'\n", argv[3], argv[2], argv[1]); ast_agi_send(agi->fd, chan, "200 result=-1 Gosub label not found\n"); return RESULT_FAILURE; } } else if (!ast_exists_extension(chan, argv[1], argv[2], priority, - S_COR(chan->caller.id.number.valid, chan->caller.id.number.str, NULL))) { + S_COR(ast_channel_caller(chan)->id.number.valid, ast_channel_caller(chan)->id.number.str, NULL))) { ast_agi_send(agi->fd, chan, "200 result=-1 Gosub label not found\n"); return RESULT_FAILURE; } @@ -642,7 +642,7 @@ static int handle_gosub(struct ast_channel *chan, AGI *agi, int argc, const char 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; + AST_LIST_HEAD(,gosub_stack_frame) *oldlist = stack_store->data; struct gosub_stack_frame *cur = AST_LIST_FIRST(oldlist); cur->is_agi = 1; diff --git a/apps/app_talkdetect.c b/apps/app_talkdetect.c index 55904d6d2..791081db5 100644 --- a/apps/app_talkdetect.c +++ b/apps/app_talkdetect.c @@ -181,7 +181,7 @@ static int background_detect_exec(struct ast_channel *chan, const char *data) t[0] = fr->subclass.integer; t[1] = '\0'; if (ast_canmatch_extension(chan, ast_channel_context(chan), t, 1, - S_COR(chan->caller.id.number.valid, chan->caller.id.number.str, NULL))) { + S_COR(ast_channel_caller(chan)->id.number.valid, ast_channel_caller(chan)->id.number.str, NULL))) { /* They entered a valid extension, or might be anyhow */ res = fr->subclass.integer; ast_frfree(fr); diff --git a/apps/app_voicemail.c b/apps/app_voicemail.c index fc7417bda..8aa8bfde2 100644 --- a/apps/app_voicemail.c +++ b/apps/app_voicemail.c @@ -2387,8 +2387,8 @@ static int imap_store_file(const char *dir, const char *mailboxuser, const char } make_email_file(p, myserveremail, vmu, msgnum, vmu->context, vmu->mailbox, "INBOX", - S_COR(chan->caller.id.number.valid, chan->caller.id.number.str, NULL), - S_COR(chan->caller.id.name.valid, chan->caller.id.name.str, NULL), + S_COR(ast_channel_caller(chan)->id.number.valid, ast_channel_caller(chan)->id.number.str, NULL), + S_COR(ast_channel_caller(chan)->id.name.valid, ast_channel_caller(chan)->id.name.str, NULL), fn, introfn, fmt, duration, 1, chan, NULL, 1, flag); /* read mail file to memory */ len = ftell(p); @@ -5457,8 +5457,8 @@ static int copy_message(struct ast_channel *chan, struct ast_vm_user *vmu, int i } ast_unlock_path(todir); notify_new_message(chan, recip, NULL, recipmsgnum, duration, fmt, - S_COR(chan->caller.id.number.valid, chan->caller.id.number.str, NULL), - S_COR(chan->caller.id.name.valid, chan->caller.id.name.str, NULL), + S_COR(ast_channel_caller(chan)->id.number.valid, ast_channel_caller(chan)->id.number.str, NULL), + S_COR(ast_channel_caller(chan)->id.name.valid, ast_channel_caller(chan)->id.name.str, NULL), flag); return res; @@ -5796,17 +5796,17 @@ static int leave_voicemail(struct ast_channel *chan, char *ext, struct leave_vm_ if (ast_test_flag(vmu, VM_OPERATOR)) { if (!ast_strlen_zero(vmu->exit)) { if (ast_exists_extension(chan, vmu->exit, "o", 1, - S_COR(chan->caller.id.number.valid, chan->caller.id.number.str, NULL))) { + S_COR(ast_channel_caller(chan)->id.number.valid, ast_channel_caller(chan)->id.number.str, NULL))) { strncat(ecodes, "0", sizeof(ecodes) - strlen(ecodes) - 1); ouseexten = 1; } } else if (ast_exists_extension(chan, ast_channel_context(chan), "o", 1, - S_COR(chan->caller.id.number.valid, chan->caller.id.number.str, NULL))) { + S_COR(ast_channel_caller(chan)->id.number.valid, ast_channel_caller(chan)->id.number.str, NULL))) { strncat(ecodes, "0", sizeof(ecodes) - strlen(ecodes) - 1); ouseexten = 1; } else if (!ast_strlen_zero(ast_channel_macrocontext(chan)) && ast_exists_extension(chan, ast_channel_macrocontext(chan), "o", 1, - S_COR(chan->caller.id.number.valid, chan->caller.id.number.str, NULL))) { + S_COR(ast_channel_caller(chan)->id.number.valid, ast_channel_caller(chan)->id.number.str, NULL))) { strncat(ecodes, "0", sizeof(ecodes) - strlen(ecodes) - 1); ousemacro = 1; } @@ -5814,15 +5814,15 @@ static int leave_voicemail(struct ast_channel *chan, char *ext, struct leave_vm_ if (!ast_strlen_zero(vmu->exit)) { if (ast_exists_extension(chan, vmu->exit, "a", 1, - S_COR(chan->caller.id.number.valid, chan->caller.id.number.str, NULL))) { + S_COR(ast_channel_caller(chan)->id.number.valid, ast_channel_caller(chan)->id.number.str, NULL))) { strncat(ecodes, "*", sizeof(ecodes) - strlen(ecodes) - 1); } } else if (ast_exists_extension(chan, ast_channel_context(chan), "a", 1, - S_COR(chan->caller.id.number.valid, chan->caller.id.number.str, NULL))) { + S_COR(ast_channel_caller(chan)->id.number.valid, ast_channel_caller(chan)->id.number.str, NULL))) { strncat(ecodes, "*", sizeof(ecodes) - strlen(ecodes) - 1); } else if (!ast_strlen_zero(ast_channel_macrocontext(chan)) && ast_exists_extension(chan, ast_channel_macrocontext(chan), "a", 1, - S_COR(chan->caller.id.number.valid, chan->caller.id.number.str, NULL))) { + S_COR(ast_channel_caller(chan)->id.number.valid, ast_channel_caller(chan)->id.number.str, NULL))) { strncat(ecodes, "*", sizeof(ecodes) - strlen(ecodes) - 1); ausemacro = 1; } @@ -5833,7 +5833,7 @@ static int leave_voicemail(struct ast_channel *chan, char *ext, struct leave_vm_ e[0] = *code; if (strchr(ecodes, e[0]) == NULL && ast_canmatch_extension(chan, ast_channel_context(chan), e, 1, - S_COR(chan->caller.id.number.valid, chan->caller.id.number.str, NULL))) { + S_COR(ast_channel_caller(chan)->id.number.valid, ast_channel_caller(chan)->id.number.str, NULL))) { strncat(ecodes, e, sizeof(ecodes) - strlen(ecodes) - 1); } } @@ -6013,8 +6013,8 @@ static int leave_voicemail(struct ast_channel *chan, char *ext, struct leave_vm_ snprintf(origtime, sizeof(origtime), "%ld", (long) time(NULL)); get_date(date, sizeof(date)); ast_callerid_merge(callerid, sizeof(callerid), - S_COR(chan->caller.id.name.valid, chan->caller.id.name.str, NULL), - S_COR(chan->caller.id.number.valid, chan->caller.id.number.str, NULL), + S_COR(ast_channel_caller(chan)->id.name.valid, ast_channel_caller(chan)->id.name.str, NULL), + S_COR(ast_channel_caller(chan)->id.number.valid, ast_channel_caller(chan)->id.number.str, NULL), "Unknown"); ast_store_realtime("voicemail_data", "origmailbox", ext, @@ -6036,8 +6036,8 @@ static int leave_voicemail(struct ast_channel *chan, char *ext, struct leave_vm_ if (txt) { get_date(date, sizeof(date)); ast_callerid_merge(callerid, sizeof(callerid), - S_COR(chan->caller.id.name.valid, chan->caller.id.name.str, NULL), - S_COR(chan->caller.id.number.valid, chan->caller.id.number.str, NULL), + S_COR(ast_channel_caller(chan)->id.name.valid, ast_channel_caller(chan)->id.name.str, NULL), + S_COR(ast_channel_caller(chan)->id.number.valid, ast_channel_caller(chan)->id.number.str, NULL), "Unknown"); fprintf(txt, ";\n" @@ -6059,8 +6059,8 @@ static int leave_voicemail(struct ast_channel *chan, char *ext, struct leave_vm_ ast_channel_context(chan), ast_channel_macrocontext(chan), ast_channel_exten(chan), - S_COR(chan->redirecting.from.number.valid, - chan->redirecting.from.number.str, "unknown"), + S_COR(ast_channel_redirecting(chan)->from.number.valid, + ast_channel_redirecting(chan)->from.number.str, "unknown"), ast_channel_priority(chan), ast_channel_name(chan), callerid, @@ -6178,13 +6178,13 @@ static int leave_voicemail(struct ast_channel *chan, char *ext, struct leave_vm_ if (ast_fileexists(fn, NULL, NULL)) { #ifdef IMAP_STORAGE notify_new_message(chan, vmu, vms, msgnum, duration, fmt, - S_COR(chan->caller.id.number.valid, chan->caller.id.number.str, NULL), - S_COR(chan->caller.id.name.valid, chan->caller.id.name.str, NULL), + S_COR(ast_channel_caller(chan)->id.number.valid, ast_channel_caller(chan)->id.number.str, NULL), + S_COR(ast_channel_caller(chan)->id.name.valid, ast_channel_caller(chan)->id.name.str, NULL), flag); #else notify_new_message(chan, vmu, NULL, msgnum, duration, fmt, - S_COR(chan->caller.id.number.valid, chan->caller.id.number.str, NULL), - S_COR(chan->caller.id.name.valid, chan->caller.id.name.str, NULL), + S_COR(ast_channel_caller(chan)->id.number.valid, ast_channel_caller(chan)->id.number.str, NULL), + S_COR(ast_channel_caller(chan)->id.name.valid, ast_channel_caller(chan)->id.name.str, NULL), flag); #endif } @@ -9864,8 +9864,8 @@ static int vm_authenticate(struct ast_channel *chan, char *mailbox, int mailbox_ return -1; } if (ast_strlen_zero(mailbox)) { - if (chan->caller.id.number.valid && chan->caller.id.number.str) { - ast_copy_string(mailbox, chan->caller.id.number.str, mailbox_size); + if (ast_channel_caller(chan)->id.number.valid && ast_channel_caller(chan)->id.number.str) { + ast_copy_string(mailbox, ast_channel_caller(chan)->id.number.str, mailbox_size); } else { ast_verb(3, "Username not entered\n"); return -1; @@ -9874,7 +9874,7 @@ static int vm_authenticate(struct ast_channel *chan, char *mailbox, int mailbox_ /* user entered '*' */ ast_verb(4, "Mailbox begins with '*', attempting jump to extension 'a'\n"); if (ast_exists_extension(chan, ast_channel_context(chan), "a", 1, - S_COR(chan->caller.id.number.valid, chan->caller.id.number.str, NULL))) { + S_COR(ast_channel_caller(chan)->id.number.valid, ast_channel_caller(chan)->id.number.str, NULL))) { return -1; } ast_verb(4, "Jump to extension 'a' failed; setting mailbox to NULL\n"); @@ -9909,7 +9909,7 @@ static int vm_authenticate(struct ast_channel *chan, char *mailbox, int mailbox_ /* user entered '*' */ ast_verb(4, "Password begins with '*', attempting jump to extension 'a'\n"); if (ast_exists_extension(chan, ast_channel_context(chan), "a", 1, - S_COR(chan->caller.id.number.valid, chan->caller.id.number.str, NULL))) { + S_COR(ast_channel_caller(chan)->id.number.valid, ast_channel_caller(chan)->id.number.str, NULL))) { mailbox[0] = '*'; return -1; } diff --git a/apps/app_while.c b/apps/app_while.c index 5e8fb9bb4..d1e03f600 100644 --- a/apps/app_while.c +++ b/apps/app_while.c @@ -168,10 +168,10 @@ static int find_matching_endwhile(struct ast_channel *chan) 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)); + S_COR(ast_channel_caller(chan)->id.number.valid, ast_channel_caller(chan)->id.number.str, NULL)); e; e = find_matching_priority(c, ast_channel_exten(chan), ++cur_priority, - S_COR(chan->caller.id.number.valid, chan->caller.id.number.str, NULL))) { + S_COR(ast_channel_caller(chan)->id.number.valid, ast_channel_caller(chan)->id.number.str, NULL))) { if (!strcasecmp(ast_get_extension_app(e), "WHILE")) { level++; } else if (!strcasecmp(ast_get_extension_app(e), "ENDWHILE")) { diff --git a/apps/app_zapateller.c b/apps/app_zapateller.c index 775fd55a3..00166978f 100644 --- a/apps/app_zapateller.c +++ b/apps/app_zapateller.c @@ -108,8 +108,8 @@ static int zapateller_exec(struct ast_channel *chan, const char *data) } if (nocallerid /* Zap caller if no caller id. */ - && chan->caller.id.number.valid - && !ast_strlen_zero(chan->caller.id.number.str)) { + && ast_channel_caller(chan)->id.number.valid + && !ast_strlen_zero(ast_channel_caller(chan)->id.number.str)) { /* We have caller id. */ return res; } diff --git a/bridges/bridge_builtin_features.c b/bridges/bridge_builtin_features.c index 5ef9b84c1..21af92855 100644 --- a/bridges/bridge_builtin_features.c +++ b/bridges/bridge_builtin_features.c @@ -85,7 +85,7 @@ static struct ast_channel *dial_transfer(struct ast_channel *caller, const char /* Before we actually dial out let's inherit appropriate information. */ ast_channel_lock_both(caller, chan); - ast_connected_line_copy_from_caller(&chan->connected, &caller->caller); + ast_connected_line_copy_from_caller(ast_channel_connected(chan), ast_channel_caller(caller)); ast_channel_inherit_variables(caller, chan); ast_channel_datastore_inherit(caller, chan); ast_channel_unlock(chan); diff --git a/channels/chan_agent.c b/channels/chan_agent.c index 9eb0b68f9..3c8073b81 100644 --- a/channels/chan_agent.c +++ b/channels/chan_agent.c @@ -1587,8 +1587,8 @@ static int action_agents(struct mansession *s, const struct message *m) if (p->chan) { loginChan = ast_strdupa(ast_channel_name(p->chan)); if (owner && owner->_bridge) { - talkingto = S_COR(p->chan->caller.id.number.valid, - p->chan->caller.id.number.str, "n/a"); + talkingto = S_COR(ast_channel_caller(p->chan)->id.number.valid, + ast_channel_caller(p->chan)->id.number.str, "n/a"); if ((bridge = ast_bridged_channel(owner))) { talkingtoChan = ast_strdupa(ast_channel_name(bridge)); } else { @@ -2282,12 +2282,12 @@ static int agentmonitoroutgoing_exec(struct ast_channel *chan, const char *data) if (strchr(data, 'c')) changeoutgoing = 1; } - if (chan->caller.id.number.valid - && !ast_strlen_zero(chan->caller.id.number.str)) { + if (ast_channel_caller(chan)->id.number.valid + && !ast_strlen_zero(ast_channel_caller(chan)->id.number.str)) { const char *tmp; char agentvar[AST_MAX_BUF]; snprintf(agentvar, sizeof(agentvar), "%s_%s", GETAGENTBYCALLERID, - chan->caller.id.number.str); + ast_channel_caller(chan)->id.number.str); if ((tmp = pbx_builtin_getvar_helper(NULL, agentvar))) { struct agent_pvt *p; ast_copy_string(agent, tmp, sizeof(agent)); diff --git a/channels/chan_console.c b/channels/chan_console.c index 02fca590c..2856bae06 100644 --- a/channels/chan_console.c +++ b/channels/chan_console.c @@ -561,8 +561,8 @@ static int console_call(struct ast_channel *c, const char *dest, int timeout) ast_verb(1, V_BEGIN "Call to device '%s' on console from '%s' <%s>" V_END, dest, - S_COR(c->caller.id.name.valid, c->caller.id.name.str, ""), - S_COR(c->caller.id.number.valid, c->caller.id.number.str, "")); + S_COR(ast_channel_caller(c)->id.name.valid, ast_channel_caller(c)->id.name.str, ""), + S_COR(ast_channel_caller(c)->id.number.valid, ast_channel_caller(c)->id.number.str, "")); console_pvt_lock(pvt); diff --git a/channels/chan_dahdi.c b/channels/chan_dahdi.c index 246742188..c160ae8f1 100644 --- a/channels/chan_dahdi.c +++ b/channels/chan_dahdi.c @@ -2097,7 +2097,7 @@ static void my_handle_dtmf(void *pvt, struct ast_channel *ast, enum analog_sub a ast_mutex_unlock(&p->lock); ast_channel_unlock(ast); if (ast_exists_extension(ast, target_context, "fax", 1, - S_COR(ast->caller.id.number.valid, ast->caller.id.number.str, NULL))) { + S_COR(ast_channel_caller(ast)->id.number.valid, ast_channel_caller(ast)->id.number.str, NULL))) { ast_channel_lock(ast); ast_mutex_lock(&p->lock); ast_verb(3, "Redirecting %s to fax extension\n", ast_channel_name(ast)); @@ -5486,7 +5486,7 @@ static int dahdi_call(struct ast_channel *ast, const char *rdest, int timeout) c = args.ext; if (!p->hidecallerid) { - l = ast->connected.id.number.valid ? ast->connected.id.number.str : NULL; + l = ast_channel_connected(ast)->id.number.valid ? ast_channel_connected(ast)->id.number.str : NULL; } else { l = NULL; } @@ -7860,7 +7860,7 @@ static void dahdi_handle_dtmf(struct ast_channel *ast, int idx, struct ast_frame ast_mutex_unlock(&p->lock); ast_channel_unlock(ast); if (ast_exists_extension(ast, target_context, "fax", 1, - S_COR(ast->caller.id.number.valid, ast->caller.id.number.str, NULL))) { + S_COR(ast_channel_caller(ast)->id.number.valid, ast_channel_caller(ast)->id.number.str, NULL))) { ast_channel_lock(ast); ast_mutex_lock(&p->lock); ast_verb(3, "Redirecting %s to fax extension\n", ast_channel_name(ast)); @@ -8541,14 +8541,14 @@ static struct ast_frame *dahdi_handle_event(struct ast_channel *ast) cid_num[0] = 0; cid_name[0] = 0; if (p->dahditrcallerid && p->owner) { - if (p->owner->caller.id.number.valid - && p->owner->caller.id.number.str) { - ast_copy_string(cid_num, p->owner->caller.id.number.str, + if (ast_channel_caller(p->owner)->id.number.valid + && ast_channel_caller(p->owner)->id.number.str) { + ast_copy_string(cid_num, ast_channel_caller(p->owner)->id.number.str, sizeof(cid_num)); } - if (p->owner->caller.id.name.valid - && p->owner->caller.id.name.str) { - ast_copy_string(cid_name, p->owner->caller.id.name.str, + if (ast_channel_caller(p->owner)->id.name.valid + && ast_channel_caller(p->owner)->id.name.str) { + ast_copy_string(cid_name, ast_channel_caller(p->owner)->id.name.str, sizeof(cid_name)); } } @@ -8668,13 +8668,13 @@ winkflashdone: case SIG_FEATDMF_TA: switch (p->whichwink) { case 0: - ast_debug(1, "ANI2 set to '%d' and ANI is '%s'\n", p->owner->caller.ani2, - S_COR(p->owner->caller.ani.number.valid, - p->owner->caller.ani.number.str, "")); + ast_debug(1, "ANI2 set to '%d' and ANI is '%s'\n", ast_channel_caller(p->owner)->ani2, + S_COR(ast_channel_caller(p->owner)->ani.number.valid, + ast_channel_caller(p->owner)->ani.number.str, "")); snprintf(p->dop.dialstr, sizeof(p->dop.dialstr), "M*%d%s#", - p->owner->caller.ani2, - S_COR(p->owner->caller.ani.number.valid, - p->owner->caller.ani.number.str, "")); + ast_channel_caller(p->owner)->ani2, + S_COR(ast_channel_caller(p->owner)->ani.number.valid, + ast_channel_caller(p->owner)->ani.number.str, "")); break; case 1: ast_copy_string(p->dop.dialstr, p->finaldial, sizeof(p->dop.dialstr)); @@ -9762,34 +9762,34 @@ static struct ast_channel *dahdi_new(struct dahdi_pvt *i, int state, int startpb if (!ast_strlen_zero(i->exten)) ast_channel_exten_set(tmp, i->exten); if (!ast_strlen_zero(i->rdnis)) { - tmp->redirecting.from.number.valid = 1; - tmp->redirecting.from.number.str = ast_strdup(i->rdnis); + ast_channel_redirecting(tmp)->from.number.valid = 1; + ast_channel_redirecting(tmp)->from.number.str = ast_strdup(i->rdnis); } if (!ast_strlen_zero(i->dnid)) { - tmp->dialed.number.str = ast_strdup(i->dnid); + ast_channel_dialed(tmp)->number.str = ast_strdup(i->dnid); } /* Don't use ast_set_callerid() here because it will * generate a needless NewCallerID event */ #if defined(HAVE_PRI) || defined(HAVE_SS7) if (!ast_strlen_zero(i->cid_ani)) { - tmp->caller.ani.number.valid = 1; - tmp->caller.ani.number.str = ast_strdup(i->cid_ani); + ast_channel_caller(tmp)->ani.number.valid = 1; + ast_channel_caller(tmp)->ani.number.str = ast_strdup(i->cid_ani); } else if (!ast_strlen_zero(i->cid_num)) { - tmp->caller.ani.number.valid = 1; - tmp->caller.ani.number.str = ast_strdup(i->cid_num); + ast_channel_caller(tmp)->ani.number.valid = 1; + ast_channel_caller(tmp)->ani.number.str = ast_strdup(i->cid_num); } #else if (!ast_strlen_zero(i->cid_num)) { - tmp->caller.ani.number.valid = 1; - tmp->caller.ani.number.str = ast_strdup(i->cid_num); + ast_channel_caller(tmp)->ani.number.valid = 1; + ast_channel_caller(tmp)->ani.number.str = ast_strdup(i->cid_num); } #endif /* defined(HAVE_PRI) || defined(HAVE_SS7) */ - tmp->caller.id.name.presentation = i->callingpres; - tmp->caller.id.number.presentation = i->callingpres; - tmp->caller.id.number.plan = i->cid_ton; - tmp->caller.ani2 = i->cid_ani2; - tmp->caller.id.tag = ast_strdup(i->cid_tag); + ast_channel_caller(tmp)->id.name.presentation = i->callingpres; + ast_channel_caller(tmp)->id.number.presentation = i->callingpres; + ast_channel_caller(tmp)->id.number.plan = i->cid_ton; + ast_channel_caller(tmp)->ani2 = i->cid_ani2; + ast_channel_caller(tmp)->id.tag = ast_strdup(i->cid_tag); /* clear the fake event in case we posted one before we had ast_channel */ i->fake_event = 0; /* Assure there is no confmute on this channel */ @@ -10217,7 +10217,7 @@ static void *analog_ss_thread(void *data) } if (ast_exists_extension(chan, ast_channel_context(chan), exten, 1, - S_COR(chan->caller.id.number.valid, chan->caller.id.number.str, NULL))) { + S_COR(ast_channel_caller(chan)->id.number.valid, ast_channel_caller(chan)->id.number.str, NULL))) { ast_channel_exten_set(chan, exten); if (p->dsp) ast_dsp_digitreset(p->dsp); res = ast_pbx_run(chan); @@ -10368,10 +10368,10 @@ static void *analog_ss_thread(void *data) ast_verb(3, "Disabling Caller*ID on %s\n", ast_channel_name(chan)); /* Disable Caller*ID if enabled */ p->hidecallerid = 1; - ast_party_number_free(&chan->caller.id.number); - ast_party_number_init(&chan->caller.id.number); - ast_party_name_free(&chan->caller.id.name); - ast_party_name_init(&chan->caller.id.name); + ast_party_number_free(&ast_channel_caller(chan)->id.number); + ast_party_number_init(&ast_channel_caller(chan)->id.number); + ast_party_name_free(&ast_channel_caller(chan)->id.name); + ast_party_name_init(&ast_channel_caller(chan)->id.name); res = tone_zone_play_tone(p->subs[idx].dfd, DAHDI_TONE_DIALRECALL); if (res) { ast_log(LOG_WARNING, "Unable to do dial recall on channel %s: %s\n", @@ -10468,10 +10468,10 @@ static void *analog_ss_thread(void *data) goto quit; } } else if (!ast_canmatch_extension(chan, ast_channel_context(chan), exten, 1, - S_COR(chan->caller.id.number.valid, chan->caller.id.number.str, NULL)) + S_COR(ast_channel_caller(chan)->id.number.valid, ast_channel_caller(chan)->id.number.str, NULL)) && !canmatch_featurecode(exten)) { ast_debug(1, "Can't match %s from '%s' in context %s\n", exten, - S_COR(chan->caller.id.number.valid, chan->caller.id.number.str, ""), + S_COR(ast_channel_caller(chan)->id.number.valid, ast_channel_caller(chan)->id.number.str, ""), ast_channel_context(chan)); break; } diff --git a/channels/chan_gtalk.c b/channels/chan_gtalk.c index 8db2369d2..1f967adb5 100644 --- a/channels/chan_gtalk.c +++ b/channels/chan_gtalk.c @@ -1178,8 +1178,8 @@ static struct ast_channel *gtalk_new(struct gtalk *client, struct gtalk_pvt *i, tmp->callgroup = client->callgroup; tmp->pickupgroup = client->pickupgroup; - tmp->caller.id.name.presentation = client->callingpres; - tmp->caller.id.number.presentation = client->callingpres; + ast_channel_caller(tmp)->id.name.presentation = client->callingpres; + ast_channel_caller(tmp)->id.number.presentation = client->callingpres; if (!ast_strlen_zero(client->accountcode)) ast_channel_accountcode_set(tmp, client->accountcode); if (client->amaflags) @@ -1196,7 +1196,7 @@ static struct ast_channel *gtalk_new(struct gtalk *client, struct gtalk_pvt *i, ast_channel_exten_set(tmp, i->exten); if (!ast_strlen_zero(i->exten) && strcmp(i->exten, "s")) { - tmp->dialed.number.str = ast_strdup(i->exten); + ast_channel_dialed(tmp)->number.str = ast_strdup(i->exten); } ast_channel_priority_set(tmp, 1); if (i->rtp) diff --git a/channels/chan_h323.c b/channels/chan_h323.c index 7da2e9295..49a5e2029 100644 --- a/channels/chan_h323.c +++ b/channels/chan_h323.c @@ -620,20 +620,20 @@ static int oh323_call(struct ast_channel *c, const char *dest, int timeout) /* make sure null terminated */ called_addr[sizeof(called_addr) - 1] = '\0'; - if (c->connected.id.number.valid && c->connected.id.number.str) { - ast_copy_string(pvt->options.cid_num, c->connected.id.number.str, sizeof(pvt->options.cid_num)); + if (ast_channel_connected(c)->id.number.valid && ast_channel_connected(c)->id.number.str) { + ast_copy_string(pvt->options.cid_num, ast_channel_connected(c)->id.number.str, sizeof(pvt->options.cid_num)); } - if (c->connected.id.name.valid && c->connected.id.name.str) { - ast_copy_string(pvt->options.cid_name, c->connected.id.name.str, sizeof(pvt->options.cid_name)); + if (ast_channel_connected(c)->id.name.valid && ast_channel_connected(c)->id.name.str) { + ast_copy_string(pvt->options.cid_name, ast_channel_connected(c)->id.name.str, sizeof(pvt->options.cid_name)); } - if (c->redirecting.from.number.valid && c->redirecting.from.number.str) { - ast_copy_string(pvt->options.cid_rdnis, c->redirecting.from.number.str, sizeof(pvt->options.cid_rdnis)); + if (ast_channel_redirecting(c)->from.number.valid && ast_channel_redirecting(c)->from.number.str) { + ast_copy_string(pvt->options.cid_rdnis, ast_channel_redirecting(c)->from.number.str, sizeof(pvt->options.cid_rdnis)); } - pvt->options.presentation = ast_party_id_presentation(&c->connected.id); - pvt->options.type_of_number = c->connected.id.number.plan; + pvt->options.presentation = ast_party_id_presentation(&ast_channel_connected(c)->id); + pvt->options.type_of_number = ast_channel_connected(c)->id.number.plan; if ((addr = pbx_builtin_getvar_helper(c, "PRIREDIRECTREASON"))) { if (!strcasecmp(addr, "UNKNOWN")) @@ -1107,21 +1107,21 @@ static struct ast_channel *__oh323_new(struct oh323_pvt *pvt, int state, const c /* Don't use ast_set_callerid() here because it will * generate a needless NewCallerID event */ if (!ast_strlen_zero(cid_num)) { - ch->caller.ani.number.valid = 1; - ch->caller.ani.number.str = ast_strdup(cid_num); + ast_channel_caller(ch)->ani.number.valid = 1; + ast_channel_caller(ch)->ani.number.str = ast_strdup(cid_num); } if (pvt->cd.redirect_reason >= 0) { - ch->redirecting.from.number.valid = 1; - ch->redirecting.from.number.str = ast_strdup(pvt->cd.redirect_number); + ast_channel_redirecting(ch)->from.number.valid = 1; + ast_channel_redirecting(ch)->from.number.str = ast_strdup(pvt->cd.redirect_number); pbx_builtin_setvar_helper(ch, "PRIREDIRECTREASON", redirectingreason2str(pvt->cd.redirect_reason)); } - ch->caller.id.name.presentation = pvt->cd.presentation; - ch->caller.id.number.presentation = pvt->cd.presentation; - ch->caller.id.number.plan = pvt->cd.type_of_number; + ast_channel_caller(ch)->id.name.presentation = pvt->cd.presentation; + ast_channel_caller(ch)->id.number.presentation = pvt->cd.presentation; + ast_channel_caller(ch)->id.number.plan = pvt->cd.type_of_number; if (!ast_strlen_zero(pvt->exten) && strcmp(pvt->exten, "s")) { - ch->dialed.number.str = ast_strdup(pvt->exten); + ast_channel_dialed(ch)->number.str = ast_strdup(pvt->exten); } if (pvt->cd.transfer_capability >= 0) ast_channel_transfercapability_set(ch, pvt->cd.transfer_capability); diff --git a/channels/chan_iax2.c b/channels/chan_iax2.c index fab2752c7..b0b041645 100644 --- a/channels/chan_iax2.c +++ b/channels/chan_iax2.c @@ -5078,8 +5078,8 @@ static int iax2_call(struct ast_channel *c, const char *dest, int timeout) if (pds.port) sin.sin_port = htons(atoi(pds.port)); - l = c->connected.id.number.valid ? c->connected.id.number.str : NULL; - n = c->connected.id.name.valid ? c->connected.id.name.str : NULL; + l = ast_channel_connected(c)->id.number.valid ? ast_channel_connected(c)->id.number.str : NULL; + n = ast_channel_connected(c)->id.name.valid ? ast_channel_connected(c)->id.name.str : NULL; /* Now build request */ memset(&ied, 0, sizeof(ied)); @@ -5098,33 +5098,33 @@ static int iax2_call(struct ast_channel *c, const char *dest, int timeout) if (l) { iax_ie_append_str(&ied, IAX_IE_CALLING_NUMBER, l); iax_ie_append_byte(&ied, IAX_IE_CALLINGPRES, - ast_party_id_presentation(&c->connected.id)); + ast_party_id_presentation(&ast_channel_connected(c)->id)); } else if (n) { iax_ie_append_byte(&ied, IAX_IE_CALLINGPRES, - ast_party_id_presentation(&c->connected.id)); + ast_party_id_presentation(&ast_channel_connected(c)->id)); } else { iax_ie_append_byte(&ied, IAX_IE_CALLINGPRES, AST_PRES_NUMBER_NOT_AVAILABLE); } - iax_ie_append_byte(&ied, IAX_IE_CALLINGTON, c->connected.id.number.plan); - iax_ie_append_short(&ied, IAX_IE_CALLINGTNS, c->dialed.transit_network_select); + iax_ie_append_byte(&ied, IAX_IE_CALLINGTON, ast_channel_connected(c)->id.number.plan); + iax_ie_append_short(&ied, IAX_IE_CALLINGTNS, ast_channel_dialed(c)->transit_network_select); if (n) iax_ie_append_str(&ied, IAX_IE_CALLING_NAME, n); if (ast_test_flag64(iaxs[callno], IAX_SENDANI) - && c->connected.ani.number.valid - && c->connected.ani.number.str) { - iax_ie_append_str(&ied, IAX_IE_CALLING_ANI, c->connected.ani.number.str); + && ast_channel_connected(c)->ani.number.valid + && ast_channel_connected(c)->ani.number.str) { + iax_ie_append_str(&ied, IAX_IE_CALLING_ANI, ast_channel_connected(c)->ani.number.str); } if (!ast_strlen_zero(ast_channel_language(c))) iax_ie_append_str(&ied, IAX_IE_LANGUAGE, ast_channel_language(c)); - if (!ast_strlen_zero(c->dialed.number.str)) { - iax_ie_append_str(&ied, IAX_IE_DNID, c->dialed.number.str); + if (!ast_strlen_zero(ast_channel_dialed(c)->number.str)) { + iax_ie_append_str(&ied, IAX_IE_DNID, ast_channel_dialed(c)->number.str); } - if (c->redirecting.from.number.valid - && !ast_strlen_zero(c->redirecting.from.number.str)) { - iax_ie_append_str(&ied, IAX_IE_RDNIS, c->redirecting.from.number.str); + if (ast_channel_redirecting(c)->from.number.valid + && !ast_strlen_zero(ast_channel_redirecting(c)->from.number.str)) { + iax_ie_append_str(&ied, IAX_IE_RDNIS, ast_channel_redirecting(c)->from.number.str); } if (pds.context) @@ -5768,21 +5768,21 @@ static struct ast_channel *ast_iax2_new(int callno, int state, iax2_format capab /* Don't use ast_set_callerid() here because it will * generate a NewCallerID event before the NewChannel event */ if (!ast_strlen_zero(i->ani)) { - tmp->caller.ani.number.valid = 1; - tmp->caller.ani.number.str = ast_strdup(i->ani); + ast_channel_caller(tmp)->ani.number.valid = 1; + ast_channel_caller(tmp)->ani.number.str = ast_strdup(i->ani); } else if (!ast_strlen_zero(i->cid_num)) { - tmp->caller.ani.number.valid = 1; - tmp->caller.ani.number.str = ast_strdup(i->cid_num); + ast_channel_caller(tmp)->ani.number.valid = 1; + ast_channel_caller(tmp)->ani.number.str = ast_strdup(i->cid_num); } - tmp->dialed.number.str = ast_strdup(i->dnid); + ast_channel_dialed(tmp)->number.str = ast_strdup(i->dnid); if (!ast_strlen_zero(i->rdnis)) { - tmp->redirecting.from.number.valid = 1; - tmp->redirecting.from.number.str = ast_strdup(i->rdnis); + ast_channel_redirecting(tmp)->from.number.valid = 1; + ast_channel_redirecting(tmp)->from.number.str = ast_strdup(i->rdnis); } - tmp->caller.id.name.presentation = i->calling_pres; - tmp->caller.id.number.presentation = i->calling_pres; - tmp->caller.id.number.plan = i->calling_ton; - tmp->dialed.transit_network_select = i->calling_tns; + ast_channel_caller(tmp)->id.name.presentation = i->calling_pres; + ast_channel_caller(tmp)->id.number.presentation = i->calling_pres; + ast_channel_caller(tmp)->id.number.plan = i->calling_ton; + ast_channel_dialed(tmp)->transit_network_select = i->calling_tns; if (!ast_strlen_zero(i->language)) ast_channel_language_set(tmp, i->language); if (!ast_strlen_zero(i->accountcode)) @@ -11597,8 +11597,8 @@ immediatedial: S_COR(connected.id.number.valid, connected.id.number.str, ""), S_COR(connected.id.name.valid, connected.id.name.str, ""), NULL); - iaxs[fr->callno]->owner->caller.id.number.presentation = connected.id.number.presentation; - iaxs[fr->callno]->owner->caller.id.name.presentation = connected.id.name.presentation; + ast_channel_caller(iaxs[fr->callno]->owner)->id.number.presentation = connected.id.number.presentation; + ast_channel_caller(iaxs[fr->callno]->owner)->id.name.presentation = connected.id.name.presentation; } } ast_party_connected_line_free(&connected); diff --git a/channels/chan_jingle.c b/channels/chan_jingle.c index 7156e9443..8a1bfdc1a 100644 --- a/channels/chan_jingle.c +++ b/channels/chan_jingle.c @@ -890,8 +890,8 @@ static struct ast_channel *jingle_new(struct jingle *client, struct jingle_pvt * tmp->callgroup = client->callgroup; tmp->pickupgroup = client->pickupgroup; - tmp->caller.id.name.presentation = client->callingpres; - tmp->caller.id.number.presentation = client->callingpres; + ast_channel_caller(tmp)->id.name.presentation = client->callingpres; + ast_channel_caller(tmp)->id.number.presentation = client->callingpres; if (!ast_strlen_zero(client->accountcode)) ast_channel_accountcode_set(tmp, client->accountcode); if (client->amaflags) @@ -906,11 +906,11 @@ static struct ast_channel *jingle_new(struct jingle *client, struct jingle_pvt * /* Don't use ast_set_callerid() here because it will * generate an unnecessary NewCallerID event */ if (!ast_strlen_zero(i->cid_num)) { - tmp->caller.ani.number.valid = 1; - tmp->caller.ani.number.str = ast_strdup(i->cid_num); + ast_channel_caller(tmp)->ani.number.valid = 1; + ast_channel_caller(tmp)->ani.number.str = ast_strdup(i->cid_num); } if (!ast_strlen_zero(i->exten) && strcmp(i->exten, "s")) { - tmp->dialed.number.str = ast_strdup(i->exten); + ast_channel_dialed(tmp)->number.str = ast_strdup(i->exten); } ast_channel_priority_set(tmp, 1); if (i->rtp) @@ -1390,9 +1390,9 @@ static int jingle_digit(struct ast_channel *ast, char digit, unsigned int durati iks_insert_node(jingle, dtmf); ast_mutex_lock(&p->lock); - if (ast->dtmff.frametype == AST_FRAME_DTMF_BEGIN || duration == 0) { + if (ast_channel_dtmff(ast)->frametype == AST_FRAME_DTMF_BEGIN || duration == 0) { iks_insert_attrib(dtmf, "action", "button-down"); - } else if (ast->dtmff.frametype == AST_FRAME_DTMF_END || duration != 0) { + } else if (ast_channel_dtmff(ast)->frametype == AST_FRAME_DTMF_END || duration != 0) { iks_insert_attrib(dtmf, "action", "button-up"); } ast_aji_send(client->connection, iq); diff --git a/channels/chan_local.c b/channels/chan_local.c index 550625656..c6780d223 100644 --- a/channels/chan_local.c +++ b/channels/chan_local.c @@ -511,7 +511,7 @@ static void check_bridge(struct local_pvt *p) frames on the owner channel (because they would be transferred to the outbound channel during the masquerade) */ - if (p->chan->_bridge /* Not ast_bridged_channel! Only go one step! */ && AST_LIST_EMPTY(&p->owner->readq)) { + if (p->chan->_bridge /* Not ast_bridged_channel! Only go one step! */ && AST_LIST_EMPTY(ast_channel_readq(p->owner))) { /* Masquerade bridged channel into owner */ /* Lock everything we need, one by one, and give up if we can't get everything. Remember, we'll get another @@ -544,27 +544,18 @@ static void check_bridge(struct local_pvt *p) * thread (which is the to be masqueraded away local channel) before both local * channels are optimized away. */ - if (p->owner->caller.id.name.valid || p->owner->caller.id.number.valid - || p->owner->caller.id.subaddress.valid || p->owner->caller.ani.name.valid - || p->owner->caller.ani.number.valid || p->owner->caller.ani.subaddress.valid) { - struct ast_party_caller tmp; - tmp = p->owner->caller; - p->owner->caller = p->chan->_bridge->caller; - p->chan->_bridge->caller = tmp; + if (ast_channel_caller(p->owner)->id.name.valid || ast_channel_caller(p->owner)->id.number.valid + || ast_channel_caller(p->owner)->id.subaddress.valid || ast_channel_caller(p->owner)->ani.name.valid + || ast_channel_caller(p->owner)->ani.number.valid || ast_channel_caller(p->owner)->ani.subaddress.valid) { + SWAP(*ast_channel_caller(p->owner), *ast_channel_caller(p->chan->_bridge)); } - if (p->owner->redirecting.from.name.valid || p->owner->redirecting.from.number.valid - || p->owner->redirecting.from.subaddress.valid || p->owner->redirecting.to.name.valid - || p->owner->redirecting.to.number.valid || p->owner->redirecting.to.subaddress.valid) { - struct ast_party_redirecting tmp; - tmp = p->owner->redirecting; - p->owner->redirecting = p->chan->_bridge->redirecting; - p->chan->_bridge->redirecting = tmp; + if (ast_channel_redirecting(p->owner)->from.name.valid || ast_channel_redirecting(p->owner)->from.number.valid + || ast_channel_redirecting(p->owner)->from.subaddress.valid || ast_channel_redirecting(p->owner)->to.name.valid + || ast_channel_redirecting(p->owner)->to.number.valid || ast_channel_redirecting(p->owner)->to.subaddress.valid) { + SWAP(*ast_channel_redirecting(p->owner), *ast_channel_redirecting(p->chan->_bridge)); } - if (p->owner->dialed.number.str || p->owner->dialed.subaddress.valid) { - struct ast_party_dialed tmp; - tmp = p->owner->dialed; - p->owner->dialed = p->chan->_bridge->dialed; - p->chan->_bridge->dialed = tmp; + if (ast_channel_dialed(p->owner)->number.str || ast_channel_dialed(p->owner)->subaddress.valid) { + SWAP(*ast_channel_dialed(p->owner), *ast_channel_dialed(p->chan->_bridge)); } @@ -690,11 +681,11 @@ static int local_indicate(struct ast_channel *ast, int condition, const void *da unsigned char frame_data[1024]; if (condition == AST_CONTROL_CONNECTED_LINE) { if (isoutbound) { - ast_connected_line_copy_to_caller(&the_other_channel->caller, &this_channel->connected); + ast_connected_line_copy_to_caller(ast_channel_caller(the_other_channel), ast_channel_connected(this_channel)); } - f.datalen = ast_connected_line_build_data(frame_data, sizeof(frame_data), &this_channel->connected, NULL); + f.datalen = ast_connected_line_build_data(frame_data, sizeof(frame_data), ast_channel_connected(this_channel), NULL); } else { - f.datalen = ast_redirecting_build_data(frame_data, sizeof(frame_data), &this_channel->redirecting, NULL); + f.datalen = ast_redirecting_build_data(frame_data, sizeof(frame_data), ast_channel_redirecting(this_channel), NULL); } f.subclass.integer = condition; f.data.ptr = frame_data; @@ -853,12 +844,12 @@ static int local_call(struct ast_channel *ast, const char *dest, int timeout) * All these failure points just return -1. The individual strings will * be cleared when we destroy the channel. */ - ast_party_redirecting_copy(&chan->redirecting, &owner->redirecting); + ast_party_redirecting_copy(ast_channel_redirecting(chan), ast_channel_redirecting(owner)); - ast_party_dialed_copy(&chan->dialed, &owner->dialed); + ast_party_dialed_copy(ast_channel_dialed(chan), ast_channel_dialed(owner)); - ast_connected_line_copy_to_caller(&chan->caller, &owner->connected); - ast_connected_line_copy_from_caller(&chan->connected, &owner->caller); + ast_connected_line_copy_to_caller(ast_channel_caller(chan), ast_channel_connected(owner)); + ast_connected_line_copy_from_caller(ast_channel_connected(chan), ast_channel_caller(owner)); ast_channel_language_set(chan, ast_channel_language(owner)); ast_channel_accountcode_set(chan, ast_channel_accountcode(owner)); @@ -874,13 +865,13 @@ static int local_call(struct ast_channel *ast, const char *dest, int timeout) /* copy the channel variables from the incoming channel to the outgoing channel */ /* Note that due to certain assumptions, they MUST be in the same order */ - AST_LIST_TRAVERSE(&owner->varshead, varptr, entries) { + AST_LIST_TRAVERSE(ast_channel_varshead(owner), varptr, entries) { namelen = strlen(varptr->name); len = sizeof(struct ast_var_t) + namelen + strlen(varptr->value) + 2; if ((new = ast_calloc(1, len))) { memcpy(new, varptr, len); new->value = &(new->name[0]) + namelen + 1; - AST_LIST_INSERT_TAIL(&chan->varshead, new, entries); + AST_LIST_INSERT_TAIL(ast_channel_varshead(chan), new, entries); } } ast_channel_datastore_inherit(owner, chan); @@ -902,7 +893,7 @@ static int local_call(struct ast_channel *ast, const char *dest, int timeout) ast_channel_unlock(chan); if (!ast_exists_extension(chan, context, exten, 1, - S_COR(owner->caller.id.number.valid, owner->caller.id.number.str, NULL))) { + S_COR(ast_channel_caller(owner)->id.number.valid, ast_channel_caller(owner)->id.number.str, NULL))) { ast_log(LOG_NOTICE, "No such extension/context %s@%s while calling Local channel\n", exten, context); res = -1; chan = ast_channel_unref(chan); /* we already unlocked it, so clear it hear so the cleanup label won't touch it. */ diff --git a/channels/chan_mgcp.c b/channels/chan_mgcp.c index 9a49d0018..be8ecbf39 100644 --- a/channels/chan_mgcp.c +++ b/channels/chan_mgcp.c @@ -845,7 +845,7 @@ static int mgcp_call(struct ast_channel *ast, const char *dest, int timeout) ast_debug(3, "MGCP mgcp_call(%s)\n", ast_channel_name(ast)); sub = ast_channel_tech_pvt(ast); p = sub->parent; - headp = &ast->varshead; + headp = ast_channel_varshead(ast); AST_LIST_TRAVERSE(headp,current,entries) { /* Check whether there is an ALERT_INFO variable */ if (strcasecmp(ast_var_name(current),"ALERT_INFO") == 0) { @@ -900,8 +900,8 @@ static int mgcp_call(struct ast_channel *ast, const char *dest, int timeout) } transmit_notify_request_with_callerid(sub, tone, - S_COR(ast->connected.id.number.valid, ast->connected.id.number.str, ""), - S_COR(ast->connected.id.name.valid, ast->connected.id.name.str, "")); + S_COR(ast_channel_connected(ast)->id.number.valid, ast_channel_connected(ast)->id.number.str, ""), + S_COR(ast_channel_connected(ast)->id.name.valid, ast_channel_connected(ast)->id.name.str, "")); ast_setstate(ast, AST_STATE_RINGING); if (sub->next->owner && !ast_strlen_zero(sub->next->cxident) && !ast_strlen_zero(sub->next->callid)) { @@ -973,8 +973,8 @@ static int mgcp_hangup(struct ast_channel *ast) /* ncs fix! */ bridged = ast_bridged_channel(sub->next->owner); transmit_notify_request_with_callerid(p->sub, (p->ncs ? "L/wt1" : "L/wt"), - S_COR(bridged->caller.id.number.valid, bridged->caller.id.number.str, ""), - S_COR(bridged->caller.id.name.valid, bridged->caller.id.name.str, "")); + S_COR(ast_channel_caller(bridged)->id.number.valid, ast_channel_caller(bridged)->id.number.str, ""), + S_COR(ast_channel_caller(bridged)->id.name.valid, ast_channel_caller(bridged)->id.name.str, "")); } } else { /* set our other connection as the primary and swith over to it */ @@ -984,8 +984,8 @@ static int mgcp_hangup(struct ast_channel *ast) if (sub->next->owner && ast_bridged_channel(sub->next->owner)) { bridged = ast_bridged_channel(sub->next->owner); transmit_notify_request_with_callerid(p->sub, "L/rg", - S_COR(bridged->caller.id.number.valid, bridged->caller.id.number.str, ""), - S_COR(bridged->caller.id.name.valid, bridged->caller.id.name.str, "")); + S_COR(ast_channel_caller(bridged)->id.number.valid, ast_channel_caller(bridged)->id.number.str, ""), + S_COR(ast_channel_caller(bridged)->id.name.valid, ast_channel_caller(bridged)->id.name.str, "")); } } @@ -1540,8 +1540,8 @@ static struct ast_channel *mgcp_new(struct mgcp_subchannel *sub, int state, cons /* Don't use ast_set_callerid() here because it will * generate a needless NewCallerID event */ if (!ast_strlen_zero(i->cid_num)) { - tmp->caller.ani.number.valid = 1; - tmp->caller.ani.number.str = ast_strdup(i->cid_num); + ast_channel_caller(tmp)->ani.number.valid = 1; + ast_channel_caller(tmp)->ani.number.str = ast_strdup(i->cid_num); } if (!i->adsi) { @@ -3022,12 +3022,12 @@ static void *mgcp_ss(void *data) /*res = tone_zone_play_tone(p->subs[index].zfd, -1);*/ ast_indicate(chan, -1); ast_channel_exten_set(chan, p->dtmf_buf); - chan->dialed.number.str = ast_strdup(p->dtmf_buf); + ast_channel_dialed(chan)->number.str = ast_strdup(p->dtmf_buf); memset(p->dtmf_buf, 0, sizeof(p->dtmf_buf)); ast_set_callerid(chan, p->hidecallerid ? "" : p->cid_num, p->hidecallerid ? "" : p->cid_name, - chan->caller.ani.number.valid ? NULL : p->cid_num); + ast_channel_caller(chan)->ani.number.valid ? NULL : p->cid_num); ast_setstate(chan, AST_STATE_RING); /*dahdi_enable_ec(p);*/ if (p->dtmfmode & MGCP_DTMF_HYBRID) { @@ -3157,10 +3157,10 @@ static void *mgcp_ss(void *data) memset(p->dtmf_buf, 0, sizeof(p->dtmf_buf)); timeout = firstdigittimeout; } else if (!ast_canmatch_extension(chan, ast_channel_context(chan), p->dtmf_buf, 1, - S_COR(chan->caller.id.number.valid, chan->caller.id.number.str, NULL)) + S_COR(ast_channel_caller(chan)->id.number.valid, ast_channel_caller(chan)->id.number.str, NULL)) && ((p->dtmf_buf[0] != '*') || (strlen(p->dtmf_buf) > 2))) { ast_debug(1, "Can't match %s from '%s' in context %s\n", p->dtmf_buf, - S_COR(chan->caller.id.number.valid, chan->caller.id.number.str, ""), + S_COR(ast_channel_caller(chan)->id.number.valid, ast_channel_caller(chan)->id.number.str, ""), ast_channel_context(chan)); break; } diff --git a/channels/chan_misdn.c b/channels/chan_misdn.c index c7ca07b99..62aa020d2 100644 --- a/channels/chan_misdn.c +++ b/channels/chan_misdn.c @@ -4151,10 +4151,10 @@ static void print_bc_info(int fd, struct chan_list *help, struct misdn_bchannel bc->nt ? "NT" : "TE", help->originator == ORG_AST ? "*" : "I", ast ? ast_channel_exten(ast) : "", - (ast && ast->caller.id.name.valid && ast->caller.id.name.str) - ? ast->caller.id.name.str : "", - (ast && ast->caller.id.number.valid && ast->caller.id.number.str) - ? ast->caller.id.number.str : "", + (ast && ast_channel_caller(ast)->id.name.valid && ast_channel_caller(ast)->id.name.str) + ? ast_channel_caller(ast)->id.name.str : "", + (ast && ast_channel_caller(ast)->id.number.valid && ast_channel_caller(ast)->id.number.str) + ? ast_channel_caller(ast)->id.number.str : "", bc->redirecting.from.name, bc->redirecting.from.number, bc->redirecting.to.name, @@ -4253,15 +4253,15 @@ static char *handle_cli_misdn_show_channels(struct ast_cli_entry *e, int cmd, st " --> hold_channel: %d\n", help->l3id, ast_channel_exten(ast), - S_COR(ast->caller.id.name.valid, ast->caller.id.name.str, ""), - S_COR(ast->caller.id.number.valid, ast->caller.id.number.str, ""), + S_COR(ast_channel_caller(ast)->id.name.valid, ast_channel_caller(ast)->id.name.str, ""), + S_COR(ast_channel_caller(ast)->id.number.valid, ast_channel_caller(ast)->id.number.str, ""), help->hold.port, help->hold.channel ); } else { ast_cli(a->fd, "* Channel in unknown STATE !!! Exten:%s, Callerid:%s\n", ast_channel_exten(ast), - S_COR(ast->caller.id.number.valid, ast->caller.id.number.str, "")); + S_COR(ast_channel_caller(ast)->id.number.valid, ast_channel_caller(ast)->id.number.str, "")); } } } @@ -5772,12 +5772,12 @@ static void update_config(struct chan_list *ch) chan_misdn_log(2, port, " --> pres: %d screen: %d\n", pres, screen); if (pres < 0 || screen < 0) { - chan_misdn_log(2, port, " --> pres: %x\n", ast->connected.id.number.presentation); + chan_misdn_log(2, port, " --> pres: %x\n", ast_channel_connected(ast)->id.number.presentation); - bc->caller.presentation = ast_to_misdn_pres(ast->connected.id.number.presentation); + bc->caller.presentation = ast_to_misdn_pres(ast_channel_connected(ast)->id.number.presentation); chan_misdn_log(2, port, " --> PRES: %s(%d)\n", misdn_to_str_pres(bc->caller.presentation), bc->caller.presentation); - bc->caller.screening = ast_to_misdn_screen(ast->connected.id.number.presentation); + bc->caller.screening = ast_to_misdn_screen(ast_channel_connected(ast)->id.number.presentation); chan_misdn_log(2, port, " --> SCREEN: %s(%d)\n", misdn_to_str_screen(bc->caller.screening), bc->caller.screening); } else { bc->caller.screening = screen; @@ -6116,7 +6116,7 @@ static void misdn_update_caller_id(struct ast_channel *ast, const struct misdn_p update_caller.ani.number = 1; ast_channel_lock(ast); - ast_party_caller_set_init(&caller, &ast->caller); + ast_party_caller_set_init(&caller, ast_channel_caller(ast)); caller.id.number.valid = 1; caller.id.number.str = (char *) id->number; @@ -6169,15 +6169,15 @@ static void misdn_get_connected_line(struct ast_channel *ast, struct misdn_bchan /* ORIGINATOR MISDN (incoming call) */ ast_copy_string(bc->connected.name, - S_COR(ast->connected.id.name.valid, ast->connected.id.name.str, ""), + S_COR(ast_channel_connected(ast)->id.name.valid, ast_channel_connected(ast)->id.name.str, ""), sizeof(bc->connected.name)); - if (ast->connected.id.number.valid) { - ast_copy_string(bc->connected.number, S_OR(ast->connected.id.number.str, ""), + if (ast_channel_connected(ast)->id.number.valid) { + ast_copy_string(bc->connected.number, S_OR(ast_channel_connected(ast)->id.number.str, ""), sizeof(bc->connected.number)); - bc->connected.presentation = ast_to_misdn_pres(ast->connected.id.number.presentation); - bc->connected.screening = ast_to_misdn_screen(ast->connected.id.number.presentation); - bc->connected.number_type = ast_to_misdn_ton(ast->connected.id.number.plan); - bc->connected.number_plan = ast_to_misdn_plan(ast->connected.id.number.plan); + bc->connected.presentation = ast_to_misdn_pres(ast_channel_connected(ast)->id.number.presentation); + bc->connected.screening = ast_to_misdn_screen(ast_channel_connected(ast)->id.number.presentation); + bc->connected.number_type = ast_to_misdn_ton(ast_channel_connected(ast)->id.number.plan); + bc->connected.number_plan = ast_to_misdn_plan(ast_channel_connected(ast)->id.number.plan); } else { bc->connected.number[0] = '\0'; bc->connected.presentation = 0;/* Allowed */ @@ -6197,15 +6197,15 @@ static void misdn_get_connected_line(struct ast_channel *ast, struct misdn_bchan /* ORIGINATOR Asterisk (outgoing call) */ ast_copy_string(bc->caller.name, - S_COR(ast->connected.id.name.valid, ast->connected.id.name.str, ""), + S_COR(ast_channel_connected(ast)->id.name.valid, ast_channel_connected(ast)->id.name.str, ""), sizeof(bc->caller.name)); - if (ast->connected.id.number.valid) { - ast_copy_string(bc->caller.number, S_OR(ast->connected.id.number.str, ""), + if (ast_channel_connected(ast)->id.number.valid) { + ast_copy_string(bc->caller.number, S_OR(ast_channel_connected(ast)->id.number.str, ""), sizeof(bc->caller.number)); - bc->caller.presentation = ast_to_misdn_pres(ast->connected.id.number.presentation); - bc->caller.screening = ast_to_misdn_screen(ast->connected.id.number.presentation); - bc->caller.number_type = ast_to_misdn_ton(ast->connected.id.number.plan); - bc->caller.number_plan = ast_to_misdn_plan(ast->connected.id.number.plan); + bc->caller.presentation = ast_to_misdn_pres(ast_channel_connected(ast)->id.number.presentation); + bc->caller.screening = ast_to_misdn_screen(ast_channel_connected(ast)->id.number.presentation); + bc->caller.number_type = ast_to_misdn_ton(ast_channel_connected(ast)->id.number.plan); + bc->caller.number_plan = ast_to_misdn_plan(ast_channel_connected(ast)->id.number.plan); } else { bc->caller.number[0] = '\0'; bc->caller.presentation = 0;/* Allowed */ @@ -6319,15 +6319,15 @@ static void misdn_update_connected_line(struct ast_channel *ast, struct misdn_bc static void misdn_copy_redirecting_from_ast(struct misdn_bchannel *bc, struct ast_channel *ast) { ast_copy_string(bc->redirecting.from.name, - S_COR(ast->redirecting.from.name.valid, ast->redirecting.from.name.str, ""), + S_COR(ast_channel_redirecting(ast)->from.name.valid, ast_channel_redirecting(ast)->from.name.str, ""), sizeof(bc->redirecting.from.name)); - if (ast->redirecting.from.number.valid) { - ast_copy_string(bc->redirecting.from.number, S_OR(ast->redirecting.from.number.str, ""), + if (ast_channel_redirecting(ast)->from.number.valid) { + ast_copy_string(bc->redirecting.from.number, S_OR(ast_channel_redirecting(ast)->from.number.str, ""), sizeof(bc->redirecting.from.number)); - bc->redirecting.from.presentation = ast_to_misdn_pres(ast->redirecting.from.number.presentation); - bc->redirecting.from.screening = ast_to_misdn_screen(ast->redirecting.from.number.presentation); - bc->redirecting.from.number_type = ast_to_misdn_ton(ast->redirecting.from.number.plan); - bc->redirecting.from.number_plan = ast_to_misdn_plan(ast->redirecting.from.number.plan); + bc->redirecting.from.presentation = ast_to_misdn_pres(ast_channel_redirecting(ast)->from.number.presentation); + bc->redirecting.from.screening = ast_to_misdn_screen(ast_channel_redirecting(ast)->from.number.presentation); + bc->redirecting.from.number_type = ast_to_misdn_ton(ast_channel_redirecting(ast)->from.number.plan); + bc->redirecting.from.number_plan = ast_to_misdn_plan(ast_channel_redirecting(ast)->from.number.plan); } else { bc->redirecting.from.number[0] = '\0'; bc->redirecting.from.presentation = 0;/* Allowed */ @@ -6337,15 +6337,15 @@ static void misdn_copy_redirecting_from_ast(struct misdn_bchannel *bc, struct as } ast_copy_string(bc->redirecting.to.name, - S_COR(ast->redirecting.to.name.valid, ast->redirecting.to.name.str, ""), + S_COR(ast_channel_redirecting(ast)->to.name.valid, ast_channel_redirecting(ast)->to.name.str, ""), sizeof(bc->redirecting.to.name)); - if (ast->redirecting.to.number.valid) { - ast_copy_string(bc->redirecting.to.number, S_OR(ast->redirecting.to.number.str, ""), + if (ast_channel_redirecting(ast)->to.number.valid) { + ast_copy_string(bc->redirecting.to.number, S_OR(ast_channel_redirecting(ast)->to.number.str, ""), sizeof(bc->redirecting.to.number)); - bc->redirecting.to.presentation = ast_to_misdn_pres(ast->redirecting.to.number.presentation); - bc->redirecting.to.screening = ast_to_misdn_screen(ast->redirecting.to.number.presentation); - bc->redirecting.to.number_type = ast_to_misdn_ton(ast->redirecting.to.number.plan); - bc->redirecting.to.number_plan = ast_to_misdn_plan(ast->redirecting.to.number.plan); + bc->redirecting.to.presentation = ast_to_misdn_pres(ast_channel_redirecting(ast)->to.number.presentation); + bc->redirecting.to.screening = ast_to_misdn_screen(ast_channel_redirecting(ast)->to.number.presentation); + bc->redirecting.to.number_type = ast_to_misdn_ton(ast_channel_redirecting(ast)->to.number.plan); + bc->redirecting.to.number_plan = ast_to_misdn_plan(ast_channel_redirecting(ast)->to.number.plan); } else { bc->redirecting.to.number[0] = '\0'; bc->redirecting.to.presentation = 0;/* Allowed */ @@ -6354,8 +6354,8 @@ static void misdn_copy_redirecting_from_ast(struct misdn_bchannel *bc, struct as bc->redirecting.to.number_plan = NUMPLAN_UNKNOWN; } - bc->redirecting.reason = ast_to_misdn_reason(ast->redirecting.reason); - bc->redirecting.count = ast->redirecting.count; + bc->redirecting.reason = ast_to_misdn_reason(ast_channel_redirecting(ast)->reason); + bc->redirecting.count = ast_channel_redirecting(ast)->count; } /*! @@ -6373,7 +6373,7 @@ static void misdn_copy_redirecting_to_ast(struct ast_channel *ast, const struct struct ast_party_redirecting redirecting; struct ast_set_party_redirecting update_redirecting; - ast_party_redirecting_set_init(&redirecting, &ast->redirecting); + ast_party_redirecting_set_init(&redirecting, ast_channel_redirecting(ast)); memset(&update_redirecting, 0, sizeof(update_redirecting)); update_redirecting.from.number = 1; @@ -6598,15 +6598,15 @@ static int misdn_call(struct ast_channel *ast, const char *dest, int timeout) ast_copy_string(newbc->dialed.number, args.ext, sizeof(newbc->dialed.number)); if (ast_strlen_zero(newbc->caller.name) - && ast->connected.id.name.valid - && !ast_strlen_zero(ast->connected.id.name.str)) { - ast_copy_string(newbc->caller.name, ast->connected.id.name.str, sizeof(newbc->caller.name)); + && ast_channel_connected(ast)->id.name.valid + && !ast_strlen_zero(ast_channel_connected(ast)->id.name.str)) { + ast_copy_string(newbc->caller.name, ast_channel_connected(ast)->id.name.str, sizeof(newbc->caller.name)); chan_misdn_log(3, port, " --> * set caller:\"%s\" <%s>\n", newbc->caller.name, newbc->caller.number); } if (ast_strlen_zero(newbc->caller.number) - && ast->connected.id.number.valid - && !ast_strlen_zero(ast->connected.id.number.str)) { - ast_copy_string(newbc->caller.number, ast->connected.id.number.str, sizeof(newbc->caller.number)); + && ast_channel_connected(ast)->id.number.valid + && !ast_strlen_zero(ast_channel_connected(ast)->id.number.str)) { + ast_copy_string(newbc->caller.number, ast_channel_connected(ast)->id.number.str, sizeof(newbc->caller.number)); chan_misdn_log(3, port, " --> * set caller:\"%s\" <%s>\n", newbc->caller.name, newbc->caller.number); } @@ -6616,13 +6616,13 @@ static int misdn_call(struct ast_channel *ast, const char *dest, int timeout) strncat(newbc->incoming_cid_tag, newbc->caller.number, sizeof(newbc->incoming_cid_tag) - strlen(newbc->incoming_cid_tag) - 1); } - ast->caller.id.tag = ast_strdup(newbc->incoming_cid_tag); + ast_channel_caller(ast)->id.tag = ast_strdup(newbc->incoming_cid_tag); misdn_cfg_get(port, MISDN_CFG_LOCALDIALPLAN, &number_type, sizeof(number_type)); if (number_type < 0) { - if (ast->connected.id.number.valid) { - newbc->caller.number_type = ast_to_misdn_ton(ast->connected.id.number.plan); - newbc->caller.number_plan = ast_to_misdn_plan(ast->connected.id.number.plan); + if (ast_channel_connected(ast)->id.number.valid) { + newbc->caller.number_type = ast_to_misdn_ton(ast_channel_connected(ast)->id.number.plan); + newbc->caller.number_plan = ast_to_misdn_plan(ast_channel_connected(ast)->id.number.plan); } else { newbc->caller.number_type = NUMTYPE_UNKNOWN; newbc->caller.number_plan = NUMPLAN_ISDN; @@ -7142,10 +7142,10 @@ static int misdn_hangup(struct ast_channel *ast) bc->pid, ast_channel_context(ast), ast_channel_exten(ast), - (ast->caller.id.name.valid && ast->caller.id.name.str) - ? ast->caller.id.name.str : "", - (ast->caller.id.number.valid && ast->caller.id.number.str) - ? ast->caller.id.number.str : "", + (ast_channel_caller(ast)->id.name.valid && ast_channel_caller(ast)->id.name.str) + ? ast_channel_caller(ast)->id.name.str : "", + (ast_channel_caller(ast)->id.number.valid && ast_channel_caller(ast)->id.number.str) + ? ast_channel_caller(ast)->id.number.str : "", misdn_get_ch_state(p)); chan_misdn_log(3, bc->port, " --> l3id:%x\n", p->l3id); chan_misdn_log(3, bc->port, " --> cause:%d\n", bc->cause); @@ -7286,7 +7286,7 @@ static struct ast_frame *process_ast_dsp(struct chan_list *tmp, struct ast_frame misdn_cfg_get(tmp->bc->port, MISDN_CFG_FAXDETECT_CONTEXT, &context_tmp, sizeof(context_tmp)); context = S_OR(context_tmp, S_OR(ast_channel_macrocontext(ast), ast_channel_context(ast))); if (ast_exists_extension(ast, context, "fax", 1, - S_COR(ast->caller.id.number.valid, ast->caller.id.number.str, NULL))) { + S_COR(ast_channel_caller(ast)->id.number.valid, ast_channel_caller(ast)->id.number.str, NULL))) { ast_verb(3, "Redirecting %s to fax extension (context:%s)\n", ast_channel_name(ast), context); /* Save the DID/DNIS when we transfer the fax call to a "fax" extension */ pbx_builtin_setvar_helper(ast,"FAXEXTEN",ast_channel_exten(ast)); @@ -7482,7 +7482,7 @@ static int misdn_write(struct ast_channel *ast, struct ast_frame *frame) chan_misdn_log(5, ch->bc->port, "BC not active (nor bridged) dropping: %d frames addr:%x exten:%s cid:%s ch->state:%s bc_state:%d l3id:%x\n", frame->samples, ch->bc->addr, ast_channel_exten(ast), - S_COR(ast->caller.id.number.valid, ast->caller.id.number.str, ""), + S_COR(ast_channel_caller(ast)->id.number.valid, ast_channel_caller(ast)->id.number.str, ""), misdn_get_ch_state(ch), ch->bc->bc_state, ch->bc->l3_id); } @@ -8161,8 +8161,8 @@ static struct ast_channel *misdn_new(struct chan_list *chlist, int state, char if (!ast_strlen_zero(cid_num)) { /* Don't use ast_set_callerid() here because it will * generate a needless NewCallerID event */ - tmp->caller.ani.number.valid = 1; - tmp->caller.ani.number.str = ast_strdup(cid_num); + ast_channel_caller(tmp)->ani.number.valid = 1; + ast_channel_caller(tmp)->ani.number.str = ast_strdup(cid_num); } if (pipe(chlist->pipe) < 0) { @@ -8452,8 +8452,8 @@ static void release_chan(struct chan_list *ch, struct misdn_bchannel *bc) bc->pid, ast_channel_context(ast), ast_channel_exten(ast), - S_COR(ast->caller.id.name.valid, ast->caller.id.name.str, ""), - S_COR(ast->caller.id.number.valid, ast->caller.id.number.str, "")); + S_COR(ast_channel_caller(ast)->id.name.valid, ast_channel_caller(ast)->id.name.str, ""), + S_COR(ast_channel_caller(ast)->id.number.valid, ast_channel_caller(ast)->id.number.str, "")); if (ast_channel_state(ast) != AST_STATE_RESERVED) { chan_misdn_log(3, bc->port, " --> Setting AST State to down\n"); @@ -8581,9 +8581,9 @@ static int misdn_attempt_transfer(struct chan_list *active_ch, struct chan_list ast_channel_name(held_ch->ast), ast_channel_name(target)); ast_party_connected_line_init(&target_colp); - ast_party_connected_line_copy(&target_colp, &target->connected); + ast_party_connected_line_copy(&target_colp, ast_channel_connected(target)); ast_party_connected_line_init(&transferee_colp); - ast_party_connected_line_copy(&transferee_colp, &held_ch->ast->connected); + ast_party_connected_line_copy(&transferee_colp, ast_channel_connected(held_ch->ast)); held_ch->hold.state = MISDN_HOLD_TRANSFER; /* @@ -8640,10 +8640,10 @@ static void do_immediate_setup(struct misdn_bchannel *bc, struct chan_list *ch, "* Starting Ast context:%s dialed:%s caller:\"%s\" <%s> with 's' extension\n", ast_channel_context(ast), ast_channel_exten(ast), - (ast->caller.id.name.valid && ast->caller.id.name.str) - ? ast->caller.id.name.str : "", - (ast->caller.id.number.valid && ast->caller.id.number.str) - ? ast->caller.id.number.str : ""); + (ast_channel_caller(ast)->id.name.valid && ast_channel_caller(ast)->id.name.str) + ? ast_channel_caller(ast)->id.name.str : "", + (ast_channel_caller(ast)->id.number.valid && ast_channel_caller(ast)->id.number.str) + ? ast_channel_caller(ast)->id.number.str : ""); ast_channel_exten_set(ast, "s"); @@ -8925,8 +8925,8 @@ static void misdn_cc_pbx_notify(long record_id, const struct misdn_cc_notify *no return; } ast_channel_priority_set(chan, notify->priority); - ast_free(chan->dialed.number.str); - chan->dialed.number.str = ast_strdup(notify->exten); + ast_free(ast_channel_dialed(chan)->number.str); + ast_channel_dialed(chan)->number.str = ast_strdup(notify->exten); if (ast_pbx_start(chan)) { ast_log(LOG_WARNING, "Unable to start pbx channel %s!\n", ast_channel_name(chan)); @@ -9260,11 +9260,11 @@ static void misdn_facility_ie_handler(enum event_e event, struct misdn_bchannel bc->div_leg_3_rx_wanted = 0; if (ch && ch->ast) { - ch->ast->redirecting.to.number.presentation = + ast_channel_redirecting(ch->ast)->to.number.presentation = bc->fac_in.u.DivertingLegInformation3.PresentationAllowedIndicator ? AST_PRES_ALLOWED | AST_PRES_USER_NUMBER_UNSCREENED : AST_PRES_RESTRICTED | AST_PRES_USER_NUMBER_UNSCREENED; - ast_channel_queue_redirecting_update(ch->ast, &ch->ast->redirecting, NULL); + ast_channel_queue_redirecting_update(ch->ast, ast_channel_redirecting(ch->ast), NULL); } } break; @@ -10176,12 +10176,12 @@ cb_events(enum event_e event, struct misdn_bchannel *bc, void *user_data) /* Update asterisk channel caller information */ chan_misdn_log(2, bc->port, " --> TON: %s(%d)\n", misdn_to_str_ton(bc->caller.number_type), bc->caller.number_type); chan_misdn_log(2, bc->port, " --> PLAN: %s(%d)\n", misdn_to_str_plan(bc->caller.number_plan), bc->caller.number_plan); - chan->caller.id.number.plan = misdn_to_ast_ton(bc->caller.number_type) + ast_channel_caller(chan)->id.number.plan = misdn_to_ast_ton(bc->caller.number_type) | misdn_to_ast_plan(bc->caller.number_plan); chan_misdn_log(2, bc->port, " --> PRES: %s(%d)\n", misdn_to_str_pres(bc->caller.presentation), bc->caller.presentation); chan_misdn_log(2, bc->port, " --> SCREEN: %s(%d)\n", misdn_to_str_screen(bc->caller.screening), bc->caller.screening); - chan->caller.id.number.presentation = misdn_to_ast_pres(bc->caller.presentation) + ast_channel_caller(chan)->id.number.presentation = misdn_to_ast_pres(bc->caller.presentation) | misdn_to_ast_screen(bc->caller.screening); ast_set_callerid(chan, bc->caller.number, NULL, bc->caller.number); @@ -10193,7 +10193,7 @@ cb_events(enum event_e event, struct misdn_bchannel *bc, void *user_data) } ast_channel_lock(chan); - chan->caller.id.tag = ast_strdup(bc->incoming_cid_tag); + ast_channel_caller(chan)->id.tag = ast_strdup(bc->incoming_cid_tag); ast_channel_unlock(chan); if (!ast_strlen_zero(bc->redirecting.from.number)) { @@ -10495,9 +10495,9 @@ cb_events(enum event_e event, struct misdn_bchannel *bc, void *user_data) bc->div_leg_3_rx_wanted = 0; if (ch->ast) { - ch->ast->redirecting.to.number.presentation = + ast_channel_redirecting(ch->ast)->to.number.presentation = AST_PRES_RESTRICTED | AST_PRES_USER_NUMBER_UNSCREENED; - ast_channel_queue_redirecting_update(ch->ast, &ch->ast->redirecting, NULL); + ast_channel_queue_redirecting_update(ch->ast, ast_channel_redirecting(ch->ast), NULL); } } #endif /* defined(AST_MISDN_ENHANCEMENTS) */ @@ -10934,7 +10934,7 @@ cb_events(enum event_e event, struct misdn_bchannel *bc, void *user_data) break; } misdn_copy_redirecting_to_ast(ch->ast, &bc->redirecting, bc->incoming_cid_tag); - ast_channel_queue_redirecting_update(ch->ast, &ch->ast->redirecting, NULL); + ast_channel_queue_redirecting_update(ch->ast, ast_channel_redirecting(ch->ast), NULL); break; case mISDN_NOTIFY_CODE_CALL_TRANSFER_ALERTING: /* diff --git a/channels/chan_oss.c b/channels/chan_oss.c index 47a995842..ddd559af1 100644 --- a/channels/chan_oss.c +++ b/channels/chan_oss.c @@ -604,10 +604,10 @@ static int oss_call(struct ast_channel *c, const char *dest, int timeout) ast_verbose(" << Call to device '%s' dnid '%s' rdnis '%s' on console from '%s' <%s> >>\n", dest, - S_OR(c->dialed.number.str, ""), - S_COR(c->redirecting.from.number.valid, c->redirecting.from.number.str, ""), - S_COR(c->caller.id.name.valid, c->caller.id.name.str, ""), - S_COR(c->caller.id.number.valid, c->caller.id.number.str, "")); + S_OR(ast_channel_dialed(c)->number.str, ""), + S_COR(ast_channel_redirecting(c)->from.number.valid, ast_channel_redirecting(c)->from.number.str, ""), + S_COR(ast_channel_caller(c)->id.name.valid, ast_channel_caller(c)->id.name.str, ""), + S_COR(ast_channel_caller(c)->id.number.valid, ast_channel_caller(c)->id.number.str, "")); if (!ast_strlen_zero(args.flags) && strcasecmp(args.flags, "answer") == 0) { f.subclass.integer = AST_CONTROL_ANSWER; ast_queue_frame(c, &f); @@ -812,11 +812,11 @@ static struct ast_channel *oss_new(struct chan_oss_pvt *o, char *ext, char *ctx, /* Don't use ast_set_callerid() here because it will * generate a needless NewCallerID event */ if (!ast_strlen_zero(o->cid_num)) { - c->caller.ani.number.valid = 1; - c->caller.ani.number.str = ast_strdup(o->cid_num); + ast_channel_caller(c)->ani.number.valid = 1; + ast_channel_caller(c)->ani.number.str = ast_strdup(o->cid_num); } if (!ast_strlen_zero(ext)) { - c->dialed.number.str = ast_strdup(ext); + ast_channel_dialed(c)->number.str = ast_strdup(ext); } o->owner = c; @@ -1195,7 +1195,7 @@ static char *console_transfer(struct ast_cli_entry *e, int cmd, struct ast_cli_a if (ctx == NULL) /* supply default context if needed */ ctx = ast_strdupa(ast_channel_context(o->owner)); if (!ast_exists_extension(b, ctx, ext, 1, - S_COR(b->caller.id.number.valid, b->caller.id.number.str, NULL))) { + S_COR(ast_channel_caller(b)->id.number.valid, ast_channel_caller(b)->id.number.str, NULL))) { ast_cli(a->fd, "No such extension exists\n"); } else { ast_cli(a->fd, "Whee, transferring %s to %s@%s.\n", ast_channel_name(b), ext, ctx); diff --git a/channels/chan_phone.c b/channels/chan_phone.c index 053174793..c071793ac 100644 --- a/channels/chan_phone.c +++ b/channels/chan_phone.c @@ -301,15 +301,15 @@ static int phone_call(struct ast_channel *ast, const char *dest, int timeout) snprintf(cid.hour, sizeof(cid.hour), "%02d", tm.tm_hour); snprintf(cid.min, sizeof(cid.min), "%02d", tm.tm_min); /* the standard format of ast->callerid is: "name" , but not always complete */ - if (!ast->connected.id.name.valid - || ast_strlen_zero(ast->connected.id.name.str)) { + if (!ast_channel_connected(ast)->id.name.valid + || ast_strlen_zero(ast_channel_connected(ast)->id.name.str)) { strcpy(cid.name, DEFAULT_CALLER_ID); } else { - ast_copy_string(cid.name, ast->connected.id.name.str, sizeof(cid.name)); + ast_copy_string(cid.name, ast_channel_connected(ast)->id.name.str, sizeof(cid.name)); } - if (ast->connected.id.number.valid && ast->connected.id.number.str) { - ast_copy_string(cid.number, ast->connected.id.number.str, sizeof(cid.number)); + if (ast_channel_connected(ast)->id.number.valid && ast_channel_connected(ast)->id.number.str) { + ast_copy_string(cid.number, ast_channel_connected(ast)->id.number.str, sizeof(cid.number)); } p = ast_channel_tech_pvt(ast); @@ -885,8 +885,8 @@ static struct ast_channel *phone_new(struct phone_pvt *i, int state, char *cntx, /* Don't use ast_set_callerid() here because it will * generate a NewCallerID event before the NewChannel event */ if (!ast_strlen_zero(i->cid_num)) { - tmp->caller.ani.number.valid = 1; - tmp->caller.ani.number.str = ast_strdup(i->cid_num); + ast_channel_caller(tmp)->ani.number.valid = 1; + ast_channel_caller(tmp)->ani.number.str = ast_strdup(i->cid_num); } i->owner = tmp; diff --git a/channels/chan_sip.c b/channels/chan_sip.c index 046ef5757..b3bb4eb55 100644 --- a/channels/chan_sip.c +++ b/channels/chan_sip.c @@ -5643,7 +5643,7 @@ static int sip_call(struct ast_channel *ast, const char *dest, int timeout) } /* Check whether there is vxml_url, distinctive ring variables */ - headp=&ast->varshead; + headp=ast_channel_varshead(ast); AST_LIST_TRAVERSE(headp, current, entries) { /* Check whether there is a VXML_URL variable */ if (!p->options->vxml_url && !strcasecmp(ast_var_name(current), "VXML_URL")) { @@ -5727,7 +5727,7 @@ static int sip_call(struct ast_channel *ast, const char *dest, int timeout) ast_channel_hangupcause_set(ast, AST_CAUSE_USER_BUSY); return res; } - p->callingpres = ast_party_id_presentation(&ast->caller.id); + p->callingpres = ast_party_id_presentation(&ast_channel_caller(ast)->id); ast_rtp_instance_available_formats(p->rtp, p->caps, p->prefcaps, p->jointcaps); p->jointnoncodeccapability = p->noncodeccapability; @@ -7139,7 +7139,7 @@ static struct ast_channel *sip_new(struct sip_pvt *i, int state, const char *tit ast_channel_lock(tmp); sip_pvt_lock(i); ast_channel_cc_params_init(tmp, i->cc_params); - tmp->caller.id.tag = ast_strdup(i->cid_tag); + ast_channel_caller(tmp)->id.tag = ast_strdup(i->cid_tag); ast_channel_tech_set(tmp, (ast_test_flag(&i->flags[0], SIP_DTMF) == SIP_DTMF_INFO || ast_test_flag(&i->flags[0], SIP_DTMF) == SIP_DTMF_SHORTINFO) ? &sip_tech_info : &sip_tech); @@ -7242,8 +7242,8 @@ static struct ast_channel *sip_new(struct sip_pvt *i, int state, const char *tit tmp->callgroup = i->callgroup; tmp->pickupgroup = i->pickupgroup; - tmp->caller.id.name.presentation = i->callingpres; - tmp->caller.id.number.presentation = i->callingpres; + ast_channel_caller(tmp)->id.name.presentation = i->callingpres; + ast_channel_caller(tmp)->id.number.presentation = i->callingpres; if (!ast_strlen_zero(i->parkinglot)) { ast_channel_parkinglot_set(tmp, i->parkinglot); } @@ -7283,16 +7283,16 @@ static struct ast_channel *sip_new(struct sip_pvt *i, int state, const char *tit /* Don't use ast_set_callerid() here because it will * generate an unnecessary NewCallerID event */ if (!ast_strlen_zero(i->cid_num)) { - tmp->caller.ani.number.valid = 1; - tmp->caller.ani.number.str = ast_strdup(i->cid_num); + ast_channel_caller(tmp)->ani.number.valid = 1; + ast_channel_caller(tmp)->ani.number.str = ast_strdup(i->cid_num); } if (!ast_strlen_zero(i->rdnis)) { - tmp->redirecting.from.number.valid = 1; - tmp->redirecting.from.number.str = ast_strdup(i->rdnis); + ast_channel_redirecting(tmp)->from.number.valid = 1; + ast_channel_redirecting(tmp)->from.number.str = ast_strdup(i->rdnis); } if (!ast_strlen_zero(i->exten) && strcmp(i->exten, "s")) { - tmp->dialed.number.str = ast_strdup(i->exten); + ast_channel_dialed(tmp)->number.str = ast_strdup(i->exten); } ast_channel_priority_set(tmp, 1); @@ -7628,7 +7628,7 @@ static struct ast_frame *sip_read(struct ast_channel *ast) sip_pvt_unlock(p); ast_channel_unlock(ast); if (ast_exists_extension(ast, target_context, "fax", 1, - S_COR(ast->caller.id.number.valid, ast->caller.id.number.str, NULL))) { + S_COR(ast_channel_caller(ast)->id.number.valid, ast_channel_caller(ast)->id.number.str, NULL))) { ast_channel_lock(ast); sip_pvt_lock(p); ast_verb(2, "Redirecting '%s' to fax extension due to CNG detection\n", ast_channel_name(ast)); @@ -9605,7 +9605,7 @@ static int process_sdp(struct sip_pvt *p, struct sip_request *req, int t38action const char *target_context = S_OR(ast_channel_macrocontext(p->owner), ast_channel_context(p->owner)); ast_channel_unlock(p->owner); if (ast_exists_extension(p->owner, target_context, "fax", 1, - S_COR(p->owner->caller.id.number.valid, p->owner->caller.id.number.str, NULL))) { + S_COR(ast_channel_caller(p->owner)->id.number.valid, ast_channel_caller(p->owner)->id.number.str, NULL))) { ast_verb(2, "Redirecting '%s' to fax extension due to peer T.38 re-INVITE\n", ast_channel_name(p->owner)); pbx_builtin_setvar_helper(p->owner, "FAXEXTEN", ast_channel_exten(p->owner)); if (ast_async_goto(p->owner, target_context, "fax", 1)) { @@ -11230,15 +11230,15 @@ static int add_rpid(struct sip_request *req, struct sip_pvt *p) return 0; } - if (p->owner && p->owner->connected.id.number.valid - && p->owner->connected.id.number.str) { - lid_num = p->owner->connected.id.number.str; + if (p->owner && ast_channel_connected(p->owner)->id.number.valid + && ast_channel_connected(p->owner)->id.number.str) { + lid_num = ast_channel_connected(p->owner)->id.number.str; } - if (p->owner && p->owner->connected.id.name.valid - && p->owner->connected.id.name.str) { - lid_name = p->owner->connected.id.name.str; + if (p->owner && ast_channel_connected(p->owner)->id.name.valid + && ast_channel_connected(p->owner)->id.name.str) { + lid_name = ast_channel_connected(p->owner)->id.name.str; } - lid_pres = (p->owner) ? ast_party_id_presentation(&p->owner->connected.id) : AST_PRES_NUMBER_NOT_AVAILABLE; + lid_pres = (p->owner) ? ast_party_id_presentation(&ast_channel_connected(p->owner)->id) : AST_PRES_NUMBER_NOT_AVAILABLE; if (ast_strlen_zero(lid_num)) return 0; @@ -12381,9 +12381,9 @@ static void initreqprep(struct sip_request *req, struct sip_pvt *p, int sipmetho d = S_OR(p->fromdomain, ast_sockaddr_stringify_host_remote(&p->ourip)); if (p->owner) { - if ((ast_party_id_presentation(&p->owner->connected.id) & AST_PRES_RESTRICTION) == AST_PRES_ALLOWED) { - l = p->owner->connected.id.number.valid ? p->owner->connected.id.number.str : NULL; - n = p->owner->connected.id.name.valid ? p->owner->connected.id.name.str : NULL; + if ((ast_party_id_presentation(&ast_channel_connected(p->owner)->id) & AST_PRES_RESTRICTION) == AST_PRES_ALLOWED) { + l = ast_channel_connected(p->owner)->id.number.valid ? ast_channel_connected(p->owner)->id.number.str : NULL; + n = ast_channel_connected(p->owner)->id.name.valid ? ast_channel_connected(p->owner)->id.name.str : NULL; } else { /* Even if we are using RPID, we shouldn't leak information in the From if the user wants * their callerid restricted */ @@ -12551,17 +12551,17 @@ static void add_diversion_header(struct sip_request *req, struct sip_pvt *pvt) return; } - diverting_number = pvt->owner->redirecting.from.number.str; - if (!pvt->owner->redirecting.from.number.valid + diverting_number = ast_channel_redirecting(pvt->owner)->from.number.str; + if (!ast_channel_redirecting(pvt->owner)->from.number.valid || ast_strlen_zero(diverting_number)) { return; } - reason = sip_reason_code_to_str(pvt->owner->redirecting.reason); + reason = sip_reason_code_to_str(ast_channel_redirecting(pvt->owner)->reason); /* We at least have a number to place in the Diversion header, which is enough */ - diverting_name = pvt->owner->redirecting.from.name.str; - if (!pvt->owner->redirecting.from.name.valid + diverting_name = ast_channel_redirecting(pvt->owner)->from.name.str; + if (!ast_channel_redirecting(pvt->owner)->from.name.valid || ast_strlen_zero(diverting_name)) { snprintf(header_text, sizeof(header_text), ";reason=%s", diverting_number, ast_sockaddr_stringify_host_remote(&pvt->ourip), reason); @@ -12696,7 +12696,7 @@ static int transmit_invite(struct sip_pvt *p, int sipmethod, int sdp, int init, ast_channel_lock(chan); - headp = &chan->varshead; + headp = ast_channel_varshead(chan); if (!headp) { ast_log(LOG_WARNING, "No Headp for the channel...ooops!\n"); @@ -13093,13 +13093,13 @@ static void state_notify_build_xml(int state, int full, const char *exten, const int need; ast_channel_lock(caller); - cid_num = S_COR(caller->caller.id.number.valid, - caller->caller.id.number.str, ""); + cid_num = S_COR(ast_channel_caller(caller)->id.number.valid, + ast_channel_caller(caller)->id.number.str, ""); need = strlen(cid_num) + strlen(p->fromdomain) + sizeof("sip:@"); local_target = alloca(need); snprintf(local_target, need, "sip:%s@%s", cid_num, p->fromdomain); - local_display = ast_strdupa(S_COR(caller->caller.id.name.valid, - caller->caller.id.name.str, "")); + local_display = ast_strdupa(S_COR(ast_channel_caller(caller)->id.name.valid, + ast_channel_caller(caller)->id.name.str, "")); ast_channel_unlock(caller); caller = ast_channel_unref(caller); } @@ -13421,15 +13421,15 @@ static void update_connectedline(struct sip_pvt *p, const void *data, size_t dat if (!ast_test_flag(&p->flags[0], SIP_SENDRPID)) { return; } - if (!p->owner->connected.id.number.valid - || ast_strlen_zero(p->owner->connected.id.number.str)) { + if (!ast_channel_connected(p->owner)->id.number.valid + || ast_strlen_zero(ast_channel_connected(p->owner)->id.number.str)) { return; } append_history(p, "ConnectedLine", "%s party is now %s <%s>", ast_test_flag(&p->flags[0], SIP_OUTGOING) ? "Calling" : "Called", - S_COR(p->owner->connected.id.name.valid, p->owner->connected.id.name.str, ""), - S_COR(p->owner->connected.id.number.valid, p->owner->connected.id.number.str, "")); + S_COR(ast_channel_connected(p->owner)->id.name.valid, ast_channel_connected(p->owner)->id.name.str, ""), + S_COR(ast_channel_connected(p->owner)->id.number.valid, ast_channel_connected(p->owner)->id.number.str, "")); if (ast_channel_state(p->owner) == AST_STATE_UP || ast_test_flag(&p->flags[0], SIP_OUTGOING)) { struct sip_request req; @@ -15575,8 +15575,8 @@ static int get_pai(struct sip_pvt *p, struct sip_request *req) if (p->owner) { ast_set_callerid(p->owner, cid_num, cid_name, NULL); - p->owner->caller.id.name.presentation = callingpres; - p->owner->caller.id.number.presentation = callingpres; + ast_channel_caller(p->owner)->id.name.presentation = callingpres; + ast_channel_caller(p->owner)->id.number.presentation = callingpres; } } @@ -15684,8 +15684,8 @@ static int get_rpid(struct sip_pvt *p, struct sip_request *oreq) if (p->owner) { ast_set_callerid(p->owner, cid_num, cid_name, NULL); - p->owner->caller.id.name.presentation = callingpres; - p->owner->caller.id.number.presentation = callingpres; + ast_channel_caller(p->owner)->id.name.presentation = callingpres; + ast_channel_caller(p->owner)->id.number.presentation = callingpres; } return 1; @@ -24014,9 +24014,9 @@ static int local_attended_transfer(struct sip_pvt *transferer, struct sip_dual * ast_party_connected_line_init(&connected_to_transferee); ast_party_connected_line_init(&connected_to_target); /* No need to lock current->chan1 here since it was locked in sipsock_read */ - ast_party_connected_line_copy(&connected_to_transferee, ¤t->chan1->connected); + ast_party_connected_line_copy(&connected_to_transferee, ast_channel_connected(current->chan1)); /* No need to lock target.chan1 here since it was locked in get_sip_pvt_byid_locked */ - ast_party_connected_line_copy(&connected_to_target, &target.chan1->connected); + ast_party_connected_line_copy(&connected_to_target, ast_channel_connected(target.chan1)); connected_to_target.source = connected_to_transferee.source = AST_CONNECTED_LINE_UPDATE_SOURCE_TRANSFER; res = attempt_transfer(current, &target); if (res) { @@ -30540,7 +30540,7 @@ static int sip_removeheader(struct ast_channel *chan, const char *data) } ast_channel_lock(chan); - headp=&chan->varshead; + headp=ast_channel_varshead(chan); AST_LIST_TRAVERSE_SAFE_BEGIN (headp, newvariable, entries) { if (strncasecmp(ast_var_name(newvariable), "SIPADDHEADER", strlen("SIPADDHEADER")) == 0) { if (removeall || (!strncasecmp(ast_var_value(newvariable),inbuf,strlen(inbuf)))) { diff --git a/channels/chan_skinny.c b/channels/chan_skinny.c index 724493f6a..cfa63eea5 100644 --- a/channels/chan_skinny.c +++ b/channels/chan_skinny.c @@ -2467,15 +2467,15 @@ static void send_callinfo(struct skinny_subchannel *sub) d = l->device; if (sub->calldirection == SKINNY_INCOMING) { - fromname = S_COR(ast->connected.id.name.valid, ast->connected.id.name.str, ""); - fromnum = S_COR(ast->connected.id.number.valid, ast->connected.id.number.str, ""); - toname = S_COR(ast->caller.id.name.valid, ast->caller.id.name.str, ""); - tonum = S_COR(ast->caller.id.number.valid, ast->caller.id.number.str, ""); + fromname = S_COR(ast_channel_connected(ast)->id.name.valid, ast_channel_connected(ast)->id.name.str, ""); + fromnum = S_COR(ast_channel_connected(ast)->id.number.valid, ast_channel_connected(ast)->id.number.str, ""); + toname = S_COR(ast_channel_caller(ast)->id.name.valid, ast_channel_caller(ast)->id.name.str, ""); + tonum = S_COR(ast_channel_caller(ast)->id.number.valid, ast_channel_caller(ast)->id.number.str, ""); } else if (sub->calldirection == SKINNY_OUTGOING) { - fromname = S_COR(ast->caller.id.name.valid, ast->caller.id.name.str, ""); - fromnum = S_COR(ast->caller.id.number.valid, ast->caller.id.number.str, ""); - toname = S_COR(ast->connected.id.name.valid, ast->connected.id.name.str, l->lastnumberdialed); - tonum = S_COR(ast->connected.id.number.valid, ast->connected.id.number.str, l->lastnumberdialed); + fromname = S_COR(ast_channel_caller(ast)->id.name.valid, ast_channel_caller(ast)->id.name.str, ""); + fromnum = S_COR(ast_channel_caller(ast)->id.number.valid, ast_channel_caller(ast)->id.number.str, ""); + toname = S_COR(ast_channel_connected(ast)->id.name.valid, ast_channel_connected(ast)->id.name.str, l->lastnumberdialed); + tonum = S_COR(ast_channel_connected(ast)->id.number.valid, ast_channel_connected(ast)->id.number.str, l->lastnumberdialed); } else { ast_verb(1, "Error sending Callinfo to %s(%d) - No call direction in sub\n", d->name, l->instance); return; @@ -2502,15 +2502,15 @@ static void push_callinfo(struct skinny_subline *subline, struct skinny_subchann d = l->device; if (sub->calldirection == SKINNY_INCOMING) { - fromname = S_COR(ast->connected.id.name.valid, ast->connected.id.name.str, ""); - fromnum = S_COR(ast->connected.id.number.valid, ast->connected.id.number.str, ""); - toname = S_COR(ast->caller.id.name.valid, ast->caller.id.name.str, ""); - tonum = S_COR(ast->caller.id.number.valid, ast->caller.id.number.str, ""); + fromname = S_COR(ast_channel_connected(ast)->id.name.valid, ast_channel_connected(ast)->id.name.str, ""); + fromnum = S_COR(ast_channel_connected(ast)->id.number.valid, ast_channel_connected(ast)->id.number.str, ""); + toname = S_COR(ast_channel_caller(ast)->id.name.valid, ast_channel_caller(ast)->id.name.str, ""); + tonum = S_COR(ast_channel_caller(ast)->id.number.valid, ast_channel_caller(ast)->id.number.str, ""); } else if (sub->calldirection == SKINNY_OUTGOING) { - fromname = S_COR(ast->caller.id.name.valid, ast->caller.id.name.str, ""); - fromnum = S_COR(ast->caller.id.number.valid, ast->caller.id.number.str, ""); - toname = S_COR(ast->connected.id.name.valid, ast->connected.id.name.str, l->lastnumberdialed); - tonum = S_COR(ast->connected.id.number.valid, ast->connected.id.number.str, l->lastnumberdialed); + fromname = S_COR(ast_channel_caller(ast)->id.name.valid, ast_channel_caller(ast)->id.name.str, ""); + fromnum = S_COR(ast_channel_caller(ast)->id.number.valid, ast_channel_caller(ast)->id.number.str, ""); + toname = S_COR(ast_channel_connected(ast)->id.name.valid, ast_channel_connected(ast)->id.name.str, l->lastnumberdialed); + tonum = S_COR(ast_channel_connected(ast)->id.number.valid, ast_channel_connected(ast)->id.number.str, l->lastnumberdialed); } else { ast_verb(1, "Error sending Callinfo to %s(%d) - No call direction in sub\n", d->name, l->instance); return; @@ -3143,10 +3143,10 @@ static void update_connectedline(struct skinny_subchannel *sub, const void *data struct skinny_line *l = sub->line; struct skinny_device *d = l->device; - if (!c->caller.id.number.valid - || ast_strlen_zero(c->caller.id.number.str) - || !c->connected.id.number.valid - || ast_strlen_zero(c->connected.id.number.str)) + if (!ast_channel_caller(c)->id.number.valid + || ast_strlen_zero(ast_channel_caller(c)->id.number.str) + || !ast_channel_connected(c)->id.number.valid + || ast_strlen_zero(ast_channel_connected(c)->id.number.str)) return; if (skinnydebug) { @@ -4230,14 +4230,14 @@ static void *skinny_newcall(void *data) ast_set_callerid(c, l->hidecallerid ? "" : l->cid_num, l->hidecallerid ? "" : l->cid_name, - c->caller.ani.number.valid ? NULL : l->cid_num); + ast_channel_caller(c)->ani.number.valid ? NULL : l->cid_num); #if 1 /* XXX This code is probably not necessary */ - ast_party_number_free(&c->connected.id.number); - ast_party_number_init(&c->connected.id.number); - c->connected.id.number.valid = 1; - c->connected.id.number.str = ast_strdup(ast_channel_exten(c)); - ast_party_name_free(&c->connected.id.name); - ast_party_name_init(&c->connected.id.name); + ast_party_number_free(&ast_channel_connected(c)->id.number); + ast_party_number_init(&ast_channel_connected(c)->id.number); + ast_channel_connected(c)->id.number.valid = 1; + ast_channel_connected(c)->id.number.str = ast_strdup(ast_channel_exten(c)); + ast_party_name_free(&ast_channel_connected(c)->id.name); + ast_party_name_init(&ast_channel_connected(c)->id.name); #endif ast_setstate(c, AST_STATE_RING); if (!sub->rtp) { @@ -4332,10 +4332,10 @@ static void *skinny_ss(void *data) } return NULL; } else if (!ast_canmatch_extension(c, ast_channel_context(c), sub->exten, 1, - S_COR(c->caller.id.number.valid, c->caller.id.number.str, NULL)) + S_COR(ast_channel_caller(c)->id.number.valid, ast_channel_caller(c)->id.number.str, NULL)) && ((sub->exten[0] != '*') || (!ast_strlen_zero(sub->exten) > 2))) { ast_log(LOG_WARNING, "Can't match [%s] from '%s' in context %s\n", sub->exten, - S_COR(c->caller.id.number.valid, c->caller.id.number.str, ""), + S_COR(ast_channel_caller(c)->id.number.valid, ast_channel_caller(c)->id.number.str, ""), ast_channel_context(c)); if (d->hookstate == SKINNY_OFFHOOK) { transmit_start_tone(d, SKINNY_REORDER, l->instance, sub->callid); @@ -4396,7 +4396,7 @@ static int skinny_call(struct ast_channel *ast, const char *dest, int timeout) return -1; } - AST_LIST_TRAVERSE(&ast->varshead, current, entries) { + AST_LIST_TRAVERSE(ast_channel_varshead(ast), current, entries) { if (!(strcasecmp(ast_var_name(current),"SKINNY_AUTOANSWER"))) { if (d->hookstate == SKINNY_ONHOOK && !sub->aa_sched) { char buf[24]; @@ -4937,8 +4937,8 @@ static struct ast_channel *skinny_new(struct skinny_line *l, struct skinny_subli /* Don't use ast_set_callerid() here because it will * generate a needless NewCallerID event */ if (!ast_strlen_zero(l->cid_num)) { - tmp->caller.ani.number.valid = 1; - tmp->caller.ani.number.str = ast_strdup(l->cid_num); + ast_channel_caller(tmp)->ani.number.valid = 1; + ast_channel_caller(tmp)->ani.number.str = ast_strdup(l->cid_num); } ast_channel_priority_set(tmp, 1); diff --git a/channels/chan_unistim.c b/channels/chan_unistim.c index f87e04479..caee08670 100644 --- a/channels/chan_unistim.c +++ b/channels/chan_unistim.c @@ -3770,14 +3770,14 @@ static int unistim_call(struct ast_channel *ast, const char *dest, int timeout) Sendicon(TEXT_LINE0, FAV_ICON_NONE, session); if (sub->owner) { - if (sub->owner->connected.id.number.valid - && sub->owner->connected.id.number.str) { + if (ast_channel_connected(sub->owner)->id.number.valid + && ast_channel_connected(sub->owner)->id.number.str) { if (session->device->height == 1) { - send_text(TEXT_LINE0, TEXT_NORMAL, session, sub->owner->connected.id.number.str); + send_text(TEXT_LINE0, TEXT_NORMAL, session, ast_channel_connected(sub->owner)->id.number.str); } else { - send_text(TEXT_LINE1, TEXT_NORMAL, session, sub->owner->connected.id.number.str); + send_text(TEXT_LINE1, TEXT_NORMAL, session, ast_channel_connected(sub->owner)->id.number.str); } - change_callerid(session, 0, sub->owner->connected.id.number.str); + change_callerid(session, 0, ast_channel_connected(sub->owner)->id.number.str); } else { if (session->device->height == 1) { send_text(TEXT_LINE0, TEXT_NORMAL, session, DEFAULTCALLERID); @@ -3786,10 +3786,10 @@ static int unistim_call(struct ast_channel *ast, const char *dest, int timeout) } change_callerid(session, 0, DEFAULTCALLERID); } - if (sub->owner->connected.id.name.valid - && sub->owner->connected.id.name.str) { - send_text(TEXT_LINE0, TEXT_NORMAL, session, sub->owner->connected.id.name.str); - change_callerid(session, 1, sub->owner->connected.id.name.str); + if (ast_channel_connected(sub->owner)->id.name.valid + && ast_channel_connected(sub->owner)->id.name.str) { + send_text(TEXT_LINE0, TEXT_NORMAL, session, ast_channel_connected(sub->owner)->id.name.str); + change_callerid(session, 1, ast_channel_connected(sub->owner)->id.name.str); } else { send_text(TEXT_LINE0, TEXT_NORMAL, session, DEFAULTCALLERNAME); change_callerid(session, 1, DEFAULTCALLERNAME); @@ -4607,12 +4607,12 @@ static struct ast_channel *unistim_new(struct unistim_subchannel *sub, int state instr = ast_strdup(l->cid_num); if (instr) { ast_callerid_parse(instr, &name, &loc); - tmp->caller.id.number.valid = 1; - ast_free(tmp->caller.id.number.str); - tmp->caller.id.number.str = ast_strdup(loc); - tmp->caller.id.name.valid = 1; - ast_free(tmp->caller.id.name.str); - tmp->caller.id.name.str = ast_strdup(name); + ast_channel_caller(tmp)->id.number.valid = 1; + ast_free(ast_channel_caller(tmp)->id.number.str); + ast_channel_caller(tmp)->id.number.str = ast_strdup(loc); + ast_channel_caller(tmp)->id.name.valid = 1; + ast_free(ast_channel_caller(tmp)->id.name.str); + ast_channel_caller(tmp)->id.name.str = ast_strdup(name); ast_free(instr); } } diff --git a/channels/chan_usbradio.c b/channels/chan_usbradio.c index 9560784b8..b2b5d141a 100644 --- a/channels/chan_usbradio.c +++ b/channels/chan_usbradio.c @@ -2192,11 +2192,11 @@ static struct ast_channel *usbradio_new(struct chan_usbradio_pvt *o, char *ext, /* Don't use ast_set_callerid() here because it will * generate a needless NewCallerID event */ if (!ast_strlen_zero(o->cid_num)) { - c->caller.ani.number.valid = 1; - c->caller.ani.number.str = ast_strdup(o->cid_num); + ast_channel_caller(c)->ani.number.valid = 1; + ast_channel_caller(c)->ani.number.str = ast_strdup(o->cid_num); } if (!ast_strlen_zero(ext)) { - c->dialed.number.str = ast_strdup(ext); + ast_channel_dialed(c)->number.str = ast_strdup(ext); } o->owner = c; diff --git a/channels/chan_vpb.cc b/channels/chan_vpb.cc index 4055fc5b5..bca7e9be8 100644 --- a/channels/chan_vpb.cc +++ b/channels/chan_vpb.cc @@ -694,8 +694,8 @@ static void get_callerid(struct vpb_pvt *p) strcpy(p->cid_name, cli_struct->cn); } ast_verb(4, "CID record - got [%s] [%s]\n", - S_COR(owner->caller.id.number.valid, owner->caller.id.number.str, ""), - S_COR(owner->caller.id.name.valid, owner->caller.id.name.str, "")); + S_COR(ast_channel_caller(owner)->id.number.valid, ast_channel_caller(owner)->id.number.str, ""), + S_COR(ast_channel_caller(owner)->id.name.valid, ast_channel_caller(owner)->id.name.str, "")); snprintf(p->callerid, sizeof(p->callerid), "%s %s", cli_struct->cldn, cli_struct->cn); } else { ast_log(LOG_ERROR, "CID record - No caller id avalable on %s \n", p->dev); @@ -781,15 +781,15 @@ static void get_callerid_ast(struct vpb_pvt *p) } else { ast_log(LOG_ERROR, "%s: Failed to create Caller ID struct\n", p->dev); } - ast_party_number_free(&owner->caller.id.number); - ast_party_number_init(&owner->caller.id.number); - ast_party_name_free(&owner->caller.id.name); - ast_party_name_init(&owner->caller.id.name); + ast_party_number_free(&ast_channel_caller(owner)->id.number); + ast_party_number_init(&ast_channel_caller(owner)->id.number); + ast_party_name_free(&ast_channel_caller(owner)->id.name); + ast_party_name_init(&ast_channel_caller(owner)->id.name); if (number) ast_shrink_phone_number(number); ast_set_callerid(owner, number, name, - owner->caller.ani.number.valid ? NULL : number); + ast_channel_caller(owner)->ani.number.valid ? NULL : number); if (!ast_strlen_zero(name)){ snprintf(p->callerid, sizeof(p->callerid), "%s %s", number, name); } else { @@ -900,7 +900,7 @@ static inline int monitor_handle_owned(struct vpb_pvt *p, VPB_EVENT *e) const char *target_context = S_OR(ast_channel_macrocontext(p->owner), ast_channel_context(p->owner)); if (ast_exists_extension(p->owner, target_context, "fax", 1, - S_COR(p->owner->caller.id.number.valid, p->owner->caller.id.number.str, NULL))) { + S_COR(ast_channel_caller(p->owner)->id.number.valid, ast_channel_caller(p->owner)->id.number.str, NULL))) { ast_verb(3, "Redirecting %s to fax extension\n", ast_channel_name(p->owner)); /* Save the DID/DNIS when we transfer the fax call to a "fax" extension */ pbx_builtin_setvar_helper(p->owner, "FAXEXTEN", ast_channel_exten(p->owner)); diff --git a/channels/console_video.c b/channels/console_video.c index 25e095f68..db07fccee 100644 --- a/channels/console_video.c +++ b/channels/console_video.c @@ -976,12 +976,12 @@ static void *video_thread(void *arg) ast_channel_lock(chan); /* AST_LIST_INSERT_TAIL is only good for one frame, cannot use here */ - if (chan->readq.first == NULL) { - chan->readq.first = f; + if (ast_channel_readq(chan).first == NULL) { + ast_channel_readq(chan).first = f; } else { - chan->readq.last->frame_list.next = f; + ast_channel_readq(chan).last->frame_list.next = f; } - chan->readq.last = p; + ast_channel_readq(chan).last = p; /* * more or less same as ast_queue_frame, but extra * write on the alertpipe to signal frames. diff --git a/channels/sig_analog.c b/channels/sig_analog.c index 01cac4b76..7f4d1a6da 100644 --- a/channels/sig_analog.c +++ b/channels/sig_analog.c @@ -719,8 +719,8 @@ static int analog_attempt_transfer(struct analog_pvt *p, int inthreeway) * The three-way party we're about to transfer is on hold if he * is not in a three way conference. */ - if (ast_channel_transfer_masquerade(owner_real, &owner_real->connected, 0, - bridge_3way, &owner_3way->connected, !inthreeway)) { + if (ast_channel_transfer_masquerade(owner_real, ast_channel_connected(owner_real), 0, + bridge_3way, ast_channel_connected(owner_3way), !inthreeway)) { ast_log(LOG_WARNING, "Unable to masquerade %s as %s\n", ast_channel_name(bridge_3way), ast_channel_name(owner_real)); return -1; @@ -745,8 +745,8 @@ static int analog_attempt_transfer(struct analog_pvt *p, int inthreeway) * The three-way party we're about to transfer is on hold if he * is not in a three way conference. */ - if (ast_channel_transfer_masquerade(owner_3way, &owner_3way->connected, - !inthreeway, bridge_real, &owner_real->connected, 0)) { + if (ast_channel_transfer_masquerade(owner_3way, ast_channel_connected(owner_3way), + !inthreeway, bridge_real, ast_channel_connected(owner_real), 0)) { ast_log(LOG_WARNING, "Unable to masquerade %s as %s\n", ast_channel_name(bridge_real), ast_channel_name(owner_3way)); return -1; @@ -1017,8 +1017,8 @@ int analog_call(struct analog_pvt *p, struct ast_channel *ast, const char *rdest char dest[256]; /* must be same length as p->dialdest */ ast_debug(1, "CALLING CID_NAME: %s CID_NUM:: %s\n", - S_COR(ast->connected.id.name.valid, ast->connected.id.name.str, ""), - S_COR(ast->connected.id.number.valid, ast->connected.id.number.str, "")); + S_COR(ast_channel_connected(ast)->id.name.valid, ast_channel_connected(ast)->id.name.str, ""), + S_COR(ast_channel_connected(ast)->id.number.valid, ast_channel_connected(ast)->id.number.str, "")); ast_copy_string(dest, rdest, sizeof(dest)); ast_copy_string(p->dialdest, rdest, sizeof(p->dialdest)); @@ -1076,13 +1076,13 @@ int analog_call(struct analog_pvt *p, struct ast_channel *ast, const char *rdest analog_set_dialing(p, 1); } else { /* Call waiting call */ - if (ast->connected.id.number.valid && ast->connected.id.number.str) { - ast_copy_string(p->callwait_num, ast->connected.id.number.str, sizeof(p->callwait_num)); + if (ast_channel_connected(ast)->id.number.valid && ast_channel_connected(ast)->id.number.str) { + ast_copy_string(p->callwait_num, ast_channel_connected(ast)->id.number.str, sizeof(p->callwait_num)); } else { p->callwait_num[0] = '\0'; } - if (ast->connected.id.name.valid && ast->connected.id.name.str) { - ast_copy_string(p->callwait_name, ast->connected.id.name.str, sizeof(p->callwait_name)); + if (ast_channel_connected(ast)->id.name.valid && ast_channel_connected(ast)->id.name.str) { + ast_copy_string(p->callwait_name, ast_channel_connected(ast)->id.name.str, sizeof(p->callwait_name)); } else { p->callwait_name[0] = '\0'; } @@ -1097,8 +1097,8 @@ int analog_call(struct analog_pvt *p, struct ast_channel *ast, const char *rdest } } - n = ast->connected.id.name.valid ? ast->connected.id.name.str : NULL; - l = ast->connected.id.number.valid ? ast->connected.id.number.str : NULL; + n = ast_channel_connected(ast)->id.name.valid ? ast_channel_connected(ast)->id.name.str : NULL; + l = ast_channel_connected(ast)->id.number.valid ? ast_channel_connected(ast)->id.number.str : NULL; if (l) { ast_copy_string(p->lastcid_num, l, sizeof(p->lastcid_num)); } else { @@ -1185,7 +1185,7 @@ int analog_call(struct analog_pvt *p, struct ast_channel *ast, const char *rdest switch (mysig) { case ANALOG_SIG_FEATD: - l = ast->connected.id.number.valid ? ast->connected.id.number.str : NULL; + l = ast_channel_connected(ast)->id.number.valid ? ast_channel_connected(ast)->id.number.str : NULL; if (l) { snprintf(p->dop.dialstr, sizeof(p->dop.dialstr), "T*%s*%s*", l, c); } else { @@ -1193,7 +1193,7 @@ int analog_call(struct analog_pvt *p, struct ast_channel *ast, const char *rdest } break; case ANALOG_SIG_FEATDMF: - l = ast->connected.id.number.valid ? ast->connected.id.number.str : NULL; + l = ast_channel_connected(ast)->id.number.valid ? ast_channel_connected(ast)->id.number.str : NULL; if (l) { snprintf(p->dop.dialstr, sizeof(p->dop.dialstr), "M*00%s#*%s#", l, c); } else { @@ -2068,7 +2068,7 @@ static void *__analog_ss_thread(void *data) analog_dsp_set_digitmode(p, ANALOG_DIGITMODE_DTMF); if (ast_exists_extension(chan, ast_channel_context(chan), exten, 1, - chan->caller.id.number.valid ? chan->caller.id.number.str : NULL)) { + ast_channel_caller(chan)->id.number.valid ? ast_channel_caller(chan)->id.number.str : NULL)) { ast_channel_exten_set(chan, exten); analog_dsp_reset_and_flush_digits(p); res = ast_pbx_run(chan); @@ -2226,10 +2226,10 @@ static void *__analog_ss_thread(void *data) ast_verb(3, "Disabling Caller*ID on %s\n", ast_channel_name(chan)); /* Disable Caller*ID if enabled */ p->hidecallerid = 1; - ast_party_number_free(&chan->caller.id.number); - ast_party_number_init(&chan->caller.id.number); - ast_party_name_free(&chan->caller.id.name); - ast_party_name_init(&chan->caller.id.name); + ast_party_number_free(&ast_channel_caller(chan)->id.number); + ast_party_number_init(&ast_channel_caller(chan)->id.number); + ast_party_name_free(&ast_channel_caller(chan)->id.name); + ast_party_name_init(&ast_channel_caller(chan)->id.name); res = analog_play_tone(p, idx, ANALOG_TONE_DIALRECALL); if (res) { ast_log(LOG_WARNING, "Unable to do dial recall on channel %s: %s\n", @@ -2341,11 +2341,11 @@ static void *__analog_ss_thread(void *data) goto quit; } } else if (!ast_canmatch_extension(chan, ast_channel_context(chan), exten, 1, - chan->caller.id.number.valid ? chan->caller.id.number.str : NULL) + ast_channel_caller(chan)->id.number.valid ? ast_channel_caller(chan)->id.number.str : NULL) && !analog_canmatch_featurecode(exten)) { ast_debug(1, "Can't match %s from '%s' in context %s\n", exten, - chan->caller.id.number.valid && chan->caller.id.number.str - ? chan->caller.id.number.str : "", + ast_channel_caller(chan)->id.number.valid && ast_channel_caller(chan)->id.number.str + ? ast_channel_caller(chan)->id.number.str : "", ast_channel_context(chan)); break; } @@ -3179,14 +3179,14 @@ static struct ast_frame *__analog_handle_event(struct analog_pvt *p, struct ast_ cid_num[0] = '\0'; cid_name[0] = '\0'; if (p->dahditrcallerid && p->owner) { - if (p->owner->caller.id.number.valid - && p->owner->caller.id.number.str) { - ast_copy_string(cid_num, p->owner->caller.id.number.str, + if (ast_channel_caller(p->owner)->id.number.valid + && ast_channel_caller(p->owner)->id.number.str) { + ast_copy_string(cid_num, ast_channel_caller(p->owner)->id.number.str, sizeof(cid_num)); } - if (p->owner->caller.id.name.valid - && p->owner->caller.id.name.str) { - ast_copy_string(cid_name, p->owner->caller.id.name.str, + if (ast_channel_caller(p->owner)->id.name.valid + && ast_channel_caller(p->owner)->id.name.str) { + ast_copy_string(cid_name, ast_channel_caller(p->owner)->id.name.str, sizeof(cid_name)); } } @@ -3331,13 +3331,13 @@ winkflashdone: case ANALOG_SIG_FEATDMF_TA: switch (p->whichwink) { case 0: - ast_debug(1, "ANI2 set to '%d' and ANI is '%s'\n", p->owner->caller.ani2, - S_COR(p->owner->caller.ani.number.valid, - p->owner->caller.ani.number.str, "")); + ast_debug(1, "ANI2 set to '%d' and ANI is '%s'\n", ast_channel_caller(p->owner)->ani2, + S_COR(ast_channel_caller(p->owner)->ani.number.valid, + ast_channel_caller(p->owner)->ani.number.str, "")); snprintf(p->dop.dialstr, sizeof(p->dop.dialstr), "M*%d%s#", - p->owner->caller.ani2, - S_COR(p->owner->caller.ani.number.valid, - p->owner->caller.ani.number.str, "")); + ast_channel_caller(p->owner)->ani2, + S_COR(ast_channel_caller(p->owner)->ani.number.valid, + ast_channel_caller(p->owner)->ani.number.str, "")); break; case 1: ast_copy_string(p->dop.dialstr, p->finaldial, sizeof(p->dop.dialstr)); diff --git a/channels/sig_pri.c b/channels/sig_pri.c index 85df15b7b..b317284fd 100644 --- a/channels/sig_pri.c +++ b/channels/sig_pri.c @@ -889,10 +889,10 @@ static void sig_pri_redirecting_update(struct sig_pri_chan *pvt, struct ast_chan /*! \todo XXX Original called data can be put in a channel data store that is inherited. */ memset(&pri_redirecting, 0, sizeof(pri_redirecting)); - sig_pri_party_id_from_ast(&pri_redirecting.from, &ast->redirecting.from); - sig_pri_party_id_from_ast(&pri_redirecting.to, &ast->redirecting.to); - pri_redirecting.count = ast->redirecting.count; - pri_redirecting.reason = ast_to_pri_reason(ast->redirecting.reason); + sig_pri_party_id_from_ast(&pri_redirecting.from, &ast_channel_redirecting(ast)->from); + sig_pri_party_id_from_ast(&pri_redirecting.to, &ast_channel_redirecting(ast)->to); + pri_redirecting.count = ast_channel_redirecting(ast)->count; + pri_redirecting.reason = ast_to_pri_reason(ast_channel_redirecting(ast)->reason); pri_redirecting_update(pvt->pri->pri, pvt->call, &pri_redirecting); } @@ -1918,8 +1918,8 @@ static void *pri_ss_thread(void *data) exten[0] = 's'; exten[1] = '\0'; } else { - ast_free(chan->dialed.number.str); - chan->dialed.number.str = ast_strdup(exten); + ast_free(ast_channel_dialed(chan)->number.str); + ast_channel_dialed(chan)->number.str = ast_strdup(exten); if (p->pri->append_msn_to_user_tag && p->pri->nodetype != PRI_NETWORK) { /* @@ -1928,8 +1928,8 @@ static void *pri_ss_thread(void *data) */ snprintf(p->user_tag, sizeof(p->user_tag), "%s_%s", p->pri->initial_user_tag, exten); - ast_free(chan->caller.id.tag); - chan->caller.id.tag = ast_strdup(p->user_tag); + ast_free(ast_channel_caller(chan)->id.tag); + ast_channel_caller(chan)->id.tag = ast_strdup(p->user_tag); } } sig_pri_play_tone(p, -1); @@ -2237,7 +2237,7 @@ static void sig_pri_mcid_event(struct sig_pri_span *pri, const struct pri_subcmd ast_str_append(&msg, 0, "Channel: %s\r\n", ast_channel_name(owner)); ast_str_append(&msg, 0, "UniqueID: %s\r\n", ast_channel_uniqueid(owner)); - sig_pri_event_party_id(&msg, "CallerID", &owner->connected.id); + sig_pri_event_party_id(&msg, "CallerID", &ast_channel_connected(owner)->id); } else { /* * Since we no longer have an owner channel, @@ -2439,10 +2439,10 @@ static int sig_pri_attempt_transfer(struct sig_pri_span *pri, q931_call *call_1_ ast_mutex_unlock(&pri->lock); retval = ast_channel_transfer_masquerade( call_2->ast, - &call_2->ast->connected, + ast_channel_connected(call_2->ast), call_2->held, transferee, - &call_1->ast->connected, + ast_channel_connected(call_1->ast), call_1->held); /* Reacquire the pri->lock to hold off completion of the transfer masquerade. */ @@ -4130,7 +4130,7 @@ static void sig_pri_handle_subcmds(struct sig_pri_span *pri, int chanpos, int ev pri->pvts[chanpos]->cid_subaddr[0] = '\0'; #if defined(HAVE_PRI_SUBADDR) if (ast_connected.id.subaddress.valid) { - ast_party_subaddress_set(&owner->caller.id.subaddress, + ast_party_subaddress_set(&ast_channel_caller(owner)->id.subaddress, &ast_connected.id.subaddress); if (ast_connected.id.subaddress.str) { ast_copy_string(pri->pvts[chanpos]->cid_subaddr, @@ -4146,7 +4146,7 @@ static void sig_pri_handle_subcmds(struct sig_pri_span *pri, int chanpos, int ev ast_party_id_presentation(&ast_connected.id); sig_pri_set_caller_id(pri->pvts[chanpos]); - ast_party_caller_set_init(&ast_caller, &owner->caller); + ast_party_caller_set_init(&ast_caller, ast_channel_caller(owner)); ast_caller.id = ast_connected.id; ast_caller.ani = ast_connected.id; ast_channel_set_caller_event(owner, &ast_caller, NULL); @@ -4167,7 +4167,7 @@ static void sig_pri_handle_subcmds(struct sig_pri_span *pri, int chanpos, int ev owner = pri->pvts[chanpos]->owner; if (owner) { sig_pri_redirecting_convert(&ast_redirecting, &subcmd->u.redirecting, - &owner->redirecting, pri); + ast_channel_redirecting(owner), pri); ast_redirecting.from.tag = ast_strdup(pri->pvts[chanpos]->user_tag); ast_redirecting.to.tag = ast_strdup(pri->pvts[chanpos]->user_tag); @@ -4239,7 +4239,7 @@ static void sig_pri_handle_subcmds(struct sig_pri_span *pri, int chanpos, int ev break; } sig_pri_redirecting_convert(&ast_redirecting, &pri_deflection, - &owner->redirecting, pri); + ast_channel_redirecting(owner), pri); ast_redirecting.from.tag = ast_strdup(pri->pvts[chanpos]->user_tag); ast_redirecting.to.tag = ast_strdup(pri->pvts[chanpos]->user_tag); ast_channel_set_redirecting(owner, &ast_redirecting, NULL); @@ -6104,7 +6104,7 @@ static void *pri_dchannel(void *vpri) /* Set Calling Subaddress */ sig_pri_lock_owner(pri, chanpos); sig_pri_set_subaddress( - &pri->pvts[chanpos]->owner->caller.id.subaddress, + &ast_channel_caller(pri->pvts[chanpos]->owner)->id.subaddress, &e->ring.calling.subaddress); if (!e->ring.calling.subaddress.type && !ast_strlen_zero( @@ -6119,7 +6119,7 @@ static void *pri_dchannel(void *vpri) /* Set Called Subaddress */ sig_pri_lock_owner(pri, chanpos); sig_pri_set_subaddress( - &pri->pvts[chanpos]->owner->dialed.subaddress, + &ast_channel_dialed(pri->pvts[chanpos]->owner)->subaddress, &e->ring.called_subaddress); if (!e->ring.called_subaddress.type && !ast_strlen_zero( @@ -6229,7 +6229,7 @@ static void *pri_dchannel(void *vpri) /* Set Calling Subaddress */ sig_pri_lock_owner(pri, chanpos); sig_pri_set_subaddress( - &pri->pvts[chanpos]->owner->caller.id.subaddress, + &ast_channel_caller(pri->pvts[chanpos]->owner)->id.subaddress, &e->ring.calling.subaddress); if (!e->ring.calling.subaddress.type && !ast_strlen_zero( @@ -6244,7 +6244,7 @@ static void *pri_dchannel(void *vpri) /* Set Called Subaddress */ sig_pri_lock_owner(pri, chanpos); sig_pri_set_subaddress( - &pri->pvts[chanpos]->owner->dialed.subaddress, + &ast_channel_dialed(pri->pvts[chanpos]->owner)->subaddress, &e->ring.called_subaddress); if (!e->ring.called_subaddress.type && !ast_strlen_zero( @@ -7434,8 +7434,8 @@ int sig_pri_call(struct sig_pri_chan *p, struct ast_channel *ast, const char *rd char *opt_args[OPT_ARG_ARRAY_SIZE]; ast_debug(1, "CALLER NAME: %s NUM: %s\n", - S_COR(ast->connected.id.name.valid, ast->connected.id.name.str, ""), - S_COR(ast->connected.id.number.valid, ast->connected.id.number.str, "")); + S_COR(ast_channel_connected(ast)->id.name.valid, ast_channel_connected(ast)->id.name.str, ""), + S_COR(ast_channel_connected(ast)->id.number.valid, ast_channel_connected(ast)->id.number.str, "")); if (!p->pri) { ast_log(LOG_ERROR, "Could not find pri on channel %d\n", p->channel); @@ -7491,14 +7491,14 @@ int sig_pri_call(struct sig_pri_chan *p, struct ast_channel *ast, const char *rd l = NULL; n = NULL; if (!p->hidecallerid) { - if (ast->connected.id.number.valid) { + if (ast_channel_connected(ast)->id.number.valid) { /* If we get to the end of this loop without breaking, there's no * calleridnum. This is done instead of testing for "unknown" or * the thousands of other ways that the calleridnum could be * invalid. */ - for (l = ast->connected.id.number.str; l && *l; l++) { + for (l = ast_channel_connected(ast)->id.number.str; l && *l; l++) { if (strchr("0123456789", *l)) { - l = ast->connected.id.number.str; + l = ast_channel_connected(ast)->id.number.str; break; } } @@ -7506,7 +7506,7 @@ int sig_pri_call(struct sig_pri_chan *p, struct ast_channel *ast, const char *rd l = NULL; } if (!p->hidecalleridname) { - n = ast->connected.id.name.valid ? ast->connected.id.name.str : NULL; + n = ast_channel_connected(ast)->id.name.valid ? ast_channel_connected(ast)->id.name.str : NULL; } } @@ -7691,8 +7691,8 @@ int sig_pri_call(struct sig_pri_chan *p, struct ast_channel *ast, const char *rd snprintf(p->user_tag, sizeof(p->user_tag), "%s_%s", p->pri->initial_user_tag, p->pri->nodetype == PRI_NETWORK ? c + p->stripmsd + dp_strip - : S_COR(ast->connected.id.number.valid, - ast->connected.id.number.str, "")); + : S_COR(ast_channel_connected(ast)->id.number.valid, + ast_channel_connected(ast)->id.number.str, "")); } else { ast_copy_string(p->user_tag, p->pri->initial_user_tag, sizeof(p->user_tag)); } @@ -7701,8 +7701,8 @@ int sig_pri_call(struct sig_pri_chan *p, struct ast_channel *ast, const char *rd * Replace the caller id tag from the channel creation * with the actual tag value. */ - ast_free(ast->caller.id.tag); - ast->caller.id.tag = ast_strdup(p->user_tag); + ast_free(ast_channel_caller(ast)->id.tag); + ast_channel_caller(ast)->id.tag = ast_strdup(p->user_tag); ldp_strip = 0; prilocaldialplan = p->pri->localdialplan - 1; @@ -7722,7 +7722,7 @@ int sig_pri_call(struct sig_pri_chan *p, struct ast_channel *ast, const char *rd } } else if (prilocaldialplan == -1) { /* Use the numbering plan passed in. */ - prilocaldialplan = ast->connected.id.number.plan; + prilocaldialplan = ast_channel_connected(ast)->id.number.plan; } if (l != NULL) { while (*l > '9' && *l != '*' && *l != '#') { @@ -7781,14 +7781,14 @@ int sig_pri_call(struct sig_pri_chan *p, struct ast_channel *ast, const char *rd } } pri_sr_set_caller(sr, l ? (l + ldp_strip) : NULL, n, prilocaldialplan, - p->use_callingpres ? ast->connected.id.number.presentation : (l ? PRES_ALLOWED_USER_NUMBER_PASSED_SCREEN : PRES_NUMBER_NOT_AVAILABLE)); + p->use_callingpres ? ast_channel_connected(ast)->id.number.presentation : (l ? PRES_ALLOWED_USER_NUMBER_PASSED_SCREEN : PRES_NUMBER_NOT_AVAILABLE)); #if defined(HAVE_PRI_SUBADDR) - if (ast->connected.id.subaddress.valid) { + if (ast_channel_connected(ast)->id.subaddress.valid) { struct pri_party_subaddress subaddress; memset(&subaddress, 0, sizeof(subaddress)); - sig_pri_party_subaddress_from_ast(&subaddress, &ast->connected.id.subaddress); + sig_pri_party_subaddress_from_ast(&subaddress, &ast_channel_connected(ast)->id.subaddress); pri_sr_set_caller_subaddress(sr, &subaddress); } #endif /* defined(HAVE_PRI_SUBADDR) */ @@ -8021,7 +8021,7 @@ int sig_pri_indicate(struct sig_pri_chan *p, struct ast_channel *chan, int condi pri_grab(p, p->pri); memset(&connected, 0, sizeof(connected)); - sig_pri_party_id_from_ast(&connected.id, &chan->connected.id); + sig_pri_party_id_from_ast(&connected.id, &ast_channel_connected(chan)->id); /* Determine the connected line numbering plan to actually use. */ switch (p->pri->cpndialplan) { diff --git a/channels/sig_ss7.c b/channels/sig_ss7.c index c37cf619c..1a8a12b98 100644 --- a/channels/sig_ss7.c +++ b/channels/sig_ss7.c @@ -1451,7 +1451,7 @@ int sig_ss7_call(struct sig_ss7_chan *p, struct ast_channel *ast, const char *rd } if (!p->hidecallerid) { - l = ast->connected.id.number.valid ? ast->connected.id.number.str : NULL; + l = ast_channel_connected(ast)->id.number.valid ? ast_channel_connected(ast)->id.number.str : NULL; } else { l = NULL; } @@ -1500,10 +1500,10 @@ int sig_ss7_call(struct sig_ss7_chan *p, struct ast_channel *ast, const char *rd } } isup_set_calling(p->ss7call, l ? (l + calling_nai_strip) : NULL, ss7_calling_nai, - p->use_callingpres ? cid_pres2ss7pres(ast->connected.id.number.presentation) : (l ? SS7_PRESENTATION_ALLOWED : SS7_PRESENTATION_RESTRICTED), - p->use_callingpres ? cid_pres2ss7screen(ast->connected.id.number.presentation) : SS7_SCREENING_USER_PROVIDED); + p->use_callingpres ? cid_pres2ss7pres(ast_channel_connected(ast)->id.number.presentation) : (l ? SS7_PRESENTATION_ALLOWED : SS7_PRESENTATION_RESTRICTED), + p->use_callingpres ? cid_pres2ss7screen(ast_channel_connected(ast)->id.number.presentation) : SS7_SCREENING_USER_PROVIDED); - isup_set_oli(p->ss7call, ast->connected.ani2); + isup_set_oli(p->ss7call, ast_channel_connected(ast)->ani2); isup_init_call(p->ss7->ss7, p->ss7call, p->cic, p->dpc); /* Set the charge number if it is set */ diff --git a/funcs/func_blacklist.c b/funcs/func_blacklist.c index be3bbc5fb..928d5d728 100644 --- a/funcs/func_blacklist.c +++ b/funcs/func_blacklist.c @@ -61,12 +61,12 @@ static int blacklist_read(struct ast_channel *chan, const char *cmd, char *data, char blacklist[1]; int bl = 0; - if (chan->caller.id.number.valid && chan->caller.id.number.str) { - if (!ast_db_get("blacklist", chan->caller.id.number.str, blacklist, sizeof (blacklist))) + if (ast_channel_caller(chan)->id.number.valid && ast_channel_caller(chan)->id.number.str) { + if (!ast_db_get("blacklist", ast_channel_caller(chan)->id.number.str, blacklist, sizeof (blacklist))) bl = 1; } - if (chan->caller.id.name.valid && chan->caller.id.name.str) { - if (!ast_db_get("blacklist", chan->caller.id.name.str, blacklist, sizeof (blacklist))) + if (ast_channel_caller(chan)->id.name.valid && ast_channel_caller(chan)->id.name.str) { + if (!ast_db_get("blacklist", ast_channel_caller(chan)->id.name.str, blacklist, sizeof (blacklist))) bl = 1; } diff --git a/funcs/func_callerid.c b/funcs/func_callerid.c index bd6d8aef2..8e8335221 100644 --- a/funcs/func_callerid.c +++ b/funcs/func_callerid.c @@ -818,7 +818,7 @@ static int callerpres_read(struct ast_channel *chan, const char *cmd, char *data " Use CALLERID(name-pres) or CALLERID(num-pres) instead.\n"); } ast_copy_string(buf, - ast_named_caller_presentation(ast_party_id_presentation(&chan->caller.id)), len); + ast_named_caller_presentation(ast_party_id_presentation(&ast_channel_caller(chan)->id)), len); return 0; } @@ -848,8 +848,8 @@ static int callerpres_write(struct ast_channel *chan, const char *cmd, char *dat if (pres < 0) { ast_log(LOG_WARNING, "'%s' is not a valid presentation (see 'show function CALLERPRES')\n", value); } else { - chan->caller.id.name.presentation = pres; - chan->caller.id.number.presentation = pres; + ast_channel_caller(chan)->id.name.presentation = pres; + ast_channel_caller(chan)->id.number.presentation = pres; } return 0; } @@ -917,9 +917,9 @@ static int callerid_read(struct ast_channel *chan, const char *cmd, char *data, ast_channel_lock(chan); if (member.argc == 1 && !strcasecmp("rdnis", member.argv[0])) { - if (chan->redirecting.from.number.valid - && chan->redirecting.from.number.str) { - ast_copy_string(buf, chan->redirecting.from.number.str, len); + if (ast_channel_redirecting(chan)->from.number.valid + && ast_channel_redirecting(chan)->from.number.str) { + ast_copy_string(buf, ast_channel_redirecting(chan)->from.number.str, len); } } else if (!strcasecmp("dnid", member.argv[0])) { if (member.argc == 1) { @@ -934,12 +934,12 @@ static int callerid_read(struct ast_channel *chan, const char *cmd, char *data, */ if (member.argc == 2) { /* dnid-num */ - if (chan->dialed.number.str) { - ast_copy_string(buf, chan->dialed.number.str, len); + if (ast_channel_dialed(chan)->number.str) { + ast_copy_string(buf, ast_channel_dialed(chan)->number.str, len); } } else if (member.argc == 3 && !strcasecmp("plan", member.argv[2])) { /* dnid-num-plan */ - snprintf(buf, len, "%d", chan->dialed.number.plan); + snprintf(buf, len, "%d", ast_channel_dialed(chan)->number.plan); } else { ast_log(LOG_ERROR, "Unknown callerid data type '%s'.\n", data); } @@ -949,7 +949,7 @@ static int callerid_read(struct ast_channel *chan, const char *cmd, char *data, * dnid-subaddr... */ status = party_subaddress_read(buf, len, member.argc - 2, member.argv + 2, - &chan->dialed.subaddress); + &ast_channel_dialed(chan)->subaddress); switch (status) { case ID_FIELD_VALID: case ID_FIELD_INVALID: @@ -962,7 +962,7 @@ static int callerid_read(struct ast_channel *chan, const char *cmd, char *data, ast_log(LOG_ERROR, "Unknown callerid data type '%s'.\n", data); } } else if (member.argc == 1 && !strcasecmp("ani2", member.argv[0])) { - snprintf(buf, len, "%d", chan->caller.ani2); + snprintf(buf, len, "%d", ast_channel_caller(chan)->ani2); } else if (!strcasecmp("ani", member.argv[0])) { if (member.argc == 1) { /* Setup as if user had given ani-num instead. */ @@ -970,7 +970,7 @@ static int callerid_read(struct ast_channel *chan, const char *cmd, char *data, member.argv[1] = "num"; } status = party_id_read(buf, len, member.argc - 1, member.argv + 1, - &chan->caller.ani); + &ast_channel_caller(chan)->ani); switch (status) { case ID_FIELD_VALID: case ID_FIELD_INVALID: @@ -980,7 +980,7 @@ static int callerid_read(struct ast_channel *chan, const char *cmd, char *data, break; } } else { - status = party_id_read(buf, len, member.argc, member.argv, &chan->caller.id); + status = party_id_read(buf, len, member.argc, member.argv, &ast_channel_caller(chan)->id); switch (status) { case ID_FIELD_VALID: case ID_FIELD_INVALID: @@ -1040,14 +1040,14 @@ static int callerid_write(struct ast_channel *chan, const char *cmd, char *data, ast_channel_lock(chan); if (member.argc == 1 && !strcasecmp("rdnis", member.argv[0])) { - chan->redirecting.from.number.valid = 1; - ast_free(chan->redirecting.from.number.str); - chan->redirecting.from.number.str = ast_strdup(value); + ast_channel_redirecting(chan)->from.number.valid = 1; + ast_free(ast_channel_redirecting(chan)->from.number.str); + ast_channel_redirecting(chan)->from.number.str = ast_strdup(value); if (ast_channel_cdr(chan)) { ast_cdr_setcid(ast_channel_cdr(chan), chan); } } else if (!strcasecmp("dnid", member.argv[0])) { - ast_party_dialed_set_init(&dialed, &chan->dialed); + ast_party_dialed_set_init(&dialed, ast_channel_dialed(chan)); if (member.argc == 1) { /* Setup as if user had given dnid-num instead. */ member.argc = 2; @@ -1062,7 +1062,7 @@ static int callerid_write(struct ast_channel *chan, const char *cmd, char *data, /* dnid-num */ dialed.number.str = ast_strdup(value); ast_trim_blanks(dialed.number.str); - ast_party_dialed_set(&chan->dialed, &dialed); + ast_party_dialed_set(ast_channel_dialed(chan), &dialed); if (ast_channel_cdr(chan)) { ast_cdr_setcid(ast_channel_cdr(chan), chan); } @@ -1072,7 +1072,7 @@ static int callerid_write(struct ast_channel *chan, const char *cmd, char *data, ast_trim_blanks(val); if (('0' <= val[0]) && (val[0] <= '9')) { - chan->dialed.number.plan = atoi(val); + ast_channel_dialed(chan)->number.plan = atoi(val); if (ast_channel_cdr(chan)) { ast_cdr_setcid(ast_channel_cdr(chan), chan); } @@ -1092,7 +1092,7 @@ static int callerid_write(struct ast_channel *chan, const char *cmd, char *data, member.argv + 2, value); switch (status) { case ID_FIELD_VALID: - ast_party_dialed_set(&chan->dialed, &dialed); + ast_party_dialed_set(ast_channel_dialed(chan), &dialed); if (ast_channel_cdr(chan)) { ast_cdr_setcid(ast_channel_cdr(chan), chan); } @@ -1112,7 +1112,7 @@ static int callerid_write(struct ast_channel *chan, const char *cmd, char *data, ast_trim_blanks(val); if (('0' <= val[0]) && (val[0] <= '9')) { - chan->caller.ani2 = atoi(val); + ast_channel_caller(chan)->ani2 = atoi(val); if (ast_channel_cdr(chan)) { ast_cdr_setcid(ast_channel_cdr(chan), chan); } @@ -1120,7 +1120,7 @@ static int callerid_write(struct ast_channel *chan, const char *cmd, char *data, ast_log(LOG_ERROR, "Unknown callerid ani2 '%s', value unchanged\n", val); } } else if (!strcasecmp("ani", member.argv[0])) { - ast_party_caller_set_init(&caller, &chan->caller); + ast_party_caller_set_init(&caller, ast_channel_caller(chan)); if (member.argc == 1) { /* Setup as if user had given ani-num instead. */ member.argc = 2; @@ -1129,7 +1129,7 @@ static int callerid_write(struct ast_channel *chan, const char *cmd, char *data, status = party_id_write(&caller.ani, member.argc - 1, member.argv + 1, value); switch (status) { case ID_FIELD_VALID: - ast_party_caller_set(&chan->caller, &caller, NULL); + ast_party_caller_set(ast_channel_caller(chan), &caller, NULL); if (ast_channel_cdr(chan)) { ast_cdr_setcid(ast_channel_cdr(chan), chan); } @@ -1142,7 +1142,7 @@ static int callerid_write(struct ast_channel *chan, const char *cmd, char *data, } ast_party_caller_free(&caller); } else { - ast_party_caller_set_init(&caller, &chan->caller); + ast_party_caller_set_init(&caller, ast_channel_caller(chan)); status = party_id_write(&caller.id, member.argc, member.argv, value); switch (status) { case ID_FIELD_VALID: @@ -1200,9 +1200,9 @@ static int connectedline_read(struct ast_channel *chan, const char *cmd, char *d ast_channel_lock(chan); if (member.argc == 1 && !strcasecmp("source", member.argv[0])) { - ast_copy_string(buf, ast_connected_line_source_name(chan->connected.source), len); + ast_copy_string(buf, ast_connected_line_source_name(ast_channel_connected(chan)->source), len); } else { - status = party_id_read(buf, len, member.argc, member.argv, &chan->connected.id); + status = party_id_read(buf, len, member.argc, member.argv, &ast_channel_connected(chan)->id); switch (status) { case ID_FIELD_VALID: case ID_FIELD_INVALID: @@ -1272,7 +1272,7 @@ static int connectedline_write(struct ast_channel *chan, const char *cmd, char * } ast_channel_lock(chan); - ast_party_connected_line_set_init(&connected, &chan->connected); + ast_party_connected_line_set_init(&connected, ast_channel_connected(chan)); ast_channel_unlock(chan); value = ast_skip_blanks(value); @@ -1350,7 +1350,7 @@ static int redirecting_read(struct ast_channel *chan, const char *cmd, char *dat if (!strcasecmp("from", member.argv[0])) { status = party_id_read(buf, len, member.argc - 1, member.argv + 1, - &chan->redirecting.from); + &ast_channel_redirecting(chan)->from); switch (status) { case ID_FIELD_VALID: case ID_FIELD_INVALID: @@ -1361,7 +1361,7 @@ static int redirecting_read(struct ast_channel *chan, const char *cmd, char *dat } } else if (!strcasecmp("to", member.argv[0])) { status = party_id_read(buf, len, member.argc - 1, member.argv + 1, - &chan->redirecting.to); + &ast_channel_redirecting(chan)->to); switch (status) { case ID_FIELD_VALID: case ID_FIELD_INVALID: @@ -1377,11 +1377,11 @@ static int redirecting_read(struct ast_channel *chan, const char *cmd, char *dat */ ast_copy_string(buf, ast_named_caller_presentation( - ast_party_id_presentation(&chan->redirecting.from)), len); + ast_party_id_presentation(&ast_channel_redirecting(chan)->from)), len); } else if (member.argc == 1 && !strcasecmp("reason", member.argv[0])) { - ast_copy_string(buf, ast_redirecting_reason_name(chan->redirecting.reason), len); + ast_copy_string(buf, ast_redirecting_reason_name(ast_channel_redirecting(chan)->reason), len); } else if (member.argc == 1 && !strcasecmp("count", member.argv[0])) { - snprintf(buf, len, "%d", chan->redirecting.count); + snprintf(buf, len, "%d", ast_channel_redirecting(chan)->count); } else { ast_log(LOG_ERROR, "Unknown redirecting data type '%s'.\n", data); } @@ -1445,7 +1445,7 @@ static int redirecting_write(struct ast_channel *chan, const char *cmd, char *da } ast_channel_lock(chan); - ast_party_redirecting_set_init(&redirecting, &chan->redirecting); + ast_party_redirecting_set_init(&redirecting, ast_channel_redirecting(chan)); ast_channel_unlock(chan); value = ast_skip_blanks(value); diff --git a/funcs/func_dialplan.c b/funcs/func_dialplan.c index 904eede29..0c2e8c707 100644 --- a/funcs/func_dialplan.c +++ b/funcs/func_dialplan.c @@ -97,20 +97,20 @@ static int isexten_function_read(struct ast_channel *chan, const char *cmd, char if (sscanf(args.priority, "%30d", &priority_num) == 1 && priority_num > 0) { int res; res = ast_exists_extension(chan, args.context, args.exten, priority_num, - S_COR(chan->caller.id.number.valid, chan->caller.id.number.str, NULL)); + S_COR(ast_channel_caller(chan)->id.number.valid, ast_channel_caller(chan)->id.number.str, NULL)); if (res) strcpy(buf, "1"); } else { int res; res = ast_findlabel_extension(chan, args.context, args.exten, args.priority, - S_COR(chan->caller.id.number.valid, chan->caller.id.number.str, NULL)); + S_COR(ast_channel_caller(chan)->id.number.valid, ast_channel_caller(chan)->id.number.str, NULL)); if (res > 0) strcpy(buf, "1"); } } else if (!ast_strlen_zero(args.exten)) { int res; res = ast_exists_extension(chan, args.context, args.exten, 1, - S_COR(chan->caller.id.number.valid, chan->caller.id.number.str, NULL)); + S_COR(ast_channel_caller(chan)->id.number.valid, ast_channel_caller(chan)->id.number.str, NULL)); if (res) strcpy(buf, "1"); } else if (!ast_strlen_zero(args.context)) { @@ -151,7 +151,7 @@ static int acf_isexten_exec(struct ast_channel *chan, const char *cmd, char *par } if (ast_exists_extension(chan, args.context, args.extension, priority_int, - S_COR(chan->caller.id.number.valid, chan->caller.id.number.str, NULL))) { + S_COR(ast_channel_caller(chan)->id.number.valid, ast_channel_caller(chan)->id.number.str, NULL))) { ast_copy_string(buffer, "1", buflen); } else { ast_copy_string(buffer, "0", buflen); diff --git a/funcs/func_strings.c b/funcs/func_strings.c index ff04be827..18de20226 100644 --- a/funcs/func_strings.c +++ b/funcs/func_strings.c @@ -997,7 +997,7 @@ static void clearvar_prefix(struct ast_channel *chan, const char *prefix) { struct ast_var_t *var; int len = strlen(prefix); - AST_LIST_TRAVERSE_SAFE_BEGIN(&chan->varshead, var, entries) { + AST_LIST_TRAVERSE_SAFE_BEGIN(ast_channel_varshead(chan), var, entries) { if (strncasecmp(prefix, ast_var_name(var), len) == 0) { AST_LIST_REMOVE_CURRENT(entries); ast_free(var); @@ -1096,7 +1096,7 @@ static int hashkeys_read(struct ast_channel *chan, const char *cmd, char *data, ast_str_set(&prefix, -1, HASH_PREFIX, data); memset(buf, 0, len); - AST_LIST_TRAVERSE(&chan->varshead, newvar, entries) { + AST_LIST_TRAVERSE(ast_channel_varshead(chan), newvar, entries) { if (strncasecmp(ast_str_buffer(prefix), ast_var_name(newvar), ast_str_strlen(prefix)) == 0) { /* Copy everything after the prefix */ strncat(buf, ast_var_name(newvar) + ast_str_strlen(prefix), len - strlen(buf) - 1); @@ -1117,7 +1117,7 @@ static int hashkeys_read2(struct ast_channel *chan, const char *cmd, char *data, ast_str_set(&prefix, -1, HASH_PREFIX, data); - AST_LIST_TRAVERSE(&chan->varshead, newvar, entries) { + AST_LIST_TRAVERSE(ast_channel_varshead(chan), newvar, entries) { if (strncasecmp(ast_str_buffer(prefix), ast_var_name(newvar), ast_str_strlen(prefix)) == 0) { /* Copy everything after the prefix */ ast_str_append(buf, len, "%s", ast_var_name(newvar) + ast_str_strlen(prefix)); @@ -1693,12 +1693,12 @@ AST_TEST_DEFINE(test_FIELDNUM) for (i = 0; i < ARRAY_LEN(test_args); i++) { struct ast_var_t *var = ast_var_assign("FIELDS", test_args[i].fields); - AST_LIST_INSERT_HEAD(&chan->varshead, var, entries); + AST_LIST_INSERT_HEAD(ast_channel_varshead(chan), var, entries); snprintf(expression, sizeof(expression), "${FIELDNUM(%s,%s,%s)}", var->name, test_args[i].delim, test_args[i].field); ast_str_substitute_variables(&str, 0, chan, expression); - AST_LIST_REMOVE(&chan->varshead, var, entries); + AST_LIST_REMOVE(ast_channel_varshead(chan), var, entries); ast_var_delete(var); if (strcasecmp(ast_str_buffer(str), test_args[i].expected)) { @@ -1795,7 +1795,7 @@ AST_TEST_DEFINE(test_STRREPLACE) char tmp[512], tmp2[512] = ""; struct ast_var_t *var = ast_var_assign("test_string", test_strings[i][0]); - AST_LIST_INSERT_HEAD(&chan->varshead, var, entries); + AST_LIST_INSERT_HEAD(ast_channel_varshead(chan), var, entries); if (test_strings[i][3]) { snprintf(tmp, sizeof(tmp), "${STRREPLACE(%s,%s,%s,%s)}", "test_string", test_strings[i][1], test_strings[i][2], test_strings[i][3]); diff --git a/funcs/func_timeout.c b/funcs/func_timeout.c index aef0a4033..3c2810fd5 100644 --- a/funcs/func_timeout.c +++ b/funcs/func_timeout.c @@ -90,11 +90,11 @@ static int timeout_read(struct ast_channel *chan, const char *cmd, char *data, switch (*data) { case 'a': case 'A': - if (ast_tvzero(chan->whentohangup)) { + if (ast_tvzero(*ast_channel_whentohangup(chan))) { ast_copy_string(buf, "0", len); } else { myt = ast_tvnow(); - snprintf(buf, len, "%.3f", ast_tvdiff_ms(chan->whentohangup, myt) / 1000.0); + snprintf(buf, len, "%.3f", ast_tvdiff_ms(*ast_channel_whentohangup(chan), myt) / 1000.0); } break; @@ -156,7 +156,7 @@ static int timeout_write(struct ast_channel *chan, const char *cmd, char *data, case 'a': case 'A': ast_channel_setwhentohangup_tv(chan, when); - if (!ast_tvzero(chan->whentohangup)) { + if (!ast_tvzero(*ast_channel_whentohangup(chan))) { when = ast_tvadd(when, ast_tvnow()); ast_strftime(timestr, sizeof(timestr), "%Y-%m-%d %H:%M:%S.%3q %Z", ast_localtime(&when, &myt, NULL)); diff --git a/include/asterisk/channel.h b/include/asterisk/channel.h index 20fcc4344..4d978b89d 100644 --- a/include/asterisk/channel.h +++ b/include/asterisk/channel.h @@ -709,6 +709,10 @@ enum ast_t38_state { T38_STATE_NEGOTIATED, /*!< T38 established */ }; +AST_LIST_HEAD_NOLOCK(ast_datastore_list, ast_datastore); +AST_LIST_HEAD_NOLOCK(ast_autochan_list, ast_autochan); +AST_LIST_HEAD_NOLOCK(ast_readq_list, ast_frame); + /*! * \page AstChannel ast_channel locking and reference tracking * @@ -821,7 +825,7 @@ struct ast_channel { AST_STRING_FIELD(__do_not_use_dialcontext); /*!< Dial: Extension context that we were called from */ ); - struct timeval whentohangup; /*!< Non-zero, set to actual time when channel is to be hung up */ + struct timeval __do_not_use_whentohangup; /*!< Non-zero, set to actual time when channel is to be hung up */ pthread_t blocker; /*!< If anyone is blocking, this is them */ /*! @@ -829,35 +833,34 @@ struct ast_channel { * \note Set on incoming channels to indicate the originally dialed party. * \note Dialed Number Identifier (DNID) */ - struct ast_party_dialed dialed; + struct ast_party_dialed __do_not_use_dialed; /*! * \brief Channel Caller ID information. * \note The caller id information is the caller id of this * channel when it is used to initiate a call. */ - struct ast_party_caller caller; + struct ast_party_caller __do_not_use_caller; /*! * \brief Channel Connected Line ID information. * \note The connected line information identifies the channel * connected/bridged to this channel. */ - struct ast_party_connected_line connected; + struct ast_party_connected_line __do_not_use_connected; /*! \brief Redirecting/Diversion information */ - struct ast_party_redirecting redirecting; + struct ast_party_redirecting __do_not_use_redirecting; - struct ast_frame dtmff; /*!< DTMF frame */ - struct varshead varshead; /*!< A linked list for channel variables. See \ref AstChanVar */ + struct ast_frame __do_not_use_dtmff; /*!< DTMF frame */ + struct varshead __do_not_use_varshead; /*!< A linked list for channel variables. See \ref AstChanVar */ ast_group_t callgroup; /*!< Call group for call pickups */ ast_group_t pickupgroup; /*!< Pickup group - which calls groups can be picked up? */ - AST_LIST_HEAD_NOLOCK(, ast_frame) readq; - struct ast_jb jb; /*!< The jitterbuffer state */ - struct timeval dtmf_tv; /*!< The time that an in process digit began, or the last digit ended */ - AST_LIST_HEAD_NOLOCK(datastores, ast_datastore) datastores; /*!< Data stores on the channel */ - AST_LIST_HEAD_NOLOCK(autochans, ast_autochan) autochans; /*!< Autochans on the channel */ - + struct ast_readq_list __do_not_use_readq; + struct ast_jb __do_not_use_jb; /*!< The jitterbuffer state */ + struct timeval __do_not_use_dtmf_tv; /*!< The time that an in process digit began, or the last digit ended */ + struct ast_datastore_list __do_not_use_datastores; /*!< Data stores on the channel */ + struct ast_autochan_list __do_not_use_autochans; /*!< Autochans on the channel */ unsigned long __do_not_use_insmpl; /*!< Track the read/written samples for monitor use */ unsigned long __do_not_use_outsmpl; /*!< Track the read/written samples for monitor use */ @@ -3792,4 +3795,27 @@ struct ast_format *ast_channel_rawwriteformat(struct ast_channel *chan); struct ast_format *ast_channel_readformat(struct ast_channel *chan); struct ast_format *ast_channel_writeformat(struct ast_channel *chan); +/* Other struct getters */ +struct ast_frame *ast_channel_dtmff(struct ast_channel *chan); +struct ast_jb *ast_channel_jb(struct ast_channel *chan); +struct ast_party_caller *ast_channel_caller(struct ast_channel *chan); +struct ast_party_connected_line *ast_channel_connected(struct ast_channel *chan); +struct ast_party_dialed *ast_channel_dialed(struct ast_channel *chan); +struct ast_party_redirecting *ast_channel_redirecting(struct ast_channel *chan); +struct timeval *ast_channel_dtmf_tv(struct ast_channel *chan); +struct timeval *ast_channel_whentohangup(struct ast_channel *chan); +struct varshead *ast_channel_varshead(struct ast_channel *chan); + +/* Other struct setters */ +void ast_channel_caller_set(struct ast_channel *chan, struct ast_party_caller *value); +void ast_channel_connected_set(struct ast_channel *chan, struct ast_party_connected_line *value); +void ast_channel_dialed_set(struct ast_channel *chan, struct ast_party_dialed *value); +void ast_channel_redirecting_set(struct ast_channel *chan, struct ast_party_redirecting *value); +void ast_channel_dtmf_tv_set(struct ast_channel *chan, struct timeval *value); +void ast_channel_whentohangup_set(struct ast_channel *chan, struct timeval *value); + +/* List getters */ +struct ast_datastore_list *ast_channel_datastores(struct ast_channel *chan); +struct ast_autochan_list *ast_channel_autochans(struct ast_channel *chan); +struct ast_readq_list *ast_channel_readq(struct ast_channel *chan); #endif /* _ASTERISK_CHANNEL_H */ diff --git a/include/asterisk/utils.h b/include/asterisk/utils.h index 5ef1f96f9..e3b98435a 100644 --- a/include/asterisk/utils.h +++ b/include/asterisk/utils.h @@ -227,6 +227,8 @@ int ast_base64encode_full(char *dst, const unsigned char *src, int srclen, int m #undef MAX #define MAX(a, b) ({ typeof(a) __a = (a); typeof(b) __b = (b); ((__a < __b) ? __b : __a);}) +#define SWAP(a,b) do { typeof(a) __tmp = (a); (a) = (b); (b) = __tmp; } while (0) + /*! * \brief Encode data in base64 * \param dst the destination buffer diff --git a/main/abstract_jb.c b/main/abstract_jb.c index c35b1d8aa..fa5597d0c 100644 --- a/main/abstract_jb.c +++ b/main/abstract_jb.c @@ -134,7 +134,7 @@ static long get_now(struct ast_jb *jb, struct timeval *tv); static void jb_choose_impl(struct ast_channel *chan) { - struct ast_jb *jb = &chan->jb; + struct ast_jb *jb = ast_channel_jb(chan); struct ast_jb_conf *jbconf = &jb->conf; const struct ast_jb_impl *test_impl; int i, avail_impl_count = ARRAY_LEN(avail_impl); @@ -156,8 +156,8 @@ static void jb_choose_impl(struct ast_channel *chan) int ast_jb_do_usecheck(struct ast_channel *c0, struct ast_channel *c1) { - struct ast_jb *jb0 = &c0->jb; - struct ast_jb *jb1 = &c1->jb; + struct ast_jb *jb0 = ast_channel_jb(c0); + struct ast_jb *jb1 = ast_channel_jb(c1); struct ast_jb_conf *conf0 = &jb0->conf; struct ast_jb_conf *conf1 = &jb1->conf; int c0_wants_jitter = ast_channel_tech(c0)->properties & AST_CHAN_TP_WANTSJITTER; @@ -217,8 +217,8 @@ int ast_jb_do_usecheck(struct ast_channel *c0, struct ast_channel *c1) int ast_jb_get_when_to_wakeup(struct ast_channel *c0, struct ast_channel *c1, int time_left) { - struct ast_jb *jb0 = &c0->jb; - struct ast_jb *jb1 = &c1->jb; + struct ast_jb *jb0 = ast_channel_jb(c0); + struct ast_jb *jb1 = ast_channel_jb(c1); int c0_use_jb = ast_test_flag(jb0, JB_USE); int c0_jb_is_created = ast_test_flag(jb0, JB_CREATED); int c1_use_jb = ast_test_flag(jb1, JB_USE); @@ -257,7 +257,7 @@ int ast_jb_get_when_to_wakeup(struct ast_channel *c0, struct ast_channel *c1, in int ast_jb_put(struct ast_channel *chan, struct ast_frame *f) { - struct ast_jb *jb = &chan->jb; + struct ast_jb *jb = ast_channel_jb(chan); const struct ast_jb_impl *jbimpl = jb->impl; void *jbobj = jb->jbobj; struct ast_frame *frr; @@ -322,8 +322,8 @@ int ast_jb_put(struct ast_channel *chan, struct ast_frame *f) void ast_jb_get_and_deliver(struct ast_channel *c0, struct ast_channel *c1) { - struct ast_jb *jb0 = &c0->jb; - struct ast_jb *jb1 = &c1->jb; + struct ast_jb *jb0 = ast_channel_jb(c0); + struct ast_jb *jb1 = ast_channel_jb(c1); int c0_use_jb = ast_test_flag(jb0, JB_USE); int c0_jb_is_created = ast_test_flag(jb0, JB_CREATED); int c1_use_jb = ast_test_flag(jb1, JB_USE); @@ -339,7 +339,7 @@ void ast_jb_get_and_deliver(struct ast_channel *c0, struct ast_channel *c1) static void jb_get_and_deliver(struct ast_channel *chan) { - struct ast_jb *jb = &chan->jb; + struct ast_jb *jb = ast_channel_jb(chan); const struct ast_jb_impl *jbimpl = jb->impl; void *jbobj = jb->jbobj; struct ast_frame *f, finterp = { .frametype = AST_FRAME_VOICE, }; @@ -399,7 +399,7 @@ static void jb_get_and_deliver(struct ast_channel *chan) static int create_jb(struct ast_channel *chan, struct ast_frame *frr) { - struct ast_jb *jb = &chan->jb; + struct ast_jb *jb = ast_channel_jb(chan); struct ast_jb_conf *jbconf = &jb->conf; const struct ast_jb_impl *jbimpl = jb->impl; void *jbobj; @@ -486,7 +486,7 @@ static int create_jb(struct ast_channel *chan, struct ast_frame *frr) void ast_jb_destroy(struct ast_channel *chan) { - struct ast_jb *jb = &chan->jb; + struct ast_jb *jb = ast_channel_jb(chan); const struct ast_jb_impl *jbimpl = jb->impl; void *jbobj = jb->jbobj; struct ast_frame *f; @@ -566,19 +566,19 @@ int ast_jb_read_conf(struct ast_jb_conf *conf, const char *varname, const char * void ast_jb_configure(struct ast_channel *chan, const struct ast_jb_conf *conf) { - memcpy(&chan->jb.conf, conf, sizeof(*conf)); + memcpy(&ast_channel_jb(chan)->conf, conf, sizeof(*conf)); } void ast_jb_get_config(const struct ast_channel *chan, struct ast_jb_conf *conf) { - memcpy(conf, &chan->jb.conf, sizeof(*conf)); + memcpy(conf, &ast_channel_jb((struct ast_channel *) chan)->conf, sizeof(*conf)); } void ast_jb_empty_and_reset(struct ast_channel *c0, struct ast_channel *c1) { - struct ast_jb *jb0 = &c0->jb; - struct ast_jb *jb1 = &c1->jb; + struct ast_jb *jb0 = ast_channel_jb(c0); + struct ast_jb *jb1 = ast_channel_jb(c1); int c0_use_jb = ast_test_flag(jb0, JB_USE); int c0_jb_is_created = ast_test_flag(jb0, JB_CREATED); int c1_use_jb = ast_test_flag(jb1, JB_USE); diff --git a/main/app.c b/main/app.c index f937b0e30..1719a11f1 100644 --- a/main/app.c +++ b/main/app.c @@ -149,14 +149,14 @@ int ast_app_dtget(struct ast_channel *chan, const char *context, char *collect, } collect[x++] = res; if (!ast_matchmore_extension(chan, context, collect, 1, - S_COR(chan->caller.id.number.valid, chan->caller.id.number.str, NULL))) { + S_COR(ast_channel_caller(chan)->id.number.valid, ast_channel_caller(chan)->id.number.str, NULL))) { break; } } if (res >= 0) { res = ast_exists_extension(chan, context, collect, 1, - S_COR(chan->caller.id.number.valid, chan->caller.id.number.str, NULL)) ? 1 : 0; + S_COR(ast_channel_caller(chan)->id.number.valid, ast_channel_caller(chan)->id.number.str, NULL)) ? 1 : 0; } return res; diff --git a/main/autochan.c b/main/autochan.c index 31f11573f..a1cd033a2 100644 --- a/main/autochan.c +++ b/main/autochan.c @@ -48,7 +48,7 @@ struct ast_autochan *ast_autochan_setup(struct ast_channel *chan) autochan->chan = ast_channel_ref(chan); ast_channel_lock(autochan->chan); - AST_LIST_INSERT_TAIL(&autochan->chan->autochans, autochan, list); + AST_LIST_INSERT_TAIL(ast_channel_autochans(autochan->chan), autochan, list); ast_channel_unlock(autochan->chan); ast_debug(1, "Created autochan %p to hold channel %s (%p)\n", autochan, ast_channel_name(chan), chan); @@ -61,7 +61,7 @@ void ast_autochan_destroy(struct ast_autochan *autochan) struct ast_autochan *autochan_iter; ast_channel_lock(autochan->chan); - AST_LIST_TRAVERSE_SAFE_BEGIN(&autochan->chan->autochans, autochan_iter, list) { + AST_LIST_TRAVERSE_SAFE_BEGIN(ast_channel_autochans(autochan->chan), autochan_iter, list) { if (autochan_iter == autochan) { AST_LIST_REMOVE_CURRENT(list); ast_debug(1, "Removed autochan %p from the list, about to free it\n", autochan); @@ -80,9 +80,9 @@ void ast_autochan_new_channel(struct ast_channel *old_chan, struct ast_channel * { struct ast_autochan *autochan; - AST_LIST_APPEND_LIST(&new_chan->autochans, &old_chan->autochans, list); + AST_LIST_APPEND_LIST(ast_channel_autochans(new_chan), ast_channel_autochans(old_chan), list); - AST_LIST_TRAVERSE(&new_chan->autochans, autochan, list) { + AST_LIST_TRAVERSE(ast_channel_autochans(new_chan), autochan, list) { if (autochan->chan == old_chan) { autochan->chan = ast_channel_unref(old_chan); autochan->chan = ast_channel_ref(new_chan); diff --git a/main/ccss.c b/main/ccss.c index ad3e82ec0..31270c41e 100644 --- a/main/ccss.c +++ b/main/ccss.c @@ -2531,11 +2531,11 @@ static int cc_generic_agent_init(struct ast_cc_agent *agent, struct ast_channel } generic_pvt->offer_timer_id = -1; - if (chan->caller.id.number.valid && chan->caller.id.number.str) { - ast_copy_string(generic_pvt->cid_num, chan->caller.id.number.str, sizeof(generic_pvt->cid_num)); + if (ast_channel_caller(chan)->id.number.valid && ast_channel_caller(chan)->id.number.str) { + ast_copy_string(generic_pvt->cid_num, ast_channel_caller(chan)->id.number.str, sizeof(generic_pvt->cid_num)); } - if (chan->caller.id.name.valid && chan->caller.id.name.str) { - ast_copy_string(generic_pvt->cid_name, chan->caller.id.name.str, sizeof(generic_pvt->cid_name)); + if (ast_channel_caller(chan)->id.name.valid && ast_channel_caller(chan)->id.name.str) { + ast_copy_string(generic_pvt->cid_name, ast_channel_caller(chan)->id.name.str, sizeof(generic_pvt->cid_name)); } ast_copy_string(generic_pvt->exten, S_OR(ast_channel_macroexten(chan), ast_channel_exten(chan)), sizeof(generic_pvt->exten)); ast_copy_string(generic_pvt->context, S_OR(ast_channel_macrocontext(chan), ast_channel_context(chan)), sizeof(generic_pvt->context)); diff --git a/main/cdr.c b/main/cdr.c index af6885308..29deb2fe9 100644 --- a/main/cdr.c +++ b/main/cdr.c @@ -893,18 +893,18 @@ static void set_one_cid(struct ast_cdr *cdr, struct ast_channel *c) } /* Grab source from ANI or normal Caller*ID */ - num = S_COR(c->caller.ani.number.valid, c->caller.ani.number.str, - S_COR(c->caller.id.number.valid, c->caller.id.number.str, NULL)); + num = S_COR(ast_channel_caller(c)->ani.number.valid, ast_channel_caller(c)->ani.number.str, + S_COR(ast_channel_caller(c)->id.number.valid, ast_channel_caller(c)->id.number.str, NULL)); ast_callerid_merge(cdr->clid, sizeof(cdr->clid), - S_COR(c->caller.id.name.valid, c->caller.id.name.str, NULL), num, ""); + S_COR(ast_channel_caller(c)->id.name.valid, ast_channel_caller(c)->id.name.str, NULL), num, ""); ast_copy_string(cdr->src, S_OR(num, ""), sizeof(cdr->src)); - ast_cdr_setvar(cdr, "dnid", S_OR(c->dialed.number.str, ""), 0); + ast_cdr_setvar(cdr, "dnid", S_OR(ast_channel_dialed(c)->number.str, ""), 0); - if (c->caller.id.subaddress.valid) { - ast_cdr_setvar(cdr, "callingsubaddr", S_OR(c->caller.id.subaddress.str, ""), 0); + if (ast_channel_caller(c)->id.subaddress.valid) { + ast_cdr_setvar(cdr, "callingsubaddr", S_OR(ast_channel_caller(c)->id.subaddress.str, ""), 0); } - if (c->dialed.subaddress.valid) { - ast_cdr_setvar(cdr, "calledsubaddr", S_OR(c->dialed.subaddress.str, ""), 0); + if (ast_channel_dialed(c)->subaddress.valid) { + ast_cdr_setvar(cdr, "calledsubaddr", S_OR(ast_channel_dialed(c)->subaddress.str, ""), 0); } } diff --git a/main/cel.c b/main/cel.c index fdf1bf0f1..efc7e7447 100644 --- a/main/cel.c +++ b/main/cel.c @@ -414,7 +414,7 @@ struct ast_channel *ast_cel_fabricate_channel_from_event(const struct ast_event return NULL; } - headp = &tchan->varshead; + headp = ast_channel_varshead(tchan); /* first, get the variables from the event */ if (ast_cel_fill_record(event, &record)) { @@ -452,15 +452,15 @@ struct ast_channel *ast_cel_fabricate_channel_from_event(const struct ast_event AST_LIST_INSERT_HEAD(headp, newvariable, entries); } - tchan->caller.id.name.valid = 1; - tchan->caller.id.name.str = ast_strdup(record.caller_id_name); - tchan->caller.id.number.valid = 1; - tchan->caller.id.number.str = ast_strdup(record.caller_id_num); - tchan->caller.ani.number.valid = 1; - tchan->caller.ani.number.str = ast_strdup(record.caller_id_ani); - tchan->redirecting.from.number.valid = 1; - tchan->redirecting.from.number.str = ast_strdup(record.caller_id_rdnis); - tchan->dialed.number.str = ast_strdup(record.caller_id_dnid); + ast_channel_caller(tchan)->id.name.valid = 1; + ast_channel_caller(tchan)->id.name.str = ast_strdup(record.caller_id_name); + ast_channel_caller(tchan)->id.number.valid = 1; + ast_channel_caller(tchan)->id.number.str = ast_strdup(record.caller_id_num); + ast_channel_caller(tchan)->ani.number.valid = 1; + ast_channel_caller(tchan)->ani.number.str = ast_strdup(record.caller_id_ani); + ast_channel_redirecting(tchan)->from.number.valid = 1; + ast_channel_redirecting(tchan)->from.number.str = ast_strdup(record.caller_id_rdnis); + ast_channel_dialed(tchan)->number.str = ast_strdup(record.caller_id_dnid); ast_channel_exten_set(tchan, record.extension); ast_channel_context_set(tchan, record.context); @@ -552,15 +552,15 @@ int ast_cel_report_event(struct ast_channel *chan, enum ast_cel_event_type event AST_EVENT_IE_CEL_EVENT_TIME_USEC, AST_EVENT_IE_PLTYPE_UINT, eventtime.tv_usec, AST_EVENT_IE_CEL_USEREVENT_NAME, AST_EVENT_IE_PLTYPE_STR, userdefevname, AST_EVENT_IE_CEL_CIDNAME, AST_EVENT_IE_PLTYPE_STR, - S_COR(chan->caller.id.name.valid, chan->caller.id.name.str, ""), + S_COR(ast_channel_caller(chan)->id.name.valid, ast_channel_caller(chan)->id.name.str, ""), AST_EVENT_IE_CEL_CIDNUM, AST_EVENT_IE_PLTYPE_STR, - S_COR(chan->caller.id.number.valid, chan->caller.id.number.str, ""), + S_COR(ast_channel_caller(chan)->id.number.valid, ast_channel_caller(chan)->id.number.str, ""), AST_EVENT_IE_CEL_CIDANI, AST_EVENT_IE_PLTYPE_STR, - S_COR(chan->caller.ani.number.valid, chan->caller.ani.number.str, ""), + S_COR(ast_channel_caller(chan)->ani.number.valid, ast_channel_caller(chan)->ani.number.str, ""), AST_EVENT_IE_CEL_CIDRDNIS, AST_EVENT_IE_PLTYPE_STR, - S_COR(chan->redirecting.from.number.valid, chan->redirecting.from.number.str, ""), + S_COR(ast_channel_redirecting(chan)->from.number.valid, ast_channel_redirecting(chan)->from.number.str, ""), AST_EVENT_IE_CEL_CIDDNID, AST_EVENT_IE_PLTYPE_STR, - S_OR(chan->dialed.number.str, ""), + S_OR(ast_channel_dialed(chan)->number.str, ""), AST_EVENT_IE_CEL_EXTEN, AST_EVENT_IE_PLTYPE_STR, ast_channel_exten(chan), AST_EVENT_IE_CEL_CONTEXT, AST_EVENT_IE_PLTYPE_STR, ast_channel_context(chan), AST_EVENT_IE_CEL_CHANNAME, AST_EVENT_IE_PLTYPE_STR, ast_channel_name(chan), diff --git a/main/channel.c b/main/channel.c index c900d0e65..387b98bea 100644 --- a/main/channel.c +++ b/main/channel.c @@ -585,11 +585,11 @@ int ast_check_hangup(struct ast_channel *chan) { if (chan->_softhangup) /* yes if soft hangup flag set */ return 1; - if (ast_tvzero(chan->whentohangup)) /* no if no hangup scheduled */ + if (ast_tvzero(*ast_channel_whentohangup(chan))) /* no if no hangup scheduled */ return 0; - if (ast_tvdiff_ms(chan->whentohangup, ast_tvnow()) > 0) /* no if hangup time has not come yet. */ + if (ast_tvdiff_ms(*ast_channel_whentohangup(chan), ast_tvnow()) > 0) /* no if hangup time has not come yet. */ return 0; - ast_debug(4, "Hangup time has come: %" PRIi64 "\n", ast_tvdiff_ms(chan->whentohangup, ast_tvnow())); + ast_debug(4, "Hangup time has come: %" PRIi64 "\n", ast_tvdiff_ms(*ast_channel_whentohangup(chan), ast_tvnow())); chan->_softhangup |= AST_SOFTHANGUP_TIMEOUT; /* record event */ return 1; } @@ -642,7 +642,12 @@ int ast_shutting_down(void) /*! \brief Set when to hangup channel */ void ast_channel_setwhentohangup_tv(struct ast_channel *chan, struct timeval offset) { - chan->whentohangup = ast_tvzero(offset) ? offset : ast_tvadd(offset, ast_tvnow()); + if (ast_tvzero(offset)) { + ast_channel_whentohangup_set(chan, &offset); + } else { + struct timeval tv = ast_tvadd(offset, ast_tvnow()); + ast_channel_whentohangup_set(chan, &tv); + } ast_queue_frame(chan, &ast_null_frame); return; } @@ -658,7 +663,7 @@ int ast_channel_cmpwhentohangup_tv(struct ast_channel *chan, struct timeval offs { struct timeval whentohangup; - if (ast_tvzero(chan->whentohangup)) + if (ast_tvzero(*ast_channel_whentohangup(chan))) return ast_tvzero(offset) ? 0 : -1; if (ast_tvzero(offset)) @@ -666,7 +671,7 @@ int ast_channel_cmpwhentohangup_tv(struct ast_channel *chan, struct timeval offs whentohangup = ast_tvadd(offset, ast_tvnow()); - return ast_tvdiff_ms(whentohangup, chan->whentohangup); + return ast_tvdiff_ms(whentohangup, *ast_channel_whentohangup(chan)); } int ast_channel_cmpwhentohangup(struct ast_channel *chan, time_t offset) @@ -971,22 +976,22 @@ __ast_channel_alloc_ap(int needqueue, int state, const char *cid_num, const char } ast_channel_sched_set(tmp, schedctx); - ast_party_dialed_init(&tmp->dialed); - ast_party_caller_init(&tmp->caller); - ast_party_connected_line_init(&tmp->connected); - ast_party_redirecting_init(&tmp->redirecting); + ast_party_dialed_init(ast_channel_dialed(tmp)); + ast_party_caller_init(ast_channel_caller(tmp)); + ast_party_connected_line_init(ast_channel_connected(tmp)); + ast_party_redirecting_init(ast_channel_redirecting(tmp)); if (cid_name) { - tmp->caller.id.name.valid = 1; - tmp->caller.id.name.str = ast_strdup(cid_name); - if (!tmp->caller.id.name.str) { + ast_channel_caller(tmp)->id.name.valid = 1; + ast_channel_caller(tmp)->id.name.str = ast_strdup(cid_name); + if (!ast_channel_caller(tmp)->id.name.str) { return ast_channel_unref(tmp); } } if (cid_num) { - tmp->caller.id.number.valid = 1; - tmp->caller.id.number.str = ast_strdup(cid_num); - if (!tmp->caller.id.number.str) { + ast_channel_caller(tmp)->id.number.valid = 1; + ast_channel_caller(tmp)->id.number.str = ast_strdup(cid_num); + if (!ast_channel_caller(tmp)->id.number.str) { return ast_channel_unref(tmp); } } @@ -1105,12 +1110,12 @@ __ast_channel_alloc_ap(int needqueue, int state, const char *cid_num, const char ast_cel_report_event(tmp, AST_CEL_CHANNEL_START, NULL, NULL, NULL); - headp = &tmp->varshead; + headp = ast_channel_varshead(tmp); AST_LIST_HEAD_INIT_NOLOCK(headp); - AST_LIST_HEAD_INIT_NOLOCK(&tmp->datastores); + AST_LIST_HEAD_INIT_NOLOCK(ast_channel_datastores(tmp)); - AST_LIST_HEAD_INIT_NOLOCK(&tmp->autochans); + AST_LIST_HEAD_INIT_NOLOCK(ast_channel_autochans(tmp)); ast_channel_language_set(tmp, defaultlanguage); @@ -1196,7 +1201,7 @@ struct ast_channel *ast_dummy_channel_alloc(void) return ast_channel_unref(tmp); } - headp = &tmp->varshead; + headp = ast_channel_varshead(tmp); AST_LIST_HEAD_INIT_NOLOCK(headp); return tmp; @@ -1218,7 +1223,7 @@ static int __ast_queue_frame(struct ast_channel *chan, struct ast_frame *fin, in * Check the last frame on the queue if we are queuing the new * frames after it. */ - cur = AST_LIST_LAST(&chan->readq); + cur = AST_LIST_LAST(ast_channel_readq(chan)); if (cur && cur->frametype == AST_FRAME_CONTROL && !head && (!after || after == cur)) { switch (cur->subclass.integer) { case AST_CONTROL_END_OF_Q: @@ -1228,7 +1233,7 @@ static int __ast_queue_frame(struct ast_channel *chan, struct ast_frame *fin, in * Destroy the end-of-Q marker frame so we can queue the hangup * frame in its place. */ - AST_LIST_REMOVE(&chan->readq, cur, frame_list); + AST_LIST_REMOVE(ast_channel_readq(chan), cur, frame_list); ast_frfree(cur); /* @@ -1268,7 +1273,7 @@ static int __ast_queue_frame(struct ast_channel *chan, struct ast_frame *fin, in } /* Count how many frames exist on the queue */ - AST_LIST_TRAVERSE(&chan->readq, cur, frame_list) { + AST_LIST_TRAVERSE(ast_channel_readq(chan), cur, frame_list) { queued_frames++; if (cur->frametype == AST_FRAME_VOICE) { queued_voice_frames++; @@ -1278,7 +1283,7 @@ static int __ast_queue_frame(struct ast_channel *chan, struct ast_frame *fin, in if ((queued_frames + new_frames > 128 || queued_voice_frames + new_voice_frames > 96)) { int count = 0; ast_log(LOG_WARNING, "Exceptionally long %squeue length queuing to %s\n", queued_frames + new_frames > 128 ? "" : "voice ", ast_channel_name(chan)); - AST_LIST_TRAVERSE_SAFE_BEGIN(&chan->readq, cur, frame_list) { + AST_LIST_TRAVERSE_SAFE_BEGIN(ast_channel_readq(chan), cur, frame_list) { /* Save the most recent frame */ if (!AST_LIST_NEXT(cur, frame_list)) { break; @@ -1294,13 +1299,13 @@ static int __ast_queue_frame(struct ast_channel *chan, struct ast_frame *fin, in } if (after) { - AST_LIST_INSERT_LIST_AFTER(&chan->readq, &frames, after, frame_list); + AST_LIST_INSERT_LIST_AFTER(ast_channel_readq(chan), &frames, after, frame_list); } else { if (head) { - AST_LIST_APPEND_LIST(&frames, &chan->readq, frame_list); - AST_LIST_HEAD_INIT_NOLOCK(&chan->readq); + AST_LIST_APPEND_LIST(&frames, ast_channel_readq(chan), frame_list); + AST_LIST_HEAD_INIT_NOLOCK(ast_channel_readq(chan)); } - AST_LIST_APPEND_LIST(&chan->readq, &frames, frame_list); + AST_LIST_APPEND_LIST(ast_channel_readq(chan), &frames, frame_list); } if (chan->alertpipe[1] > -1) { @@ -2198,7 +2203,7 @@ static void ast_channel_destructor(void *obj) /* Get rid of each of the data stores on the channel */ ast_channel_lock(chan); - while ((datastore = AST_LIST_REMOVE_HEAD(&chan->datastores, entry))) + while ((datastore = AST_LIST_REMOVE_HEAD(ast_channel_datastores(chan), entry))) /* Free the data store */ ast_datastore_free(datastore); ast_channel_unlock(chan); @@ -2245,10 +2250,10 @@ static void ast_channel_destructor(void *obj) if (ast_channel_pbx(chan)) ast_log(LOG_WARNING, "PBX may not have been terminated properly on '%s'\n", ast_channel_name(chan)); - ast_party_dialed_free(&chan->dialed); - ast_party_caller_free(&chan->caller); - ast_party_connected_line_free(&chan->connected); - ast_party_redirecting_free(&chan->redirecting); + ast_party_dialed_free(ast_channel_dialed(chan)); + ast_party_caller_free(ast_channel_caller(chan)); + ast_party_connected_line_free(ast_channel_connected(chan)); + ast_party_redirecting_free(ast_channel_redirecting(chan)); /* Close pipes if appropriate */ if ((fd = chan->alertpipe[0]) > -1) @@ -2265,12 +2270,12 @@ static void ast_channel_destructor(void *obj) } close(ast_channel_epfd(chan)); #endif - while ((f = AST_LIST_REMOVE_HEAD(&chan->readq, frame_list))) + while ((f = AST_LIST_REMOVE_HEAD(ast_channel_readq(chan), frame_list))) ast_frfree(f); /* loop over the variables list, freeing all data and deleting list items */ /* no need to lock the list, as the channel is already locked */ - headp = &chan->varshead; + headp = ast_channel_varshead(chan); while ((vardata = AST_LIST_REMOVE_HEAD(headp, entries))) ast_var_delete(vardata); @@ -2311,12 +2316,12 @@ static void ast_dummy_channel_destructor(void *obj) struct ast_var_t *vardata; struct varshead *headp; - headp = &chan->varshead; + headp = ast_channel_varshead(chan); - ast_party_dialed_free(&chan->dialed); - ast_party_caller_free(&chan->caller); - ast_party_connected_line_free(&chan->connected); - ast_party_redirecting_free(&chan->redirecting); + ast_party_dialed_free(ast_channel_dialed(chan)); + ast_party_caller_free(ast_channel_caller(chan)); + ast_party_connected_line_free(ast_channel_connected(chan)); + ast_party_redirecting_free(ast_channel_redirecting(chan)); /* loop over the variables list, freeing all data and deleting list items */ /* no need to lock the list, as the channel is already locked */ @@ -2345,13 +2350,13 @@ int ast_channel_datastore_inherit(struct ast_channel *from, struct ast_channel * { struct ast_datastore *datastore = NULL, *datastore2; - AST_LIST_TRAVERSE(&from->datastores, datastore, entry) { + AST_LIST_TRAVERSE(ast_channel_datastores(from), datastore, entry) { if (datastore->inheritance > 0) { datastore2 = ast_datastore_alloc(datastore->info, datastore->uid); if (datastore2) { datastore2->data = datastore->info->duplicate ? datastore->info->duplicate(datastore->data) : NULL; datastore2->inheritance = datastore->inheritance == DATASTORE_INHERIT_FOREVER ? DATASTORE_INHERIT_FOREVER : datastore->inheritance - 1; - AST_LIST_INSERT_TAIL(&to->datastores, datastore2, entry); + AST_LIST_INSERT_TAIL(ast_channel_datastores(to), datastore2, entry); } } } @@ -2362,14 +2367,14 @@ int ast_channel_datastore_add(struct ast_channel *chan, struct ast_datastore *da { int res = 0; - AST_LIST_INSERT_HEAD(&chan->datastores, datastore, entry); + AST_LIST_INSERT_HEAD(ast_channel_datastores(chan), datastore, entry); return res; } int ast_channel_datastore_remove(struct ast_channel *chan, struct ast_datastore *datastore) { - return AST_LIST_REMOVE(&chan->datastores, datastore, entry) ? 0 : -1; + return AST_LIST_REMOVE(ast_channel_datastores(chan), datastore, entry) ? 0 : -1; } struct ast_datastore *ast_channel_datastore_find(struct ast_channel *chan, const struct ast_datastore_info *info, const char *uid) @@ -2379,7 +2384,7 @@ struct ast_datastore *ast_channel_datastore_find(struct ast_channel *chan, const if (info == NULL) return NULL; - AST_LIST_TRAVERSE(&chan->datastores, datastore, entry) { + AST_LIST_TRAVERSE(ast_channel_datastores(chan), datastore, entry) { if (datastore->info != info) { continue; } @@ -2489,10 +2494,10 @@ void ast_channel_clear_softhangup(struct ast_channel *chan, int flag) * pulling the END_OF_Q frame out of the channel frame queue if it * still happens to be there. */ - fr = AST_LIST_LAST(&chan->readq); + fr = AST_LIST_LAST(ast_channel_readq(chan)); if (fr && fr->frametype == AST_FRAME_CONTROL && fr->subclass.integer == AST_CONTROL_END_OF_Q) { - AST_LIST_REMOVE(&chan->readq, fr, frame_list); + AST_LIST_REMOVE(ast_channel_readq(chan), fr, frame_list); ast_frfree(fr); } } @@ -2688,10 +2693,10 @@ int ast_hangup(struct ast_channel *chan) "Cause-txt: %s\r\n", ast_channel_name(chan), ast_channel_uniqueid(chan), - S_COR(chan->caller.id.number.valid, chan->caller.id.number.str, ""), - S_COR(chan->caller.id.name.valid, chan->caller.id.name.str, ""), - S_COR(chan->connected.id.number.valid, chan->connected.id.number.str, ""), - S_COR(chan->connected.id.name.valid, chan->connected.id.name.str, ""), + S_COR(ast_channel_caller(chan)->id.number.valid, ast_channel_caller(chan)->id.number.str, ""), + S_COR(ast_channel_caller(chan)->id.name.valid, ast_channel_caller(chan)->id.name.str, ""), + S_COR(ast_channel_connected(chan)->id.number.valid, ast_channel_connected(chan)->id.number.str, ""), + S_COR(ast_channel_connected(chan)->id.name.valid, ast_channel_connected(chan)->id.name.str, ""), ast_channel_hangupcause(chan), ast_cause2str(ast_channel_hangupcause(chan)) ); @@ -3001,10 +3006,10 @@ struct ast_channel *ast_waitfor_nandfds(struct ast_channel **c, int n, int *fds, } ast_channel_lock(c[x]); - if (!ast_tvzero(c[x]->whentohangup)) { + if (!ast_tvzero(*ast_channel_whentohangup(c[x]))) { if (ast_tvzero(whentohangup)) now = ast_tvnow(); - diff = ast_tvsub(c[x]->whentohangup, now); + diff = ast_tvsub(*ast_channel_whentohangup(c[x]), now); if (diff.tv_sec < 0 || ast_tvzero(diff)) { /* Should already be hungup */ c[x]->_softhangup |= AST_SOFTHANGUP_TIMEOUT; @@ -3073,7 +3078,7 @@ struct ast_channel *ast_waitfor_nandfds(struct ast_channel **c, int n, int *fds, if (!ast_tvzero(whentohangup)) { /* if we have a timeout, check who expired */ now = ast_tvnow(); for (x = 0; x < n; x++) { - if (!ast_tvzero(c[x]->whentohangup) && ast_tvcmp(c[x]->whentohangup, now) <= 0) { + if (!ast_tvzero(*ast_channel_whentohangup(c[x])) && ast_tvcmp(*ast_channel_whentohangup(c[x]), now) <= 0) { c[x]->_softhangup |= AST_SOFTHANGUP_TIMEOUT; if (winner == NULL) winner = c[x]; @@ -3136,8 +3141,8 @@ static struct ast_channel *ast_waitfor_nandfds_simple(struct ast_channel *chan, ast_channel_lock(chan); /* Figure out their timeout */ - if (!ast_tvzero(chan->whentohangup)) { - if ((diff = ast_tvdiff_ms(chan->whentohangup, ast_tvnow())) < 0) { + if (!ast_tvzero(*ast_channel_whentohangup(chan))) { + if ((diff = ast_tvdiff_ms(*ast_channel_whentohangup(chan), ast_tvnow())) < 0) { /* They should already be hungup! */ chan->_softhangup |= AST_SOFTHANGUP_TIMEOUT; ast_channel_unlock(chan); @@ -3170,8 +3175,8 @@ static struct ast_channel *ast_waitfor_nandfds_simple(struct ast_channel *chan, } /* If this channel has a timeout see if it expired */ - if (!ast_tvzero(chan->whentohangup)) { - if (ast_tvdiff_ms(ast_tvnow(), chan->whentohangup) >= 0) { + if (!ast_tvzero(*ast_channel_whentohangup(chan))) { + if (ast_tvdiff_ms(ast_tvnow(), *ast_channel_whentohangup(chan)) >= 0) { chan->_softhangup |= AST_SOFTHANGUP_TIMEOUT; winner = chan; } @@ -3217,10 +3222,10 @@ static struct ast_channel *ast_waitfor_nandfds_complex(struct ast_channel **c, i } ast_channel_lock(c[i]); - if (!ast_tvzero(c[i]->whentohangup)) { + if (!ast_tvzero(*ast_channel_whentohangup(c[i]))) { if (whentohangup == 0) now = ast_tvnow(); - if ((diff = ast_tvdiff_ms(c[i]->whentohangup, now)) < 0) { + if ((diff = ast_tvdiff_ms(*ast_channel_whentohangup(c[i]), now)) < 0) { c[i]->_softhangup |= AST_SOFTHANGUP_TIMEOUT; ast_channel_unlock(c[i]); return c[i]; @@ -3256,7 +3261,7 @@ static struct ast_channel *ast_waitfor_nandfds_complex(struct ast_channel **c, i if (whentohangup) { now = ast_tvnow(); for (i = 0; i < n; i++) { - if (!ast_tvzero(c[i]->whentohangup) && ast_tvdiff_ms(now, c[i]->whentohangup) >= 0) { + if (!ast_tvzero(*ast_channel_whentohangup(c[i])) && ast_tvdiff_ms(now, *ast_channel_whentohangup(c[i])) >= 0) { c[i]->_softhangup |= AST_SOFTHANGUP_TIMEOUT; if (!winner) winner = c[i]; @@ -3512,7 +3517,7 @@ static void ast_read_generator_actions(struct ast_channel *chan, struct ast_fram static inline void queue_dtmf_readq(struct ast_channel *chan, struct ast_frame *f) { - struct ast_frame *fr = &chan->dtmff; + struct ast_frame *fr = ast_channel_dtmff(chan); fr->frametype = AST_FRAME_DTMF_END; fr->subclass.integer = f->subclass.integer; @@ -3536,8 +3541,8 @@ static inline int should_skip_dtmf(struct ast_channel *chan) return 1; } - if (!ast_tvzero(chan->dtmf_tv) && - ast_tvdiff_ms(ast_tvnow(), chan->dtmf_tv) < AST_MIN_DTMF_GAP) { + if (!ast_tvzero(*ast_channel_dtmf_tv(chan)) && + ast_tvdiff_ms(ast_tvnow(), *ast_channel_dtmf_tv(chan)) < AST_MIN_DTMF_GAP) { /* We're not in the middle of a digit, but it hasn't been long enough * since the last digit, so we'll have to skip DTMF for now. */ return 1; @@ -3681,8 +3686,8 @@ static struct ast_frame *__ast_read(struct ast_channel *chan, int dropaudio) return &ast_null_frame; case AST_TIMING_EVENT_CONTINUOUS: - if (AST_LIST_EMPTY(&chan->readq) || - !AST_LIST_NEXT(AST_LIST_FIRST(&chan->readq), frame_list)) { + if (AST_LIST_EMPTY(ast_channel_readq(chan)) || + !AST_LIST_NEXT(AST_LIST_FIRST(ast_channel_readq(chan)), frame_list)) { ast_timer_disable_continuous(ast_channel_timer(chan)); } break; @@ -3704,10 +3709,10 @@ static struct ast_frame *__ast_read(struct ast_channel *chan, int dropaudio) } /* Check for pending read queue */ - if (!AST_LIST_EMPTY(&chan->readq)) { + if (!AST_LIST_EMPTY(ast_channel_readq(chan))) { int skip_dtmf = should_skip_dtmf(chan); - AST_LIST_TRAVERSE_SAFE_BEGIN(&chan->readq, f, frame_list) { + AST_LIST_TRAVERSE_SAFE_BEGIN(ast_channel_readq(chan), f, frame_list) { /* We have to be picky about which frame we pull off of the readq because * there are cases where we want to leave DTMF frames on the queue until * some later time. */ @@ -3778,7 +3783,7 @@ static struct ast_frame *__ast_read(struct ast_channel *chan, int dropaudio) ast_channel_fdno_set(chan, -1); if (f) { - struct ast_frame *readq_tail = AST_LIST_LAST(&chan->readq); + struct ast_frame *readq_tail = AST_LIST_LAST(ast_channel_readq(chan)); struct ast_control_read_action_payload *read_action_payload; struct ast_party_connected_line connected; @@ -3813,7 +3818,7 @@ static struct ast_frame *__ast_read(struct ast_channel *chan, int dropaudio) switch (read_action_payload->action) { case AST_FRAME_READ_ACTION_CONNECTED_LINE_MACRO: ast_party_connected_line_init(&connected); - ast_party_connected_line_copy(&connected, &chan->connected); + ast_party_connected_line_copy(&connected, ast_channel_connected(chan)); if (ast_connected_line_parse_data(read_action_payload->payload, read_action_payload->payload_size, &connected)) { ast_party_connected_line_free(&connected); @@ -3841,18 +3846,19 @@ static struct ast_frame *__ast_read(struct ast_channel *chan, int dropaudio) ast_frfree(f); f = &ast_null_frame; } else if (!ast_test_flag(chan, AST_FLAG_IN_DTMF | AST_FLAG_END_DTMF_ONLY)) { - if (!ast_tvzero(chan->dtmf_tv) && - ast_tvdiff_ms(ast_tvnow(), chan->dtmf_tv) < AST_MIN_DTMF_GAP) { + if (!ast_tvzero(*ast_channel_dtmf_tv(chan)) && + ast_tvdiff_ms(ast_tvnow(), *ast_channel_dtmf_tv(chan)) < AST_MIN_DTMF_GAP) { /* If it hasn't been long enough, defer this digit */ queue_dtmf_readq(chan, f); ast_frfree(f); f = &ast_null_frame; } else { /* There was no begin, turn this into a begin and send the end later */ + struct timeval tv = ast_tvnow(); f->frametype = AST_FRAME_DTMF_BEGIN; ast_set_flag(chan, AST_FLAG_EMULATE_DTMF); ast_channel_dtmf_digit_to_emulate_set(chan, f->subclass.integer); - chan->dtmf_tv = ast_tvnow(); + ast_channel_dtmf_tv_set(chan, &tv); if (f->len) { if (f->len > AST_MIN_DTMF_DURATION) ast_channel_emulate_dtmf_duration_set(chan, f->len); @@ -3877,7 +3883,7 @@ static struct ast_frame *__ast_read(struct ast_channel *chan, int dropaudio) ast_log(LOG_DTMF, "DTMF end accepted with begin '%c' on %s\n", f->subclass.integer, ast_channel_name(chan)); ast_clear_flag(chan, AST_FLAG_IN_DTMF); if (!f->len) - f->len = ast_tvdiff_ms(now, chan->dtmf_tv); + f->len = ast_tvdiff_ms(now, *ast_channel_dtmf_tv(chan)); /* detect tones that were received on * the wire with durations shorter than @@ -3887,8 +3893,8 @@ static struct ast_frame *__ast_read(struct ast_channel *chan, int dropaudio) * dtmf emulation to be triggered later * on. */ - if (ast_tvdiff_ms(now, chan->dtmf_tv) < AST_MIN_DTMF_DURATION) { - f->len = ast_tvdiff_ms(now, chan->dtmf_tv); + if (ast_tvdiff_ms(now, *ast_channel_dtmf_tv(chan)) < AST_MIN_DTMF_DURATION) { + f->len = ast_tvdiff_ms(now, *ast_channel_dtmf_tv(chan)); ast_log(LOG_DTMF, "DTMF end '%c' detected to have actual duration %ld on the wire, emulation will be triggered on %s\n", f->subclass.integer, f->len, ast_channel_name(chan)); } } else if (!f->len) { @@ -3907,7 +3913,7 @@ static struct ast_frame *__ast_read(struct ast_channel *chan, int dropaudio) if (f->len < AST_MIN_DTMF_DURATION) { f->len = AST_MIN_DTMF_DURATION; } - chan->dtmf_tv = now; + ast_channel_dtmf_tv_set(chan, &now); } if (ast_channel_audiohooks(chan)) { struct ast_frame *old_frame = f; @@ -3921,14 +3927,15 @@ static struct ast_frame *__ast_read(struct ast_channel *chan, int dropaudio) send_dtmf_event(chan, "Received", f->subclass.integer, "Yes", "No"); ast_log(LOG_DTMF, "DTMF begin '%c' received on %s\n", f->subclass.integer, ast_channel_name(chan)); if ( ast_test_flag(chan, AST_FLAG_DEFER_DTMF | AST_FLAG_END_DTMF_ONLY | AST_FLAG_EMULATE_DTMF) || - (!ast_tvzero(chan->dtmf_tv) && - ast_tvdiff_ms(ast_tvnow(), chan->dtmf_tv) < AST_MIN_DTMF_GAP) ) { + (!ast_tvzero(*ast_channel_dtmf_tv(chan)) && + ast_tvdiff_ms(ast_tvnow(), *ast_channel_dtmf_tv(chan)) < AST_MIN_DTMF_GAP) ) { ast_log(LOG_DTMF, "DTMF begin ignored '%c' on %s\n", f->subclass.integer, ast_channel_name(chan)); ast_frfree(f); f = &ast_null_frame; } else { + struct timeval now = ast_tvnow(); ast_set_flag(chan, AST_FLAG_IN_DTMF); - chan->dtmf_tv = ast_tvnow(); + ast_channel_dtmf_tv_set(chan, &now); ast_log(LOG_DTMF, "DTMF begin passthrough '%c' on %s\n", f->subclass.integer, ast_channel_name(chan)); } break; @@ -3942,14 +3949,14 @@ static struct ast_frame *__ast_read(struct ast_channel *chan, int dropaudio) if (!ast_channel_emulate_dtmf_duration(chan)) { ast_clear_flag(chan, AST_FLAG_EMULATE_DTMF); ast_channel_dtmf_digit_to_emulate_set(chan, 0); - } else if (ast_tvdiff_ms(now, chan->dtmf_tv) >= ast_channel_emulate_dtmf_duration(chan)) { + } else if (ast_tvdiff_ms(now, *ast_channel_dtmf_tv(chan)) >= ast_channel_emulate_dtmf_duration(chan)) { ast_channel_emulate_dtmf_duration_set(chan, 0); ast_frfree(f); - f = &chan->dtmff; + f = ast_channel_dtmff(chan); f->frametype = AST_FRAME_DTMF_END; f->subclass.integer = ast_channel_dtmf_digit_to_emulate(chan); - f->len = ast_tvdiff_ms(now, chan->dtmf_tv); - chan->dtmf_tv = now; + f->len = ast_tvdiff_ms(now, *ast_channel_dtmf_tv(chan)); + ast_channel_dtmf_tv_set(chan, &now); ast_clear_flag(chan, AST_FLAG_EMULATE_DTMF); ast_channel_dtmf_digit_to_emulate_set(chan, 0); ast_log(LOG_DTMF, "DTMF end emulation of '%c' queued on %s\n", f->subclass.integer, ast_channel_name(chan)); @@ -3982,14 +3989,14 @@ static struct ast_frame *__ast_read(struct ast_channel *chan, int dropaudio) if (ast_test_flag(chan, AST_FLAG_EMULATE_DTMF) && !ast_test_flag(chan, AST_FLAG_IN_DTMF)) { struct timeval now = ast_tvnow(); - if (ast_tvdiff_ms(now, chan->dtmf_tv) >= ast_channel_emulate_dtmf_duration(chan)) { + if (ast_tvdiff_ms(now, *ast_channel_dtmf_tv(chan)) >= ast_channel_emulate_dtmf_duration(chan)) { ast_channel_emulate_dtmf_duration_set(chan, 0); ast_frfree(f); - f = &chan->dtmff; + f = ast_channel_dtmff(chan); f->frametype = AST_FRAME_DTMF_END; f->subclass.integer = ast_channel_dtmf_digit_to_emulate(chan); - f->len = ast_tvdiff_ms(now, chan->dtmf_tv); - chan->dtmf_tv = now; + f->len = ast_tvdiff_ms(now, *ast_channel_dtmf_tv(chan)); + ast_channel_dtmf_tv_set(chan, &now); if (ast_channel_audiohooks(chan)) { struct ast_frame *old_frame = f; f = ast_audiohook_write_list(chan, ast_channel_audiohooks(chan), AST_AUDIOHOOK_DIRECTION_READ, f); @@ -4224,7 +4231,7 @@ int ast_indicate_data(struct ast_channel *chan, int _condition, { struct ast_party_connected_line connected; - ast_party_connected_line_set_init(&connected, &chan->connected); + ast_party_connected_line_set_init(&connected, ast_channel_connected(chan)); res = ast_connected_line_parse_data(data, datalen, &connected); if (!res) { ast_channel_set_connected_line(chan, &connected, NULL); @@ -4237,7 +4244,7 @@ int ast_indicate_data(struct ast_channel *chan, int _condition, { struct ast_party_redirecting redirecting; - ast_party_redirecting_set_init(&redirecting, &chan->redirecting); + ast_party_redirecting_set_init(&redirecting, ast_channel_redirecting(chan)); res = ast_redirecting_parse_data(data, datalen, &redirecting); if (!res) { ast_channel_set_redirecting(chan, &redirecting, NULL); @@ -5236,7 +5243,7 @@ static void call_forward_inherit(struct ast_channel *new_chan, struct ast_channe */ ast_party_redirecting_init(&redirecting); ast_channel_lock(orig); - ast_party_redirecting_copy(&redirecting, &orig->redirecting); + ast_party_redirecting_copy(&redirecting, ast_channel_redirecting(orig)); ast_channel_unlock(orig); if (ast_channel_redirecting_sub(orig, parent, &redirecting, 0) && ast_channel_redirecting_macro(orig, parent, &redirecting, 1, 0)) { @@ -5302,8 +5309,8 @@ struct ast_channel *ast_call_forward(struct ast_channel *caller, struct ast_chan ast_channel_lock_both(orig, new_chan); ast_copy_flags(ast_channel_cdr(new_chan), ast_channel_cdr(orig), AST_CDR_FLAG_ORIGINATED); ast_channel_accountcode_set(new_chan, ast_channel_accountcode(orig)); - ast_party_connected_line_copy(&new_chan->connected, &orig->connected); - ast_party_redirecting_copy(&new_chan->redirecting, &orig->redirecting); + ast_party_connected_line_copy(ast_channel_connected(new_chan), ast_channel_connected(orig)); + ast_party_redirecting_copy(ast_channel_redirecting(new_chan), ast_channel_redirecting(orig)); ast_channel_unlock(new_chan); ast_channel_unlock(orig); @@ -5382,7 +5389,7 @@ struct ast_channel *__ast_request_and_dial(const char *type, struct ast_format_c ast_set_callerid(chan, cid_num, cid_name, cid_num); ast_set_flag(ast_channel_cdr(chan), AST_CDR_FLAG_ORIGINATED); - ast_party_connected_line_set_init(&connected, &chan->connected); + ast_party_connected_line_set_init(&connected, ast_channel_connected(chan)); if (cid_num) { connected.id.number.valid = 1; connected.id.number.str = (char *) cid_num; @@ -6135,7 +6142,7 @@ void ast_channel_inherit_variables(const struct ast_channel *parent, struct ast_ struct ast_var_t *current, *newvar; const char *varname; - AST_LIST_TRAVERSE(&parent->varshead, current, entries) { + AST_LIST_TRAVERSE(ast_channel_varshead((struct ast_channel *) parent), current, entries) { int vartype = 0; varname = ast_var_full_name(current); @@ -6152,14 +6159,14 @@ void ast_channel_inherit_variables(const struct ast_channel *parent, struct ast_ case 1: newvar = ast_var_assign(&varname[1], ast_var_value(current)); if (newvar) { - AST_LIST_INSERT_TAIL(&child->varshead, newvar, entries); + AST_LIST_INSERT_TAIL(ast_channel_varshead(child), newvar, entries); ast_debug(1, "Copying soft-transferable variable %s.\n", ast_var_name(newvar)); } break; case 2: newvar = ast_var_assign(varname, ast_var_value(current)); if (newvar) { - AST_LIST_INSERT_TAIL(&child->varshead, newvar, entries); + AST_LIST_INSERT_TAIL(ast_channel_varshead(child), newvar, entries); ast_debug(1, "Copying hard-transferable variable %s.\n", ast_var_name(newvar)); } break; @@ -6184,15 +6191,15 @@ static void clone_variables(struct ast_channel *original, struct ast_channel *cl struct ast_var_t *current, *newvar; /* Append variables from clone channel into original channel */ /* XXX Is this always correct? We have to in order to keep MACROS working XXX */ - if (AST_LIST_FIRST(&clonechan->varshead)) - AST_LIST_APPEND_LIST(&original->varshead, &clonechan->varshead, entries); + if (AST_LIST_FIRST(ast_channel_varshead(clonechan))) + AST_LIST_APPEND_LIST(ast_channel_varshead(original), ast_channel_varshead(clonechan), entries); /* then, dup the varshead list into the clone */ - AST_LIST_TRAVERSE(&original->varshead, current, entries) { + AST_LIST_TRAVERSE(ast_channel_varshead(original), current, entries) { newvar = ast_var_assign(current->name, current->value); if (newvar) - AST_LIST_INSERT_TAIL(&clonechan->varshead, newvar, entries); + AST_LIST_INSERT_TAIL(ast_channel_varshead(clonechan), newvar, entries); } } @@ -6359,7 +6366,7 @@ static void report_new_callerid(struct ast_channel *chan) { int pres; - pres = ast_party_id_presentation(&chan->caller.id); + pres = ast_party_id_presentation(&ast_channel_caller(chan)->id); ast_manager_event(chan, EVENT_FLAG_CALL, "NewCallerid", "Channel: %s\r\n" "CallerIDNum: %s\r\n" @@ -6367,8 +6374,8 @@ static void report_new_callerid(struct ast_channel *chan) "Uniqueid: %s\r\n" "CID-CallingPres: %d (%s)\r\n", ast_channel_name(chan), - S_COR(chan->caller.id.number.valid, chan->caller.id.number.str, ""), - S_COR(chan->caller.id.name.valid, chan->caller.id.name.str, ""), + S_COR(ast_channel_caller(chan)->id.number.valid, ast_channel_caller(chan)->id.number.str, ""), + S_COR(ast_channel_caller(chan)->id.name.valid, ast_channel_caller(chan)->id.name.str, ""), ast_channel_uniqueid(chan), pres, ast_describe_caller_presentation(pres) @@ -6614,14 +6621,14 @@ int ast_do_masquerade(struct ast_channel *original) * old (clone) channel. */ { - AST_LIST_HEAD_NOLOCK(, ast_frame) tmp_readq; + AST_LIST_HEAD_NOLOCK(,ast_frame) tmp_readq; AST_LIST_HEAD_SET_NOLOCK(&tmp_readq, NULL); - AST_LIST_APPEND_LIST(&tmp_readq, &original->readq, frame_list); - AST_LIST_APPEND_LIST(&original->readq, &clonechan->readq, frame_list); + AST_LIST_APPEND_LIST(&tmp_readq, ast_channel_readq(original), frame_list); + AST_LIST_APPEND_LIST(ast_channel_readq(original), ast_channel_readq(clonechan), frame_list); while ((current = AST_LIST_REMOVE_HEAD(&tmp_readq, frame_list))) { - AST_LIST_INSERT_TAIL(&original->readq, current, frame_list); + AST_LIST_INSERT_TAIL(ast_channel_readq(original), current, frame_list); if (original->alertpipe[1] > -1) { int poke = 0; @@ -6688,17 +6695,17 @@ int ast_do_masquerade(struct ast_channel *original) ast_app_group_update(clonechan, original); /* Move data stores over */ - if (AST_LIST_FIRST(&clonechan->datastores)) { + if (AST_LIST_FIRST(ast_channel_datastores(clonechan))) { struct ast_datastore *ds; /* We use a safe traversal here because some fixup routines actually * remove the datastore from the list and free them. */ - AST_LIST_TRAVERSE_SAFE_BEGIN(&clonechan->datastores, ds, entry) { + AST_LIST_TRAVERSE_SAFE_BEGIN(ast_channel_datastores(clonechan), ds, entry) { if (ds->info->chan_fixup) ds->info->chan_fixup(ds->data, clonechan, original); } AST_LIST_TRAVERSE_SAFE_END; - AST_LIST_APPEND_LIST(&original->datastores, &clonechan->datastores, entry); + AST_LIST_APPEND_LIST(ast_channel_datastores(original), ast_channel_datastores(clonechan), entry); } ast_autochan_new_channel(clonechan, original); @@ -6721,21 +6728,21 @@ int ast_do_masquerade(struct ast_channel *original) * Just swap the whole structures, nevermind the allocations, * they'll work themselves out. */ - exchange.dialed = original->dialed; - original->dialed = clonechan->dialed; - clonechan->dialed = exchange.dialed; + exchange.dialed = *ast_channel_dialed(original); + ast_channel_dialed_set(original, ast_channel_dialed(clonechan)); + ast_channel_dialed_set(clonechan, &exchange.dialed); - exchange.caller = original->caller; - original->caller = clonechan->caller; - clonechan->caller = exchange.caller; + exchange.caller = *ast_channel_caller(original); + ast_channel_caller_set(original, ast_channel_caller(clonechan)); + ast_channel_caller_set(clonechan, &exchange.caller); - exchange.connected = original->connected; - original->connected = clonechan->connected; - clonechan->connected = exchange.connected; + exchange.connected = *ast_channel_connected(original); + ast_channel_connected_set(original, ast_channel_connected(clonechan)); + ast_channel_connected_set(clonechan, &exchange.connected); - exchange.redirecting = original->redirecting; - original->redirecting = clonechan->redirecting; - clonechan->redirecting = exchange.redirecting; + exchange.redirecting = *ast_channel_redirecting(original); + ast_channel_redirecting_set(original, ast_channel_redirecting(clonechan)); + ast_channel_redirecting_set(clonechan, &exchange.redirecting); report_new_callerid(original); @@ -6862,19 +6869,19 @@ void ast_set_callerid(struct ast_channel *chan, const char *cid_num, const char ast_channel_lock(chan); if (cid_num) { - chan->caller.id.number.valid = 1; - ast_free(chan->caller.id.number.str); - chan->caller.id.number.str = ast_strdup(cid_num); + ast_channel_caller(chan)->id.number.valid = 1; + ast_free(ast_channel_caller(chan)->id.number.str); + ast_channel_caller(chan)->id.number.str = ast_strdup(cid_num); } if (cid_name) { - chan->caller.id.name.valid = 1; - ast_free(chan->caller.id.name.str); - chan->caller.id.name.str = ast_strdup(cid_name); + ast_channel_caller(chan)->id.name.valid = 1; + ast_free(ast_channel_caller(chan)->id.name.str); + ast_channel_caller(chan)->id.name.str = ast_strdup(cid_name); } if (cid_ani) { - chan->caller.ani.number.valid = 1; - ast_free(chan->caller.ani.number.str); - chan->caller.ani.number.str = ast_strdup(cid_ani); + ast_channel_caller(chan)->ani.number.valid = 1; + ast_free(ast_channel_caller(chan)->ani.number.str); + ast_channel_caller(chan)->ani.number.str = ast_strdup(cid_ani); } if (ast_channel_cdr(chan)) { ast_cdr_setcid(ast_channel_cdr(chan), chan); @@ -6887,13 +6894,13 @@ void ast_set_callerid(struct ast_channel *chan, const char *cid_num, const char void ast_channel_set_caller(struct ast_channel *chan, const struct ast_party_caller *caller, const struct ast_set_party_caller *update) { - if (&chan->caller == caller) { + if (ast_channel_caller(chan) == caller) { /* Don't set to self */ return; } ast_channel_lock(chan); - ast_party_caller_set(&chan->caller, caller, update); + ast_party_caller_set(ast_channel_caller(chan), caller, update); ast_channel_unlock(chan); } @@ -6902,19 +6909,19 @@ void ast_channel_set_caller_event(struct ast_channel *chan, const struct ast_par const char *pre_set_number; const char *pre_set_name; - if (&chan->caller == caller) { + if (ast_channel_caller(chan) == caller) { /* Don't set to self */ return; } ast_channel_lock(chan); pre_set_number = - S_COR(chan->caller.id.number.valid, chan->caller.id.number.str, NULL); - pre_set_name = S_COR(chan->caller.id.name.valid, chan->caller.id.name.str, NULL); - ast_party_caller_set(&chan->caller, caller, update); - if (S_COR(chan->caller.id.number.valid, chan->caller.id.number.str, NULL) + S_COR(ast_channel_caller(chan)->id.number.valid, ast_channel_caller(chan)->id.number.str, NULL); + pre_set_name = S_COR(ast_channel_caller(chan)->id.name.valid, ast_channel_caller(chan)->id.name.str, NULL); + ast_party_caller_set(ast_channel_caller(chan), caller, update); + if (S_COR(ast_channel_caller(chan)->id.number.valid, ast_channel_caller(chan)->id.number.str, NULL) != pre_set_number - || S_COR(chan->caller.id.name.valid, chan->caller.id.name.str, NULL) + || S_COR(ast_channel_caller(chan)->id.name.valid, ast_channel_caller(chan)->id.name.str, NULL) != pre_set_name) { /* The caller id name or number changed. */ report_new_callerid(chan); @@ -6956,10 +6963,10 @@ int ast_setstate(struct ast_channel *chan, enum ast_channel_state state) "ConnectedLineName: %s\r\n" "Uniqueid: %s\r\n", ast_channel_name(chan), ast_channel_state(chan), ast_state2str(ast_channel_state(chan)), - S_COR(chan->caller.id.number.valid, chan->caller.id.number.str, ""), - S_COR(chan->caller.id.name.valid, chan->caller.id.name.str, ""), - S_COR(chan->connected.id.number.valid, chan->connected.id.number.str, ""), - S_COR(chan->connected.id.name.valid, chan->connected.id.name.str, ""), + S_COR(ast_channel_caller(chan)->id.number.valid, ast_channel_caller(chan)->id.number.str, ""), + S_COR(ast_channel_caller(chan)->id.name.valid, ast_channel_caller(chan)->id.name.str, ""), + S_COR(ast_channel_connected(chan)->id.number.valid, ast_channel_connected(chan)->id.number.str, ""), + S_COR(ast_channel_connected(chan)->id.name.valid, ast_channel_connected(chan)->id.name.str, ""), ast_channel_uniqueid(chan)); return 0; @@ -7253,8 +7260,8 @@ static void manager_bridge_event(int onoff, int type, struct ast_channel *c0, st type == 1 ? "core" : "native", ast_channel_name(c0), ast_channel_name(c1), ast_channel_uniqueid(c0), ast_channel_uniqueid(c1), - S_COR(c0->caller.id.number.valid, c0->caller.id.number.str, ""), - S_COR(c1->caller.id.number.valid, c1->caller.id.number.str, "")); + S_COR(ast_channel_caller(c0)->id.number.valid, ast_channel_caller(c0)->id.number.str, ""), + S_COR(ast_channel_caller(c1)->id.number.valid, ast_channel_caller(c1)->id.number.str, "")); } static void update_bridge_vars(struct ast_channel *c0, struct ast_channel *c1) @@ -8216,13 +8223,13 @@ void ast_connected_line_copy_to_caller(struct ast_party_caller *dest, const stru void ast_channel_set_connected_line(struct ast_channel *chan, const struct ast_party_connected_line *connected, const struct ast_set_party_connected_line *update) { - if (&chan->connected == connected) { + if (ast_channel_connected(chan) == connected) { /* Don't set to self */ return; } ast_channel_lock(chan); - ast_party_connected_line_set(&chan->connected, connected, update); + ast_party_connected_line_set(ast_channel_connected(chan), connected, update); ast_channel_unlock(chan); } @@ -8869,13 +8876,13 @@ void ast_channel_queue_connected_line_update(struct ast_channel *chan, const str void ast_channel_set_redirecting(struct ast_channel *chan, const struct ast_party_redirecting *redirecting, const struct ast_set_party_redirecting *update) { - if (&chan->redirecting == redirecting) { + if (ast_channel_redirecting(chan) == redirecting) { /* Don't set to self */ return; } ast_channel_lock(chan); - ast_party_redirecting_set(&chan->redirecting, redirecting, update); + ast_party_redirecting_set(ast_channel_redirecting(chan), redirecting, update); ast_channel_unlock(chan); } @@ -9401,17 +9408,17 @@ int ast_channel_connected_line_macro(struct ast_channel *autoservice_chan, struc if (is_frame) { const struct ast_frame *frame = connected_info; - ast_connected_line_parse_data(frame->data.ptr, frame->datalen, ¯o_chan->connected); + ast_connected_line_parse_data(frame->data.ptr, frame->datalen, ast_channel_connected(macro_chan)); } else { const struct ast_party_connected_line *connected = connected_info; - ast_party_connected_line_copy(¯o_chan->connected, connected); + ast_party_connected_line_copy(ast_channel_connected(macro_chan), connected); } ast_channel_unlock(macro_chan); if (!(retval = ast_app_run_macro(autoservice_chan, macro_chan, macro, macro_args))) { ast_channel_lock(macro_chan); - ast_channel_update_connected_line(macro_chan, ¯o_chan->connected, NULL); + ast_channel_update_connected_line(macro_chan, ast_channel_connected(macro_chan), NULL); ast_channel_unlock(macro_chan); } @@ -9445,18 +9452,18 @@ int ast_channel_redirecting_macro(struct ast_channel *autoservice_chan, struct a if (is_frame) { const struct ast_frame *frame = redirecting_info; - ast_redirecting_parse_data(frame->data.ptr, frame->datalen, ¯o_chan->redirecting); + ast_redirecting_parse_data(frame->data.ptr, frame->datalen, ast_channel_redirecting(macro_chan)); } else { const struct ast_party_redirecting *redirecting = redirecting_info; - ast_party_redirecting_copy(¯o_chan->redirecting, redirecting); + ast_party_redirecting_copy(ast_channel_redirecting(macro_chan), redirecting); } ast_channel_unlock(macro_chan); retval = ast_app_run_macro(autoservice_chan, macro_chan, macro, macro_args); if (!retval) { ast_channel_lock(macro_chan); - ast_channel_update_redirecting(macro_chan, ¯o_chan->redirecting, NULL); + ast_channel_update_redirecting(macro_chan, ast_channel_redirecting(macro_chan), NULL); ast_channel_unlock(macro_chan); } @@ -9483,17 +9490,17 @@ int ast_channel_connected_line_sub(struct ast_channel *autoservice_chan, struct if (is_frame) { const struct ast_frame *frame = connected_info; - ast_connected_line_parse_data(frame->data.ptr, frame->datalen, &sub_chan->connected); + ast_connected_line_parse_data(frame->data.ptr, frame->datalen, ast_channel_connected(sub_chan)); } else { const struct ast_party_connected_line *connected = connected_info; - ast_party_connected_line_copy(&sub_chan->connected, connected); + ast_party_connected_line_copy(ast_channel_connected(sub_chan), connected); } ast_channel_unlock(sub_chan); if (!(retval = ast_app_run_sub(autoservice_chan, sub_chan, sub, sub_args))) { ast_channel_lock(sub_chan); - ast_channel_update_connected_line(sub_chan, &sub_chan->connected, NULL); + ast_channel_update_connected_line(sub_chan, ast_channel_connected(sub_chan), NULL); ast_channel_unlock(sub_chan); } @@ -9520,18 +9527,18 @@ int ast_channel_redirecting_sub(struct ast_channel *autoservice_chan, struct ast if (is_frame) { const struct ast_frame *frame = redirecting_info; - ast_redirecting_parse_data(frame->data.ptr, frame->datalen, &sub_chan->redirecting); + ast_redirecting_parse_data(frame->data.ptr, frame->datalen, ast_channel_redirecting(sub_chan)); } else { const struct ast_party_redirecting *redirecting = redirecting_info; - ast_party_redirecting_copy(&sub_chan->redirecting, redirecting); + ast_party_redirecting_copy(ast_channel_redirecting(sub_chan), redirecting); } ast_channel_unlock(sub_chan); retval = ast_app_run_sub(autoservice_chan, sub_chan, sub, sub_args); if (!retval) { ast_channel_lock(sub_chan); - ast_channel_update_redirecting(sub_chan, &sub_chan->redirecting, NULL); + ast_channel_update_redirecting(sub_chan, ast_channel_redirecting(sub_chan), NULL); ast_channel_unlock(sub_chan); } diff --git a/main/channel_internal_api.c b/main/channel_internal_api.c index df6345b33..bec785fb5 100644 --- a/main/channel_internal_api.c +++ b/main/channel_internal_api.c @@ -196,7 +196,7 @@ int ast_channel_data_add_structure(struct ast_data *tree, } channel_data_add_flags(data_flags, chan); - ast_data_add_uint(tree, "timetohangup", chan->whentohangup.tv_sec); + ast_data_add_uint(tree, "timetohangup", ast_channel_whentohangup(chan)->tv_sec); #if 0 /* XXX AstData: ast_callerid no longer exists. (Equivalent code not readily apparent.) */ /* callerid */ @@ -704,3 +704,75 @@ struct ast_format *ast_channel_writeformat(struct ast_channel *chan) { return &chan->__do_not_use_writeformat; } +struct ast_datastore_list *ast_channel_datastores(struct ast_channel *chan) +{ + return &chan->__do_not_use_datastores; +} +struct ast_autochan_list *ast_channel_autochans(struct ast_channel *chan) +{ + return &chan->__do_not_use_autochans; +} +struct ast_readq_list *ast_channel_readq(struct ast_channel *chan) +{ + return &chan->__do_not_use_readq; +} +struct ast_frame *ast_channel_dtmff(struct ast_channel *chan) +{ + return &chan->__do_not_use_dtmff; +} +struct ast_jb *ast_channel_jb(struct ast_channel *chan) +{ + return &chan->__do_not_use_jb; +} +struct ast_party_caller *ast_channel_caller(struct ast_channel *chan) +{ + return &chan->__do_not_use_caller; +} +struct ast_party_connected_line *ast_channel_connected(struct ast_channel *chan) +{ + return &chan->__do_not_use_connected; +} +struct ast_party_dialed *ast_channel_dialed(struct ast_channel *chan) +{ + return &chan->__do_not_use_dialed; +} +struct ast_party_redirecting *ast_channel_redirecting(struct ast_channel *chan) +{ + return &chan->__do_not_use_redirecting; +} +struct timeval *ast_channel_dtmf_tv(struct ast_channel *chan) +{ + return &chan->__do_not_use_dtmf_tv; +} +struct timeval *ast_channel_whentohangup(struct ast_channel *chan) +{ + return &chan->__do_not_use_whentohangup; +} +struct varshead *ast_channel_varshead(struct ast_channel *chan) +{ + return &chan->__do_not_use_varshead; +} +void ast_channel_caller_set(struct ast_channel *chan, struct ast_party_caller *value) +{ + chan->__do_not_use_caller = *value; +} +void ast_channel_connected_set(struct ast_channel *chan, struct ast_party_connected_line *value) +{ + chan->__do_not_use_connected = *value; +} +void ast_channel_dialed_set(struct ast_channel *chan, struct ast_party_dialed *value) +{ + chan->__do_not_use_dialed = *value; +} +void ast_channel_redirecting_set(struct ast_channel *chan, struct ast_party_redirecting *value) +{ + chan->__do_not_use_redirecting = *value; +} +void ast_channel_dtmf_tv_set(struct ast_channel *chan, struct timeval *value) +{ + chan->__do_not_use_dtmf_tv = *value; +} +void ast_channel_whentohangup_set(struct ast_channel *chan, struct timeval *value) +{ + chan->__do_not_use_whentohangup = *value; +} diff --git a/main/cli.c b/main/cli.c index ae9e9d383..bfb4d6d07 100644 --- a/main/cli.c +++ b/main/cli.c @@ -917,7 +917,7 @@ static char *handle_chanlist(struct ast_cli_entry *e, int cmd, struct ast_cli_ar ast_cli(a->fd, CONCISE_FORMAT_STRING, ast_channel_name(c), ast_channel_context(c), ast_channel_exten(c), ast_channel_priority(c), ast_state2str(ast_channel_state(c)), ast_channel_appl(c) ? ast_channel_appl(c) : "(None)", S_OR(ast_channel_data(c), ""), /* XXX different from verbose ? */ - S_COR(c->caller.id.number.valid, c->caller.id.number.str, ""), + S_COR(ast_channel_caller(c)->id.number.valid, ast_channel_caller(c)->id.number.str, ""), S_OR(ast_channel_accountcode(c), ""), S_OR(ast_channel_peeraccount(c), ""), ast_channel_amaflags(c), @@ -928,7 +928,7 @@ static char *handle_chanlist(struct ast_cli_entry *e, int cmd, struct ast_cli_ar ast_cli(a->fd, VERBOSE_FORMAT_STRING, ast_channel_name(c), ast_channel_context(c), ast_channel_exten(c), ast_channel_priority(c), ast_state2str(ast_channel_state(c)), ast_channel_appl(c) ? ast_channel_appl(c) : "(None)", ast_channel_data(c) ? S_OR(ast_channel_data(c), "(Empty)" ): "(None)", - S_COR(c->caller.id.number.valid, c->caller.id.number.str, ""), + S_COR(ast_channel_caller(c)->id.number.valid, ast_channel_caller(c)->id.number.str, ""), durbuf, S_OR(ast_channel_accountcode(c), ""), S_OR(ast_channel_peeraccount(c), ""), @@ -1476,11 +1476,11 @@ static char *handle_showchan(struct ast_cli_entry *e, int cmd, struct ast_cli_ar " Data: %s\n" " Blocking in: %s\n", ast_channel_name(c), ast_channel_tech(c)->type, ast_channel_uniqueid(c), ast_channel_linkedid(c), - S_COR(c->caller.id.number.valid, c->caller.id.number.str, "(N/A)"), - S_COR(c->caller.id.name.valid, c->caller.id.name.str, "(N/A)"), - S_COR(c->connected.id.number.valid, c->connected.id.number.str, "(N/A)"), - S_COR(c->connected.id.name.valid, c->connected.id.name.str, "(N/A)"), - S_OR(c->dialed.number.str, "(N/A)"), + S_COR(ast_channel_caller(c)->id.number.valid, ast_channel_caller(c)->id.number.str, "(N/A)"), + S_COR(ast_channel_caller(c)->id.name.valid, ast_channel_caller(c)->id.name.str, "(N/A)"), + S_COR(ast_channel_connected(c)->id.number.valid, ast_channel_connected(c)->id.number.str, "(N/A)"), + S_COR(ast_channel_connected(c)->id.name.valid, ast_channel_connected(c)->id.name.str, "(N/A)"), + S_OR(ast_channel_dialed(c)->number.str, "(N/A)"), ast_channel_language(c), ast_state2str(ast_channel_state(c)), ast_channel_state(c), ast_channel_rings(c), ast_getformatname_multiple(nf, sizeof(nf), ast_channel_nativeformats(c)), @@ -1493,7 +1493,7 @@ static char *handle_showchan(struct ast_cli_entry *e, int cmd, struct ast_cli_ar c->fds[0], ast_channel_fin(c) & ~DEBUGCHAN_FLAG, (ast_channel_fin(c) & DEBUGCHAN_FLAG) ? " (DEBUGGED)" : "", ast_channel_fout(c) & ~DEBUGCHAN_FLAG, (ast_channel_fout(c) & DEBUGCHAN_FLAG) ? " (DEBUGGED)" : "", - (long)c->whentohangup.tv_sec, + (long)ast_channel_whentohangup(c)->tv_sec, cdrtime, c->_bridge ? ast_channel_name(c->_bridge) : "", ast_bridged_channel(c) ? ast_channel_name(ast_bridged_channel(c)) : "", ast_channel_context(c), ast_channel_exten(c), ast_channel_priority(c), c->callgroup, c->pickupgroup, (ast_channel_appl(c) ? ast_channel_appl(c) : "(N/A)" ), (ast_channel_data(c) ? S_OR(ast_channel_data(c), "(Empty)") : "(None)"), diff --git a/main/dial.c b/main/dial.c index fe8a74faf..24dbf2841 100644 --- a/main/dial.c +++ b/main/dial.c @@ -272,7 +272,7 @@ static int begin_dial_channel(struct ast_dial_channel *channel, struct ast_chann ast_channel_appl_set(channel->owner, "AppDial2"); ast_channel_data_set(channel->owner, "(Outgoing Line)"); - memset(&channel->owner->whentohangup, 0, sizeof(channel->owner->whentohangup)); + memset(ast_channel_whentohangup(channel->owner), 0, sizeof(*ast_channel_whentohangup(channel->owner))); /* Inherit everything from he who spawned this dial */ if (chan) { @@ -280,11 +280,11 @@ static int begin_dial_channel(struct ast_dial_channel *channel, struct ast_chann ast_channel_datastore_inherit(chan, channel->owner); /* Copy over callerid information */ - ast_party_redirecting_copy(&channel->owner->redirecting, &chan->redirecting); + ast_party_redirecting_copy(ast_channel_redirecting(channel->owner), ast_channel_redirecting(chan)); - channel->owner->dialed.transit_network_select = chan->dialed.transit_network_select; + ast_channel_dialed(channel->owner)->transit_network_select = ast_channel_dialed(chan)->transit_network_select; - ast_connected_line_copy_from_caller(&channel->owner->connected, &chan->caller); + ast_connected_line_copy_from_caller(ast_channel_connected(channel->owner), ast_channel_caller(chan)); ast_channel_language_set(channel->owner, ast_channel_language(chan)); ast_channel_accountcode_set(channel->owner, ast_channel_accountcode(chan)); diff --git a/main/features.c b/main/features.c index 6f3d0f9cb..aa2810d18 100644 --- a/main/features.c +++ b/main/features.c @@ -1510,10 +1510,10 @@ static int park_call_full(struct ast_channel *chan, struct ast_channel *peer, st "Uniqueid: %s\r\n", pu->parkingexten, ast_channel_name(chan), pu->parkinglot->name, event_from, (long)pu->start.tv_sec + (long)(pu->parkingtime/1000) - (long)time(NULL), - S_COR(chan->caller.id.number.valid, chan->caller.id.number.str, ""), - S_COR(chan->caller.id.name.valid, chan->caller.id.name.str, ""), - S_COR(chan->connected.id.number.valid, chan->connected.id.number.str, ""), - S_COR(chan->connected.id.name.valid, chan->connected.id.name.str, ""), + S_COR(ast_channel_caller(chan)->id.number.valid, ast_channel_caller(chan)->id.number.str, ""), + S_COR(ast_channel_caller(chan)->id.name.valid, ast_channel_caller(chan)->id.name.str, ""), + S_COR(ast_channel_connected(chan)->id.number.valid, ast_channel_connected(chan)->id.number.str, ""), + S_COR(ast_channel_connected(chan)->id.name.valid, ast_channel_connected(chan)->id.name.str, ""), ast_channel_uniqueid(chan) ); ast_debug(4, "peer: %s\n", peer ? ast_channel_name(peer) : "-No peer-"); @@ -2069,10 +2069,10 @@ static int builtin_automonitor(struct ast_channel *chan, struct ast_channel *pee snprintf(touch_filename, len, "%s-%ld-%s", S_OR(touch_monitor_prefix, "auto"), (long)time(NULL), touch_monitor); snprintf(args, len, "%s,%s,m", S_OR(touch_format, "wav"), touch_filename); } else { - caller_chan_id = ast_strdupa(S_COR(caller_chan->caller.id.number.valid, - caller_chan->caller.id.number.str, ast_channel_name(caller_chan))); - callee_chan_id = ast_strdupa(S_COR(callee_chan->caller.id.number.valid, - callee_chan->caller.id.number.str, ast_channel_name(callee_chan))); + caller_chan_id = ast_strdupa(S_COR(ast_channel_caller(caller_chan)->id.number.valid, + ast_channel_caller(caller_chan)->id.number.str, ast_channel_name(caller_chan))); + callee_chan_id = ast_strdupa(S_COR(ast_channel_caller(callee_chan)->id.number.valid, + ast_channel_caller(callee_chan)->id.number.str, ast_channel_name(callee_chan))); len = strlen(caller_chan_id) + strlen(callee_chan_id) + 50; args = alloca(len); touch_filename = alloca(len); @@ -2185,10 +2185,10 @@ static int builtin_automixmonitor(struct ast_channel *chan, struct ast_channel * snprintf(touch_filename, len, "auto-%ld-%s", (long)time(NULL), touch_monitor); snprintf(args, len, "%s.%s,b", touch_filename, (touch_format) ? touch_format : "wav"); } else { - caller_chan_id = ast_strdupa(S_COR(caller_chan->caller.id.number.valid, - caller_chan->caller.id.number.str, ast_channel_name(caller_chan))); - callee_chan_id = ast_strdupa(S_COR(callee_chan->caller.id.number.valid, - callee_chan->caller.id.number.str, ast_channel_name(callee_chan))); + caller_chan_id = ast_strdupa(S_COR(ast_channel_caller(caller_chan)->id.number.valid, + ast_channel_caller(caller_chan)->id.number.str, ast_channel_name(caller_chan))); + callee_chan_id = ast_strdupa(S_COR(ast_channel_caller(callee_chan)->id.number.valid, + ast_channel_caller(callee_chan)->id.number.str, ast_channel_name(callee_chan))); len = strlen(caller_chan_id) + strlen(callee_chan_id) + 50; args = alloca(len); touch_filename = alloca(len); @@ -2532,7 +2532,7 @@ static int builtin_atxfer(struct ast_channel *chan, struct ast_channel *peer, st /* Save connected line info for party B about party A in case transfer fails. */ ast_party_connected_line_init(&connected_line); ast_channel_lock(transferer); - ast_party_connected_line_copy(&connected_line, &transferer->connected); + ast_party_connected_line_copy(&connected_line, ast_channel_connected(transferer)); ast_channel_unlock(transferer); connected_line.source = AST_CONNECTED_LINE_UPDATE_SOURCE_TRANSFER; @@ -2814,7 +2814,7 @@ static int builtin_atxfer(struct ast_channel *chan, struct ast_channel *peer, st * Due to a limitation regarding when callerID is set on a Local channel, * we use the transferer's connected line information here. */ - ast_party_connected_line_copy(&connected_line, &transferer->connected); + ast_party_connected_line_copy(&connected_line, ast_channel_connected(transferer)); ast_channel_unlock(transferer); connected_line.source = AST_CONNECTED_LINE_UPDATE_SOURCE_TRANSFER; if (ast_channel_connected_line_sub(newchan, xferchan, &connected_line, 0) && @@ -2824,7 +2824,7 @@ static int builtin_atxfer(struct ast_channel *chan, struct ast_channel *peer, st /* Transfer party A connected line to party C */ ast_channel_lock(xferchan); - ast_connected_line_copy_from_caller(&connected_line, &xferchan->caller); + ast_connected_line_copy_from_caller(&connected_line, ast_channel_caller(xferchan)); ast_channel_unlock(xferchan); connected_line.source = AST_CONNECTED_LINE_UPDATE_SOURCE_TRANSFER; if (ast_channel_connected_line_sub(xferchan, newchan, &connected_line, 0) && @@ -3457,7 +3457,7 @@ static struct ast_channel *feature_request_and_dial(struct ast_channel *caller, pbx_builtin_setvar_helper(chan, "TRANSFERERNAME", caller_name); ast_channel_lock(chan); - ast_connected_line_copy_from_caller(&chan->connected, &requestor->caller); + ast_connected_line_copy_from_caller(ast_channel_connected(chan), ast_channel_caller(requestor)); ast_channel_unlock(chan); if (ast_call(chan, addr, timeout)) { @@ -3608,7 +3608,7 @@ static struct ast_channel *feature_request_and_dial(struct ast_channel *caller, struct ast_party_connected_line connected; /* Just save it for the transfer. */ - ast_party_connected_line_set_init(&connected, &caller->connected); + ast_party_connected_line_set_init(&connected, ast_channel_connected(caller)); res = ast_connected_line_parse_data(f->data.ptr, f->datalen, &connected); if (!res) { @@ -4320,11 +4320,11 @@ before_you_go: if (ast_test_flag(&config->features_caller, AST_FEATURE_NO_H_EXTEN)) { h_context = NULL; } else if (ast_exists_extension(chan, ast_channel_context(chan), "h", 1, - S_COR(chan->caller.id.number.valid, chan->caller.id.number.str, NULL))) { + S_COR(ast_channel_caller(chan)->id.number.valid, ast_channel_caller(chan)->id.number.str, NULL))) { h_context = ast_channel_context(chan); } else if (!ast_strlen_zero(ast_channel_macrocontext(chan)) && ast_exists_extension(chan, ast_channel_macrocontext(chan), "h", 1, - S_COR(chan->caller.id.number.valid, chan->caller.id.number.str, NULL))) { + S_COR(ast_channel_caller(chan)->id.number.valid, ast_channel_caller(chan)->id.number.str, NULL))) { h_context = ast_channel_macrocontext(chan); } else { h_context = NULL; @@ -4372,7 +4372,7 @@ before_you_go: while ((spawn_error = ast_spawn_extension(chan, ast_channel_context(chan), ast_channel_exten(chan), ast_channel_priority(chan), - S_COR(chan->caller.id.number.valid, chan->caller.id.number.str, NULL), + S_COR(ast_channel_caller(chan)->id.number.valid, ast_channel_caller(chan)->id.number.str, NULL), &found, 1)) == 0) { ast_channel_priority_set(chan, ast_channel_priority(chan) + 1); } @@ -4530,10 +4530,10 @@ static void post_manager_event(const char *s, struct parkeduser *pu) pu->parkingexten, ast_channel_name(pu->chan), pu->parkinglot->name, - S_COR(pu->chan->caller.id.number.valid, pu->chan->caller.id.number.str, ""), - S_COR(pu->chan->caller.id.name.valid, pu->chan->caller.id.name.str, ""), - S_COR(pu->chan->connected.id.number.valid, pu->chan->connected.id.number.str, ""), - S_COR(pu->chan->connected.id.name.valid, pu->chan->connected.id.name.str, ""), + S_COR(ast_channel_caller(pu->chan)->id.number.valid, ast_channel_caller(pu->chan)->id.number.str, ""), + S_COR(ast_channel_caller(pu->chan)->id.name.valid, ast_channel_caller(pu->chan)->id.name.str, ""), + S_COR(ast_channel_connected(pu->chan)->id.number.valid, ast_channel_connected(pu->chan)->id.number.str, ""), + S_COR(ast_channel_connected(pu->chan)->id.name.valid, ast_channel_connected(pu->chan)->id.name.str, ""), ast_channel_uniqueid(pu->chan) ); } @@ -5141,10 +5141,10 @@ static int parked_call_exec(struct ast_channel *chan, const char *data) "Uniqueid: %s\r\n", pu->parkingexten, ast_channel_name(pu->chan), pu->parkinglot->name, ast_channel_name(chan), - S_COR(pu->chan->caller.id.number.valid, pu->chan->caller.id.number.str, ""), - S_COR(pu->chan->caller.id.name.valid, pu->chan->caller.id.name.str, ""), - S_COR(pu->chan->connected.id.number.valid, pu->chan->connected.id.number.str, ""), - S_COR(pu->chan->connected.id.name.valid, pu->chan->connected.id.name.str, ""), + S_COR(ast_channel_caller(pu->chan)->id.number.valid, ast_channel_caller(pu->chan)->id.number.str, ""), + S_COR(ast_channel_caller(pu->chan)->id.name.valid, ast_channel_caller(pu->chan)->id.name.str, ""), + S_COR(ast_channel_connected(pu->chan)->id.number.valid, ast_channel_connected(pu->chan)->id.number.str, ""), + S_COR(ast_channel_connected(pu->chan)->id.name.valid, ast_channel_connected(pu->chan)->id.name.str, ""), ast_channel_uniqueid(pu->chan) ); @@ -5174,7 +5174,7 @@ static int parked_call_exec(struct ast_channel *chan, const char *data) /* Send our caller-id to peer. */ ast_channel_lock(chan); - ast_connected_line_copy_from_caller(&connected, &chan->caller); + ast_connected_line_copy_from_caller(&connected, ast_channel_caller(chan)); ast_channel_unlock(chan); connected.source = AST_CONNECTED_LINE_UPDATE_SOURCE_ANSWER; if (ast_channel_connected_line_sub(chan, peer, &connected, 0) && @@ -5190,7 +5190,7 @@ static int parked_call_exec(struct ast_channel *chan, const char *data) * connected line information after connection. */ ast_channel_lock(peer); - ast_connected_line_copy_from_caller(&connected, &peer->caller); + ast_connected_line_copy_from_caller(&connected, ast_channel_caller(peer)); ast_channel_unlock(peer); connected.source = AST_CONNECTED_LINE_UPDATE_SOURCE_ANSWER; if (ast_channel_connected_line_sub(peer, chan, &connected, 0) && @@ -7099,10 +7099,10 @@ static int manager_parking_status(struct mansession *s, const struct message *m) curlot->name, cur->parkingnum, ast_channel_name(cur->chan), cur->peername, (long) cur->start.tv_sec + (long) (cur->parkingtime / 1000) - (long) time(NULL), - S_COR(cur->chan->caller.id.number.valid, cur->chan->caller.id.number.str, ""), /* XXX in other places it is */ - S_COR(cur->chan->caller.id.name.valid, cur->chan->caller.id.name.str, ""), - S_COR(cur->chan->connected.id.number.valid, cur->chan->connected.id.number.str, ""), /* XXX in other places it is */ - S_COR(cur->chan->connected.id.name.valid, cur->chan->connected.id.name.str, ""), + S_COR(ast_channel_caller(cur->chan)->id.number.valid, ast_channel_caller(cur->chan)->id.number.str, ""), /* XXX in other places it is */ + S_COR(ast_channel_caller(cur->chan)->id.name.valid, ast_channel_caller(cur->chan)->id.name.str, ""), + S_COR(ast_channel_connected(cur->chan)->id.number.valid, ast_channel_connected(cur->chan)->id.number.str, ""), /* XXX in other places it is */ + S_COR(ast_channel_connected(cur->chan)->id.name.valid, ast_channel_connected(cur->chan)->id.name.str, ""), idText); ++numparked; } @@ -7323,7 +7323,7 @@ int ast_do_pickup(struct ast_channel *chan, struct ast_channel *target) ast_channel_datastore_add(target, ds_pickup); ast_party_connected_line_init(&connected_caller); - ast_party_connected_line_copy(&connected_caller, &target->connected); + ast_party_connected_line_copy(&connected_caller, ast_channel_connected(target)); ast_channel_unlock(target);/* The pickup race is avoided so we do not need the lock anymore. */ connected_caller.source = AST_CONNECTED_LINE_UPDATE_SOURCE_ANSWER; if (ast_channel_connected_line_sub(NULL, chan, &connected_caller, 0) && @@ -7334,7 +7334,7 @@ int ast_do_pickup(struct ast_channel *chan, struct ast_channel *target) ast_channel_lock(chan); chan_name = ast_strdupa(ast_channel_name(chan)); - ast_connected_line_copy_from_caller(&connected_caller, &chan->caller); + ast_connected_line_copy_from_caller(&connected_caller, ast_channel_caller(chan)); ast_channel_unlock(chan); connected_caller.source = AST_CONNECTED_LINE_UPDATE_SOURCE_ANSWER; ast_channel_queue_connected_line_update(chan, &connected_caller, NULL); diff --git a/main/file.c b/main/file.c index bf9f6831a..588dfe2f7 100644 --- a/main/file.c +++ b/main/file.c @@ -1311,7 +1311,7 @@ static int waitstream_core(struct ast_channel *c, const char *breakon, if (context) { const char exten[2] = { fr->subclass.integer, '\0' }; if (ast_exists_extension(c, context, exten, 1, - S_COR(c->caller.id.number.valid, c->caller.id.number.str, NULL))) { + S_COR(ast_channel_caller(c)->id.number.valid, ast_channel_caller(c)->id.number.str, NULL))) { res = fr->subclass.integer; ast_frfree(fr); ast_clear_flag(c, AST_FLAG_END_DTMF_ONLY); diff --git a/main/manager.c b/main/manager.c index 8fa1041c4..bafe827d7 100644 --- a/main/manager.c +++ b/main/manager.c @@ -3351,10 +3351,10 @@ static int action_status(struct mansession *s, const struct message *m) "%s" "\r\n", ast_channel_name(c), - S_COR(c->caller.id.number.valid, c->caller.id.number.str, ""), - S_COR(c->caller.id.name.valid, c->caller.id.name.str, ""), - S_COR(c->connected.id.number.valid, c->connected.id.number.str, ""), - S_COR(c->connected.id.name.valid, c->connected.id.name.str, ""), + S_COR(ast_channel_caller(c)->id.number.valid, ast_channel_caller(c)->id.number.str, ""), + S_COR(ast_channel_caller(c)->id.name.valid, ast_channel_caller(c)->id.name.str, ""), + S_COR(ast_channel_connected(c)->id.number.valid, ast_channel_connected(c)->id.number.str, ""), + S_COR(ast_channel_connected(c)->id.name.valid, ast_channel_connected(c)->id.name.str, ""), ast_channel_accountcode(c), ast_channel_state(c), ast_state2str(ast_channel_state(c)), ast_channel_context(c), @@ -3376,10 +3376,10 @@ static int action_status(struct mansession *s, const struct message *m) "%s" "\r\n", ast_channel_name(c), - S_COR(c->caller.id.number.valid, c->caller.id.number.str, ""), - S_COR(c->caller.id.name.valid, c->caller.id.name.str, ""), - S_COR(c->connected.id.number.valid, c->connected.id.number.str, ""), - S_COR(c->connected.id.name.valid, c->connected.id.name.str, ""), + S_COR(ast_channel_caller(c)->id.number.valid, ast_channel_caller(c)->id.number.str, ""), + S_COR(ast_channel_caller(c)->id.name.valid, ast_channel_caller(c)->id.name.str, ""), + S_COR(ast_channel_connected(c)->id.number.valid, ast_channel_connected(c)->id.number.str, ""), + S_COR(ast_channel_connected(c)->id.name.valid, ast_channel_connected(c)->id.name.str, ""), ast_channel_accountcode(c), ast_state2str(ast_channel_state(c)), bridge, ast_channel_uniqueid(c), ast_str_buffer(str), idText); @@ -4607,10 +4607,10 @@ static int action_coreshowchannels(struct mansession *s, const struct message *m "BridgedUniqueID: %s\r\n" "\r\n", idText, ast_channel_name(c), ast_channel_uniqueid(c), ast_channel_context(c), ast_channel_exten(c), ast_channel_priority(c), ast_channel_state(c), ast_state2str(ast_channel_state(c)), ast_channel_appl(c) ? ast_channel_appl(c) : "", ast_channel_data(c) ? S_OR(ast_channel_data(c), "") : "", - S_COR(c->caller.id.number.valid, c->caller.id.number.str, ""), - S_COR(c->caller.id.name.valid, c->caller.id.name.str, ""), - S_COR(c->connected.id.number.valid, c->connected.id.number.str, ""), - S_COR(c->connected.id.name.valid, c->connected.id.name.str, ""), + S_COR(ast_channel_caller(c)->id.number.valid, ast_channel_caller(c)->id.number.str, ""), + S_COR(ast_channel_caller(c)->id.name.valid, ast_channel_caller(c)->id.name.str, ""), + S_COR(ast_channel_connected(c)->id.number.valid, ast_channel_connected(c)->id.number.str, ""), + S_COR(ast_channel_connected(c)->id.name.valid, ast_channel_connected(c)->id.name.str, ""), durbuf, S_OR(ast_channel_accountcode(c), ""), bc ? ast_channel_name(bc) : "", bc ? ast_channel_uniqueid(bc) : ""); ast_channel_unlock(c); diff --git a/main/message.c b/main/message.c index 1e575f2e2..67655f79d 100644 --- a/main/message.c +++ b/main/message.c @@ -676,14 +676,14 @@ static void chan_cleanup(struct ast_channel *chan) /* * Destroy all other datastores. */ - while ((ds = AST_LIST_REMOVE_HEAD(&chan->datastores, entry))) { + while ((ds = AST_LIST_REMOVE_HEAD(ast_channel_datastores(chan), entry))) { ast_datastore_free(ds); } /* * Destroy all channel variables. */ - headp = &chan->varshead; + headp = ast_channel_varshead(chan); while ((vardata = AST_LIST_REMOVE_HEAD(headp, entries))) { ast_var_delete(vardata); } diff --git a/main/pbx.c b/main/pbx.c index bbf5ad74b..a5a2c08fd 100644 --- a/main/pbx.c +++ b/main/pbx.c @@ -3260,7 +3260,7 @@ const char *ast_str_retrieve_variable(struct ast_str **str, ssize_t maxlen, stru if (c) { ast_channel_lock(c); - places[0] = &c->varshead; + places[0] = ast_channel_varshead(c); } /* * Make a copy of var because parse_variable_name() modifies the string. @@ -3292,16 +3292,16 @@ const char *ast_str_retrieve_variable(struct ast_str **str, ssize_t maxlen, stru if (!strncmp(var + 4, "ING", 3)) { if (!strcmp(var + 7, "PRES")) { /* CALLINGPRES */ ast_str_set(str, maxlen, "%d", - ast_party_id_presentation(&c->caller.id)); + ast_party_id_presentation(&ast_channel_caller(c)->id)); s = ast_str_buffer(*str); } else if (!strcmp(var + 7, "ANI2")) { /* CALLINGANI2 */ - ast_str_set(str, maxlen, "%d", c->caller.ani2); + ast_str_set(str, maxlen, "%d", ast_channel_caller(c)->ani2); s = ast_str_buffer(*str); } else if (!strcmp(var + 7, "TON")) { /* CALLINGTON */ - ast_str_set(str, maxlen, "%d", c->caller.id.number.plan); + ast_str_set(str, maxlen, "%d", ast_channel_caller(c)->id.number.plan); s = ast_str_buffer(*str); } else if (!strcmp(var + 7, "TNS")) { /* CALLINGTNS */ - ast_str_set(str, maxlen, "%d", c->dialed.transit_network_select); + ast_str_set(str, maxlen, "%d", ast_channel_dialed(c)->transit_network_select); s = ast_str_buffer(*str); } } @@ -3987,11 +3987,11 @@ void ast_str_substitute_variables_full(struct ast_str **buf, ssize_t maxlen, str struct varshead old; struct ast_channel *bogus = ast_dummy_channel_alloc(); if (bogus) { - memcpy(&old, &bogus->varshead, sizeof(old)); - memcpy(&bogus->varshead, headp, sizeof(bogus->varshead)); + memcpy(&old, ast_channel_varshead(bogus), sizeof(old)); + memcpy(ast_channel_varshead(bogus), headp, sizeof(*ast_channel_varshead(bogus))); cp4 = ast_func_read2(c, finalvars, &substr3, 0) ? NULL : ast_str_buffer(substr3); /* Don't deallocate the varshead that was passed in */ - memcpy(&bogus->varshead, &old, sizeof(bogus->varshead)); + memcpy(ast_channel_varshead(bogus), &old, sizeof(*ast_channel_varshead(bogus))); ast_channel_unref(bogus); } else { ast_log(LOG_ERROR, "Unable to allocate bogus channel for variable substitution. Function results may be blank.\n"); @@ -4186,11 +4186,11 @@ void pbx_substitute_variables_helper_full(struct ast_channel *c, struct varshead struct varshead old; struct ast_channel *c = ast_dummy_channel_alloc(); if (c) { - memcpy(&old, &c->varshead, sizeof(old)); - memcpy(&c->varshead, headp, sizeof(c->varshead)); + memcpy(&old, ast_channel_varshead(c), sizeof(old)); + memcpy(ast_channel_varshead(c), headp, sizeof(*ast_channel_varshead(c))); cp4 = ast_func_read(c, vars, workspace, VAR_BUF_SIZE) ? NULL : workspace; /* Don't deallocate the varshead that was passed in */ - memcpy(&c->varshead, &old, sizeof(c->varshead)); + memcpy(ast_channel_varshead(c), &old, sizeof(*ast_channel_varshead(c))); c = ast_channel_unref(c); } else { ast_log(LOG_ERROR, "Unable to allocate bogus channel for variable substitution. Function results may be blank.\n"); @@ -4277,7 +4277,7 @@ void pbx_substitute_variables_helper_full(struct ast_channel *c, struct varshead void pbx_substitute_variables_helper(struct ast_channel *c, const char *cp1, char *cp2, int count) { size_t used; - pbx_substitute_variables_helper_full(c, (c) ? &c->varshead : NULL, cp1, cp2, count, &used); + pbx_substitute_variables_helper_full(c, (c) ? ast_channel_varshead(c) : NULL, cp1, cp2, count, &used); } void pbx_substitute_variables_varshead(struct varshead *headp, const char *cp1, char *cp2, int count) @@ -5075,7 +5075,7 @@ static int collect_digits(struct ast_channel *c, int waittime, char *buf, int bu buf[pos] = '\0'; /* make sure it is properly terminated */ while (ast_matchmore_extension(c, ast_channel_context(c), buf, 1, - S_COR(c->caller.id.number.valid, c->caller.id.number.str, NULL))) { + S_COR(ast_channel_caller(c)->id.number.valid, ast_channel_caller(c)->id.number.str, NULL))) { /* As long as we're willing to wait, and as long as it's not defined, keep reading digits until we can't possibly get a right answer anymore. */ digit = ast_waitfordigit(c, waittime); @@ -5147,7 +5147,7 @@ static enum ast_pbx_result __ast_pbx_run(struct ast_channel *c, /* loop on priorities in this context/exten */ while (!(res = ast_spawn_extension(c, ast_channel_context(c), ast_channel_exten(c), ast_channel_priority(c), - S_COR(c->caller.id.number.valid, c->caller.id.number.str, NULL), + S_COR(ast_channel_caller(c)->id.number.valid, ast_channel_caller(c)->id.number.str, NULL), &found, 1))) { if (!ast_check_hangup(c)) { ast_channel_priority_set(c, ast_channel_priority(c) + 1); @@ -5161,17 +5161,17 @@ static enum ast_pbx_result __ast_pbx_run(struct ast_channel *c, } if (c->_softhangup & AST_SOFTHANGUP_TIMEOUT) { if (ast_exists_extension(c, ast_channel_context(c), "T", 1, - S_COR(c->caller.id.number.valid, c->caller.id.number.str, NULL))) { + S_COR(ast_channel_caller(c)->id.number.valid, ast_channel_caller(c)->id.number.str, NULL))) { set_ext_pri(c, "T", 1); /* If the AbsoluteTimeout is not reset to 0, we'll get an infinite loop */ - memset(&c->whentohangup, 0, sizeof(c->whentohangup)); + memset(ast_channel_whentohangup(c), 0, sizeof(*ast_channel_whentohangup(c))); ast_channel_clear_softhangup(c, AST_SOFTHANGUP_TIMEOUT); continue; } else if (ast_exists_extension(c, ast_channel_context(c), "e", 1, - S_COR(c->caller.id.number.valid, c->caller.id.number.str, NULL))) { + S_COR(ast_channel_caller(c)->id.number.valid, ast_channel_caller(c)->id.number.str, NULL))) { raise_exception(c, "ABSOLUTETIMEOUT", 1); /* If the AbsoluteTimeout is not reset to 0, we'll get an infinite loop */ - memset(&c->whentohangup, 0, sizeof(c->whentohangup)); + memset(ast_channel_whentohangup(c), 0, sizeof(*ast_channel_whentohangup(c))); ast_channel_clear_softhangup(c, AST_SOFTHANGUP_TIMEOUT); continue; } @@ -5198,7 +5198,7 @@ static enum ast_pbx_result __ast_pbx_run(struct ast_channel *c, /* Don't cycle on incomplete - this will happen if the only extension that matches is our "incomplete" extension */ if (!ast_matchmore_extension(c, ast_channel_context(c), ast_channel_exten(c), 1, - S_COR(c->caller.id.number.valid, c->caller.id.number.str, NULL))) { + S_COR(ast_channel_caller(c)->id.number.valid, ast_channel_caller(c)->id.number.str, NULL))) { invalid = 1; } else { ast_copy_string(dst_exten, ast_channel_exten(c), sizeof(dst_exten)); @@ -5211,7 +5211,7 @@ static enum ast_pbx_result __ast_pbx_run(struct ast_channel *c, if ((res == AST_PBX_ERROR) && ast_exists_extension(c, ast_channel_context(c), "e", 1, - S_COR(c->caller.id.number.valid, c->caller.id.number.str, NULL))) { + S_COR(ast_channel_caller(c)->id.number.valid, ast_channel_caller(c)->id.number.str, NULL))) { /* if we are already on the 'e' exten, don't jump to it again */ if (!strcmp(ast_channel_exten(c), "e")) { ast_verb(2, "Spawn extension (%s, %s, %d) exited ERROR while already on 'e' exten on '%s'\n", ast_channel_context(c), ast_channel_exten(c), ast_channel_priority(c), ast_channel_name(c)); @@ -5228,17 +5228,17 @@ static enum ast_pbx_result __ast_pbx_run(struct ast_channel *c, } if (c->_softhangup & AST_SOFTHANGUP_TIMEOUT) { if (ast_exists_extension(c, ast_channel_context(c), "T", 1, - S_COR(c->caller.id.number.valid, c->caller.id.number.str, NULL))) { + S_COR(ast_channel_caller(c)->id.number.valid, ast_channel_caller(c)->id.number.str, NULL))) { set_ext_pri(c, "T", 1); /* If the AbsoluteTimeout is not reset to 0, we'll get an infinite loop */ - memset(&c->whentohangup, 0, sizeof(c->whentohangup)); + memset(ast_channel_whentohangup(c), 0, sizeof(*ast_channel_whentohangup(c))); ast_channel_clear_softhangup(c, AST_SOFTHANGUP_TIMEOUT); continue; } else if (ast_exists_extension(c, ast_channel_context(c), "e", 1, - S_COR(c->caller.id.number.valid, c->caller.id.number.str, NULL))) { + S_COR(ast_channel_caller(c)->id.number.valid, ast_channel_caller(c)->id.number.str, NULL))) { raise_exception(c, "ABSOLUTETIMEOUT", 1); /* If the AbsoluteTimeout is not reset to 0, we'll get an infinite loop */ - memset(&c->whentohangup, 0, sizeof(c->whentohangup)); + memset(ast_channel_whentohangup(c), 0, sizeof(*ast_channel_whentohangup(c))); ast_channel_clear_softhangup(c, AST_SOFTHANGUP_TIMEOUT); continue; } @@ -5263,19 +5263,19 @@ static enum ast_pbx_result __ast_pbx_run(struct ast_channel *c, if (invalid || !ast_exists_extension(c, ast_channel_context(c), ast_channel_exten(c), 1, - S_COR(c->caller.id.number.valid, c->caller.id.number.str, NULL))) { + S_COR(ast_channel_caller(c)->id.number.valid, ast_channel_caller(c)->id.number.str, NULL))) { /*!\note * If there is no match at priority 1, it is not a valid extension anymore. * Try to continue at "i" (for invalid) or "e" (for exception) or exit if * neither exist. */ if (ast_exists_extension(c, ast_channel_context(c), "i", 1, - S_COR(c->caller.id.number.valid, c->caller.id.number.str, NULL))) { + S_COR(ast_channel_caller(c)->id.number.valid, ast_channel_caller(c)->id.number.str, NULL))) { ast_verb(3, "Sent into invalid extension '%s' in context '%s' on %s\n", ast_channel_exten(c), ast_channel_context(c), ast_channel_name(c)); pbx_builtin_setvar_helper(c, "INVALID_EXTEN", ast_channel_exten(c)); set_ext_pri(c, "i", 1); } else if (ast_exists_extension(c, ast_channel_context(c), "e", 1, - S_COR(c->caller.id.number.valid, c->caller.id.number.str, NULL))) { + S_COR(ast_channel_caller(c)->id.number.valid, ast_channel_caller(c)->id.number.str, NULL))) { raise_exception(c, "INVALID", 1); } else { ast_log(LOG_WARNING, "Channel '%s' sent into invalid extension '%s' in context '%s', but no invalid handler\n", @@ -5313,19 +5313,19 @@ static enum ast_pbx_result __ast_pbx_run(struct ast_channel *c, timeout = 1; if (!timeout && ast_exists_extension(c, ast_channel_context(c), dst_exten, 1, - S_COR(c->caller.id.number.valid, c->caller.id.number.str, NULL))) { /* Prepare the next cycle */ + S_COR(ast_channel_caller(c)->id.number.valid, ast_channel_caller(c)->id.number.str, NULL))) { /* Prepare the next cycle */ set_ext_pri(c, dst_exten, 1); } else { /* No such extension */ if (!timeout && !ast_strlen_zero(dst_exten)) { /* An invalid extension */ if (ast_exists_extension(c, ast_channel_context(c), "i", 1, - S_COR(c->caller.id.number.valid, c->caller.id.number.str, NULL))) { + S_COR(ast_channel_caller(c)->id.number.valid, ast_channel_caller(c)->id.number.str, NULL))) { ast_verb(3, "Invalid extension '%s' in context '%s' on %s\n", dst_exten, ast_channel_context(c), ast_channel_name(c)); pbx_builtin_setvar_helper(c, "INVALID_EXTEN", dst_exten); set_ext_pri(c, "i", 1); } else if (ast_exists_extension(c, ast_channel_context(c), "e", 1, - S_COR(c->caller.id.number.valid, c->caller.id.number.str, NULL))) { + S_COR(ast_channel_caller(c)->id.number.valid, ast_channel_caller(c)->id.number.str, NULL))) { raise_exception(c, "INVALID", 1); } else { ast_log(LOG_WARNING, @@ -5337,11 +5337,11 @@ static enum ast_pbx_result __ast_pbx_run(struct ast_channel *c, } else { /* A simple timeout */ if (ast_exists_extension(c, ast_channel_context(c), "t", 1, - S_COR(c->caller.id.number.valid, c->caller.id.number.str, NULL))) { + S_COR(ast_channel_caller(c)->id.number.valid, ast_channel_caller(c)->id.number.str, NULL))) { ast_verb(3, "Timeout on %s\n", ast_channel_name(c)); set_ext_pri(c, "t", 1); } else if (ast_exists_extension(c, ast_channel_context(c), "e", 1, - S_COR(c->caller.id.number.valid, c->caller.id.number.str, NULL))) { + S_COR(ast_channel_caller(c)->id.number.valid, ast_channel_caller(c)->id.number.str, NULL))) { raise_exception(c, "RESPONSETIMEOUT", 1); } else { ast_log(LOG_WARNING, @@ -5372,13 +5372,13 @@ static enum ast_pbx_result __ast_pbx_run(struct ast_channel *c, if ((!args || !args->no_hangup_chan) && !ast_test_flag(c, AST_FLAG_BRIDGE_HANGUP_RUN) && ast_exists_extension(c, ast_channel_context(c), "h", 1, - S_COR(c->caller.id.number.valid, c->caller.id.number.str, NULL))) { + S_COR(ast_channel_caller(c)->id.number.valid, ast_channel_caller(c)->id.number.str, NULL))) { set_ext_pri(c, "h", 1); if (ast_channel_cdr(c) && ast_opt_end_cdr_before_h_exten) { ast_cdr_end(ast_channel_cdr(c)); } while ((res = ast_spawn_extension(c, ast_channel_context(c), ast_channel_exten(c), ast_channel_priority(c), - S_COR(c->caller.id.number.valid, c->caller.id.number.str, NULL), + S_COR(ast_channel_caller(c)->id.number.valid, ast_channel_caller(c)->id.number.str, NULL), &found, 1)) == 0) { ast_channel_priority_set(c, ast_channel_priority(c) + 1); } @@ -9854,14 +9854,14 @@ static int pbx_builtin_waitexten(struct ast_channel *chan, const char *data) /* Call is hungup for some reason. */ res = -1; } else if (ast_exists_extension(chan, ast_channel_context(chan), ast_channel_exten(chan), ast_channel_priority(chan) + 1, - S_COR(chan->caller.id.number.valid, chan->caller.id.number.str, NULL))) { + S_COR(ast_channel_caller(chan)->id.number.valid, ast_channel_caller(chan)->id.number.str, NULL))) { ast_verb(3, "Timeout on %s, continuing...\n", ast_channel_name(chan)); } else if (ast_exists_extension(chan, ast_channel_context(chan), "t", 1, - S_COR(chan->caller.id.number.valid, chan->caller.id.number.str, NULL))) { + S_COR(ast_channel_caller(chan)->id.number.valid, ast_channel_caller(chan)->id.number.str, NULL))) { ast_verb(3, "Timeout on %s, going to 't'\n", ast_channel_name(chan)); set_ext_pri(chan, "t", 0); /* 0 will become 1, next time through the loop */ } else if (ast_exists_extension(chan, ast_channel_context(chan), "e", 1, - S_COR(chan->caller.id.number.valid, chan->caller.id.number.str, NULL))) { + S_COR(ast_channel_caller(chan)->id.number.valid, ast_channel_caller(chan)->id.number.str, NULL))) { raise_exception(chan, "RESPONSETIMEOUT", 0); /* 0 will become 1, next time through the loop */ } else { ast_log(LOG_WARNING, "Timeout but no rule 't' or 'e' in context '%s'\n", @@ -9980,9 +9980,9 @@ static int pbx_builtin_background(struct ast_channel *chan, const char *data) if (!ast_test_flag(chan, AST_FLAG_DISABLE_WORKAROUNDS) && (exten[0] = res) && ast_canmatch_extension(chan, args.context, exten, 1, - S_COR(chan->caller.id.number.valid, chan->caller.id.number.str, NULL)) + S_COR(ast_channel_caller(chan)->id.number.valid, ast_channel_caller(chan)->id.number.str, NULL)) && !ast_matchmore_extension(chan, args.context, exten, 1, - S_COR(chan->caller.id.number.valid, chan->caller.id.number.str, NULL))) { + S_COR(ast_channel_caller(chan)->id.number.valid, ast_channel_caller(chan)->id.number.str, NULL))) { char buf[2] = { 0, }; snprintf(buf, sizeof(buf), "%c", res); ast_channel_exten_set(chan, buf); @@ -10020,7 +10020,7 @@ int pbx_builtin_serialize_variables(struct ast_channel *chan, struct ast_str **b ast_channel_lock(chan); - AST_LIST_TRAVERSE(&chan->varshead, variables, entries) { + AST_LIST_TRAVERSE(ast_channel_varshead(chan), variables, entries) { if ((var = ast_var_name(variables)) && (val = ast_var_value(variables)) /* && !ast_strlen_zero(var) && !ast_strlen_zero(val) */ ) { @@ -10050,7 +10050,7 @@ const char *pbx_builtin_getvar_helper(struct ast_channel *chan, const char *name if (chan) { ast_channel_lock(chan); - places[0] = &chan->varshead; + places[0] = ast_channel_varshead(chan); } for (i = 0; i < 2; i++) { @@ -10091,7 +10091,7 @@ void pbx_builtin_pushvar_helper(struct ast_channel *chan, const char *name, cons if (chan) { ast_channel_lock(chan); - headp = &chan->varshead; + headp = ast_channel_varshead(chan); } else { ast_rwlock_wrlock(&globalslock); headp = &globals; @@ -10124,7 +10124,7 @@ int pbx_builtin_setvar_helper(struct ast_channel *chan, const char *name, const if (chan) { ast_channel_lock(chan); - headp = &chan->varshead; + headp = ast_channel_varshead(chan); } else { ast_rwlock_wrlock(&globalslock); headp = &globals; @@ -10699,7 +10699,7 @@ static int __ast_goto_if_exists(struct ast_channel *chan, const char *context, c goto_func = (async) ? ast_async_goto : ast_explicit_goto; if (ast_exists_extension(chan, context, exten, priority, - S_COR(chan->caller.id.number.valid, chan->caller.id.number.str, NULL))) + S_COR(ast_channel_caller(chan)->id.number.valid, ast_channel_caller(chan)->id.number.str, NULL))) return goto_func(chan, context, exten, priority); else { return AST_PBX_GOTO_FAILED; @@ -10750,7 +10750,7 @@ static int pbx_parseable_goto(struct ast_channel *chan, const char *goto_string, if (sscanf(pri, "%30d", &ipri) != 1) { ipri = ast_findlabel_extension(chan, context ? context : ast_channel_context(chan), exten ? exten : ast_channel_exten(chan), pri, - S_COR(chan->caller.id.number.valid, chan->caller.id.number.str, NULL)); + S_COR(ast_channel_caller(chan)->id.number.valid, ast_channel_caller(chan)->id.number.str, NULL)); if (ipri < 1) { ast_log(LOG_WARNING, "Priority '%s' must be a number > 0, or valid label\n", pri); return -1; diff --git a/pbx/pbx_lua.c b/pbx/pbx_lua.c index 725fde923..d0e0f984b 100644 --- a/pbx/pbx_lua.c +++ b/pbx/pbx_lua.c @@ -333,7 +333,7 @@ static int lua_get_variable_value(lua_State *L) if (!ast_strlen_zero(name) && name[strlen(name) - 1] == ')') { value = ast_func_read(chan, name, workspace, LUA_BUF_SIZE) ? NULL : workspace; } else { - pbx_retrieve_variable(chan, name, &value, workspace, LUA_BUF_SIZE, &chan->varshead); + pbx_retrieve_variable(chan, name, &value, workspace, LUA_BUF_SIZE, ast_channel_varshead(chan)); } if (autoservice) @@ -574,7 +574,7 @@ static int lua_get_variable(lua_State *L) /* if this is not a request for a dialplan funciton attempt to retrieve * the value of the variable */ if (!ast_strlen_zero(name) && name[strlen(name) - 1] != ')') { - pbx_retrieve_variable(chan, name, &value, workspace, LUA_BUF_SIZE, &chan->varshead); + pbx_retrieve_variable(chan, name, &value, workspace, LUA_BUF_SIZE, ast_channel_varshead(chan)); } if (value) { diff --git a/res/res_agi.c b/res/res_agi.c index 4ea10bf30..1f4c1cab2 100644 --- a/res/res_agi.c +++ b/res/res_agi.c @@ -1732,17 +1732,17 @@ static void setup_env(struct ast_channel *chan, char *request, int fd, int enhan /* ANI/DNIS */ ast_agi_send(fd, chan, "agi_callerid: %s\n", - S_COR(chan->caller.id.number.valid, chan->caller.id.number.str, "unknown")); + S_COR(ast_channel_caller(chan)->id.number.valid, ast_channel_caller(chan)->id.number.str, "unknown")); ast_agi_send(fd, chan, "agi_calleridname: %s\n", - S_COR(chan->caller.id.name.valid, chan->caller.id.name.str, "unknown")); + S_COR(ast_channel_caller(chan)->id.name.valid, ast_channel_caller(chan)->id.name.str, "unknown")); ast_agi_send(fd, chan, "agi_callingpres: %d\n", - ast_party_id_presentation(&chan->caller.id)); - ast_agi_send(fd, chan, "agi_callingani2: %d\n", chan->caller.ani2); - ast_agi_send(fd, chan, "agi_callington: %d\n", chan->caller.id.number.plan); - ast_agi_send(fd, chan, "agi_callingtns: %d\n", chan->dialed.transit_network_select); - ast_agi_send(fd, chan, "agi_dnid: %s\n", S_OR(chan->dialed.number.str, "unknown")); + ast_party_id_presentation(&ast_channel_caller(chan)->id)); + ast_agi_send(fd, chan, "agi_callingani2: %d\n", ast_channel_caller(chan)->ani2); + ast_agi_send(fd, chan, "agi_callington: %d\n", ast_channel_caller(chan)->id.number.plan); + ast_agi_send(fd, chan, "agi_callingtns: %d\n", ast_channel_dialed(chan)->transit_network_select); + ast_agi_send(fd, chan, "agi_dnid: %s\n", S_OR(ast_channel_dialed(chan)->number.str, "unknown")); ast_agi_send(fd, chan, "agi_rdnis: %s\n", - S_COR(chan->redirecting.from.number.valid, chan->redirecting.from.number.str, "unknown")); + S_COR(ast_channel_redirecting(chan)->from.number.valid, ast_channel_redirecting(chan)->from.number.str, "unknown")); /* Context information */ ast_agi_send(fd, chan, "agi_context: %s\n", ast_channel_context(chan)); @@ -2233,7 +2233,7 @@ static int handle_setpriority(struct ast_channel *chan, AGI *agi, int argc, cons if (sscanf(argv[2], "%30d", &pri) != 1) { pri = ast_findlabel_extension(chan, ast_channel_context(chan), ast_channel_exten(chan), argv[2], - S_COR(chan->caller.id.number.valid, chan->caller.id.number.str, NULL)); + S_COR(ast_channel_caller(chan)->id.number.valid, ast_channel_caller(chan)->id.number.str, NULL)); if (pri < 1) return RESULT_SHOWUSAGE; } diff --git a/res/res_fax.c b/res/res_fax.c index 5b9df5252..7b628d364 100644 --- a/res/res_fax.c +++ b/res/res_fax.c @@ -3363,7 +3363,7 @@ static struct ast_frame *fax_detect_framehook(struct ast_channel *chan, struct a case 't': ast_channel_unlock(chan); if (ast_exists_extension(chan, target_context, "fax", 1, - S_COR(chan->caller.id.number.valid, chan->caller.id.number.str, NULL))) { + S_COR(ast_channel_caller(chan)->id.number.valid, ast_channel_caller(chan)->id.number.str, NULL))) { ast_channel_lock(chan); ast_verb(2, "Redirecting '%s' to fax extension due to %s detection\n", ast_channel_name(chan), (result == 'f') ? "CNG" : "T38"); diff --git a/res/snmp/agent.c b/res/snmp/agent.c index 3c0c48e1b..7e713f8b3 100644 --- a/res/snmp/agent.c +++ b/res/snmp/agent.c @@ -322,9 +322,9 @@ static u_char *ast_var_channels_table(struct variable *vp, oid *name, size_t *le } break; case ASTCHANWHENHANGUP: - if (!ast_tvzero(chan->whentohangup)) { + if (!ast_tvzero(*ast_channel_whentohangup(chan))) { gettimeofday(&tval, NULL); - long_ret = difftime(chan->whentohangup.tv_sec, tval.tv_sec) * 100 - tval.tv_usec / 10000; + long_ret = difftime(ast_channel_whentohangup(chan)->tv_sec, tval.tv_sec) * 100 - tval.tv_usec / 10000; ret= (u_char *)&long_ret; } break; @@ -419,59 +419,59 @@ static u_char *ast_var_channels_table(struct variable *vp, oid *name, size_t *le ret = (u_char *)&long_ret; break; case ASTCHANCIDDNID: - if (chan->dialed.number.str) { - strncpy(string_ret, chan->dialed.number.str, sizeof(string_ret)); + if (ast_channel_dialed(chan)->number.str) { + strncpy(string_ret, ast_channel_dialed(chan)->number.str, sizeof(string_ret)); string_ret[sizeof(string_ret) - 1] = '\0'; *var_len = strlen(string_ret); ret = (u_char *)string_ret; } break; case ASTCHANCIDNUM: - if (chan->caller.id.number.valid && chan->caller.id.number.str) { - strncpy(string_ret, chan->caller.id.number.str, sizeof(string_ret)); + if (ast_channel_caller(chan)->id.number.valid && ast_channel_caller(chan)->id.number.str) { + strncpy(string_ret, ast_channel_caller(chan)->id.number.str, sizeof(string_ret)); string_ret[sizeof(string_ret) - 1] = '\0'; *var_len = strlen(string_ret); ret = (u_char *)string_ret; } break; case ASTCHANCIDNAME: - if (chan->caller.id.name.valid && chan->caller.id.name.str) { - strncpy(string_ret, chan->caller.id.name.str, sizeof(string_ret)); + if (ast_channel_caller(chan)->id.name.valid && ast_channel_caller(chan)->id.name.str) { + strncpy(string_ret, ast_channel_caller(chan)->id.name.str, sizeof(string_ret)); string_ret[sizeof(string_ret) - 1] = '\0'; *var_len = strlen(string_ret); ret = (u_char *)string_ret; } break; case ASTCHANCIDANI: - if (chan->caller.ani.number.valid && chan->caller.ani.number.str) { - strncpy(string_ret, chan->caller.ani.number.str, sizeof(string_ret)); + if (ast_channel_caller(chan)->ani.number.valid && ast_channel_caller(chan)->ani.number.str) { + strncpy(string_ret, ast_channel_caller(chan)->ani.number.str, sizeof(string_ret)); string_ret[sizeof(string_ret) - 1] = '\0'; *var_len = strlen(string_ret); ret = (u_char *)string_ret; } break; case ASTCHANCIDRDNIS: - if (chan->redirecting.from.number.valid && chan->redirecting.from.number.str) { - strncpy(string_ret, chan->redirecting.from.number.str, sizeof(string_ret)); + if (ast_channel_redirecting(chan)->from.number.valid && ast_channel_redirecting(chan)->from.number.str) { + strncpy(string_ret, ast_channel_redirecting(chan)->from.number.str, sizeof(string_ret)); string_ret[sizeof(string_ret) - 1] = '\0'; *var_len = strlen(string_ret); ret = (u_char *)string_ret; } break; case ASTCHANCIDPRES: - long_ret = ast_party_id_presentation(&chan->caller.id); + long_ret = ast_party_id_presentation(&ast_channel_caller(chan)->id); ret = (u_char *)&long_ret; break; case ASTCHANCIDANI2: - long_ret = chan->caller.ani2; + long_ret = ast_channel_caller(chan)->ani2; ret = (u_char *)&long_ret; break; case ASTCHANCIDTON: - long_ret = chan->caller.id.number.plan; + long_ret = ast_channel_caller(chan)->id.number.plan; ret = (u_char *)&long_ret; break; case ASTCHANCIDTNS: - long_ret = chan->dialed.transit_network_select; + long_ret = ast_channel_dialed(chan)->transit_network_select; ret = (u_char *)&long_ret; break; case ASTCHANAMAFLAGS: diff --git a/tests/test_substitution.c b/tests/test_substitution.c index 3df903615..dd7d00ea0 100644 --- a/tests/test_substitution.c +++ b/tests/test_substitution.c @@ -252,9 +252,9 @@ AST_TEST_DEFINE(test_substitution) */ TEST(test_chan_integer(test, c, &c->caller.id.number.presentation, "${CALLINGPRES}")); #endif - TEST(test_chan_integer(test, c, &c->caller.ani2, "${CALLINGANI2}")); - TEST(test_chan_integer(test, c, &c->caller.id.number.plan, "${CALLINGTON}")); - TEST(test_chan_integer(test, c, &c->dialed.transit_network_select, "${CALLINGTNS}")); + TEST(test_chan_integer(test, c, &ast_channel_caller(c)->ani2, "${CALLINGANI2}")); + TEST(test_chan_integer(test, c, &ast_channel_caller(c)->id.number.plan, "${CALLINGTON}")); + TEST(test_chan_integer(test, c, &ast_channel_dialed(c)->transit_network_select, "${CALLINGTNS}")); TEST(test_chan_integer_accessor(test, c, ast_channel_hangupcause_set, "${HANGUPCAUSE}")); TEST(test_chan_integer_accessor(test, c, ast_channel_priority_set, "${PRIORITY}")); TEST(test_chan_string(test, c, ast_channel_context_set, ast_channel_context, "${CONTEXT}")); -- cgit v1.2.3