summaryrefslogtreecommitdiff
path: root/channels
diff options
context:
space:
mode:
authorTerry Wilson <twilson@digium.com>2012-02-13 17:27:06 +0000
committerTerry Wilson <twilson@digium.com>2012-02-13 17:27:06 +0000
commit34c55e8e7c87a92181fca3e0101dc456eef2475b (patch)
treead27fca98a7df582348e14b0aaa42f0065cdef99 /channels
parenta955a4770fcdd7874e1337e7df694bcd293e020e (diff)
Opaquify char * and char[] in ast_channel
Review: https://reviewboard.asterisk.org/r/1733/ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@354968 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'channels')
-rw-r--r--channels/chan_agent.c10
-rw-r--r--channels/chan_alsa.c4
-rw-r--r--channels/chan_dahdi.c58
-rw-r--r--channels/chan_gtalk.c4
-rw-r--r--channels/chan_h323.c4
-rw-r--r--channels/chan_iax2.c22
-rw-r--r--channels/chan_jingle.c4
-rw-r--r--channels/chan_local.c10
-rw-r--r--channels/chan_mgcp.c22
-rw-r--r--channels/chan_misdn.c72
-rw-r--r--channels/chan_nbs.c4
-rw-r--r--channels/chan_oss.c2
-rw-r--r--channels/chan_phone.c6
-rw-r--r--channels/chan_sip.c40
-rw-r--r--channels/chan_skinny.c38
-rw-r--r--channels/chan_unistim.c2
-rw-r--r--channels/chan_vpb.cc12
-rw-r--r--channels/sig_analog.c30
-rw-r--r--channels/sig_pri.c20
19 files changed, 182 insertions, 182 deletions
diff --git a/channels/chan_agent.c b/channels/chan_agent.c
index ca9a9ed21..a0fd09a98 100644
--- a/channels/chan_agent.c
+++ b/channels/chan_agent.c
@@ -1103,9 +1103,9 @@ static struct ast_channel *agent_new(struct agent_pvt *p, int state, const char
}
#endif
if (p->pending)
- tmp = ast_channel_alloc(0, state, 0, 0, "", p->chan ? p->chan->exten:"", p->chan ? p->chan->context:"", linkedid, 0, "Agent/P%s-%d", p->agent, (int) ast_random() & 0xffff);
+ tmp = ast_channel_alloc(0, state, 0, 0, "", p->chan ? ast_channel_exten(p->chan):"", p->chan ? ast_channel_context(p->chan):"", linkedid, 0, "Agent/P%s-%d", p->agent, (int) ast_random() & 0xffff);
else
- tmp = ast_channel_alloc(0, state, 0, 0, "", p->chan ? p->chan->exten:"", p->chan ? p->chan->context:"", linkedid, 0, "Agent/%s", p->agent);
+ tmp = ast_channel_alloc(0, state, 0, 0, "", p->chan ? ast_channel_exten(p->chan):"", p->chan ? ast_channel_context(p->chan):"", linkedid, 0, "Agent/%s", p->agent);
if (!tmp) {
ast_log(LOG_WARNING, "Unable to allocate agent channel structure\n");
return NULL;
@@ -1119,8 +1119,8 @@ static struct ast_channel *agent_new(struct agent_pvt *p, int state, const char
ast_format_copy(&tmp->readformat, &p->chan->readformat);
ast_format_copy(&tmp->rawreadformat, &p->chan->readformat);
ast_channel_language_set(tmp, ast_channel_language(p->chan));
- ast_copy_string(tmp->context, p->chan->context, sizeof(tmp->context));
- ast_copy_string(tmp->exten, p->chan->exten, sizeof(tmp->exten));
+ ast_channel_context_set(tmp, ast_channel_context(p->chan));
+ ast_channel_exten_set(tmp, ast_channel_exten(p->chan));
/* XXX Is this really all we copy form the originating channel?? */
} else {
ast_format_set(&tmp->writeformat, AST_FORMAT_SLINEAR, 0);
@@ -1353,7 +1353,7 @@ static int check_availability(struct agent_pvt *newlyavailable, int needlock)
/* Safe -- agent lock already held */
ast_setstate(parent, AST_STATE_UP);
ast_setstate(chan, AST_STATE_UP);
- ast_copy_string(parent->context, chan->context, sizeof(parent->context));
+ ast_channel_context_set(parent, ast_channel_context(chan));
ast_channel_masquerade(parent, chan);
ast_hangup(chan);
p->abouttograb = 0;
diff --git a/channels/chan_alsa.c b/channels/chan_alsa.c
index 62d8e5227..38ef917b7 100644
--- a/channels/chan_alsa.c
+++ b/channels/chan_alsa.c
@@ -578,9 +578,9 @@ static struct ast_channel *alsa_new(struct chan_alsa_pvt *p, int state, const ch
tmp->tech_pvt = p;
if (!ast_strlen_zero(p->context))
- ast_copy_string(tmp->context, p->context, sizeof(tmp->context));
+ ast_channel_context_set(tmp, p->context);
if (!ast_strlen_zero(p->exten))
- ast_copy_string(tmp->exten, p->exten, sizeof(tmp->exten));
+ ast_channel_exten_set(tmp, p->exten);
if (!ast_strlen_zero(language))
ast_channel_language_set(tmp, language);
p->owner = tmp;
diff --git a/channels/chan_dahdi.c b/channels/chan_dahdi.c
index e6457b1e0..560fb02d4 100644
--- a/channels/chan_dahdi.c
+++ b/channels/chan_dahdi.c
@@ -1813,7 +1813,7 @@ static int my_distinctive_ring(struct ast_channel *chan, void *pvt, int idx, int
/* Check to see if context is what it should be, if not set to be. */
else if (strcmp(p->context,p->defcontext) != 0) {
ast_copy_string(p->context, p->defcontext, sizeof(p->context));
- ast_copy_string(chan->context,p->defcontext,sizeof(chan->context));
+ ast_channel_context_set(chan, p->defcontext);
}
for (;;) {
@@ -1889,7 +1889,7 @@ static int my_distinctive_ring(struct ast_channel *chan, void *pvt, int idx, int
if (distMatches == 3) {
/* The ring matches, set the context to whatever is for distinctive ring.. */
ast_copy_string(p->context, S_OR(p->drings.ringContext[counter].contextData, p->defcontext), sizeof(p->context));
- ast_copy_string(chan->context, S_OR(p->drings.ringContext[counter].contextData, p->defcontext), sizeof(chan->context));
+ ast_channel_context_set(chan, S_OR(p->drings.ringContext[counter].contextData, p->defcontext));
ast_verb(3, "Distinctive Ring matched context %s\n",p->context);
break;
}
@@ -2087,8 +2087,8 @@ static void my_handle_dtmf(void *pvt, struct ast_channel *ast, enum analog_sub a
ast_dsp_set_features(p->dsp, p->dsp_features);
ast_debug(1, "Disabling FAX tone detection on %s after tone received\n", ast_channel_name(ast));
}
- if (strcmp(ast->exten, "fax")) {
- const char *target_context = S_OR(ast->macrocontext, ast->context);
+ if (strcmp(ast_channel_exten(ast), "fax")) {
+ const char *target_context = S_OR(ast_channel_macrocontext(ast), ast_channel_context(ast));
/* We need to unlock 'ast' here because ast_exists_extension has the
* potential to start autoservice on the channel. Such action is prone
@@ -2102,7 +2102,7 @@ static void my_handle_dtmf(void *pvt, struct ast_channel *ast, enum analog_sub a
ast_mutex_lock(&p->lock);
ast_verb(3, "Redirecting %s to fax extension\n", ast_channel_name(ast));
/* Save the DID/DNIS when we transfer the fax call to a "fax" extension */
- pbx_builtin_setvar_helper(ast, "FAXEXTEN", ast->exten);
+ pbx_builtin_setvar_helper(ast, "FAXEXTEN", ast_channel_exten(ast));
if (ast_async_goto(ast, target_context, "fax", 1))
ast_log(LOG_WARNING, "Failed to async goto '%s' into fax of '%s'\n", ast_channel_name(ast), target_context);
} else {
@@ -7840,8 +7840,8 @@ static void dahdi_handle_dtmf(struct ast_channel *ast, int idx, struct ast_frame
ast_dsp_set_features(p->dsp, p->dsp_features);
ast_debug(1, "Disabling FAX tone detection on %s after tone received\n", ast_channel_name(ast));
}
- if (strcmp(ast->exten, "fax")) {
- const char *target_context = S_OR(ast->macrocontext, ast->context);
+ if (strcmp(ast_channel_exten(ast), "fax")) {
+ const char *target_context = S_OR(ast_channel_macrocontext(ast), ast_channel_context(ast));
/* We need to unlock 'ast' here because ast_exists_extension has the
* potential to start autoservice on the channel. Such action is prone
@@ -7855,7 +7855,7 @@ static void dahdi_handle_dtmf(struct ast_channel *ast, int idx, struct ast_frame
ast_mutex_lock(&p->lock);
ast_verb(3, "Redirecting %s to fax extension\n", ast_channel_name(ast));
/* Save the DID/DNIS when we transfer the fax call to a "fax" extension */
- pbx_builtin_setvar_helper(ast, "FAXEXTEN", ast->exten);
+ pbx_builtin_setvar_helper(ast, "FAXEXTEN", ast_channel_exten(ast));
if (ast_async_goto(ast, target_context, "fax", 1))
ast_log(LOG_WARNING, "Failed to async goto '%s' into fax of '%s'\n", ast_channel_name(ast), target_context);
} else {
@@ -9742,7 +9742,7 @@ static struct ast_channel *dahdi_new(struct dahdi_pvt *i, int state, int startpb
if (i->amaflags)
tmp->amaflags = i->amaflags;
i->subs[idx].owner = tmp;
- ast_copy_string(tmp->context, i->context, sizeof(tmp->context));
+ ast_channel_context_set(tmp, i->context);
if (!analog_lib_handles(i->sig, i->radio, i->oprmode)) {
ast_channel_call_forward_set(tmp, i->call_forward);
}
@@ -9750,7 +9750,7 @@ static struct ast_channel *dahdi_new(struct dahdi_pvt *i, int state, int startpb
if (!i->adsi)
tmp->adsicpe = AST_ADSI_UNAVAILABLE;
if (!ast_strlen_zero(i->exten))
- ast_copy_string(tmp->exten, i->exten, sizeof(tmp->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);
@@ -10064,8 +10064,8 @@ static void *analog_ss_thread(void *data)
/* If we got the first digit, get the rest */
len = 1;
dtmfbuf[len] = '\0';
- while ((len < AST_MAX_EXTENSION-1) && ast_matchmore_extension(chan, chan->context, dtmfbuf, 1, p->cid_num)) {
- if (ast_exists_extension(chan, chan->context, dtmfbuf, 1, p->cid_num)) {
+ while ((len < AST_MAX_EXTENSION-1) && ast_matchmore_extension(chan, ast_channel_context(chan), dtmfbuf, 1, p->cid_num)) {
+ if (ast_exists_extension(chan, ast_channel_context(chan), dtmfbuf, 1, p->cid_num)) {
timeout = matchdigittimeout;
} else {
timeout = gendigittimeout;
@@ -10206,9 +10206,9 @@ static void *analog_ss_thread(void *data)
}
}
- if (ast_exists_extension(chan, chan->context, exten, 1,
+ if (ast_exists_extension(chan, ast_channel_context(chan), exten, 1,
S_COR(chan->caller.id.number.valid, chan->caller.id.number.str, NULL))) {
- ast_copy_string(chan->exten, exten, sizeof(chan->exten));
+ ast_channel_exten_set(chan, exten);
if (p->dsp) ast_dsp_digitreset(p->dsp);
res = ast_pbx_run(chan);
if (res) {
@@ -10217,7 +10217,7 @@ static void *analog_ss_thread(void *data)
}
goto quit;
} else {
- ast_verb(2, "Unknown extension '%s' in context '%s' requested\n", exten, chan->context);
+ ast_verb(2, "Unknown extension '%s' in context '%s' requested\n", exten, ast_channel_context(chan));
sleep(2);
res = tone_zone_play_tone(p->subs[idx].dfd, DAHDI_TONE_INFO);
if (res < 0)
@@ -10259,12 +10259,12 @@ static void *analog_ss_thread(void *data)
exten[len++]=res;
exten[len] = '\0';
}
- if (!ast_ignore_pattern(chan->context, exten))
+ if (!ast_ignore_pattern(ast_channel_context(chan), exten))
tone_zone_play_tone(p->subs[idx].dfd, -1);
else
tone_zone_play_tone(p->subs[idx].dfd, DAHDI_TONE_DIALTONE);
- if (ast_exists_extension(chan, chan->context, exten, 1, p->cid_num) && !ast_parking_ext_valid(exten, chan, chan->context)) {
- if (!res || !ast_matchmore_extension(chan, chan->context, exten, 1, p->cid_num)) {
+ if (ast_exists_extension(chan, ast_channel_context(chan), exten, 1, p->cid_num) && !ast_parking_ext_valid(exten, chan, ast_channel_context(chan))) {
+ if (!res || !ast_matchmore_extension(chan, ast_channel_context(chan), exten, 1, p->cid_num)) {
if (getforward) {
/* Record this as the forwarding extension */
ast_copy_string(p->call_forward, exten, sizeof(p->call_forward));
@@ -10281,7 +10281,7 @@ static void *analog_ss_thread(void *data)
getforward = 0;
} else {
res = tone_zone_play_tone(p->subs[idx].dfd, -1);
- ast_copy_string(chan->exten, exten, sizeof(chan->exten));
+ ast_channel_exten_set(chan, exten);
if (!ast_strlen_zero(p->cid_num)) {
if (!p->hidecallerid)
ast_set_callerid(chan, p->cid_num, NULL, p->cid_num);
@@ -10399,13 +10399,13 @@ static void *analog_ss_thread(void *data)
getforward = 0;
memset(exten, 0, sizeof(exten));
len = 0;
- } else if ((p->transfer || p->canpark) && ast_parking_ext_valid(exten, chan, chan->context) &&
+ } else if ((p->transfer || p->canpark) && ast_parking_ext_valid(exten, chan, ast_channel_context(chan)) &&
p->subs[SUB_THREEWAY].owner &&
ast_bridged_channel(p->subs[SUB_THREEWAY].owner)) {
/* This is a three way call, the main call being a real channel,
and we're parking the first call. */
ast_masq_park_call_exten(ast_bridged_channel(p->subs[SUB_THREEWAY].owner),
- chan, exten, chan->context, 0, NULL);
+ chan, exten, ast_channel_context(chan), 0, NULL);
ast_verb(3, "Parking call to '%s'\n", ast_channel_name(chan));
break;
} else if (p->hidecallerid && !strcmp(exten, "*82")) {
@@ -10457,17 +10457,17 @@ static void *analog_ss_thread(void *data)
ast_hangup(chan);
goto quit;
}
- } else if (!ast_canmatch_extension(chan, chan->context, exten, 1,
+ } 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))
&& !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>"),
- chan->context);
+ ast_channel_context(chan));
break;
}
if (!timeout)
timeout = gendigittimeout;
- if (len && !ast_ignore_pattern(chan->context, exten))
+ if (len && !ast_ignore_pattern(ast_channel_context(chan), exten))
tone_zone_play_tone(p->subs[idx].dfd, -1);
}
break;
@@ -10479,7 +10479,7 @@ static void *analog_ss_thread(void *data)
smdi_msg = ast_smdi_md_message_wait(p->smdi_iface, SMDI_MD_WAIT_TIMEOUT);
if (smdi_msg != NULL) {
- ast_copy_string(chan->exten, smdi_msg->fwd_st, sizeof(chan->exten));
+ ast_channel_exten_set(chan, smdi_msg->fwd_st);
if (smdi_msg->type == 'B')
pbx_builtin_setvar_helper(chan, "_SMDI_VM_TYPE", "b");
@@ -10670,7 +10670,7 @@ static void *analog_ss_thread(void *data)
/* Check to see if context is what it should be, if not set to be. */
if (strcmp(p->context,p->defcontext) != 0) {
ast_copy_string(p->context, p->defcontext, sizeof(p->context));
- ast_copy_string(chan->context,p->defcontext,sizeof(chan->context));
+ ast_channel_context_set(chan, p->defcontext);
}
for (;;) {
@@ -10741,7 +10741,7 @@ static void *analog_ss_thread(void *data)
if (distMatches == 3) {
/* The ring matches, set the context to whatever is for distinctive ring.. */
ast_copy_string(p->context, S_OR(p->drings.ringContext[counter].contextData, p->defcontext), sizeof(p->context));
- ast_copy_string(chan->context, S_OR(p->drings.ringContext[counter].contextData, p->defcontext), sizeof(chan->context));
+ ast_channel_context_set(chan, S_OR(p->drings.ringContext[counter].contextData, p->defcontext));
ast_verb(3, "Distinctive Ring matched context %s\n",p->context);
break;
}
@@ -10825,7 +10825,7 @@ static void *analog_ss_thread(void *data)
/* Check to see if context is what it should be, if not set to be. */
if (strcmp(p->context,p->defcontext) != 0) {
ast_copy_string(p->context, p->defcontext, sizeof(p->context));
- ast_copy_string(chan->context,p->defcontext,sizeof(chan->context));
+ ast_channel_context_set(chan, p->defcontext);
}
/* Take out of linear mode for Caller*ID processing */
@@ -10984,7 +10984,7 @@ static void *analog_ss_thread(void *data)
if (distMatches == 3) {
/* The ring matches, set the context to whatever is for distinctive ring.. */
ast_copy_string(p->context, S_OR(p->drings.ringContext[counter].contextData, p->defcontext), sizeof(p->context));
- ast_copy_string(chan->context, S_OR(p->drings.ringContext[counter].contextData, p->defcontext), sizeof(chan->context));
+ ast_channel_context_set(chan, S_OR(p->drings.ringContext[counter].contextData, p->defcontext));
ast_verb(3, "Distinctive Ring matched context %s\n",p->context);
break;
}
diff --git a/channels/chan_gtalk.c b/channels/chan_gtalk.c
index 9c1034f11..9b41ab106 100644
--- a/channels/chan_gtalk.c
+++ b/channels/chan_gtalk.c
@@ -1192,8 +1192,8 @@ static struct ast_channel *gtalk_new(struct gtalk *client, struct gtalk_pvt *i,
ast_channel_parkinglot_set(tmp, client->parkinglot);
i->owner = tmp;
ast_module_ref(ast_module_info->self);
- ast_copy_string(tmp->context, client->context, sizeof(tmp->context));
- ast_copy_string(tmp->exten, i->exten, sizeof(tmp->exten));
+ ast_channel_context_set(tmp, client->context);
+ 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);
diff --git a/channels/chan_h323.c b/channels/chan_h323.c
index 9aaa85a20..388c17caa 100644
--- a/channels/chan_h323.c
+++ b/channels/chan_h323.c
@@ -1094,8 +1094,8 @@ static struct ast_channel *__oh323_new(struct oh323_pvt *pvt, int state, const c
/* Set the owner of this channel */
pvt->owner = ch;
- ast_copy_string(ch->context, pvt->context, sizeof(ch->context));
- ast_copy_string(ch->exten, pvt->exten, sizeof(ch->exten));
+ ast_channel_context_set(ch, pvt->context);
+ ast_channel_exten_set(ch, pvt->exten);
ch->priority = 1;
if (!ast_strlen_zero(pvt->accountcode)) {
ast_channel_accountcode_set(ch, pvt->accountcode);
diff --git a/channels/chan_iax2.c b/channels/chan_iax2.c
index 5789e4393..17cc0bbe2 100644
--- a/channels/chan_iax2.c
+++ b/channels/chan_iax2.c
@@ -5134,7 +5134,7 @@ static int iax2_call(struct ast_channel *c, const char *dest, int timeout)
pds.context = cai.peercontext;
/* Keep track of the context for outgoing calls too */
- ast_copy_string(c->context, cai.context, sizeof(c->context));
+ ast_channel_context_set(c, cai.context);
if (pds.port)
sin.sin_port = htons(atoi(pds.port));
@@ -5199,8 +5199,8 @@ static int iax2_call(struct ast_channel *c, const char *dest, int timeout)
ast_mutex_lock(&iaxsl[callno]);
- if (!ast_strlen_zero(c->context))
- ast_string_field_set(iaxs[callno], context, c->context);
+ if (!ast_strlen_zero(ast_channel_context(c)))
+ ast_string_field_set(iaxs[callno], context, ast_channel_context(c));
if (pds.username)
ast_string_field_set(iaxs[callno], username, pds.username);
@@ -5850,8 +5850,8 @@ static struct ast_channel *ast_iax2_new(int callno, int state, iax2_format capab
ast_channel_accountcode_set(tmp, i->accountcode);
if (i->amaflags)
tmp->amaflags = i->amaflags;
- ast_copy_string(tmp->context, i->context, sizeof(tmp->context));
- ast_copy_string(tmp->exten, i->exten, sizeof(tmp->exten));
+ ast_channel_context_set(tmp, i->context);
+ ast_channel_exten_set(tmp, i->exten);
if (i->adsi)
tmp->adsicpe = i->peeradsicpe;
else
@@ -9389,8 +9389,8 @@ static int iax_park(struct ast_channel *chan1, struct ast_channel *chan2, const
struct ast_channel *chan1m, *chan2m;/* Chan2m: The transferer, chan1m: The transferee */
pthread_t th;
- chan1m = ast_channel_alloc(0, AST_STATE_DOWN, 0, 0, ast_channel_accountcode(chan2), chan1->exten, chan1->context, ast_channel_linkedid(chan1), chan1->amaflags, "Parking/%s", ast_channel_name(chan1));
- chan2m = ast_channel_alloc(0, AST_STATE_DOWN, 0, 0, ast_channel_accountcode(chan2), chan2->exten, chan2->context, ast_channel_linkedid(chan2), chan2->amaflags, "IAXPeer/%s", ast_channel_name(chan2));
+ chan1m = ast_channel_alloc(0, AST_STATE_DOWN, 0, 0, ast_channel_accountcode(chan2), ast_channel_exten(chan1), ast_channel_context(chan1), ast_channel_linkedid(chan1), chan1->amaflags, "Parking/%s", ast_channel_name(chan1));
+ chan2m = ast_channel_alloc(0, AST_STATE_DOWN, 0, 0, ast_channel_accountcode(chan2), ast_channel_exten(chan2), ast_channel_context(chan2), ast_channel_linkedid(chan2), chan2->amaflags, "IAXPeer/%s", ast_channel_name(chan2));
d = ast_calloc(1, sizeof(*d));
if (!chan1m || !chan2m || !d) {
if (chan1m) {
@@ -9428,8 +9428,8 @@ static int iax_park(struct ast_channel *chan1, struct ast_channel *chan2, const
}
/* Setup the extensions and such */
- ast_copy_string(chan1m->context, chan1->context, sizeof(chan1m->context));
- ast_copy_string(chan1m->exten, chan1->exten, sizeof(chan1m->exten));
+ ast_channel_context_set(chan1m, ast_channel_context(chan1));
+ ast_channel_exten_set(chan1m, ast_channel_exten(chan1));
chan1m->priority = chan1->priority;
ast_do_masquerade(chan1m);
@@ -9453,8 +9453,8 @@ static int iax_park(struct ast_channel *chan1, struct ast_channel *chan2, const
}
/* Setup the extensions and such */
- ast_copy_string(chan2m->context, chan2->context, sizeof(chan2m->context));
- ast_copy_string(chan2m->exten, chan2->exten, sizeof(chan2m->exten));
+ ast_channel_context_set(chan2m, ast_channel_context(chan2));
+ ast_channel_exten_set(chan2m, ast_channel_exten(chan2));
chan2m->priority = chan2->priority;
ast_do_masquerade(chan2m);
diff --git a/channels/chan_jingle.c b/channels/chan_jingle.c
index 0278238d4..9825f73d8 100644
--- a/channels/chan_jingle.c
+++ b/channels/chan_jingle.c
@@ -901,8 +901,8 @@ static struct ast_channel *jingle_new(struct jingle *client, struct jingle_pvt *
if (!ast_strlen_zero(client->musicclass))
ast_channel_musicclass_set(tmp, client->musicclass);
i->owner = tmp;
- ast_copy_string(tmp->context, client->context, sizeof(tmp->context));
- ast_copy_string(tmp->exten, i->exten, sizeof(tmp->exten));
+ ast_channel_context_set(tmp, client->context);
+ ast_channel_exten_set(tmp, i->exten);
/* Don't use ast_set_callerid() here because it will
* generate an unnecessary NewCallerID event */
if (!ast_strlen_zero(i->cid_num)) {
diff --git a/channels/chan_local.c b/channels/chan_local.c
index 27caa3833..ba116d03a 100644
--- a/channels/chan_local.c
+++ b/channels/chan_local.c
@@ -893,8 +893,8 @@ static int local_call(struct ast_channel *ast, const char *dest, int timeout)
}
ast_set_cc_interfaces_chanvar(chan, reduced_dest);
- exten = ast_strdupa(chan->exten);
- context = ast_strdupa(chan->context);
+ exten = ast_strdupa(ast_channel_exten(chan));
+ context = ast_strdupa(ast_channel_context(chan));
ao2_unlock(p);
pvt_locked = 0;
@@ -1173,9 +1173,9 @@ static struct ast_channel *local_new(struct local_pvt *p, int state, const char
p->u_owner = ast_module_user_add(p->owner);
p->u_chan = ast_module_user_add(p->chan);
- ast_copy_string(tmp->context, p->context, sizeof(tmp->context));
- ast_copy_string(tmp2->context, p->context, sizeof(tmp2->context));
- ast_copy_string(tmp2->exten, p->exten, sizeof(tmp->exten));
+ ast_channel_context_set(tmp, p->context);
+ ast_channel_context_set(tmp2, p->context);
+ ast_channel_exten_set(tmp2, p->exten);
tmp->priority = 1;
tmp2->priority = 1;
diff --git a/channels/chan_mgcp.c b/channels/chan_mgcp.c
index 3005ccb2d..3b544f631 100644
--- a/channels/chan_mgcp.c
+++ b/channels/chan_mgcp.c
@@ -1534,8 +1534,8 @@ static struct ast_channel *mgcp_new(struct mgcp_subchannel *sub, int state, cons
tmp->callgroup = i->callgroup;
tmp->pickupgroup = i->pickupgroup;
ast_channel_call_forward_set(tmp, i->call_forward);
- ast_copy_string(tmp->context, i->context, sizeof(tmp->context));
- ast_copy_string(tmp->exten, i->exten, sizeof(tmp->exten));
+ ast_channel_context_set(tmp, i->context);
+ ast_channel_exten_set(tmp, i->exten);
/* Don't use ast_set_callerid() here because it will
* generate a needless NewCallerID event */
@@ -2990,7 +2990,7 @@ static void *mgcp_ss(void *data)
timeout = 0;
len = strlen(p->dtmf_buf);
- if (!ast_ignore_pattern(chan->context, p->dtmf_buf)) {
+ if (!ast_ignore_pattern(ast_channel_context(chan), p->dtmf_buf)) {
/*res = tone_zone_play_tone(p->subs[index].zfd, -1);*/
ast_indicate(chan, -1);
} else {
@@ -2998,8 +2998,8 @@ static void *mgcp_ss(void *data)
/*tone_zone_play_tone(p->subs[index].zfd, DAHDI_TONE_DIALTONE);*/
transmit_notify_request(sub, "L/dl");
}
- if (ast_exists_extension(chan, chan->context, p->dtmf_buf, 1, p->cid_num)) {
- if (!res || !ast_matchmore_extension(chan, chan->context, p->dtmf_buf, 1, p->cid_num)) {
+ if (ast_exists_extension(chan, ast_channel_context(chan), p->dtmf_buf, 1, p->cid_num)) {
+ if (!res || !ast_matchmore_extension(chan, ast_channel_context(chan), p->dtmf_buf, 1, p->cid_num)) {
if (getforward) {
/* Record this as the forwarding extension */
ast_copy_string(p->call_forward, p->dtmf_buf, sizeof(p->call_forward));
@@ -3021,7 +3021,7 @@ static void *mgcp_ss(void *data)
} else {
/*res = tone_zone_play_tone(p->subs[index].zfd, -1);*/
ast_indicate(chan, -1);
- ast_copy_string(chan->exten, p->dtmf_buf, sizeof(chan->exten));
+ ast_channel_exten_set(chan, p->dtmf_buf);
chan->dialed.number.str = ast_strdup(p->dtmf_buf);
memset(p->dtmf_buf, 0, sizeof(p->dtmf_buf));
ast_set_callerid(chan,
@@ -3129,12 +3129,12 @@ static void *mgcp_ss(void *data)
getforward = 0;
memset(p->dtmf_buf, 0, sizeof(p->dtmf_buf));
len = 0;
- } else if (ast_parking_ext_valid(p->dtmf_buf, chan, chan->context) &&
+ } else if (ast_parking_ext_valid(p->dtmf_buf, chan, ast_channel_context(chan)) &&
sub->next->owner && ast_bridged_channel(sub->next->owner)) {
/* This is a three way call, the main call being a real channel,
and we're parking the first call. */
ast_masq_park_call_exten(ast_bridged_channel(sub->next->owner), chan,
- p->dtmf_buf, chan->context, 0, NULL);
+ p->dtmf_buf, ast_channel_context(chan), 0, NULL);
ast_verb(3, "Parking call to '%s'\n", ast_channel_name(chan));
break;
} else if (!ast_strlen_zero(p->lastcallerid) && !strcmp(p->dtmf_buf, "*60")) {
@@ -3156,17 +3156,17 @@ static void *mgcp_ss(void *data)
len = 0;
memset(p->dtmf_buf, 0, sizeof(p->dtmf_buf));
timeout = firstdigittimeout;
- } else if (!ast_canmatch_extension(chan, chan->context, p->dtmf_buf, 1,
+ } 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))
&& ((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>"),
- chan->context);
+ ast_channel_context(chan));
break;
}
if (!timeout)
timeout = gendigittimeout;
- if (len && !ast_ignore_pattern(chan->context, p->dtmf_buf))
+ if (len && !ast_ignore_pattern(ast_channel_context(chan), p->dtmf_buf))
/*tone_zone_play_tone(p->subs[index].zfd, -1);*/
ast_indicate(chan, -1);
}
diff --git a/channels/chan_misdn.c b/channels/chan_misdn.c
index 6017ee836..1402c8320 100644
--- a/channels/chan_misdn.c
+++ b/channels/chan_misdn.c
@@ -3626,7 +3626,7 @@ static int misdn_overlap_dial_task(const void *data)
if (ast_strlen_zero(ch->bc->dialed.number)) {
dad = "s";
- strcpy(ch->ast->exten, dad);
+ ast_channel_exten_set(ch->ast, dad);
} else {
dad = ch->bc->dialed.number;
}
@@ -4149,7 +4149,7 @@ static void print_bc_info(int fd, struct chan_list *help, struct misdn_bchannel
bc->channel,
bc->nt ? "NT" : "TE",
help->originator == ORG_AST ? "*" : "I",
- ast ? ast->exten : "",
+ 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)
@@ -4158,7 +4158,7 @@ static void print_bc_info(int fd, struct chan_list *help, struct misdn_bchannel
bc->redirecting.from.number,
bc->redirecting.to.name,
bc->redirecting.to.number,
- ast ? ast->context : "",
+ ast ? ast_channel_context(ast) : "",
misdn_get_ch_state(help));
if (misdn_debug[bc->port] > 0) {
ast_cli(fd,
@@ -4251,7 +4251,7 @@ static char *handle_cli_misdn_show_channels(struct ast_cli_entry *e, int cmd, st
" --> hold_port: %d\n"
" --> hold_channel: %d\n",
help->l3id,
- ast->exten,
+ 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, ""),
help->hold.port,
@@ -4259,7 +4259,7 @@ static char *handle_cli_misdn_show_channels(struct ast_cli_entry *e, int cmd, st
);
} else {
ast_cli(a->fd, "* Channel in unknown STATE !!! Exten:%s, Callerid:%s\n",
- ast->exten,
+ ast_channel_exten(ast),
S_COR(ast->caller.id.number.valid, ast->caller.id.number.str, ""));
}
}
@@ -5965,7 +5965,7 @@ static int read_config(struct chan_list *ch)
misdn_cfg_get(bc->port, MISDN_CFG_CONTEXT, ch->context, sizeof(ch->context));
- ast_copy_string(ast->context, ch->context, sizeof(ast->context));
+ ast_channel_context_set(ast, ch->context);
#ifdef MISDN_1_2
update_pipeline_config(bc);
@@ -6037,7 +6037,7 @@ static int read_config(struct chan_list *ch)
/* Add configured prefix to dialed.number */
misdn_add_number_prefix(bc->port, bc->dialed.number_type, bc->dialed.number, sizeof(bc->dialed.number));
- ast_copy_string(ast->exten, bc->dialed.number, sizeof(ast->exten));
+ ast_channel_exten_set(ast, bc->dialed.number);
misdn_cfg_get(bc->port, MISDN_CFG_OVERLAP_DIAL, &ch->overlap_dial, sizeof(ch->overlap_dial));
ast_mutex_init(&ch->overlap_tv_lock);
@@ -6452,7 +6452,7 @@ static void misdn_update_redirecting(struct ast_channel *ast, struct misdn_bchan
} else {
int match; /* TRUE if the dialed number matches the redirecting to number */
- match = (strcmp(ast->exten, bc->redirecting.to.number) == 0) ? 1 : 0;
+ match = (strcmp(ast_channel_exten(ast), bc->redirecting.to.number) == 0) ? 1 : 0;
if (!bc->div_leg_3_tx_pending
|| !match) {
/* Send DivertingLegInformation1 */
@@ -6569,10 +6569,10 @@ static int misdn_call(struct ast_channel *ast, const char *dest, int timeout)
}
AST_LIST_UNLOCK(&misdn_cc_records_db);
- ast_copy_string(ast->exten, newbc->dialed.number, sizeof(ast->exten));
+ ast_channel_exten_set(ast, newbc->dialed.number);
chan_misdn_log(1, port, "* Call completion to: %s\n", newbc->dialed.number);
- chan_misdn_log(2, port, " --> * tech:%s context:%s\n", ast_channel_name(ast), ast->context);
+ chan_misdn_log(2, port, " --> * tech:%s context:%s\n", ast_channel_name(ast), ast_channel_context(ast));
} else
#endif /* defined(AST_MISDN_ENHANCEMENTS) */
{
@@ -6591,9 +6591,9 @@ static int misdn_call(struct ast_channel *ast, const char *dest, int timeout)
}
chan_misdn_log(1, port, "* CALL: %s\n", dest);
- chan_misdn_log(2, port, " --> * dialed:%s tech:%s context:%s\n", args.ext, ast_channel_name(ast), ast->context);
+ chan_misdn_log(2, port, " --> * dialed:%s tech:%s context:%s\n", args.ext, ast_channel_name(ast), ast_channel_context(ast));
- ast_copy_string(ast->exten, args.ext, sizeof(ast->exten));
+ ast_channel_exten_set(ast, args.ext);
ast_copy_string(newbc->dialed.number, args.ext, sizeof(newbc->dialed.number));
if (ast_strlen_zero(newbc->caller.name)
@@ -6872,7 +6872,7 @@ static int misdn_digit_end(struct ast_channel *ast, char digit, unsigned int dur
if (strlen(bc->dialed.number) < sizeof(bc->dialed.number) - 1) {
strncat(bc->dialed.number, buf, sizeof(bc->dialed.number) - strlen(bc->dialed.number) - 1);
}
- ast_copy_string(p->ast->exten, bc->dialed.number, sizeof(p->ast->exten));
+ ast_channel_exten_set(p->ast, bc->dialed.number);
misdn_lib_send_event(bc, EVENT_INFORMATION);
break;
default:
@@ -7139,8 +7139,8 @@ static int misdn_hangup(struct ast_channel *ast)
chan_misdn_log(1, bc->port,
"* IND : HANGUP\tpid:%d context:%s dialed:%s caller:\"%s\" <%s> State:%s\n",
bc->pid,
- ast->context,
- ast->exten,
+ 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)
@@ -7279,21 +7279,21 @@ static struct ast_frame *process_ast_dsp(struct chan_list *tmp, struct ast_frame
isdn_lib_stop_dtmf(tmp->bc);
switch (tmp->faxdetect) {
case 1:
- if (strcmp(ast->exten, "fax")) {
+ if (strcmp(ast_channel_exten(ast), "fax")) {
char *context;
char context_tmp[BUFFERSIZE];
misdn_cfg_get(tmp->bc->port, MISDN_CFG_FAXDETECT_CONTEXT, &context_tmp, sizeof(context_tmp));
- context = ast_strlen_zero(context_tmp) ? (ast_strlen_zero(ast->macrocontext) ? ast->context : ast->macrocontext) : context_tmp;
+ context = ast_strlen_zero(context_tmp) ? (ast_strlen_zero(ast_channel_macrocontext(ast)) ? ast_channel_context(ast) : ast_channel_macrocontext(ast)) : context_tmp;
if (ast_exists_extension(ast, context, "fax", 1,
S_COR(ast->caller.id.number.valid, ast->caller.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->exten);
+ pbx_builtin_setvar_helper(ast,"FAXEXTEN",ast_channel_exten(ast));
if (ast_async_goto(ast, context, "fax", 1)) {
ast_log(LOG_WARNING, "Failed to async goto '%s' into fax of '%s'\n", ast_channel_name(ast), context);
}
} else {
- ast_log(LOG_NOTICE, "Fax detected but no fax extension, context:%s exten:%s\n", context, ast->exten);
+ ast_log(LOG_NOTICE, "Fax detected but no fax extension, context:%s exten:%s\n", context, ast_channel_exten(ast));
}
} else {
ast_debug(1, "Already in a fax extension, not redirecting\n");
@@ -7480,7 +7480,7 @@ static int misdn_write(struct ast_channel *ast, struct ast_frame *frame)
if (!ch->dropped_frame_cnt) {
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->exten,
+ frame->samples, ch->bc->addr, ast_channel_exten(ast),
S_COR(ast->caller.id.number.valid, ast->caller.id.number.str, ""),
misdn_get_ch_state(ch), ch->bc->bc_state, ch->bc->l3_id);
}
@@ -7594,7 +7594,7 @@ static enum ast_bridge_result misdn_bridge(struct ast_channel *c0,
}
if (f->frametype == AST_FRAME_DTMF) {
- chan_misdn_log(1, 0, "Read DTMF %d from %s\n", f->subclass.integer, who->exten);
+ chan_misdn_log(1, 0, "Read DTMF %d from %s\n", f->subclass.integer, ast_channel_exten(who));
*fo = f;
*rc = who;
@@ -8152,7 +8152,7 @@ static struct ast_channel *misdn_new(struct chan_list *chlist, int state, char
tmp->priority = 1;
if (exten) {
- ast_copy_string(tmp->exten, exten, sizeof(tmp->exten));
+ ast_channel_exten_set(tmp, exten);
} else {
chan_misdn_log(1, 0, "misdn_new: no exten given.\n");
}
@@ -8449,8 +8449,8 @@ static void release_chan(struct chan_list *ch, struct misdn_bchannel *bc)
chan_misdn_log(1, bc->port,
"* RELEASING CHANNEL pid:%d context:%s dialed:%s caller:\"%s\" <%s>\n",
bc->pid,
- ast->context,
- ast->exten,
+ 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, ""));
@@ -8617,7 +8617,7 @@ static void do_immediate_setup(struct misdn_bchannel *bc, struct chan_list *ch,
char *predial;
struct ast_frame fr;
- predial = ast_strdupa(ast->exten);
+ predial = ast_strdupa(ast_channel_exten(ast));
ch->state = MISDN_DIALING;
@@ -8637,16 +8637,16 @@ static void do_immediate_setup(struct misdn_bchannel *bc, struct chan_list *ch,
chan_misdn_log(1, bc->port,
"* Starting Ast context:%s dialed:%s caller:\"%s\" <%s> with 's' extension\n",
- ast->context,
- ast->exten,
+ 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 : "");
- strcpy(ast->exten, "s");
+ ast_channel_exten_set(ast, "s");
- if (!ast_canmatch_extension(ast, ast->context, ast->exten, 1, bc->caller.number) || pbx_start_chan(ch) < 0) {
+ if (!ast_canmatch_extension(ast, ast_channel_context(ast), ast_channel_exten(ast), 1, bc->caller.number) || pbx_start_chan(ch) < 0) {
ast = NULL;
bc->out_cause = AST_CAUSE_UNALLOCATED;
hangup_chan(ch, bc);
@@ -10012,10 +10012,10 @@ cb_events(enum event_e event, struct misdn_bchannel *bc, void *user_data)
}
strncat(bc->dialed.number, bc->info_dad, sizeof(bc->dialed.number) - strlen(bc->dialed.number) - 1);
- ast_copy_string(ch->ast->exten, bc->dialed.number, sizeof(ch->ast->exten));
+ ast_channel_exten_set(ch->ast, bc->dialed.number);
/* Check for Pickup Request first */
- if (!strcmp(ch->ast->exten, ast_pickup_ext())) {
+ if (!strcmp(ast_channel_exten(ch->ast), ast_pickup_ext())) {
if (ast_pickup_call(ch->ast)) {
hangup_chan(ch, bc);
} else {
@@ -10031,7 +10031,7 @@ cb_events(enum event_e event, struct misdn_bchannel *bc, void *user_data)
ast_log(LOG_WARNING,
"Extension '%s@%s' can never match. Jumping to 'i' extension. port:%d\n",
bc->dialed.number, ch->context, bc->port);
- strcpy(ch->ast->exten, "i");
+ ast_channel_exten_set(ch->ast, "i");
ch->state = MISDN_DIALING;
start_pbx(ch, bc, ch->ast);
@@ -10088,7 +10088,7 @@ cb_events(enum event_e event, struct misdn_bchannel *bc, void *user_data)
if (ch->state != MISDN_CONNECTED) {
if (digits) {
strncat(bc->dialed.number, bc->info_dad, sizeof(bc->dialed.number) - strlen(bc->dialed.number) - 1);
- ast_copy_string(ch->ast->exten, bc->dialed.number, sizeof(ch->ast->exten));
+ ast_channel_exten_set(ch->ast, bc->dialed.number);
ast_cdr_update(ch->ast);
}
@@ -10251,7 +10251,7 @@ cb_events(enum event_e event, struct misdn_bchannel *bc, void *user_data)
}
/* Check for Pickup Request first */
- if (!strcmp(chan->exten, ast_pickup_ext())) {
+ if (!strcmp(ast_channel_exten(chan), ast_pickup_ext())) {
if (!ch->noautorespond_on_setup) {
/* Sending SETUP_ACK */
misdn_lib_send_event(bc, EVENT_SETUP_ACKNOWLEDGE);
@@ -10291,7 +10291,7 @@ cb_events(enum event_e event, struct misdn_bchannel *bc, void *user_data)
ast_log(LOG_WARNING,
"Extension '%s@%s' can never match. Jumping to 'i' extension. port:%d\n",
bc->dialed.number, ch->context, bc->port);
- strcpy(ch->ast->exten, "i");
+ ast_channel_exten_set(ch->ast, "i");
misdn_lib_send_event(bc, EVENT_SETUP_ACKNOWLEDGE);
ch->state = MISDN_DIALING;
start_pbx(ch, bc, chan);
@@ -10409,7 +10409,7 @@ cb_events(enum event_e event, struct misdn_bchannel *bc, void *user_data)
if (!ch->ast) {
break;
}
- ast_copy_string(ch->ast->exten, bc->dialed.number, sizeof(ch->ast->exten));
+ ast_channel_exten_set(ch->ast, bc->dialed.number);
ast_copy_string(bc->info_dad, bc->infos_pending, sizeof(bc->info_dad));
ast_copy_string(bc->infos_pending, "", sizeof(bc->infos_pending));
diff --git a/channels/chan_nbs.c b/channels/chan_nbs.c
index 50a6397d3..4bb88e661 100644
--- a/channels/chan_nbs.c
+++ b/channels/chan_nbs.c
@@ -234,8 +234,8 @@ static struct ast_channel *nbs_new(struct nbs_pvt *i, int state, const char *lin
if (state == AST_STATE_RING)
tmp->rings = 1;
tmp->tech_pvt = i;
- ast_copy_string(tmp->context, context, sizeof(tmp->context));
- ast_copy_string(tmp->exten, "s", sizeof(tmp->exten));
+ ast_channel_context_set(tmp, context);
+ ast_channel_exten_set(tmp, "s");
ast_channel_language_set(tmp, "");
i->owner = tmp;
i->u = ast_module_user_add(tmp);
diff --git a/channels/chan_oss.c b/channels/chan_oss.c
index 7b75ac4ca..dc3532931 100644
--- a/channels/chan_oss.c
+++ b/channels/chan_oss.c
@@ -1193,7 +1193,7 @@ static char *console_transfer(struct ast_cli_entry *e, int cmd, struct ast_cli_a
tmp = ast_ext_ctx(a->argv[2], &ext, &ctx);
if (ctx == NULL) /* supply default context if needed */
- ctx = o->owner->context;
+ 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))) {
ast_cli(a->fd, "No such extension exists\n");
diff --git a/channels/chan_phone.c b/channels/chan_phone.c
index 99dc01c5c..55f43f39a 100644
--- a/channels/chan_phone.c
+++ b/channels/chan_phone.c
@@ -874,11 +874,11 @@ static struct ast_channel *phone_new(struct phone_pvt *i, int state, char *cntx,
if (state == AST_STATE_RING)
tmp->rings = 1;
tmp->tech_pvt = i;
- ast_copy_string(tmp->context, cntx, sizeof(tmp->context));
+ ast_channel_context_set(tmp, cntx);
if (!ast_strlen_zero(i->ext))
- ast_copy_string(tmp->exten, i->ext, sizeof(tmp->exten));
+ ast_channel_exten_set(tmp, i->ext);
else
- strcpy(tmp->exten, "s");
+ ast_channel_exten_set(tmp, "s");
if (!ast_strlen_zero(i->language))
ast_channel_language_set(tmp, i->language);
diff --git a/channels/chan_sip.c b/channels/chan_sip.c
index 8d6703fa1..f42a13a3c 100644
--- a/channels/chan_sip.c
+++ b/channels/chan_sip.c
@@ -7263,7 +7263,7 @@ static struct ast_channel *sip_new(struct sip_pvt *i, int state, const char *tit
}
i->owner = tmp;
ast_module_ref(ast_module_info->self);
- ast_copy_string(tmp->context, i->context, sizeof(tmp->context));
+ ast_channel_context_set(tmp, i->context);
/*Since it is valid to have extensions in the dialplan that have unescaped characters in them
* we should decode the uri before storing it in the channel, but leave it encoded in the sip_pvt
* structure so that there aren't issues when forming URI's
@@ -7276,7 +7276,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_copy_string(tmp->exten, exten, sizeof(tmp->exten));
+ ast_channel_exten_set(tmp, exten);
/* Don't use ast_set_callerid() here because it will
* generate an unnecessary NewCallerID event */
@@ -7616,8 +7616,8 @@ static struct ast_frame *sip_read(struct ast_channel *ast)
/* If we detect a CNG tone and fax detection is enabled then send us off to the fax extension */
if (faxdetected && ast_test_flag(&p->flags[1], SIP_PAGE2_FAX_DETECT_CNG)) {
- if (strcmp(ast->exten, "fax")) {
- const char *target_context = S_OR(ast->macrocontext, ast->context);
+ if (strcmp(ast_channel_exten(ast), "fax")) {
+ const char *target_context = S_OR(ast_channel_macrocontext(ast), ast_channel_context(ast));
/* We need to unlock 'ast' here because
* ast_exists_extension has the potential to start and
* stop an autoservice on the channel. Such action is
@@ -7630,7 +7630,7 @@ static struct ast_frame *sip_read(struct ast_channel *ast)
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));
- pbx_builtin_setvar_helper(ast, "FAXEXTEN", ast->exten);
+ pbx_builtin_setvar_helper(ast, "FAXEXTEN", ast_channel_exten(ast));
if (ast_async_goto(ast, target_context, "fax", 1)) {
ast_log(LOG_NOTICE, "Failed to async goto '%s' into fax of '%s'\n", ast_channel_name(ast), target_context);
}
@@ -9599,13 +9599,13 @@ static int process_sdp(struct sip_pvt *p, struct sip_request *req, int t38action
/* If fax detection is enabled then send us off to the fax extension */
if (ast_test_flag(&p->flags[1], SIP_PAGE2_FAX_DETECT_T38)) {
ast_channel_lock(p->owner);
- if (strcmp(p->owner->exten, "fax")) {
- const char *target_context = S_OR(p->owner->macrocontext, p->owner->context);
+ if (strcmp(ast_channel_exten(p->owner), "fax")) {
+ 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))) {
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", p->owner->exten);
+ pbx_builtin_setvar_helper(p->owner, "FAXEXTEN", ast_channel_exten(p->owner));
if (ast_async_goto(p->owner, target_context, "fax", 1)) {
ast_log(LOG_NOTICE, "Failed to async goto '%s' into fax of '%s'\n", ast_channel_name(p->owner), target_context);
}
@@ -12946,8 +12946,8 @@ static int find_calling_channel(void *obj, void *arg, void *data, int flags)
ast_channel_lock(c);
res = (c->pbx &&
- (!strcasecmp(c->macroexten, p->exten) || !strcasecmp(c->exten, p->exten)) &&
- (sip_cfg.notifycid == IGNORE_CONTEXT || !strcasecmp(c->context, p->context)));
+ (!strcasecmp(ast_channel_macroexten(c), p->exten) || !strcasecmp(ast_channel_exten(c), p->exten)) &&
+ (sip_cfg.notifycid == IGNORE_CONTEXT || !strcasecmp(ast_channel_context(c), p->context)));
ast_channel_unlock(c);
@@ -16196,7 +16196,7 @@ static int get_refer_info(struct sip_pvt *transferer, struct sip_request *outgoi
/* By default, use the context in the channel sending the REFER */
if (ast_strlen_zero(transfer_context)) {
- transfer_context = S_OR(transferer->owner->macrocontext,
+ transfer_context = S_OR(ast_channel_macrocontext(transferer->owner),
S_OR(transferer->context, sip_cfg.default_context));
}
@@ -16256,7 +16256,7 @@ static int get_also_info(struct sip_pvt *p, struct sip_request *oreq)
/* By default, use the context in the channel sending the REFER */
if (ast_strlen_zero(transfer_context)) {
- transfer_context = S_OR(p->owner->macrocontext,
+ transfer_context = S_OR(ast_channel_macrocontext(p->owner),
S_OR(p->context, sip_cfg.default_context));
}
if (ast_exists_extension(NULL, transfer_context, c, 1, NULL)) {
@@ -22251,8 +22251,8 @@ static int sip_park(struct ast_channel *chan1, struct ast_channel *chan2, struct
struct ast_channel *transferee, *transferer;
pthread_t th;
- transferee = ast_channel_alloc(0, AST_STATE_DOWN, 0, 0, ast_channel_accountcode(chan1), chan1->exten, chan1->context, ast_channel_linkedid(chan1), chan1->amaflags, "Parking/%s", ast_channel_name(chan1));
- transferer = ast_channel_alloc(0, AST_STATE_DOWN, 0, 0, ast_channel_accountcode(chan2), chan2->exten, chan2->context, ast_channel_linkedid(chan2), chan2->amaflags, "SIPPeer/%s", ast_channel_name(chan2));
+ transferee = ast_channel_alloc(0, AST_STATE_DOWN, 0, 0, ast_channel_accountcode(chan1), ast_channel_exten(chan1), ast_channel_context(chan1), ast_channel_linkedid(chan1), chan1->amaflags, "Parking/%s", ast_channel_name(chan1));
+ transferer = ast_channel_alloc(0, AST_STATE_DOWN, 0, 0, ast_channel_accountcode(chan2), ast_channel_exten(chan2), ast_channel_context(chan2), ast_channel_linkedid(chan2), chan2->amaflags, "SIPPeer/%s", ast_channel_name(chan2));
d = ast_calloc(1, sizeof(*d));
if (!transferee || !transferer || !d) {
if (transferee) {
@@ -22290,8 +22290,8 @@ static int sip_park(struct ast_channel *chan1, struct ast_channel *chan2, struct
}
/* Setup the extensions and such */
- ast_copy_string(transferee->context, chan1->context, sizeof(transferee->context));
- ast_copy_string(transferee->exten, chan1->exten, sizeof(transferee->exten));
+ ast_channel_context_set(transferee, ast_channel_context(chan1));
+ ast_channel_exten_set(transferee, ast_channel_exten(chan1));
transferee->priority = chan1->priority;
ast_do_masquerade(transferee);
@@ -22314,8 +22314,8 @@ static int sip_park(struct ast_channel *chan1, struct ast_channel *chan2, struct
}
/* Setup the extensions and such */
- ast_copy_string(transferer->context, chan2->context, sizeof(transferer->context));
- ast_copy_string(transferer->exten, chan2->exten, sizeof(transferer->exten));
+ ast_channel_context_set(transferer, ast_channel_context(chan2));
+ ast_channel_exten_set(transferer, ast_channel_exten(chan2));
transferer->priority = chan2->priority;
ast_do_masquerade(transferer);
@@ -24362,7 +24362,7 @@ static int handle_request_refer(struct sip_pvt *p, struct sip_request *req, int
sip_pvt_unlock(p);
/* Parking a call. DO NOT hold any locks while calling ast_parking_ext_valid() */
- if (localtransfer && ast_parking_ext_valid(refer_to, current.chan1, current.chan1->context)) {
+ if (localtransfer && ast_parking_ext_valid(refer_to, current.chan1, ast_channel_context(current.chan1))) {
sip_pvt_lock(p);
ast_clear_flag(&p->flags[0], SIP_GOTREFER);
p->refer->status = REFER_200OK;
@@ -24391,7 +24391,7 @@ static int handle_request_refer(struct sip_pvt *p, struct sip_request *req, int
}
/* DO NOT hold any locks while calling sip_park */
- if (sip_park(current.chan2, current.chan1, req, seqno, refer_to, current.chan1->context)) {
+ if (sip_park(current.chan2, current.chan1, req, seqno, refer_to, ast_channel_context(current.chan1))) {
sip_pvt_lock(p);
transmit_notify_with_sipfrag(p, seqno, "500 Internal Server Error", TRUE);
} else {
diff --git a/channels/chan_skinny.c b/channels/chan_skinny.c
index 69773dca7..0bfce4dfd 100644
--- a/channels/chan_skinny.c
+++ b/channels/chan_skinny.c
@@ -4235,7 +4235,7 @@ static void *skinny_newcall(void *data)
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(c->exten);
+ 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);
#endif
@@ -4243,7 +4243,7 @@ static void *skinny_newcall(void *data)
if (!sub->rtp) {
start_rtp(sub);
}
- ast_verb(3, "Sub %d - Calling %s@%s\n", sub->callid, c->exten, c->context);
+ ast_verb(3, "Sub %d - Calling %s@%s\n", sub->callid, ast_channel_exten(c), ast_channel_context(c));
res = ast_pbx_run(c);
if (res) {
ast_log(LOG_WARNING, "PBX exited non-zero\n");
@@ -4286,11 +4286,11 @@ static void *skinny_ss(void *data)
timeout = 0;
len = strlen(sub->exten);
- if (!ast_ignore_pattern(c->context, sub->exten)) {
+ if (!ast_ignore_pattern(ast_channel_context(c), sub->exten)) {
transmit_stop_tone(d, l->instance, sub->callid);
}
- if (ast_exists_extension(c, c->context, sub->exten, 1, l->cid_num)) {
- if (!res || !ast_matchmore_extension(c, c->context, sub->exten, 1, l->cid_num)) {
+ if (ast_exists_extension(c, ast_channel_context(c), sub->exten, 1, l->cid_num)) {
+ if (!res || !ast_matchmore_extension(c, ast_channel_context(c), sub->exten, 1, l->cid_num)) {
if (l->getforward) {
/* Record this as the forwarding extension */
set_callforwards(l, sub->exten, l->getforward);
@@ -4331,12 +4331,12 @@ static void *skinny_ss(void *data)
ast_hangup(c);
}
return NULL;
- } else if (!ast_canmatch_extension(c, c->context, sub->exten, 1,
+ } 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))
&& ((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>"),
- c->context);
+ ast_channel_context(c));
if (d->hookstate == SKINNY_OFFHOOK) {
transmit_start_tone(d, SKINNY_REORDER, l->instance, sub->callid);
/* hang out for 3 seconds to let congestion play */
@@ -4347,7 +4347,7 @@ static void *skinny_ss(void *data)
if (!timeout) {
timeout = gendigittimeout;
}
- if (len && !ast_ignore_pattern(c->context, sub->exten)) {
+ if (len && !ast_ignore_pattern(ast_channel_context(c), sub->exten)) {
ast_indicate(c, -1);
}
}
@@ -4928,11 +4928,11 @@ static struct ast_channel *skinny_new(struct skinny_line *l, struct skinny_subli
}
if (subline) {
- ast_copy_string(tmp->context, subline->context, sizeof(tmp->context));
+ ast_channel_context_set(tmp, subline->context);
} else {
- ast_copy_string(tmp->context, l->context, sizeof(tmp->context));
+ ast_channel_context_set(tmp, l->context);
}
- ast_copy_string(tmp->exten, l->exten, sizeof(tmp->exten));
+ ast_channel_exten_set(tmp, l->exten);
/* Don't use ast_set_callerid() here because it will
* generate a needless NewCallerID event */
@@ -5201,8 +5201,8 @@ static void setsubstate(struct skinny_subchannel *sub, int state)
}
break;
case SUBSTATE_DIALING:
- if (ast_strlen_zero(sub->exten) || !ast_exists_extension(c, c->context, sub->exten, 1, l->cid_num)) {
- ast_log(LOG_WARNING, "Exten (%s)@(%s) does not exist, unable to set substate DIALING on sub %d\n", sub->exten, c->context, sub->callid);
+ if (ast_strlen_zero(sub->exten) || !ast_exists_extension(c, ast_channel_context(c), sub->exten, 1, l->cid_num)) {
+ ast_log(LOG_WARNING, "Exten (%s)@(%s) does not exist, unable to set substate DIALING on sub %d\n", sub->exten, ast_channel_context(c), sub->callid);
return;
}
@@ -5222,17 +5222,17 @@ static void setsubstate(struct skinny_subchannel *sub, int state)
if (AST_LIST_FIRST(&l->sublines)) {
if (subline) {
- ast_copy_string(c->exten, subline->exten, sizeof(c->exten));
- ast_copy_string(c->context, "sla_stations", sizeof(c->context));
+ ast_channel_exten_set(c, subline->exten);
+ ast_channel_context_set(c, "sla_stations");
} else {
pbx_builtin_setvar_helper(c, "_DESTEXTEN", sub->exten);
- pbx_builtin_setvar_helper(c, "_DESTCONTEXT", c->context);
- ast_copy_string(c->exten, l->dialoutexten, sizeof(c->exten));
- ast_copy_string(c->context, l->dialoutcontext, sizeof(c->context));
+ pbx_builtin_setvar_helper(c, "_DESTCONTEXT", ast_channel_context(c));
+ ast_channel_exten_set(c, l->dialoutexten);
+ ast_channel_context_set(c, l->dialoutcontext);
ast_copy_string(l->lastnumberdialed, sub->exten, sizeof(l->lastnumberdialed));
}
} else {
- ast_copy_string(c->exten, sub->exten, sizeof(c->exten));
+ ast_channel_exten_set(c, sub->exten);
ast_copy_string(l->lastnumberdialed, sub->exten, sizeof(l->lastnumberdialed));
}
diff --git a/channels/chan_unistim.c b/channels/chan_unistim.c
index 563d1f143..6eca792ec 100644
--- a/channels/chan_unistim.c
+++ b/channels/chan_unistim.c
@@ -2056,7 +2056,7 @@ static void *unistim_ss(void *data)
int res;
ast_verb(3, "Starting switch on '%s@%s-%d' to %s\n", l->name, l->parent->name, sub->subtype, s->device->phone_number);
- ast_copy_string(chan->exten, s->device->phone_number, sizeof(chan->exten));
+ ast_channel_exten_set(chan, s->device->phone_number);
ast_copy_string(s->device->redial_number, s->device->phone_number,
sizeof(s->device->redial_number));
ast_setstate(chan, AST_STATE_RING);
diff --git a/channels/chan_vpb.cc b/channels/chan_vpb.cc
index cd9d4344b..9a5a1265d 100644
--- a/channels/chan_vpb.cc
+++ b/channels/chan_vpb.cc
@@ -896,14 +896,14 @@ static inline int monitor_handle_owned(struct vpb_pvt *p, VPB_EVENT *e)
}
} else if (e->data == VPB_FAX) {
if (!p->faxhandled) {
- if (strcmp(p->owner->exten, "fax")) {
- const char *target_context = S_OR(p->owner->macrocontext, p->owner->context);
+ if (strcmp(ast_channel_exten(p->owner), "fax")) {
+ 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))) {
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", p->owner->exten);
+ pbx_builtin_setvar_helper(p->owner, "FAXEXTEN", ast_channel_exten(p->owner));
if (ast_async_goto(p->owner, target_context, "fax", 1)) {
ast_log(LOG_WARNING, "Failed to async goto '%s' into fax of '%s'\n", ast_channel_name(p->owner), target_context);
}
@@ -2469,11 +2469,11 @@ static struct ast_channel *vpb_new(struct vpb_pvt *me, enum ast_channel_state st
}
tmp->tech_pvt = me;
- ast_copy_string(tmp->context, context, sizeof(tmp->context));
+ ast_channel_context_set(tmp, context);
if (!ast_strlen_zero(me->ext))
- ast_copy_string(tmp->exten, me->ext, sizeof(tmp->exten));
+ ast_channel_exten_set(tmp, me->ext);
else
- strcpy(tmp->exten, "s");
+ ast_channel_exten_set(tmp, "s");
if (!ast_strlen_zero(me->language))
ast_channel_language_set(tmp, me->language);
diff --git a/channels/sig_analog.c b/channels/sig_analog.c
index 67ed6944c..ecb62b938 100644
--- a/channels/sig_analog.c
+++ b/channels/sig_analog.c
@@ -1908,8 +1908,8 @@ static void *__analog_ss_thread(void *data)
/* If we got the first digit, get the rest */
len = 1;
dtmfbuf[len] = '\0';
- while ((len < AST_MAX_EXTENSION-1) && ast_matchmore_extension(chan, chan->context, dtmfbuf, 1, p->cid_num)) {
- if (ast_exists_extension(chan, chan->context, dtmfbuf, 1, p->cid_num)) {
+ while ((len < AST_MAX_EXTENSION-1) && ast_matchmore_extension(chan, ast_channel_context(chan), dtmfbuf, 1, p->cid_num)) {
+ if (ast_exists_extension(chan, ast_channel_context(chan), dtmfbuf, 1, p->cid_num)) {
timeout = analog_matchdigittimeout;
} else {
timeout = analog_gendigittimeout;
@@ -2059,9 +2059,9 @@ static void *__analog_ss_thread(void *data)
analog_dsp_set_digitmode(p, ANALOG_DIGITMODE_DTMF);
- if (ast_exists_extension(chan, chan->context, exten, 1,
+ if (ast_exists_extension(chan, ast_channel_context(chan), exten, 1,
chan->caller.id.number.valid ? chan->caller.id.number.str : NULL)) {
- ast_copy_string(chan->exten, exten, sizeof(chan->exten));
+ ast_channel_exten_set(chan, exten);
analog_dsp_reset_and_flush_digits(p);
res = ast_pbx_run(chan);
if (res) {
@@ -2070,7 +2070,7 @@ static void *__analog_ss_thread(void *data)
}
goto quit;
} else {
- ast_verb(3, "Unknown extension '%s' in context '%s' requested\n", exten, chan->context);
+ ast_verb(3, "Unknown extension '%s' in context '%s' requested\n", exten, ast_channel_context(chan));
sleep(2);
res = analog_play_tone(p, idx, ANALOG_TONE_INFO);
if (res < 0) {
@@ -2116,13 +2116,13 @@ static void *__analog_ss_thread(void *data)
exten[len++]=res;
exten[len] = '\0';
}
- if (!ast_ignore_pattern(chan->context, exten)) {
+ if (!ast_ignore_pattern(ast_channel_context(chan), exten)) {
analog_play_tone(p, idx, -1);
} else {
analog_play_tone(p, idx, ANALOG_TONE_DIALTONE);
}
- if (ast_exists_extension(chan, chan->context, exten, 1, p->cid_num) && !ast_parking_ext_valid(exten, chan, chan->context)) {
- if (!res || !ast_matchmore_extension(chan, chan->context, exten, 1, p->cid_num)) {
+ if (ast_exists_extension(chan, ast_channel_context(chan), exten, 1, p->cid_num) && !ast_parking_ext_valid(exten, chan, ast_channel_context(chan))) {
+ if (!res || !ast_matchmore_extension(chan, ast_channel_context(chan), exten, 1, p->cid_num)) {
if (getforward) {
/* Record this as the forwarding extension */
ast_copy_string(p->call_forward, exten, sizeof(p->call_forward));
@@ -2140,7 +2140,7 @@ static void *__analog_ss_thread(void *data)
getforward = 0;
} else {
res = analog_play_tone(p, idx, -1);
- ast_copy_string(chan->exten, exten, sizeof(chan->exten));
+ ast_channel_exten_set(chan, exten);
if (!ast_strlen_zero(p->cid_num)) {
if (!p->hidecallerid) {
ast_set_callerid(chan, p->cid_num, NULL, p->cid_num);
@@ -2265,14 +2265,14 @@ static void *__analog_ss_thread(void *data)
getforward = 0;
memset(exten, 0, sizeof(exten));
len = 0;
- } else if ((p->transfer || p->canpark) && ast_parking_ext_valid(exten, chan, chan->context) &&
+ } else if ((p->transfer || p->canpark) && ast_parking_ext_valid(exten, chan, ast_channel_context(chan)) &&
p->subs[ANALOG_SUB_THREEWAY].owner &&
ast_bridged_channel(p->subs[ANALOG_SUB_THREEWAY].owner)) {
/* This is a three way call, the main call being a real channel,
and we're parking the first call. */
ast_masq_park_call_exten(
ast_bridged_channel(p->subs[ANALOG_SUB_THREEWAY].owner), chan, exten,
- chan->context, 0, NULL);
+ ast_channel_context(chan), 0, NULL);
ast_verb(3, "Parking call to '%s'\n", ast_channel_name(chan));
break;
} else if (!ast_strlen_zero(p->lastcid_num) && !strcmp(exten, "*60")) {
@@ -2332,19 +2332,19 @@ static void *__analog_ss_thread(void *data)
ast_hangup(chan);
goto quit;
}
- } else if (!ast_canmatch_extension(chan, chan->context, exten, 1,
+ } else if (!ast_canmatch_extension(chan, ast_channel_context(chan), exten, 1,
chan->caller.id.number.valid ? chan->caller.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>",
- chan->context);
+ ast_channel_context(chan));
break;
}
if (!timeout) {
timeout = analog_gendigittimeout;
}
- if (len && !ast_ignore_pattern(chan->context, exten)) {
+ if (len && !ast_ignore_pattern(ast_channel_context(chan), exten)) {
analog_play_tone(p, idx, -1);
}
}
@@ -2356,7 +2356,7 @@ static void *__analog_ss_thread(void *data)
if (p->use_smdi && p->smdi_iface) {
smdi_msg = ast_smdi_md_message_wait(p->smdi_iface, ANALOG_SMDI_MD_WAIT_TIMEOUT);
if (smdi_msg != NULL) {
- ast_copy_string(chan->exten, smdi_msg->fwd_st, sizeof(chan->exten));
+ ast_channel_exten_set(chan, smdi_msg->fwd_st);
if (smdi_msg->type == 'B')
pbx_builtin_setvar_helper(chan, "_SMDI_VM_TYPE", "b");
diff --git a/channels/sig_pri.c b/channels/sig_pri.c
index bfdcb1084..28a640639 100644
--- a/channels/sig_pri.c
+++ b/channels/sig_pri.c
@@ -1829,10 +1829,10 @@ static void *do_idle_thread(void *v_pvt)
switch (f->subclass.integer) {
case AST_CONTROL_ANSWER:
/* Launch the PBX */
- ast_copy_string(chan->exten, pvt->pri->idleext, sizeof(chan->exten));
- ast_copy_string(chan->context, pvt->pri->idlecontext, sizeof(chan->context));
+ ast_channel_exten_set(chan, pvt->pri->idleext);
+ ast_channel_context_set(chan, pvt->pri->idlecontext);
chan->priority = 1;
- ast_verb(4, "Idle channel '%s' answered, sending to %s@%s\n", ast_channel_name(chan), chan->exten, chan->context);
+ ast_verb(4, "Idle channel '%s' answered, sending to %s@%s\n", ast_channel_name(chan), ast_channel_exten(chan), ast_channel_context(chan));
ast_pbx_run(chan);
/* It's already hungup, return immediately */
return NULL;
@@ -1884,12 +1884,12 @@ static void *pri_ss_thread(void *data)
ast_copy_string(exten, p->exten, sizeof(exten));
len = strlen(exten);
res = 0;
- while ((len < AST_MAX_EXTENSION-1) && ast_matchmore_extension(chan, chan->context, exten, 1, p->cid_num)) {
- if (len && !ast_ignore_pattern(chan->context, exten))
+ while ((len < AST_MAX_EXTENSION-1) && ast_matchmore_extension(chan, ast_channel_context(chan), exten, 1, p->cid_num)) {
+ if (len && !ast_ignore_pattern(ast_channel_context(chan), exten))
sig_pri_play_tone(p, -1);
else
sig_pri_play_tone(p, SIG_PRI_TONE_DIALTONE);
- if (ast_exists_extension(chan, chan->context, exten, 1, p->cid_num))
+ if (ast_exists_extension(chan, ast_channel_context(chan), exten, 1, p->cid_num))
timeout = pri_matchdigittimeout;
else
timeout = pri_gendigittimeout;
@@ -1925,9 +1925,9 @@ static void *pri_ss_thread(void *data)
}
}
sig_pri_play_tone(p, -1);
- if (ast_exists_extension(chan, chan->context, exten, 1, p->cid_num)) {
+ if (ast_exists_extension(chan, ast_channel_context(chan), exten, 1, p->cid_num)) {
/* Start the real PBX */
- ast_copy_string(chan->exten, exten, sizeof(chan->exten));
+ ast_channel_exten_set(chan, exten);
sig_pri_dsp_reset_and_flush_digits(p);
#if defined(ISSUE_16789)
/*
@@ -1943,7 +1943,7 @@ static void *pri_ss_thread(void *data)
* early on non-dial through extensions.
*/
if ((p->pri->overlapdial & DAHDI_OVERLAPDIAL_INCOMING)
- && !ast_matchmore_extension(chan, chan->context, exten, 1, p->cid_num)) {
+ && !ast_matchmore_extension(chan, ast_channel_context(chan), exten, 1, p->cid_num)) {
sig_pri_lock_private(p);
if (p->pri->pri) {
pri_grab(p, p->pri);
@@ -1964,7 +1964,7 @@ static void *pri_ss_thread(void *data)
ast_log(LOG_WARNING, "PBX exited non-zero!\n");
}
} else {
- ast_debug(1, "No such possible extension '%s' in context '%s'\n", exten, chan->context);
+ ast_debug(1, "No such possible extension '%s' in context '%s'\n", exten, ast_channel_context(chan));
chan->hangupcause = AST_CAUSE_UNALLOCATED;
ast_hangup(chan);
p->exten[0] = '\0';