diff options
author | Terry Wilson <twilson@digium.com> | 2012-02-29 16:52:47 +0000 |
---|---|---|
committer | Terry Wilson <twilson@digium.com> | 2012-02-29 16:52:47 +0000 |
commit | a9d607a35764d93790172cab1f630e14fb8e043c (patch) | |
tree | dadea55813cfc525898844c51eec824d468455cb /channels | |
parent | 0b988da21c1ec856b7b8bad2434bf93498d17cfd (diff) |
Opaquify ast_channel structs and lists
Review: https://reviewboard.asterisk.org/r/1773/
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@357542 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'channels')
-rw-r--r-- | channels/chan_agent.c | 10 | ||||
-rw-r--r-- | channels/chan_console.c | 4 | ||||
-rw-r--r-- | channels/chan_dahdi.c | 72 | ||||
-rw-r--r-- | channels/chan_gtalk.c | 6 | ||||
-rw-r--r-- | channels/chan_h323.c | 32 | ||||
-rw-r--r-- | channels/chan_iax2.c | 54 | ||||
-rw-r--r-- | channels/chan_jingle.c | 14 | ||||
-rw-r--r-- | channels/chan_local.c | 51 | ||||
-rw-r--r-- | channels/chan_mgcp.c | 26 | ||||
-rw-r--r-- | channels/chan_misdn.c | 156 | ||||
-rw-r--r-- | channels/chan_oss.c | 16 | ||||
-rw-r--r-- | channels/chan_phone.c | 14 | ||||
-rw-r--r-- | channels/chan_sip.c | 86 | ||||
-rw-r--r-- | channels/chan_skinny.c | 64 | ||||
-rw-r--r-- | channels/chan_unistim.c | 30 | ||||
-rw-r--r-- | channels/chan_usbradio.c | 6 | ||||
-rw-r--r-- | channels/chan_vpb.cc | 16 | ||||
-rw-r--r-- | channels/console_video.c | 8 | ||||
-rw-r--r-- | channels/sig_analog.c | 68 | ||||
-rw-r--r-- | channels/sig_pri.c | 68 | ||||
-rw-r--r-- | channels/sig_ss7.c | 8 |
21 files changed, 400 insertions, 409 deletions
diff --git a/channels/chan_agent.c b/channels/chan_agent.c index 9eb0b68f9..3c8073b81 100644 --- a/channels/chan_agent.c +++ b/channels/chan_agent.c @@ -1587,8 +1587,8 @@ static int action_agents(struct mansession *s, const struct message *m) if (p->chan) { loginChan = ast_strdupa(ast_channel_name(p->chan)); if (owner && owner->_bridge) { - talkingto = S_COR(p->chan->caller.id.number.valid, - p->chan->caller.id.number.str, "n/a"); + talkingto = S_COR(ast_channel_caller(p->chan)->id.number.valid, + ast_channel_caller(p->chan)->id.number.str, "n/a"); if ((bridge = ast_bridged_channel(owner))) { talkingtoChan = ast_strdupa(ast_channel_name(bridge)); } else { @@ -2282,12 +2282,12 @@ static int agentmonitoroutgoing_exec(struct ast_channel *chan, const char *data) if (strchr(data, 'c')) changeoutgoing = 1; } - if (chan->caller.id.number.valid - && !ast_strlen_zero(chan->caller.id.number.str)) { + if (ast_channel_caller(chan)->id.number.valid + && !ast_strlen_zero(ast_channel_caller(chan)->id.number.str)) { const char *tmp; char agentvar[AST_MAX_BUF]; snprintf(agentvar, sizeof(agentvar), "%s_%s", GETAGENTBYCALLERID, - chan->caller.id.number.str); + ast_channel_caller(chan)->id.number.str); if ((tmp = pbx_builtin_getvar_helper(NULL, agentvar))) { struct agent_pvt *p; ast_copy_string(agent, tmp, sizeof(agent)); diff --git a/channels/chan_console.c b/channels/chan_console.c index 02fca590c..2856bae06 100644 --- a/channels/chan_console.c +++ b/channels/chan_console.c @@ -561,8 +561,8 @@ static int console_call(struct ast_channel *c, const char *dest, int timeout) ast_verb(1, V_BEGIN "Call to device '%s' on console from '%s' <%s>" V_END, dest, - S_COR(c->caller.id.name.valid, c->caller.id.name.str, ""), - S_COR(c->caller.id.number.valid, c->caller.id.number.str, "")); + S_COR(ast_channel_caller(c)->id.name.valid, ast_channel_caller(c)->id.name.str, ""), + S_COR(ast_channel_caller(c)->id.number.valid, ast_channel_caller(c)->id.number.str, "")); console_pvt_lock(pvt); diff --git a/channels/chan_dahdi.c b/channels/chan_dahdi.c index 246742188..c160ae8f1 100644 --- a/channels/chan_dahdi.c +++ b/channels/chan_dahdi.c @@ -2097,7 +2097,7 @@ static void my_handle_dtmf(void *pvt, struct ast_channel *ast, enum analog_sub a ast_mutex_unlock(&p->lock); ast_channel_unlock(ast); if (ast_exists_extension(ast, target_context, "fax", 1, - S_COR(ast->caller.id.number.valid, ast->caller.id.number.str, NULL))) { + S_COR(ast_channel_caller(ast)->id.number.valid, ast_channel_caller(ast)->id.number.str, NULL))) { ast_channel_lock(ast); ast_mutex_lock(&p->lock); ast_verb(3, "Redirecting %s to fax extension\n", ast_channel_name(ast)); @@ -5486,7 +5486,7 @@ static int dahdi_call(struct ast_channel *ast, const char *rdest, int timeout) c = args.ext; if (!p->hidecallerid) { - l = ast->connected.id.number.valid ? ast->connected.id.number.str : NULL; + l = ast_channel_connected(ast)->id.number.valid ? ast_channel_connected(ast)->id.number.str : NULL; } else { l = NULL; } @@ -7860,7 +7860,7 @@ static void dahdi_handle_dtmf(struct ast_channel *ast, int idx, struct ast_frame ast_mutex_unlock(&p->lock); ast_channel_unlock(ast); if (ast_exists_extension(ast, target_context, "fax", 1, - S_COR(ast->caller.id.number.valid, ast->caller.id.number.str, NULL))) { + S_COR(ast_channel_caller(ast)->id.number.valid, ast_channel_caller(ast)->id.number.str, NULL))) { ast_channel_lock(ast); ast_mutex_lock(&p->lock); ast_verb(3, "Redirecting %s to fax extension\n", ast_channel_name(ast)); @@ -8541,14 +8541,14 @@ static struct ast_frame *dahdi_handle_event(struct ast_channel *ast) cid_num[0] = 0; cid_name[0] = 0; if (p->dahditrcallerid && p->owner) { - if (p->owner->caller.id.number.valid - && p->owner->caller.id.number.str) { - ast_copy_string(cid_num, p->owner->caller.id.number.str, + if (ast_channel_caller(p->owner)->id.number.valid + && ast_channel_caller(p->owner)->id.number.str) { + ast_copy_string(cid_num, ast_channel_caller(p->owner)->id.number.str, sizeof(cid_num)); } - if (p->owner->caller.id.name.valid - && p->owner->caller.id.name.str) { - ast_copy_string(cid_name, p->owner->caller.id.name.str, + if (ast_channel_caller(p->owner)->id.name.valid + && ast_channel_caller(p->owner)->id.name.str) { + ast_copy_string(cid_name, ast_channel_caller(p->owner)->id.name.str, sizeof(cid_name)); } } @@ -8668,13 +8668,13 @@ winkflashdone: case SIG_FEATDMF_TA: switch (p->whichwink) { case 0: - ast_debug(1, "ANI2 set to '%d' and ANI is '%s'\n", p->owner->caller.ani2, - S_COR(p->owner->caller.ani.number.valid, - p->owner->caller.ani.number.str, "")); + ast_debug(1, "ANI2 set to '%d' and ANI is '%s'\n", ast_channel_caller(p->owner)->ani2, + S_COR(ast_channel_caller(p->owner)->ani.number.valid, + ast_channel_caller(p->owner)->ani.number.str, "")); snprintf(p->dop.dialstr, sizeof(p->dop.dialstr), "M*%d%s#", - p->owner->caller.ani2, - S_COR(p->owner->caller.ani.number.valid, - p->owner->caller.ani.number.str, "")); + ast_channel_caller(p->owner)->ani2, + S_COR(ast_channel_caller(p->owner)->ani.number.valid, + ast_channel_caller(p->owner)->ani.number.str, "")); break; case 1: ast_copy_string(p->dop.dialstr, p->finaldial, sizeof(p->dop.dialstr)); @@ -9762,34 +9762,34 @@ static struct ast_channel *dahdi_new(struct dahdi_pvt *i, int state, int startpb if (!ast_strlen_zero(i->exten)) ast_channel_exten_set(tmp, i->exten); if (!ast_strlen_zero(i->rdnis)) { - tmp->redirecting.from.number.valid = 1; - tmp->redirecting.from.number.str = ast_strdup(i->rdnis); + ast_channel_redirecting(tmp)->from.number.valid = 1; + ast_channel_redirecting(tmp)->from.number.str = ast_strdup(i->rdnis); } if (!ast_strlen_zero(i->dnid)) { - tmp->dialed.number.str = ast_strdup(i->dnid); + ast_channel_dialed(tmp)->number.str = ast_strdup(i->dnid); } /* Don't use ast_set_callerid() here because it will * generate a needless NewCallerID event */ #if defined(HAVE_PRI) || defined(HAVE_SS7) if (!ast_strlen_zero(i->cid_ani)) { - tmp->caller.ani.number.valid = 1; - tmp->caller.ani.number.str = ast_strdup(i->cid_ani); + ast_channel_caller(tmp)->ani.number.valid = 1; + ast_channel_caller(tmp)->ani.number.str = ast_strdup(i->cid_ani); } else if (!ast_strlen_zero(i->cid_num)) { - tmp->caller.ani.number.valid = 1; - tmp->caller.ani.number.str = ast_strdup(i->cid_num); + ast_channel_caller(tmp)->ani.number.valid = 1; + ast_channel_caller(tmp)->ani.number.str = ast_strdup(i->cid_num); } #else if (!ast_strlen_zero(i->cid_num)) { - tmp->caller.ani.number.valid = 1; - tmp->caller.ani.number.str = ast_strdup(i->cid_num); + ast_channel_caller(tmp)->ani.number.valid = 1; + ast_channel_caller(tmp)->ani.number.str = ast_strdup(i->cid_num); } #endif /* defined(HAVE_PRI) || defined(HAVE_SS7) */ - tmp->caller.id.name.presentation = i->callingpres; - tmp->caller.id.number.presentation = i->callingpres; - tmp->caller.id.number.plan = i->cid_ton; - tmp->caller.ani2 = i->cid_ani2; - tmp->caller.id.tag = ast_strdup(i->cid_tag); + ast_channel_caller(tmp)->id.name.presentation = i->callingpres; + ast_channel_caller(tmp)->id.number.presentation = i->callingpres; + ast_channel_caller(tmp)->id.number.plan = i->cid_ton; + ast_channel_caller(tmp)->ani2 = i->cid_ani2; + ast_channel_caller(tmp)->id.tag = ast_strdup(i->cid_tag); /* clear the fake event in case we posted one before we had ast_channel */ i->fake_event = 0; /* Assure there is no confmute on this channel */ @@ -10217,7 +10217,7 @@ static void *analog_ss_thread(void *data) } if (ast_exists_extension(chan, ast_channel_context(chan), exten, 1, - S_COR(chan->caller.id.number.valid, chan->caller.id.number.str, NULL))) { + S_COR(ast_channel_caller(chan)->id.number.valid, ast_channel_caller(chan)->id.number.str, NULL))) { ast_channel_exten_set(chan, exten); if (p->dsp) ast_dsp_digitreset(p->dsp); res = ast_pbx_run(chan); @@ -10368,10 +10368,10 @@ static void *analog_ss_thread(void *data) ast_verb(3, "Disabling Caller*ID on %s\n", ast_channel_name(chan)); /* Disable Caller*ID if enabled */ p->hidecallerid = 1; - ast_party_number_free(&chan->caller.id.number); - ast_party_number_init(&chan->caller.id.number); - ast_party_name_free(&chan->caller.id.name); - ast_party_name_init(&chan->caller.id.name); + ast_party_number_free(&ast_channel_caller(chan)->id.number); + ast_party_number_init(&ast_channel_caller(chan)->id.number); + ast_party_name_free(&ast_channel_caller(chan)->id.name); + ast_party_name_init(&ast_channel_caller(chan)->id.name); res = tone_zone_play_tone(p->subs[idx].dfd, DAHDI_TONE_DIALRECALL); if (res) { ast_log(LOG_WARNING, "Unable to do dial recall on channel %s: %s\n", @@ -10468,10 +10468,10 @@ static void *analog_ss_thread(void *data) goto quit; } } else if (!ast_canmatch_extension(chan, ast_channel_context(chan), exten, 1, - S_COR(chan->caller.id.number.valid, chan->caller.id.number.str, NULL)) + S_COR(ast_channel_caller(chan)->id.number.valid, ast_channel_caller(chan)->id.number.str, NULL)) && !canmatch_featurecode(exten)) { ast_debug(1, "Can't match %s from '%s' in context %s\n", exten, - S_COR(chan->caller.id.number.valid, chan->caller.id.number.str, "<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; } diff --git a/channels/chan_gtalk.c b/channels/chan_gtalk.c index 8db2369d2..1f967adb5 100644 --- a/channels/chan_gtalk.c +++ b/channels/chan_gtalk.c @@ -1178,8 +1178,8 @@ static struct ast_channel *gtalk_new(struct gtalk *client, struct gtalk_pvt *i, tmp->callgroup = client->callgroup; tmp->pickupgroup = client->pickupgroup; - tmp->caller.id.name.presentation = client->callingpres; - tmp->caller.id.number.presentation = client->callingpres; + ast_channel_caller(tmp)->id.name.presentation = client->callingpres; + ast_channel_caller(tmp)->id.number.presentation = client->callingpres; if (!ast_strlen_zero(client->accountcode)) ast_channel_accountcode_set(tmp, client->accountcode); if (client->amaflags) @@ -1196,7 +1196,7 @@ static struct ast_channel *gtalk_new(struct gtalk *client, struct gtalk_pvt *i, ast_channel_exten_set(tmp, i->exten); if (!ast_strlen_zero(i->exten) && strcmp(i->exten, "s")) { - tmp->dialed.number.str = ast_strdup(i->exten); + ast_channel_dialed(tmp)->number.str = ast_strdup(i->exten); } ast_channel_priority_set(tmp, 1); if (i->rtp) diff --git a/channels/chan_h323.c b/channels/chan_h323.c index 7da2e9295..49a5e2029 100644 --- a/channels/chan_h323.c +++ b/channels/chan_h323.c @@ -620,20 +620,20 @@ static int oh323_call(struct ast_channel *c, const char *dest, int timeout) /* make sure null terminated */ called_addr[sizeof(called_addr) - 1] = '\0'; - if (c->connected.id.number.valid && c->connected.id.number.str) { - ast_copy_string(pvt->options.cid_num, c->connected.id.number.str, sizeof(pvt->options.cid_num)); + if (ast_channel_connected(c)->id.number.valid && ast_channel_connected(c)->id.number.str) { + ast_copy_string(pvt->options.cid_num, ast_channel_connected(c)->id.number.str, sizeof(pvt->options.cid_num)); } - if (c->connected.id.name.valid && c->connected.id.name.str) { - ast_copy_string(pvt->options.cid_name, c->connected.id.name.str, sizeof(pvt->options.cid_name)); + if (ast_channel_connected(c)->id.name.valid && ast_channel_connected(c)->id.name.str) { + ast_copy_string(pvt->options.cid_name, ast_channel_connected(c)->id.name.str, sizeof(pvt->options.cid_name)); } - if (c->redirecting.from.number.valid && c->redirecting.from.number.str) { - ast_copy_string(pvt->options.cid_rdnis, c->redirecting.from.number.str, sizeof(pvt->options.cid_rdnis)); + if (ast_channel_redirecting(c)->from.number.valid && ast_channel_redirecting(c)->from.number.str) { + ast_copy_string(pvt->options.cid_rdnis, ast_channel_redirecting(c)->from.number.str, sizeof(pvt->options.cid_rdnis)); } - pvt->options.presentation = ast_party_id_presentation(&c->connected.id); - pvt->options.type_of_number = c->connected.id.number.plan; + pvt->options.presentation = ast_party_id_presentation(&ast_channel_connected(c)->id); + pvt->options.type_of_number = ast_channel_connected(c)->id.number.plan; if ((addr = pbx_builtin_getvar_helper(c, "PRIREDIRECTREASON"))) { if (!strcasecmp(addr, "UNKNOWN")) @@ -1107,21 +1107,21 @@ static struct ast_channel *__oh323_new(struct oh323_pvt *pvt, int state, const c /* Don't use ast_set_callerid() here because it will * generate a needless NewCallerID event */ if (!ast_strlen_zero(cid_num)) { - ch->caller.ani.number.valid = 1; - ch->caller.ani.number.str = ast_strdup(cid_num); + ast_channel_caller(ch)->ani.number.valid = 1; + ast_channel_caller(ch)->ani.number.str = ast_strdup(cid_num); } if (pvt->cd.redirect_reason >= 0) { - ch->redirecting.from.number.valid = 1; - ch->redirecting.from.number.str = ast_strdup(pvt->cd.redirect_number); + ast_channel_redirecting(ch)->from.number.valid = 1; + ast_channel_redirecting(ch)->from.number.str = ast_strdup(pvt->cd.redirect_number); pbx_builtin_setvar_helper(ch, "PRIREDIRECTREASON", redirectingreason2str(pvt->cd.redirect_reason)); } - ch->caller.id.name.presentation = pvt->cd.presentation; - ch->caller.id.number.presentation = pvt->cd.presentation; - ch->caller.id.number.plan = pvt->cd.type_of_number; + ast_channel_caller(ch)->id.name.presentation = pvt->cd.presentation; + ast_channel_caller(ch)->id.number.presentation = pvt->cd.presentation; + ast_channel_caller(ch)->id.number.plan = pvt->cd.type_of_number; if (!ast_strlen_zero(pvt->exten) && strcmp(pvt->exten, "s")) { - ch->dialed.number.str = ast_strdup(pvt->exten); + ast_channel_dialed(ch)->number.str = ast_strdup(pvt->exten); } if (pvt->cd.transfer_capability >= 0) ast_channel_transfercapability_set(ch, pvt->cd.transfer_capability); diff --git a/channels/chan_iax2.c b/channels/chan_iax2.c index fab2752c7..b0b041645 100644 --- a/channels/chan_iax2.c +++ b/channels/chan_iax2.c @@ -5078,8 +5078,8 @@ static int iax2_call(struct ast_channel *c, const char *dest, int timeout) if (pds.port) sin.sin_port = htons(atoi(pds.port)); - l = c->connected.id.number.valid ? c->connected.id.number.str : NULL; - n = c->connected.id.name.valid ? c->connected.id.name.str : NULL; + l = ast_channel_connected(c)->id.number.valid ? ast_channel_connected(c)->id.number.str : NULL; + n = ast_channel_connected(c)->id.name.valid ? ast_channel_connected(c)->id.name.str : NULL; /* Now build request */ memset(&ied, 0, sizeof(ied)); @@ -5098,33 +5098,33 @@ static int iax2_call(struct ast_channel *c, const char *dest, int timeout) if (l) { iax_ie_append_str(&ied, IAX_IE_CALLING_NUMBER, l); iax_ie_append_byte(&ied, IAX_IE_CALLINGPRES, - ast_party_id_presentation(&c->connected.id)); + ast_party_id_presentation(&ast_channel_connected(c)->id)); } else if (n) { iax_ie_append_byte(&ied, IAX_IE_CALLINGPRES, - ast_party_id_presentation(&c->connected.id)); + ast_party_id_presentation(&ast_channel_connected(c)->id)); } else { iax_ie_append_byte(&ied, IAX_IE_CALLINGPRES, AST_PRES_NUMBER_NOT_AVAILABLE); } - iax_ie_append_byte(&ied, IAX_IE_CALLINGTON, c->connected.id.number.plan); - iax_ie_append_short(&ied, IAX_IE_CALLINGTNS, c->dialed.transit_network_select); + iax_ie_append_byte(&ied, IAX_IE_CALLINGTON, ast_channel_connected(c)->id.number.plan); + iax_ie_append_short(&ied, IAX_IE_CALLINGTNS, ast_channel_dialed(c)->transit_network_select); if (n) iax_ie_append_str(&ied, IAX_IE_CALLING_NAME, n); if (ast_test_flag64(iaxs[callno], IAX_SENDANI) - && c->connected.ani.number.valid - && c->connected.ani.number.str) { - iax_ie_append_str(&ied, IAX_IE_CALLING_ANI, c->connected.ani.number.str); + && ast_channel_connected(c)->ani.number.valid + && ast_channel_connected(c)->ani.number.str) { + iax_ie_append_str(&ied, IAX_IE_CALLING_ANI, ast_channel_connected(c)->ani.number.str); } if (!ast_strlen_zero(ast_channel_language(c))) iax_ie_append_str(&ied, IAX_IE_LANGUAGE, ast_channel_language(c)); - if (!ast_strlen_zero(c->dialed.number.str)) { - iax_ie_append_str(&ied, IAX_IE_DNID, c->dialed.number.str); + if (!ast_strlen_zero(ast_channel_dialed(c)->number.str)) { + iax_ie_append_str(&ied, IAX_IE_DNID, ast_channel_dialed(c)->number.str); } - if (c->redirecting.from.number.valid - && !ast_strlen_zero(c->redirecting.from.number.str)) { - iax_ie_append_str(&ied, IAX_IE_RDNIS, c->redirecting.from.number.str); + if (ast_channel_redirecting(c)->from.number.valid + && !ast_strlen_zero(ast_channel_redirecting(c)->from.number.str)) { + iax_ie_append_str(&ied, IAX_IE_RDNIS, ast_channel_redirecting(c)->from.number.str); } if (pds.context) @@ -5768,21 +5768,21 @@ static struct ast_channel *ast_iax2_new(int callno, int state, iax2_format capab /* Don't use ast_set_callerid() here because it will * generate a NewCallerID event before the NewChannel event */ if (!ast_strlen_zero(i->ani)) { - tmp->caller.ani.number.valid = 1; - tmp->caller.ani.number.str = ast_strdup(i->ani); + ast_channel_caller(tmp)->ani.number.valid = 1; + ast_channel_caller(tmp)->ani.number.str = ast_strdup(i->ani); } else if (!ast_strlen_zero(i->cid_num)) { - tmp->caller.ani.number.valid = 1; - tmp->caller.ani.number.str = ast_strdup(i->cid_num); + ast_channel_caller(tmp)->ani.number.valid = 1; + ast_channel_caller(tmp)->ani.number.str = ast_strdup(i->cid_num); } - tmp->dialed.number.str = ast_strdup(i->dnid); + ast_channel_dialed(tmp)->number.str = ast_strdup(i->dnid); if (!ast_strlen_zero(i->rdnis)) { - tmp->redirecting.from.number.valid = 1; - tmp->redirecting.from.number.str = ast_strdup(i->rdnis); + ast_channel_redirecting(tmp)->from.number.valid = 1; + ast_channel_redirecting(tmp)->from.number.str = ast_strdup(i->rdnis); } - tmp->caller.id.name.presentation = i->calling_pres; - tmp->caller.id.number.presentation = i->calling_pres; - tmp->caller.id.number.plan = i->calling_ton; - tmp->dialed.transit_network_select = i->calling_tns; + ast_channel_caller(tmp)->id.name.presentation = i->calling_pres; + ast_channel_caller(tmp)->id.number.presentation = i->calling_pres; + ast_channel_caller(tmp)->id.number.plan = i->calling_ton; + ast_channel_dialed(tmp)->transit_network_select = i->calling_tns; if (!ast_strlen_zero(i->language)) ast_channel_language_set(tmp, i->language); if (!ast_strlen_zero(i->accountcode)) @@ -11597,8 +11597,8 @@ immediatedial: S_COR(connected.id.number.valid, connected.id.number.str, ""), S_COR(connected.id.name.valid, connected.id.name.str, ""), NULL); - iaxs[fr->callno]->owner->caller.id.number.presentation = connected.id.number.presentation; - iaxs[fr->callno]->owner->caller.id.name.presentation = connected.id.name.presentation; + ast_channel_caller(iaxs[fr->callno]->owner)->id.number.presentation = connected.id.number.presentation; + ast_channel_caller(iaxs[fr->callno]->owner)->id.name.presentation = connected.id.name.presentation; } } ast_party_connected_line_free(&connected); diff --git a/channels/chan_jingle.c b/channels/chan_jingle.c index 7156e9443..8a1bfdc1a 100644 --- a/channels/chan_jingle.c +++ b/channels/chan_jingle.c @@ -890,8 +890,8 @@ static struct ast_channel *jingle_new(struct jingle *client, struct jingle_pvt * tmp->callgroup = client->callgroup; tmp->pickupgroup = client->pickupgroup; - tmp->caller.id.name.presentation = client->callingpres; - tmp->caller.id.number.presentation = client->callingpres; + ast_channel_caller(tmp)->id.name.presentation = client->callingpres; + ast_channel_caller(tmp)->id.number.presentation = client->callingpres; if (!ast_strlen_zero(client->accountcode)) ast_channel_accountcode_set(tmp, client->accountcode); if (client->amaflags) @@ -906,11 +906,11 @@ static struct ast_channel *jingle_new(struct jingle *client, struct jingle_pvt * /* Don't use ast_set_callerid() here because it will * generate an unnecessary NewCallerID event */ if (!ast_strlen_zero(i->cid_num)) { - tmp->caller.ani.number.valid = 1; - tmp->caller.ani.number.str = ast_strdup(i->cid_num); + ast_channel_caller(tmp)->ani.number.valid = 1; + ast_channel_caller(tmp)->ani.number.str = ast_strdup(i->cid_num); } if (!ast_strlen_zero(i->exten) && strcmp(i->exten, "s")) { - tmp->dialed.number.str = ast_strdup(i->exten); + ast_channel_dialed(tmp)->number.str = ast_strdup(i->exten); } ast_channel_priority_set(tmp, 1); if (i->rtp) @@ -1390,9 +1390,9 @@ static int jingle_digit(struct ast_channel *ast, char digit, unsigned int durati iks_insert_node(jingle, dtmf); ast_mutex_lock(&p->lock); - if (ast->dtmff.frametype == AST_FRAME_DTMF_BEGIN || duration == 0) { + if (ast_channel_dtmff(ast)->frametype == AST_FRAME_DTMF_BEGIN || duration == 0) { iks_insert_attrib(dtmf, "action", "button-down"); - } else if (ast->dtmff.frametype == AST_FRAME_DTMF_END || duration != 0) { + } else if (ast_channel_dtmff(ast)->frametype == AST_FRAME_DTMF_END || duration != 0) { iks_insert_attrib(dtmf, "action", "button-up"); } ast_aji_send(client->connection, iq); diff --git a/channels/chan_local.c b/channels/chan_local.c index 550625656..c6780d223 100644 --- a/channels/chan_local.c +++ b/channels/chan_local.c @@ -511,7 +511,7 @@ static void check_bridge(struct local_pvt *p) frames on the owner channel (because they would be transferred to the outbound channel during the masquerade) */ - if (p->chan->_bridge /* Not ast_bridged_channel! Only go one step! */ && AST_LIST_EMPTY(&p->owner->readq)) { + if (p->chan->_bridge /* Not ast_bridged_channel! Only go one step! */ && AST_LIST_EMPTY(ast_channel_readq(p->owner))) { /* Masquerade bridged channel into owner */ /* Lock everything we need, one by one, and give up if we can't get everything. Remember, we'll get another @@ -544,27 +544,18 @@ static void check_bridge(struct local_pvt *p) * thread (which is the to be masqueraded away local channel) before both local * channels are optimized away. */ - if (p->owner->caller.id.name.valid || p->owner->caller.id.number.valid - || p->owner->caller.id.subaddress.valid || p->owner->caller.ani.name.valid - || p->owner->caller.ani.number.valid || p->owner->caller.ani.subaddress.valid) { - struct ast_party_caller tmp; - tmp = p->owner->caller; - p->owner->caller = p->chan->_bridge->caller; - p->chan->_bridge->caller = tmp; + if (ast_channel_caller(p->owner)->id.name.valid || ast_channel_caller(p->owner)->id.number.valid + || ast_channel_caller(p->owner)->id.subaddress.valid || ast_channel_caller(p->owner)->ani.name.valid + || ast_channel_caller(p->owner)->ani.number.valid || ast_channel_caller(p->owner)->ani.subaddress.valid) { + SWAP(*ast_channel_caller(p->owner), *ast_channel_caller(p->chan->_bridge)); } - if (p->owner->redirecting.from.name.valid || p->owner->redirecting.from.number.valid - || p->owner->redirecting.from.subaddress.valid || p->owner->redirecting.to.name.valid - || p->owner->redirecting.to.number.valid || p->owner->redirecting.to.subaddress.valid) { - struct ast_party_redirecting tmp; - tmp = p->owner->redirecting; - p->owner->redirecting = p->chan->_bridge->redirecting; - p->chan->_bridge->redirecting = tmp; + if (ast_channel_redirecting(p->owner)->from.name.valid || ast_channel_redirecting(p->owner)->from.number.valid + || ast_channel_redirecting(p->owner)->from.subaddress.valid || ast_channel_redirecting(p->owner)->to.name.valid + || ast_channel_redirecting(p->owner)->to.number.valid || ast_channel_redirecting(p->owner)->to.subaddress.valid) { + SWAP(*ast_channel_redirecting(p->owner), *ast_channel_redirecting(p->chan->_bridge)); } - if (p->owner->dialed.number.str || p->owner->dialed.subaddress.valid) { - struct ast_party_dialed tmp; - tmp = p->owner->dialed; - p->owner->dialed = p->chan->_bridge->dialed; - p->chan->_bridge->dialed = tmp; + if (ast_channel_dialed(p->owner)->number.str || ast_channel_dialed(p->owner)->subaddress.valid) { + SWAP(*ast_channel_dialed(p->owner), *ast_channel_dialed(p->chan->_bridge)); } @@ -690,11 +681,11 @@ static int local_indicate(struct ast_channel *ast, int condition, const void *da unsigned char frame_data[1024]; if (condition == AST_CONTROL_CONNECTED_LINE) { if (isoutbound) { - ast_connected_line_copy_to_caller(&the_other_channel->caller, &this_channel->connected); + ast_connected_line_copy_to_caller(ast_channel_caller(the_other_channel), ast_channel_connected(this_channel)); } - f.datalen = ast_connected_line_build_data(frame_data, sizeof(frame_data), &this_channel->connected, NULL); + f.datalen = ast_connected_line_build_data(frame_data, sizeof(frame_data), ast_channel_connected(this_channel), NULL); } else { - f.datalen = ast_redirecting_build_data(frame_data, sizeof(frame_data), &this_channel->redirecting, NULL); + f.datalen = ast_redirecting_build_data(frame_data, sizeof(frame_data), ast_channel_redirecting(this_channel), NULL); } f.subclass.integer = condition; f.data.ptr = frame_data; @@ -853,12 +844,12 @@ static int local_call(struct ast_channel *ast, const char *dest, int timeout) * All these failure points just return -1. The individual strings will * be cleared when we destroy the channel. */ - ast_party_redirecting_copy(&chan->redirecting, &owner->redirecting); + ast_party_redirecting_copy(ast_channel_redirecting(chan), ast_channel_redirecting(owner)); - ast_party_dialed_copy(&chan->dialed, &owner->dialed); + ast_party_dialed_copy(ast_channel_dialed(chan), ast_channel_dialed(owner)); - ast_connected_line_copy_to_caller(&chan->caller, &owner->connected); - ast_connected_line_copy_from_caller(&chan->connected, &owner->caller); + ast_connected_line_copy_to_caller(ast_channel_caller(chan), ast_channel_connected(owner)); + ast_connected_line_copy_from_caller(ast_channel_connected(chan), ast_channel_caller(owner)); ast_channel_language_set(chan, ast_channel_language(owner)); ast_channel_accountcode_set(chan, ast_channel_accountcode(owner)); @@ -874,13 +865,13 @@ static int local_call(struct ast_channel *ast, const char *dest, int timeout) /* copy the channel variables from the incoming channel to the outgoing channel */ /* Note that due to certain assumptions, they MUST be in the same order */ - AST_LIST_TRAVERSE(&owner->varshead, varptr, entries) { + AST_LIST_TRAVERSE(ast_channel_varshead(owner), varptr, entries) { namelen = strlen(varptr->name); len = sizeof(struct ast_var_t) + namelen + strlen(varptr->value) + 2; if ((new = ast_calloc(1, len))) { memcpy(new, varptr, len); new->value = &(new->name[0]) + namelen + 1; - AST_LIST_INSERT_TAIL(&chan->varshead, new, entries); + AST_LIST_INSERT_TAIL(ast_channel_varshead(chan), new, entries); } } ast_channel_datastore_inherit(owner, chan); @@ -902,7 +893,7 @@ static int local_call(struct ast_channel *ast, const char *dest, int timeout) ast_channel_unlock(chan); if (!ast_exists_extension(chan, context, exten, 1, - S_COR(owner->caller.id.number.valid, owner->caller.id.number.str, NULL))) { + S_COR(ast_channel_caller(owner)->id.number.valid, ast_channel_caller(owner)->id.number.str, NULL))) { ast_log(LOG_NOTICE, "No such extension/context %s@%s while calling Local channel\n", exten, context); res = -1; chan = ast_channel_unref(chan); /* we already unlocked it, so clear it hear so the cleanup label won't touch it. */ diff --git a/channels/chan_mgcp.c b/channels/chan_mgcp.c index 9a49d0018..be8ecbf39 100644 --- a/channels/chan_mgcp.c +++ b/channels/chan_mgcp.c @@ -845,7 +845,7 @@ static int mgcp_call(struct ast_channel *ast, const char *dest, int timeout) ast_debug(3, "MGCP mgcp_call(%s)\n", ast_channel_name(ast)); sub = ast_channel_tech_pvt(ast); p = sub->parent; - headp = &ast->varshead; + headp = ast_channel_varshead(ast); AST_LIST_TRAVERSE(headp,current,entries) { /* Check whether there is an ALERT_INFO variable */ if (strcasecmp(ast_var_name(current),"ALERT_INFO") == 0) { @@ -900,8 +900,8 @@ static int mgcp_call(struct ast_channel *ast, const char *dest, int timeout) } transmit_notify_request_with_callerid(sub, tone, - S_COR(ast->connected.id.number.valid, ast->connected.id.number.str, ""), - S_COR(ast->connected.id.name.valid, ast->connected.id.name.str, "")); + S_COR(ast_channel_connected(ast)->id.number.valid, ast_channel_connected(ast)->id.number.str, ""), + S_COR(ast_channel_connected(ast)->id.name.valid, ast_channel_connected(ast)->id.name.str, "")); ast_setstate(ast, AST_STATE_RINGING); if (sub->next->owner && !ast_strlen_zero(sub->next->cxident) && !ast_strlen_zero(sub->next->callid)) { @@ -973,8 +973,8 @@ static int mgcp_hangup(struct ast_channel *ast) /* ncs fix! */ bridged = ast_bridged_channel(sub->next->owner); transmit_notify_request_with_callerid(p->sub, (p->ncs ? "L/wt1" : "L/wt"), - S_COR(bridged->caller.id.number.valid, bridged->caller.id.number.str, ""), - S_COR(bridged->caller.id.name.valid, bridged->caller.id.name.str, "")); + S_COR(ast_channel_caller(bridged)->id.number.valid, ast_channel_caller(bridged)->id.number.str, ""), + S_COR(ast_channel_caller(bridged)->id.name.valid, ast_channel_caller(bridged)->id.name.str, "")); } } else { /* set our other connection as the primary and swith over to it */ @@ -984,8 +984,8 @@ static int mgcp_hangup(struct ast_channel *ast) if (sub->next->owner && ast_bridged_channel(sub->next->owner)) { bridged = ast_bridged_channel(sub->next->owner); transmit_notify_request_with_callerid(p->sub, "L/rg", - S_COR(bridged->caller.id.number.valid, bridged->caller.id.number.str, ""), - S_COR(bridged->caller.id.name.valid, bridged->caller.id.name.str, "")); + S_COR(ast_channel_caller(bridged)->id.number.valid, ast_channel_caller(bridged)->id.number.str, ""), + S_COR(ast_channel_caller(bridged)->id.name.valid, ast_channel_caller(bridged)->id.name.str, "")); } } @@ -1540,8 +1540,8 @@ static struct ast_channel *mgcp_new(struct mgcp_subchannel *sub, int state, cons /* Don't use ast_set_callerid() here because it will * generate a needless NewCallerID event */ if (!ast_strlen_zero(i->cid_num)) { - tmp->caller.ani.number.valid = 1; - tmp->caller.ani.number.str = ast_strdup(i->cid_num); + ast_channel_caller(tmp)->ani.number.valid = 1; + ast_channel_caller(tmp)->ani.number.str = ast_strdup(i->cid_num); } if (!i->adsi) { @@ -3022,12 +3022,12 @@ static void *mgcp_ss(void *data) /*res = tone_zone_play_tone(p->subs[index].zfd, -1);*/ ast_indicate(chan, -1); ast_channel_exten_set(chan, p->dtmf_buf); - chan->dialed.number.str = ast_strdup(p->dtmf_buf); + ast_channel_dialed(chan)->number.str = ast_strdup(p->dtmf_buf); memset(p->dtmf_buf, 0, sizeof(p->dtmf_buf)); ast_set_callerid(chan, p->hidecallerid ? "" : p->cid_num, p->hidecallerid ? "" : p->cid_name, - chan->caller.ani.number.valid ? NULL : p->cid_num); + ast_channel_caller(chan)->ani.number.valid ? NULL : p->cid_num); ast_setstate(chan, AST_STATE_RING); /*dahdi_enable_ec(p);*/ if (p->dtmfmode & MGCP_DTMF_HYBRID) { @@ -3157,10 +3157,10 @@ static void *mgcp_ss(void *data) memset(p->dtmf_buf, 0, sizeof(p->dtmf_buf)); timeout = firstdigittimeout; } else if (!ast_canmatch_extension(chan, ast_channel_context(chan), p->dtmf_buf, 1, - S_COR(chan->caller.id.number.valid, chan->caller.id.number.str, NULL)) + S_COR(ast_channel_caller(chan)->id.number.valid, ast_channel_caller(chan)->id.number.str, NULL)) && ((p->dtmf_buf[0] != '*') || (strlen(p->dtmf_buf) > 2))) { ast_debug(1, "Can't match %s from '%s' in context %s\n", p->dtmf_buf, - S_COR(chan->caller.id.number.valid, chan->caller.id.number.str, "<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; } diff --git a/channels/chan_misdn.c b/channels/chan_misdn.c index c7ca07b99..62aa020d2 100644 --- a/channels/chan_misdn.c +++ b/channels/chan_misdn.c @@ -4151,10 +4151,10 @@ static void print_bc_info(int fd, struct chan_list *help, struct misdn_bchannel bc->nt ? "NT" : "TE", help->originator == ORG_AST ? "*" : "I", ast ? ast_channel_exten(ast) : "", - (ast && ast->caller.id.name.valid && ast->caller.id.name.str) - ? ast->caller.id.name.str : "", - (ast && ast->caller.id.number.valid && ast->caller.id.number.str) - ? ast->caller.id.number.str : "", + (ast && ast_channel_caller(ast)->id.name.valid && ast_channel_caller(ast)->id.name.str) + ? ast_channel_caller(ast)->id.name.str : "", + (ast && ast_channel_caller(ast)->id.number.valid && ast_channel_caller(ast)->id.number.str) + ? ast_channel_caller(ast)->id.number.str : "", bc->redirecting.from.name, bc->redirecting.from.number, bc->redirecting.to.name, @@ -4253,15 +4253,15 @@ static char *handle_cli_misdn_show_channels(struct ast_cli_entry *e, int cmd, st " --> hold_channel: %d\n", help->l3id, ast_channel_exten(ast), - S_COR(ast->caller.id.name.valid, ast->caller.id.name.str, ""), - S_COR(ast->caller.id.number.valid, ast->caller.id.number.str, ""), + S_COR(ast_channel_caller(ast)->id.name.valid, ast_channel_caller(ast)->id.name.str, ""), + S_COR(ast_channel_caller(ast)->id.number.valid, ast_channel_caller(ast)->id.number.str, ""), help->hold.port, help->hold.channel ); } else { ast_cli(a->fd, "* Channel in unknown STATE !!! Exten:%s, Callerid:%s\n", ast_channel_exten(ast), - S_COR(ast->caller.id.number.valid, ast->caller.id.number.str, "")); + S_COR(ast_channel_caller(ast)->id.number.valid, ast_channel_caller(ast)->id.number.str, "")); } } } @@ -5772,12 +5772,12 @@ static void update_config(struct chan_list *ch) chan_misdn_log(2, port, " --> pres: %d screen: %d\n", pres, screen); if (pres < 0 || screen < 0) { - chan_misdn_log(2, port, " --> pres: %x\n", ast->connected.id.number.presentation); + chan_misdn_log(2, port, " --> pres: %x\n", ast_channel_connected(ast)->id.number.presentation); - bc->caller.presentation = ast_to_misdn_pres(ast->connected.id.number.presentation); + bc->caller.presentation = ast_to_misdn_pres(ast_channel_connected(ast)->id.number.presentation); chan_misdn_log(2, port, " --> PRES: %s(%d)\n", misdn_to_str_pres(bc->caller.presentation), bc->caller.presentation); - bc->caller.screening = ast_to_misdn_screen(ast->connected.id.number.presentation); + bc->caller.screening = ast_to_misdn_screen(ast_channel_connected(ast)->id.number.presentation); chan_misdn_log(2, port, " --> SCREEN: %s(%d)\n", misdn_to_str_screen(bc->caller.screening), bc->caller.screening); } else { bc->caller.screening = screen; @@ -6116,7 +6116,7 @@ static void misdn_update_caller_id(struct ast_channel *ast, const struct misdn_p update_caller.ani.number = 1; ast_channel_lock(ast); - ast_party_caller_set_init(&caller, &ast->caller); + ast_party_caller_set_init(&caller, ast_channel_caller(ast)); caller.id.number.valid = 1; caller.id.number.str = (char *) id->number; @@ -6169,15 +6169,15 @@ static void misdn_get_connected_line(struct ast_channel *ast, struct misdn_bchan /* ORIGINATOR MISDN (incoming call) */ ast_copy_string(bc->connected.name, - S_COR(ast->connected.id.name.valid, ast->connected.id.name.str, ""), + S_COR(ast_channel_connected(ast)->id.name.valid, ast_channel_connected(ast)->id.name.str, ""), sizeof(bc->connected.name)); - if (ast->connected.id.number.valid) { - ast_copy_string(bc->connected.number, S_OR(ast->connected.id.number.str, ""), + if (ast_channel_connected(ast)->id.number.valid) { + ast_copy_string(bc->connected.number, S_OR(ast_channel_connected(ast)->id.number.str, ""), sizeof(bc->connected.number)); - bc->connected.presentation = ast_to_misdn_pres(ast->connected.id.number.presentation); - bc->connected.screening = ast_to_misdn_screen(ast->connected.id.number.presentation); - bc->connected.number_type = ast_to_misdn_ton(ast->connected.id.number.plan); - bc->connected.number_plan = ast_to_misdn_plan(ast->connected.id.number.plan); + bc->connected.presentation = ast_to_misdn_pres(ast_channel_connected(ast)->id.number.presentation); + bc->connected.screening = ast_to_misdn_screen(ast_channel_connected(ast)->id.number.presentation); + bc->connected.number_type = ast_to_misdn_ton(ast_channel_connected(ast)->id.number.plan); + bc->connected.number_plan = ast_to_misdn_plan(ast_channel_connected(ast)->id.number.plan); } else { bc->connected.number[0] = '\0'; bc->connected.presentation = 0;/* Allowed */ @@ -6197,15 +6197,15 @@ static void misdn_get_connected_line(struct ast_channel *ast, struct misdn_bchan /* ORIGINATOR Asterisk (outgoing call) */ ast_copy_string(bc->caller.name, - S_COR(ast->connected.id.name.valid, ast->connected.id.name.str, ""), + S_COR(ast_channel_connected(ast)->id.name.valid, ast_channel_connected(ast)->id.name.str, ""), sizeof(bc->caller.name)); - if (ast->connected.id.number.valid) { - ast_copy_string(bc->caller.number, S_OR(ast->connected.id.number.str, ""), + if (ast_channel_connected(ast)->id.number.valid) { + ast_copy_string(bc->caller.number, S_OR(ast_channel_connected(ast)->id.number.str, ""), sizeof(bc->caller.number)); - bc->caller.presentation = ast_to_misdn_pres(ast->connected.id.number.presentation); - bc->caller.screening = ast_to_misdn_screen(ast->connected.id.number.presentation); - bc->caller.number_type = ast_to_misdn_ton(ast->connected.id.number.plan); - bc->caller.number_plan = ast_to_misdn_plan(ast->connected.id.number.plan); + bc->caller.presentation = ast_to_misdn_pres(ast_channel_connected(ast)->id.number.presentation); + bc->caller.screening = ast_to_misdn_screen(ast_channel_connected(ast)->id.number.presentation); + bc->caller.number_type = ast_to_misdn_ton(ast_channel_connected(ast)->id.number.plan); + bc->caller.number_plan = ast_to_misdn_plan(ast_channel_connected(ast)->id.number.plan); } else { bc->caller.number[0] = '\0'; bc->caller.presentation = 0;/* Allowed */ @@ -6319,15 +6319,15 @@ static void misdn_update_connected_line(struct ast_channel *ast, struct misdn_bc static void misdn_copy_redirecting_from_ast(struct misdn_bchannel *bc, struct ast_channel *ast) { ast_copy_string(bc->redirecting.from.name, - S_COR(ast->redirecting.from.name.valid, ast->redirecting.from.name.str, ""), + S_COR(ast_channel_redirecting(ast)->from.name.valid, ast_channel_redirecting(ast)->from.name.str, ""), sizeof(bc->redirecting.from.name)); - if (ast->redirecting.from.number.valid) { - ast_copy_string(bc->redirecting.from.number, S_OR(ast->redirecting.from.number.str, ""), + if (ast_channel_redirecting(ast)->from.number.valid) { + ast_copy_string(bc->redirecting.from.number, S_OR(ast_channel_redirecting(ast)->from.number.str, ""), sizeof(bc->redirecting.from.number)); - bc->redirecting.from.presentation = ast_to_misdn_pres(ast->redirecting.from.number.presentation); - bc->redirecting.from.screening = ast_to_misdn_screen(ast->redirecting.from.number.presentation); - bc->redirecting.from.number_type = ast_to_misdn_ton(ast->redirecting.from.number.plan); - bc->redirecting.from.number_plan = ast_to_misdn_plan(ast->redirecting.from.number.plan); + bc->redirecting.from.presentation = ast_to_misdn_pres(ast_channel_redirecting(ast)->from.number.presentation); + bc->redirecting.from.screening = ast_to_misdn_screen(ast_channel_redirecting(ast)->from.number.presentation); + bc->redirecting.from.number_type = ast_to_misdn_ton(ast_channel_redirecting(ast)->from.number.plan); + bc->redirecting.from.number_plan = ast_to_misdn_plan(ast_channel_redirecting(ast)->from.number.plan); } else { bc->redirecting.from.number[0] = '\0'; bc->redirecting.from.presentation = 0;/* Allowed */ @@ -6337,15 +6337,15 @@ static void misdn_copy_redirecting_from_ast(struct misdn_bchannel *bc, struct as } ast_copy_string(bc->redirecting.to.name, - S_COR(ast->redirecting.to.name.valid, ast->redirecting.to.name.str, ""), + S_COR(ast_channel_redirecting(ast)->to.name.valid, ast_channel_redirecting(ast)->to.name.str, ""), sizeof(bc->redirecting.to.name)); - if (ast->redirecting.to.number.valid) { - ast_copy_string(bc->redirecting.to.number, S_OR(ast->redirecting.to.number.str, ""), + if (ast_channel_redirecting(ast)->to.number.valid) { + ast_copy_string(bc->redirecting.to.number, S_OR(ast_channel_redirecting(ast)->to.number.str, ""), sizeof(bc->redirecting.to.number)); - bc->redirecting.to.presentation = ast_to_misdn_pres(ast->redirecting.to.number.presentation); - bc->redirecting.to.screening = ast_to_misdn_screen(ast->redirecting.to.number.presentation); - bc->redirecting.to.number_type = ast_to_misdn_ton(ast->redirecting.to.number.plan); - bc->redirecting.to.number_plan = ast_to_misdn_plan(ast->redirecting.to.number.plan); + bc->redirecting.to.presentation = ast_to_misdn_pres(ast_channel_redirecting(ast)->to.number.presentation); + bc->redirecting.to.screening = ast_to_misdn_screen(ast_channel_redirecting(ast)->to.number.presentation); + bc->redirecting.to.number_type = ast_to_misdn_ton(ast_channel_redirecting(ast)->to.number.plan); + bc->redirecting.to.number_plan = ast_to_misdn_plan(ast_channel_redirecting(ast)->to.number.plan); } else { bc->redirecting.to.number[0] = '\0'; bc->redirecting.to.presentation = 0;/* Allowed */ @@ -6354,8 +6354,8 @@ static void misdn_copy_redirecting_from_ast(struct misdn_bchannel *bc, struct as bc->redirecting.to.number_plan = NUMPLAN_UNKNOWN; } - bc->redirecting.reason = ast_to_misdn_reason(ast->redirecting.reason); - bc->redirecting.count = ast->redirecting.count; + bc->redirecting.reason = ast_to_misdn_reason(ast_channel_redirecting(ast)->reason); + bc->redirecting.count = ast_channel_redirecting(ast)->count; } /*! @@ -6373,7 +6373,7 @@ static void misdn_copy_redirecting_to_ast(struct ast_channel *ast, const struct struct ast_party_redirecting redirecting; struct ast_set_party_redirecting update_redirecting; - ast_party_redirecting_set_init(&redirecting, &ast->redirecting); + ast_party_redirecting_set_init(&redirecting, ast_channel_redirecting(ast)); memset(&update_redirecting, 0, sizeof(update_redirecting)); update_redirecting.from.number = 1; @@ -6598,15 +6598,15 @@ static int misdn_call(struct ast_channel *ast, const char *dest, int timeout) ast_copy_string(newbc->dialed.number, args.ext, sizeof(newbc->dialed.number)); if (ast_strlen_zero(newbc->caller.name) - && ast->connected.id.name.valid - && !ast_strlen_zero(ast->connected.id.name.str)) { - ast_copy_string(newbc->caller.name, ast->connected.id.name.str, sizeof(newbc->caller.name)); + && ast_channel_connected(ast)->id.name.valid + && !ast_strlen_zero(ast_channel_connected(ast)->id.name.str)) { + ast_copy_string(newbc->caller.name, ast_channel_connected(ast)->id.name.str, sizeof(newbc->caller.name)); chan_misdn_log(3, port, " --> * set caller:\"%s\" <%s>\n", newbc->caller.name, newbc->caller.number); } if (ast_strlen_zero(newbc->caller.number) - && ast->connected.id.number.valid - && !ast_strlen_zero(ast->connected.id.number.str)) { - ast_copy_string(newbc->caller.number, ast->connected.id.number.str, sizeof(newbc->caller.number)); + && ast_channel_connected(ast)->id.number.valid + && !ast_strlen_zero(ast_channel_connected(ast)->id.number.str)) { + ast_copy_string(newbc->caller.number, ast_channel_connected(ast)->id.number.str, sizeof(newbc->caller.number)); chan_misdn_log(3, port, " --> * set caller:\"%s\" <%s>\n", newbc->caller.name, newbc->caller.number); } @@ -6616,13 +6616,13 @@ static int misdn_call(struct ast_channel *ast, const char *dest, int timeout) strncat(newbc->incoming_cid_tag, newbc->caller.number, sizeof(newbc->incoming_cid_tag) - strlen(newbc->incoming_cid_tag) - 1); } - ast->caller.id.tag = ast_strdup(newbc->incoming_cid_tag); + ast_channel_caller(ast)->id.tag = ast_strdup(newbc->incoming_cid_tag); misdn_cfg_get(port, MISDN_CFG_LOCALDIALPLAN, &number_type, sizeof(number_type)); if (number_type < 0) { - if (ast->connected.id.number.valid) { - newbc->caller.number_type = ast_to_misdn_ton(ast->connected.id.number.plan); - newbc->caller.number_plan = ast_to_misdn_plan(ast->connected.id.number.plan); + if (ast_channel_connected(ast)->id.number.valid) { + newbc->caller.number_type = ast_to_misdn_ton(ast_channel_connected(ast)->id.number.plan); + newbc->caller.number_plan = ast_to_misdn_plan(ast_channel_connected(ast)->id.number.plan); } else { newbc->caller.number_type = NUMTYPE_UNKNOWN; newbc->caller.number_plan = NUMPLAN_ISDN; @@ -7142,10 +7142,10 @@ static int misdn_hangup(struct ast_channel *ast) bc->pid, ast_channel_context(ast), ast_channel_exten(ast), - (ast->caller.id.name.valid && ast->caller.id.name.str) - ? ast->caller.id.name.str : "", - (ast->caller.id.number.valid && ast->caller.id.number.str) - ? ast->caller.id.number.str : "", + (ast_channel_caller(ast)->id.name.valid && ast_channel_caller(ast)->id.name.str) + ? ast_channel_caller(ast)->id.name.str : "", + (ast_channel_caller(ast)->id.number.valid && ast_channel_caller(ast)->id.number.str) + ? ast_channel_caller(ast)->id.number.str : "", misdn_get_ch_state(p)); chan_misdn_log(3, bc->port, " --> l3id:%x\n", p->l3id); chan_misdn_log(3, bc->port, " --> cause:%d\n", bc->cause); @@ -7286,7 +7286,7 @@ static struct ast_frame *process_ast_dsp(struct chan_list *tmp, struct ast_frame misdn_cfg_get(tmp->bc->port, MISDN_CFG_FAXDETECT_CONTEXT, &context_tmp, sizeof(context_tmp)); context = S_OR(context_tmp, S_OR(ast_channel_macrocontext(ast), ast_channel_context(ast))); if (ast_exists_extension(ast, context, "fax", 1, - S_COR(ast->caller.id.number.valid, ast->caller.id.number.str, NULL))) { + S_COR(ast_channel_caller(ast)->id.number.valid, ast_channel_caller(ast)->id.number.str, NULL))) { ast_verb(3, "Redirecting %s to fax extension (context:%s)\n", ast_channel_name(ast), context); /* Save the DID/DNIS when we transfer the fax call to a "fax" extension */ pbx_builtin_setvar_helper(ast,"FAXEXTEN",ast_channel_exten(ast)); @@ -7482,7 +7482,7 @@ static int misdn_write(struct ast_channel *ast, struct ast_frame *frame) chan_misdn_log(5, ch->bc->port, "BC not active (nor bridged) dropping: %d frames addr:%x exten:%s cid:%s ch->state:%s bc_state:%d l3id:%x\n", frame->samples, ch->bc->addr, ast_channel_exten(ast), - S_COR(ast->caller.id.number.valid, ast->caller.id.number.str, ""), + S_COR(ast_channel_caller(ast)->id.number.valid, ast_channel_caller(ast)->id.number.str, ""), misdn_get_ch_state(ch), ch->bc->bc_state, ch->bc->l3_id); } @@ -8161,8 +8161,8 @@ static struct ast_channel *misdn_new(struct chan_list *chlist, int state, char if (!ast_strlen_zero(cid_num)) { /* Don't use ast_set_callerid() here because it will * generate a needless NewCallerID event */ - tmp->caller.ani.number.valid = 1; - tmp->caller.ani.number.str = ast_strdup(cid_num); + ast_channel_caller(tmp)->ani.number.valid = 1; + ast_channel_caller(tmp)->ani.number.str = ast_strdup(cid_num); } if (pipe(chlist->pipe) < 0) { @@ -8452,8 +8452,8 @@ static void release_chan(struct chan_list *ch, struct misdn_bchannel *bc) bc->pid, ast_channel_context(ast), ast_channel_exten(ast), - S_COR(ast->caller.id.name.valid, ast->caller.id.name.str, ""), - S_COR(ast->caller.id.number.valid, ast->caller.id.number.str, "")); + S_COR(ast_channel_caller(ast)->id.name.valid, ast_channel_caller(ast)->id.name.str, ""), + S_COR(ast_channel_caller(ast)->id.number.valid, ast_channel_caller(ast)->id.number.str, "")); if (ast_channel_state(ast) != AST_STATE_RESERVED) { chan_misdn_log(3, bc->port, " --> Setting AST State to down\n"); @@ -8581,9 +8581,9 @@ static int misdn_attempt_transfer(struct chan_list *active_ch, struct chan_list ast_channel_name(held_ch->ast), ast_channel_name(target)); ast_party_connected_line_init(&target_colp); - ast_party_connected_line_copy(&target_colp, &target->connected); + ast_party_connected_line_copy(&target_colp, ast_channel_connected(target)); ast_party_connected_line_init(&transferee_colp); - ast_party_connected_line_copy(&transferee_colp, &held_ch->ast->connected); + ast_party_connected_line_copy(&transferee_colp, ast_channel_connected(held_ch->ast)); held_ch->hold.state = MISDN_HOLD_TRANSFER; /* @@ -8640,10 +8640,10 @@ static void do_immediate_setup(struct misdn_bchannel *bc, struct chan_list *ch, "* Starting Ast context:%s dialed:%s caller:\"%s\" <%s> with 's' extension\n", ast_channel_context(ast), ast_channel_exten(ast), - (ast->caller.id.name.valid && ast->caller.id.name.str) - ? ast->caller.id.name.str : "", - (ast->caller.id.number.valid && ast->caller.id.number.str) - ? ast->caller.id.number.str : ""); + (ast_channel_caller(ast)->id.name.valid && ast_channel_caller(ast)->id.name.str) + ? ast_channel_caller(ast)->id.name.str : "", + (ast_channel_caller(ast)->id.number.valid && ast_channel_caller(ast)->id.number.str) + ? ast_channel_caller(ast)->id.number.str : ""); ast_channel_exten_set(ast, "s"); @@ -8925,8 +8925,8 @@ static void misdn_cc_pbx_notify(long record_id, const struct misdn_cc_notify *no return; } ast_channel_priority_set(chan, notify->priority); - ast_free(chan->dialed.number.str); - chan->dialed.number.str = ast_strdup(notify->exten); + ast_free(ast_channel_dialed(chan)->number.str); + ast_channel_dialed(chan)->number.str = ast_strdup(notify->exten); if (ast_pbx_start(chan)) { ast_log(LOG_WARNING, "Unable to start pbx channel %s!\n", ast_channel_name(chan)); @@ -9260,11 +9260,11 @@ static void misdn_facility_ie_handler(enum event_e event, struct misdn_bchannel bc->div_leg_3_rx_wanted = 0; if (ch && ch->ast) { - ch->ast->redirecting.to.number.presentation = + ast_channel_redirecting(ch->ast)->to.number.presentation = bc->fac_in.u.DivertingLegInformation3.PresentationAllowedIndicator ? AST_PRES_ALLOWED | AST_PRES_USER_NUMBER_UNSCREENED : AST_PRES_RESTRICTED | AST_PRES_USER_NUMBER_UNSCREENED; - ast_channel_queue_redirecting_update(ch->ast, &ch->ast->redirecting, NULL); + ast_channel_queue_redirecting_update(ch->ast, ast_channel_redirecting(ch->ast), NULL); } } break; @@ -10176,12 +10176,12 @@ cb_events(enum event_e event, struct misdn_bchannel *bc, void *user_data) /* Update asterisk channel caller information */ chan_misdn_log(2, bc->port, " --> TON: %s(%d)\n", misdn_to_str_ton(bc->caller.number_type), bc->caller.number_type); chan_misdn_log(2, bc->port, " --> PLAN: %s(%d)\n", misdn_to_str_plan(bc->caller.number_plan), bc->caller.number_plan); - chan->caller.id.number.plan = misdn_to_ast_ton(bc->caller.number_type) + ast_channel_caller(chan)->id.number.plan = misdn_to_ast_ton(bc->caller.number_type) | misdn_to_ast_plan(bc->caller.number_plan); chan_misdn_log(2, bc->port, " --> PRES: %s(%d)\n", misdn_to_str_pres(bc->caller.presentation), bc->caller.presentation); chan_misdn_log(2, bc->port, " --> SCREEN: %s(%d)\n", misdn_to_str_screen(bc->caller.screening), bc->caller.screening); - chan->caller.id.number.presentation = misdn_to_ast_pres(bc->caller.presentation) + ast_channel_caller(chan)->id.number.presentation = misdn_to_ast_pres(bc->caller.presentation) | misdn_to_ast_screen(bc->caller.screening); ast_set_callerid(chan, bc->caller.number, NULL, bc->caller.number); @@ -10193,7 +10193,7 @@ cb_events(enum event_e event, struct misdn_bchannel *bc, void *user_data) } ast_channel_lock(chan); - chan->caller.id.tag = ast_strdup(bc->incoming_cid_tag); + ast_channel_caller(chan)->id.tag = ast_strdup(bc->incoming_cid_tag); ast_channel_unlock(chan); if (!ast_strlen_zero(bc->redirecting.from.number)) { @@ -10495,9 +10495,9 @@ cb_events(enum event_e event, struct misdn_bchannel *bc, void *user_data) bc->div_leg_3_rx_wanted = 0; if (ch->ast) { - ch->ast->redirecting.to.number.presentation = + ast_channel_redirecting(ch->ast)->to.number.presentation = AST_PRES_RESTRICTED | AST_PRES_USER_NUMBER_UNSCREENED; - ast_channel_queue_redirecting_update(ch->ast, &ch->ast->redirecting, NULL); + ast_channel_queue_redirecting_update(ch->ast, ast_channel_redirecting(ch->ast), NULL); } } #endif /* defined(AST_MISDN_ENHANCEMENTS) */ @@ -10934,7 +10934,7 @@ cb_events(enum event_e event, struct misdn_bchannel *bc, void *user_data) break; } misdn_copy_redirecting_to_ast(ch->ast, &bc->redirecting, bc->incoming_cid_tag); - ast_channel_queue_redirecting_update(ch->ast, &ch->ast->redirecting, NULL); + ast_channel_queue_redirecting_update(ch->ast, ast_channel_redirecting(ch->ast), NULL); break; case mISDN_NOTIFY_CODE_CALL_TRANSFER_ALERTING: /* diff --git a/channels/chan_oss.c b/channels/chan_oss.c index 47a995842..ddd559af1 100644 --- a/channels/chan_oss.c +++ b/channels/chan_oss.c @@ -604,10 +604,10 @@ static int oss_call(struct ast_channel *c, const char *dest, int timeout) ast_verbose(" << Call to device '%s' dnid '%s' rdnis '%s' on console from '%s' <%s> >>\n", dest, - S_OR(c->dialed.number.str, ""), - S_COR(c->redirecting.from.number.valid, c->redirecting.from.number.str, ""), - S_COR(c->caller.id.name.valid, c->caller.id.name.str, ""), - S_COR(c->caller.id.number.valid, c->caller.id.number.str, "")); + S_OR(ast_channel_dialed(c)->number.str, ""), + S_COR(ast_channel_redirecting(c)->from.number.valid, ast_channel_redirecting(c)->from.number.str, ""), + S_COR(ast_channel_caller(c)->id.name.valid, ast_channel_caller(c)->id.name.str, ""), + S_COR(ast_channel_caller(c)->id.number.valid, ast_channel_caller(c)->id.number.str, "")); if (!ast_strlen_zero(args.flags) && strcasecmp(args.flags, "answer") == 0) { f.subclass.integer = AST_CONTROL_ANSWER; ast_queue_frame(c, &f); @@ -812,11 +812,11 @@ static struct ast_channel *oss_new(struct chan_oss_pvt *o, char *ext, char *ctx, /* Don't use ast_set_callerid() here because it will * generate a needless NewCallerID event */ if (!ast_strlen_zero(o->cid_num)) { - c->caller.ani.number.valid = 1; - c->caller.ani.number.str = ast_strdup(o->cid_num); + ast_channel_caller(c)->ani.number.valid = 1; + ast_channel_caller(c)->ani.number.str = ast_strdup(o->cid_num); } if (!ast_strlen_zero(ext)) { - c->dialed.number.str = ast_strdup(ext); + ast_channel_dialed(c)->number.str = ast_strdup(ext); } o->owner = c; @@ -1195,7 +1195,7 @@ static char *console_transfer(struct ast_cli_entry *e, int cmd, struct ast_cli_a if (ctx == NULL) /* supply default context if needed */ ctx = ast_strdupa(ast_channel_context(o->owner)); if (!ast_exists_extension(b, ctx, ext, 1, - S_COR(b->caller.id.number.valid, b->caller.id.number.str, NULL))) { + S_COR(ast_channel_caller(b)->id.number.valid, ast_channel_caller(b)->id.number.str, NULL))) { ast_cli(a->fd, "No such extension exists\n"); } else { ast_cli(a->fd, "Whee, transferring %s to %s@%s.\n", ast_channel_name(b), ext, ctx); diff --git a/channels/chan_phone.c b/channels/chan_phone.c index 053174793..c071793ac 100644 --- a/channels/chan_phone.c +++ b/channels/chan_phone.c @@ -301,15 +301,15 @@ static int phone_call(struct ast_channel *ast, const char *dest, int timeout) snprintf(cid.hour, sizeof(cid.hour), "%02d", tm.tm_hour); snprintf(cid.min, sizeof(cid.min), "%02d", tm.tm_min); /* the standard format of ast->callerid is: "name" <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; diff --git a/channels/chan_sip.c b/channels/chan_sip.c index 046ef5757..b3bb4eb55 100644 --- a/channels/chan_sip.c +++ b/channels/chan_sip.c @@ -5643,7 +5643,7 @@ static int sip_call(struct ast_channel *ast, const char *dest, int timeout) } /* Check whether there is vxml_url, distinctive ring variables */ - headp=&ast->varshead; + headp=ast_channel_varshead(ast); AST_LIST_TRAVERSE(headp, current, entries) { /* Check whether there is a VXML_URL variable */ if (!p->options->vxml_url && !strcasecmp(ast_var_name(current), "VXML_URL")) { @@ -5727,7 +5727,7 @@ static int sip_call(struct ast_channel *ast, const char *dest, int timeout) ast_channel_hangupcause_set(ast, AST_CAUSE_USER_BUSY); return res; } - p->callingpres = ast_party_id_presentation(&ast->caller.id); + p->callingpres = ast_party_id_presentation(&ast_channel_caller(ast)->id); ast_rtp_instance_available_formats(p->rtp, p->caps, p->prefcaps, p->jointcaps); p->jointnoncodeccapability = p->noncodeccapability; @@ -7139,7 +7139,7 @@ static struct ast_channel *sip_new(struct sip_pvt *i, int state, const char *tit ast_channel_lock(tmp); sip_pvt_lock(i); ast_channel_cc_params_init(tmp, i->cc_params); - tmp->caller.id.tag = ast_strdup(i->cid_tag); + ast_channel_caller(tmp)->id.tag = ast_strdup(i->cid_tag); ast_channel_tech_set(tmp, (ast_test_flag(&i->flags[0], SIP_DTMF) == SIP_DTMF_INFO || ast_test_flag(&i->flags[0], SIP_DTMF) == SIP_DTMF_SHORTINFO) ? &sip_tech_info : &sip_tech); @@ -7242,8 +7242,8 @@ static struct ast_channel *sip_new(struct sip_pvt *i, int state, const char *tit tmp->callgroup = i->callgroup; tmp->pickupgroup = i->pickupgroup; - tmp->caller.id.name.presentation = i->callingpres; - tmp->caller.id.number.presentation = i->callingpres; + ast_channel_caller(tmp)->id.name.presentation = i->callingpres; + ast_channel_caller(tmp)->id.number.presentation = i->callingpres; if (!ast_strlen_zero(i->parkinglot)) { ast_channel_parkinglot_set(tmp, i->parkinglot); } @@ -7283,16 +7283,16 @@ static struct ast_channel *sip_new(struct sip_pvt *i, int state, const char *tit /* Don't use ast_set_callerid() here because it will * generate an unnecessary NewCallerID event */ if (!ast_strlen_zero(i->cid_num)) { - tmp->caller.ani.number.valid = 1; - tmp->caller.ani.number.str = ast_strdup(i->cid_num); + ast_channel_caller(tmp)->ani.number.valid = 1; + ast_channel_caller(tmp)->ani.number.str = ast_strdup(i->cid_num); } if (!ast_strlen_zero(i->rdnis)) { - tmp->redirecting.from.number.valid = 1; - tmp->redirecting.from.number.str = ast_strdup(i->rdnis); + ast_channel_redirecting(tmp)->from.number.valid = 1; + ast_channel_redirecting(tmp)->from.number.str = ast_strdup(i->rdnis); } if (!ast_strlen_zero(i->exten) && strcmp(i->exten, "s")) { - tmp->dialed.number.str = ast_strdup(i->exten); + ast_channel_dialed(tmp)->number.str = ast_strdup(i->exten); } ast_channel_priority_set(tmp, 1); @@ -7628,7 +7628,7 @@ static struct ast_frame *sip_read(struct ast_channel *ast) sip_pvt_unlock(p); ast_channel_unlock(ast); if (ast_exists_extension(ast, target_context, "fax", 1, - S_COR(ast->caller.id.number.valid, ast->caller.id.number.str, NULL))) { + S_COR(ast_channel_caller(ast)->id.number.valid, ast_channel_caller(ast)->id.number.str, NULL))) { ast_channel_lock(ast); sip_pvt_lock(p); ast_verb(2, "Redirecting '%s' to fax extension due to CNG detection\n", ast_channel_name(ast)); @@ -9605,7 +9605,7 @@ static int process_sdp(struct sip_pvt *p, struct sip_request *req, int t38action const char *target_context = S_OR(ast_channel_macrocontext(p->owner), ast_channel_context(p->owner)); ast_channel_unlock(p->owner); if (ast_exists_extension(p->owner, target_context, "fax", 1, - S_COR(p->owner->caller.id.number.valid, p->owner->caller.id.number.str, NULL))) { + S_COR(ast_channel_caller(p->owner)->id.number.valid, ast_channel_caller(p->owner)->id.number.str, NULL))) { ast_verb(2, "Redirecting '%s' to fax extension due to peer T.38 re-INVITE\n", ast_channel_name(p->owner)); pbx_builtin_setvar_helper(p->owner, "FAXEXTEN", ast_channel_exten(p->owner)); if (ast_async_goto(p->owner, target_context, "fax", 1)) { @@ -11230,15 +11230,15 @@ static int add_rpid(struct sip_request *req, struct sip_pvt *p) return 0; } - if (p->owner && p->owner->connected.id.number.valid - && p->owner->connected.id.number.str) { - lid_num = p->owner->connected.id.number.str; + if (p->owner && ast_channel_connected(p->owner)->id.number.valid + && ast_channel_connected(p->owner)->id.number.str) { + lid_num = ast_channel_connected(p->owner)->id.number.str; } - if (p->owner && p->owner->connected.id.name.valid - && p->owner->connected.id.name.str) { - lid_name = p->owner->connected.id.name.str; + if (p->owner && ast_channel_connected(p->owner)->id.name.valid + && ast_channel_connected(p->owner)->id.name.str) { + lid_name = ast_channel_connected(p->owner)->id.name.str; } - lid_pres = (p->owner) ? ast_party_id_presentation(&p->owner->connected.id) : AST_PRES_NUMBER_NOT_AVAILABLE; + lid_pres = (p->owner) ? ast_party_id_presentation(&ast_channel_connected(p->owner)->id) : AST_PRES_NUMBER_NOT_AVAILABLE; if (ast_strlen_zero(lid_num)) return 0; @@ -12381,9 +12381,9 @@ static void initreqprep(struct sip_request *req, struct sip_pvt *p, int sipmetho d = S_OR(p->fromdomain, ast_sockaddr_stringify_host_remote(&p->ourip)); if (p->owner) { - if ((ast_party_id_presentation(&p->owner->connected.id) & AST_PRES_RESTRICTION) == AST_PRES_ALLOWED) { - l = p->owner->connected.id.number.valid ? p->owner->connected.id.number.str : NULL; - n = p->owner->connected.id.name.valid ? p->owner->connected.id.name.str : NULL; + if ((ast_party_id_presentation(&ast_channel_connected(p->owner)->id) & AST_PRES_RESTRICTION) == AST_PRES_ALLOWED) { + l = ast_channel_connected(p->owner)->id.number.valid ? ast_channel_connected(p->owner)->id.number.str : NULL; + n = ast_channel_connected(p->owner)->id.name.valid ? ast_channel_connected(p->owner)->id.name.str : NULL; } else { /* Even if we are using RPID, we shouldn't leak information in the From if the user wants * their callerid restricted */ @@ -12551,17 +12551,17 @@ static void add_diversion_header(struct sip_request *req, struct sip_pvt *pvt) return; } - diverting_number = pvt->owner->redirecting.from.number.str; - if (!pvt->owner->redirecting.from.number.valid + diverting_number = ast_channel_redirecting(pvt->owner)->from.number.str; + if (!ast_channel_redirecting(pvt->owner)->from.number.valid || ast_strlen_zero(diverting_number)) { return; } - reason = sip_reason_code_to_str(pvt->owner->redirecting.reason); + reason = sip_reason_code_to_str(ast_channel_redirecting(pvt->owner)->reason); /* We at least have a number to place in the Diversion header, which is enough */ - diverting_name = pvt->owner->redirecting.from.name.str; - if (!pvt->owner->redirecting.from.name.valid + diverting_name = ast_channel_redirecting(pvt->owner)->from.name.str; + if (!ast_channel_redirecting(pvt->owner)->from.name.valid || ast_strlen_zero(diverting_name)) { snprintf(header_text, sizeof(header_text), "<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, ¤t->chan1->connected); + ast_party_connected_line_copy(&connected_to_transferee, ast_channel_connected(current->chan1)); /* No need to lock target.chan1 here since it was locked in get_sip_pvt_byid_locked */ - ast_party_connected_line_copy(&connected_to_target, &target.chan1->connected); + ast_party_connected_line_copy(&connected_to_target, ast_channel_connected(target.chan1)); connected_to_target.source = connected_to_transferee.source = AST_CONNECTED_LINE_UPDATE_SOURCE_TRANSFER; res = attempt_transfer(current, &target); if (res) { @@ -30540,7 +30540,7 @@ static int sip_removeheader(struct ast_channel *chan, const char *data) } ast_channel_lock(chan); - headp=&chan->varshead; + headp=ast_channel_varshead(chan); AST_LIST_TRAVERSE_SAFE_BEGIN (headp, newvariable, entries) { if (strncasecmp(ast_var_name(newvariable), "SIPADDHEADER", strlen("SIPADDHEADER")) == 0) { if (removeall || (!strncasecmp(ast_var_value(newvariable),inbuf,strlen(inbuf)))) { diff --git a/channels/chan_skinny.c b/channels/chan_skinny.c index 724493f6a..cfa63eea5 100644 --- a/channels/chan_skinny.c +++ b/channels/chan_skinny.c @@ -2467,15 +2467,15 @@ static void send_callinfo(struct skinny_subchannel *sub) d = l->device; if (sub->calldirection == SKINNY_INCOMING) { - fromname = S_COR(ast->connected.id.name.valid, ast->connected.id.name.str, ""); - fromnum = S_COR(ast->connected.id.number.valid, ast->connected.id.number.str, ""); - toname = S_COR(ast->caller.id.name.valid, ast->caller.id.name.str, ""); - tonum = S_COR(ast->caller.id.number.valid, ast->caller.id.number.str, ""); + fromname = S_COR(ast_channel_connected(ast)->id.name.valid, ast_channel_connected(ast)->id.name.str, ""); + fromnum = S_COR(ast_channel_connected(ast)->id.number.valid, ast_channel_connected(ast)->id.number.str, ""); + toname = S_COR(ast_channel_caller(ast)->id.name.valid, ast_channel_caller(ast)->id.name.str, ""); + tonum = S_COR(ast_channel_caller(ast)->id.number.valid, ast_channel_caller(ast)->id.number.str, ""); } else if (sub->calldirection == SKINNY_OUTGOING) { - fromname = S_COR(ast->caller.id.name.valid, ast->caller.id.name.str, ""); - fromnum = S_COR(ast->caller.id.number.valid, ast->caller.id.number.str, ""); - toname = S_COR(ast->connected.id.name.valid, ast->connected.id.name.str, l->lastnumberdialed); - tonum = S_COR(ast->connected.id.number.valid, ast->connected.id.number.str, l->lastnumberdialed); + fromname = S_COR(ast_channel_caller(ast)->id.name.valid, ast_channel_caller(ast)->id.name.str, ""); + fromnum = S_COR(ast_channel_caller(ast)->id.number.valid, ast_channel_caller(ast)->id.number.str, ""); + toname = S_COR(ast_channel_connected(ast)->id.name.valid, ast_channel_connected(ast)->id.name.str, l->lastnumberdialed); + tonum = S_COR(ast_channel_connected(ast)->id.number.valid, ast_channel_connected(ast)->id.number.str, l->lastnumberdialed); } else { ast_verb(1, "Error sending Callinfo to %s(%d) - No call direction in sub\n", d->name, l->instance); return; @@ -2502,15 +2502,15 @@ static void push_callinfo(struct skinny_subline *subline, struct skinny_subchann d = l->device; if (sub->calldirection == SKINNY_INCOMING) { - fromname = S_COR(ast->connected.id.name.valid, ast->connected.id.name.str, ""); - fromnum = S_COR(ast->connected.id.number.valid, ast->connected.id.number.str, ""); - toname = S_COR(ast->caller.id.name.valid, ast->caller.id.name.str, ""); - tonum = S_COR(ast->caller.id.number.valid, ast->caller.id.number.str, ""); + fromname = S_COR(ast_channel_connected(ast)->id.name.valid, ast_channel_connected(ast)->id.name.str, ""); + fromnum = S_COR(ast_channel_connected(ast)->id.number.valid, ast_channel_connected(ast)->id.number.str, ""); + toname = S_COR(ast_channel_caller(ast)->id.name.valid, ast_channel_caller(ast)->id.name.str, ""); + tonum = S_COR(ast_channel_caller(ast)->id.number.valid, ast_channel_caller(ast)->id.number.str, ""); } else if (sub->calldirection == SKINNY_OUTGOING) { - fromname = S_COR(ast->caller.id.name.valid, ast->caller.id.name.str, ""); - fromnum = S_COR(ast->caller.id.number.valid, ast->caller.id.number.str, ""); - toname = S_COR(ast->connected.id.name.valid, ast->connected.id.name.str, l->lastnumberdialed); - tonum = S_COR(ast->connected.id.number.valid, ast->connected.id.number.str, l->lastnumberdialed); + fromname = S_COR(ast_channel_caller(ast)->id.name.valid, ast_channel_caller(ast)->id.name.str, ""); + fromnum = S_COR(ast_channel_caller(ast)->id.number.valid, ast_channel_caller(ast)->id.number.str, ""); + toname = S_COR(ast_channel_connected(ast)->id.name.valid, ast_channel_connected(ast)->id.name.str, l->lastnumberdialed); + tonum = S_COR(ast_channel_connected(ast)->id.number.valid, ast_channel_connected(ast)->id.number.str, l->lastnumberdialed); } else { ast_verb(1, "Error sending Callinfo to %s(%d) - No call direction in sub\n", d->name, l->instance); return; @@ -3143,10 +3143,10 @@ static void update_connectedline(struct skinny_subchannel *sub, const void *data struct skinny_line *l = sub->line; struct skinny_device *d = l->device; - if (!c->caller.id.number.valid - || ast_strlen_zero(c->caller.id.number.str) - || !c->connected.id.number.valid - || ast_strlen_zero(c->connected.id.number.str)) + if (!ast_channel_caller(c)->id.number.valid + || ast_strlen_zero(ast_channel_caller(c)->id.number.str) + || !ast_channel_connected(c)->id.number.valid + || ast_strlen_zero(ast_channel_connected(c)->id.number.str)) return; if (skinnydebug) { @@ -4230,14 +4230,14 @@ static void *skinny_newcall(void *data) ast_set_callerid(c, l->hidecallerid ? "" : l->cid_num, l->hidecallerid ? "" : l->cid_name, - c->caller.ani.number.valid ? NULL : l->cid_num); + ast_channel_caller(c)->ani.number.valid ? NULL : l->cid_num); #if 1 /* XXX This code is probably not necessary */ - ast_party_number_free(&c->connected.id.number); - ast_party_number_init(&c->connected.id.number); - c->connected.id.number.valid = 1; - c->connected.id.number.str = ast_strdup(ast_channel_exten(c)); - ast_party_name_free(&c->connected.id.name); - ast_party_name_init(&c->connected.id.name); + ast_party_number_free(&ast_channel_connected(c)->id.number); + ast_party_number_init(&ast_channel_connected(c)->id.number); + ast_channel_connected(c)->id.number.valid = 1; + ast_channel_connected(c)->id.number.str = ast_strdup(ast_channel_exten(c)); + ast_party_name_free(&ast_channel_connected(c)->id.name); + ast_party_name_init(&ast_channel_connected(c)->id.name); #endif ast_setstate(c, AST_STATE_RING); if (!sub->rtp) { @@ -4332,10 +4332,10 @@ static void *skinny_ss(void *data) } return NULL; } else if (!ast_canmatch_extension(c, ast_channel_context(c), sub->exten, 1, - S_COR(c->caller.id.number.valid, c->caller.id.number.str, NULL)) + S_COR(ast_channel_caller(c)->id.number.valid, ast_channel_caller(c)->id.number.str, NULL)) && ((sub->exten[0] != '*') || (!ast_strlen_zero(sub->exten) > 2))) { ast_log(LOG_WARNING, "Can't match [%s] from '%s' in context %s\n", sub->exten, - S_COR(c->caller.id.number.valid, c->caller.id.number.str, "<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); diff --git a/channels/chan_unistim.c b/channels/chan_unistim.c index f87e04479..caee08670 100644 --- a/channels/chan_unistim.c +++ b/channels/chan_unistim.c @@ -3770,14 +3770,14 @@ static int unistim_call(struct ast_channel *ast, const char *dest, int timeout) Sendicon(TEXT_LINE0, FAV_ICON_NONE, session); if (sub->owner) { - if (sub->owner->connected.id.number.valid - && sub->owner->connected.id.number.str) { + if (ast_channel_connected(sub->owner)->id.number.valid + && ast_channel_connected(sub->owner)->id.number.str) { if (session->device->height == 1) { - send_text(TEXT_LINE0, TEXT_NORMAL, session, sub->owner->connected.id.number.str); + send_text(TEXT_LINE0, TEXT_NORMAL, session, ast_channel_connected(sub->owner)->id.number.str); } else { - send_text(TEXT_LINE1, TEXT_NORMAL, session, sub->owner->connected.id.number.str); + send_text(TEXT_LINE1, TEXT_NORMAL, session, ast_channel_connected(sub->owner)->id.number.str); } - change_callerid(session, 0, sub->owner->connected.id.number.str); + change_callerid(session, 0, ast_channel_connected(sub->owner)->id.number.str); } else { if (session->device->height == 1) { send_text(TEXT_LINE0, TEXT_NORMAL, session, DEFAULTCALLERID); @@ -3786,10 +3786,10 @@ static int unistim_call(struct ast_channel *ast, const char *dest, int timeout) } change_callerid(session, 0, DEFAULTCALLERID); } - if (sub->owner->connected.id.name.valid - && sub->owner->connected.id.name.str) { - send_text(TEXT_LINE0, TEXT_NORMAL, session, sub->owner->connected.id.name.str); - change_callerid(session, 1, sub->owner->connected.id.name.str); + if (ast_channel_connected(sub->owner)->id.name.valid + && ast_channel_connected(sub->owner)->id.name.str) { + send_text(TEXT_LINE0, TEXT_NORMAL, session, ast_channel_connected(sub->owner)->id.name.str); + change_callerid(session, 1, ast_channel_connected(sub->owner)->id.name.str); } else { send_text(TEXT_LINE0, TEXT_NORMAL, session, DEFAULTCALLERNAME); change_callerid(session, 1, DEFAULTCALLERNAME); @@ -4607,12 +4607,12 @@ static struct ast_channel *unistim_new(struct unistim_subchannel *sub, int state instr = ast_strdup(l->cid_num); if (instr) { ast_callerid_parse(instr, &name, &loc); - tmp->caller.id.number.valid = 1; - ast_free(tmp->caller.id.number.str); - tmp->caller.id.number.str = ast_strdup(loc); - tmp->caller.id.name.valid = 1; - ast_free(tmp->caller.id.name.str); - tmp->caller.id.name.str = ast_strdup(name); + ast_channel_caller(tmp)->id.number.valid = 1; + ast_free(ast_channel_caller(tmp)->id.number.str); + ast_channel_caller(tmp)->id.number.str = ast_strdup(loc); + ast_channel_caller(tmp)->id.name.valid = 1; + ast_free(ast_channel_caller(tmp)->id.name.str); + ast_channel_caller(tmp)->id.name.str = ast_strdup(name); ast_free(instr); } } diff --git a/channels/chan_usbradio.c b/channels/chan_usbradio.c index 9560784b8..b2b5d141a 100644 --- a/channels/chan_usbradio.c +++ b/channels/chan_usbradio.c @@ -2192,11 +2192,11 @@ static struct ast_channel *usbradio_new(struct chan_usbradio_pvt *o, char *ext, /* Don't use ast_set_callerid() here because it will * generate a needless NewCallerID event */ if (!ast_strlen_zero(o->cid_num)) { - c->caller.ani.number.valid = 1; - c->caller.ani.number.str = ast_strdup(o->cid_num); + ast_channel_caller(c)->ani.number.valid = 1; + ast_channel_caller(c)->ani.number.str = ast_strdup(o->cid_num); } if (!ast_strlen_zero(ext)) { - c->dialed.number.str = ast_strdup(ext); + ast_channel_dialed(c)->number.str = ast_strdup(ext); } o->owner = c; diff --git a/channels/chan_vpb.cc b/channels/chan_vpb.cc index 4055fc5b5..bca7e9be8 100644 --- a/channels/chan_vpb.cc +++ b/channels/chan_vpb.cc @@ -694,8 +694,8 @@ static void get_callerid(struct vpb_pvt *p) strcpy(p->cid_name, cli_struct->cn); } ast_verb(4, "CID record - got [%s] [%s]\n", - S_COR(owner->caller.id.number.valid, owner->caller.id.number.str, ""), - S_COR(owner->caller.id.name.valid, owner->caller.id.name.str, "")); + S_COR(ast_channel_caller(owner)->id.number.valid, ast_channel_caller(owner)->id.number.str, ""), + S_COR(ast_channel_caller(owner)->id.name.valid, ast_channel_caller(owner)->id.name.str, "")); snprintf(p->callerid, sizeof(p->callerid), "%s %s", cli_struct->cldn, cli_struct->cn); } else { ast_log(LOG_ERROR, "CID record - No caller id avalable on %s \n", p->dev); @@ -781,15 +781,15 @@ static void get_callerid_ast(struct vpb_pvt *p) } else { ast_log(LOG_ERROR, "%s: Failed to create Caller ID struct\n", p->dev); } - ast_party_number_free(&owner->caller.id.number); - ast_party_number_init(&owner->caller.id.number); - ast_party_name_free(&owner->caller.id.name); - ast_party_name_init(&owner->caller.id.name); + ast_party_number_free(&ast_channel_caller(owner)->id.number); + ast_party_number_init(&ast_channel_caller(owner)->id.number); + ast_party_name_free(&ast_channel_caller(owner)->id.name); + ast_party_name_init(&ast_channel_caller(owner)->id.name); if (number) ast_shrink_phone_number(number); ast_set_callerid(owner, number, name, - owner->caller.ani.number.valid ? NULL : number); + ast_channel_caller(owner)->ani.number.valid ? NULL : number); if (!ast_strlen_zero(name)){ snprintf(p->callerid, sizeof(p->callerid), "%s %s", number, name); } else { @@ -900,7 +900,7 @@ static inline int monitor_handle_owned(struct vpb_pvt *p, VPB_EVENT *e) const char *target_context = S_OR(ast_channel_macrocontext(p->owner), ast_channel_context(p->owner)); if (ast_exists_extension(p->owner, target_context, "fax", 1, - S_COR(p->owner->caller.id.number.valid, p->owner->caller.id.number.str, NULL))) { + S_COR(ast_channel_caller(p->owner)->id.number.valid, ast_channel_caller(p->owner)->id.number.str, NULL))) { ast_verb(3, "Redirecting %s to fax extension\n", ast_channel_name(p->owner)); /* Save the DID/DNIS when we transfer the fax call to a "fax" extension */ pbx_builtin_setvar_helper(p->owner, "FAXEXTEN", ast_channel_exten(p->owner)); diff --git a/channels/console_video.c b/channels/console_video.c index 25e095f68..db07fccee 100644 --- a/channels/console_video.c +++ b/channels/console_video.c @@ -976,12 +976,12 @@ static void *video_thread(void *arg) ast_channel_lock(chan); /* AST_LIST_INSERT_TAIL is only good for one frame, cannot use here */ - if (chan->readq.first == NULL) { - chan->readq.first = f; + if (ast_channel_readq(chan).first == NULL) { + ast_channel_readq(chan).first = f; } else { - chan->readq.last->frame_list.next = f; + ast_channel_readq(chan).last->frame_list.next = f; } - chan->readq.last = p; + ast_channel_readq(chan).last = p; /* * more or less same as ast_queue_frame, but extra * write on the alertpipe to signal frames. diff --git a/channels/sig_analog.c b/channels/sig_analog.c index 01cac4b76..7f4d1a6da 100644 --- a/channels/sig_analog.c +++ b/channels/sig_analog.c @@ -719,8 +719,8 @@ static int analog_attempt_transfer(struct analog_pvt *p, int inthreeway) * The three-way party we're about to transfer is on hold if he * is not in a three way conference. */ - if (ast_channel_transfer_masquerade(owner_real, &owner_real->connected, 0, - bridge_3way, &owner_3way->connected, !inthreeway)) { + if (ast_channel_transfer_masquerade(owner_real, ast_channel_connected(owner_real), 0, + bridge_3way, ast_channel_connected(owner_3way), !inthreeway)) { ast_log(LOG_WARNING, "Unable to masquerade %s as %s\n", ast_channel_name(bridge_3way), ast_channel_name(owner_real)); return -1; @@ -745,8 +745,8 @@ static int analog_attempt_transfer(struct analog_pvt *p, int inthreeway) * The three-way party we're about to transfer is on hold if he * is not in a three way conference. */ - if (ast_channel_transfer_masquerade(owner_3way, &owner_3way->connected, - !inthreeway, bridge_real, &owner_real->connected, 0)) { + if (ast_channel_transfer_masquerade(owner_3way, ast_channel_connected(owner_3way), + !inthreeway, bridge_real, ast_channel_connected(owner_real), 0)) { ast_log(LOG_WARNING, "Unable to masquerade %s as %s\n", ast_channel_name(bridge_real), ast_channel_name(owner_3way)); return -1; @@ -1017,8 +1017,8 @@ int analog_call(struct analog_pvt *p, struct ast_channel *ast, const char *rdest char dest[256]; /* must be same length as p->dialdest */ ast_debug(1, "CALLING CID_NAME: %s CID_NUM:: %s\n", - S_COR(ast->connected.id.name.valid, ast->connected.id.name.str, ""), - S_COR(ast->connected.id.number.valid, ast->connected.id.number.str, "")); + S_COR(ast_channel_connected(ast)->id.name.valid, ast_channel_connected(ast)->id.name.str, ""), + S_COR(ast_channel_connected(ast)->id.number.valid, ast_channel_connected(ast)->id.number.str, "")); ast_copy_string(dest, rdest, sizeof(dest)); ast_copy_string(p->dialdest, rdest, sizeof(p->dialdest)); @@ -1076,13 +1076,13 @@ int analog_call(struct analog_pvt *p, struct ast_channel *ast, const char *rdest analog_set_dialing(p, 1); } else { /* Call waiting call */ - if (ast->connected.id.number.valid && ast->connected.id.number.str) { - ast_copy_string(p->callwait_num, ast->connected.id.number.str, sizeof(p->callwait_num)); + if (ast_channel_connected(ast)->id.number.valid && ast_channel_connected(ast)->id.number.str) { + ast_copy_string(p->callwait_num, ast_channel_connected(ast)->id.number.str, sizeof(p->callwait_num)); } else { p->callwait_num[0] = '\0'; } - if (ast->connected.id.name.valid && ast->connected.id.name.str) { - ast_copy_string(p->callwait_name, ast->connected.id.name.str, sizeof(p->callwait_name)); + if (ast_channel_connected(ast)->id.name.valid && ast_channel_connected(ast)->id.name.str) { + ast_copy_string(p->callwait_name, ast_channel_connected(ast)->id.name.str, sizeof(p->callwait_name)); } else { p->callwait_name[0] = '\0'; } @@ -1097,8 +1097,8 @@ int analog_call(struct analog_pvt *p, struct ast_channel *ast, const char *rdest } } - n = ast->connected.id.name.valid ? ast->connected.id.name.str : NULL; - l = ast->connected.id.number.valid ? ast->connected.id.number.str : NULL; + n = ast_channel_connected(ast)->id.name.valid ? ast_channel_connected(ast)->id.name.str : NULL; + l = ast_channel_connected(ast)->id.number.valid ? ast_channel_connected(ast)->id.number.str : NULL; if (l) { ast_copy_string(p->lastcid_num, l, sizeof(p->lastcid_num)); } else { @@ -1185,7 +1185,7 @@ int analog_call(struct analog_pvt *p, struct ast_channel *ast, const char *rdest switch (mysig) { case ANALOG_SIG_FEATD: - l = ast->connected.id.number.valid ? ast->connected.id.number.str : NULL; + l = ast_channel_connected(ast)->id.number.valid ? ast_channel_connected(ast)->id.number.str : NULL; if (l) { snprintf(p->dop.dialstr, sizeof(p->dop.dialstr), "T*%s*%s*", l, c); } else { @@ -1193,7 +1193,7 @@ int analog_call(struct analog_pvt *p, struct ast_channel *ast, const char *rdest } break; case ANALOG_SIG_FEATDMF: - l = ast->connected.id.number.valid ? ast->connected.id.number.str : NULL; + l = ast_channel_connected(ast)->id.number.valid ? ast_channel_connected(ast)->id.number.str : NULL; if (l) { snprintf(p->dop.dialstr, sizeof(p->dop.dialstr), "M*00%s#*%s#", l, c); } else { @@ -2068,7 +2068,7 @@ static void *__analog_ss_thread(void *data) analog_dsp_set_digitmode(p, ANALOG_DIGITMODE_DTMF); if (ast_exists_extension(chan, ast_channel_context(chan), exten, 1, - chan->caller.id.number.valid ? chan->caller.id.number.str : NULL)) { + ast_channel_caller(chan)->id.number.valid ? ast_channel_caller(chan)->id.number.str : NULL)) { ast_channel_exten_set(chan, exten); analog_dsp_reset_and_flush_digits(p); res = ast_pbx_run(chan); @@ -2226,10 +2226,10 @@ static void *__analog_ss_thread(void *data) ast_verb(3, "Disabling Caller*ID on %s\n", ast_channel_name(chan)); /* Disable Caller*ID if enabled */ p->hidecallerid = 1; - ast_party_number_free(&chan->caller.id.number); - ast_party_number_init(&chan->caller.id.number); - ast_party_name_free(&chan->caller.id.name); - ast_party_name_init(&chan->caller.id.name); + ast_party_number_free(&ast_channel_caller(chan)->id.number); + ast_party_number_init(&ast_channel_caller(chan)->id.number); + ast_party_name_free(&ast_channel_caller(chan)->id.name); + ast_party_name_init(&ast_channel_caller(chan)->id.name); res = analog_play_tone(p, idx, ANALOG_TONE_DIALRECALL); if (res) { ast_log(LOG_WARNING, "Unable to do dial recall on channel %s: %s\n", @@ -2341,11 +2341,11 @@ static void *__analog_ss_thread(void *data) goto quit; } } else if (!ast_canmatch_extension(chan, ast_channel_context(chan), exten, 1, - chan->caller.id.number.valid ? chan->caller.id.number.str : NULL) + ast_channel_caller(chan)->id.number.valid ? ast_channel_caller(chan)->id.number.str : NULL) && !analog_canmatch_featurecode(exten)) { ast_debug(1, "Can't match %s from '%s' in context %s\n", exten, - chan->caller.id.number.valid && chan->caller.id.number.str - ? chan->caller.id.number.str : "<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)); diff --git a/channels/sig_pri.c b/channels/sig_pri.c index 85df15b7b..b317284fd 100644 --- a/channels/sig_pri.c +++ b/channels/sig_pri.c @@ -889,10 +889,10 @@ static void sig_pri_redirecting_update(struct sig_pri_chan *pvt, struct ast_chan /*! \todo XXX Original called data can be put in a channel data store that is inherited. */ memset(&pri_redirecting, 0, sizeof(pri_redirecting)); - sig_pri_party_id_from_ast(&pri_redirecting.from, &ast->redirecting.from); - sig_pri_party_id_from_ast(&pri_redirecting.to, &ast->redirecting.to); - pri_redirecting.count = ast->redirecting.count; - pri_redirecting.reason = ast_to_pri_reason(ast->redirecting.reason); + sig_pri_party_id_from_ast(&pri_redirecting.from, &ast_channel_redirecting(ast)->from); + sig_pri_party_id_from_ast(&pri_redirecting.to, &ast_channel_redirecting(ast)->to); + pri_redirecting.count = ast_channel_redirecting(ast)->count; + pri_redirecting.reason = ast_to_pri_reason(ast_channel_redirecting(ast)->reason); pri_redirecting_update(pvt->pri->pri, pvt->call, &pri_redirecting); } @@ -1918,8 +1918,8 @@ static void *pri_ss_thread(void *data) exten[0] = 's'; exten[1] = '\0'; } else { - ast_free(chan->dialed.number.str); - chan->dialed.number.str = ast_strdup(exten); + ast_free(ast_channel_dialed(chan)->number.str); + ast_channel_dialed(chan)->number.str = ast_strdup(exten); if (p->pri->append_msn_to_user_tag && p->pri->nodetype != PRI_NETWORK) { /* @@ -1928,8 +1928,8 @@ static void *pri_ss_thread(void *data) */ snprintf(p->user_tag, sizeof(p->user_tag), "%s_%s", p->pri->initial_user_tag, exten); - ast_free(chan->caller.id.tag); - chan->caller.id.tag = ast_strdup(p->user_tag); + ast_free(ast_channel_caller(chan)->id.tag); + ast_channel_caller(chan)->id.tag = ast_strdup(p->user_tag); } } sig_pri_play_tone(p, -1); @@ -2237,7 +2237,7 @@ static void sig_pri_mcid_event(struct sig_pri_span *pri, const struct pri_subcmd ast_str_append(&msg, 0, "Channel: %s\r\n", ast_channel_name(owner)); ast_str_append(&msg, 0, "UniqueID: %s\r\n", ast_channel_uniqueid(owner)); - sig_pri_event_party_id(&msg, "CallerID", &owner->connected.id); + sig_pri_event_party_id(&msg, "CallerID", &ast_channel_connected(owner)->id); } else { /* * Since we no longer have an owner channel, @@ -2439,10 +2439,10 @@ static int sig_pri_attempt_transfer(struct sig_pri_span *pri, q931_call *call_1_ ast_mutex_unlock(&pri->lock); retval = ast_channel_transfer_masquerade( call_2->ast, - &call_2->ast->connected, + ast_channel_connected(call_2->ast), call_2->held, transferee, - &call_1->ast->connected, + ast_channel_connected(call_1->ast), call_1->held); /* Reacquire the pri->lock to hold off completion of the transfer masquerade. */ @@ -4130,7 +4130,7 @@ static void sig_pri_handle_subcmds(struct sig_pri_span *pri, int chanpos, int ev pri->pvts[chanpos]->cid_subaddr[0] = '\0'; #if defined(HAVE_PRI_SUBADDR) if (ast_connected.id.subaddress.valid) { - ast_party_subaddress_set(&owner->caller.id.subaddress, + ast_party_subaddress_set(&ast_channel_caller(owner)->id.subaddress, &ast_connected.id.subaddress); if (ast_connected.id.subaddress.str) { ast_copy_string(pri->pvts[chanpos]->cid_subaddr, @@ -4146,7 +4146,7 @@ static void sig_pri_handle_subcmds(struct sig_pri_span *pri, int chanpos, int ev ast_party_id_presentation(&ast_connected.id); sig_pri_set_caller_id(pri->pvts[chanpos]); - ast_party_caller_set_init(&ast_caller, &owner->caller); + ast_party_caller_set_init(&ast_caller, ast_channel_caller(owner)); ast_caller.id = ast_connected.id; ast_caller.ani = ast_connected.id; ast_channel_set_caller_event(owner, &ast_caller, NULL); @@ -4167,7 +4167,7 @@ static void sig_pri_handle_subcmds(struct sig_pri_span *pri, int chanpos, int ev owner = pri->pvts[chanpos]->owner; if (owner) { sig_pri_redirecting_convert(&ast_redirecting, &subcmd->u.redirecting, - &owner->redirecting, pri); + ast_channel_redirecting(owner), pri); ast_redirecting.from.tag = ast_strdup(pri->pvts[chanpos]->user_tag); ast_redirecting.to.tag = ast_strdup(pri->pvts[chanpos]->user_tag); @@ -4239,7 +4239,7 @@ static void sig_pri_handle_subcmds(struct sig_pri_span *pri, int chanpos, int ev break; } sig_pri_redirecting_convert(&ast_redirecting, &pri_deflection, - &owner->redirecting, pri); + ast_channel_redirecting(owner), pri); ast_redirecting.from.tag = ast_strdup(pri->pvts[chanpos]->user_tag); ast_redirecting.to.tag = ast_strdup(pri->pvts[chanpos]->user_tag); ast_channel_set_redirecting(owner, &ast_redirecting, NULL); @@ -6104,7 +6104,7 @@ static void *pri_dchannel(void *vpri) /* Set Calling Subaddress */ sig_pri_lock_owner(pri, chanpos); sig_pri_set_subaddress( - &pri->pvts[chanpos]->owner->caller.id.subaddress, + &ast_channel_caller(pri->pvts[chanpos]->owner)->id.subaddress, &e->ring.calling.subaddress); if (!e->ring.calling.subaddress.type && !ast_strlen_zero( @@ -6119,7 +6119,7 @@ static void *pri_dchannel(void *vpri) /* Set Called Subaddress */ sig_pri_lock_owner(pri, chanpos); sig_pri_set_subaddress( - &pri->pvts[chanpos]->owner->dialed.subaddress, + &ast_channel_dialed(pri->pvts[chanpos]->owner)->subaddress, &e->ring.called_subaddress); if (!e->ring.called_subaddress.type && !ast_strlen_zero( @@ -6229,7 +6229,7 @@ static void *pri_dchannel(void *vpri) /* Set Calling Subaddress */ sig_pri_lock_owner(pri, chanpos); sig_pri_set_subaddress( - &pri->pvts[chanpos]->owner->caller.id.subaddress, + &ast_channel_caller(pri->pvts[chanpos]->owner)->id.subaddress, &e->ring.calling.subaddress); if (!e->ring.calling.subaddress.type && !ast_strlen_zero( @@ -6244,7 +6244,7 @@ static void *pri_dchannel(void *vpri) /* Set Called Subaddress */ sig_pri_lock_owner(pri, chanpos); sig_pri_set_subaddress( - &pri->pvts[chanpos]->owner->dialed.subaddress, + &ast_channel_dialed(pri->pvts[chanpos]->owner)->subaddress, &e->ring.called_subaddress); if (!e->ring.called_subaddress.type && !ast_strlen_zero( @@ -7434,8 +7434,8 @@ int sig_pri_call(struct sig_pri_chan *p, struct ast_channel *ast, const char *rd char *opt_args[OPT_ARG_ARRAY_SIZE]; ast_debug(1, "CALLER NAME: %s NUM: %s\n", - S_COR(ast->connected.id.name.valid, ast->connected.id.name.str, ""), - S_COR(ast->connected.id.number.valid, ast->connected.id.number.str, "")); + S_COR(ast_channel_connected(ast)->id.name.valid, ast_channel_connected(ast)->id.name.str, ""), + S_COR(ast_channel_connected(ast)->id.number.valid, ast_channel_connected(ast)->id.number.str, "")); if (!p->pri) { ast_log(LOG_ERROR, "Could not find pri on channel %d\n", p->channel); @@ -7491,14 +7491,14 @@ int sig_pri_call(struct sig_pri_chan *p, struct ast_channel *ast, const char *rd l = NULL; n = NULL; if (!p->hidecallerid) { - if (ast->connected.id.number.valid) { + if (ast_channel_connected(ast)->id.number.valid) { /* If we get to the end of this loop without breaking, there's no * calleridnum. This is done instead of testing for "unknown" or * the thousands of other ways that the calleridnum could be * invalid. */ - for (l = ast->connected.id.number.str; l && *l; l++) { + for (l = ast_channel_connected(ast)->id.number.str; l && *l; l++) { if (strchr("0123456789", *l)) { - l = ast->connected.id.number.str; + l = ast_channel_connected(ast)->id.number.str; break; } } @@ -7506,7 +7506,7 @@ int sig_pri_call(struct sig_pri_chan *p, struct ast_channel *ast, const char *rd l = NULL; } if (!p->hidecalleridname) { - n = ast->connected.id.name.valid ? ast->connected.id.name.str : NULL; + n = ast_channel_connected(ast)->id.name.valid ? ast_channel_connected(ast)->id.name.str : NULL; } } @@ -7691,8 +7691,8 @@ int sig_pri_call(struct sig_pri_chan *p, struct ast_channel *ast, const char *rd snprintf(p->user_tag, sizeof(p->user_tag), "%s_%s", p->pri->initial_user_tag, p->pri->nodetype == PRI_NETWORK ? c + p->stripmsd + dp_strip - : S_COR(ast->connected.id.number.valid, - ast->connected.id.number.str, "")); + : S_COR(ast_channel_connected(ast)->id.number.valid, + ast_channel_connected(ast)->id.number.str, "")); } else { ast_copy_string(p->user_tag, p->pri->initial_user_tag, sizeof(p->user_tag)); } @@ -7701,8 +7701,8 @@ int sig_pri_call(struct sig_pri_chan *p, struct ast_channel *ast, const char *rd * Replace the caller id tag from the channel creation * with the actual tag value. */ - ast_free(ast->caller.id.tag); - ast->caller.id.tag = ast_strdup(p->user_tag); + ast_free(ast_channel_caller(ast)->id.tag); + ast_channel_caller(ast)->id.tag = ast_strdup(p->user_tag); ldp_strip = 0; prilocaldialplan = p->pri->localdialplan - 1; @@ -7722,7 +7722,7 @@ int sig_pri_call(struct sig_pri_chan *p, struct ast_channel *ast, const char *rd } } else if (prilocaldialplan == -1) { /* Use the numbering plan passed in. */ - prilocaldialplan = ast->connected.id.number.plan; + prilocaldialplan = ast_channel_connected(ast)->id.number.plan; } if (l != NULL) { while (*l > '9' && *l != '*' && *l != '#') { @@ -7781,14 +7781,14 @@ int sig_pri_call(struct sig_pri_chan *p, struct ast_channel *ast, const char *rd } } pri_sr_set_caller(sr, l ? (l + ldp_strip) : NULL, n, prilocaldialplan, - p->use_callingpres ? ast->connected.id.number.presentation : (l ? PRES_ALLOWED_USER_NUMBER_PASSED_SCREEN : PRES_NUMBER_NOT_AVAILABLE)); + p->use_callingpres ? ast_channel_connected(ast)->id.number.presentation : (l ? PRES_ALLOWED_USER_NUMBER_PASSED_SCREEN : PRES_NUMBER_NOT_AVAILABLE)); #if defined(HAVE_PRI_SUBADDR) - if (ast->connected.id.subaddress.valid) { + if (ast_channel_connected(ast)->id.subaddress.valid) { struct pri_party_subaddress subaddress; memset(&subaddress, 0, sizeof(subaddress)); - sig_pri_party_subaddress_from_ast(&subaddress, &ast->connected.id.subaddress); + sig_pri_party_subaddress_from_ast(&subaddress, &ast_channel_connected(ast)->id.subaddress); pri_sr_set_caller_subaddress(sr, &subaddress); } #endif /* defined(HAVE_PRI_SUBADDR) */ @@ -8021,7 +8021,7 @@ int sig_pri_indicate(struct sig_pri_chan *p, struct ast_channel *chan, int condi pri_grab(p, p->pri); memset(&connected, 0, sizeof(connected)); - sig_pri_party_id_from_ast(&connected.id, &chan->connected.id); + sig_pri_party_id_from_ast(&connected.id, &ast_channel_connected(chan)->id); /* Determine the connected line numbering plan to actually use. */ switch (p->pri->cpndialplan) { diff --git a/channels/sig_ss7.c b/channels/sig_ss7.c index c37cf619c..1a8a12b98 100644 --- a/channels/sig_ss7.c +++ b/channels/sig_ss7.c @@ -1451,7 +1451,7 @@ int sig_ss7_call(struct sig_ss7_chan *p, struct ast_channel *ast, const char *rd } if (!p->hidecallerid) { - l = ast->connected.id.number.valid ? ast->connected.id.number.str : NULL; + l = ast_channel_connected(ast)->id.number.valid ? ast_channel_connected(ast)->id.number.str : NULL; } else { l = NULL; } @@ -1500,10 +1500,10 @@ int sig_ss7_call(struct sig_ss7_chan *p, struct ast_channel *ast, const char *rd } } isup_set_calling(p->ss7call, l ? (l + calling_nai_strip) : NULL, ss7_calling_nai, - p->use_callingpres ? cid_pres2ss7pres(ast->connected.id.number.presentation) : (l ? SS7_PRESENTATION_ALLOWED : SS7_PRESENTATION_RESTRICTED), - p->use_callingpres ? cid_pres2ss7screen(ast->connected.id.number.presentation) : SS7_SCREENING_USER_PROVIDED); + p->use_callingpres ? cid_pres2ss7pres(ast_channel_connected(ast)->id.number.presentation) : (l ? SS7_PRESENTATION_ALLOWED : SS7_PRESENTATION_RESTRICTED), + p->use_callingpres ? cid_pres2ss7screen(ast_channel_connected(ast)->id.number.presentation) : SS7_SCREENING_USER_PROVIDED); - isup_set_oli(p->ss7call, ast->connected.ani2); + isup_set_oli(p->ss7call, ast_channel_connected(ast)->ani2); isup_init_call(p->ss7->ss7, p->ss7call, p->cic, p->dpc); /* Set the charge number if it is set */ |