summaryrefslogtreecommitdiff
path: root/main
diff options
context:
space:
mode:
Diffstat (limited to 'main')
-rw-r--r--main/aoc.c8
-rw-r--r--main/app.c8
-rw-r--r--main/cdr.c34
-rw-r--r--main/cel.c24
-rw-r--r--main/channel.c132
-rw-r--r--main/channel_internal_api.c76
-rw-r--r--main/cli.c14
-rw-r--r--main/dial.c18
-rw-r--r--main/features.c48
-rw-r--r--main/file.c2
-rw-r--r--main/image.c2
-rw-r--r--main/manager.c16
-rw-r--r--main/pbx.c20
-rw-r--r--main/say.c20
14 files changed, 228 insertions, 194 deletions
diff --git a/main/aoc.c b/main/aoc.c
index aaf4647b9..cb3b057cb 100644
--- a/main/aoc.c
+++ b/main/aoc.c
@@ -1289,7 +1289,7 @@ static void aoc_request_event(const struct ast_aoc_decoded *decoded, struct ast_
{
if (chan) {
ast_str_append(msg, 0, "Channel: %s\r\n", ast_channel_name(chan));
- ast_str_append(msg, 0, "UniqueID: %s\r\n", chan->uniqueid);
+ ast_str_append(msg, 0, "UniqueID: %s\r\n", ast_channel_uniqueid(chan));
}
if (decoded->request_flag) {
@@ -1318,7 +1318,7 @@ static void aoc_s_event(const struct ast_aoc_decoded *decoded, struct ast_channe
if (owner) {
ast_str_append(msg, 0, "Channel: %s\r\n", ast_channel_name(owner));
- ast_str_append(msg, 0, "UniqueID: %s\r\n", owner->uniqueid);
+ ast_str_append(msg, 0, "UniqueID: %s\r\n", ast_channel_uniqueid(owner));
}
ast_str_append(msg, 0, "NumberRates: %d\r\n", decoded->aoc_s_count);
@@ -1391,7 +1391,7 @@ static void aoc_d_event(const struct ast_aoc_decoded *decoded, struct ast_channe
if (chan) {
ast_str_append(msg, 0, "Channel: %s\r\n", ast_channel_name(chan));
- ast_str_append(msg, 0, "UniqueID: %s\r\n", chan->uniqueid);
+ ast_str_append(msg, 0, "UniqueID: %s\r\n", ast_channel_uniqueid(chan));
}
charge_str = aoc_charge_type_str(decoded->charge_type);
@@ -1445,7 +1445,7 @@ static void aoc_e_event(const struct ast_aoc_decoded *decoded, struct ast_channe
if (chan) {
ast_str_append(msg, 0, "Channel: %s\r\n", ast_channel_name(chan));
- ast_str_append(msg, 0, "UniqueID: %s\r\n", chan->uniqueid);
+ ast_str_append(msg, 0, "UniqueID: %s\r\n", ast_channel_uniqueid(chan));
}
charge_str = "ChargingAssociation";
diff --git a/main/app.c b/main/app.c
index c27f71341..d7c148581 100644
--- a/main/app.c
+++ b/main/app.c
@@ -187,7 +187,7 @@ enum ast_getdata_result ast_app_getdata(struct ast_channel *c, const char *promp
while ((front = strsep(&filename, "&"))) {
ast_test_suite_event_notify("PLAYBACK", "Message: %s\r\nChannel: %s", front, ast_channel_name(c));
if (!ast_strlen_zero(front)) {
- res = ast_streamfile(c, front, c->language);
+ res = ast_streamfile(c, front, ast_channel_language(c));
if (res)
continue;
}
@@ -229,7 +229,7 @@ int ast_app_getdata_full(struct ast_channel *c, const char *prompt, char *s, int
int res, to = 2000, fto = 6000;
if (!ast_strlen_zero(prompt)) {
- res = ast_streamfile(c, prompt, c->language);
+ res = ast_streamfile(c, prompt, ast_channel_language(c));
if (res < 0) {
return res;
}
@@ -614,7 +614,7 @@ int ast_control_streamfile(struct ast_channel *chan, const char *file,
for (;;) {
ast_stopstream(chan);
- res = ast_streamfile(chan, file, chan->language);
+ res = ast_streamfile(chan, file, ast_channel_language(chan));
if (!res) {
if (pause_restart_point) {
ast_seekstream(chan->stream, pause_restart_point, SEEK_SET);
@@ -703,7 +703,7 @@ int ast_play_and_wait(struct ast_channel *chan, const char *fn)
int d = 0;
ast_test_suite_event_notify("PLAYBACK", "Message: %s\r\nChannel: %s", fn, ast_channel_name(chan));
- if ((d = ast_streamfile(chan, fn, chan->language))) {
+ if ((d = ast_streamfile(chan, fn, ast_channel_language(chan)))) {
return d;
}
diff --git a/main/cdr.c b/main/cdr.c
index d70e2337f..823f74d85 100644
--- a/main/cdr.c
+++ b/main/cdr.c
@@ -932,15 +932,15 @@ int ast_cdr_init(struct ast_cdr *cdr, struct ast_channel *c)
cdr->disposition = (c->_state == AST_STATE_UP) ? AST_CDR_ANSWERED : AST_CDR_NOANSWER;
cdr->amaflags = c->amaflags ? c->amaflags : ast_default_amaflags;
- ast_copy_string(cdr->accountcode, c->accountcode, sizeof(cdr->accountcode));
- ast_copy_string(cdr->peeraccount, c->peeraccount, sizeof(cdr->peeraccount));
+ ast_copy_string(cdr->accountcode, ast_channel_accountcode(c), sizeof(cdr->accountcode));
+ ast_copy_string(cdr->peeraccount, ast_channel_peeraccount(c), sizeof(cdr->peeraccount));
/* Destination information */
ast_copy_string(cdr->dst, S_OR(c->macroexten,c->exten), sizeof(cdr->dst));
ast_copy_string(cdr->dcontext, S_OR(c->macrocontext,c->context), sizeof(cdr->dcontext));
/* Unique call identifier */
- ast_copy_string(cdr->uniqueid, c->uniqueid, sizeof(cdr->uniqueid));
+ ast_copy_string(cdr->uniqueid, ast_channel_uniqueid(c), sizeof(cdr->uniqueid));
/* Linked call identifier */
- ast_copy_string(cdr->linkedid, c->linkedid, sizeof(cdr->linkedid));
+ ast_copy_string(cdr->linkedid, ast_channel_linkedid(c), sizeof(cdr->linkedid));
}
}
return 0;
@@ -1022,14 +1022,14 @@ int ast_cdr_setaccount(struct ast_channel *chan, const char *account)
struct ast_cdr *cdr = chan->cdr;
const char *old_acct = "";
- if (!ast_strlen_zero(chan->accountcode)) {
- old_acct = ast_strdupa(chan->accountcode);
+ if (!ast_strlen_zero(ast_channel_accountcode(chan))) {
+ old_acct = ast_strdupa(ast_channel_accountcode(chan));
}
- ast_string_field_set(chan, accountcode, account);
+ ast_channel_accountcode_set(chan, account);
for ( ; cdr ; cdr = cdr->next) {
if (!ast_test_flag(cdr, AST_CDR_FLAG_LOCKED)) {
- ast_copy_string(cdr->accountcode, chan->accountcode, sizeof(cdr->accountcode));
+ ast_copy_string(cdr->accountcode, ast_channel_accountcode(chan), sizeof(cdr->accountcode));
}
}
@@ -1038,7 +1038,7 @@ int ast_cdr_setaccount(struct ast_channel *chan, const char *account)
"Uniqueid: %s\r\n"
"AccountCode: %s\r\n"
"OldAccountCode: %s\r\n",
- ast_channel_name(chan), chan->uniqueid, chan->accountcode, old_acct);
+ ast_channel_name(chan), ast_channel_uniqueid(chan), ast_channel_accountcode(chan), old_acct);
return 0;
}
@@ -1048,14 +1048,14 @@ int ast_cdr_setpeeraccount(struct ast_channel *chan, const char *account)
struct ast_cdr *cdr = chan->cdr;
const char *old_acct = "";
- if (!ast_strlen_zero(chan->peeraccount)) {
- old_acct = ast_strdupa(chan->peeraccount);
+ if (!ast_strlen_zero(ast_channel_peeraccount(chan))) {
+ old_acct = ast_strdupa(ast_channel_peeraccount(chan));
}
- ast_string_field_set(chan, peeraccount, account);
+ ast_channel_peeraccount_set(chan, account);
for ( ; cdr ; cdr = cdr->next) {
if (!ast_test_flag(cdr, AST_CDR_FLAG_LOCKED)) {
- ast_copy_string(cdr->peeraccount, chan->peeraccount, sizeof(cdr->peeraccount));
+ ast_copy_string(cdr->peeraccount, ast_channel_peeraccount(chan), sizeof(cdr->peeraccount));
}
}
@@ -1064,7 +1064,7 @@ int ast_cdr_setpeeraccount(struct ast_channel *chan, const char *account)
"Uniqueid: %s\r\n"
"PeerAccount: %s\r\n"
"OldPeerAccount: %s\r\n",
- ast_channel_name(chan), chan->uniqueid, chan->peeraccount, old_acct);
+ ast_channel_name(chan), ast_channel_uniqueid(chan), ast_channel_peeraccount(chan), old_acct);
return 0;
}
@@ -1119,9 +1119,9 @@ int ast_cdr_update(struct ast_channel *c)
set_one_cid(cdr, c);
/* Copy account code et-al */
- ast_copy_string(cdr->accountcode, c->accountcode, sizeof(cdr->accountcode));
- ast_copy_string(cdr->peeraccount, c->peeraccount, sizeof(cdr->peeraccount));
- ast_copy_string(cdr->linkedid, c->linkedid, sizeof(cdr->linkedid));
+ ast_copy_string(cdr->accountcode, ast_channel_accountcode(c), sizeof(cdr->accountcode));
+ ast_copy_string(cdr->peeraccount, ast_channel_peeraccount(c), sizeof(cdr->peeraccount));
+ ast_copy_string(cdr->linkedid, ast_channel_linkedid(c), sizeof(cdr->linkedid));
/* Destination information */ /* XXX privilege macro* ? */
ast_copy_string(cdr->dst, S_OR(c->macroexten, c->exten), sizeof(cdr->dst));
diff --git a/main/cel.c b/main/cel.c
index 534faed50..6e8215f20 100644
--- a/main/cel.c
+++ b/main/cel.c
@@ -373,7 +373,7 @@ static int linkedid_match(void *obj, void *arg, void *data, int flags)
int res;
ast_channel_lock(c);
- res = (c != find_dat->chan && c->linkedid && !strcmp(find_dat->linkedid, c->linkedid));
+ res = (c != find_dat->chan && ast_channel_linkedid(c) && !strcmp(find_dat->linkedid, ast_channel_linkedid(c)));
ast_channel_unlock(c);
return res ? CMP_MATCH | CMP_STOP : 0;
@@ -381,7 +381,7 @@ static int linkedid_match(void *obj, void *arg, void *data, int flags)
void ast_cel_check_retire_linkedid(struct ast_channel *chan)
{
- const char *linkedid = chan->linkedid;
+ const char *linkedid = ast_channel_linkedid(chan);
struct channel_find_data find_dat;
/* make sure we need to do all this work */
@@ -459,11 +459,11 @@ struct ast_channel *ast_cel_fabricate_channel_from_event(const struct ast_event
ast_copy_string(tchan->exten, record.extension, sizeof(tchan->exten));
ast_copy_string(tchan->context, record.context, sizeof(tchan->context));
ast_channel_name_set(tchan, record.channel_name);
- ast_string_field_set(tchan, uniqueid, record.unique_id);
- ast_string_field_set(tchan, linkedid, record.linked_id);
- ast_string_field_set(tchan, accountcode, record.account_code);
- ast_string_field_set(tchan, peeraccount, record.peer_account);
- ast_string_field_set(tchan, userfield, record.user_field);
+ ast_channel_uniqueid_set(tchan, record.unique_id);
+ ast_channel_linkedid_set(tchan, record.linked_id);
+ ast_channel_accountcode_set(tchan, record.account_code);
+ ast_channel_peeraccount_set(tchan, record.peer_account);
+ ast_channel_userfield_set(tchan, record.user_field);
if ((newvariable = ast_var_assign("BRIDGEPEER", record.peer))) {
AST_LIST_INSERT_HEAD(headp, newvariable, entries);
@@ -561,11 +561,11 @@ int ast_cel_report_event(struct ast_channel *chan, enum ast_cel_event_type event
AST_EVENT_IE_CEL_APPNAME, AST_EVENT_IE_PLTYPE_STR, S_OR(chan->appl, ""),
AST_EVENT_IE_CEL_APPDATA, AST_EVENT_IE_PLTYPE_STR, S_OR(chan->data, ""),
AST_EVENT_IE_CEL_AMAFLAGS, AST_EVENT_IE_PLTYPE_UINT, chan->amaflags,
- AST_EVENT_IE_CEL_ACCTCODE, AST_EVENT_IE_PLTYPE_STR, chan->accountcode,
- AST_EVENT_IE_CEL_PEERACCT, AST_EVENT_IE_PLTYPE_STR, chan->peeraccount,
- AST_EVENT_IE_CEL_UNIQUEID, AST_EVENT_IE_PLTYPE_STR, chan->uniqueid,
- AST_EVENT_IE_CEL_LINKEDID, AST_EVENT_IE_PLTYPE_STR, chan->linkedid,
- AST_EVENT_IE_CEL_USERFIELD, AST_EVENT_IE_PLTYPE_STR, chan->userfield,
+ AST_EVENT_IE_CEL_ACCTCODE, AST_EVENT_IE_PLTYPE_STR, ast_channel_accountcode(chan),
+ AST_EVENT_IE_CEL_PEERACCT, AST_EVENT_IE_PLTYPE_STR, ast_channel_peeraccount(chan),
+ AST_EVENT_IE_CEL_UNIQUEID, AST_EVENT_IE_PLTYPE_STR, ast_channel_uniqueid(chan),
+ AST_EVENT_IE_CEL_LINKEDID, AST_EVENT_IE_PLTYPE_STR, ast_channel_linkedid(chan),
+ AST_EVENT_IE_CEL_USERFIELD, AST_EVENT_IE_PLTYPE_STR, ast_channel_userfield(chan),
AST_EVENT_IE_CEL_EXTRA, AST_EVENT_IE_PLTYPE_STR, extra,
AST_EVENT_IE_CEL_PEER, AST_EVENT_IE_PLTYPE_STR, peername,
AST_EVENT_IE_END);
diff --git a/main/channel.c b/main/channel.c
index cc675af97..d0af7d0a2 100644
--- a/main/channel.c
+++ b/main/channel.c
@@ -1036,17 +1036,17 @@ __ast_channel_alloc_ap(int needqueue, int state, const char *cid_num, const char
tmp->fout = global_fout;
if (ast_strlen_zero(ast_config_AST_SYSTEM_NAME)) {
- ast_string_field_build(tmp, uniqueid, "%li.%d", (long) time(NULL),
+ ast_channel_uniqueid_build(tmp, "%li.%d", (long) time(NULL),
ast_atomic_fetchadd_int(&uniqueint, 1));
} else {
- ast_string_field_build(tmp, uniqueid, "%s-%li.%d", ast_config_AST_SYSTEM_NAME,
+ ast_channel_uniqueid_build(tmp, "%s-%li.%d", ast_config_AST_SYSTEM_NAME,
(long) time(NULL), ast_atomic_fetchadd_int(&uniqueint, 1));
}
if (!ast_strlen_zero(linkedid)) {
- ast_string_field_set(tmp, linkedid, linkedid);
+ ast_channel_linkedid_set(tmp, linkedid);
} else {
- ast_string_field_set(tmp, linkedid, tmp->uniqueid);
+ ast_channel_linkedid_set(tmp, ast_channel_uniqueid(tmp));
}
if (!ast_strlen_zero(name_fmt)) {
@@ -1058,7 +1058,7 @@ __ast_channel_alloc_ap(int needqueue, int state, const char *cid_num, const char
* uses them to build the string, instead of forming the va_lists internally from the vararg ... list.
* This new function was written so this can be accomplished.
*/
- ast_channel_name_set_va(tmp, name_fmt, ap);
+ ast_channel_name_build_va(tmp, name_fmt, ap);
tech = ast_strdupa(ast_channel_name(tmp));
if ((slash = strchr(tech, '/'))) {
if ((slash2 = strchr(slash + 1, '/'))) {
@@ -1084,9 +1084,9 @@ __ast_channel_alloc_ap(int needqueue, int state, const char *cid_num, const char
tmp->amaflags = ast_default_amaflags;
if (!ast_strlen_zero(acctcode))
- ast_string_field_set(tmp, accountcode, acctcode);
+ ast_channel_accountcode_set(tmp, acctcode);
else
- ast_string_field_set(tmp, accountcode, ast_default_accountcode);
+ ast_channel_accountcode_set(tmp, ast_default_accountcode);
if (!ast_strlen_zero(context))
ast_copy_string(tmp->context, context, sizeof(tmp->context));
@@ -1113,7 +1113,7 @@ __ast_channel_alloc_ap(int needqueue, int state, const char *cid_num, const char
AST_LIST_HEAD_INIT_NOLOCK(&tmp->autochans);
- ast_string_field_set(tmp, language, defaultlanguage);
+ ast_channel_language_set(tmp, defaultlanguage);
tmp->tech = &null_tech;
@@ -1141,10 +1141,10 @@ __ast_channel_alloc_ap(int needqueue, int state, const char *cid_num, const char
ast_state2str(state),
S_OR(cid_num, ""),
S_OR(cid_name, ""),
- tmp->accountcode,
+ ast_channel_accountcode(tmp),
S_OR(exten, ""),
S_OR(context, ""),
- tmp->uniqueid);
+ ast_channel_uniqueid(tmp));
}
return tmp;
@@ -1344,7 +1344,7 @@ int ast_queue_hangup(struct ast_channel *chan)
"Channel: %s\r\n"
"Uniqueid: %s\r\n",
ast_channel_name(chan),
- chan->uniqueid);
+ ast_channel_uniqueid(chan));
ast_channel_unlock(chan);
}
return ast_queue_frame(chan, &f);
@@ -1369,7 +1369,7 @@ int ast_queue_hangup_with_cause(struct ast_channel *chan, int cause)
"Uniqueid: %s\r\n"
"Cause: %d\r\n",
ast_channel_name(chan),
- chan->uniqueid,
+ ast_channel_uniqueid(chan),
cause);
ast_channel_unlock(chan);
}
@@ -1474,8 +1474,8 @@ static int ast_channel_by_uniqueid_cb(void *obj, void *arg, void *data, int flag
}
ast_channel_lock(chan);
- if ((!name_len && strcasecmp(chan->uniqueid, uniqueid)) ||
- (name_len && strncasecmp(chan->uniqueid, uniqueid, name_len))) {
+ if ((!name_len && strcasecmp(ast_channel_uniqueid(chan), uniqueid)) ||
+ (name_len && strncasecmp(ast_channel_uniqueid(chan), uniqueid, name_len))) {
ret = 0;
}
ast_channel_unlock(chan);
@@ -1572,8 +1572,8 @@ static int ast_channel_cmp_cb(void *obj, void *arg, int flags)
ret = ast_channel_by_name_cb(obj, arg, &name_len, flags);
} else if (!ast_strlen_zero(cmp_args->exten)) {
ret = ast_channel_by_exten_cb(obj, cmp_args->context, cmp_args->exten, flags);
- } else if (!ast_strlen_zero(cmp_args->uniqueid)) {
- ret = ast_channel_by_uniqueid_cb(obj, (void *) cmp_args->uniqueid, &name_len, flags);
+ } else if (!ast_strlen_zero(ast_channel_uniqueid(cmp_args))) {
+ ret = ast_channel_by_uniqueid_cb(obj, (void *) ast_channel_uniqueid(cmp_args), &name_len, flags);
} else {
ret = 0;
}
@@ -2548,7 +2548,7 @@ int ast_softhangup(struct ast_channel *chan, int cause)
"Uniqueid: %s\r\n"
"Cause: %d\r\n",
ast_channel_name(chan),
- chan->uniqueid,
+ ast_channel_uniqueid(chan),
cause);
ast_channel_unlock(chan);
@@ -2579,15 +2579,15 @@ void ast_set_hangupsource(struct ast_channel *chan, const char *source, int forc
struct ast_channel *bridge;
ast_channel_lock(chan);
- if (force || ast_strlen_zero(chan->hangupsource)) {
- ast_string_field_set(chan, hangupsource, source);
+ if (force || ast_strlen_zero(ast_channel_hangupsource(chan))) {
+ ast_channel_hangupsource_set(chan, source);
}
bridge = ast_bridged_channel(chan);
ast_channel_unlock(chan);
- if (bridge && (force || ast_strlen_zero(bridge->hangupsource))) {
+ if (bridge && (force || ast_strlen_zero(ast_channel_hangupsource(bridge)))) {
ast_channel_lock(bridge);
- ast_string_field_set(chan, hangupsource, source);
+ ast_channel_hangupsource_set(chan, source);
ast_channel_unlock(bridge);
}
}
@@ -2670,7 +2670,7 @@ int ast_hangup(struct ast_channel *chan)
chan->generatordata = NULL;
chan->generator = NULL;
- snprintf(extra_str, sizeof(extra_str), "%d,%s,%s", chan->hangupcause, chan->hangupsource, S_OR(pbx_builtin_getvar_helper(chan, "DIALSTATUS"), ""));
+ snprintf(extra_str, sizeof(extra_str), "%d,%s,%s", chan->hangupcause, ast_channel_hangupsource(chan), S_OR(pbx_builtin_getvar_helper(chan, "DIALSTATUS"), ""));
ast_cel_report_event(chan, AST_CEL_HANGUP, NULL, extra_str, NULL);
if (ast_test_flag(chan, AST_FLAG_BLOCKING)) {
@@ -2707,7 +2707,7 @@ int ast_hangup(struct ast_channel *chan)
"Cause: %d\r\n"
"Cause-txt: %s\r\n",
ast_channel_name(chan),
- chan->uniqueid,
+ ast_channel_uniqueid(chan),
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(chan->connected.id.number.valid, chan->connected.id.number.str, "<unknown>"),
@@ -3475,7 +3475,7 @@ static void send_dtmf_event(struct ast_channel *chan, const char *direction, con
"Direction: %s\r\n"
"Begin: %s\r\n"
"End: %s\r\n",
- ast_channel_name(chan), chan->uniqueid, digit, direction, begin, end);
+ ast_channel_name(chan), ast_channel_uniqueid(chan), digit, direction, begin, end);
}
static void ast_read_generator_actions(struct ast_channel *chan, struct ast_frame *f)
@@ -5256,7 +5256,7 @@ struct ast_channel *ast_call_forward(struct ast_channel *caller, struct ast_chan
int res;
/* gather data and request the new forward channel */
- ast_copy_string(tmpchan, orig->call_forward, sizeof(tmpchan));
+ ast_copy_string(tmpchan, ast_channel_call_forward(orig), sizeof(tmpchan));
if ((data = strchr(tmpchan, '/'))) {
*data++ = '\0';
type = tmpchan;
@@ -5264,7 +5264,7 @@ struct ast_channel *ast_call_forward(struct ast_channel *caller, struct ast_chan
const char *forward_context;
ast_channel_lock(orig);
forward_context = pbx_builtin_getvar_helper(orig, "FORWARD_CONTEXT");
- snprintf(tmpchan, sizeof(tmpchan), "%s@%s", orig->call_forward, S_OR(forward_context, orig->context));
+ snprintf(tmpchan, sizeof(tmpchan), "%s@%s", ast_channel_call_forward(orig), S_OR(forward_context, orig->context));
ast_channel_unlock(orig);
data = tmpchan;
type = "Local";
@@ -5295,7 +5295,7 @@ struct ast_channel *ast_call_forward(struct ast_channel *caller, struct ast_chan
ast_channel_lock_both(orig, new_chan);
ast_copy_flags(new_chan->cdr, orig->cdr, AST_CDR_FLAG_ORIGINATED);
- ast_string_field_set(new_chan, accountcode, orig->accountcode);
+ ast_channel_accountcode_set(new_chan, ast_channel_accountcode(orig));
ast_party_connected_line_copy(&new_chan->connected, &orig->connected);
ast_party_redirecting_copy(&new_chan->redirecting, &orig->redirecting);
ast_channel_unlock(new_chan);
@@ -5394,7 +5394,7 @@ struct ast_channel *__ast_request_and_dial(const char *type, struct ast_format_c
break;
if (timeout > -1)
timeout = res;
- if (!ast_strlen_zero(chan->call_forward)) {
+ if (!ast_strlen_zero(ast_channel_call_forward(chan))) {
if (!(chan = ast_call_forward(NULL, chan, NULL, cap, oh, outstate))) {
return NULL;
}
@@ -6098,7 +6098,7 @@ int ast_channel_transfer_masquerade(
*/
static void __ast_change_name_nolink(struct ast_channel *chan, const char *newname)
{
- ast_manager_event(chan, EVENT_FLAG_CALL, "Rename", "Channel: %s\r\nNewname: %s\r\nUniqueid: %s\r\n", ast_channel_name(chan), newname, chan->uniqueid);
+ ast_manager_event(chan, EVENT_FLAG_CALL, "Rename", "Channel: %s\r\nNewname: %s\r\nUniqueid: %s\r\n", ast_channel_name(chan), newname, ast_channel_uniqueid(chan));
ast_channel_name_set(chan, newname);
}
@@ -6244,11 +6244,11 @@ static const char *oldest_linkedid(const char *a, const char *b)
static void ast_channel_change_linkedid(struct ast_channel *chan, const char *linkedid)
{
/* if the linkedid for this channel is being changed from something, check... */
- if (!ast_strlen_zero(chan->linkedid) && 0 != strcmp(chan->linkedid, linkedid)) {
+ if (!ast_strlen_zero(ast_channel_linkedid(chan)) && 0 != strcmp(ast_channel_linkedid(chan), linkedid)) {
ast_cel_check_retire_linkedid(chan);
}
- ast_string_field_set(chan, linkedid, linkedid);
+ ast_channel_linkedid_set(chan, linkedid);
}
@@ -6261,21 +6261,21 @@ void ast_channel_set_linkgroup(struct ast_channel *chan, struct ast_channel *pee
const char* linkedid=NULL;
struct ast_channel *bridged;
- linkedid = oldest_linkedid(chan->linkedid, peer->linkedid);
- linkedid = oldest_linkedid(linkedid, chan->uniqueid);
- linkedid = oldest_linkedid(linkedid, peer->uniqueid);
+ linkedid = oldest_linkedid(ast_channel_linkedid(chan), ast_channel_linkedid(peer));
+ linkedid = oldest_linkedid(linkedid, ast_channel_uniqueid(chan));
+ linkedid = oldest_linkedid(linkedid, ast_channel_uniqueid(peer));
if (chan->_bridge) {
bridged = ast_bridged_channel(chan);
if (bridged != peer) {
- linkedid = oldest_linkedid(linkedid, bridged->linkedid);
- linkedid = oldest_linkedid(linkedid, bridged->uniqueid);
+ linkedid = oldest_linkedid(linkedid, ast_channel_linkedid(bridged));
+ linkedid = oldest_linkedid(linkedid, ast_channel_uniqueid(bridged));
}
}
if (peer->_bridge) {
bridged = ast_bridged_channel(peer);
if (bridged != chan) {
- linkedid = oldest_linkedid(linkedid, bridged->linkedid);
- linkedid = oldest_linkedid(linkedid, bridged->uniqueid);
+ linkedid = oldest_linkedid(linkedid, ast_channel_linkedid(bridged));
+ linkedid = oldest_linkedid(linkedid, ast_channel_uniqueid(bridged));
}
}
@@ -6302,35 +6302,35 @@ void ast_channel_set_linkgroup(struct ast_channel *chan, struct ast_channel *pee
static void ast_set_owners_and_peers(struct ast_channel *chan1,
struct ast_channel *chan2)
{
- if (!ast_strlen_zero(chan1->accountcode) && ast_strlen_zero(chan2->peeraccount)) {
+ if (!ast_strlen_zero(ast_channel_accountcode(chan1)) && ast_strlen_zero(ast_channel_peeraccount(chan2))) {
ast_debug(1, "setting peeraccount to %s for %s from data on channel %s\n",
- chan1->accountcode, ast_channel_name(chan2), ast_channel_name(chan1));
- ast_string_field_set(chan2, peeraccount, chan1->accountcode);
+ ast_channel_accountcode(chan1), ast_channel_name(chan2), ast_channel_name(chan1));
+ ast_channel_peeraccount_set(chan2, ast_channel_accountcode(chan1));
}
- if (!ast_strlen_zero(chan2->accountcode) && ast_strlen_zero(chan1->peeraccount)) {
+ if (!ast_strlen_zero(ast_channel_accountcode(chan2)) && ast_strlen_zero(ast_channel_peeraccount(chan1))) {
ast_debug(1, "setting peeraccount to %s for %s from data on channel %s\n",
- chan2->accountcode, ast_channel_name(chan1), ast_channel_name(chan2));
- ast_string_field_set(chan1, peeraccount, chan2->accountcode);
+ ast_channel_accountcode(chan2), ast_channel_name(chan1), ast_channel_name(chan2));
+ ast_channel_peeraccount_set(chan1, ast_channel_accountcode(chan2));
}
- if (!ast_strlen_zero(chan1->peeraccount) && ast_strlen_zero(chan2->accountcode)) {
+ if (!ast_strlen_zero(ast_channel_peeraccount(chan1)) && ast_strlen_zero(ast_channel_accountcode(chan2))) {
ast_debug(1, "setting accountcode to %s for %s from data on channel %s\n",
- chan1->peeraccount, ast_channel_name(chan2), ast_channel_name(chan1));
- ast_string_field_set(chan2, accountcode, chan1->peeraccount);
+ ast_channel_peeraccount(chan1), ast_channel_name(chan2), ast_channel_name(chan1));
+ ast_channel_accountcode_set(chan2, ast_channel_peeraccount(chan1));
}
- if (!ast_strlen_zero(chan2->peeraccount) && ast_strlen_zero(chan1->accountcode)) {
+ if (!ast_strlen_zero(ast_channel_peeraccount(chan2)) && ast_strlen_zero(ast_channel_accountcode(chan1))) {
ast_debug(1, "setting accountcode to %s for %s from data on channel %s\n",
- chan2->peeraccount, ast_channel_name(chan1), ast_channel_name(chan2));
- ast_string_field_set(chan1, accountcode, chan2->peeraccount);
+ ast_channel_peeraccount(chan2), ast_channel_name(chan1), ast_channel_name(chan2));
+ ast_channel_accountcode_set(chan1, ast_channel_peeraccount(chan2));
}
- if (0 != strcmp(chan1->accountcode, chan2->peeraccount)) {
+ if (0 != strcmp(ast_channel_accountcode(chan1), ast_channel_peeraccount(chan2))) {
ast_debug(1, "changing peeraccount from %s to %s on %s to match channel %s\n",
- chan2->peeraccount, chan1->peeraccount, ast_channel_name(chan2), ast_channel_name(chan1));
- ast_string_field_set(chan2, peeraccount, chan1->accountcode);
+ ast_channel_peeraccount(chan2), ast_channel_peeraccount(chan1), ast_channel_name(chan2), ast_channel_name(chan1));
+ ast_channel_peeraccount_set(chan2, ast_channel_accountcode(chan1));
}
- if (0 != strcmp(chan2->accountcode, chan1->peeraccount)) {
+ if (0 != strcmp(ast_channel_accountcode(chan2), ast_channel_peeraccount(chan1))) {
ast_debug(1, "changing peeraccount from %s to %s on %s to match channel %s\n",
- chan1->peeraccount, chan2->peeraccount, ast_channel_name(chan1), ast_channel_name(chan2));
- ast_string_field_set(chan1, peeraccount, chan2->accountcode);
+ ast_channel_peeraccount(chan1), ast_channel_peeraccount(chan2), ast_channel_name(chan1), ast_channel_name(chan2));
+ ast_channel_peeraccount_set(chan1, ast_channel_accountcode(chan2));
}
}
@@ -6351,7 +6351,7 @@ static void report_new_callerid(struct ast_channel *chan)
ast_channel_name(chan),
S_COR(chan->caller.id.number.valid, chan->caller.id.number.str, ""),
S_COR(chan->caller.id.name.valid, chan->caller.id.name.str, ""),
- chan->uniqueid,
+ ast_channel_uniqueid(chan),
pres,
ast_describe_caller_presentation(pres)
);
@@ -6660,7 +6660,7 @@ int ast_do_masquerade(struct ast_channel *original)
clonechan->monitor = t_pvt;
/* Keep the same language. */
- ast_string_field_set(original, language, clonechan->language);
+ ast_channel_language_set(original, ast_channel_language(clonechan));
/* Copy the FD's other than the generator fd */
for (x = 0; x < AST_MAX_FDS; x++) {
if (x != AST_GENERATOR_FD)
@@ -6737,13 +6737,13 @@ int ast_do_masquerade(struct ast_channel *original)
ast_set_read_format(original, &rformat);
/* Copy the music class */
- ast_string_field_set(original, musicclass, clonechan->musicclass);
+ ast_channel_musicclass_set(original, ast_channel_musicclass(clonechan));
/* copy over accuntcode and set peeraccount across the bridge */
- ast_string_field_set(original, accountcode, S_OR(clonechan->accountcode, ""));
+ ast_channel_accountcode_set(original, S_OR(ast_channel_accountcode(clonechan), ""));
if (original->_bridge) {
/* XXX - should we try to lock original->_bridge here? */
- ast_string_field_set(original->_bridge, peeraccount, S_OR(clonechan->accountcode, ""));
+ ast_channel_peeraccount_set(original->_bridge, S_OR(ast_channel_accountcode(clonechan), ""));
ast_cel_report_event(original, AST_CEL_BRIDGE_UPDATE, NULL, NULL, NULL);
}
@@ -6787,7 +6787,7 @@ int ast_do_masquerade(struct ast_channel *original)
"Cause: %d\r\n"
"Cause-txt: %s\r\n",
ast_channel_name(clonechan),
- clonechan->uniqueid,
+ ast_channel_uniqueid(clonechan),
clonechan->hangupcause,
ast_cause2str(clonechan->hangupcause)
);
@@ -6942,7 +6942,7 @@ int ast_setstate(struct ast_channel *chan, enum ast_channel_state state)
S_COR(chan->caller.id.name.valid, chan->caller.id.name.str, ""),
S_COR(chan->connected.id.number.valid, chan->connected.id.number.str, ""),
S_COR(chan->connected.id.name.valid, chan->connected.id.name.str, ""),
- chan->uniqueid);
+ ast_channel_uniqueid(chan));
return 0;
}
@@ -6977,11 +6977,11 @@ static void bridge_playfile(struct ast_channel *chan, struct ast_channel *peer,
if (!strcmp(sound,"timeleft")) { /* Queue support */
ast_stream_and_wait(chan, "vm-youhave", "");
if (min) {
- ast_say_number(chan, min, AST_DIGIT_ANY, chan->language, NULL);
+ ast_say_number(chan, min, AST_DIGIT_ANY, ast_channel_language(chan), NULL);
ast_stream_and_wait(chan, "queue-minutes", "");
}
if (sec) {
- ast_say_number(chan, sec, AST_DIGIT_ANY, chan->language, NULL);
+ ast_say_number(chan, sec, AST_DIGIT_ANY, ast_channel_language(chan), NULL);
ast_stream_and_wait(chan, "queue-seconds", "");
}
} else {
@@ -7232,7 +7232,7 @@ static void manager_bridge_event(int onoff, int type, struct ast_channel *c0, st
onoff ? "Link" : "Unlink",
type == 1 ? "core" : "native",
ast_channel_name(c0), ast_channel_name(c1),
- c0->uniqueid, c1->uniqueid,
+ ast_channel_uniqueid(c0), ast_channel_uniqueid(c1),
S_COR(c0->caller.id.number.valid, c0->caller.id.number.str, ""),
S_COR(c1->caller.id.number.valid, c1->caller.id.number.str, ""));
}
diff --git a/main/channel_internal_api.c b/main/channel_internal_api.c
index 0e624dfb3..92e2d7e42 100644
--- a/main/channel_internal_api.c
+++ b/main/channel_internal_api.c
@@ -56,17 +56,17 @@ AST_DATA_STRUCTURE(ast_callerid, DATA_EXPORT_CALLERID);
MEMBER(ast_channel, appl, AST_DATA_STRING) \
MEMBER(ast_channel, data, AST_DATA_STRING) \
MEMBER(ast_channel, __do_not_use_name, AST_DATA_STRING) \
- MEMBER(ast_channel, language, AST_DATA_STRING) \
- MEMBER(ast_channel, musicclass, AST_DATA_STRING) \
- MEMBER(ast_channel, accountcode, AST_DATA_STRING) \
- MEMBER(ast_channel, peeraccount, AST_DATA_STRING) \
- MEMBER(ast_channel, userfield, AST_DATA_STRING) \
- MEMBER(ast_channel, call_forward, AST_DATA_STRING) \
- MEMBER(ast_channel, uniqueid, AST_DATA_STRING) \
- MEMBER(ast_channel, linkedid, AST_DATA_STRING) \
- MEMBER(ast_channel, parkinglot, AST_DATA_STRING) \
- MEMBER(ast_channel, hangupsource, AST_DATA_STRING) \
- MEMBER(ast_channel, dialcontext, AST_DATA_STRING) \
+ MEMBER(ast_channel, __do_not_use_language, AST_DATA_STRING) \
+ MEMBER(ast_channel, __do_not_use_musicclass, AST_DATA_STRING) \
+ MEMBER(ast_channel, __do_not_use_accountcode, AST_DATA_STRING) \
+ MEMBER(ast_channel, __do_not_use_peeraccount, AST_DATA_STRING) \
+ MEMBER(ast_channel, __do_not_use_userfield, AST_DATA_STRING) \
+ MEMBER(ast_channel, __do_not_use_call_forward, AST_DATA_STRING) \
+ MEMBER(ast_channel, __do_not_use_uniqueid, AST_DATA_STRING) \
+ MEMBER(ast_channel, __do_not_use_linkedid, AST_DATA_STRING) \
+ MEMBER(ast_channel, __do_not_use_parkinglot, AST_DATA_STRING) \
+ MEMBER(ast_channel, __do_not_use_hangupsource, AST_DATA_STRING) \
+ MEMBER(ast_channel, __do_not_use_dialcontext, AST_DATA_STRING) \
MEMBER(ast_channel, rings, AST_DATA_INTEGER) \
MEMBER(ast_channel, priority, AST_DATA_INTEGER) \
MEMBER(ast_channel, macropriority, AST_DATA_INTEGER) \
@@ -245,17 +245,51 @@ int ast_channel_data_cmp_structure(const struct ast_data_search *tree,
/* ACCESSORS */
-const char *ast_channel_name(const struct ast_channel *chan)
-{
- return chan->__do_not_use_name;
+#define DEFINE_STRINGFIELD_SETTERS_FOR(field) \
+void ast_channel_##field##_set(struct ast_channel *chan, const char *value) \
+{ \
+ ast_string_field_set(chan, __do_not_use_##field, value); \
+} \
+ \
+void ast_channel_##field##_build_va(struct ast_channel *chan, const char *fmt, va_list ap) \
+{ \
+ ast_string_field_build_va(chan, __do_not_use_##field, fmt, ap); \
+} \
+void ast_channel_##field##_build(struct ast_channel *chan, const char *fmt, ...) \
+{ \
+ va_list ap; \
+ va_start(ap, fmt); \
+ ast_channel_##field##_build_va(chan, fmt, ap); \
+ va_end(ap); \
}
-void ast_channel_name_set(struct ast_channel *chan, const char *name)
-{
- ast_string_field_set(chan, __do_not_use_name, name);
+DEFINE_STRINGFIELD_SETTERS_FOR(name)
+DEFINE_STRINGFIELD_SETTERS_FOR(language)
+DEFINE_STRINGFIELD_SETTERS_FOR(musicclass)
+DEFINE_STRINGFIELD_SETTERS_FOR(accountcode)
+DEFINE_STRINGFIELD_SETTERS_FOR(peeraccount)
+DEFINE_STRINGFIELD_SETTERS_FOR(userfield)
+DEFINE_STRINGFIELD_SETTERS_FOR(call_forward)
+DEFINE_STRINGFIELD_SETTERS_FOR(uniqueid)
+DEFINE_STRINGFIELD_SETTERS_FOR(linkedid)
+DEFINE_STRINGFIELD_SETTERS_FOR(parkinglot)
+DEFINE_STRINGFIELD_SETTERS_FOR(hangupsource)
+DEFINE_STRINGFIELD_SETTERS_FOR(dialcontext)
+
+#define DEFINE_STRINGFIELD_GETTER_FOR(field) const char *ast_channel_##field(const struct ast_channel *chan) \
+{ \
+ return chan->__do_not_use_##field; \
}
-void ast_channel_name_set_va(struct ast_channel *chan, const char *name_fmt, va_list ap)
-{
- ast_string_field_build_va(chan, __do_not_use_name, name_fmt, ap);
-}
+DEFINE_STRINGFIELD_GETTER_FOR(name)
+DEFINE_STRINGFIELD_GETTER_FOR(language)
+DEFINE_STRINGFIELD_GETTER_FOR(musicclass)
+DEFINE_STRINGFIELD_GETTER_FOR(accountcode)
+DEFINE_STRINGFIELD_GETTER_FOR(peeraccount)
+DEFINE_STRINGFIELD_GETTER_FOR(userfield)
+DEFINE_STRINGFIELD_GETTER_FOR(call_forward)
+DEFINE_STRINGFIELD_GETTER_FOR(uniqueid)
+DEFINE_STRINGFIELD_GETTER_FOR(linkedid)
+DEFINE_STRINGFIELD_GETTER_FOR(parkinglot)
+DEFINE_STRINGFIELD_GETTER_FOR(hangupsource)
+DEFINE_STRINGFIELD_GETTER_FOR(dialcontext)
diff --git a/main/cli.c b/main/cli.c
index 1923dd3d3..69521e1cd 100644
--- a/main/cli.c
+++ b/main/cli.c
@@ -918,20 +918,20 @@ static char *handle_chanlist(struct ast_cli_entry *e, int cmd, struct ast_cli_ar
c->appl ? c->appl : "(None)",
S_OR(c->data, ""), /* XXX different from verbose ? */
S_COR(c->caller.id.number.valid, c->caller.id.number.str, ""),
- S_OR(c->accountcode, ""),
- S_OR(c->peeraccount, ""),
+ S_OR(ast_channel_accountcode(c), ""),
+ S_OR(ast_channel_peeraccount(c), ""),
c->amaflags,
durbuf,
bc ? ast_channel_name(bc) : "(None)",
- c->uniqueid);
+ ast_channel_uniqueid(c));
} else if (verbose) {
ast_cli(a->fd, VERBOSE_FORMAT_STRING, ast_channel_name(c), c->context, c->exten, c->priority, ast_state2str(c->_state),
c->appl ? c->appl : "(None)",
c->data ? S_OR(c->data, "(Empty)" ): "(None)",
S_COR(c->caller.id.number.valid, c->caller.id.number.str, ""),
durbuf,
- S_OR(c->accountcode, ""),
- S_OR(c->peeraccount, ""),
+ S_OR(ast_channel_accountcode(c), ""),
+ S_OR(ast_channel_peeraccount(c), ""),
bc ? ast_channel_name(bc) : "(None)");
} else {
char locbuf[40] = "(None)";
@@ -1475,13 +1475,13 @@ static char *handle_showchan(struct ast_cli_entry *e, int cmd, struct ast_cli_ar
" Application: %s\n"
" Data: %s\n"
" Blocking in: %s\n",
- ast_channel_name(c), c->tech->type, c->uniqueid, c->linkedid,
+ ast_channel_name(c), c->tech->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)"),
- c->language,
+ ast_channel_language(c),
ast_state2str(c->_state), c->_state, c->rings,
ast_getformatname_multiple(nf, sizeof(nf), c->nativeformats),
ast_getformatname(&c->writeformat),
diff --git a/main/dial.c b/main/dial.c
index 7fe49be33..a18e06505 100644
--- a/main/dial.c
+++ b/main/dial.c
@@ -286,10 +286,10 @@ static int begin_dial_channel(struct ast_dial_channel *channel, struct ast_chann
ast_connected_line_copy_from_caller(&channel->owner->connected, &chan->caller);
- ast_string_field_set(channel->owner, language, chan->language);
- ast_string_field_set(channel->owner, accountcode, chan->accountcode);
- if (ast_strlen_zero(channel->owner->musicclass))
- ast_string_field_set(channel->owner, musicclass, chan->musicclass);
+ ast_channel_language_set(channel->owner, ast_channel_language(chan));
+ ast_channel_accountcode_set(channel->owner, ast_channel_accountcode(chan));
+ if (ast_strlen_zero(ast_channel_musicclass(channel->owner)))
+ ast_channel_musicclass_set(channel->owner, ast_channel_musicclass(chan));
channel->owner->adsicpe = chan->adsicpe;
channel->owner->transfercapability = chan->transfercapability;
@@ -331,7 +331,7 @@ static int begin_dial(struct ast_dial *dial, struct ast_channel *chan)
static int handle_call_forward(struct ast_dial *dial, struct ast_dial_channel *channel, struct ast_channel *chan)
{
struct ast_channel *original = channel->owner;
- char *tmp = ast_strdupa(channel->owner->call_forward);
+ char *tmp = ast_strdupa(ast_channel_call_forward(channel->owner));
char *tech = "Local", *device = tmp, *stuff;
/* If call forwarding is disabled just drop the original channel and don't attempt to dial the new one */
@@ -567,11 +567,11 @@ static enum ast_dial_result monitor_dial(struct ast_dial *dial, struct ast_chann
ast_indicate(chan, AST_CONTROL_RINGING);
} else if (chan && dial->options[AST_DIAL_OPTION_MUSIC] &&
!ast_strlen_zero(dial->options[AST_DIAL_OPTION_MUSIC])) {
- char *original_moh = ast_strdupa(chan->musicclass);
+ char *original_moh = ast_strdupa(ast_channel_musicclass(chan));
ast_indicate(chan, -1);
- ast_string_field_set(chan, musicclass, dial->options[AST_DIAL_OPTION_MUSIC]);
+ ast_channel_musicclass_set(chan, dial->options[AST_DIAL_OPTION_MUSIC]);
ast_moh_start(chan, dial->options[AST_DIAL_OPTION_MUSIC], NULL);
- ast_string_field_set(chan, musicclass, original_moh);
+ ast_channel_musicclass_set(chan, original_moh);
}
/* Record start time for timeout purposes */
@@ -628,7 +628,7 @@ static enum ast_dial_result monitor_dial(struct ast_dial *dial, struct ast_chann
channel = find_relative_dial_channel(dial, who);
/* See if this channel has been forwarded elsewhere */
- if (!ast_strlen_zero(who->call_forward)) {
+ if (!ast_strlen_zero(ast_channel_call_forward(who))) {
handle_call_forward(dial, channel, chan);
continue;
}
diff --git a/main/features.c b/main/features.c
index 3232f22b2..a053d50ee 100644
--- a/main/features.c
+++ b/main/features.c
@@ -868,7 +868,7 @@ static void check_goto_on_transfer(struct ast_channel *chan)
ast_debug(1, "Attempting GOTO_ON_BLINDXFR=%s for %s.\n", val, ast_channel_name(chan));
- xferchan = ast_channel_alloc(0, AST_STATE_DOWN, 0, 0, "", "", "", chan->linkedid, 0,
+ xferchan = ast_channel_alloc(0, AST_STATE_DOWN, 0, 0, "", "", "", ast_channel_linkedid(chan), 0,
"%s", ast_channel_name(chan));
if (!xferchan) {
return;
@@ -1003,9 +1003,9 @@ static const char *findparkinglotname(struct ast_channel *chan)
/* The channel variable overrides everything */
name = pbx_builtin_getvar_helper(chan, "PARKINGLOT");
- if (!name && !ast_strlen_zero(chan->parkinglot)) {
+ if (!name && !ast_strlen_zero(ast_channel_parkinglot(chan))) {
/* Use the channel's parking lot. */
- name = chan->parkinglot;
+ name = ast_channel_parkinglot(chan);
}
return name;
}
@@ -1514,7 +1514,7 @@ static int park_call_full(struct ast_channel *chan, struct ast_channel *peer, st
S_COR(pu->chan->caller.id.name.valid, pu->chan->caller.id.name.str, "<unknown>"),
S_COR(pu->chan->connected.id.number.valid, pu->chan->connected.id.number.str, "<unknown>"),
S_COR(pu->chan->connected.id.name.valid, pu->chan->connected.id.name.str, "<unknown>"),
- pu->chan->uniqueid
+ ast_channel_uniqueid(pu->chan)
);
if (peer && adsipark && ast_adsi_available(peer)) {
@@ -1544,7 +1544,7 @@ static int park_call_full(struct ast_channel *chan, struct ast_channel *peer, st
*/
ast_set_flag(peer, AST_FLAG_MASQ_NOSTREAM);
/* Tell the peer channel the number of the parking space */
- ast_say_digits(peer, pu->parkingnum, "", peer->language);
+ ast_say_digits(peer, pu->parkingnum, "", ast_channel_language(peer));
ast_clear_flag(peer, AST_FLAG_MASQ_NOSTREAM);
}
if (peer == chan) { /* pu->notquiteyet = 1 */
@@ -1635,8 +1635,8 @@ static int masq_park_call(struct ast_channel *rchan, struct ast_channel *peer, s
struct ast_channel *chan;
/* Make a new, channel that we'll use to masquerade in the real one */
- chan = ast_channel_alloc(0, AST_STATE_DOWN, 0, 0, rchan->accountcode, rchan->exten,
- rchan->context, rchan->linkedid, rchan->amaflags, "Parked/%s", ast_channel_name(rchan));
+ chan = ast_channel_alloc(0, AST_STATE_DOWN, 0, 0, ast_channel_accountcode(rchan), rchan->exten,
+ rchan->context, ast_channel_linkedid(rchan), rchan->amaflags, "Parked/%s", ast_channel_name(rchan));
if (!chan) {
ast_log(LOG_WARNING, "Unable to create parked channel\n");
if (!ast_test_flag(args, AST_PARK_OPT_SILENCE)) {
@@ -2533,7 +2533,7 @@ static int builtin_atxfer(struct ast_channel *chan, struct ast_channel *peer, st
/* Dial party C */
newchan = feature_request_and_dial(transferer, transferer_name_orig, transferer,
transferee, "Local", transferer->nativeformats, xferto,
- atxfernoanswertimeout, &outstate, transferer->language);
+ atxfernoanswertimeout, &outstate, ast_channel_language(transferer));
ast_debug(2, "Dial party C result: newchan:%d, outstate:%d\n", !!newchan, outstate);
if (!ast_check_hangup(transferer)) {
@@ -2640,7 +2640,7 @@ static int builtin_atxfer(struct ast_channel *chan, struct ast_channel *peer, st
newchan = feature_request_and_dial(transferer, transferer_name_orig,
transferee, transferee, transferer_tech,
transferee->nativeformats, transferer_name,
- atxfernoanswertimeout, &outstate, transferer->language);
+ atxfernoanswertimeout, &outstate, ast_channel_language(transferer));
ast_debug(2, "Dial party B result: newchan:%d, outstate:%d\n",
!!newchan, outstate);
if (newchan || ast_check_hangup(transferee)) {
@@ -2669,7 +2669,7 @@ static int builtin_atxfer(struct ast_channel *chan, struct ast_channel *peer, st
newchan = feature_request_and_dial(transferer, transferer_name_orig,
transferer, transferee, "Local",
transferee->nativeformats, xferto,
- atxfernoanswertimeout, &outstate, transferer->language);
+ atxfernoanswertimeout, &outstate, ast_channel_language(transferer));
ast_debug(2, "Redial party C result: newchan:%d, outstate:%d\n",
!!newchan, outstate);
if (newchan || ast_check_hangup(transferee)) {
@@ -2710,7 +2710,7 @@ static int builtin_atxfer(struct ast_channel *chan, struct ast_channel *peer, st
/* Initiate the channel transfer of party A to party C (or recalled party B). */
ast_cel_report_event(transferee, AST_CEL_ATTENDEDTRANSFER, NULL, NULL, newchan);
- xferchan = ast_channel_alloc(0, AST_STATE_DOWN, 0, 0, "", "", "", transferee->linkedid, 0, "Transfered/%s", ast_channel_name(transferee));
+ xferchan = ast_channel_alloc(0, AST_STATE_DOWN, 0, 0, "", "", "", ast_channel_linkedid(transferee), 0, "Transfered/%s", ast_channel_name(transferee));
if (!xferchan) {
ast_hangup(newchan);
ast_party_connected_line_free(&connected_line);
@@ -3444,7 +3444,7 @@ static struct ast_channel *feature_request_and_dial(struct ast_channel *caller,
goto done;
}
- ast_string_field_set(chan, language, language);
+ ast_channel_language_set(chan, language);
ast_channel_inherit_variables(caller, chan);
pbx_builtin_setvar_helper(chan, "TRANSFERERNAME", caller_name);
@@ -3545,7 +3545,7 @@ static struct ast_channel *feature_request_and_dial(struct ast_channel *caller,
}
}
} else if (chan == active_channel) {
- if (!ast_strlen_zero(chan->call_forward)) {
+ if (!ast_strlen_zero(ast_channel_call_forward(chan))) {
state = 0;
ast_autoservice_start(transferee);
chan = ast_call_forward(caller, chan, NULL, tmp_cap, NULL, &state);
@@ -3701,10 +3701,10 @@ void ast_channel_log(char *title, struct ast_channel *chan) /* for debug, this i
ast_log(LOG_NOTICE, "CHAN: name: %s; appl: %s; data: %s; contxt: %s; exten: %s; pri: %d;\n",
ast_channel_name(chan), chan->appl, chan->data, chan->context, chan->exten, chan->priority);
ast_log(LOG_NOTICE, "CHAN: acctcode: %s; dialcontext: %s; amaflags: %x; maccontxt: %s; macexten: %s; macpri: %d;\n",
- chan->accountcode, chan->dialcontext, chan->amaflags, chan->macrocontext, chan->macroexten, chan->macropriority);
+ ast_channel_accountcode(chan), ast_channel_dialcontext(chan), chan->amaflags, chan->macrocontext, chan->macroexten, chan->macropriority);
ast_log(LOG_NOTICE, "CHAN: masq: %p; masqr: %p; _bridge: %p; uniqueID: %s; linkedID:%s\n",
chan->masq, chan->masqr,
- chan->_bridge, chan->uniqueid, chan->linkedid);
+ chan->_bridge, ast_channel_uniqueid(chan), ast_channel_linkedid(chan));
if (chan->masqr) {
ast_log(LOG_NOTICE, "CHAN: masquerading as: %s; cdr: %p;\n",
ast_channel_name(chan->masqr), chan->masqr->cdr);
@@ -3955,19 +3955,19 @@ int ast_bridge_call(struct ast_channel *chan, struct ast_channel *peer, struct a
if (peer_cdr && !ast_strlen_zero(peer_cdr->userfield)) {
ast_copy_string(bridge_cdr->userfield, peer_cdr->userfield, sizeof(bridge_cdr->userfield));
}
- ast_cdr_setaccount(peer, chan->accountcode);
+ ast_cdr_setaccount(peer, ast_channel_accountcode(chan));
} else {
/* better yet, in a xfer situation, find out why the chan cdr got zapped (pun unintentional) */
bridge_cdr = ast_cdr_alloc(); /* this should be really, really rare/impossible? */
ast_copy_string(bridge_cdr->channel, ast_channel_name(chan), sizeof(bridge_cdr->channel));
ast_copy_string(bridge_cdr->dstchannel, ast_channel_name(peer), sizeof(bridge_cdr->dstchannel));
- ast_copy_string(bridge_cdr->uniqueid, chan->uniqueid, sizeof(bridge_cdr->uniqueid));
+ ast_copy_string(bridge_cdr->uniqueid, ast_channel_uniqueid(chan), sizeof(bridge_cdr->uniqueid));
ast_copy_string(bridge_cdr->lastapp, S_OR(chan->appl, ""), sizeof(bridge_cdr->lastapp));
ast_copy_string(bridge_cdr->lastdata, S_OR(chan->data, ""), sizeof(bridge_cdr->lastdata));
ast_cdr_setcid(bridge_cdr, chan);
bridge_cdr->disposition = (chan->_state == AST_STATE_UP) ? AST_CDR_ANSWERED : AST_CDR_NULL;
bridge_cdr->amaflags = chan->amaflags ? chan->amaflags : ast_default_amaflags;
- ast_copy_string(bridge_cdr->accountcode, chan->accountcode, sizeof(bridge_cdr->accountcode));
+ ast_copy_string(bridge_cdr->accountcode, ast_channel_accountcode(chan), sizeof(bridge_cdr->accountcode));
/* Destination information */
ast_copy_string(bridge_cdr->dst, chan->exten, sizeof(bridge_cdr->dst));
ast_copy_string(bridge_cdr->dcontext, chan->context, sizeof(bridge_cdr->dcontext));
@@ -4512,7 +4512,7 @@ static void post_manager_event(const char *s, struct parkeduser *pu)
S_COR(pu->chan->caller.id.name.valid, pu->chan->caller.id.name.str, "<unknown>"),
S_COR(pu->chan->connected.id.number.valid, pu->chan->connected.id.number.str, "<unknown>"),
S_COR(pu->chan->connected.id.name.valid, pu->chan->connected.id.name.str, "<unknown>"),
- pu->chan->uniqueid
+ ast_channel_uniqueid(pu->chan)
);
}
@@ -6868,7 +6868,7 @@ static int action_bridge(struct mansession *s, const struct message *m)
/* create the placeholder channels and grab the other channels */
if (!(tmpchana = ast_channel_alloc(0, AST_STATE_DOWN, NULL, NULL, NULL,
- NULL, NULL, chana->linkedid, 0, "Bridge/%s", ast_channel_name(chana)))) {
+ NULL, NULL, ast_channel_linkedid(chana), 0, "Bridge/%s", ast_channel_name(chana)))) {
astman_send_error(s, m, "Unable to create temporary channel!");
chana = ast_channel_unref(chana);
return 1;
@@ -6895,7 +6895,7 @@ static int action_bridge(struct mansession *s, const struct message *m)
/* create the placeholder channels and grab the other channels */
if (!(tmpchanb = ast_channel_alloc(0, AST_STATE_DOWN, NULL, NULL, NULL,
- NULL, NULL, chanb->linkedid, 0, "Bridge/%s", ast_channel_name(chanb)))) {
+ NULL, NULL, ast_channel_linkedid(chanb), 0, "Bridge/%s", ast_channel_name(chanb)))) {
astman_send_error(s, m, "Unable to create temporary channels!");
ast_hangup(tmpchana);
chanb = ast_channel_unref(chanb);
@@ -6929,7 +6929,7 @@ static int action_bridge(struct mansession *s, const struct message *m)
tobj->return_to_pbx = 1;
if (ast_true(playtone)) {
- if (!ast_strlen_zero(xfersound) && !ast_streamfile(tmpchanb, xfersound, tmpchanb->language)) {
+ if (!ast_strlen_zero(xfersound) && !ast_streamfile(tmpchanb, xfersound, ast_channel_language(tmpchanb))) {
if (ast_waitstream(tmpchanb, "") < 0)
ast_log(LOG_WARNING, "Failed to play a courtesy tone on chan %s\n", ast_channel_name(tmpchanb));
}
@@ -7559,7 +7559,7 @@ static int bridge_exec(struct ast_channel *chan, const char *data)
/* try to allocate a place holder where current_dest_chan will be placed */
if (!(final_dest_chan = ast_channel_alloc(0, AST_STATE_DOWN, NULL, NULL, NULL,
- NULL, NULL, current_dest_chan->linkedid, 0, "Bridge/%s", ast_channel_name(current_dest_chan)))) {
+ NULL, NULL, ast_channel_linkedid(current_dest_chan), 0, "Bridge/%s", ast_channel_name(current_dest_chan)))) {
ast_log(LOG_WARNING, "Cannot create placeholder channel for chan %s\n", args.dest_chan);
ast_manager_event(chan, EVENT_FLAG_CALL, "BridgeExec",
"Response: Failed\r\n"
@@ -7596,7 +7596,7 @@ static int bridge_exec(struct ast_channel *chan, const char *data)
/* we have 2 valid channels to bridge, now it is just a matter of setting up the bridge config and starting the bridge */
if (ast_test_flag(&opts, BRIDGE_OPT_PLAYTONE) && !ast_strlen_zero(xfersound)) {
- if (!ast_streamfile(final_dest_chan, xfersound, final_dest_chan->language)) {
+ if (!ast_streamfile(final_dest_chan, xfersound, ast_channel_language(final_dest_chan))) {
if (ast_waitstream(final_dest_chan, "") < 0)
ast_log(LOG_WARNING, "Failed to play courtesy tone on %s\n", ast_channel_name(final_dest_chan));
}
diff --git a/main/file.c b/main/file.c
index 8591637c8..ee2139c05 100644
--- a/main/file.c
+++ b/main/file.c
@@ -1425,7 +1425,7 @@ int ast_stream_and_wait(struct ast_channel *chan, const char *file, const char *
int res = 0;
if (!ast_strlen_zero(file)) {
ast_test_suite_event_notify("PLAYBACK", "Message: %s\r\nChannel: %s", file, ast_channel_name(chan));
- res = ast_streamfile(chan, file, chan->language);
+ res = ast_streamfile(chan, file, ast_channel_language(chan));
if (!res) {
res = ast_waitstream(chan, digits);
}
diff --git a/main/image.c b/main/image.c
index 3aa226653..0e956b0c9 100644
--- a/main/image.c
+++ b/main/image.c
@@ -158,7 +158,7 @@ int ast_send_image(struct ast_channel *chan, const char *filename)
struct ast_frame *f;
int res = -1;
if (chan->tech->send_image) {
- f = ast_read_image(filename, chan->language, NULL);
+ f = ast_read_image(filename, ast_channel_language(chan), NULL);
if (f) {
res = chan->tech->send_image(chan, f);
ast_frfree(f);
diff --git a/main/manager.c b/main/manager.c
index f7144adc9..4e3e72018 100644
--- a/main/manager.c
+++ b/main/manager.c
@@ -3322,7 +3322,7 @@ static int action_status(struct mansession *s, const struct message *m)
channels++;
if (c->_bridge) {
- snprintf(bridge, sizeof(bridge), "BridgedChannel: %s\r\nBridgedUniqueid: %s\r\n", ast_channel_name(c->_bridge), c->_bridge->uniqueid);
+ snprintf(bridge, sizeof(bridge), "BridgedChannel: %s\r\nBridgedUniqueid: %s\r\n", ast_channel_name(c->_bridge), ast_channel_uniqueid(c->_bridge));
} else {
bridge[0] = '\0';
}
@@ -3355,10 +3355,10 @@ static int action_status(struct mansession *s, const struct message *m)
S_COR(c->caller.id.name.valid, c->caller.id.name.str, "<unknown>"),
S_COR(c->connected.id.number.valid, c->connected.id.number.str, "<unknown>"),
S_COR(c->connected.id.name.valid, c->connected.id.name.str, "<unknown>"),
- c->accountcode,
+ ast_channel_accountcode(c),
c->_state,
ast_state2str(c->_state), c->context,
- c->exten, c->priority, (long)elapsed_seconds, bridge, c->uniqueid, ast_str_buffer(str), idText);
+ c->exten, c->priority, (long)elapsed_seconds, bridge, ast_channel_uniqueid(c), ast_str_buffer(str), idText);
} else {
astman_append(s,
"Event: Status\r\n"
@@ -3380,8 +3380,8 @@ static int action_status(struct mansession *s, const struct message *m)
S_COR(c->caller.id.name.valid, c->caller.id.name.str, "<unknown>"),
S_COR(c->connected.id.number.valid, c->connected.id.number.str, "<unknown>"),
S_COR(c->connected.id.name.valid, c->connected.id.name.str, "<unknown>"),
- c->accountcode,
- ast_state2str(c->_state), bridge, c->uniqueid,
+ ast_channel_accountcode(c),
+ ast_state2str(c->_state), bridge, ast_channel_uniqueid(c),
ast_str_buffer(str), idText);
}
@@ -3743,7 +3743,7 @@ static void *fast_originate(void *data)
"CallerIDName: %s\r\n",
in->idtext, ast_strlen_zero(in->idtext) ? "" : "\r\n", res ? "Failure" : "Success",
chan ? ast_channel_name(chan) : requested_channel, in->context, in->exten, reason,
- chan ? chan->uniqueid : "<null>",
+ chan ? ast_channel_uniqueid(chan) : "<null>",
S_OR(in->cid_num, "<unknown>"),
S_OR(in->cid_name, "<unknown>")
);
@@ -4592,13 +4592,13 @@ static int action_coreshowchannels(struct mansession *s, const struct message *m
"AccountCode: %s\r\n"
"BridgedChannel: %s\r\n"
"BridgedUniqueID: %s\r\n"
- "\r\n", idText, ast_channel_name(c), c->uniqueid, c->context, c->exten, c->priority, c->_state,
+ "\r\n", idText, ast_channel_name(c), ast_channel_uniqueid(c), c->context, c->exten, c->priority, c->_state,
ast_state2str(c->_state), c->appl ? c->appl : "", c->data ? S_OR(c->data, "") : "",
S_COR(c->caller.id.number.valid, c->caller.id.number.str, ""),
S_COR(c->caller.id.name.valid, c->caller.id.name.str, ""),
S_COR(c->connected.id.number.valid, c->connected.id.number.str, ""),
S_COR(c->connected.id.name.valid, c->connected.id.name.str, ""),
- durbuf, S_OR(c->accountcode, ""), bc ? ast_channel_name(bc) : "", bc ? bc->uniqueid : "");
+ durbuf, S_OR(ast_channel_accountcode(c), ""), bc ? ast_channel_name(bc) : "", bc ? ast_channel_uniqueid(bc) : "");
ast_channel_unlock(c);
diff --git a/main/pbx.c b/main/pbx.c
index d2a18fb64..204eb8841 100644
--- a/main/pbx.c
+++ b/main/pbx.c
@@ -3319,7 +3319,7 @@ const char *ast_str_retrieve_variable(struct ast_str **str, ssize_t maxlen, stru
} else if (!strcmp(var, "CHANNEL")) {
s = ast_channel_name(c);
} else if (!strcmp(var, "UNIQUEID")) {
- s = c->uniqueid;
+ s = ast_channel_uniqueid(c);
} else if (!strcmp(var, "HANGUPCAUSE")) {
ast_str_set(str, maxlen, "%d", c->hangupcause);
s = ast_str_buffer(*str);
@@ -4386,7 +4386,7 @@ static int pbx_extension_helper(struct ast_channel *c, struct ast_context *con,
"Application: %s\r\n"
"AppData: %s\r\n"
"Uniqueid: %s\r\n",
- ast_channel_name(c), c->context, c->exten, c->priority, app->name, passdata, c->uniqueid);
+ ast_channel_name(c), c->context, c->exten, c->priority, app->name, passdata, ast_channel_uniqueid(c));
return pbx_exec(c, app, passdata); /* 0 on success, -1 on failure */
}
} else if (q.swo) { /* not found here, but in another switch */
@@ -8335,10 +8335,10 @@ int ast_async_goto(struct ast_channel *chan, const char *context, const char *ex
/* In order to do it when the channel doesn't really exist within
* the PBX, we have to make a new channel, masquerade, and start the PBX
* at the new location */
- tmpvars.accountcode = ast_strdupa(chan->accountcode);
+ tmpvars.accountcode = ast_strdupa(ast_channel_accountcode(chan));
tmpvars.exten = ast_strdupa(chan->exten);
tmpvars.context = ast_strdupa(chan->context);
- tmpvars.linkedid = ast_strdupa(chan->linkedid);
+ tmpvars.linkedid = ast_strdupa(ast_channel_linkedid(chan));
tmpvars.name = ast_strdupa(ast_channel_name(chan));
tmpvars.amaflags = chan->amaflags;
tmpvars.state = chan->_state;
@@ -9899,7 +9899,7 @@ static int pbx_builtin_background(struct ast_channel *chan, const char *data)
AST_STANDARD_APP_ARGS(args, parse);
if (ast_strlen_zero(args.lang))
- args.lang = (char *)chan->language; /* XXX this is const */
+ args.lang = (char *)ast_channel_language(chan); /* XXX this is const */
if (ast_strlen_zero(args.context)) {
const char *context;
@@ -10151,7 +10151,7 @@ int pbx_builtin_setvar_helper(struct ast_channel *chan, const char *name, const
"Value: %s\r\n"
"Uniqueid: %s\r\n",
chan ? ast_channel_name(chan) : "none", name, value,
- chan ? chan->uniqueid : "none");
+ chan ? ast_channel_uniqueid(chan) : "none");
}
if (chan)
@@ -10336,7 +10336,7 @@ static int pbx_builtin_saynumber(struct ast_channel *chan, const char *data)
}
}
- if (ast_say_number(chan, atoi(tmp), "", chan->language, options)) {
+ if (ast_say_number(chan, atoi(tmp), "", ast_channel_language(chan), options)) {
ast_log(LOG_WARNING, "We were unable to say the number %s, is it too large?\n", tmp);
}
@@ -10348,7 +10348,7 @@ static int pbx_builtin_saydigits(struct ast_channel *chan, const char *data)
int res = 0;
if (data)
- res = ast_say_digit_str(chan, data, "", chan->language);
+ res = ast_say_digit_str(chan, data, "", ast_channel_language(chan));
return res;
}
@@ -10357,7 +10357,7 @@ static int pbx_builtin_saycharacters(struct ast_channel *chan, const char *data)
int res = 0;
if (data)
- res = ast_say_character_str(chan, data, "", chan->language);
+ res = ast_say_character_str(chan, data, "", ast_channel_language(chan));
return res;
}
@@ -10366,7 +10366,7 @@ static int pbx_builtin_sayphonetic(struct ast_channel *chan, const char *data)
int res = 0;
if (data)
- res = ast_say_phonetic_str(chan, data, "", chan->language);
+ res = ast_say_phonetic_str(chan, data, "", ast_channel_language(chan));
return res;
}
diff --git a/main/say.c b/main/say.c
index dbeb8ba9c..1397cab36 100644
--- a/main/say.c
+++ b/main/say.c
@@ -7295,7 +7295,7 @@ static int ast_say_number_full_gr(struct ast_channel *chan, int num, const char
if (!num) {
ast_copy_string(fn, "digits/0", sizeof(fn));
- res = ast_streamfile(chan, fn, chan->language);
+ res = ast_streamfile(chan, fn, ast_channel_language(chan));
if (!res)
return ast_waitstream(chan, ints);
}
@@ -7323,14 +7323,14 @@ static int ast_say_number_full_gr(struct ast_channel *chan, int num, const char
} else {
/* num > 1000 */
if (num < 1000000) {
- res = ast_say_number_full_gr(chan, (num / 1000), ints, chan->language, audiofd, ctrlfd);
+ res = ast_say_number_full_gr(chan, (num / 1000), ints, ast_channel_language(chan), audiofd, ctrlfd);
if (res)
return res;
num %= 1000;
snprintf(fn, sizeof(fn), "digits/thousands");
} else {
if (num < 1000000000) { /* 1,000,000,000 */
- res = ast_say_number_full_gr(chan, (num / 1000000), ints, chan->language, audiofd, ctrlfd);
+ res = ast_say_number_full_gr(chan, (num / 1000000), ints, ast_channel_language(chan), audiofd, ctrlfd);
if (res)
return res;
num %= 1000000;
@@ -7538,7 +7538,7 @@ static int ast_say_date_with_format_gr(struct ast_channel *chan, time_t t, const
case 'Y':
/* Year */
- ast_say_number_full_gr(chan, 1900+tm.tm_year, ints, chan->language, -1, -1);
+ ast_say_number_full_gr(chan, 1900+tm.tm_year, ints, ast_channel_language(chan), -1, -1);
break;
case 'I':
case 'l':
@@ -8296,11 +8296,11 @@ int ast_say_counted_noun(struct ast_channel *chan, int num, const char noun[])
char *temp;
int temp_len;
const char *ending;
- if (!strncasecmp(chan->language, "ru", 2)) { /* Russian */
+ if (!strncasecmp(ast_channel_language(chan), "ru", 2)) { /* Russian */
ending = counted_noun_ending_slavic(num);
- } else if (!strncasecmp(chan->language, "ua", 2)) { /* Ukrainian */
+ } else if (!strncasecmp(ast_channel_language(chan), "ua", 2)) { /* Ukrainian */
ending = counted_noun_ending_slavic(num);
- } else if (!strncasecmp(chan->language, "pl", 2)) { /* Polish */
+ } else if (!strncasecmp(ast_channel_language(chan), "pl", 2)) { /* Polish */
ending = counted_noun_ending_slavic(num);
} else { /* English and default */
ending = counted_noun_ending_en(num);
@@ -8338,11 +8338,11 @@ int ast_say_counted_adjective(struct ast_channel *chan, int num, const char adje
char *temp;
int temp_len;
const char *ending;
- if (!strncasecmp(chan->language, "ru", 2)) { /* Russian */
+ if (!strncasecmp(ast_channel_language(chan), "ru", 2)) { /* Russian */
ending = counted_adjective_ending_ru(num, gender);
- } else if (!strncasecmp(chan->language, "ua", 2)) { /* Ukrainian */
+ } else if (!strncasecmp(ast_channel_language(chan), "ua", 2)) { /* Ukrainian */
ending = counted_adjective_ending_ru(num, gender);
- } else if (!strncasecmp(chan->language, "pl", 2)) { /* Polish */
+ } else if (!strncasecmp(ast_channel_language(chan), "pl", 2)) { /* Polish */
ending = counted_adjective_ending_ru(num, gender);
} else { /* English and default */
ending = "";