Opaquify ast_channel typedefs, fd arrays, and softhangup flag

Review: https://reviewboard.asterisk.org/r/1784/


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@357721 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Terry Wilson
2012-03-01 22:09:18 +00:00
parent e291318df2
commit 0e5c761c28
36 changed files with 434 additions and 260 deletions
+5 -5
View File
@@ -129,7 +129,7 @@ static int conf_run(struct ast_channel *chan, int confno, int confflags)
ast_indicate(chan, -1);
retrydahdi = strcasecmp(ast_channel_tech(chan)->type, "DAHDI");
dahdiretry:
origfd = chan->fds[0];
origfd = ast_channel_fd(chan, 0);
if (retrydahdi) {
fd = open("/dev/dahdi/pseudo", O_RDWR);
if (fd < 0) {
@@ -162,7 +162,7 @@ dahdiretry:
nfds = 1;
} else {
/* XXX Make sure we're not running on a pseudo channel XXX */
fd = chan->fds[0];
fd = ast_channel_fd(chan, 0);
nfds = 0;
}
memset(&dahdic, 0, sizeof(dahdic));
@@ -199,7 +199,7 @@ dahdiretry:
ms = -1;
c = ast_waitfor_nandfds(&chan, 1, &fd, nfds, NULL, &outfd, &ms);
if (c) {
if (c->fds[0] != origfd) {
if (ast_channel_fd(c, 0) != origfd) {
if (retrydahdi) {
/* Kill old pseudo */
close(fd);
@@ -215,7 +215,7 @@ dahdiretry:
ret = 0;
ast_frfree(f);
break;
} else if (fd != chan->fds[0]) {
} else if (fd != ast_channel_fd(chan, 0)) {
if (f->frametype == AST_FRAME_VOICE) {
if (f->subclass.format.id == AST_FORMAT_ULAW) {
/* Carefully write */
@@ -243,7 +243,7 @@ dahdiretry:
ast_log(LOG_WARNING, "Failed to read frame: %s\n", strerror(errno));
}
}
if (fd != chan->fds[0])
if (fd != ast_channel_fd(chan, 0))
close(fd);
else {
/* Take out of conference */
+5 -5
View File
@@ -95,7 +95,7 @@ static pid_t spawn_ras(struct ast_channel *chan, char *args)
}
/* Execute RAS on File handles */
dup2(chan->fds[0], STDIN_FILENO);
dup2(ast_channel_fd(chan, 0), STDIN_FILENO);
/* Drop high priority */
if (ast_opt_high_priority)
@@ -139,7 +139,7 @@ static void run_ras(struct ast_channel *chan, char *args)
struct dahdi_bufferinfo savebi;
int x;
res = ioctl(chan->fds[0], DAHDI_GET_BUFINFO, &savebi);
res = ioctl(ast_channel_fd(chan, 0), DAHDI_GET_BUFINFO, &savebi);
if(res) {
ast_log(LOG_WARNING, "Unable to check buffer policy on channel %s\n", ast_channel_name(chan));
return;
@@ -175,10 +175,10 @@ static void run_ras(struct ast_channel *chan, char *args)
}
/* Throw back into audio mode */
x = 1;
ioctl(chan->fds[0], DAHDI_AUDIOMODE, &x);
ioctl(ast_channel_fd(chan, 0), DAHDI_AUDIOMODE, &x);
/* Restore saved values */
res = ioctl(chan->fds[0], DAHDI_SET_BUFINFO, &savebi);
res = ioctl(ast_channel_fd(chan, 0), DAHDI_SET_BUFINFO, &savebi);
if (res < 0) {
ast_log(LOG_WARNING, "Unable to set buffer policy on channel %s\n", ast_channel_name(chan));
}
@@ -209,7 +209,7 @@ static int dahdiras_exec(struct ast_channel *chan, const char *data)
sleep(2);
} else {
memset(&dahdip, 0, sizeof(dahdip));
if (ioctl(chan->fds[0], DAHDI_GET_PARAMS, &dahdip)) {
if (ioctl(ast_channel_fd(chan, 0), DAHDI_GET_PARAMS, &dahdip)) {
ast_log(LOG_WARNING, "Unable to get DAHDI parameters\n");
} else if (dahdip.sigtype != DAHDI_SIG_CLEAR) {
ast_verb(2, "Channel %s is not a clear channel\n", ast_channel_name(chan));
+1 -1
View File
@@ -241,7 +241,7 @@ static int find_channel_by_group(void *obj, void *arg, void *data, int flags)
struct ast_channel *chan = data;/*!< Channel wanting to pickup call */
ast_channel_lock(target);
if (chan != target && (chan->pickupgroup & target->callgroup)
if (chan != target && (ast_channel_pickupgroup(chan) & ast_channel_callgroup(target))
&& ast_can_pickup(target)) {
/* Return with the channel still locked on purpose */
return CMP_MATCH | CMP_STOP;
+3 -3
View File
@@ -151,7 +151,7 @@ static int serialize_showchan(struct ast_channel *c, char *buf, size_t size)
ast_translate_path_to_str(ast_channel_writetrans(c), &write_transpath),
ast_channel_readtrans(c) ? "Yes" : "No",
ast_translate_path_to_str(ast_channel_readtrans(c), &read_transpath),
c->fds[0],
ast_channel_fd(c, 0),
ast_channel_fin(c) & ~DEBUGCHAN_FLAG, (ast_channel_fin(c) & DEBUGCHAN_FLAG) ? " (DEBUGGED)" : "",
ast_channel_fout(c) & ~DEBUGCHAN_FLAG, (ast_channel_fout(c) & DEBUGCHAN_FLAG) ? " (DEBUGGED)" : "",
(long)ast_channel_whentohangup(c)->tv_sec,
@@ -163,8 +163,8 @@ static int serialize_showchan(struct ast_channel *c, char *buf, size_t size)
ast_channel_context(c),
ast_channel_exten(c),
ast_channel_priority(c),
ast_print_group(cgrp, sizeof(cgrp), c->callgroup),
ast_print_group(pgrp, sizeof(pgrp), c->pickupgroup),
ast_print_group(cgrp, sizeof(cgrp), ast_channel_callgroup(c)),
ast_print_group(pgrp, sizeof(pgrp), ast_channel_pickupgroup(c)),
ast_channel_appl(c) ? ast_channel_appl(c) : "(N/A)",
ast_channel_data(c) ? S_OR(ast_channel_data(c), "(Empty)") : "(None)",
(ast_test_flag(c, AST_FLAG_BLOCKING) ? ast_channel_blockproc(c) : "(Not Blocking)"));
+3 -3
View File
@@ -85,15 +85,15 @@ static int flash_exec(struct ast_channel *chan, const char *data)
}
memset(&dahdip, 0, sizeof(dahdip));
res = ioctl(chan->fds[0], DAHDI_GET_PARAMS, &dahdip);
res = ioctl(ast_channel_fd(chan, 0), DAHDI_GET_PARAMS, &dahdip);
if (!res) {
if (dahdip.sigtype & __DAHDI_SIG_FXS) {
x = DAHDI_FLASH;
res = ioctl(chan->fds[0], DAHDI_HOOK, &x);
res = ioctl(ast_channel_fd(chan, 0), DAHDI_HOOK, &x);
if (!res || (errno == EINPROGRESS)) {
if (res) {
/* Wait for the event to finish */
dahdi_wait_event(chan->fds[0]);
dahdi_wait_event(ast_channel_fd(chan, 0));
}
res = ast_safe_sleep(chan, 1000);
ast_verb(3, "Flashed channel %s\n", ast_channel_name(chan));
+6 -6
View File
@@ -1286,7 +1286,7 @@ static struct ast_conference *build_conf(const char *confno, const char *pin,
dahdic.chan = 0;
dahdic.confno = cnf->dahdiconf;
dahdic.confmode = DAHDI_CONF_CONFANN | DAHDI_CONF_CONFANNMON;
if (ioctl(cnf->chan->fds[0], DAHDI_SETCONF, &dahdic)) {
if (ioctl(ast_channel_fd(cnf->chan, 0), DAHDI_SETCONF, &dahdic)) {
if (test) {
ast_test_status_update(test, "Error setting conference on pseudo channel\n");
}
@@ -2439,7 +2439,7 @@ static int conf_run(struct ast_channel *chan, struct ast_conference *conf, struc
dahdic.chan = 0;
dahdic.confno = conf->dahdiconf;
dahdic.confmode = DAHDI_CONF_CONFANN | DAHDI_CONF_CONFANNMON;
if (ioctl(conf->lchan->fds[0], DAHDI_SETCONF, &dahdic)) {
if (ioctl(ast_channel_fd(conf->lchan, 0), DAHDI_SETCONF, &dahdic)) {
ast_log(LOG_WARNING, "Error starting listen channel\n");
ast_hangup(conf->lchan);
conf->lchan = NULL;
@@ -2681,7 +2681,7 @@ static int conf_run(struct ast_channel *chan, struct ast_conference *conf, struc
user->dahdichannel = !retrydahdi;
dahdiretry:
origfd = chan->fds[0];
origfd = ast_channel_fd(chan, 0);
if (retrydahdi) {
/* open pseudo in non-blocking mode */
fd = open("/dev/dahdi/pseudo", O_RDWR | O_NONBLOCK);
@@ -2710,7 +2710,7 @@ static int conf_run(struct ast_channel *chan, struct ast_conference *conf, struc
nfds = 1;
} else {
/* XXX Make sure we're not running on a pseudo channel XXX */
fd = chan->fds[0];
fd = ast_channel_fd(chan, 0);
nfds = 0;
}
memset(&dahdic, 0, sizeof(dahdic));
@@ -3218,7 +3218,7 @@ static int conf_run(struct ast_channel *chan, struct ast_conference *conf, struc
if (c) {
char dtmfstr[2] = "";
if (c->fds[0] != origfd || (user->dahdichannel && (ast_channel_audiohooks(c) || ast_channel_monitor(c)))) {
if (ast_channel_fd(c, 0) != origfd || (user->dahdichannel && (ast_channel_audiohooks(c) || ast_channel_monitor(c)))) {
if (using_pseudo) {
/* Kill old pseudo */
close(fd);
@@ -3420,7 +3420,7 @@ static int conf_run(struct ast_channel *chan, struct ast_conference *conf, struc
dahdic.chan = 0;
dahdic.confno = conf->dahdiconf;
dahdic.confmode = DAHDI_CONF_CONFANN | DAHDI_CONF_CONFANNMON;
if (ioctl(conf->lchan->fds[0], DAHDI_SETCONF, &dahdic)) {
if (ioctl(ast_channel_fd(conf->lchan, 0), DAHDI_SETCONF, &dahdic)) {
ast_log(LOG_WARNING, "Error starting listen channel\n");
ast_hangup(conf->lchan);
conf->lchan = NULL;
+1 -1
View File
@@ -5191,7 +5191,7 @@ static int try_calling(struct queue_ent *qe, const char *options, char *announce
struct ast_datastore *tds;
/* detect a blind transfer */
if (!(qe->chan->_softhangup | peer->_softhangup) && (strcasecmp(oldcontext, ast_channel_context(qe->chan)) || strcasecmp(oldexten, ast_channel_exten(qe->chan)))) {
if (!(ast_channel_softhangup_internal_flag(qe->chan) | ast_channel_softhangup_internal_flag(peer)) && (strcasecmp(oldcontext, ast_channel_context(qe->chan)) || strcasecmp(oldexten, ast_channel_exten(qe->chan)))) {
ast_queue_log(queuename, ast_channel_uniqueid(qe->chan), member->membername, "TRANSFER", "%s|%s|%ld|%ld|%d",
ast_channel_exten(qe->chan), ast_channel_context(qe->chan), (long) (callstart - qe->start),
(long) (time(NULL) - callstart), qe->opos);