mirror of
https://github.com/asterisk/asterisk.git
synced 2025-11-16 06:48:25 +00:00
Merge more changes from the resolve-shadow-warnings branch (henceforth known
as RSW since i am too lazy to keep typing it all out). This time a few of the channels. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@136888 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -268,7 +268,7 @@ static void agent_devicestate_cb(const struct ast_event *event, void *unused)
|
|||||||
{
|
{
|
||||||
int res, i;
|
int res, i;
|
||||||
struct agent_pvt *p;
|
struct agent_pvt *p;
|
||||||
char basename[AST_CHANNEL_NAME], *tmp;
|
char base[AST_CHANNEL_NAME], *tmp;
|
||||||
const char *device;
|
const char *device;
|
||||||
enum ast_device_state state;
|
enum ast_device_state state;
|
||||||
|
|
||||||
@@ -297,11 +297,11 @@ static void agent_devicestate_cb(const struct ast_event *event, void *unused)
|
|||||||
AST_LIST_TRAVERSE(&agents, p, list) {
|
AST_LIST_TRAVERSE(&agents, p, list) {
|
||||||
ast_mutex_lock(&p->lock);
|
ast_mutex_lock(&p->lock);
|
||||||
if (p->chan) {
|
if (p->chan) {
|
||||||
ast_copy_string(basename, p->chan->name, sizeof(basename));
|
ast_copy_string(base, p->chan->name, sizeof(base));
|
||||||
if ((tmp = strrchr(basename, '-'))) {
|
if ((tmp = strrchr(base, '-'))) {
|
||||||
*tmp = '\0';
|
*tmp = '\0';
|
||||||
}
|
}
|
||||||
if (strcasecmp(p->chan->name, device) == 0 || strcasecmp(basename, device) == 0) {
|
if (strcasecmp(p->chan->name, device) == 0 || strcasecmp(base, device) == 0) {
|
||||||
p->inherited_devicestate = state;
|
p->inherited_devicestate = state;
|
||||||
ast_devstate_changed(state, "Agent/%s", p->agent);
|
ast_devstate_changed(state, "Agent/%s", p->agent);
|
||||||
}
|
}
|
||||||
@@ -1363,7 +1363,7 @@ static struct ast_channel *agent_request(const char *type, int format, void *dat
|
|||||||
int groupoff;
|
int groupoff;
|
||||||
int waitforagent=0;
|
int waitforagent=0;
|
||||||
int hasagent = 0;
|
int hasagent = 0;
|
||||||
struct timeval tv;
|
struct timeval now;
|
||||||
|
|
||||||
s = data;
|
s = data;
|
||||||
if ((s[0] == '@') && (sscanf(s + 1, "%d", &groupoff) == 1)) {
|
if ((s[0] == '@') && (sscanf(s + 1, "%d", &groupoff) == 1)) {
|
||||||
@@ -1382,8 +1382,8 @@ static struct ast_channel *agent_request(const char *type, int format, void *dat
|
|||||||
ast_strlen_zero(p->loginchan)) {
|
ast_strlen_zero(p->loginchan)) {
|
||||||
if (p->chan)
|
if (p->chan)
|
||||||
hasagent++;
|
hasagent++;
|
||||||
tv = ast_tvnow();
|
now = ast_tvnow();
|
||||||
if (!p->lastdisc.tv_sec || (tv.tv_sec >= p->lastdisc.tv_sec)) {
|
if (!p->lastdisc.tv_sec || (now.tv_sec >= p->lastdisc.tv_sec)) {
|
||||||
p->lastdisc = ast_tv(0, 0);
|
p->lastdisc = ast_tv(0, 0);
|
||||||
/* Agent must be registered, but not have any active call, and not be in a waiting state */
|
/* Agent must be registered, but not have any active call, and not be in a waiting state */
|
||||||
if (!p->owner && p->chan) {
|
if (!p->owner && p->chan) {
|
||||||
@@ -1404,11 +1404,11 @@ static struct ast_channel *agent_request(const char *type, int format, void *dat
|
|||||||
if (!p->pending && ((groupmatch && (p->group & groupmatch)) || !strcmp(data, p->agent))) {
|
if (!p->pending && ((groupmatch && (p->group & groupmatch)) || !strcmp(data, p->agent))) {
|
||||||
if (p->chan || !ast_strlen_zero(p->loginchan))
|
if (p->chan || !ast_strlen_zero(p->loginchan))
|
||||||
hasagent++;
|
hasagent++;
|
||||||
tv = ast_tvnow();
|
now = ast_tvnow();
|
||||||
#if 0
|
#if 0
|
||||||
ast_log(LOG_NOTICE, "Time now: %ld, Time of lastdisc: %ld\n", tv.tv_sec, p->lastdisc.tv_sec);
|
ast_log(LOG_NOTICE, "Time now: %ld, Time of lastdisc: %ld\n", now.tv_sec, p->lastdisc.tv_sec);
|
||||||
#endif
|
#endif
|
||||||
if (!p->lastdisc.tv_sec || (tv.tv_sec >= p->lastdisc.tv_sec)) {
|
if (!p->lastdisc.tv_sec || (now.tv_sec >= p->lastdisc.tv_sec)) {
|
||||||
p->lastdisc = ast_tv(0, 0);
|
p->lastdisc = ast_tv(0, 0);
|
||||||
/* Agent must be registered, but not have any active call, and not be in a waiting state */
|
/* Agent must be registered, but not have any active call, and not be in a waiting state */
|
||||||
if (!p->owner && p->chan) {
|
if (!p->owner && p->chan) {
|
||||||
@@ -1726,7 +1726,7 @@ static char *agents_show(struct ast_cli_entry *e, int cmd, struct ast_cli_args *
|
|||||||
char username[AST_MAX_BUF];
|
char username[AST_MAX_BUF];
|
||||||
char location[AST_MAX_BUF] = "";
|
char location[AST_MAX_BUF] = "";
|
||||||
char talkingto[AST_MAX_BUF] = "";
|
char talkingto[AST_MAX_BUF] = "";
|
||||||
char moh[AST_MAX_BUF];
|
char music[AST_MAX_BUF];
|
||||||
int count_agents = 0; /*!< Number of agents configured */
|
int count_agents = 0; /*!< Number of agents configured */
|
||||||
int online_agents = 0; /*!< Number of online agents */
|
int online_agents = 0; /*!< Number of online agents */
|
||||||
int offline_agents = 0; /*!< Number of offline agents */
|
int offline_agents = 0; /*!< Number of offline agents */
|
||||||
@@ -1780,9 +1780,9 @@ static char *agents_show(struct ast_cli_entry *e, int cmd, struct ast_cli_args *
|
|||||||
offline_agents++;
|
offline_agents++;
|
||||||
}
|
}
|
||||||
if (!ast_strlen_zero(p->moh))
|
if (!ast_strlen_zero(p->moh))
|
||||||
snprintf(moh, sizeof(moh), " (musiconhold is '%s')", p->moh);
|
snprintf(music, sizeof(music), " (musiconhold is '%s')", p->moh);
|
||||||
ast_cli(a->fd, "%-12.12s %s%s%s%s\n", p->agent,
|
ast_cli(a->fd, "%-12.12s %s%s%s%s\n", p->agent,
|
||||||
username, location, talkingto, moh);
|
username, location, talkingto, music);
|
||||||
count_agents++;
|
count_agents++;
|
||||||
}
|
}
|
||||||
ast_mutex_unlock(&p->lock);
|
ast_mutex_unlock(&p->lock);
|
||||||
@@ -1804,7 +1804,7 @@ static char *agents_show_online(struct ast_cli_entry *e, int cmd, struct ast_cli
|
|||||||
char username[AST_MAX_BUF];
|
char username[AST_MAX_BUF];
|
||||||
char location[AST_MAX_BUF] = "";
|
char location[AST_MAX_BUF] = "";
|
||||||
char talkingto[AST_MAX_BUF] = "";
|
char talkingto[AST_MAX_BUF] = "";
|
||||||
char moh[AST_MAX_BUF];
|
char music[AST_MAX_BUF];
|
||||||
int count_agents = 0; /* Number of agents configured */
|
int count_agents = 0; /* Number of agents configured */
|
||||||
int online_agents = 0; /* Number of online agents */
|
int online_agents = 0; /* Number of online agents */
|
||||||
int agent_status = 0; /* 0 means offline, 1 means online */
|
int agent_status = 0; /* 0 means offline, 1 means online */
|
||||||
@@ -1848,9 +1848,9 @@ static char *agents_show_online(struct ast_cli_entry *e, int cmd, struct ast_cli
|
|||||||
strncat(location, " (Confirmed)", sizeof(location) - strlen(location) - 1);
|
strncat(location, " (Confirmed)", sizeof(location) - strlen(location) - 1);
|
||||||
}
|
}
|
||||||
if (!ast_strlen_zero(p->moh))
|
if (!ast_strlen_zero(p->moh))
|
||||||
snprintf(moh, sizeof(moh), " (musiconhold is '%s')", p->moh);
|
snprintf(music, sizeof(music), " (musiconhold is '%s')", p->moh);
|
||||||
if (agent_status)
|
if (agent_status)
|
||||||
ast_cli(a->fd, "%-12.12s %s%s%s%s\n", p->agent, username, location, talkingto, moh);
|
ast_cli(a->fd, "%-12.12s %s%s%s%s\n", p->agent, username, location, talkingto, music);
|
||||||
count_agents++;
|
count_agents++;
|
||||||
ast_mutex_unlock(&p->lock);
|
ast_mutex_unlock(&p->lock);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -560,12 +560,12 @@ static struct ast_channel *alsa_new(struct chan_alsa_pvt *p, int state)
|
|||||||
return tmp;
|
return tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct ast_channel *alsa_request(const char *type, int format, void *data, int *cause)
|
static struct ast_channel *alsa_request(const char *type, int fmt, void *data, int *cause)
|
||||||
{
|
{
|
||||||
int oldformat = format;
|
int oldformat = fmt;
|
||||||
struct ast_channel *tmp = NULL;
|
struct ast_channel *tmp = NULL;
|
||||||
|
|
||||||
if (!(format &= AST_FORMAT_SLINEAR)) {
|
if (!(fmt &= AST_FORMAT_SLINEAR)) {
|
||||||
ast_log(LOG_NOTICE, "Asked to get a channel of format '%d'\n", oldformat);
|
ast_log(LOG_NOTICE, "Asked to get a channel of format '%d'\n", oldformat);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -311,7 +311,7 @@ static int open_stream(struct console_pvt *pvt)
|
|||||||
.suggestedLatency = (1.0 / 50.0), /* 20 ms */
|
.suggestedLatency = (1.0 / 50.0), /* 20 ms */
|
||||||
.device = paNoDevice,
|
.device = paNoDevice,
|
||||||
};
|
};
|
||||||
PaDeviceIndex index, num_devices, def_input, def_output;
|
PaDeviceIndex idx, num_devices, def_input, def_output;
|
||||||
|
|
||||||
if (!(num_devices = Pa_GetDeviceCount()))
|
if (!(num_devices = Pa_GetDeviceCount()))
|
||||||
return res;
|
return res;
|
||||||
@@ -319,23 +319,23 @@ static int open_stream(struct console_pvt *pvt)
|
|||||||
def_input = Pa_GetDefaultInputDevice();
|
def_input = Pa_GetDefaultInputDevice();
|
||||||
def_output = Pa_GetDefaultOutputDevice();
|
def_output = Pa_GetDefaultOutputDevice();
|
||||||
|
|
||||||
for (index = 0;
|
for (idx = 0;
|
||||||
index < num_devices && (input_params.device == paNoDevice
|
idx < num_devices && (input_params.device == paNoDevice
|
||||||
|| output_params.device == paNoDevice);
|
|| output_params.device == paNoDevice);
|
||||||
index++)
|
idx++)
|
||||||
{
|
{
|
||||||
const PaDeviceInfo *dev = Pa_GetDeviceInfo(index);
|
const PaDeviceInfo *dev = Pa_GetDeviceInfo(idx);
|
||||||
|
|
||||||
if (dev->maxInputChannels) {
|
if (dev->maxInputChannels) {
|
||||||
if ( (index == def_input && !strcasecmp(pvt->input_device, "default")) ||
|
if ( (idx == def_input && !strcasecmp(pvt->input_device, "default")) ||
|
||||||
!strcasecmp(pvt->input_device, dev->name) )
|
!strcasecmp(pvt->input_device, dev->name) )
|
||||||
input_params.device = index;
|
input_params.device = idx;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dev->maxOutputChannels) {
|
if (dev->maxOutputChannels) {
|
||||||
if ( (index == def_output && !strcasecmp(pvt->output_device, "default")) ||
|
if ( (idx == def_output && !strcasecmp(pvt->output_device, "default")) ||
|
||||||
!strcasecmp(pvt->output_device, dev->name) )
|
!strcasecmp(pvt->output_device, dev->name) )
|
||||||
output_params.device = index;
|
output_params.device = idx;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -922,7 +922,7 @@ static char *cli_console_mute(struct ast_cli_entry *e, int cmd, struct ast_cli_a
|
|||||||
|
|
||||||
static char *cli_list_available(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
|
static char *cli_list_available(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
|
||||||
{
|
{
|
||||||
PaDeviceIndex index, num, def_input, def_output;
|
PaDeviceIndex idx, num, def_input, def_output;
|
||||||
|
|
||||||
if (cmd == CLI_INIT) {
|
if (cmd == CLI_INIT) {
|
||||||
e->command = "console list available";
|
e->command = "console list available";
|
||||||
@@ -950,16 +950,16 @@ static char *cli_list_available(struct ast_cli_entry *e, int cmd, struct ast_cli
|
|||||||
|
|
||||||
def_input = Pa_GetDefaultInputDevice();
|
def_input = Pa_GetDefaultInputDevice();
|
||||||
def_output = Pa_GetDefaultOutputDevice();
|
def_output = Pa_GetDefaultOutputDevice();
|
||||||
for (index = 0; index < num; index++) {
|
for (idx = 0; idx < num; idx++) {
|
||||||
const PaDeviceInfo *dev = Pa_GetDeviceInfo(index);
|
const PaDeviceInfo *dev = Pa_GetDeviceInfo(idx);
|
||||||
if (!dev)
|
if (!dev)
|
||||||
continue;
|
continue;
|
||||||
ast_cli(a->fd, "=== ---------------------------------------------------------\n"
|
ast_cli(a->fd, "=== ---------------------------------------------------------\n"
|
||||||
"=== Device Name: %s\n", dev->name);
|
"=== Device Name: %s\n", dev->name);
|
||||||
if (dev->maxInputChannels)
|
if (dev->maxInputChannels)
|
||||||
ast_cli(a->fd, "=== ---> %sInput Device\n", (index == def_input) ? "Default " : "");
|
ast_cli(a->fd, "=== ---> %sInput Device\n", (idx == def_input) ? "Default " : "");
|
||||||
if (dev->maxOutputChannels)
|
if (dev->maxOutputChannels)
|
||||||
ast_cli(a->fd, "=== ---> %sOutput Device\n", (index == def_output) ? "Default " : "");
|
ast_cli(a->fd, "=== ---> %sOutput Device\n", (idx == def_output) ? "Default " : "");
|
||||||
ast_cli(a->fd, "=== ---------------------------------------------------------\n===\n");
|
ast_cli(a->fd, "=== ---------------------------------------------------------\n===\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -151,40 +151,40 @@ static void wakeup_sub(struct feature_pvt *p, int a)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static void restore_channel(struct feature_pvt *p, int index)
|
static void restore_channel(struct feature_pvt *p, int idx)
|
||||||
{
|
{
|
||||||
/* Restore timing/alertpipe */
|
/* Restore timing/alertpipe */
|
||||||
p->subs[index].owner->timingfd = p->subs[index].timingfdbackup;
|
p->subs[idx].owner->timingfd = p->subs[idx].timingfdbackup;
|
||||||
p->subs[index].owner->alertpipe[0] = p->subs[index].alertpipebackup[0];
|
p->subs[idx].owner->alertpipe[0] = p->subs[idx].alertpipebackup[0];
|
||||||
p->subs[index].owner->alertpipe[1] = p->subs[index].alertpipebackup[1];
|
p->subs[idx].owner->alertpipe[1] = p->subs[idx].alertpipebackup[1];
|
||||||
ast_channel_set_fd(p->subs[index].owner, AST_ALERT_FD, p->subs[index].alertpipebackup[0]);
|
ast_channel_set_fd(p->subs[idx].owner, AST_ALERT_FD, p->subs[idx].alertpipebackup[0]);
|
||||||
ast_channel_set_fd(p->subs[index].owner, AST_TIMING_FD, p->subs[index].timingfdbackup);
|
ast_channel_set_fd(p->subs[idx].owner, AST_TIMING_FD, p->subs[idx].timingfdbackup);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void update_features(struct feature_pvt *p, int index)
|
static void update_features(struct feature_pvt *p, int idx)
|
||||||
{
|
{
|
||||||
int x;
|
int x;
|
||||||
if (p->subs[index].owner) {
|
if (p->subs[idx].owner) {
|
||||||
for (x=0; x<AST_MAX_FDS; x++) {
|
for (x=0; x<AST_MAX_FDS; x++) {
|
||||||
if (index)
|
if (idx)
|
||||||
ast_channel_set_fd(p->subs[index].owner, x, -1);
|
ast_channel_set_fd(p->subs[idx].owner, x, -1);
|
||||||
else
|
else
|
||||||
ast_channel_set_fd(p->subs[index].owner, x, p->subchan->fds[x]);
|
ast_channel_set_fd(p->subs[idx].owner, x, p->subchan->fds[x]);
|
||||||
}
|
}
|
||||||
if (!index) {
|
if (!idx) {
|
||||||
/* Copy timings from master channel */
|
/* Copy timings from master channel */
|
||||||
p->subs[index].owner->timingfd = p->subchan->timingfd;
|
p->subs[idx].owner->timingfd = p->subchan->timingfd;
|
||||||
p->subs[index].owner->alertpipe[0] = p->subchan->alertpipe[0];
|
p->subs[idx].owner->alertpipe[0] = p->subchan->alertpipe[0];
|
||||||
p->subs[index].owner->alertpipe[1] = p->subchan->alertpipe[1];
|
p->subs[idx].owner->alertpipe[1] = p->subchan->alertpipe[1];
|
||||||
if (p->subs[index].owner->nativeformats != p->subchan->readformat) {
|
if (p->subs[idx].owner->nativeformats != p->subchan->readformat) {
|
||||||
p->subs[index].owner->nativeformats = p->subchan->readformat;
|
p->subs[idx].owner->nativeformats = p->subchan->readformat;
|
||||||
if (p->subs[index].owner->readformat)
|
if (p->subs[idx].owner->readformat)
|
||||||
ast_set_read_format(p->subs[index].owner, p->subs[index].owner->readformat);
|
ast_set_read_format(p->subs[idx].owner, p->subs[idx].owner->readformat);
|
||||||
if (p->subs[index].owner->writeformat)
|
if (p->subs[idx].owner->writeformat)
|
||||||
ast_set_write_format(p->subs[index].owner, p->subs[index].owner->writeformat);
|
ast_set_write_format(p->subs[idx].owner, p->subs[idx].owner->writeformat);
|
||||||
}
|
}
|
||||||
} else{
|
} else{
|
||||||
restore_channel(p, index);
|
restore_channel(p, idx);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -432,7 +432,7 @@ static struct feature_pvt *features_alloc(char *data, int format)
|
|||||||
return tmp;
|
return tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct ast_channel *features_new(struct feature_pvt *p, int state, int index)
|
static struct ast_channel *features_new(struct feature_pvt *p, int state, int idx)
|
||||||
{
|
{
|
||||||
struct ast_channel *tmp;
|
struct ast_channel *tmp;
|
||||||
int x,y;
|
int x,y;
|
||||||
@@ -441,8 +441,8 @@ static struct ast_channel *features_new(struct feature_pvt *p, int state, int in
|
|||||||
ast_log(LOG_WARNING, "Called upon channel with no subchan:(\n");
|
ast_log(LOG_WARNING, "Called upon channel with no subchan:(\n");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
if (p->subs[index].owner) {
|
if (p->subs[idx].owner) {
|
||||||
ast_log(LOG_WARNING, "Called to put index %d already there!\n", index);
|
ast_log(LOG_WARNING, "Called to put index %d already there!\n", idx);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
/* figure out what you want the name to be */
|
/* figure out what you want the name to be */
|
||||||
@@ -451,7 +451,7 @@ static struct ast_channel *features_new(struct feature_pvt *p, int state, int in
|
|||||||
ast_free(b2);
|
ast_free(b2);
|
||||||
asprintf(&b2, "%s/%s-%d", p->tech, p->dest, x);
|
asprintf(&b2, "%s/%s-%d", p->tech, p->dest, x);
|
||||||
for (y=0;y<3;y++) {
|
for (y=0;y<3;y++) {
|
||||||
if (y == index)
|
if (y == idx)
|
||||||
continue;
|
continue;
|
||||||
if (p->subs[y].owner && !strcasecmp(p->subs[y].owner->name, b2))
|
if (p->subs[y].owner && !strcasecmp(p->subs[y].owner->name, b2))
|
||||||
break;
|
break;
|
||||||
@@ -474,7 +474,7 @@ static struct ast_channel *features_new(struct feature_pvt *p, int state, int in
|
|||||||
tmp->rawreadformat = p->subchan->rawreadformat;
|
tmp->rawreadformat = p->subchan->rawreadformat;
|
||||||
tmp->nativeformats = p->subchan->readformat;
|
tmp->nativeformats = p->subchan->readformat;
|
||||||
tmp->tech_pvt = p;
|
tmp->tech_pvt = p;
|
||||||
p->subs[index].owner = tmp;
|
p->subs[idx].owner = tmp;
|
||||||
if (!p->owner)
|
if (!p->owner)
|
||||||
p->owner = tmp;
|
p->owner = tmp;
|
||||||
ast_module_ref(ast_module_info->self);
|
ast_module_ref(ast_module_info->self);
|
||||||
|
|||||||
@@ -161,7 +161,7 @@ struct jingle_container {
|
|||||||
};
|
};
|
||||||
|
|
||||||
static const char desc[] = "Jingle Channel";
|
static const char desc[] = "Jingle Channel";
|
||||||
static const char type[] = "Jingle";
|
static const char channel_type[] = "Jingle";
|
||||||
|
|
||||||
static int global_capability = AST_FORMAT_ULAW | AST_FORMAT_ALAW | AST_FORMAT_GSM | AST_FORMAT_H263;
|
static int global_capability = AST_FORMAT_ULAW | AST_FORMAT_ALAW | AST_FORMAT_GSM | AST_FORMAT_H263;
|
||||||
|
|
||||||
@@ -1464,7 +1464,7 @@ static int jingle_hangup(struct ast_channel *ast)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*! \brief Part of PBX interface */
|
/*! \brief Part of PBX interface */
|
||||||
static struct ast_channel *jingle_request(const char *type, int format, void *data, int *cause)
|
static struct ast_channel *jingle_request(const char *request_type, int format, void *data, int *cause)
|
||||||
{
|
{
|
||||||
struct jingle_pvt *p = NULL;
|
struct jingle_pvt *p = NULL;
|
||||||
struct jingle *client = NULL;
|
struct jingle *client = NULL;
|
||||||
@@ -1882,7 +1882,7 @@ static int load_module(void)
|
|||||||
ast_cli_register_multiple(jingle_cli, ARRAY_LEN(jingle_cli));
|
ast_cli_register_multiple(jingle_cli, ARRAY_LEN(jingle_cli));
|
||||||
/* Make sure we can register our channel type */
|
/* Make sure we can register our channel type */
|
||||||
if (ast_channel_register(&jingle_tech)) {
|
if (ast_channel_register(&jingle_tech)) {
|
||||||
ast_log(LOG_ERROR, "Unable to register channel class %s\n", type);
|
ast_log(LOG_ERROR, "Unable to register channel class %s\n", channel_type);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
@@ -844,18 +844,18 @@ static int phone_write(struct ast_channel *ast, struct ast_frame *frame)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct ast_channel *phone_new(struct phone_pvt *i, int state, char *context)
|
static struct ast_channel *phone_new(struct phone_pvt *i, int state, char *cntx)
|
||||||
{
|
{
|
||||||
struct ast_channel *tmp;
|
struct ast_channel *tmp;
|
||||||
struct phone_codec_data codec;
|
struct phone_codec_data queried_codec;
|
||||||
tmp = ast_channel_alloc(1, state, i->cid_num, i->cid_name, "", i->ext, i->context, 0, "Phone/%s", i->dev + 5);
|
tmp = ast_channel_alloc(1, state, i->cid_num, i->cid_name, "", i->ext, i->context, 0, "Phone/%s", i->dev + 5);
|
||||||
if (tmp) {
|
if (tmp) {
|
||||||
tmp->tech = cur_tech;
|
tmp->tech = cur_tech;
|
||||||
ast_channel_set_fd(tmp, 0, i->fd);
|
ast_channel_set_fd(tmp, 0, i->fd);
|
||||||
/* XXX Switching formats silently causes kernel panics XXX */
|
/* XXX Switching formats silently causes kernel panics XXX */
|
||||||
if (i->mode == MODE_FXS &&
|
if (i->mode == MODE_FXS &&
|
||||||
ioctl(i->fd, PHONE_QUERY_CODEC, &codec) == 0) {
|
ioctl(i->fd, PHONE_QUERY_CODEC, &queried_codec) == 0) {
|
||||||
if (codec.type == LINEAR16)
|
if (queried_codec.type == LINEAR16)
|
||||||
tmp->nativeformats =
|
tmp->nativeformats =
|
||||||
tmp->rawreadformat =
|
tmp->rawreadformat =
|
||||||
tmp->rawwriteformat =
|
tmp->rawwriteformat =
|
||||||
@@ -876,7 +876,7 @@ static struct ast_channel *phone_new(struct phone_pvt *i, int state, char *conte
|
|||||||
if (state == AST_STATE_RING)
|
if (state == AST_STATE_RING)
|
||||||
tmp->rings = 1;
|
tmp->rings = 1;
|
||||||
tmp->tech_pvt = i;
|
tmp->tech_pvt = i;
|
||||||
ast_copy_string(tmp->context, context, sizeof(tmp->context));
|
ast_copy_string(tmp->context, cntx, sizeof(tmp->context));
|
||||||
if (!ast_strlen_zero(i->ext))
|
if (!ast_strlen_zero(i->ext))
|
||||||
ast_copy_string(tmp->exten, i->ext, sizeof(tmp->exten));
|
ast_copy_string(tmp->exten, i->ext, sizeof(tmp->exten));
|
||||||
else
|
else
|
||||||
@@ -1017,7 +1017,7 @@ static void *do_monitor(void *data)
|
|||||||
struct phone_pvt *i;
|
struct phone_pvt *i;
|
||||||
int tonepos = 0;
|
int tonepos = 0;
|
||||||
/* The tone we're playing this round */
|
/* The tone we're playing this round */
|
||||||
struct timeval tv = {0,0};
|
struct timeval wait = {0,0};
|
||||||
int dotone;
|
int dotone;
|
||||||
/* This thread monitors all the frame relay interfaces which are not yet in use
|
/* This thread monitors all the frame relay interfaces which are not yet in use
|
||||||
(and thus do not have a separate thread) indefinitely */
|
(and thus do not have a separate thread) indefinitely */
|
||||||
@@ -1048,7 +1048,7 @@ static void *do_monitor(void *data)
|
|||||||
if (i->dialtone && i->mode != MODE_SIGMA) {
|
if (i->dialtone && i->mode != MODE_SIGMA) {
|
||||||
/* Remember we're going to have to come back and play
|
/* Remember we're going to have to come back and play
|
||||||
more dialtones */
|
more dialtones */
|
||||||
if (ast_tvzero(tv)) {
|
if (ast_tvzero(wait)) {
|
||||||
/* If we're due for a dialtone, play one */
|
/* If we're due for a dialtone, play one */
|
||||||
if (write(i->fd, DialTone + tonepos, 240) != 240)
|
if (write(i->fd, DialTone + tonepos, 240) != 240)
|
||||||
ast_log(LOG_WARNING, "Dial tone write error\n");
|
ast_log(LOG_WARNING, "Dial tone write error\n");
|
||||||
@@ -1068,13 +1068,13 @@ static void *do_monitor(void *data)
|
|||||||
tonepos += 240;
|
tonepos += 240;
|
||||||
if (tonepos >= sizeof(DialTone))
|
if (tonepos >= sizeof(DialTone))
|
||||||
tonepos = 0;
|
tonepos = 0;
|
||||||
if (ast_tvzero(tv)) {
|
if (ast_tvzero(wait)) {
|
||||||
tv = ast_tv(30000, 0);
|
wait = ast_tv(30000, 0);
|
||||||
}
|
}
|
||||||
res = ast_select(n + 1, &rfds, NULL, &efds, &tv);
|
res = ast_select(n + 1, &rfds, NULL, &efds, &wait);
|
||||||
} else {
|
} else {
|
||||||
res = ast_select(n + 1, &rfds, NULL, &efds, NULL);
|
res = ast_select(n + 1, &rfds, NULL, &efds, NULL);
|
||||||
tv = ast_tv(0,0);
|
wait = ast_tv(0,0);
|
||||||
tonepos = 0;
|
tonepos = 0;
|
||||||
}
|
}
|
||||||
/* Okay, select has finished. Let's see what happened. */
|
/* Okay, select has finished. Let's see what happened. */
|
||||||
|
|||||||
Reference in New Issue
Block a user