Opaquify ast_channel structs and lists
authorTerry Wilson <twilson@digium.com>
Wed, 29 Feb 2012 16:52:47 +0000 (16:52 +0000)
committerTerry Wilson <twilson@digium.com>
Wed, 29 Feb 2012 16:52:47 +0000 (16:52 +0000)
Review: https://reviewboard.asterisk.org/r/1773/

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@357542 65c4cc65-6c06-0410-ace0-fbb531ad65f3

75 files changed:
addons/chan_ooh323.c
apps/app_alarmreceiver.c
apps/app_amd.c
apps/app_confbridge.c
apps/app_dial.c
apps/app_disa.c
apps/app_dumpchan.c
apps/app_fax.c
apps/app_followme.c
apps/app_macro.c
apps/app_meetme.c
apps/app_minivm.c
apps/app_mixmonitor.c
apps/app_osplookup.c
apps/app_parkandannounce.c
apps/app_privacy.c
apps/app_queue.c
apps/app_readexten.c
apps/app_rpt.c
apps/app_setcallerid.c
apps/app_sms.c
apps/app_stack.c
apps/app_talkdetect.c
apps/app_voicemail.c
apps/app_while.c
apps/app_zapateller.c
bridges/bridge_builtin_features.c
channels/chan_agent.c
channels/chan_console.c
channels/chan_dahdi.c
channels/chan_gtalk.c
channels/chan_h323.c
channels/chan_iax2.c
channels/chan_jingle.c
channels/chan_local.c
channels/chan_mgcp.c
channels/chan_misdn.c
channels/chan_oss.c
channels/chan_phone.c
channels/chan_sip.c
channels/chan_skinny.c
channels/chan_unistim.c
channels/chan_usbradio.c
channels/chan_vpb.cc
channels/console_video.c
channels/sig_analog.c
channels/sig_pri.c
channels/sig_ss7.c
funcs/func_blacklist.c
funcs/func_callerid.c
funcs/func_dialplan.c
funcs/func_strings.c
funcs/func_timeout.c
include/asterisk/channel.h
include/asterisk/utils.h
main/abstract_jb.c
main/app.c
main/autochan.c
main/ccss.c
main/cdr.c
main/cel.c
main/channel.c
main/channel_internal_api.c
main/cli.c
main/dial.c
main/features.c
main/file.c
main/manager.c
main/message.c
main/pbx.c
pbx/pbx_lua.c
res/res_agi.c
res/res_fax.c
res/snmp/agent.c
tests/test_substitution.c

index 59fc0bc..dc465f0 100644 (file)
@@ -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)) {
index c4309e0..574a59d 100644 (file)
@@ -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, "<unknown>");
+       cn = S_COR(ast_channel_caller(chan)->id.name.valid, ast_channel_caller(chan)->id.name.str, "<unknown>");
 
        /* Get the current time */
        t = ast_tvnow();
index 6aefe9a..597aac3 100644 (file)
@@ -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. */
index 2998640..b5b27ed 100644 (file)
@@ -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, "<unknown>"),
-               S_COR(chan->caller.id.name.valid, chan->caller.id.name.str, "<unknown>")
+               S_COR(ast_channel_caller(chan)->id.number.valid, ast_channel_caller(chan)->id.number.str, "<unknown>"),
+               S_COR(ast_channel_caller(chan)->id.name.valid, ast_channel_caller(chan)->id.name.str, "<unknown>")
        );
 }
 
@@ -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, "<unknown>"),
-               S_COR(chan->caller.id.name.valid, chan->caller.id.name.str, "<unknown>")
+               S_COR(ast_channel_caller(chan)->id.number.valid, ast_channel_caller(chan)->id.number.str, "<unknown>"),
+               S_COR(ast_channel_caller(chan)->id.name.valid, ast_channel_caller(chan)->id.name.str, "<unknown>")
        );
 }
 
@@ -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, "<unknown>"));
+                       ast_cli(a->fd, "%-17s", S_COR(ast_channel_caller(participant->chan)->id.number.valid, ast_channel_caller(participant->chan)->id.number.str, "<unknown>"));
                        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, "<unknown>"),
-                       S_COR(participant->chan->caller.id.name.valid, participant->chan->caller.id.name.str, "<no name>"),
+                       S_COR(ast_channel_caller(participant->chan)->id.number.valid, ast_channel_caller(participant->chan)->id.number.str, "<unknown>"),
+                       S_COR(ast_channel_caller(participant->chan)->id.name.valid, ast_channel_caller(participant->chan)->id.name.str, "<no name>"),
                        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");
index 20747c0..d12ea9c 100644 (file)
@@ -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, "<unknown>"),
-               S_COR(src->caller.id.name.valid, src->caller.id.name.str, "<unknown>"),
-               S_COR(src->connected.id.number.valid, src->connected.id.number.str, "<unknown>"),
-               S_COR(src->connected.id.name.valid, src->connected.id.name.str, "<unknown>"),
+               S_COR(ast_channel_caller(src)->id.number.valid, ast_channel_caller(src)->id.number.str, "<unknown>"),
+               S_COR(ast_channel_caller(src)->id.name.valid, ast_channel_caller(src)->id.name.str, "<unknown>"),
+               S_COR(ast_channel_connected(src)->id.number.valid, ast_channel_connected(src)->id.number.str, "<unknown>"),
+               S_COR(ast_channel_connected(src)->id.name.valid, ast_channel_connected(src)->id.name.str, "<unknown>"),
                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;
        }
 
index 5de3acf..0432a0b 100644 (file)
@@ -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)) {
index c16318f..42f8899 100644 (file)
@@ -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,
index 4d7382b..9d63a3c 100644 (file)
@@ -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,
index dc824f5..c4d1a2d 100644 (file)
@@ -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);
index c324a36..cebfae7 100644 (file)
@@ -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);
                                }
                        }
index 5b3fa25..1eb10a5 100644 (file)
@@ -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, "<unknown>"),
-                                       S_COR(user->chan->caller.id.name.valid, user->chan->caller.id.name.str, "<no name>"),
+                                       S_COR(ast_channel_caller(user->chan)->id.number.valid, ast_channel_caller(user->chan)->id.number.str, "<unknown>"),
+                                       S_COR(ast_channel_caller(user->chan)->id.name.valid, ast_channel_caller(user->chan)->id.name.str, "<no name>"),
                                        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, "<unknown>"),
-                       S_COR(user->chan->caller.id.name.valid, user->chan->caller.id.name.str, "<unknown>"),
-                       S_COR(user->chan->connected.id.number.valid, user->chan->connected.id.number.str, "<unknown>"),
-                       S_COR(user->chan->connected.id.name.valid, user->chan->connected.id.name.str, "<unknown>")
+                       S_COR(ast_channel_caller(user->chan)->id.number.valid, ast_channel_caller(user->chan)->id.number.str, "<unknown>"),
+                       S_COR(ast_channel_caller(user->chan)->id.name.valid, ast_channel_caller(user->chan)->id.name.str, "<unknown>"),
+                       S_COR(ast_channel_connected(user->chan)->id.number.valid, ast_channel_connected(user->chan)->id.number.str, "<unknown>"),
+                       S_COR(ast_channel_connected(user->chan)->id.name.valid, ast_channel_connected(user->chan)->id.name.str, "<unknown>")
                        );
                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, "<unknown>"),
-                               S_COR(user->chan->caller.id.name.valid, user->chan->caller.id.name.str, "<unknown>"),
-                               S_COR(user->chan->connected.id.number.valid, user->chan->connected.id.number.str, "<unknown>"),
-                               S_COR(user->chan->connected.id.name.valid, user->chan->connected.id.name.str, "<unknown>"),
+                               S_COR(ast_channel_caller(user->chan)->id.number.valid, ast_channel_caller(user->chan)->id.number.str, "<unknown>"),
+                               S_COR(ast_channel_caller(user->chan)->id.name.valid, ast_channel_caller(user->chan)->id.name.str, "<unknown>"),
+                               S_COR(ast_channel_connected(user->chan)->id.number.valid, ast_channel_connected(user->chan)->id.number.str, "<unknown>"),
+                               S_COR(ast_channel_connected(user->chan)->id.name.valid, ast_channel_connected(user->chan)->id.name.str, "<unknown>"),
                                (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, "<unknown>"),
-                               S_COR(user->chan->caller.id.name.valid, user->chan->caller.id.name.str, "<no name>"),
-                               S_COR(user->chan->connected.id.number.valid, user->chan->connected.id.number.str, "<unknown>"),
-                               S_COR(user->chan->connected.id.name.valid, user->chan->connected.id.name.str, "<no name>"),
+                               S_COR(ast_channel_caller(user->chan)->id.number.valid, ast_channel_caller(user->chan)->id.number.str, "<unknown>"),
+                               S_COR(ast_channel_caller(user->chan)->id.name.valid, ast_channel_caller(user->chan)->id.name.str, "<no name>"),
+                               S_COR(ast_channel_connected(user->chan)->id.number.valid, ast_channel_connected(user->chan)->id.number.str, "<unknown>"),
+                               S_COR(ast_channel_connected(user->chan)->id.name.valid, ast_channel_connected(user->chan)->id.name.str, "<no name>"),
                                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) {
index bf408f8..cd613b6 100644 (file)
@@ -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;
        }
index 4515805..88c8f88 100644 (file)
@@ -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 = "";
index 23f8838..ba7bb03 100644 (file)
@@ -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) {
index 508c31a..dce0009 100644 (file)
@@ -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
index d287c56..0e04df6 100644 (file)
@@ -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);
 
index f042c06..ea2dd54 100644 (file)
@@ -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 <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"),/* XXX somewhere else it is <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"),/* XXX somewhere else it is <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"),/* XXX somewhere else it is <unknown> */
+                       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);
                        }
                }
index a894ba4..deaf83f 100644 (file)
@@ -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";
index 48e398e..6b01c83 100644 (file)
@@ -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";
index cfcd2b4..6fa3170 100644 (file)
@@ -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;
 }
 
index 946677a..d5fc353 100644 (file)
@@ -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)) {
index 0ae2f5a..827bb50 100644 (file)
@@ -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;
 
index 55904d6..791081d 100644 (file)
@@ -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);
index fc7417b..8aa8bfd 100644 (file)
@@ -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;
                                }
index 5e8fb9b..d1e03f6 100644 (file)
@@ -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")) {
index 775fd55..0016697 100644 (file)
@@ -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;
        }
index 5ef9b84..21af928 100644 (file)
@@ -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);
index 9eb0b68..3c8073b 100644 (file)
@@ -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));
index 02fca59..2856bae 100644 (file)
@@ -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);
 
index 2467421..c160ae8 100644 (file)
@@ -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, "<Unknown Caller>"),
+                                       S_COR(ast_channel_caller(chan)->id.number.valid, ast_channel_caller(chan)->id.number.str, "<Unknown Caller>"),
                                        ast_channel_context(chan));
                                break;
                        }
index 8db2369..1f967ad 100644 (file)
@@ -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)
index 7da2e92..49a5e20 100644 (file)
@@ -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);
index fab2752..b0b0416 100644 (file)
@@ -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);
index 7156e94..8a1bfdc 100644 (file)
@@ -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);
index 5506256..c6780d2 100644 (file)
@@ -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. */
index 9a49d00..be8ecbf 100644 (file)
@@ -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, "<Unknown Caller>"),
+                               S_COR(ast_channel_caller(chan)->id.number.valid, ast_channel_caller(chan)->id.number.str, "<Unknown Caller>"),
                                ast_channel_context(chan));
                        break;
                }
index c7ca07b..62aa020 100644 (file)
@@ -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:
                        /*
index 47a9958..ddd559a 100644 (file)
@@ -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);
index 0531747..c071793 100644 (file)
@@ -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" <number>, 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;
index 046ef57..b3bb4eb 100644 (file)
@@ -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), "<sip:%s@%s>;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, &current->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)))) {
index 724493f..cfa63ee 100644 (file)
@@ -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, "<Unknown Caller>"),
+                               S_COR(ast_channel_caller(c)->id.number.valid, ast_channel_caller(c)->id.number.str, "<Unknown Caller>"),
                                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);
index f87e044..caee086 100644 (file)
@@ -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);
                }
        }
index 9560784..b2b5d14 100644 (file)
@@ -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;
index 4055fc5..bca7e9b 100644 (file)
@@ -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));
index 25e095f..db07fcc 100644 (file)
@@ -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.
index 01cac4b..7f4d1a6 100644 (file)
@@ -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 : "<Unknown Caller>",
+                                       ast_channel_caller(chan)->id.number.valid && ast_channel_caller(chan)->id.number.str
+                                               ? ast_channel_caller(chan)->id.number.str : "<Unknown Caller>",
                                        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));
index 85df15b..b317284 100644 (file)
@@ -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) {
index c37cf61..1a8a12b 100644 (file)
@@ -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 */
index be3bbc5..928d5d7 100644 (file)
@@ -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;
        }
 
index bd6d8ae..8e83352 100644 (file)
@@ -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);
index 904eede..0c2e8c7 100644 (file)
@@ -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);
index ff04be8..18de202 100644 (file)
@@ -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]);
index aef0a40..3c2810f 100644 (file)
@@ -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));
index 20fcc43..4d978b8 100644 (file)
@@ -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 */
index 5ef1f96..e3b9843 100644 (file)
@@ -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