mirror of
https://github.com/asterisk/asterisk.git
synced 2025-11-02 03:48:02 +00:00
Whitespace changes only
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@114667 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -26,7 +26,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/*** MODULEINFO
|
/*** MODULEINFO
|
||||||
<depend>chan_local</depend>
|
<depend>chan_local</depend>
|
||||||
***/
|
***/
|
||||||
|
|
||||||
|
|
||||||
@@ -1934,9 +1934,9 @@ static int dial_exec_full(struct ast_channel *chan, void *data, struct ast_flags
|
|||||||
}
|
}
|
||||||
if (res != AST_PBX_NO_HANGUP_PEER) {
|
if (res != AST_PBX_NO_HANGUP_PEER) {
|
||||||
if (!ast_check_hangup(peer) && ast_test_flag64(&opts, OPT_CALLEE_GO_ON) && !ast_strlen_zero(opt_args[OPT_ARG_CALLEE_GO_ON])) {
|
if (!ast_check_hangup(peer) && ast_test_flag64(&opts, OPT_CALLEE_GO_ON) && !ast_strlen_zero(opt_args[OPT_ARG_CALLEE_GO_ON])) {
|
||||||
replace_macro_delimiter(opt_args[OPT_ARG_CALLEE_GO_ON]);
|
replace_macro_delimiter(opt_args[OPT_ARG_CALLEE_GO_ON]);
|
||||||
ast_parseable_goto(peer, opt_args[OPT_ARG_CALLEE_GO_ON]);
|
ast_parseable_goto(peer, opt_args[OPT_ARG_CALLEE_GO_ON]);
|
||||||
ast_pbx_start(peer);
|
ast_pbx_start(peer);
|
||||||
} else {
|
} else {
|
||||||
if (!ast_check_hangup(chan))
|
if (!ast_check_hangup(chan))
|
||||||
chan->hangupcause = peer->hangupcause;
|
chan->hangupcause = peer->hangupcause;
|
||||||
|
|||||||
@@ -87,8 +87,8 @@ struct gen_state {
|
|||||||
};
|
};
|
||||||
|
|
||||||
static int eivr_comm(struct ast_channel *chan, struct ivr_localuser *u,
|
static int eivr_comm(struct ast_channel *chan, struct ivr_localuser *u,
|
||||||
int eivr_events_fd, int eivr_commands_fd, int eivr_errors_fd,
|
int eivr_events_fd, int eivr_commands_fd, int eivr_errors_fd,
|
||||||
const char *args);
|
const char *args);
|
||||||
|
|
||||||
int eivr_connect_socket(struct ast_channel *chan, const char *host, int port);
|
int eivr_connect_socket(struct ast_channel *chan, const char *host, int port);
|
||||||
|
|
||||||
|
|||||||
@@ -29,7 +29,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/*** MODULEINFO
|
/*** MODULEINFO
|
||||||
<depend>chan_local</depend>
|
<depend>chan_local</depend>
|
||||||
***/
|
***/
|
||||||
|
|
||||||
#include "asterisk.h"
|
#include "asterisk.h"
|
||||||
|
|||||||
@@ -736,8 +736,9 @@ static void prep_email_sub_vars(struct ast_channel *channel, const struct minivm
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (var = vmu->chanvars ; var ; var = var->next)
|
for (var = vmu->chanvars ; var ; var = var->next) {
|
||||||
pbx_builtin_setvar_helper(channel, var->name, var->value);
|
pbx_builtin_setvar_helper(channel, var->name, var->value);
|
||||||
|
}
|
||||||
|
|
||||||
/* Prepare variables for substition in email body and subject */
|
/* Prepare variables for substition in email body and subject */
|
||||||
pbx_builtin_setvar_helper(channel, "MVM_NAME", vmu->fullname);
|
pbx_builtin_setvar_helper(channel, "MVM_NAME", vmu->fullname);
|
||||||
@@ -2778,12 +2779,12 @@ static int minivm_account_func_read(struct ast_channel *chan, const char *cmd, c
|
|||||||
*/
|
*/
|
||||||
static int vm_lock_path(const char *path)
|
static int vm_lock_path(const char *path)
|
||||||
{
|
{
|
||||||
switch (ast_lock_path(path)) {
|
switch (ast_lock_path(path)) {
|
||||||
case AST_LOCK_TIMEOUT:
|
case AST_LOCK_TIMEOUT:
|
||||||
return -1;
|
return -1;
|
||||||
default:
|
default:
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*! \brief Access counter file, lock directory, read and possibly write it again changed
|
/*! \brief Access counter file, lock directory, read and possibly write it again changed
|
||||||
|
|||||||
@@ -129,7 +129,7 @@ static int parkandannounce_exec(struct ast_channel *chan, void *data)
|
|||||||
ast_verb(4, "Channel %s was answered.\n", dchan->name);
|
ast_verb(4, "Channel %s was answered.\n", dchan->name);
|
||||||
} else {
|
} else {
|
||||||
ast_verb(4, "Channel %s was never answered.\n", dchan->name);
|
ast_verb(4, "Channel %s was never answered.\n", dchan->name);
|
||||||
ast_log(LOG_WARNING, "PARK: Channel %s was never answered for the announce.\n", dchan->name);
|
ast_log(LOG_WARNING, "PARK: Channel %s was never answered for the announce.\n", dchan->name);
|
||||||
ast_hangup(dchan);
|
ast_hangup(dchan);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -75,16 +75,16 @@ static void save_say_mode(const void *arg)
|
|||||||
int i = 0;
|
int i = 0;
|
||||||
say_api_buf[i++] = arg;
|
say_api_buf[i++] = arg;
|
||||||
|
|
||||||
say_api_buf[i++] = ast_say_number_full;
|
say_api_buf[i++] = ast_say_number_full;
|
||||||
say_api_buf[i++] = ast_say_enumeration_full;
|
say_api_buf[i++] = ast_say_enumeration_full;
|
||||||
say_api_buf[i++] = ast_say_digit_str_full;
|
say_api_buf[i++] = ast_say_digit_str_full;
|
||||||
say_api_buf[i++] = ast_say_character_str_full;
|
say_api_buf[i++] = ast_say_character_str_full;
|
||||||
say_api_buf[i++] = ast_say_phonetic_str_full;
|
say_api_buf[i++] = ast_say_phonetic_str_full;
|
||||||
say_api_buf[i++] = ast_say_datetime;
|
say_api_buf[i++] = ast_say_datetime;
|
||||||
say_api_buf[i++] = ast_say_time;
|
say_api_buf[i++] = ast_say_time;
|
||||||
say_api_buf[i++] = ast_say_date;
|
say_api_buf[i++] = ast_say_date;
|
||||||
say_api_buf[i++] = ast_say_datetime_from_now;
|
say_api_buf[i++] = ast_say_datetime_from_now;
|
||||||
say_api_buf[i++] = ast_say_date_with_format;
|
say_api_buf[i++] = ast_say_date_with_format;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void restore_say_mode(void *arg)
|
static void restore_say_mode(void *arg)
|
||||||
@@ -92,16 +92,16 @@ static void restore_say_mode(void *arg)
|
|||||||
int i = 0;
|
int i = 0;
|
||||||
say_api_buf[i++] = arg;
|
say_api_buf[i++] = arg;
|
||||||
|
|
||||||
ast_say_number_full = say_api_buf[i++];
|
ast_say_number_full = say_api_buf[i++];
|
||||||
ast_say_enumeration_full = say_api_buf[i++];
|
ast_say_enumeration_full = say_api_buf[i++];
|
||||||
ast_say_digit_str_full = say_api_buf[i++];
|
ast_say_digit_str_full = say_api_buf[i++];
|
||||||
ast_say_character_str_full = say_api_buf[i++];
|
ast_say_character_str_full = say_api_buf[i++];
|
||||||
ast_say_phonetic_str_full = say_api_buf[i++];
|
ast_say_phonetic_str_full = say_api_buf[i++];
|
||||||
ast_say_datetime = say_api_buf[i++];
|
ast_say_datetime = say_api_buf[i++];
|
||||||
ast_say_time = say_api_buf[i++];
|
ast_say_time = say_api_buf[i++];
|
||||||
ast_say_date = say_api_buf[i++];
|
ast_say_date = say_api_buf[i++];
|
||||||
ast_say_datetime_from_now = say_api_buf[i++];
|
ast_say_datetime_from_now = say_api_buf[i++];
|
||||||
ast_say_date_with_format = say_api_buf[i++];
|
ast_say_date_with_format = say_api_buf[i++];
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -111,25 +111,25 @@ static void restore_say_mode(void *arg)
|
|||||||
* parameter.
|
* parameter.
|
||||||
*/
|
*/
|
||||||
typedef struct {
|
typedef struct {
|
||||||
struct ast_channel *chan;
|
struct ast_channel *chan;
|
||||||
const char *ints;
|
const char *ints;
|
||||||
const char *language;
|
const char *language;
|
||||||
int audiofd;
|
int audiofd;
|
||||||
int ctrlfd;
|
int ctrlfd;
|
||||||
} say_args_t;
|
} say_args_t;
|
||||||
|
|
||||||
static int s_streamwait3(const say_args_t *a, const char *fn)
|
static int s_streamwait3(const say_args_t *a, const char *fn)
|
||||||
{
|
{
|
||||||
int res = ast_streamfile(a->chan, fn, a->language);
|
int res = ast_streamfile(a->chan, fn, a->language);
|
||||||
if (res) {
|
if (res) {
|
||||||
ast_log(LOG_WARNING, "Unable to play message %s\n", fn);
|
ast_log(LOG_WARNING, "Unable to play message %s\n", fn);
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
res = (a->audiofd > -1 && a->ctrlfd > -1) ?
|
res = (a->audiofd > -1 && a->ctrlfd > -1) ?
|
||||||
ast_waitstream_full(a->chan, a->ints, a->audiofd, a->ctrlfd) :
|
ast_waitstream_full(a->chan, a->ints, a->audiofd, a->ctrlfd) :
|
||||||
ast_waitstream(a->chan, a->ints);
|
ast_waitstream(a->chan, a->ints);
|
||||||
ast_stopstream(a->chan);
|
ast_stopstream(a->chan);
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -247,11 +247,11 @@ static int do_say(say_args_t *a, const char *s, const char *options, int depth)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int say_full(struct ast_channel *chan, const char *string,
|
static int say_full(struct ast_channel *chan, const char *string,
|
||||||
const char *ints, const char *lang, const char *options,
|
const char *ints, const char *lang, const char *options,
|
||||||
int audiofd, int ctrlfd)
|
int audiofd, int ctrlfd)
|
||||||
{
|
{
|
||||||
say_args_t a = { chan, ints, lang, audiofd, ctrlfd };
|
say_args_t a = { chan, ints, lang, audiofd, ctrlfd };
|
||||||
return do_say(&a, string, options, 0);
|
return do_say(&a, string, options, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int say_number_full(struct ast_channel *chan, int num,
|
static int say_number_full(struct ast_channel *chan, int num,
|
||||||
@@ -259,9 +259,9 @@ static int say_number_full(struct ast_channel *chan, int num,
|
|||||||
int audiofd, int ctrlfd)
|
int audiofd, int ctrlfd)
|
||||||
{
|
{
|
||||||
char buf[64];
|
char buf[64];
|
||||||
say_args_t a = { chan, ints, lang, audiofd, ctrlfd };
|
say_args_t a = { chan, ints, lang, audiofd, ctrlfd };
|
||||||
snprintf(buf, sizeof(buf), "num:%d", num);
|
snprintf(buf, sizeof(buf), "num:%d", num);
|
||||||
return do_say(&a, buf, options, 0);
|
return do_say(&a, buf, options, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int say_enumeration_full(struct ast_channel *chan, int num,
|
static int say_enumeration_full(struct ast_channel *chan, int num,
|
||||||
@@ -269,9 +269,9 @@ static int say_enumeration_full(struct ast_channel *chan, int num,
|
|||||||
int audiofd, int ctrlfd)
|
int audiofd, int ctrlfd)
|
||||||
{
|
{
|
||||||
char buf[64];
|
char buf[64];
|
||||||
say_args_t a = { chan, ints, lang, audiofd, ctrlfd };
|
say_args_t a = { chan, ints, lang, audiofd, ctrlfd };
|
||||||
snprintf(buf, sizeof(buf), "enum:%d", num);
|
snprintf(buf, sizeof(buf), "enum:%d", num);
|
||||||
return do_say(&a, buf, options, 0);
|
return do_say(&a, buf, options, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int say_date_generic(struct ast_channel *chan, time_t t,
|
static int say_date_generic(struct ast_channel *chan, time_t t,
|
||||||
@@ -280,7 +280,7 @@ static int say_date_generic(struct ast_channel *chan, time_t t,
|
|||||||
char buf[128];
|
char buf[128];
|
||||||
struct ast_tm tm;
|
struct ast_tm tm;
|
||||||
struct timeval tv = { t, 0 };
|
struct timeval tv = { t, 0 };
|
||||||
say_args_t a = { chan, ints, lang, -1, -1 };
|
say_args_t a = { chan, ints, lang, -1, -1 };
|
||||||
if (format == NULL)
|
if (format == NULL)
|
||||||
format = "";
|
format = "";
|
||||||
|
|
||||||
@@ -296,7 +296,7 @@ static int say_date_generic(struct ast_channel *chan, time_t t,
|
|||||||
tm.tm_sec,
|
tm.tm_sec,
|
||||||
tm.tm_wday,
|
tm.tm_wday,
|
||||||
tm.tm_yday);
|
tm.tm_yday);
|
||||||
return do_say(&a, buf, NULL, 0);
|
return do_say(&a, buf, NULL, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int say_date_with_format(struct ast_channel *chan, time_t t,
|
static int say_date_with_format(struct ast_channel *chan, time_t t,
|
||||||
@@ -515,7 +515,7 @@ static int load_module(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ast_cli_register_multiple(cli_playback, sizeof(cli_playback) / sizeof(struct ast_cli_entry));
|
ast_cli_register_multiple(cli_playback, sizeof(cli_playback) / sizeof(struct ast_cli_entry));
|
||||||
return ast_register_application(app, playback_exec, synopsis, descrip);
|
return ast_register_application(app, playback_exec, synopsis, descrip);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -57,7 +57,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/*** MODULEINFO
|
/*** MODULEINFO
|
||||||
<depend>res_monitor</depend>
|
<depend>res_monitor</depend>
|
||||||
***/
|
***/
|
||||||
|
|
||||||
#include "asterisk.h"
|
#include "asterisk.h"
|
||||||
@@ -135,7 +135,7 @@ static const struct strategy {
|
|||||||
#define DEFAULT_TIMEOUT 15
|
#define DEFAULT_TIMEOUT 15
|
||||||
#define RECHECK 1 /*!< Recheck every second to see we we're at the top yet */
|
#define RECHECK 1 /*!< Recheck every second to see we we're at the top yet */
|
||||||
#define MAX_PERIODIC_ANNOUNCEMENTS 10 /*!< The maximum periodic announcements we can have */
|
#define MAX_PERIODIC_ANNOUNCEMENTS 10 /*!< The maximum periodic announcements we can have */
|
||||||
#define DEFAULT_MIN_ANNOUNCE_FREQUENCY 15 /*!< The minimum number of seconds between position announcements
|
#define DEFAULT_MIN_ANNOUNCE_FREQUENCY 15 /*!< The minimum number of seconds between position announcements \
|
||||||
The default value of 15 provides backwards compatibility */
|
The default value of 15 provides backwards compatibility */
|
||||||
#define MAX_QUEUE_BUCKETS 53
|
#define MAX_QUEUE_BUCKETS 53
|
||||||
|
|
||||||
@@ -581,7 +581,7 @@ static void set_queue_variables(struct queue_ent *qe)
|
|||||||
{
|
{
|
||||||
char interfacevar[256]="";
|
char interfacevar[256]="";
|
||||||
float sl = 0;
|
float sl = 0;
|
||||||
|
|
||||||
if (qe->parent->setqueuevar) {
|
if (qe->parent->setqueuevar) {
|
||||||
sl = 0;
|
sl = 0;
|
||||||
if (qe->parent->callscompleted > 0)
|
if (qe->parent->callscompleted > 0)
|
||||||
@@ -1904,10 +1904,11 @@ playout:
|
|||||||
|
|
||||||
/* Don't restart music on hold if we're about to exit the caller from the queue */
|
/* Don't restart music on hold if we're about to exit the caller from the queue */
|
||||||
if (!res) {
|
if (!res) {
|
||||||
if (ringing)
|
if (ringing) {
|
||||||
ast_indicate(qe->chan, AST_CONTROL_RINGING);
|
ast_indicate(qe->chan, AST_CONTROL_RINGING);
|
||||||
else
|
} else {
|
||||||
ast_moh_start(qe->chan, qe->moh, NULL);
|
ast_moh_start(qe->chan, qe->moh, NULL);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
@@ -3113,12 +3114,12 @@ static int try_calling(struct queue_ent *qe, const char *options, char *announce
|
|||||||
case 'H':
|
case 'H':
|
||||||
ast_set_flag(&(bridge_config.features_caller), AST_FEATURE_DISCONNECT);
|
ast_set_flag(&(bridge_config.features_caller), AST_FEATURE_DISCONNECT);
|
||||||
break;
|
break;
|
||||||
case 'k':
|
case 'k':
|
||||||
ast_set_flag(&(bridge_config.features_callee), AST_FEATURE_PARKCALL);
|
ast_set_flag(&(bridge_config.features_callee), AST_FEATURE_PARKCALL);
|
||||||
break;
|
break;
|
||||||
case 'K':
|
case 'K':
|
||||||
ast_set_flag(&(bridge_config.features_caller), AST_FEATURE_PARKCALL);
|
ast_set_flag(&(bridge_config.features_caller), AST_FEATURE_PARKCALL);
|
||||||
break;
|
break;
|
||||||
case 'n':
|
case 'n':
|
||||||
if (qe->parent->strategy == QUEUE_STRATEGY_RRMEMORY || qe->parent->strategy == QUEUE_STRATEGY_LINEAR)
|
if (qe->parent->strategy == QUEUE_STRATEGY_RRMEMORY || qe->parent->strategy == QUEUE_STRATEGY_LINEAR)
|
||||||
(*tries)++;
|
(*tries)++;
|
||||||
@@ -4643,8 +4644,8 @@ static int queue_function_var(struct ast_channel *chan, const char *cmd, char *d
|
|||||||
.name = data,
|
.name = data,
|
||||||
};
|
};
|
||||||
|
|
||||||
char interfacevar[256]="";
|
char interfacevar[256] = "";
|
||||||
float sl = 0;
|
float sl = 0;
|
||||||
|
|
||||||
if (ast_strlen_zero(data)) {
|
if (ast_strlen_zero(data)) {
|
||||||
ast_log(LOG_ERROR, "%s requires an argument: queuename\n", cmd);
|
ast_log(LOG_ERROR, "%s requires an argument: queuename\n", cmd);
|
||||||
@@ -4653,24 +4654,26 @@ static int queue_function_var(struct ast_channel *chan, const char *cmd, char *d
|
|||||||
|
|
||||||
if ((q = ao2_find(queues, &tmpq, OBJ_POINTER))) {
|
if ((q = ao2_find(queues, &tmpq, OBJ_POINTER))) {
|
||||||
ao2_lock(q);
|
ao2_lock(q);
|
||||||
if (q->setqueuevar) {
|
if (q->setqueuevar) {
|
||||||
sl = 0;
|
sl = 0;
|
||||||
res = 0;
|
res = 0;
|
||||||
|
|
||||||
if (q->callscompleted > 0)
|
if (q->callscompleted > 0) {
|
||||||
sl = 100 * ((float) q->callscompletedinsl / (float) q->callscompleted);
|
sl = 100 * ((float) q->callscompletedinsl / (float) q->callscompleted);
|
||||||
|
}
|
||||||
|
|
||||||
snprintf(interfacevar, sizeof(interfacevar),
|
snprintf(interfacevar, sizeof(interfacevar),
|
||||||
"QUEUEMAX=%d,QUEUESTRATEGY=%s,QUEUECALLS=%d,QUEUEHOLDTIME=%d,QUEUECOMPLETED=%d,QUEUEABANDONED=%d,QUEUESRVLEVEL=%d,QUEUESRVLEVELPERF=%2.1f",
|
"QUEUEMAX=%d,QUEUESTRATEGY=%s,QUEUECALLS=%d,QUEUEHOLDTIME=%d,QUEUECOMPLETED=%d,QUEUEABANDONED=%d,QUEUESRVLEVEL=%d,QUEUESRVLEVELPERF=%2.1f",
|
||||||
q->maxlen, int2strat(q->strategy), q->count, q->holdtime, q->callscompleted, q->callsabandoned, q->servicelevel, sl);
|
q->maxlen, int2strat(q->strategy), q->count, q->holdtime, q->callscompleted, q->callsabandoned, q->servicelevel, sl);
|
||||||
|
|
||||||
pbx_builtin_setvar_multiple(chan, interfacevar);
|
pbx_builtin_setvar_multiple(chan, interfacevar);
|
||||||
}
|
}
|
||||||
|
|
||||||
ao2_unlock(q);
|
ao2_unlock(q);
|
||||||
queue_unref(q);
|
queue_unref(q);
|
||||||
} else
|
} else {
|
||||||
ast_log(LOG_WARNING, "queue %s was not found\n", data);
|
ast_log(LOG_WARNING, "queue %s was not found\n", data);
|
||||||
|
}
|
||||||
|
|
||||||
snprintf(buf, len, "%d", res);
|
snprintf(buf, len, "%d", res);
|
||||||
|
|
||||||
@@ -4865,7 +4868,7 @@ static int queue_function_memberpenalty_read(struct ast_channel *chan, const cha
|
|||||||
AST_DECLARE_APP_ARGS(args,
|
AST_DECLARE_APP_ARGS(args,
|
||||||
AST_APP_ARG(queuename);
|
AST_APP_ARG(queuename);
|
||||||
AST_APP_ARG(interface);
|
AST_APP_ARG(interface);
|
||||||
);
|
);
|
||||||
/* Make sure the returned value on error is NULL. */
|
/* Make sure the returned value on error is NULL. */
|
||||||
buf[0] = '\0';
|
buf[0] = '\0';
|
||||||
|
|
||||||
|
|||||||
@@ -202,7 +202,7 @@ enum {DLY_TELEM, DLY_ID, DLY_UNKEY, DLY_CALLTERM};
|
|||||||
enum {REM_MODE_FM, REM_MODE_USB, REM_MODE_LSB, REM_MODE_AM};
|
enum {REM_MODE_FM, REM_MODE_USB, REM_MODE_LSB, REM_MODE_AM};
|
||||||
|
|
||||||
enum {HF_SCAN_OFF, HF_SCAN_DOWN_SLOW, HF_SCAN_DOWN_QUICK,
|
enum {HF_SCAN_OFF, HF_SCAN_DOWN_SLOW, HF_SCAN_DOWN_QUICK,
|
||||||
HF_SCAN_DOWN_FAST, HF_SCAN_UP_SLOW, HF_SCAN_UP_QUICK, HF_SCAN_UP_FAST};
|
HF_SCAN_DOWN_FAST, HF_SCAN_UP_SLOW, HF_SCAN_UP_QUICK, HF_SCAN_UP_FAST};
|
||||||
|
|
||||||
#include "asterisk.h"
|
#include "asterisk.h"
|
||||||
|
|
||||||
|
|||||||
@@ -260,8 +260,9 @@ static void numcpy(char *d, char *s)
|
|||||||
if (*s == '+')
|
if (*s == '+')
|
||||||
*d++ = *s++;
|
*d++ = *s++;
|
||||||
while (*s) {
|
while (*s) {
|
||||||
if (isdigit(*s))
|
if (isdigit(*s)) {
|
||||||
*d++ = *s;
|
*d++ = *s;
|
||||||
|
}
|
||||||
s++;
|
s++;
|
||||||
}
|
}
|
||||||
*d = 0;
|
*d = 0;
|
||||||
@@ -600,8 +601,9 @@ static void unpacksms7(unsigned char *i, unsigned char l, unsigned char *udh, in
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*! \brief unpacks bytes (8 bit encoding) at i, len l septets,
|
/*! \brief unpacks bytes (8 bit encoding) at i, len l septets,
|
||||||
and places in udh and ud setting udhl and udl. udh not used
|
* and places in udh and ud setting udhl and udl. udh not used
|
||||||
if udhi not set */
|
* if udhi not set.
|
||||||
|
*/
|
||||||
static void unpacksms8(unsigned char *i, unsigned char l, unsigned char *udh, int *udhl, unsigned short *ud, int *udl, char udhi)
|
static void unpacksms8(unsigned char *i, unsigned char l, unsigned char *udh, int *udhl, unsigned short *ud, int *udl, char udhi)
|
||||||
{
|
{
|
||||||
unsigned short *o = ud;
|
unsigned short *o = ud;
|
||||||
|
|||||||
@@ -137,8 +137,9 @@ static struct ast_speech_result *find_result(struct ast_speech_result *results,
|
|||||||
char *tmp = NULL;
|
char *tmp = NULL;
|
||||||
int nbest_num = 0, wanted_num = 0, i = 0;
|
int nbest_num = 0, wanted_num = 0, i = 0;
|
||||||
|
|
||||||
if (!result)
|
if (!result) {
|
||||||
return NULL;
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
if ((tmp = strchr(result_num, '/'))) {
|
if ((tmp = strchr(result_num, '/'))) {
|
||||||
*tmp++ = '\0';
|
*tmp++ = '\0';
|
||||||
@@ -167,8 +168,9 @@ static int speech_score(struct ast_channel *chan, const char *cmd, char *data,
|
|||||||
struct ast_speech *speech = find_speech(chan);
|
struct ast_speech *speech = find_speech(chan);
|
||||||
char tmp[128] = "";
|
char tmp[128] = "";
|
||||||
|
|
||||||
if (data == NULL || speech == NULL || !(result = find_result(speech->results, data)))
|
if (data == NULL || speech == NULL || !(result = find_result(speech->results, data))) {
|
||||||
return -1;
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
snprintf(tmp, sizeof(tmp), "%d", result->score);
|
snprintf(tmp, sizeof(tmp), "%d", result->score);
|
||||||
|
|
||||||
@@ -178,65 +180,69 @@ static int speech_score(struct ast_channel *chan, const char *cmd, char *data,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static struct ast_custom_function speech_score_function = {
|
static struct ast_custom_function speech_score_function = {
|
||||||
.name = "SPEECH_SCORE",
|
.name = "SPEECH_SCORE",
|
||||||
.synopsis = "Gets the confidence score of a result.",
|
.synopsis = "Gets the confidence score of a result.",
|
||||||
.syntax = "SPEECH_SCORE([nbest number/]result number)",
|
.syntax = "SPEECH_SCORE([nbest number/]result number)",
|
||||||
.desc =
|
.desc =
|
||||||
"Gets the confidence score of a result.\n",
|
"Gets the confidence score of a result.\n",
|
||||||
.read = speech_score,
|
.read = speech_score,
|
||||||
.write = NULL,
|
.write = NULL,
|
||||||
};
|
};
|
||||||
|
|
||||||
/*! \brief SPEECH_TEXT() Dialplan Function */
|
/*! \brief SPEECH_TEXT() Dialplan Function */
|
||||||
static int speech_text(struct ast_channel *chan, const char *cmd, char *data,
|
static int speech_text(struct ast_channel *chan, const char *cmd, char *data,
|
||||||
char *buf, size_t len)
|
char *buf, size_t len)
|
||||||
{
|
{
|
||||||
struct ast_speech_result *result = NULL;
|
struct ast_speech_result *result = NULL;
|
||||||
struct ast_speech *speech = find_speech(chan);
|
struct ast_speech *speech = find_speech(chan);
|
||||||
|
|
||||||
if (data == NULL || speech == NULL || !(result = find_result(speech->results, data)))
|
if (data == NULL || speech == NULL || !(result = find_result(speech->results, data))) {
|
||||||
return -1;
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
if (result->text != NULL)
|
if (result->text != NULL) {
|
||||||
ast_copy_string(buf, result->text, len);
|
ast_copy_string(buf, result->text, len);
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct ast_custom_function speech_text_function = {
|
static struct ast_custom_function speech_text_function = {
|
||||||
.name = "SPEECH_TEXT",
|
.name = "SPEECH_TEXT",
|
||||||
.synopsis = "Gets the recognized text of a result.",
|
.synopsis = "Gets the recognized text of a result.",
|
||||||
.syntax = "SPEECH_TEXT([nbest number/]result number)",
|
.syntax = "SPEECH_TEXT([nbest number/]result number)",
|
||||||
.desc =
|
.desc =
|
||||||
"Gets the recognized text of a result.\n",
|
"Gets the recognized text of a result.\n",
|
||||||
.read = speech_text,
|
.read = speech_text,
|
||||||
.write = NULL,
|
.write = NULL,
|
||||||
};
|
};
|
||||||
|
|
||||||
/*! \brief SPEECH_GRAMMAR() Dialplan Function */
|
/*! \brief SPEECH_GRAMMAR() Dialplan Function */
|
||||||
static int speech_grammar(struct ast_channel *chan, const char *cmd, char *data,
|
static int speech_grammar(struct ast_channel *chan, const char *cmd, char *data,
|
||||||
char *buf, size_t len)
|
char *buf, size_t len)
|
||||||
{
|
{
|
||||||
struct ast_speech_result *result = NULL;
|
struct ast_speech_result *result = NULL;
|
||||||
struct ast_speech *speech = find_speech(chan);
|
struct ast_speech *speech = find_speech(chan);
|
||||||
|
|
||||||
if (data == NULL || speech == NULL || !(result = find_result(speech->results, data)))
|
if (data == NULL || speech == NULL || !(result = find_result(speech->results, data))) {
|
||||||
return -1;
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
if (result->grammar != NULL)
|
if (result->grammar != NULL) {
|
||||||
ast_copy_string(buf, result->grammar, len);
|
ast_copy_string(buf, result->grammar, len);
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct ast_custom_function speech_grammar_function = {
|
static struct ast_custom_function speech_grammar_function = {
|
||||||
.name = "SPEECH_GRAMMAR",
|
.name = "SPEECH_GRAMMAR",
|
||||||
.synopsis = "Gets the matched grammar of a result if available.",
|
.synopsis = "Gets the matched grammar of a result if available.",
|
||||||
.syntax = "SPEECH_GRAMMAR([nbest number/]result number)",
|
.syntax = "SPEECH_GRAMMAR([nbest number/]result number)",
|
||||||
.desc =
|
.desc =
|
||||||
"Gets the matched grammar of a result if available.\n",
|
"Gets the matched grammar of a result if available.\n",
|
||||||
.read = speech_grammar,
|
.read = speech_grammar,
|
||||||
.write = NULL,
|
.write = NULL,
|
||||||
};
|
};
|
||||||
|
|
||||||
/*! \brief SPEECH_ENGINE() Dialplan Function */
|
/*! \brief SPEECH_ENGINE() Dialplan Function */
|
||||||
@@ -244,8 +250,9 @@ static int speech_engine_write(struct ast_channel *chan, const char *cmd, char *
|
|||||||
{
|
{
|
||||||
struct ast_speech *speech = find_speech(chan);
|
struct ast_speech *speech = find_speech(chan);
|
||||||
|
|
||||||
if (data == NULL || speech == NULL)
|
if (data == NULL || speech == NULL) {
|
||||||
return -1;
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
ast_speech_change(speech, data, value);
|
ast_speech_change(speech, data, value);
|
||||||
|
|
||||||
@@ -329,16 +336,16 @@ static int speech_read(struct ast_channel *chan, const char *cmd, char *data,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static struct ast_custom_function speech_function = {
|
static struct ast_custom_function speech_function = {
|
||||||
.name = "SPEECH",
|
.name = "SPEECH",
|
||||||
.synopsis = "Gets information about speech recognition results.",
|
.synopsis = "Gets information about speech recognition results.",
|
||||||
.syntax = "SPEECH(argument)",
|
.syntax = "SPEECH(argument)",
|
||||||
.desc =
|
.desc =
|
||||||
"Gets information about speech recognition results.\n"
|
"Gets information about speech recognition results.\n"
|
||||||
"status: Returns 1 upon speech object existing, or 0 if not\n"
|
"status: Returns 1 upon speech object existing, or 0 if not\n"
|
||||||
"spoke: Returns 1 if spoker spoke, or 0 if not\n"
|
"spoke: Returns 1 if spoker spoke, or 0 if not\n"
|
||||||
"results: Returns number of results that were recognized\n",
|
"results: Returns number of results that were recognized\n",
|
||||||
.read = speech_read,
|
.read = speech_read,
|
||||||
.write = NULL,
|
.write = NULL,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -645,14 +652,14 @@ static int speech_background(struct ast_channel *chan, void *data)
|
|||||||
if (!strlen(dtmf)) {
|
if (!strlen(dtmf)) {
|
||||||
if (chan->stream == NULL) {
|
if (chan->stream == NULL) {
|
||||||
if (speech->processing_sound != NULL) {
|
if (speech->processing_sound != NULL) {
|
||||||
if (strlen(speech->processing_sound) > 0 && strcasecmp(speech->processing_sound,"none")) {
|
if (strlen(speech->processing_sound) > 0 && strcasecmp(speech->processing_sound, "none")) {
|
||||||
speech_streamfile(chan, speech->processing_sound, chan->language);
|
speech_streamfile(chan, speech->processing_sound, chan->language);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (chan->streamid == -1 && chan->timingfunc == NULL) {
|
} else if (chan->streamid == -1 && chan->timingfunc == NULL) {
|
||||||
ast_stopstream(chan);
|
ast_stopstream(chan);
|
||||||
if (speech->processing_sound != NULL) {
|
if (speech->processing_sound != NULL) {
|
||||||
if (strlen(speech->processing_sound) > 0 && strcasecmp(speech->processing_sound,"none")) {
|
if (strlen(speech->processing_sound) > 0 && strcasecmp(speech->processing_sound, "none")) {
|
||||||
speech_streamfile(chan, speech->processing_sound, chan->language);
|
speech_streamfile(chan, speech->processing_sound, chan->language);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -53,12 +53,12 @@ static int waitforring_exec(struct ast_channel *chan, void *data)
|
|||||||
int ms;
|
int ms;
|
||||||
|
|
||||||
if (!data || (sscanf(data, "%lg", &s) != 1)) {
|
if (!data || (sscanf(data, "%lg", &s) != 1)) {
|
||||||
ast_log(LOG_WARNING, "WaitForRing requires an argument (minimum seconds)\n");
|
ast_log(LOG_WARNING, "WaitForRing requires an argument (minimum seconds)\n");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
ms = s*1000.0;
|
ms = s * 1000.0;
|
||||||
while(ms > 0) {
|
while (ms > 0) {
|
||||||
ms = ast_waitfor(chan, ms);
|
ms = ast_waitfor(chan, ms);
|
||||||
if (ms < 0) {
|
if (ms < 0) {
|
||||||
res = ms;
|
res = ms;
|
||||||
|
|||||||
@@ -66,21 +66,22 @@ static char *descrip =
|
|||||||
static struct ast_channel *get_zap_channel_locked(int num) {
|
static struct ast_channel *get_zap_channel_locked(int num) {
|
||||||
char name[80];
|
char name[80];
|
||||||
|
|
||||||
snprintf(name,sizeof(name),"Zap/%d-1",num);
|
snprintf(name, sizeof(name), "Zap/%d-1", num);
|
||||||
return ast_get_channel_by_name_locked(name);
|
return ast_get_channel_by_name_locked(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int careful_write(int fd, unsigned char *data, int len)
|
static int careful_write(int fd, unsigned char *data, int len)
|
||||||
{
|
{
|
||||||
int res;
|
int res;
|
||||||
while(len) {
|
while (len) {
|
||||||
res = write(fd, data, len);
|
res = write(fd, data, len);
|
||||||
if (res < 1) {
|
if (res < 1) {
|
||||||
if (errno != EAGAIN) {
|
if (errno != EAGAIN) {
|
||||||
ast_log(LOG_WARNING, "Failed to write audio data to conference: %s\n", strerror(errno));
|
ast_log(LOG_WARNING, "Failed to write audio data to conference: %s\n", strerror(errno));
|
||||||
return -1;
|
return -1;
|
||||||
} else
|
} else {
|
||||||
return 0;
|
return 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
len -= res;
|
len -= res;
|
||||||
data += res;
|
data += res;
|
||||||
@@ -104,7 +105,7 @@ static int conf_run(struct ast_channel *chan, int confno, int confflags)
|
|||||||
int origfd;
|
int origfd;
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
char input[4];
|
char input[4];
|
||||||
int ic=0;
|
int ic = 0;
|
||||||
|
|
||||||
ZT_BUFFERINFO bi;
|
ZT_BUFFERINFO bi;
|
||||||
char __buf[CONF_SIZE + AST_FRIENDLY_OFFSET];
|
char __buf[CONF_SIZE + AST_FRIENDLY_OFFSET];
|
||||||
@@ -136,7 +137,7 @@ static int conf_run(struct ast_channel *chan, int confno, int confflags)
|
|||||||
if (flags < 0) {
|
if (flags < 0) {
|
||||||
ast_log(LOG_WARNING, "Unable to get flags: %s\n", strerror(errno));
|
ast_log(LOG_WARNING, "Unable to get flags: %s\n", strerror(errno));
|
||||||
close(fd);
|
close(fd);
|
||||||
goto outrun;
|
goto outrun;
|
||||||
}
|
}
|
||||||
if (fcntl(fd, F_SETFL, flags | O_NONBLOCK)) {
|
if (fcntl(fd, F_SETFL, flags | O_NONBLOCK)) {
|
||||||
ast_log(LOG_WARNING, "Unable to set flags: %s\n", strerror(errno));
|
ast_log(LOG_WARNING, "Unable to set flags: %s\n", strerror(errno));
|
||||||
@@ -154,7 +155,7 @@ static int conf_run(struct ast_channel *chan, int confno, int confflags)
|
|||||||
close(fd);
|
close(fd);
|
||||||
goto outrun;
|
goto outrun;
|
||||||
}
|
}
|
||||||
nfds = 1;
|
nfds = 1;
|
||||||
} else {
|
} else {
|
||||||
/* XXX Make sure we're not running on a pseudo channel XXX */
|
/* XXX Make sure we're not running on a pseudo channel XXX */
|
||||||
fd = chan->fds[0];
|
fd = chan->fds[0];
|
||||||
@@ -162,118 +163,119 @@ static int conf_run(struct ast_channel *chan, int confno, int confflags)
|
|||||||
}
|
}
|
||||||
memset(&ztc, 0, sizeof(ztc));
|
memset(&ztc, 0, sizeof(ztc));
|
||||||
/* Check to see if we're in a conference... */
|
/* Check to see if we're in a conference... */
|
||||||
ztc.chan = 0;
|
ztc.chan = 0;
|
||||||
if (ioctl(fd, ZT_GETCONF, &ztc)) {
|
if (ioctl(fd, ZT_GETCONF, &ztc)) {
|
||||||
ast_log(LOG_WARNING, "Error getting conference\n");
|
ast_log(LOG_WARNING, "Error getting conference\n");
|
||||||
close(fd);
|
close(fd);
|
||||||
goto outrun;
|
goto outrun;
|
||||||
}
|
}
|
||||||
if (ztc.confmode) {
|
if (ztc.confmode) {
|
||||||
/* Whoa, already in a conference... Retry... */
|
/* Whoa, already in a conference... Retry... */
|
||||||
if (!retryzap) {
|
if (!retryzap) {
|
||||||
ast_debug(1, "Zap channel is in a conference already, retrying with pseudo\n");
|
ast_debug(1, "Zap channel is in a conference already, retrying with pseudo\n");
|
||||||
retryzap = 1;
|
retryzap = 1;
|
||||||
|
goto zapretry;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
memset(&ztc, 0, sizeof(ztc));
|
||||||
|
/* Add us to the conference */
|
||||||
|
ztc.chan = 0;
|
||||||
|
ztc.confno = confno;
|
||||||
|
ztc.confmode = ZT_CONF_MONITORBOTH;
|
||||||
|
|
||||||
|
if (ioctl(fd, ZT_SETCONF, &ztc)) {
|
||||||
|
ast_log(LOG_WARNING, "Error setting conference\n");
|
||||||
|
close(fd);
|
||||||
|
goto outrun;
|
||||||
|
}
|
||||||
|
ast_debug(1, "Placed channel %s in ZAP channel %d monitor\n", chan->name, confno);
|
||||||
|
|
||||||
|
for (;;) {
|
||||||
|
outfd = -1;
|
||||||
|
ms = -1;
|
||||||
|
c = ast_waitfor_nandfds(&chan, 1, &fd, nfds, NULL, &outfd, &ms);
|
||||||
|
if (c) {
|
||||||
|
if (c->fds[0] != origfd) {
|
||||||
|
if (retryzap) {
|
||||||
|
/* Kill old pseudo */
|
||||||
|
close(fd);
|
||||||
|
}
|
||||||
|
ast_debug(1, "Ooh, something swapped out under us, starting over\n");
|
||||||
|
retryzap = 0;
|
||||||
goto zapretry;
|
goto zapretry;
|
||||||
}
|
}
|
||||||
}
|
f = ast_read(c);
|
||||||
memset(&ztc, 0, sizeof(ztc));
|
if (!f) {
|
||||||
/* Add us to the conference */
|
break;
|
||||||
ztc.chan = 0;
|
|
||||||
ztc.confno = confno;
|
|
||||||
ztc.confmode = ZT_CONF_MONITORBOTH;
|
|
||||||
|
|
||||||
if (ioctl(fd, ZT_SETCONF, &ztc)) {
|
|
||||||
ast_log(LOG_WARNING, "Error setting conference\n");
|
|
||||||
close(fd);
|
|
||||||
goto outrun;
|
|
||||||
}
|
|
||||||
ast_debug(1, "Placed channel %s in ZAP channel %d monitor\n", chan->name, confno);
|
|
||||||
|
|
||||||
for(;;) {
|
|
||||||
outfd = -1;
|
|
||||||
ms = -1;
|
|
||||||
c = ast_waitfor_nandfds(&chan, 1, &fd, nfds, NULL, &outfd, &ms);
|
|
||||||
if (c) {
|
|
||||||
if (c->fds[0] != origfd) {
|
|
||||||
if (retryzap) {
|
|
||||||
/* Kill old pseudo */
|
|
||||||
close(fd);
|
|
||||||
}
|
|
||||||
ast_debug(1, "Ooh, something swapped out under us, starting over\n");
|
|
||||||
retryzap = 0;
|
|
||||||
goto zapretry;
|
|
||||||
}
|
|
||||||
f = ast_read(c);
|
|
||||||
if (!f)
|
|
||||||
break;
|
|
||||||
if(f->frametype == AST_FRAME_DTMF) {
|
|
||||||
if(f->subclass == '#') {
|
|
||||||
ret = 0;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
else if (f->subclass == '*') {
|
|
||||||
ret = -1;
|
|
||||||
break;
|
|
||||||
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
input[ic++] = f->subclass;
|
|
||||||
}
|
|
||||||
if(ic == 3) {
|
|
||||||
input[ic++] = '\0';
|
|
||||||
ic=0;
|
|
||||||
ret = atoi(input);
|
|
||||||
ast_verb(3, "Zapscan: change channel to %d\n",ret);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (fd != chan->fds[0]) {
|
|
||||||
if (f->frametype == AST_FRAME_VOICE) {
|
|
||||||
if (f->subclass == AST_FORMAT_ULAW) {
|
|
||||||
/* Carefully write */
|
|
||||||
careful_write(fd, f->data, f->datalen);
|
|
||||||
} else
|
|
||||||
ast_log(LOG_WARNING, "Huh? Got a non-ulaw (%d) frame in the conference\n", f->subclass);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
ast_frfree(f);
|
|
||||||
} else if (outfd > -1) {
|
|
||||||
res = read(outfd, buf, CONF_SIZE);
|
|
||||||
if (res > 0) {
|
|
||||||
memset(&fr, 0, sizeof(fr));
|
|
||||||
fr.frametype = AST_FRAME_VOICE;
|
|
||||||
fr.subclass = AST_FORMAT_ULAW;
|
|
||||||
fr.datalen = res;
|
|
||||||
fr.samples = res;
|
|
||||||
fr.data = buf;
|
|
||||||
fr.offset = AST_FRIENDLY_OFFSET;
|
|
||||||
if (ast_write(chan, &fr) < 0) {
|
|
||||||
ast_log(LOG_WARNING, "Unable to write frame to channel: %s\n", strerror(errno));
|
|
||||||
/* break; */
|
|
||||||
}
|
|
||||||
} else
|
|
||||||
ast_log(LOG_WARNING, "Failed to read frame: %s\n", strerror(errno));
|
|
||||||
}
|
}
|
||||||
}
|
if (f->frametype == AST_FRAME_DTMF) {
|
||||||
if (f)
|
if (f->subclass == '#') {
|
||||||
|
ret = 0;
|
||||||
|
break;
|
||||||
|
} else if (f->subclass == '*') {
|
||||||
|
ret = -1;
|
||||||
|
break;
|
||||||
|
} else {
|
||||||
|
input[ic++] = f->subclass;
|
||||||
|
}
|
||||||
|
if (ic == 3) {
|
||||||
|
input[ic++] = '\0';
|
||||||
|
ic = 0;
|
||||||
|
ret = atoi(input);
|
||||||
|
ast_verb(3, "Zapscan: change channel to %d\n", ret);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (fd != chan->fds[0]) {
|
||||||
|
if (f->frametype == AST_FRAME_VOICE) {
|
||||||
|
if (f->subclass == AST_FORMAT_ULAW) {
|
||||||
|
/* Carefully write */
|
||||||
|
careful_write(fd, f->data, f->datalen);
|
||||||
|
} else {
|
||||||
|
ast_log(LOG_WARNING, "Huh? Got a non-ulaw (%d) frame in the conference\n", f->subclass);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ast_frfree(f);
|
||||||
|
} else if (outfd > -1) {
|
||||||
|
res = read(outfd, buf, CONF_SIZE);
|
||||||
|
if (res > 0) {
|
||||||
|
memset(&fr, 0, sizeof(fr));
|
||||||
|
fr.frametype = AST_FRAME_VOICE;
|
||||||
|
fr.subclass = AST_FORMAT_ULAW;
|
||||||
|
fr.datalen = res;
|
||||||
|
fr.samples = res;
|
||||||
|
fr.data = buf;
|
||||||
|
fr.offset = AST_FRIENDLY_OFFSET;
|
||||||
|
if (ast_write(chan, &fr) < 0) {
|
||||||
|
ast_log(LOG_WARNING, "Unable to write frame to channel: %s\n", strerror(errno));
|
||||||
|
/* break; */
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
ast_log(LOG_WARNING, "Failed to read frame: %s\n", strerror(errno));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (f) {
|
||||||
ast_frfree(f);
|
ast_frfree(f);
|
||||||
if (fd != chan->fds[0])
|
}
|
||||||
close(fd);
|
if (fd != chan->fds[0]) {
|
||||||
else {
|
close(fd);
|
||||||
/* Take out of conference */
|
} else {
|
||||||
/* Add us to the conference */
|
/* Take out of conference */
|
||||||
ztc.chan = 0;
|
/* Add us to the conference */
|
||||||
ztc.confno = 0;
|
ztc.chan = 0;
|
||||||
ztc.confmode = 0;
|
ztc.confno = 0;
|
||||||
if (ioctl(fd, ZT_SETCONF, &ztc)) {
|
ztc.confmode = 0;
|
||||||
ast_log(LOG_WARNING, "Error setting conference\n");
|
if (ioctl(fd, ZT_SETCONF, &ztc)) {
|
||||||
}
|
ast_log(LOG_WARNING, "Error setting conference\n");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
outrun:
|
outrun:
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int conf_exec(struct ast_channel *chan, void *data)
|
static int conf_exec(struct ast_channel *chan, void *data)
|
||||||
@@ -282,16 +284,16 @@ static int conf_exec(struct ast_channel *chan, void *data)
|
|||||||
int confflags = 0;
|
int confflags = 0;
|
||||||
int confno = 0;
|
int confno = 0;
|
||||||
char confstr[80] = "", *tmp = NULL;
|
char confstr[80] = "", *tmp = NULL;
|
||||||
struct ast_channel *tempchan = NULL, *lastchan = NULL,*ichan = NULL;
|
struct ast_channel *tempchan = NULL, *lastchan = NULL, *ichan = NULL;
|
||||||
struct ast_frame *f;
|
struct ast_frame *f;
|
||||||
char *desired_group;
|
char *desired_group;
|
||||||
int input=0,search_group=0;
|
int input = 0, search_group = 0;
|
||||||
|
|
||||||
if (chan->_state != AST_STATE_UP)
|
if (chan->_state != AST_STATE_UP)
|
||||||
ast_answer(chan);
|
ast_answer(chan);
|
||||||
|
|
||||||
desired_group = ast_strdupa(data);
|
desired_group = ast_strdupa(data);
|
||||||
if(!ast_strlen_zero(desired_group)) {
|
if (!ast_strlen_zero(desired_group)) {
|
||||||
ast_verb(3, "Scanning for group %s\n", desired_group);
|
ast_verb(3, "Scanning for group %s\n", desired_group);
|
||||||
search_group = 1;
|
search_group = 1;
|
||||||
}
|
}
|
||||||
@@ -299,7 +301,7 @@ static int conf_exec(struct ast_channel *chan, void *data)
|
|||||||
for (;;) {
|
for (;;) {
|
||||||
if (ast_waitfor(chan, 100) < 0)
|
if (ast_waitfor(chan, 100) < 0)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
f = ast_read(chan);
|
f = ast_read(chan);
|
||||||
if (!f)
|
if (!f)
|
||||||
break;
|
break;
|
||||||
@@ -313,15 +315,16 @@ static int conf_exec(struct ast_channel *chan, void *data)
|
|||||||
ichan = get_zap_channel_locked(input);
|
ichan = get_zap_channel_locked(input);
|
||||||
input = 0;
|
input = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
tempchan = ichan ? ichan : ast_channel_walk_locked(tempchan);
|
tempchan = ichan ? ichan : ast_channel_walk_locked(tempchan);
|
||||||
|
|
||||||
if ( !tempchan && !lastchan )
|
if (!tempchan && !lastchan) {
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
if (tempchan && search_group) {
|
if (tempchan && search_group) {
|
||||||
const char *mygroup;
|
const char *mygroup;
|
||||||
if((mygroup = pbx_builtin_getvar_helper(tempchan, "GROUP")) && (!strcmp(mygroup, desired_group))) {
|
if ((mygroup = pbx_builtin_getvar_helper(tempchan, "GROUP")) && (!strcmp(mygroup, desired_group))) {
|
||||||
ast_verb(3, "Found Matching Channel %s in group %s\n", tempchan->name, desired_group);
|
ast_verb(3, "Found Matching Channel %s in group %s\n", tempchan->name, desired_group);
|
||||||
} else {
|
} else {
|
||||||
ast_channel_unlock(tempchan);
|
ast_channel_unlock(tempchan);
|
||||||
@@ -329,21 +332,24 @@ static int conf_exec(struct ast_channel *chan, void *data)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (tempchan && (!strcmp(tempchan->tech->type, "Zap")) && (tempchan != chan) ) {
|
if (tempchan && (!strcmp(tempchan->tech->type, "Zap")) && (tempchan != chan)) {
|
||||||
ast_verb(3, "Zap channel %s is in-use, monitoring...\n", tempchan->name);
|
ast_verb(3, "Zap channel %s is in-use, monitoring...\n", tempchan->name);
|
||||||
ast_copy_string(confstr, tempchan->name, sizeof(confstr));
|
ast_copy_string(confstr, tempchan->name, sizeof(confstr));
|
||||||
ast_channel_unlock(tempchan);
|
ast_channel_unlock(tempchan);
|
||||||
if ((tmp = strchr(confstr,'-'))) {
|
if ((tmp = strchr(confstr, '-'))) {
|
||||||
*tmp = '\0';
|
*tmp = '\0';
|
||||||
}
|
}
|
||||||
confno = atoi(strchr(confstr,'/') + 1);
|
confno = atoi(strchr(confstr, '/') + 1);
|
||||||
ast_stopstream(chan);
|
ast_stopstream(chan);
|
||||||
ast_say_number(chan, confno, AST_DIGIT_ANY, chan->language, (char *) NULL);
|
ast_say_number(chan, confno, AST_DIGIT_ANY, chan->language, (char *) NULL);
|
||||||
res = conf_run(chan, confno, confflags);
|
res = conf_run(chan, confno, confflags);
|
||||||
if (res<0) break;
|
if (res < 0) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
input = res;
|
input = res;
|
||||||
} else if (tempchan)
|
} else if (tempchan) {
|
||||||
ast_channel_unlock(tempchan);
|
ast_channel_unlock(tempchan);
|
||||||
|
}
|
||||||
lastchan = tempchan;
|
lastchan = tempchan;
|
||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
|
|||||||
Reference in New Issue
Block a user