use string fields for some stuff in ast_channel
const-ify some more APIs remove 'type' field from ast_channel, in favor of the one in the channel's tech structure allow string field module users to specify the 'chunk size' for pool allocations update chan_alsa to be compatible with recent const-ification patches git-svn-id: http://svn.digium.com/svn/asterisk/trunk@9060 f38db490-d61c-443f-a65b-d21fe96a405b
This commit is contained in:
parent
4d4470fe15
commit
21d21f89c0
|
@ -1 +1 @@
|
|||
9
|
||||
10
|
||||
|
|
|
@ -58,6 +58,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
|
|||
#include "asterisk/rtp.h"
|
||||
#include "asterisk/manager.h"
|
||||
#include "asterisk/privacy.h"
|
||||
#include "asterisk/stringfields.h"
|
||||
|
||||
static char *tdesc = "Dialing Application";
|
||||
|
||||
|
@ -498,7 +499,7 @@ static struct ast_channel *wait_for_answer(struct ast_channel *in, struct dial_l
|
|||
else
|
||||
newcid = in->exten;
|
||||
o->chan->cid.cid_num = strdup(newcid);
|
||||
ast_copy_string(o->chan->accountcode, winner->accountcode, sizeof(o->chan->accountcode));
|
||||
ast_string_field_set(o->chan, accountcode, winner->accountcode);
|
||||
o->chan->cdrflags = winner->cdrflags;
|
||||
if (!o->chan->cid.cid_num)
|
||||
ast_log(LOG_WARNING, "Out of memory\n");
|
||||
|
@ -513,7 +514,7 @@ static struct ast_channel *wait_for_answer(struct ast_channel *in, struct dial_l
|
|||
if (!o->chan->cid.cid_name)
|
||||
ast_log(LOG_WARNING, "Out of memory\n");
|
||||
}
|
||||
ast_copy_string(o->chan->accountcode, in->accountcode, sizeof(o->chan->accountcode));
|
||||
ast_string_field_set(o->chan, accountcode, in->accountcode);
|
||||
o->chan->cdrflags = in->cdrflags;
|
||||
}
|
||||
|
||||
|
@ -1089,11 +1090,11 @@ static int dial_exec_full(struct ast_channel *chan, void *data, struct ast_flags
|
|||
tmp->chan->cid.cid_ani = strdup(chan->cid.cid_ani);
|
||||
|
||||
/* Copy language from incoming to outgoing */
|
||||
ast_copy_string(tmp->chan->language, chan->language, sizeof(tmp->chan->language));
|
||||
ast_copy_string(tmp->chan->accountcode, chan->accountcode, sizeof(tmp->chan->accountcode));
|
||||
ast_string_field_set(tmp->chan, language, chan->language);
|
||||
ast_string_field_set(tmp->chan, accountcode, chan->accountcode);
|
||||
tmp->chan->cdrflags = chan->cdrflags;
|
||||
if (ast_strlen_zero(tmp->chan->musicclass))
|
||||
ast_copy_string(tmp->chan->musicclass, chan->musicclass, sizeof(tmp->chan->musicclass));
|
||||
ast_string_field_set(tmp->chan, musicclass, chan->musicclass);
|
||||
if (chan->cid.cid_rdnis)
|
||||
tmp->chan->cid.cid_rdnis = strdup(chan->cid.cid_rdnis);
|
||||
/* Pass callingpres setting */
|
||||
|
|
|
@ -47,6 +47,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
|
|||
#include "asterisk/translate.h"
|
||||
#include "asterisk/ulaw.h"
|
||||
#include "asterisk/callerid.h"
|
||||
#include "asterisk/stringfields.h"
|
||||
|
||||
static char *tdesc = "DISA (Direct Inward System Access) Application";
|
||||
|
||||
|
@ -347,7 +348,7 @@ static int disa_exec(struct ast_channel *chan, void *data)
|
|||
}
|
||||
|
||||
if (!ast_strlen_zero(acctcode))
|
||||
ast_copy_string(chan->accountcode, acctcode, sizeof(chan->accountcode));
|
||||
ast_string_field_set(chan, accountcode, acctcode);
|
||||
|
||||
if (special_noanswer) flags.flags = 0;
|
||||
ast_cdr_reset(chan->cdr, &flags);
|
||||
|
|
|
@ -106,7 +106,7 @@ static int ast_serialize_showchan(struct ast_channel *c, char *buf, size_t size)
|
|||
"Data= %s\n"
|
||||
"Blocking_in= %s\n",
|
||||
c->name,
|
||||
c->type,
|
||||
c->tech->type,
|
||||
c->uniqueid,
|
||||
(c->cid.cid_num ? c->cid.cid_num : "(N/A)"),
|
||||
(c->cid.cid_name ? c->cid.cid_name : "(N/A)"),
|
||||
|
|
|
@ -82,7 +82,7 @@ static int flash_exec(struct ast_channel *chan, void *data)
|
|||
struct localuser *u;
|
||||
struct zt_params ztp;
|
||||
LOCAL_USER_ADD(u);
|
||||
if (!strcasecmp(chan->type, "Zap")) {
|
||||
if (!strcasecmp(chan->tech->type, "Zap")) {
|
||||
memset(&ztp, 0, sizeof(ztp));
|
||||
res = ioctl(chan->fds[0], ZT_GET_PARAMS, &ztp);
|
||||
if (!res) {
|
||||
|
|
|
@ -996,7 +996,7 @@ static int conf_run(struct ast_channel *chan, struct ast_conference *conf, int c
|
|||
}
|
||||
|
||||
ast_indicate(chan, -1);
|
||||
retryzap = strcasecmp(chan->type, "Zap");
|
||||
retryzap = strcasecmp(chan->tech->type, "Zap");
|
||||
user->zapchannel = !retryzap;
|
||||
|
||||
zapretry:
|
||||
|
@ -1302,7 +1302,7 @@ static int conf_run(struct ast_channel *chan, struct ast_conference *conf, int c
|
|||
using_pseudo = 0;
|
||||
}
|
||||
ast_log(LOG_DEBUG, "Ooh, something swapped out under us, starting over\n");
|
||||
retryzap = strcasecmp(c->type, "Zap");
|
||||
retryzap = strcasecmp(c->tech->type, "Zap");
|
||||
user->zapchannel = !retryzap;
|
||||
goto zapretry;
|
||||
}
|
||||
|
|
|
@ -91,6 +91,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
|
|||
#include "asterisk/causes.h"
|
||||
#include "asterisk/astdb.h"
|
||||
#include "asterisk/devicestate.h"
|
||||
#include "asterisk/stringfields.h"
|
||||
|
||||
#define QUEUE_STRATEGY_RINGALL 0
|
||||
#define QUEUE_STRATEGY_ROUNDROBIN 1
|
||||
|
@ -1735,7 +1736,7 @@ static struct localuser *wait_for_answer(struct queue_ent *qe, struct localuser
|
|||
if (!o->chan->cid.cid_name)
|
||||
ast_log(LOG_WARNING, "Out of memory\n");
|
||||
}
|
||||
ast_copy_string(o->chan->accountcode, in->accountcode, sizeof(o->chan->accountcode));
|
||||
ast_string_field_set(o->chan, accountcode, in->accountcode);
|
||||
o->chan->cdrflags = in->cdrflags;
|
||||
|
||||
if (in->cid.cid_ani) {
|
||||
|
@ -2182,9 +2183,9 @@ static int try_calling(struct queue_ent *qe, const char *options, char *announce
|
|||
we will always return with -1 so that it is hung up properly after the
|
||||
conversation. */
|
||||
qe->handled++;
|
||||
if (!strcmp(qe->chan->type,"Zap"))
|
||||
if (!strcmp(qe->chan->tech->type, "Zap"))
|
||||
ast_channel_setoption(qe->chan, AST_OPTION_TONE_VERIFY, &nondataquality, sizeof(nondataquality), 0);
|
||||
if (!strcmp(peer->type,"Zap"))
|
||||
if (!strcmp(peer->tech->type, "Zap"))
|
||||
ast_channel_setoption(peer, AST_OPTION_TONE_VERIFY, &nondataquality, sizeof(nondataquality), 0);
|
||||
/* Update parameters for the queue */
|
||||
recalc_holdtime(qe);
|
||||
|
|
|
@ -84,7 +84,7 @@ static int softhangup_exec(struct ast_channel *chan, void *data)
|
|||
/* XXX watch out, i think it is wrong to access c-> after unlocking! */
|
||||
if (all) {
|
||||
/* CAPI is set up like CAPI[foo/bar]/clcnt */
|
||||
if (!strcmp(c->type,"CAPI"))
|
||||
if (!strcmp(c->tech->type, "CAPI"))
|
||||
cut = strrchr(name,'/');
|
||||
/* Basically everything else is Foo/Bar-Z */
|
||||
else
|
||||
|
|
|
@ -113,7 +113,7 @@ static int transfer_exec(struct ast_channel *chan, void *data)
|
|||
tech = dest;
|
||||
dest = slash + 1;
|
||||
/* Allow execution only if the Tech/destination agrees with the type of the channel */
|
||||
if (strncasecmp(chan->type, tech, len)) {
|
||||
if (strncasecmp(chan->tech->type, tech, len)) {
|
||||
pbx_builtin_setvar_helper(chan, "TRANSFERSTATUS", "FAILURE");
|
||||
LOCAL_USER_REMOVE(u);
|
||||
return 0;
|
||||
|
|
|
@ -72,6 +72,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
|
|||
#include "asterisk/localtime.h"
|
||||
#include "asterisk/cli.h"
|
||||
#include "asterisk/utils.h"
|
||||
#include "asterisk/stringfields.h"
|
||||
#ifdef USE_ODBC_STORAGE
|
||||
#include "asterisk/res_odbc.h"
|
||||
#endif
|
||||
|
@ -2655,7 +2656,7 @@ static int resequence_mailbox(struct ast_vm_user *vmu, char *dir)
|
|||
}
|
||||
|
||||
|
||||
static int say_and_wait(struct ast_channel *chan, int num, char *language)
|
||||
static int say_and_wait(struct ast_channel *chan, int num, const char *language)
|
||||
{
|
||||
int d;
|
||||
d = ast_say_number(chan, num, AST_DIGIT_ANY, language, (char *) NULL);
|
||||
|
@ -5150,7 +5151,7 @@ static int vm_execmain(struct ast_channel *chan, void *data)
|
|||
|
||||
/* Set language from config to override channel language */
|
||||
if (!ast_strlen_zero(vmu->language))
|
||||
ast_copy_string(chan->language, vmu->language, sizeof(chan->language));
|
||||
ast_string_field_set(chan, language, vmu->language);
|
||||
create_dirpath(vms.curdir, sizeof(vms.curdir), vmu->context, vms.username, "");
|
||||
/* Retrieve old and new message counts */
|
||||
res = open_mailbox(&vms, vmu, 1);
|
||||
|
|
|
@ -131,7 +131,7 @@ static int conf_run(struct ast_channel *chan, int confno, int confflags)
|
|||
goto outrun;
|
||||
}
|
||||
ast_indicate(chan, -1);
|
||||
retryzap = strcasecmp(chan->type, "Zap");
|
||||
retryzap = strcasecmp(chan->tech->type, "Zap");
|
||||
zapretry:
|
||||
origfd = chan->fds[0];
|
||||
if (retryzap) {
|
||||
|
|
|
@ -217,7 +217,7 @@ static int zapras_exec(struct ast_channel *chan, void *data)
|
|||
/* Answer the channel if it's not up */
|
||||
if (chan->_state != AST_STATE_UP)
|
||||
ast_answer(chan);
|
||||
if (strcasecmp(chan->type, "Zap")) {
|
||||
if (strcasecmp(chan->tech->type, "Zap")) {
|
||||
/* If it's not a zap channel, we're done. Wait a couple of
|
||||
seconds and then hangup... */
|
||||
if (option_verbose > 1)
|
||||
|
|
|
@ -137,7 +137,7 @@ static int conf_run(struct ast_channel *chan, int confno, int confflags)
|
|||
goto outrun;
|
||||
}
|
||||
ast_indicate(chan, -1);
|
||||
retryzap = strcasecmp(chan->type, "Zap");
|
||||
retryzap = strcasecmp(chan->tech->type, "Zap");
|
||||
zapretry:
|
||||
origfd = chan->fds[0];
|
||||
if (retryzap) {
|
||||
|
@ -345,7 +345,7 @@ static int conf_exec(struct ast_channel *chan, void *data)
|
|||
continue;
|
||||
}
|
||||
}
|
||||
if ( tempchan && tempchan->type && (!strcmp(tempchan->type, "Zap")) && (tempchan != chan) ) {
|
||||
if (tempchan && (!strcmp(tempchan->tech->type, "Zap")) && (tempchan != chan) ) {
|
||||
ast_verbose(VERBOSE_PREFIX_3 "Zap channel %s is in-use, monitoring...\n", tempchan->name);
|
||||
ast_copy_string(confstr, tempchan->name, sizeof(confstr));
|
||||
ast_mutex_unlock(&tempchan->lock);
|
||||
|
|
5
cdr.c
5
cdr.c
|
@ -54,6 +54,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
|
|||
#include "asterisk/config.h"
|
||||
#include "asterisk/cli.h"
|
||||
#include "asterisk/module.h"
|
||||
#include "asterisk/stringfields.h"
|
||||
|
||||
/*! Default AMA flag for billing records (CDR's) */
|
||||
int ast_default_amaflags = AST_CDR_DOCUMENTATION;
|
||||
|
@ -535,7 +536,7 @@ int ast_cdr_disposition(struct ast_cdr *cdr, int cause)
|
|||
return res;
|
||||
}
|
||||
|
||||
void ast_cdr_setdestchan(struct ast_cdr *cdr, char *chann)
|
||||
void ast_cdr_setdestchan(struct ast_cdr *cdr, const char *chann)
|
||||
{
|
||||
char *chan;
|
||||
|
||||
|
@ -682,7 +683,7 @@ int ast_cdr_setaccount(struct ast_channel *chan, const char *account)
|
|||
{
|
||||
struct ast_cdr *cdr = chan->cdr;
|
||||
|
||||
ast_copy_string(chan->accountcode, account, sizeof(chan->accountcode));
|
||||
ast_string_field_set(chan, accountcode, account);
|
||||
while (cdr) {
|
||||
if (!ast_test_flag(cdr, AST_CDR_FLAG_LOCKED))
|
||||
ast_copy_string(cdr->accountcode, chan->accountcode, sizeof(cdr->accountcode));
|
||||
|
|
41
channel.c
41
channel.c
|
@ -604,6 +604,8 @@ struct ast_channel *ast_channel_alloc(int needqueue)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
ast_string_field_init(tmp, 128);
|
||||
|
||||
/* Don't bother initializing the last two FD here, because they
|
||||
will *always* be set just a few lines down (AST_TIMING_FD,
|
||||
AST_ALERT_FD). */
|
||||
|
@ -642,7 +644,7 @@ struct ast_channel *ast_channel_alloc(int needqueue)
|
|||
tmp->fds[AST_ALERT_FD] = tmp->alertpipe[0];
|
||||
/* And timing pipe */
|
||||
tmp->fds[AST_TIMING_FD] = tmp->timingfd;
|
||||
strcpy(tmp->name, "**Unknown**");
|
||||
ast_string_field_set(tmp, name, "**Unknown**");
|
||||
/* Initial state */
|
||||
tmp->_state = AST_STATE_DOWN;
|
||||
tmp->streamid = -1;
|
||||
|
@ -657,11 +659,11 @@ struct ast_channel *ast_channel_alloc(int needqueue)
|
|||
ast_mutex_init(&tmp->lock);
|
||||
AST_LIST_HEAD_INIT_NOLOCK(headp);
|
||||
strcpy(tmp->context, "default");
|
||||
ast_copy_string(tmp->language, defaultlanguage, sizeof(tmp->language));
|
||||
ast_string_field_set(tmp, language, defaultlanguage);
|
||||
strcpy(tmp->exten, "s");
|
||||
tmp->priority = 1;
|
||||
tmp->amaflags = ast_default_amaflags;
|
||||
ast_copy_string(tmp->accountcode, ast_default_accountcode, sizeof(tmp->accountcode));
|
||||
ast_string_field_set(tmp, accountcode, ast_default_accountcode);
|
||||
|
||||
tmp->tech = &null_tech;
|
||||
|
||||
|
@ -2805,10 +2807,8 @@ int ast_channel_masquerade(struct ast_channel *original, struct ast_channel *clo
|
|||
|
||||
void ast_change_name(struct ast_channel *chan, char *newname)
|
||||
{
|
||||
char tmp[256];
|
||||
ast_copy_string(tmp, chan->name, sizeof(tmp));
|
||||
ast_copy_string(chan->name, newname, sizeof(chan->name));
|
||||
manager_event(EVENT_FLAG_CALL, "Rename", "Oldname: %s\r\nNewname: %s\r\nUniqueid: %s\r\n", tmp, chan->name, chan->uniqueid);
|
||||
manager_event(EVENT_FLAG_CALL, "Rename", "Oldname: %s\r\nNewname: %s\r\nUniqueid: %s\r\n", chan->name, newname, chan->uniqueid);
|
||||
ast_string_field_set(chan, name, newname);
|
||||
}
|
||||
|
||||
void ast_channel_inherit_variables(const struct ast_channel *parent, struct ast_channel *child)
|
||||
|
@ -2941,10 +2941,10 @@ int ast_do_masquerade(struct ast_channel *original)
|
|||
snprintf(masqn, sizeof(masqn), "%s<MASQ>", newn);
|
||||
|
||||
/* Copy the name from the clone channel */
|
||||
ast_copy_string(original->name, newn, sizeof(original->name));
|
||||
ast_string_field_set(original, name, newn);
|
||||
|
||||
/* Mangle the name of the clone channel */
|
||||
ast_copy_string(clone->name, masqn, sizeof(clone->name));
|
||||
ast_string_field_set(clone, name, masqn);
|
||||
|
||||
/* Notify any managers of the change, first the masq then the other */
|
||||
manager_event(EVENT_FLAG_CALL, "Rename", "Oldname: %s\r\nNewname: %s\r\nUniqueid: %s\r\n", newn, masqn, clone->uniqueid);
|
||||
|
@ -3026,17 +3026,16 @@ int ast_do_masquerade(struct ast_channel *original)
|
|||
|
||||
snprintf(zombn, sizeof(zombn), "%s<ZOMBIE>", orig);
|
||||
/* Mangle the name of the clone channel */
|
||||
ast_copy_string(clone->name, zombn, sizeof(clone->name));
|
||||
ast_string_field_set(clone, name, zombn);
|
||||
manager_event(EVENT_FLAG_CALL, "Rename", "Oldname: %s\r\nNewname: %s\r\nUniqueid: %s\r\n", masqn, zombn, clone->uniqueid);
|
||||
|
||||
/* Update the type. */
|
||||
original->type = clone->type;
|
||||
t_pvt = original->monitor;
|
||||
original->monitor = clone->monitor;
|
||||
clone->monitor = t_pvt;
|
||||
|
||||
/* Keep the same language. */
|
||||
ast_copy_string(original->language, clone->language, sizeof(original->language));
|
||||
ast_string_field_set(original, language, clone->language);
|
||||
/* Copy the FD's other than the generator fd */
|
||||
for (x = 0; x < AST_MAX_FDS; x++) {
|
||||
if (x != AST_GENERATOR_FD)
|
||||
|
@ -3079,7 +3078,7 @@ int ast_do_masquerade(struct ast_channel *original)
|
|||
ast_set_read_format(original, rformat);
|
||||
|
||||
/* Copy the music class */
|
||||
ast_copy_string(original->musicclass, clone->musicclass, sizeof(original->musicclass));
|
||||
ast_string_field_set(original, musicclass, clone->musicclass);
|
||||
|
||||
ast_log(LOG_DEBUG, "Putting channel %s in %d/%d formats\n", original->name, wformat, rformat);
|
||||
|
||||
|
@ -3089,13 +3088,13 @@ int ast_do_masquerade(struct ast_channel *original)
|
|||
res = original->tech->fixup(clone, original);
|
||||
if (res) {
|
||||
ast_log(LOG_WARNING, "Channel for type '%s' could not fixup channel %s\n",
|
||||
original->type, original->name);
|
||||
original->tech->type, original->name);
|
||||
ast_mutex_unlock(&clone->lock);
|
||||
return -1;
|
||||
}
|
||||
} else
|
||||
ast_log(LOG_WARNING, "Channel type '%s' does not have a fixup routine (for %s)! Bad things may happen.\n",
|
||||
original->type, original->name);
|
||||
original->tech->type, original->name);
|
||||
|
||||
/* Now, at this point, the "clone" channel is totally F'd up. We mark it as
|
||||
a zombie so nothing tries to touch it. If it's already been marked as a
|
||||
|
@ -3775,15 +3774,13 @@ ast_group_t ast_get_group(char *s)
|
|||
return group;
|
||||
}
|
||||
|
||||
static int (*ast_moh_start_ptr)(struct ast_channel *, char *) = NULL;
|
||||
static int (*ast_moh_start_ptr)(struct ast_channel *, const char *) = NULL;
|
||||
static void (*ast_moh_stop_ptr)(struct ast_channel *) = NULL;
|
||||
static void (*ast_moh_cleanup_ptr)(struct ast_channel *) = NULL;
|
||||
|
||||
|
||||
void ast_install_music_functions(int (*start_ptr)(struct ast_channel *, char *),
|
||||
void (*stop_ptr)(struct ast_channel *),
|
||||
void (*cleanup_ptr)(struct ast_channel *)
|
||||
)
|
||||
void ast_install_music_functions(int (*start_ptr)(struct ast_channel *, const char *),
|
||||
void (*stop_ptr)(struct ast_channel *),
|
||||
void (*cleanup_ptr)(struct ast_channel *))
|
||||
{
|
||||
ast_moh_start_ptr = start_ptr;
|
||||
ast_moh_stop_ptr = stop_ptr;
|
||||
|
@ -3798,7 +3795,7 @@ void ast_uninstall_music_functions(void)
|
|||
}
|
||||
|
||||
/*! \brief Turn on music on hold on a given channel */
|
||||
int ast_moh_start(struct ast_channel *chan, char *mclass)
|
||||
int ast_moh_start(struct ast_channel *chan, const char *mclass)
|
||||
{
|
||||
if (ast_moh_start_ptr)
|
||||
return ast_moh_start_ptr(chan, mclass);
|
||||
|
|
|
@ -71,9 +71,9 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
|
|||
#include "asterisk/astdb.h"
|
||||
#include "asterisk/devicestate.h"
|
||||
#include "asterisk/monitor.h"
|
||||
#include "asterisk/stringfields.h"
|
||||
|
||||
static const char desc[] = "Agent Proxy Channel";
|
||||
static const char channeltype[] = "Agent";
|
||||
static const char tdesc[] = "Call Agent Proxy Channel";
|
||||
static const char config[] = "agents.conf";
|
||||
|
||||
|
@ -257,7 +257,7 @@ static struct ast_channel *agent_bridgedchannel(struct ast_channel *chan, struct
|
|||
static void set_agentbycallerid(const char *callerid, const char *agent);
|
||||
|
||||
static const struct ast_channel_tech agent_tech = {
|
||||
.type = channeltype,
|
||||
.type = "Agent",
|
||||
.description = tdesc,
|
||||
.capabilities = -1,
|
||||
.requester = agent_request,
|
||||
|
@ -520,7 +520,7 @@ static struct ast_frame *agent_read(struct ast_channel *ast)
|
|||
|
||||
CLEANUP(ast,p);
|
||||
if (p->chan && !p->chan->_bridge) {
|
||||
if (strcasecmp(p->chan->type, "Local")) {
|
||||
if (strcasecmp(p->chan->tech->type, "Local")) {
|
||||
p->chan->_bridge = ast;
|
||||
if (p->chan)
|
||||
ast_log(LOG_DEBUG, "Bridge on '%s' being set to '%s' (3)\n", p->chan->name, p->chan->_bridge->name);
|
||||
|
@ -913,7 +913,7 @@ static struct ast_channel *agent_new(struct agent_pvt *p, int state)
|
|||
tmp->rawwriteformat = p->chan->writeformat;
|
||||
tmp->readformat = p->chan->readformat;
|
||||
tmp->rawreadformat = p->chan->readformat;
|
||||
ast_copy_string(tmp->language, p->chan->language, sizeof(tmp->language));
|
||||
ast_string_field_set(tmp, language, p->chan->language);
|
||||
ast_copy_string(tmp->context, p->chan->context, sizeof(tmp->context));
|
||||
ast_copy_string(tmp->exten, p->chan->exten, sizeof(tmp->exten));
|
||||
} else {
|
||||
|
@ -924,10 +924,9 @@ static struct ast_channel *agent_new(struct agent_pvt *p, int state)
|
|||
tmp->rawreadformat = AST_FORMAT_SLINEAR;
|
||||
}
|
||||
if (p->pending)
|
||||
snprintf(tmp->name, sizeof(tmp->name), "Agent/P%s-%d", p->agent, rand() & 0xffff);
|
||||
ast_string_field_build(tmp, name, "Agent/P%s-%d", p->agent, rand() & 0xffff);
|
||||
else
|
||||
snprintf(tmp->name, sizeof(tmp->name), "Agent/%s", p->agent);
|
||||
tmp->type = channeltype;
|
||||
ast_string_field_build(tmp, name, "Agent/%s", p->agent);
|
||||
/* Safe, agentlock already held */
|
||||
ast_setstate(tmp, state);
|
||||
tmp->tech_pvt = p;
|
||||
|
@ -2491,7 +2490,7 @@ int load_module()
|
|||
{
|
||||
/* Make sure we can register our agent channel type */
|
||||
if (ast_channel_register(&agent_tech)) {
|
||||
ast_log(LOG_ERROR, "Unable to register channel class %s\n", channeltype);
|
||||
ast_log(LOG_ERROR, "Unable to register channel class 'Agent'\n");
|
||||
return -1;
|
||||
}
|
||||
/* Dialplan applications */
|
||||
|
|
|
@ -56,6 +56,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
|
|||
#include "asterisk/utils.h"
|
||||
#include "asterisk/causes.h"
|
||||
#include "asterisk/endian.h"
|
||||
#include "asterisk/stringfields.h"
|
||||
|
||||
#include "busy.h"
|
||||
#include "ringtone.h"
|
||||
|
@ -105,7 +106,6 @@ static int silencethreshold = 1000;
|
|||
AST_MUTEX_DEFINE_STATIC(usecnt_lock);
|
||||
AST_MUTEX_DEFINE_STATIC(alsalock);
|
||||
|
||||
static const char type[] = "Console";
|
||||
static const char desc[] = "ALSA Console Channel Driver";
|
||||
static const char tdesc[] = "ALSA Console Channel Driver";
|
||||
static const char config[] = "alsa.conf";
|
||||
|
@ -184,7 +184,7 @@ static int alsa_indicate(struct ast_channel *chan, int cond);
|
|||
static int alsa_fixup(struct ast_channel *oldchan, struct ast_channel *newchan);
|
||||
|
||||
static const struct ast_channel_tech alsa_tech = {
|
||||
.type = type,
|
||||
.type = "Console",
|
||||
.description = tdesc,
|
||||
.capabilities = AST_FORMAT_SLINEAR,
|
||||
.requester = alsa_request,
|
||||
|
@ -681,7 +681,7 @@ static struct ast_frame *alsa_read(struct ast_channel *chan)
|
|||
f.datalen = 0;
|
||||
f.data = NULL;
|
||||
f.offset = 0;
|
||||
f.src = type;
|
||||
f.src = "Console";
|
||||
f.mallocd = 0;
|
||||
f.delivery.tv_sec = 0;
|
||||
f.delivery.tv_usec = 0;
|
||||
|
@ -727,7 +727,7 @@ static struct ast_frame *alsa_read(struct ast_channel *chan)
|
|||
f.datalen = FRAME_SIZE * 2;
|
||||
f.data = buf;
|
||||
f.offset = AST_FRIENDLY_OFFSET;
|
||||
f.src = type;
|
||||
f.src = "Console";
|
||||
f.mallocd = 0;
|
||||
#ifdef ALSA_MONITOR
|
||||
alsa_monitor_read((char *)buf, FRAME_SIZE * 2);
|
||||
|
@ -784,8 +784,7 @@ static struct ast_channel *alsa_new(struct chan_alsa_pvt *p, int state)
|
|||
tmp = ast_channel_alloc(1);
|
||||
if (tmp) {
|
||||
tmp->tech = &alsa_tech;
|
||||
snprintf(tmp->name, sizeof(tmp->name), "ALSA/%s", indevname);
|
||||
tmp->type = type;
|
||||
ast_string_field_build(tmp, name, "ALSA/%s", indevname);
|
||||
tmp->fds[0] = readdev;
|
||||
tmp->nativeformats = AST_FORMAT_SLINEAR;
|
||||
tmp->readformat = AST_FORMAT_SLINEAR;
|
||||
|
@ -796,7 +795,7 @@ static struct ast_channel *alsa_new(struct chan_alsa_pvt *p, int state)
|
|||
if (!ast_strlen_zero(p->exten))
|
||||
ast_copy_string(tmp->exten, p->exten, sizeof(tmp->exten));
|
||||
if (!ast_strlen_zero(language))
|
||||
ast_copy_string(tmp->language, language, sizeof(tmp->language));
|
||||
ast_string_field_set(tmp, language, language);
|
||||
p->owner = tmp;
|
||||
ast_setstate(tmp, state);
|
||||
ast_mutex_lock(&usecnt_lock);
|
||||
|
@ -857,7 +856,7 @@ static int console_autoanswer(int fd, int argc, char *argv[])
|
|||
return res;
|
||||
}
|
||||
|
||||
static char *autoanswer_complete(char *line, char *word, int pos, int state)
|
||||
static char *autoanswer_complete(const char *line, const char *word, int pos, int state)
|
||||
{
|
||||
#ifndef MIN
|
||||
#define MIN(a,b) ((a) < (b) ? (a) : (b))
|
||||
|
@ -875,7 +874,7 @@ static char *autoanswer_complete(char *line, char *word, int pos, int state)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
static char autoanswer_usage[] =
|
||||
static const char autoanswer_usage[] =
|
||||
"Usage: autoanswer [on|off]\n"
|
||||
" Enables or disables autoanswer feature. If used without\n"
|
||||
" argument, displays the current on/off status of autoanswer.\n"
|
||||
|
@ -1088,7 +1087,7 @@ int load_module()
|
|||
|
||||
res = ast_channel_register(&alsa_tech);
|
||||
if (res < 0) {
|
||||
ast_log(LOG_ERROR, "Unable to register channel class '%s'\n", type);
|
||||
ast_log(LOG_ERROR, "Unable to register channel class 'Console'\n");
|
||||
return -1;
|
||||
}
|
||||
for (x=0;x<sizeof(myclis)/sizeof(struct ast_cli_entry); x++)
|
||||
|
|
|
@ -61,9 +61,9 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
|
|||
#include "asterisk/app.h"
|
||||
#include "asterisk/musiconhold.h"
|
||||
#include "asterisk/manager.h"
|
||||
#include "asterisk/stringfields.h"
|
||||
|
||||
static const char desc[] = "Feature Proxy Channel";
|
||||
static const char type[] = "Feature";
|
||||
static const char tdesc[] = "Feature Proxy Channel Driver";
|
||||
|
||||
static int usecnt =0;
|
||||
|
@ -106,7 +106,7 @@ static int features_indicate(struct ast_channel *ast, int condition);
|
|||
static int features_fixup(struct ast_channel *oldchan, struct ast_channel *newchan);
|
||||
|
||||
static const struct ast_channel_tech features_tech = {
|
||||
.type = type,
|
||||
.type = "Feature",
|
||||
.description = tdesc,
|
||||
.capabilities = -1,
|
||||
.requester = features_request,
|
||||
|
@ -349,8 +349,8 @@ static int features_call(struct ast_channel *ast, char *dest, int timeout)
|
|||
p->subchan->cid.cid_ani = NULL;
|
||||
|
||||
p->subchan->cid.cid_pres = p->owner->cid.cid_pres;
|
||||
strncpy(p->subchan->language, p->owner->language, sizeof(p->subchan->language) - 1);
|
||||
strncpy(p->subchan->accountcode, p->owner->accountcode, sizeof(p->subchan->accountcode) - 1);
|
||||
ast_string_field_set(p->subchan, language, p->owner->language);
|
||||
ast_string_field_set(p->subchan, accountcode, p->owner->accountcode);
|
||||
p->subchan->cdrflags = p->owner->cdrflags;
|
||||
res = ast_call(p->subchan, dest2, timeout);
|
||||
update_features(p, x);
|
||||
|
@ -464,7 +464,7 @@ static struct ast_channel *features_new(struct feature_pvt *p, int state, int in
|
|||
}
|
||||
tmp->tech = &features_tech;
|
||||
for (x=1;x<4;x++) {
|
||||
snprintf(tmp->name, sizeof(tmp->name), "Feature/%s/%s-%d", p->tech, p->dest, x);
|
||||
ast_string_field_build(tmp, name, "Feature/%s/%s-%d", p->tech, p->dest, x);
|
||||
for (y=0;y<3;y++) {
|
||||
if (y == index)
|
||||
continue;
|
||||
|
@ -474,7 +474,6 @@ static struct ast_channel *features_new(struct feature_pvt *p, int state, int in
|
|||
if (y >= 3)
|
||||
break;
|
||||
}
|
||||
tmp->type = type;
|
||||
ast_setstate(tmp, state);
|
||||
tmp->writeformat = p->subchan->writeformat;
|
||||
tmp->rawwriteformat = p->subchan->rawwriteformat;
|
||||
|
@ -540,7 +539,7 @@ int load_module()
|
|||
{
|
||||
/* Make sure we can register our sip channel type */
|
||||
if (ast_channel_register(&features_tech)) {
|
||||
ast_log(LOG_ERROR, "Unable to register channel class %s\n", type);
|
||||
ast_log(LOG_ERROR, "Unable to register channel class 'Feature'\n");
|
||||
return -1;
|
||||
}
|
||||
ast_cli_register(&cli_show_features);
|
||||
|
|
|
@ -90,6 +90,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
|
|||
#include "asterisk/dnsmgr.h"
|
||||
#include "asterisk/devicestate.h"
|
||||
#include "asterisk/netsock.h"
|
||||
#include "asterisk/stringfields.h"
|
||||
|
||||
#include "iax2.h"
|
||||
#include "iax2-parser.h"
|
||||
|
@ -141,7 +142,6 @@ static struct ast_codec_pref prefs;
|
|||
|
||||
static const char desc[] = "Inter Asterisk eXchange (Ver 2)";
|
||||
static const char tdesc[] = "Inter Asterisk eXchange Driver (Ver 2)";
|
||||
static const char channeltype[] = "IAX2";
|
||||
|
||||
static char context[80] = "default";
|
||||
|
||||
|
@ -747,7 +747,7 @@ static int iax2_transfer(struct ast_channel *c, const char *dest);
|
|||
static int iax2_fixup(struct ast_channel *oldchannel, struct ast_channel *newchan);
|
||||
|
||||
static const struct ast_channel_tech iax2_tech = {
|
||||
.type = channeltype,
|
||||
.type = "IAX2",
|
||||
.description = tdesc,
|
||||
.capabilities = IAX_CAPABILITY_FULLBANDWIDTH,
|
||||
.properties = AST_CHAN_TP_WANTSJITTER,
|
||||
|
@ -3175,16 +3175,16 @@ static enum ast_bridge_result iax2_bridge(struct ast_channel *c0, struct ast_cha
|
|||
cs[1] = c1;
|
||||
for (/* ever */;;) {
|
||||
/* Check in case we got masqueraded into */
|
||||
if ((c0->type != channeltype) || (c1->type != channeltype)) {
|
||||
if ((c0->tech != &iax2_tech) || (c1->tech != &iax2_tech)) {
|
||||
if (option_verbose > 2)
|
||||
ast_verbose(VERBOSE_PREFIX_3 "Can't masquerade, we're different...\n");
|
||||
/* Remove from native mode */
|
||||
if (c0->type == channeltype) {
|
||||
if (c0->tech == &iax2_tech) {
|
||||
ast_mutex_lock(&iaxsl[callno0]);
|
||||
iaxs[callno0]->bridgecallno = 0;
|
||||
ast_mutex_unlock(&iaxsl[callno0]);
|
||||
}
|
||||
if (c1->type == channeltype) {
|
||||
if (c1->tech == &iax2_tech) {
|
||||
ast_mutex_lock(&iaxsl[callno1]);
|
||||
iaxs[callno1]->bridgecallno = 0;
|
||||
ast_mutex_unlock(&iaxsl[callno1]);
|
||||
|
@ -3387,8 +3387,7 @@ static struct ast_channel *ast_iax2_new(int callno, int state, int capability)
|
|||
i = iaxs[callno];
|
||||
if (i && tmp) {
|
||||
tmp->tech = &iax2_tech;
|
||||
snprintf(tmp->name, sizeof(tmp->name), "IAX2/%s-%d", i->host, i->callno);
|
||||
tmp->type = channeltype;
|
||||
ast_string_field_build(tmp, name, "IAX2/%s-%d", i->host, i->callno);
|
||||
/* We can support any format by default, until we get restricted */
|
||||
tmp->nativeformats = capability;
|
||||
tmp->readformat = ast_best_codec(capability);
|
||||
|
@ -3402,7 +3401,7 @@ static struct ast_channel *ast_iax2_new(int callno, int state, int capability)
|
|||
if (!ast_strlen_zero(i->ani))
|
||||
tmp->cid.cid_ani = ast_strdup(i->ani);
|
||||
if (!ast_strlen_zero(i->language))
|
||||
ast_copy_string(tmp->language, i->language, sizeof(tmp->language));
|
||||
ast_string_field_set(tmp, language, i->language);
|
||||
if (!ast_strlen_zero(i->dnid))
|
||||
tmp->cid.cid_dnid = ast_strdup(i->dnid);
|
||||
if (!ast_strlen_zero(i->rdnis))
|
||||
|
@ -3411,7 +3410,7 @@ static struct ast_channel *ast_iax2_new(int callno, int state, int capability)
|
|||
tmp->cid.cid_ton = i->calling_ton;
|
||||
tmp->cid.cid_tns = i->calling_tns;
|
||||
if (!ast_strlen_zero(i->accountcode))
|
||||
ast_copy_string(tmp->accountcode, i->accountcode, sizeof(tmp->accountcode));
|
||||
ast_string_field_set(tmp, accountcode, i->accountcode);
|
||||
if (i->amaflags)
|
||||
tmp->amaflags = i->amaflags;
|
||||
ast_copy_string(tmp->context, i->context, sizeof(tmp->context));
|
||||
|
@ -5538,7 +5537,8 @@ static void register_peer_exten(struct iax2_peer *peer, int onoff)
|
|||
while((ext = strsep(&stringp, "&"))) {
|
||||
if (onoff) {
|
||||
if (!ast_exists_extension(NULL, regcontext, ext, 1, NULL))
|
||||
ast_add_extension(regcontext, 1, ext, 1, NULL, NULL, "Noop", ast_strdup(peer->name), free, channeltype);
|
||||
ast_add_extension(regcontext, 1, ext, 1, NULL, NULL,
|
||||
"Noop", ast_strdup(peer->name), free, "IAX2");
|
||||
} else
|
||||
ast_context_remove_extension(regcontext, ext, 1, NULL);
|
||||
}
|
||||
|
@ -6140,7 +6140,7 @@ static int iax_park(struct ast_channel *chan1, struct ast_channel *chan2)
|
|||
chan1m = ast_channel_alloc(0);
|
||||
chan2m = ast_channel_alloc(0);
|
||||
if (chan2m && chan1m) {
|
||||
snprintf(chan1m->name, sizeof(chan1m->name), "Parking/%s", chan1->name);
|
||||
ast_string_field_build(chan1m, name, "Parking/%s", chan1->name);
|
||||
/* Make formats okay */
|
||||
chan1m->readformat = chan1->readformat;
|
||||
chan1m->writeformat = chan1->writeformat;
|
||||
|
@ -6152,7 +6152,7 @@ static int iax_park(struct ast_channel *chan1, struct ast_channel *chan2)
|
|||
|
||||
/* We make a clone of the peer channel too, so we can play
|
||||
back the announcement */
|
||||
snprintf(chan2m->name, sizeof (chan2m->name), "IAXPeer/%s",chan2->name);
|
||||
ast_string_field_build(chan2m, name, "IAXPeer/%s",chan2->name);
|
||||
/* Make formats okay */
|
||||
chan2m->readformat = chan2->readformat;
|
||||
chan2m->writeformat = chan2->writeformat;
|
||||
|
@ -7716,7 +7716,7 @@ static int iax2_prov_app(struct ast_channel *chan, void *data)
|
|||
if (opts)
|
||||
*opts='\0';
|
||||
|
||||
if (chan->type != channeltype) {
|
||||
if (chan->tech != &iax2_tech) {
|
||||
ast_log(LOG_NOTICE, "Can't provision a non-IAX device!\n");
|
||||
return -1;
|
||||
}
|
||||
|
@ -8728,7 +8728,7 @@ static int set_config(char *config_file, int reload)
|
|||
ast_copy_string(regcontext, v->value, sizeof(regcontext));
|
||||
/* Create context if it doesn't exist already */
|
||||
if (!ast_context_find(regcontext))
|
||||
ast_context_create(NULL, regcontext, channeltype);
|
||||
ast_context_create(NULL, regcontext, "IAX2");
|
||||
} else if (!strcasecmp(v->name, "tos")) {
|
||||
if (ast_str2tos(v->value, &tos))
|
||||
ast_log(LOG_WARNING, "Invalid tos value at line %d, should be 'lowdelay', 'throughput', 'reliability', 'mincost', or 'none'\n", v->lineno);
|
||||
|
@ -9562,7 +9562,7 @@ int load_module(void)
|
|||
set_config(config, 0);
|
||||
|
||||
if (ast_channel_register(&iax2_tech)) {
|
||||
ast_log(LOG_ERROR, "Unable to register channel class %s\n", channeltype);
|
||||
ast_log(LOG_ERROR, "Unable to register channel class %s\n", "IAX2");
|
||||
__unload_module();
|
||||
return -1;
|
||||
}
|
||||
|
|
|
@ -59,9 +59,9 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
|
|||
#include "asterisk/app.h"
|
||||
#include "asterisk/musiconhold.h"
|
||||
#include "asterisk/manager.h"
|
||||
#include "asterisk/stringfields.h"
|
||||
|
||||
static const char desc[] = "Local Proxy Channel";
|
||||
static const char type[] = "Local";
|
||||
static const char tdesc[] = "Local Proxy Channel Driver";
|
||||
|
||||
static int usecnt =0;
|
||||
|
@ -85,7 +85,7 @@ static int local_sendhtml(struct ast_channel *ast, int subclass, const char *dat
|
|||
|
||||
/* PBX interface structure for channel registration */
|
||||
static const struct ast_channel_tech local_tech = {
|
||||
.type = type,
|
||||
.type = "Local",
|
||||
.description = tdesc,
|
||||
.capabilities = -1,
|
||||
.requester = local_request,
|
||||
|
@ -330,8 +330,8 @@ static int local_call(struct ast_channel *ast, char *dest, int timeout)
|
|||
p->chan->cid.cid_rdnis = ast_strdup(p->owner->cid.cid_rdnis);
|
||||
p->chan->cid.cid_ani = ast_strdup(p->owner->cid.cid_ani);
|
||||
|
||||
strncpy(p->chan->language, p->owner->language, sizeof(p->chan->language) - 1);
|
||||
strncpy(p->chan->accountcode, p->owner->accountcode, sizeof(p->chan->accountcode) - 1);
|
||||
ast_string_field_set(p->chan, language, p->owner->language);
|
||||
ast_string_field_set(p->chan, accountcode, p->owner->accountcode);
|
||||
p->chan->cdrflags = p->owner->cdrflags;
|
||||
|
||||
/* copy the channel variables from the incoming channel to the outgoing channel */
|
||||
|
@ -513,10 +513,8 @@ static struct ast_channel *local_new(struct local_pvt *p, int state)
|
|||
tmp2->tech = tmp->tech = &local_tech;
|
||||
tmp->nativeformats = p->reqformat;
|
||||
tmp2->nativeformats = p->reqformat;
|
||||
snprintf(tmp->name, sizeof(tmp->name), "Local/%s@%s-%04x,1", p->exten, p->context, randnum);
|
||||
snprintf(tmp2->name, sizeof(tmp2->name), "Local/%s@%s-%04x,2", p->exten, p->context, randnum);
|
||||
tmp->type = type;
|
||||
tmp2->type = type;
|
||||
ast_string_field_build(tmp, name, "Local/%s@%s-%04x,1", p->exten, p->context, randnum);
|
||||
ast_string_field_build(tmp2, name, "Local/%s@%s-%04x,2", p->exten, p->context, randnum);
|
||||
ast_setstate(tmp, state);
|
||||
ast_setstate(tmp2, AST_STATE_RING);
|
||||
tmp->writeformat = p->reqformat;
|
||||
|
@ -592,7 +590,7 @@ int load_module()
|
|||
{
|
||||
/* Make sure we can register our channel type */
|
||||
if (ast_channel_register(&local_tech)) {
|
||||
ast_log(LOG_ERROR, "Unable to register channel class %s\n", type);
|
||||
ast_log(LOG_ERROR, "Unable to register channel class 'Local'\n");
|
||||
return -1;
|
||||
}
|
||||
ast_cli_register(&cli_show_locals);
|
||||
|
|
|
@ -116,6 +116,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
|
|||
#include "asterisk/causes.h"
|
||||
#include "asterisk/dsp.h"
|
||||
#include "asterisk/devicestate.h"
|
||||
#include "asterisk/stringfields.h"
|
||||
|
||||
#ifndef IPTOS_MINCOST
|
||||
#define IPTOS_MINCOST 0x02
|
||||
|
@ -137,7 +138,6 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
|
|||
#endif
|
||||
|
||||
static const char desc[] = "Media Gateway Control Protocol (MGCP)";
|
||||
static const char type[] = "MGCP";
|
||||
static const char tdesc[] = "Media Gateway Control Protocol (MGCP)";
|
||||
static const char config[] = "mgcp.conf";
|
||||
|
||||
|
@ -503,7 +503,7 @@ static int mgcp_senddigit(struct ast_channel *ast, char digit);
|
|||
static int mgcp_devicestate(void *data);
|
||||
|
||||
static const struct ast_channel_tech mgcp_tech = {
|
||||
.type = type,
|
||||
.type = "MGCP",
|
||||
.description = tdesc,
|
||||
.capabilities = AST_FORMAT_ULAW,
|
||||
.properties = AST_CHAN_TP_WANTSJITTER,
|
||||
|
@ -1454,10 +1454,9 @@ static struct ast_channel *mgcp_new(struct mgcp_subchannel *sub, int state)
|
|||
if (!tmp->nativeformats)
|
||||
tmp->nativeformats = capability;
|
||||
fmt = ast_best_codec(tmp->nativeformats);
|
||||
snprintf(tmp->name, sizeof(tmp->name), "MGCP/%s@%s-%d", i->name, i->parent->name, sub->id);
|
||||
ast_string_field_build(tmp, name, "MGCP/%s@%s-%d", i->name, i->parent->name, sub->id);
|
||||
if (sub->rtp)
|
||||
tmp->fds[0] = ast_rtp_fd(sub->rtp);
|
||||
tmp->type = type;
|
||||
if (i->dtmfmode & (MGCP_DTMF_INBAND | MGCP_DTMF_HYBRID)) {
|
||||
i->dsp = ast_dsp_new();
|
||||
ast_dsp_set_features(i->dsp,DSP_FEATURE_DTMF_DETECT);
|
||||
|
@ -1475,9 +1474,9 @@ static struct ast_channel *mgcp_new(struct mgcp_subchannel *sub, int state)
|
|||
tmp->rawreadformat = fmt;
|
||||
tmp->tech_pvt = sub;
|
||||
if (!ast_strlen_zero(i->language))
|
||||
strncpy(tmp->language, i->language, sizeof(tmp->language)-1);
|
||||
ast_string_field_set(tmp, language, i->language);
|
||||
if (!ast_strlen_zero(i->accountcode))
|
||||
strncpy(tmp->accountcode, i->accountcode, sizeof(tmp->accountcode)-1);
|
||||
ast_string_field_set(tmp, accountcode, i->accountcode);
|
||||
if (i->amaflags)
|
||||
tmp->amaflags = i->amaflags;
|
||||
sub->owner = tmp;
|
||||
|
@ -1487,7 +1486,7 @@ static struct ast_channel *mgcp_new(struct mgcp_subchannel *sub, int state)
|
|||
ast_update_use_count();
|
||||
tmp->callgroup = i->callgroup;
|
||||
tmp->pickupgroup = i->pickupgroup;
|
||||
strncpy(tmp->call_forward, i->call_forward, sizeof(tmp->call_forward) - 1);
|
||||
ast_string_field_set(tmp, call_forward, i->call_forward);
|
||||
strncpy(tmp->context, i->context, sizeof(tmp->context)-1);
|
||||
strncpy(tmp->exten, i->exten, sizeof(tmp->exten)-1);
|
||||
if (!ast_strlen_zero(i->cid_num))
|
||||
|
@ -4017,7 +4016,7 @@ static int mgcp_set_rtp_peer(struct ast_channel *chan, struct ast_rtp *rtp, stru
|
|||
}
|
||||
|
||||
static struct ast_rtp_protocol mgcp_rtp = {
|
||||
.type = type,
|
||||
.type = "MGCP",
|
||||
.get_rtp_info = mgcp_get_rtp_peer,
|
||||
.set_rtp_peer = mgcp_set_rtp_peer,
|
||||
};
|
||||
|
@ -4346,7 +4345,7 @@ int load_module()
|
|||
if (!(res = reload_config())) {
|
||||
/* Make sure we can register our mgcp channel type */
|
||||
if (ast_channel_register(&mgcp_tech)) {
|
||||
ast_log(LOG_ERROR, "Unable to register channel class %s\n", type);
|
||||
ast_log(LOG_ERROR, "Unable to register channel class 'MGCP'\n");
|
||||
return -1;
|
||||
}
|
||||
ast_rtp_proto_register(&mgcp_rtp);
|
||||
|
|
|
@ -69,6 +69,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
|
|||
#include "asterisk/utils.h"
|
||||
#include "asterisk/causes.h"
|
||||
#include "asterisk/endian.h"
|
||||
#include "asterisk/stringfields.h"
|
||||
|
||||
/* ringtones we use */
|
||||
#include "busy.h"
|
||||
|
@ -247,7 +248,6 @@ static struct sound sounds[] = {
|
|||
struct chan_oss_pvt {
|
||||
struct chan_oss_pvt *next;
|
||||
|
||||
char *type; /* XXX maybe take the one from oss_tech */
|
||||
char *name;
|
||||
/*
|
||||
* cursound indicates which in struct sound we play. -1 means nothing,
|
||||
|
@ -303,7 +303,6 @@ struct chan_oss_pvt {
|
|||
};
|
||||
|
||||
static struct chan_oss_pvt oss_default = {
|
||||
.type = "Console",
|
||||
.cursound = -1,
|
||||
.sounddev = -1,
|
||||
.duplex = M_UNSET, /* XXX check this */
|
||||
|
@ -334,19 +333,19 @@ static int oss_indicate(struct ast_channel *chan, int cond);
|
|||
static int oss_fixup(struct ast_channel *oldchan, struct ast_channel *newchan);
|
||||
|
||||
static const struct ast_channel_tech oss_tech = {
|
||||
.type = "Console",
|
||||
.type = "Console",
|
||||
.description = "OSS Console Channel Driver",
|
||||
.capabilities = AST_FORMAT_SLINEAR,
|
||||
.requester = oss_request,
|
||||
.send_digit = oss_digit,
|
||||
.send_text = oss_text,
|
||||
.hangup = oss_hangup,
|
||||
.answer = oss_answer,
|
||||
.read = oss_read,
|
||||
.call = oss_call,
|
||||
.write = oss_write,
|
||||
.indicate = oss_indicate,
|
||||
.fixup = oss_fixup,
|
||||
.requester = oss_request,
|
||||
.send_digit = oss_digit,
|
||||
.send_text = oss_text,
|
||||
.hangup = oss_hangup,
|
||||
.answer = oss_answer,
|
||||
.read = oss_read,
|
||||
.call = oss_call,
|
||||
.write = oss_write,
|
||||
.indicate = oss_indicate,
|
||||
.fixup = oss_fixup,
|
||||
};
|
||||
|
||||
/*
|
||||
|
@ -807,7 +806,7 @@ static struct ast_frame *oss_read(struct ast_channel *c)
|
|||
/* prepare a NULL frame in case we don't have enough data to return */
|
||||
bzero(f, sizeof(struct ast_frame));
|
||||
f->frametype = AST_FRAME_NULL;
|
||||
f->src = o->type;
|
||||
f->src = oss_tech.type;
|
||||
|
||||
res = read(o->sounddev, o->oss_read_buf + o->readpos,
|
||||
sizeof(o->oss_read_buf) - o->readpos);
|
||||
|
@ -884,8 +883,7 @@ static struct ast_channel *oss_new(struct chan_oss_pvt *o,
|
|||
if (c == NULL)
|
||||
return NULL;
|
||||
c->tech = &oss_tech;
|
||||
snprintf(c->name, sizeof(c->name), "OSS/%s", o->device + 5);
|
||||
c->type = o->type;
|
||||
ast_string_field_build(c, name, "OSS/%s", o->device + 5);
|
||||
c->fds[0] = o->sounddev; /* -1 if device closed, override later */
|
||||
c->nativeformats = AST_FORMAT_SLINEAR;
|
||||
c->readformat = AST_FORMAT_SLINEAR;
|
||||
|
@ -897,7 +895,7 @@ static struct ast_channel *oss_new(struct chan_oss_pvt *o,
|
|||
if (!ast_strlen_zero(ext))
|
||||
ast_copy_string(c->exten, ext, sizeof(c->exten));
|
||||
if (!ast_strlen_zero(o->language))
|
||||
ast_copy_string(c->language, o->language, sizeof(c->language));
|
||||
ast_string_field_set(c, language, o->language);
|
||||
if (!ast_strlen_zero(o->cid_num))
|
||||
c->cid.cid_num = ast_strdup(o->cid_num);
|
||||
if (!ast_strlen_zero(o->cid_name))
|
||||
|
@ -1403,8 +1401,7 @@ int load_module(void)
|
|||
}
|
||||
i = ast_channel_register(&oss_tech);
|
||||
if (i < 0) {
|
||||
ast_log(LOG_ERROR, "Unable to register channel class '%s'\n",
|
||||
oss_default.type);
|
||||
ast_log(LOG_ERROR, "Unable to register channel class 'Console'\n");
|
||||
/* XXX should cleanup allocated memory etc. */
|
||||
return -1;
|
||||
}
|
||||
|
|
|
@ -58,6 +58,8 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
|
|||
#include "asterisk/utils.h"
|
||||
#include "asterisk/callerid.h"
|
||||
#include "asterisk/causes.h"
|
||||
#include "asterisk/stringfields.h"
|
||||
|
||||
#include "DialTone.h"
|
||||
|
||||
#ifdef QTI_PHONEJACK_TJ_PCI /* check for the newer quicknet driver v.3.1.0 which has this symbol */
|
||||
|
@ -81,7 +83,6 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
|
|||
#define DEFAULT_GAIN 0x100
|
||||
|
||||
static const char desc[] = "Linux Telephony API Support";
|
||||
static const char type[] = "Phone";
|
||||
static const char tdesc[] = "Standard Linux Telephony API Driver";
|
||||
static const char config[] = "phone.conf";
|
||||
|
||||
|
@ -163,7 +164,7 @@ static int phone_fixup(struct ast_channel *old, struct ast_channel *new);
|
|||
static int phone_indicate(struct ast_channel *chan, int condition);
|
||||
|
||||
static const struct ast_channel_tech phone_tech = {
|
||||
.type = type,
|
||||
.type = "Phone",
|
||||
.description = tdesc,
|
||||
.capabilities = AST_FORMAT_G723_1 | AST_FORMAT_SLINEAR | AST_FORMAT_ULAW,
|
||||
.requester = phone_request,
|
||||
|
@ -179,7 +180,7 @@ static const struct ast_channel_tech phone_tech = {
|
|||
};
|
||||
|
||||
static struct ast_channel_tech phone_tech_fxs = {
|
||||
.type = type,
|
||||
.type = "Phone",
|
||||
.description = tdesc,
|
||||
.requester = phone_request,
|
||||
.send_digit = phone_digit,
|
||||
|
@ -479,7 +480,7 @@ static struct ast_frame *phone_exception(struct ast_channel *ast)
|
|||
p->fr.datalen = 0;
|
||||
p->fr.samples = 0;
|
||||
p->fr.data = NULL;
|
||||
p->fr.src = type;
|
||||
p->fr.src = "Phone";
|
||||
p->fr.offset = 0;
|
||||
p->fr.mallocd=0;
|
||||
p->fr.delivery = ast_tv(0,0);
|
||||
|
@ -541,7 +542,7 @@ static struct ast_frame *phone_read(struct ast_channel *ast)
|
|||
p->fr.datalen = 0;
|
||||
p->fr.samples = 0;
|
||||
p->fr.data = NULL;
|
||||
p->fr.src = type;
|
||||
p->fr.src = "Phone";
|
||||
p->fr.offset = 0;
|
||||
p->fr.mallocd=0;
|
||||
p->fr.delivery = ast_tv(0,0);
|
||||
|
@ -815,8 +816,7 @@ static struct ast_channel *phone_new(struct phone_pvt *i, int state, char *conte
|
|||
tmp = ast_channel_alloc(1);
|
||||
if (tmp) {
|
||||
tmp->tech = cur_tech;
|
||||
snprintf(tmp->name, sizeof(tmp->name), "Phone/%s", i->dev + 5);
|
||||
tmp->type = type;
|
||||
ast_string_field_build(tmp, name, "Phone/%s", i->dev + 5);
|
||||
tmp->fds[0] = i->fd;
|
||||
/* XXX Switching formats silently causes kernel panics XXX */
|
||||
if (i->mode == MODE_FXS &&
|
||||
|
@ -848,7 +848,7 @@ static struct ast_channel *phone_new(struct phone_pvt *i, int state, char *conte
|
|||
else
|
||||
strncpy(tmp->exten, "s", sizeof(tmp->exten) - 1);
|
||||
if (!ast_strlen_zero(i->language))
|
||||
strncpy(tmp->language, i->language, sizeof(tmp->language)-1);
|
||||
ast_string_field_set(tmp, language, i->language);
|
||||
if (!ast_strlen_zero(i->cid_num))
|
||||
tmp->cid.cid_num = strdup(i->cid_num);
|
||||
if (!ast_strlen_zero(i->cid_name))
|
||||
|
@ -1411,7 +1411,7 @@ int load_module()
|
|||
/* Make sure we can register our Adtranphone channel type */
|
||||
|
||||
if (ast_channel_register(cur_tech)) {
|
||||
ast_log(LOG_ERROR, "Unable to register channel class %s\n", type);
|
||||
ast_log(LOG_ERROR, "Unable to register channel class 'Phone'\n");
|
||||
ast_config_destroy(cfg);
|
||||
__unload_module();
|
||||
return -1;
|
||||
|
|
|
@ -155,7 +155,6 @@ static int expiry = DEFAULT_EXPIRY;
|
|||
|
||||
|
||||
static const char desc[] = "Session Initiation Protocol (SIP)";
|
||||
static const char channeltype[] = "SIP";
|
||||
static const char config[] = "sip.conf";
|
||||
static const char notify_config[] = "sip_notify.conf";
|
||||
static int usecnt = 0;
|
||||
|
@ -979,7 +978,7 @@ static int sip_get_codec(struct ast_channel *chan);
|
|||
|
||||
/*! \brief Definition of this channel for PBX channel registration */
|
||||
static const struct ast_channel_tech sip_tech = {
|
||||
.type = channeltype,
|
||||
.type = "SIP",
|
||||
.description = "Session Initiation Protocol (SIP)",
|
||||
.capabilities = ((AST_FORMAT_MAX_AUDIO << 1) - 1),
|
||||
.properties = AST_CHAN_TP_WANTSJITTER,
|
||||
|
@ -1001,7 +1000,7 @@ static const struct ast_channel_tech sip_tech = {
|
|||
|
||||
/*! \brief Interface structure with callbacks used to connect to RTP module */
|
||||
static struct ast_rtp_protocol sip_rtp = {
|
||||
type: channeltype,
|
||||
type: "SIP",
|
||||
get_rtp_info: sip_get_rtp_peer,
|
||||
get_vrtp_info: sip_get_vrtp_peer,
|
||||
set_rtp_peer: sip_set_rtp_peer,
|
||||
|
@ -1665,7 +1664,8 @@ static void register_peer_exten(struct sip_peer *peer, int onoff)
|
|||
stringp = multi;
|
||||
while((ext = strsep(&stringp, "&"))) {
|
||||
if (onoff)
|
||||
ast_add_extension(regcontext, 1, ext, 1, NULL, NULL, "Noop", ast_strdup(peer->name), free, channeltype);
|
||||
ast_add_extension(regcontext, 1, ext, 1, NULL, NULL, "Noop",
|
||||
ast_strdup(peer->name), free, "SIP");
|
||||
else
|
||||
ast_context_remove_extension(regcontext, ext, 1, NULL);
|
||||
}
|
||||
|
@ -2866,13 +2866,12 @@ static struct ast_channel *sip_new(struct sip_pvt *i, int state, const char *tit
|
|||
fmt = ast_best_codec(tmp->nativeformats);
|
||||
|
||||
if (title)
|
||||
snprintf(tmp->name, sizeof(tmp->name), "SIP/%s-%04x", title, thread_safe_rand() & 0xffff);
|
||||
ast_string_field_build(tmp, name, "SIP/%s-%04x", title, thread_safe_rand() & 0xffff);
|
||||
else if (strchr(i->fromdomain,':'))
|
||||
snprintf(tmp->name, sizeof(tmp->name), "SIP/%s-%08x", strchr(i->fromdomain,':')+1, (int)(long)(i));
|
||||
ast_string_field_build(tmp, name, "SIP/%s-%08x", strchr(i->fromdomain,':')+1, (int)(long)(i));
|
||||
else
|
||||
snprintf(tmp->name, sizeof(tmp->name), "SIP/%s-%08x", i->fromdomain, (int)(long)(i));
|
||||
ast_string_field_build(tmp, name, "SIP/%s-%08x", i->fromdomain, (int)(long)(i));
|
||||
|
||||
tmp->type = channeltype;
|
||||
if (ast_test_flag(i, SIP_DTMF) == SIP_DTMF_INBAND) {
|
||||
i->vad = ast_dsp_new();
|
||||
ast_dsp_set_features(i->vad, DSP_FEATURE_DTMF_DETECT);
|
||||
|
@ -2900,13 +2899,13 @@ static struct ast_channel *sip_new(struct sip_pvt *i, int state, const char *tit
|
|||
tmp->pickupgroup = i->pickupgroup;
|
||||
tmp->cid.cid_pres = i->callingpres;
|
||||
if (!ast_strlen_zero(i->accountcode))
|
||||
ast_copy_string(tmp->accountcode, i->accountcode, sizeof(tmp->accountcode));
|
||||
ast_string_field_set(tmp, accountcode, i->accountcode);
|
||||
if (i->amaflags)
|
||||
tmp->amaflags = i->amaflags;
|
||||
if (!ast_strlen_zero(i->language))
|
||||
ast_copy_string(tmp->language, i->language, sizeof(tmp->language));
|
||||
ast_string_field_set(tmp, language, i->language);
|
||||
if (!ast_strlen_zero(i->musicclass))
|
||||
ast_copy_string(tmp->musicclass, i->musicclass, sizeof(tmp->musicclass));
|
||||
ast_string_field_set(tmp, musicclass, i->musicclass);
|
||||
i->owner = tmp;
|
||||
ast_mutex_lock(&usecnt_lock);
|
||||
usecnt++;
|
||||
|
@ -3165,7 +3164,7 @@ static struct sip_pvt *sip_alloc(ast_string_field callid, struct sockaddr_in *si
|
|||
if (!(p = ast_calloc(1, sizeof(*p))))
|
||||
return NULL;
|
||||
|
||||
if (ast_string_field_init(p)) {
|
||||
if (ast_string_field_init(p, 512)) {
|
||||
free(p);
|
||||
return NULL;
|
||||
}
|
||||
|
@ -3381,7 +3380,7 @@ static int sip_register(char *value, int lineno)
|
|||
return -1;
|
||||
}
|
||||
|
||||
if (ast_string_field_init(reg)) {
|
||||
if (ast_string_field_init(reg, 256)) {
|
||||
ast_log(LOG_ERROR, "Out of memory. Can't allocate SIP registry strings\n");
|
||||
free(reg);
|
||||
return -1;
|
||||
|
@ -9275,7 +9274,7 @@ static char *func_header_read(struct ast_channel *chan, char *cmd, char *data, c
|
|||
}
|
||||
|
||||
ast_mutex_lock(&chan->lock);
|
||||
if (chan->type != channeltype) {
|
||||
if (chan->tech != &sip_tech) {
|
||||
ast_log(LOG_WARNING, "This function can only be used on SIP channels.\n");
|
||||
ast_mutex_unlock(&chan->lock);
|
||||
return NULL;
|
||||
|
@ -9446,7 +9445,7 @@ static char *function_sipchaninfo_read(struct ast_channel *chan, char *cmd, char
|
|||
}
|
||||
|
||||
ast_mutex_lock(&chan->lock);
|
||||
if (chan->type != channeltype) {
|
||||
if (chan->tech != &sip_tech) {
|
||||
ast_log(LOG_WARNING, "This function can only be used on SIP channels.\n");
|
||||
ast_mutex_unlock(&chan->lock);
|
||||
return NULL;
|
||||
|
@ -9517,7 +9516,7 @@ static void parse_moved_contact(struct sip_pvt *p, struct sip_request *req)
|
|||
*e = '\0';
|
||||
ast_log(LOG_DEBUG, "Found promiscuous redirection to 'SIP/%s'\n", s);
|
||||
if (p->owner)
|
||||
snprintf(p->owner->call_forward, sizeof(p->owner->call_forward), "SIP/%s", s);
|
||||
ast_string_field_build(p->owner, call_forward, "SIP/%s", s);
|
||||
} else {
|
||||
e = strchr(tmp, '@');
|
||||
if (e)
|
||||
|
@ -9529,7 +9528,7 @@ static void parse_moved_contact(struct sip_pvt *p, struct sip_request *req)
|
|||
s += 4;
|
||||
ast_log(LOG_DEBUG, "Found 302 Redirect to extension '%s'\n", s);
|
||||
if (p->owner)
|
||||
ast_copy_string(p->owner->call_forward, s, sizeof(p->owner->call_forward));
|
||||
ast_string_field_set(p->owner, call_forward, s);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -10031,7 +10030,8 @@ static void handle_response(struct sip_pvt *p, int resp, char *rest, struct sip_
|
|||
forward and hope we end up at the right place... */
|
||||
ast_log(LOG_DEBUG, "Hairpin detected, setting up call forward for what it's worth\n");
|
||||
if (p->owner)
|
||||
snprintf(p->owner->call_forward, sizeof(p->owner->call_forward), "Local/%s@%s", p->username, p->context);
|
||||
ast_string_field_build(p->owner, call_forward,
|
||||
"Local/%s@%s", p->username, p->context);
|
||||
/* Fall through */
|
||||
case 488: /* Not acceptable here - codec error */
|
||||
case 480: /* Temporarily Unavailable */
|
||||
|
@ -10183,7 +10183,7 @@ static int sip_park(struct ast_channel *chan1, struct ast_channel *chan2, struct
|
|||
ast_hangup(chan2m);
|
||||
return -1;
|
||||
}
|
||||
snprintf(chan1m->name, sizeof(chan1m->name), "Parking/%s", chan1->name);
|
||||
ast_string_field_build(chan1m, name, "Parking/%s", chan1->name);
|
||||
/* Make formats okay */
|
||||
chan1m->readformat = chan1->readformat;
|
||||
chan1m->writeformat = chan1->writeformat;
|
||||
|
@ -10195,7 +10195,7 @@ static int sip_park(struct ast_channel *chan1, struct ast_channel *chan2, struct
|
|||
|
||||
/* We make a clone of the peer channel too, so we can play
|
||||
back the announcement */
|
||||
snprintf(chan2m->name, sizeof (chan2m->name), "SIPPeer/%s",chan2->name);
|
||||
ast_string_field_build(chan2m, name, "SIPPeer/%s",chan2->name);
|
||||
/* Make formats okay */
|
||||
chan2m->readformat = chan2->readformat;
|
||||
chan2m->writeformat = chan2->writeformat;
|
||||
|
@ -12504,7 +12504,7 @@ static int reload_config(enum channelreloadreason reason)
|
|||
ast_copy_string(regcontext, v->value, sizeof(regcontext));
|
||||
/* Create context if it doesn't exist already */
|
||||
if (!ast_context_find(regcontext))
|
||||
ast_context_create(NULL, regcontext, channeltype);
|
||||
ast_context_create(NULL, regcontext, "SIP");
|
||||
} else if (!strcasecmp(v->name, "callerid")) {
|
||||
ast_copy_string(default_callerid, v->value, sizeof(default_callerid));
|
||||
} else if (!strcasecmp(v->name, "fromdomain")) {
|
||||
|
@ -12871,7 +12871,7 @@ static int sip_dtmfmode(struct ast_channel *chan, void *data)
|
|||
return 0;
|
||||
}
|
||||
ast_mutex_lock(&chan->lock);
|
||||
if (chan->type != channeltype) {
|
||||
if (chan->tech != &sip_tech) {
|
||||
ast_log(LOG_WARNING, "Call this application only on SIP incoming calls\n");
|
||||
ast_mutex_unlock(&chan->lock);
|
||||
return 0;
|
||||
|
@ -13170,7 +13170,7 @@ int load_module()
|
|||
|
||||
/* Make sure we can register our sip channel type */
|
||||
if (ast_channel_register(&sip_tech)) {
|
||||
ast_log(LOG_ERROR, "Unable to register channel type %s\n", channeltype);
|
||||
ast_log(LOG_ERROR, "Unable to register channel type 'SIP'\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
|
@ -68,13 +68,13 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
|
|||
#include "asterisk/musiconhold.h"
|
||||
#include "asterisk/utils.h"
|
||||
#include "asterisk/dsp.h"
|
||||
#include "asterisk/stringfields.h"
|
||||
|
||||
/************************************************************************************/
|
||||
/* Skinny/Asterisk Protocol Settings */
|
||||
/************************************************************************************/
|
||||
static const char desc[] = "Skinny Client Control Protocol (Skinny)";
|
||||
static const char tdesc[] = "Skinny Client Control Protocol (Skinny)";
|
||||
static const char type[] = "Skinny";
|
||||
static const char config[] = "skinny.conf";
|
||||
|
||||
/* Just about everybody seems to support ulaw, so make it a nice default */
|
||||
|
@ -908,7 +908,7 @@ static int skinny_fixup(struct ast_channel *oldchan, struct ast_channel *newchan
|
|||
static int skinny_senddigit(struct ast_channel *ast, char digit);
|
||||
|
||||
static const struct ast_channel_tech skinny_tech = {
|
||||
.type = type,
|
||||
.type = "Skinny",
|
||||
.description = tdesc,
|
||||
.capabilities = AST_FORMAT_ULAW,
|
||||
.properties = AST_CHAN_TP_WANTSJITTER,
|
||||
|
@ -1355,7 +1355,7 @@ static int skinny_set_rtp_peer(struct ast_channel *chan, struct ast_rtp *rtp, st
|
|||
}
|
||||
|
||||
static struct ast_rtp_protocol skinny_rtp = {
|
||||
.type = type,
|
||||
.type = "Skinny",
|
||||
.get_rtp_info = skinny_get_rtp_peer,
|
||||
.get_vrtp_info = skinny_get_vrtp_peer,
|
||||
.set_rtp_peer = skinny_set_rtp_peer,
|
||||
|
@ -2263,11 +2263,10 @@ static struct ast_channel *skinny_new(struct skinny_subchannel *sub, int state)
|
|||
tmp->nativeformats = capability;
|
||||
fmt = ast_best_codec(tmp->nativeformats);
|
||||
ast_verbose("skinny_new: tmp->nativeformats=%d fmt=%d\n", tmp->nativeformats, fmt);
|
||||
snprintf(tmp->name, sizeof(tmp->name), "Skinny/%s@%s-%d", l->name, l->parent->name, sub->callid);
|
||||
ast_string_field_build(tmp, name, "Skinny/%s@%s-%d", l->name, l->parent->name, sub->callid);
|
||||
if (sub->rtp) {
|
||||
tmp->fds[0] = ast_rtp_fd(sub->rtp);
|
||||
}
|
||||
tmp->type = type;
|
||||
ast_setstate(tmp, state);
|
||||
if (state == AST_STATE_RING) {
|
||||
tmp->rings = 1;
|
||||
|
@ -2277,15 +2276,12 @@ static struct ast_channel *skinny_new(struct skinny_subchannel *sub, int state)
|
|||
tmp->readformat = fmt;
|
||||
tmp->rawreadformat = fmt;
|
||||
tmp->tech_pvt = sub;
|
||||
if (!ast_strlen_zero(l->language)) {
|
||||
strncpy(tmp->language, l->language, sizeof(tmp->language)-1);
|
||||
}
|
||||
if (!ast_strlen_zero(l->accountcode)) {
|
||||
strncpy(tmp->accountcode, l->accountcode, sizeof(tmp->accountcode)-1);
|
||||
}
|
||||
if (l->amaflags) {
|
||||
if (!ast_strlen_zero(l->language))
|
||||
ast_string_field_set(tmp, language, l->language);
|
||||
if (!ast_strlen_zero(l->accountcode))
|
||||
ast_string_field_set(tmp, accountcode, l->accountcode);
|
||||
if (l->amaflags)
|
||||
tmp->amaflags = l->amaflags;
|
||||
}
|
||||
sub->owner = tmp;
|
||||
ast_mutex_lock(&usecnt_lock);
|
||||
usecnt++;
|
||||
|
@ -2293,7 +2289,7 @@ static struct ast_channel *skinny_new(struct skinny_subchannel *sub, int state)
|
|||
ast_update_use_count();
|
||||
tmp->callgroup = l->callgroup;
|
||||
tmp->pickupgroup = l->pickupgroup;
|
||||
strncpy(tmp->call_forward, l->call_forward, sizeof(tmp->call_forward) - 1);
|
||||
ast_string_field_set(tmp, call_forward, l->call_forward);
|
||||
strncpy(tmp->context, l->context, sizeof(tmp->context)-1);
|
||||
strncpy(tmp->exten,l->exten, sizeof(tmp->exten)-1);
|
||||
if (!ast_strlen_zero(l->cid_num)) {
|
||||
|
@ -3303,7 +3299,7 @@ int load_module()
|
|||
if (!res) {
|
||||
/* Make sure we can register our skinny channel type */
|
||||
if (ast_channel_register(&skinny_tech)) {
|
||||
ast_log(LOG_ERROR, "Unable to register channel class %s\n", type);
|
||||
ast_log(LOG_ERROR, "Unable to register channel class 'Skinny'\n");
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -100,9 +100,10 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
|
|||
#include "asterisk/term.h"
|
||||
#include "asterisk/utils.h"
|
||||
#include "asterisk/transcap.h"
|
||||
#include "asterisk/stringfields.h"
|
||||
|
||||
#ifndef ZT_SIG_EM_E1
|
||||
#error "Your zaptel is too old. please cvs update"
|
||||
#error "Your zaptel is too old. please update"
|
||||
#endif
|
||||
|
||||
#ifndef ZT_TONEDETECT
|
||||
|
@ -160,7 +161,6 @@ static const char tdesc[] = "Zapata Telephony Driver"
|
|||
#endif
|
||||
;
|
||||
|
||||
static const char type[] = "Zap";
|
||||
static const char config[] = "zapata.conf";
|
||||
|
||||
#define SIG_EM ZT_SIG_EM
|
||||
|
@ -307,7 +307,7 @@ static char localprefix[20] = "";
|
|||
static char privateprefix[20] = "";
|
||||
static char unknownprefix[20] = "";
|
||||
static long resetinterval = 3600; /*!< How often (in seconds) to reset unused channels. Default 1 hour. */
|
||||
static struct ast_channel inuse = { "GR-303InUse" };
|
||||
static struct ast_channel inuse;
|
||||
#ifdef PRI_GETSET_TIMERS
|
||||
static int pritimers[PRI_MAX_TIMERS];
|
||||
#endif
|
||||
|
@ -709,7 +709,7 @@ static int zt_fixup(struct ast_channel *oldchan, struct ast_channel *newchan);
|
|||
static int zt_setoption(struct ast_channel *chan, int option, void *data, int datalen);
|
||||
|
||||
static const struct ast_channel_tech zap_tech = {
|
||||
.type = type,
|
||||
.type = "Zap",
|
||||
.description = tdesc,
|
||||
.capabilities = AST_FORMAT_SLINEAR | AST_FORMAT_ULAW | AST_FORMAT_ALAW,
|
||||
.requester = zt_request,
|
||||
|
@ -5083,20 +5083,19 @@ static struct ast_channel *zt_new(struct zt_pvt *i, int state, int startpbx, int
|
|||
do {
|
||||
#ifdef ZAPATA_PRI
|
||||
if (i->bearer || (i->pri && (i->sig == SIG_FXSKS)))
|
||||
snprintf(tmp->name, sizeof(tmp->name), "Zap/%d:%d-%d", i->pri->trunkgroup, i->channel, y);
|
||||
ast_string_field_build(tmp, name, "Zap/%d:%d-%d", i->pri->trunkgroup, i->channel, y);
|
||||
else
|
||||
#endif
|
||||
if (i->channel == CHAN_PSEUDO)
|
||||
snprintf(tmp->name, sizeof(tmp->name), "Zap/pseudo-%d", rand());
|
||||
ast_string_field_build(tmp, name, "Zap/pseudo-%d", rand());
|
||||
else
|
||||
snprintf(tmp->name, sizeof(tmp->name), "Zap/%d-%d", i->channel, y);
|
||||
ast_string_field_build(tmp, name, "Zap/%d-%d", i->channel, y);
|
||||
for (x=0;x<3;x++) {
|
||||
if ((index != x) && i->subs[x].owner && !strcasecmp(tmp->name, i->subs[x].owner->name))
|
||||
break;
|
||||
}
|
||||
y++;
|
||||
} while (x < 3);
|
||||
tmp->type = type;
|
||||
tmp->fds[0] = i->subs[index].zfd;
|
||||
tmp->nativeformats = AST_FORMAT_SLINEAR | deflaw;
|
||||
/* Start out assuming ulaw since it's smaller :) */
|
||||
|
@ -5168,19 +5167,18 @@ static struct ast_channel *zt_new(struct zt_pvt *i, int state, int startpbx, int
|
|||
tmp->pickupgroup = i->pickupgroup;
|
||||
}
|
||||
if (!ast_strlen_zero(i->language))
|
||||
ast_copy_string(tmp->language, i->language, sizeof(tmp->language));
|
||||
ast_string_field_set(tmp, language, i->language);
|
||||
if (!ast_strlen_zero(i->musicclass))
|
||||
ast_copy_string(tmp->musicclass, i->musicclass, sizeof(tmp->musicclass));
|
||||
ast_string_field_set(tmp, musicclass, i->musicclass);
|
||||
if (!i->owner)
|
||||
i->owner = tmp;
|
||||
if (!ast_strlen_zero(i->accountcode))
|
||||
ast_copy_string(tmp->accountcode, i->accountcode, sizeof(tmp->accountcode));
|
||||
ast_string_field_set(tmp, accountcode, i->accountcode);
|
||||
if (i->amaflags)
|
||||
tmp->amaflags = i->amaflags;
|
||||
i->subs[index].owner = tmp;
|
||||
ast_copy_string(tmp->context, i->context, sizeof(tmp->context));
|
||||
/* Copy call forward info */
|
||||
ast_copy_string(tmp->call_forward, i->call_forward, sizeof(tmp->call_forward));
|
||||
ast_string_field_set(tmp, call_forward, i->call_forward);
|
||||
/* If we've been told "no ADSI" then enforce it */
|
||||
if (!i->adsi)
|
||||
tmp->adsicpe = AST_ADSI_UNAVAILABLE;
|
||||
|
@ -5856,8 +5854,8 @@ lax);
|
|||
if (nbridge && ast_bridged_channel(nbridge))
|
||||
pbridge = ast_bridged_channel(nbridge)->tech_pvt;
|
||||
if (nbridge && pbridge &&
|
||||
(!strcmp(nbridge->type,"Zap")) &&
|
||||
(!strcmp(ast_bridged_channel(nbridge)->type, "Zap")) &&
|
||||
(nbridge->tech == &zap_tech) &&
|
||||
(ast_bridged_channel(nbridge)->tech == &zap_tech) &&
|
||||
ISTRUNK(pbridge)) {
|
||||
int func = ZT_FLASH;
|
||||
/* Clear out the dial buffer */
|
||||
|
@ -7893,8 +7891,9 @@ static int pri_fixup_principle(struct zt_pri *pri, int principle, q931_call *c)
|
|||
/* Fix it all up now */
|
||||
pri->pvts[principle]->owner = pri->pvts[x]->owner;
|
||||
if (pri->pvts[principle]->owner) {
|
||||
snprintf(pri->pvts[principle]->owner->name, sizeof(pri->pvts[principle]->owner->name),
|
||||
"Zap/%d:%d-%d", pri->trunkgroup, pri->pvts[principle]->channel, 1);
|
||||
ast_string_field_build(pri->pvts[principle]->owner, name,
|
||||
"Zap/%d:%d-%d", pri->trunkgroup,
|
||||
pri->pvts[principle]->channel, 1);
|
||||
pri->pvts[principle]->owner->tech_pvt = pri->pvts[principle];
|
||||
pri->pvts[principle]->owner->fds[0] = pri->pvts[principle]->subs[SUB_REAL].zfd;
|
||||
pri->pvts[principle]->subs[SUB_REAL].owner = pri->pvts[x]->subs[SUB_REAL].owner;
|
||||
|
@ -11095,7 +11094,7 @@ int load_module(void)
|
|||
return -1;
|
||||
}
|
||||
if (ast_channel_register(&zap_tech)) {
|
||||
ast_log(LOG_ERROR, "Unable to register channel class %s\n", type);
|
||||
ast_log(LOG_ERROR, "Unable to register channel class 'Zap'\n");
|
||||
__unload_module();
|
||||
return -1;
|
||||
}
|
||||
|
@ -11114,6 +11113,8 @@ int load_module(void)
|
|||
ast_manager_register( "ZapDNDon", 0, action_zapdndon, "Toggle Zap channel Do Not Disturb status ON" );
|
||||
ast_manager_register( "ZapDNDoff", 0, action_zapdndoff, "Toggle Zap channel Do Not Disturb status OFF" );
|
||||
ast_manager_register("ZapShowChannels", 0, action_zapshowchannels, "Show status zapata channels");
|
||||
ast_string_field_init(&inuse, 16);
|
||||
ast_string_field_set(&inuse, name, "GR-303InUse");
|
||||
|
||||
return res;
|
||||
}
|
||||
|
|
|
@ -525,7 +525,7 @@ void iax_showframe(struct iax_frame *f, struct ast_iax2_full_hdr *fhi, int rx, s
|
|||
dump_ies(fh->iedata, datalen);
|
||||
}
|
||||
|
||||
int iax_ie_append_raw(struct iax_ie_data *ied, unsigned char ie, void *data, int datalen)
|
||||
int iax_ie_append_raw(struct iax_ie_data *ied, unsigned char ie, const void *data, int datalen)
|
||||
{
|
||||
char tmp[256];
|
||||
if (datalen > ((int)sizeof(ied->buf) - ied->pos)) {
|
||||
|
@ -540,7 +540,7 @@ int iax_ie_append_raw(struct iax_ie_data *ied, unsigned char ie, void *data, int
|
|||
return 0;
|
||||
}
|
||||
|
||||
int iax_ie_append_addr(struct iax_ie_data *ied, unsigned char ie, struct sockaddr_in *sin)
|
||||
int iax_ie_append_addr(struct iax_ie_data *ied, unsigned char ie, const struct sockaddr_in *sin)
|
||||
{
|
||||
return iax_ie_append_raw(ied, ie, sin, (int)sizeof(struct sockaddr_in));
|
||||
}
|
||||
|
@ -559,7 +559,7 @@ int iax_ie_append_short(struct iax_ie_data *ied, unsigned char ie, unsigned shor
|
|||
return iax_ie_append_raw(ied, ie, &newval, (int)sizeof(newval));
|
||||
}
|
||||
|
||||
int iax_ie_append_str(struct iax_ie_data *ied, unsigned char ie, char *str)
|
||||
int iax_ie_append_str(struct iax_ie_data *ied, unsigned char ie, const char *str)
|
||||
{
|
||||
return iax_ie_append_raw(ied, ie, str, strlen(str));
|
||||
}
|
||||
|
|
|
@ -129,27 +129,27 @@ struct iax_ie_data {
|
|||
};
|
||||
|
||||
/* Choose a different function for output */
|
||||
extern void iax_set_output(void (*output)(const char *data));
|
||||
void iax_set_output(void (*output)(const char *data));
|
||||
/* Choose a different function for errors */
|
||||
extern void iax_set_error(void (*output)(const char *data));
|
||||
extern void iax_showframe(struct iax_frame *f, struct ast_iax2_full_hdr *fhi, int rx, struct sockaddr_in *sin, int datalen);
|
||||
void iax_set_error(void (*output)(const char *data));
|
||||
void iax_showframe(struct iax_frame *f, struct ast_iax2_full_hdr *fhi, int rx, struct sockaddr_in *sin, int datalen);
|
||||
|
||||
extern const char *iax_ie2str(int ie);
|
||||
const char *iax_ie2str(int ie);
|
||||
|
||||
extern int iax_ie_append_raw(struct iax_ie_data *ied, unsigned char ie, void *data, int datalen);
|
||||
extern int iax_ie_append_addr(struct iax_ie_data *ied, unsigned char ie, struct sockaddr_in *sin);
|
||||
extern int iax_ie_append_int(struct iax_ie_data *ied, unsigned char ie, unsigned int value);
|
||||
extern int iax_ie_append_short(struct iax_ie_data *ied, unsigned char ie, unsigned short value);
|
||||
extern int iax_ie_append_str(struct iax_ie_data *ied, unsigned char ie, char *str);
|
||||
extern int iax_ie_append_byte(struct iax_ie_data *ied, unsigned char ie, unsigned char dat);
|
||||
extern int iax_ie_append(struct iax_ie_data *ied, unsigned char ie);
|
||||
extern int iax_parse_ies(struct iax_ies *ies, unsigned char *data, int datalen);
|
||||
int iax_ie_append_raw(struct iax_ie_data *ied, unsigned char ie, const void *data, int datalen);
|
||||
int iax_ie_append_addr(struct iax_ie_data *ied, unsigned char ie, const struct sockaddr_in *sin);
|
||||
int iax_ie_append_int(struct iax_ie_data *ied, unsigned char ie, unsigned int value);
|
||||
int iax_ie_append_short(struct iax_ie_data *ied, unsigned char ie, unsigned short value);
|
||||
int iax_ie_append_str(struct iax_ie_data *ied, unsigned char ie, const char *str);
|
||||
int iax_ie_append_byte(struct iax_ie_data *ied, unsigned char ie, unsigned char dat);
|
||||
int iax_ie_append(struct iax_ie_data *ied, unsigned char ie);
|
||||
int iax_parse_ies(struct iax_ies *ies, unsigned char *data, int datalen);
|
||||
|
||||
extern int iax_get_frames(void);
|
||||
extern int iax_get_iframes(void);
|
||||
extern int iax_get_oframes(void);
|
||||
int iax_get_frames(void);
|
||||
int iax_get_iframes(void);
|
||||
int iax_get_oframes(void);
|
||||
|
||||
extern void iax_frame_wrap(struct iax_frame *fr, struct ast_frame *f);
|
||||
extern struct iax_frame *iax_frame_new(int direction, int datalen);
|
||||
extern void iax_frame_free(struct iax_frame *fr);
|
||||
void iax_frame_wrap(struct iax_frame *fr, struct ast_frame *f);
|
||||
struct iax_frame *iax_frame_new(int direction, int datalen);
|
||||
void iax_frame_free(struct iax_frame *fr);
|
||||
#endif
|
||||
|
|
2
cli.c
2
cli.c
|
@ -739,7 +739,7 @@ static int handle_showchan(int fd, int argc, char *argv[])
|
|||
" Application: %s\n"
|
||||
" Data: %s\n"
|
||||
" Blocking in: %s\n",
|
||||
c->name, c->type, c->uniqueid,
|
||||
c->name, c->tech->type, c->uniqueid,
|
||||
(c->cid.cid_num ? c->cid.cid_num : "(N/A)"),
|
||||
(c->cid.cid_name ? c->cid.cid_name : "(N/A)"),
|
||||
(c->cid.cid_dnid ? c->cid.cid_dnid : "(N/A)" ), ast_state2str(c->_state), c->_state, c->rings,
|
||||
|
|
40
frame.c
40
frame.c
|
@ -655,9 +655,9 @@ static char frame_show_codec_n_usage[] =
|
|||
" Displays codec mapping\n";
|
||||
|
||||
/*! Dump a frame for debugging purposes */
|
||||
void ast_frame_dump(char *name, struct ast_frame *f, char *prefix)
|
||||
void ast_frame_dump(const char *name, struct ast_frame *f, char *prefix)
|
||||
{
|
||||
char *n = "unknown";
|
||||
const char noname[] = "unknown";
|
||||
char ftype[40] = "Unknown Frametype";
|
||||
char cft[80];
|
||||
char subclass[40] = "Unknown Subclass";
|
||||
|
@ -666,13 +666,16 @@ void ast_frame_dump(char *name, struct ast_frame *f, char *prefix)
|
|||
char cn[60];
|
||||
char cp[40];
|
||||
char cmn[40];
|
||||
if (name)
|
||||
n = name;
|
||||
|
||||
if (!name)
|
||||
name = noname;
|
||||
|
||||
|
||||
if (!f) {
|
||||
ast_verbose("%s [ %s (NULL) ] [%s]\n",
|
||||
term_color(cp, prefix, COLOR_BRMAGENTA, COLOR_BLACK, sizeof(cp)),
|
||||
term_color(cft, "HANGUP", COLOR_BRRED, COLOR_BLACK, sizeof(cft)),
|
||||
term_color(cn, n, COLOR_YELLOW, COLOR_BLACK, sizeof(cn)));
|
||||
term_color(cn, name, COLOR_YELLOW, COLOR_BLACK, sizeof(cn)));
|
||||
return;
|
||||
}
|
||||
/* XXX We should probably print one each of voice and video when the format changes XXX */
|
||||
|
@ -795,22 +798,21 @@ void ast_frame_dump(char *name, struct ast_frame *f, char *prefix)
|
|||
}
|
||||
if (!ast_strlen_zero(moreinfo))
|
||||
ast_verbose("%s [ TYPE: %s (%d) SUBCLASS: %s (%d) '%s' ] [%s]\n",
|
||||
term_color(cp, prefix, COLOR_BRMAGENTA, COLOR_BLACK, sizeof(cp)),
|
||||
term_color(cft, ftype, COLOR_BRRED, COLOR_BLACK, sizeof(cft)),
|
||||
f->frametype,
|
||||
term_color(csub, subclass, COLOR_BRCYAN, COLOR_BLACK, sizeof(csub)),
|
||||
f->subclass,
|
||||
term_color(cmn, moreinfo, COLOR_BRGREEN, COLOR_BLACK, sizeof(cmn)),
|
||||
term_color(cn, n, COLOR_YELLOW, COLOR_BLACK, sizeof(cn)));
|
||||
term_color(cp, prefix, COLOR_BRMAGENTA, COLOR_BLACK, sizeof(cp)),
|
||||
term_color(cft, ftype, COLOR_BRRED, COLOR_BLACK, sizeof(cft)),
|
||||
f->frametype,
|
||||
term_color(csub, subclass, COLOR_BRCYAN, COLOR_BLACK, sizeof(csub)),
|
||||
f->subclass,
|
||||
term_color(cmn, moreinfo, COLOR_BRGREEN, COLOR_BLACK, sizeof(cmn)),
|
||||
term_color(cn, name, COLOR_YELLOW, COLOR_BLACK, sizeof(cn)));
|
||||
else
|
||||
ast_verbose("%s [ TYPE: %s (%d) SUBCLASS: %s (%d) ] [%s]\n",
|
||||
term_color(cp, prefix, COLOR_BRMAGENTA, COLOR_BLACK, sizeof(cp)),
|
||||
term_color(cft, ftype, COLOR_BRRED, COLOR_BLACK, sizeof(cft)),
|
||||
f->frametype,
|
||||
term_color(csub, subclass, COLOR_BRCYAN, COLOR_BLACK, sizeof(csub)),
|
||||
f->subclass,
|
||||
term_color(cn, n, COLOR_YELLOW, COLOR_BLACK, sizeof(cn)));
|
||||
|
||||
term_color(cp, prefix, COLOR_BRMAGENTA, COLOR_BLACK, sizeof(cp)),
|
||||
term_color(cft, ftype, COLOR_BRRED, COLOR_BLACK, sizeof(cft)),
|
||||
f->frametype,
|
||||
term_color(csub, subclass, COLOR_BRCYAN, COLOR_BLACK, sizeof(csub)),
|
||||
f->subclass,
|
||||
term_color(cn, name, COLOR_YELLOW, COLOR_BLACK, sizeof(cn)));
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -33,6 +33,7 @@
|
|||
#include "asterisk/logger.h"
|
||||
#include "asterisk/utils.h"
|
||||
#include "asterisk/app.h"
|
||||
#include "asterisk/stringfields.h"
|
||||
|
||||
static char *builtin_function_language_read(struct ast_channel *chan, char *cmd, char *data, char *buf, size_t len)
|
||||
{
|
||||
|
@ -44,7 +45,7 @@ static char *builtin_function_language_read(struct ast_channel *chan, char *cmd,
|
|||
static void builtin_function_language_write(struct ast_channel *chan, char *cmd, char *data, const char *value)
|
||||
{
|
||||
if (value)
|
||||
ast_copy_string(chan->language, value, sizeof(chan->language));
|
||||
ast_string_field_set(chan, language, value);
|
||||
}
|
||||
|
||||
#ifndef BUILTIN_FUNC
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
#include "asterisk/channel.h"
|
||||
#include "asterisk/pbx.h"
|
||||
#include "asterisk/utils.h"
|
||||
#include "asterisk/stringfields.h"
|
||||
|
||||
static char *function_moh_read(struct ast_channel *chan, char *cmd, char *data, char *buf, size_t len)
|
||||
{
|
||||
|
@ -40,7 +41,7 @@ static char *function_moh_read(struct ast_channel *chan, char *cmd, char *data,
|
|||
|
||||
static void function_moh_write(struct ast_channel *chan, char *cmd, char *data, const char *value)
|
||||
{
|
||||
ast_copy_string(chan->musicclass, value, sizeof(chan->musicclass));
|
||||
ast_string_field_set(chan, musicclass, value);
|
||||
}
|
||||
|
||||
#ifndef BUILTIN_FUNC
|
||||
|
|
4
image.c
4
image.c
|
@ -94,7 +94,7 @@ static int file_exists(char *filename)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static void make_filename(char *buf, int len, char *filename, char *preflang, char *ext)
|
||||
static void make_filename(char *buf, int len, char *filename, const char *preflang, char *ext)
|
||||
{
|
||||
if (filename[0] == '/') {
|
||||
if (preflang && strlen(preflang))
|
||||
|
@ -109,7 +109,7 @@ static void make_filename(char *buf, int len, char *filename, char *preflang, ch
|
|||
}
|
||||
}
|
||||
|
||||
struct ast_frame *ast_read_image(char *filename, char *preflang, int format)
|
||||
struct ast_frame *ast_read_image(char *filename, const char *preflang, int format)
|
||||
{
|
||||
struct ast_imager *i;
|
||||
char buf[256];
|
||||
|
|
|
@ -96,29 +96,29 @@ struct ast_cdr {
|
|||
struct ast_cdr *next;
|
||||
};
|
||||
|
||||
extern void ast_cdr_getvar(struct ast_cdr *cdr, const char *name, char **ret, char *workspace, int workspacelen, int recur);
|
||||
extern int ast_cdr_setvar(struct ast_cdr *cdr, const char *name, const char *value, int recur);
|
||||
extern int ast_cdr_serialize_variables(struct ast_cdr *cdr, char *buf, size_t size, char delim, char sep, int recur);
|
||||
extern void ast_cdr_free_vars(struct ast_cdr *cdr, int recur);
|
||||
extern int ast_cdr_copy_vars(struct ast_cdr *to_cdr, struct ast_cdr *from_cdr);
|
||||
void ast_cdr_getvar(struct ast_cdr *cdr, const char *name, char **ret, char *workspace, int workspacelen, int recur);
|
||||
int ast_cdr_setvar(struct ast_cdr *cdr, const char *name, const char *value, int recur);
|
||||
int ast_cdr_serialize_variables(struct ast_cdr *cdr, char *buf, size_t size, char delim, char sep, int recur);
|
||||
void ast_cdr_free_vars(struct ast_cdr *cdr, int recur);
|
||||
int ast_cdr_copy_vars(struct ast_cdr *to_cdr, struct ast_cdr *from_cdr);
|
||||
|
||||
typedef int (*ast_cdrbe)(struct ast_cdr *cdr);
|
||||
|
||||
/*! \brief Allocate a CDR record
|
||||
* Returns a malloc'd ast_cdr structure, returns NULL on error (malloc failure)
|
||||
*/
|
||||
extern struct ast_cdr *ast_cdr_alloc(void);
|
||||
struct ast_cdr *ast_cdr_alloc(void);
|
||||
|
||||
/*! \brief Duplicate a record
|
||||
* Returns a malloc'd ast_cdr structure, returns NULL on error (malloc failure)
|
||||
*/
|
||||
extern struct ast_cdr *ast_cdr_dup(struct ast_cdr *cdr);
|
||||
struct ast_cdr *ast_cdr_dup(struct ast_cdr *cdr);
|
||||
|
||||
/*! \brief Free a CDR record
|
||||
* \param cdr ast_cdr structure to free
|
||||
* Returns nothing important
|
||||
*/
|
||||
extern void ast_cdr_free(struct ast_cdr *cdr);
|
||||
void ast_cdr_free(struct ast_cdr *cdr);
|
||||
|
||||
/*! \brief Initialize based on a channel
|
||||
* \param cdr Call Detail Record to use for channel
|
||||
|
@ -126,7 +126,7 @@ extern void ast_cdr_free(struct ast_cdr *cdr);
|
|||
* Initializes a CDR and associates it with a particular channel
|
||||
* Return is negligible. (returns 0 by default)
|
||||
*/
|
||||
extern int ast_cdr_init(struct ast_cdr *cdr, struct ast_channel *chan);
|
||||
int ast_cdr_init(struct ast_cdr *cdr, struct ast_channel *chan);
|
||||
|
||||
/*! Initialize based on a channel */
|
||||
/*!
|
||||
|
@ -135,7 +135,7 @@ extern int ast_cdr_init(struct ast_cdr *cdr, struct ast_channel *chan);
|
|||
* Initializes a CDR and associates it with a particular channel
|
||||
* Return is negligible. (returns 0 by default)
|
||||
*/
|
||||
extern int ast_cdr_setcid(struct ast_cdr *cdr, struct ast_channel *chan);
|
||||
int ast_cdr_setcid(struct ast_cdr *cdr, struct ast_channel *chan);
|
||||
|
||||
/*! Register a CDR handling engine */
|
||||
/*!
|
||||
|
@ -145,14 +145,14 @@ extern int ast_cdr_setcid(struct ast_cdr *cdr, struct ast_channel *chan);
|
|||
* Used to register a Call Detail Record handler.
|
||||
* Returns -1 on error, 0 on success.
|
||||
*/
|
||||
extern int ast_cdr_register(char *name, char *desc, ast_cdrbe be);
|
||||
int ast_cdr_register(char *name, char *desc, ast_cdrbe be);
|
||||
|
||||
/*! Unregister a CDR handling engine */
|
||||
/*!
|
||||
* \param name name of CDR handler to unregister
|
||||
* Unregisters a CDR by it's name
|
||||
*/
|
||||
extern void ast_cdr_unregister(char *name);
|
||||
void ast_cdr_unregister(char *name);
|
||||
|
||||
/*! Start a call */
|
||||
/*!
|
||||
|
@ -160,28 +160,28 @@ extern void ast_cdr_unregister(char *name);
|
|||
* Starts all CDR stuff necessary for monitoring a call
|
||||
* Returns nothing important
|
||||
*/
|
||||
extern void ast_cdr_start(struct ast_cdr *cdr);
|
||||
void ast_cdr_start(struct ast_cdr *cdr);
|
||||
|
||||
/*! Answer a call */
|
||||
/*!
|
||||
* \param cdr the cdr you wish to associate with the call
|
||||
* Starts all CDR stuff necessary for doing CDR when answering a call
|
||||
*/
|
||||
extern void ast_cdr_answer(struct ast_cdr *cdr);
|
||||
void ast_cdr_answer(struct ast_cdr *cdr);
|
||||
|
||||
/*! Busy a call */
|
||||
/*!
|
||||
* \param cdr the cdr you wish to associate with the call
|
||||
* Returns nothing important
|
||||
*/
|
||||
extern void ast_cdr_busy(struct ast_cdr *cdr);
|
||||
void ast_cdr_busy(struct ast_cdr *cdr);
|
||||
|
||||
/*! Fail a call */
|
||||
/*!
|
||||
* \param cdr the cdr you wish to associate with the call
|
||||
* Returns nothing important
|
||||
*/
|
||||
extern void ast_cdr_failed(struct ast_cdr *cdr);
|
||||
void ast_cdr_failed(struct ast_cdr *cdr);
|
||||
|
||||
/*! Save the result of the call based on the AST_CAUSE_* */
|
||||
/*!
|
||||
|
@ -189,7 +189,7 @@ extern void ast_cdr_failed(struct ast_cdr *cdr);
|
|||
* Returns nothing important
|
||||
* \param cause the AST_CAUSE_*
|
||||
*/
|
||||
extern int ast_cdr_disposition(struct ast_cdr *cdr, int cause);
|
||||
int ast_cdr_disposition(struct ast_cdr *cdr, int cause);
|
||||
|
||||
/*! End a call */
|
||||
/*!
|
||||
|
@ -197,7 +197,7 @@ extern int ast_cdr_disposition(struct ast_cdr *cdr, int cause);
|
|||
* Registers the end of call time in the cdr structure.
|
||||
* Returns nothing important
|
||||
*/
|
||||
extern void ast_cdr_end(struct ast_cdr *cdr);
|
||||
void ast_cdr_end(struct ast_cdr *cdr);
|
||||
|
||||
/*! Detaches the detail record for posting (and freeing) either now or at a
|
||||
* later time in bulk with other records during batch mode operation */
|
||||
|
@ -206,7 +206,7 @@ extern void ast_cdr_end(struct ast_cdr *cdr);
|
|||
* Prevents the channel thread from blocking on the CDR handling
|
||||
* Returns nothing
|
||||
*/
|
||||
extern void ast_cdr_detach(struct ast_cdr *cdr);
|
||||
void ast_cdr_detach(struct ast_cdr *cdr);
|
||||
|
||||
/*! Spawns (possibly) a new thread to submit a batch of CDRs to the backend engines */
|
||||
/*!
|
||||
|
@ -214,7 +214,7 @@ extern void ast_cdr_detach(struct ast_cdr *cdr);
|
|||
* Blocks the asterisk shutdown procedures until the CDR data is submitted.
|
||||
* Returns nothing
|
||||
*/
|
||||
extern void ast_cdr_submit_batch(int shutdown);
|
||||
void ast_cdr_submit_batch(int shutdown);
|
||||
|
||||
/*! Set the destination channel, if there was one */
|
||||
/*!
|
||||
|
@ -223,7 +223,7 @@ extern void ast_cdr_submit_batch(int shutdown);
|
|||
* Sets the destination channel the CDR is applied to
|
||||
* Returns nothing
|
||||
*/
|
||||
extern void ast_cdr_setdestchan(struct ast_cdr *cdr, char *chan);
|
||||
void ast_cdr_setdestchan(struct ast_cdr *cdr, const char *chan);
|
||||
|
||||
/*! Set the last executed application */
|
||||
/*!
|
||||
|
@ -233,7 +233,7 @@ extern void ast_cdr_setdestchan(struct ast_cdr *cdr, char *chan);
|
|||
* Changes the value of the last executed app
|
||||
* Returns nothing
|
||||
*/
|
||||
extern void ast_cdr_setapp(struct ast_cdr *cdr, char *app, char *data);
|
||||
void ast_cdr_setapp(struct ast_cdr *cdr, char *app, char *data);
|
||||
|
||||
/*! Convert a string to a detail record AMA flag */
|
||||
/*!
|
||||
|
@ -241,7 +241,7 @@ extern void ast_cdr_setapp(struct ast_cdr *cdr, char *app, char *data);
|
|||
* Converts the string form of the flag to the binary form.
|
||||
* Returns the binary form of the flag
|
||||
*/
|
||||
extern int ast_cdr_amaflags2int(const char *flag);
|
||||
int ast_cdr_amaflags2int(const char *flag);
|
||||
|
||||
/*! Disposition to a string */
|
||||
/*!
|
||||
|
@ -249,7 +249,7 @@ extern int ast_cdr_amaflags2int(const char *flag);
|
|||
* Converts the binary form of a disposition to string form.
|
||||
* Returns a pointer to the string form
|
||||
*/
|
||||
extern char *ast_cdr_disp2str(int disposition);
|
||||
char *ast_cdr_disp2str(int disposition);
|
||||
|
||||
/*! Reset the detail record, optionally posting it first */
|
||||
/*!
|
||||
|
@ -257,7 +257,7 @@ extern char *ast_cdr_disp2str(int disposition);
|
|||
* \param flags |AST_CDR_FLAG_POSTED whether or not to post the cdr first before resetting it
|
||||
* |AST_CDR_FLAG_LOCKED whether or not to reset locked CDR's
|
||||
*/
|
||||
extern void ast_cdr_reset(struct ast_cdr *cdr, struct ast_flags *flags);
|
||||
void ast_cdr_reset(struct ast_cdr *cdr, struct ast_flags *flags);
|
||||
|
||||
/*! Flags to a string */
|
||||
/*!
|
||||
|
@ -265,33 +265,33 @@ extern void ast_cdr_reset(struct ast_cdr *cdr, struct ast_flags *flags);
|
|||
* Converts binary flags to string flags
|
||||
* Returns string with flag name
|
||||
*/
|
||||
extern char *ast_cdr_flags2str(int flags);
|
||||
char *ast_cdr_flags2str(int flags);
|
||||
|
||||
extern int ast_cdr_setaccount(struct ast_channel *chan, const char *account);
|
||||
extern int ast_cdr_setamaflags(struct ast_channel *chan, const char *amaflags);
|
||||
int ast_cdr_setaccount(struct ast_channel *chan, const char *account);
|
||||
int ast_cdr_setamaflags(struct ast_channel *chan, const char *amaflags);
|
||||
|
||||
|
||||
extern int ast_cdr_setuserfield(struct ast_channel *chan, const char *userfield);
|
||||
extern int ast_cdr_appenduserfield(struct ast_channel *chan, const char *userfield);
|
||||
int ast_cdr_setuserfield(struct ast_channel *chan, const char *userfield);
|
||||
int ast_cdr_appenduserfield(struct ast_channel *chan, const char *userfield);
|
||||
|
||||
|
||||
/* Update CDR on a channel */
|
||||
extern int ast_cdr_update(struct ast_channel *chan);
|
||||
int ast_cdr_update(struct ast_channel *chan);
|
||||
|
||||
|
||||
extern int ast_default_amaflags;
|
||||
|
||||
extern char ast_default_accountcode[AST_MAX_ACCOUNT_CODE];
|
||||
|
||||
extern struct ast_cdr *ast_cdr_append(struct ast_cdr *cdr, struct ast_cdr *newcdr);
|
||||
struct ast_cdr *ast_cdr_append(struct ast_cdr *cdr, struct ast_cdr *newcdr);
|
||||
|
||||
/*! Reload the configuration file cdr.conf and start/stop CDR scheduling thread */
|
||||
extern void ast_cdr_engine_reload(void);
|
||||
void ast_cdr_engine_reload(void);
|
||||
|
||||
/*! Load the configuration file cdr.conf and possibly start the CDR scheduling thread */
|
||||
extern int ast_cdr_engine_init(void);
|
||||
int ast_cdr_engine_init(void);
|
||||
|
||||
/*! Submit any remaining CDRs and prepare for shutdown */
|
||||
extern void ast_cdr_engine_term(void);
|
||||
void ast_cdr_engine_term(void);
|
||||
|
||||
#endif /* _ASTERISK_CDR_H */
|
||||
|
|
|
@ -113,6 +113,7 @@ extern "C" {
|
|||
#include "asterisk/cdr.h"
|
||||
#include "asterisk/utils.h"
|
||||
#include "asterisk/linkedlists.h"
|
||||
#include "asterisk/stringfields.h"
|
||||
|
||||
#define MAX_LANGUAGE 20
|
||||
|
||||
|
@ -266,24 +267,23 @@ struct ast_channel_spy_list;
|
|||
* this structure is changed. XXX
|
||||
*/
|
||||
struct ast_channel {
|
||||
/*! ASCII unique channel name */
|
||||
char name[AST_CHANNEL_NAME];
|
||||
|
||||
/*! Technology (point to channel driver) */
|
||||
const struct ast_channel_tech *tech;
|
||||
|
||||
/*! Private data used by the technology driver */
|
||||
void *tech_pvt;
|
||||
|
||||
/*! Language requested for voice prompts */
|
||||
char language[MAX_LANGUAGE];
|
||||
/*! Type of channel */
|
||||
const char *type;
|
||||
AST_DECLARE_STRING_FIELDS(
|
||||
AST_STRING_FIELD(name); /*! ASCII unique channel name */
|
||||
AST_STRING_FIELD(language); /*! Language requested for voice prompts */
|
||||
AST_STRING_FIELD(musicclass); /*! Default music class */
|
||||
AST_STRING_FIELD(accountcode); /*! Account code for billing */
|
||||
AST_STRING_FIELD(call_forward); /*! Where to forward to if asked to dial on this interface */
|
||||
);
|
||||
|
||||
/*! File descriptor for channel -- Drivers will poll on these file descriptors, so at least one must be non -1. */
|
||||
int fds[AST_MAX_FDS];
|
||||
|
||||
/*! Default music class */
|
||||
char musicclass[MAX_MUSICCLASS];
|
||||
/*! Music State*/
|
||||
void *music_state;
|
||||
/*! Current generator data if there is any */
|
||||
|
@ -372,14 +372,10 @@ struct ast_channel {
|
|||
struct ast_pbx *pbx;
|
||||
/*! Set BEFORE PBX is started to determine AMA flags */
|
||||
int amaflags;
|
||||
/*! Account code for billing */
|
||||
char accountcode[AST_MAX_ACCOUNT_CODE];
|
||||
/*! Call Detail Record */
|
||||
struct ast_cdr *cdr;
|
||||
/*! Whether or not ADSI is detected on CPE */
|
||||
int adsicpe;
|
||||
/*! Where to forward to if asked to dial on this interface */
|
||||
char call_forward[AST_MAX_EXTENSION];
|
||||
|
||||
/*! Tone zone as set in indications.conf */
|
||||
struct tone_zone *zone;
|
||||
|
|
|
@ -441,7 +441,7 @@ extern struct ast_frame *ast_smoother_read(struct ast_smoother *s);
|
|||
#define ast_smoother_feed_le(s,f) __ast_smoother_feed(s, f, 1)
|
||||
#endif
|
||||
|
||||
extern void ast_frame_dump(char *name, struct ast_frame *f, char *prefix);
|
||||
extern void ast_frame_dump(const char *name, struct ast_frame *f, char *prefix);
|
||||
|
||||
/*! \brief Initialize a codec preference to "no preference" */
|
||||
extern void ast_codec_pref_init(struct ast_codec_pref *pref);
|
||||
|
|
|
@ -68,7 +68,7 @@ extern int ast_send_image(struct ast_channel *chan, char *filename);
|
|||
* Make an image from a filename ??? No estoy positivo
|
||||
* Returns an ast_frame on success, NULL on failure
|
||||
*/
|
||||
extern struct ast_frame *ast_read_image(char *filename, char *preflang, int format);
|
||||
extern struct ast_frame *ast_read_image(char *filename, const char *preflang, int format);
|
||||
|
||||
/*! Register image format */
|
||||
/*!
|
||||
|
|
|
@ -28,16 +28,17 @@ extern "C" {
|
|||
#endif
|
||||
|
||||
/*! Turn on music on hold on a given channel */
|
||||
extern int ast_moh_start(struct ast_channel *chan, char *mclass);
|
||||
int ast_moh_start(struct ast_channel *chan, const char *mclass);
|
||||
|
||||
/*! Turn off music on hold on a given channel */
|
||||
extern void ast_moh_stop(struct ast_channel *chan);
|
||||
void ast_moh_stop(struct ast_channel *chan);
|
||||
|
||||
extern void ast_install_music_functions(int (*start_ptr)(struct ast_channel *, char *),
|
||||
void (*stop_ptr)(struct ast_channel *),
|
||||
void (*cleanup_ptr)(struct ast_channel *));
|
||||
void ast_install_music_functions(int (*start_ptr)(struct ast_channel *, const char *),
|
||||
void (*stop_ptr)(struct ast_channel *),
|
||||
void (*cleanup_ptr)(struct ast_channel *));
|
||||
|
||||
extern void ast_uninstall_music_functions(void);
|
||||
void ast_uninstall_music_functions(void);
|
||||
|
||||
void ast_moh_cleanup(struct ast_channel *chan);
|
||||
|
||||
#if defined(__cplusplus) || defined(c_plusplus)
|
||||
|
|
|
@ -167,11 +167,6 @@ void __ast_string_field_index_build(struct ast_string_field_mgr *mgr,
|
|||
ast_string_field *fields, int num_fields,
|
||||
int index, const char *format, ...);
|
||||
|
||||
/*!
|
||||
The default amount of storage to be allocated for a field pool.
|
||||
*/
|
||||
#define AST_STRING_FIELD_DEFAULT_POOL 512
|
||||
|
||||
/*!
|
||||
\brief Declare a string field
|
||||
\param name The field name
|
||||
|
@ -194,7 +189,7 @@ void __ast_string_field_index_build(struct ast_string_field_mgr *mgr,
|
|||
\return the number of fields in the structure's definition
|
||||
*/
|
||||
#define ast_string_field_count(x) \
|
||||
(offsetof(typeof(*x), __end_field) - offsetof(typeof(*x), __begin_field)) / sizeof(ast_string_field)
|
||||
(offsetof(typeof(*(x)), __end_field) - offsetof(typeof(*(x)), __begin_field)) / sizeof(ast_string_field)
|
||||
|
||||
/*!
|
||||
\brief Get the index of a field in a structure
|
||||
|
@ -209,10 +204,11 @@ void __ast_string_field_index_build(struct ast_string_field_mgr *mgr,
|
|||
/*!
|
||||
\brief Initialize a field pool and fields
|
||||
\param x Pointer to a structure containing fields
|
||||
\param size Amount of storage to allocate
|
||||
\return 0 on failure, non-zero on success
|
||||
*/
|
||||
#define ast_string_field_init(x) \
|
||||
__ast_string_field_init(&x->__field_mgr, AST_STRING_FIELD_DEFAULT_POOL, &x->__begin_field[0], ast_string_field_count(x))
|
||||
#define ast_string_field_init(x, size) \
|
||||
__ast_string_field_init(&(x)->__field_mgr, size, &(x)->__begin_field[0], ast_string_field_count(x))
|
||||
|
||||
/*!
|
||||
\brief Set a field to a simple string value
|
||||
|
@ -222,8 +218,8 @@ void __ast_string_field_index_build(struct ast_string_field_mgr *mgr,
|
|||
\return nothing
|
||||
*/
|
||||
#define ast_string_field_index_set(x, index, data) do { \
|
||||
if ((x->__begin_field[index] = __ast_string_field_alloc_space(&x->__field_mgr, strlen(data) + 1, &x->__begin_field[0], ast_string_field_count(x)))) \
|
||||
strcpy((char *) x->__begin_field[index], data); \
|
||||
if (((x)->__begin_field[index] = __ast_string_field_alloc_space(&(x)->__field_mgr, strlen(data) + 1, &(x)->__begin_field[0], ast_string_field_count(x)))) \
|
||||
strcpy((char *) (x)->__begin_field[index], data); \
|
||||
} while (0)
|
||||
|
||||
/*!
|
||||
|
@ -245,7 +241,7 @@ void __ast_string_field_index_build(struct ast_string_field_mgr *mgr,
|
|||
\return nothing
|
||||
*/
|
||||
#define ast_string_field_index_build(x, index, fmt, args...) \
|
||||
__ast_string_field_index_build(&x->__field_mgr, &x->__begin_field[0], ast_string_field_count(x), index, fmt, args)
|
||||
__ast_string_field_index_build(&(x)->__field_mgr, &(x)->__begin_field[0], ast_string_field_count(x), index, fmt, args)
|
||||
|
||||
/*!
|
||||
\brief Set a field to a complex (built) value
|
||||
|
@ -269,7 +265,7 @@ void __ast_string_field_index_build(struct ast_string_field_mgr *mgr,
|
|||
pointer is just changed to point to an empty string.
|
||||
*/
|
||||
#define ast_string_field_index_free(x, index) do { \
|
||||
x->__begin_field[index] = __ast_string_field_empty; \
|
||||
(x)->__begin_field[index] = __ast_string_field_empty; \
|
||||
} while(0)
|
||||
|
||||
/*!
|
||||
|
@ -299,7 +295,7 @@ void __ast_string_field_index_build(struct ast_string_field_mgr *mgr,
|
|||
struct ast_string_field_pool *this, *prev; \
|
||||
for (index = 0; index < ast_string_field_count(x); index ++) \
|
||||
ast_string_field_index_free(x, index); \
|
||||
for (this = x->__field_mgr.pool; this; this = prev) { \
|
||||
for (this = (x)->__field_mgr.pool; this; this = prev) { \
|
||||
prev = this->prev; \
|
||||
free(this); \
|
||||
} \
|
||||
|
|
7
pbx.c
7
pbx.c
|
@ -58,6 +58,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
|
|||
#include "asterisk/app.h"
|
||||
#include "asterisk/devicestate.h"
|
||||
#include "asterisk/compat.h"
|
||||
#include "asterisk/stringfields.h"
|
||||
|
||||
/*!
|
||||
* \note I M P O R T A N T :
|
||||
|
@ -4237,7 +4238,7 @@ int ast_async_goto(struct ast_channel *chan, const char *context, const char *ex
|
|||
struct ast_channel *tmpchan;
|
||||
tmpchan = ast_channel_alloc(0);
|
||||
if (tmpchan) {
|
||||
snprintf(tmpchan->name, sizeof(tmpchan->name), "AsyncGoto/%s", chan->name);
|
||||
ast_string_field_build(tmpchan, name, "AsyncGoto/%s", chan->name);
|
||||
ast_setstate(tmpchan, chan->_state);
|
||||
/* Make formats okay */
|
||||
tmpchan->readformat = chan->readformat;
|
||||
|
@ -4736,7 +4737,7 @@ int ast_pbx_outgoing_exten(const char *type, int format, void *data, int timeout
|
|||
if (ast_exists_extension(chan, context, "failed", 1, NULL)) {
|
||||
chan = ast_channel_alloc(0);
|
||||
if (chan) {
|
||||
ast_copy_string(chan->name, "OutgoingSpoolFailed", sizeof(chan->name));
|
||||
ast_string_field_set(chan, name, "OutgoingSpoolFailed");
|
||||
if (!ast_strlen_zero(context))
|
||||
ast_copy_string(chan->context, context, sizeof(chan->context));
|
||||
ast_copy_string(chan->exten, "failed", sizeof(chan->exten));
|
||||
|
@ -5344,7 +5345,7 @@ static int pbx_builtin_background(struct ast_channel *chan, void *data)
|
|||
AST_STANDARD_APP_ARGS(args, parse);
|
||||
|
||||
if (!args.lang)
|
||||
args.lang = chan->language;
|
||||
args.lang = (char *) chan->language;
|
||||
|
||||
if (!args.context)
|
||||
args.context = chan->context;
|
||||
|
|
|
@ -341,7 +341,7 @@ static void setup_env(struct ast_channel *chan, char *request, int fd, int enhan
|
|||
fdprintf(fd, "agi_request: %s\n", request);
|
||||
fdprintf(fd, "agi_channel: %s\n", chan->name);
|
||||
fdprintf(fd, "agi_language: %s\n", chan->language);
|
||||
fdprintf(fd, "agi_type: %s\n", chan->type);
|
||||
fdprintf(fd, "agi_type: %s\n", chan->tech->type);
|
||||
fdprintf(fd, "agi_uniqueid: %s\n", chan->uniqueid);
|
||||
|
||||
/* ANI/DNIS */
|
||||
|
|
|
@ -174,7 +174,7 @@ static void check_goto_on_transfer(struct ast_channel *chan)
|
|||
for (x = goto_on_transfer; x && *x; x++)
|
||||
if (*x == '^')
|
||||
*x = '|';
|
||||
strcpy(xferchan->name, chan->name);
|
||||
ast_string_field_set(xferchan, name, chan->name);
|
||||
/* Make formats okay */
|
||||
xferchan->readformat = chan->readformat;
|
||||
xferchan->writeformat = chan->writeformat;
|
||||
|
@ -201,9 +201,9 @@ static void *ast_bridge_call_thread(void *data)
|
|||
struct ast_bridge_thread_obj *tobj = data;
|
||||
|
||||
tobj->chan->appl = "Transferred Call";
|
||||
tobj->chan->data = tobj->peer->name;
|
||||
tobj->chan->data = (char *) tobj->peer->name;
|
||||
tobj->peer->appl = "Transferred Call";
|
||||
tobj->peer->data = tobj->chan->name;
|
||||
tobj->peer->data = (char *) tobj->chan->name;
|
||||
if (tobj->chan->cdr) {
|
||||
ast_cdr_reset(tobj->chan->cdr, NULL);
|
||||
ast_cdr_setdestchan(tobj->chan->cdr, tobj->peer->name);
|
||||
|
@ -385,7 +385,7 @@ int ast_masq_park_call(struct ast_channel *rchan, struct ast_channel *peer, int
|
|||
/* Make a new, fake channel that we'll use to masquerade in the real one */
|
||||
if ((chan = ast_channel_alloc(0))) {
|
||||
/* Let us keep track of the channel name */
|
||||
snprintf(chan->name, sizeof (chan->name), "Parked/%s",rchan->name);
|
||||
ast_string_field_build(chan, name, "Parked/%s",rchan->name);
|
||||
|
||||
/* Make formats okay */
|
||||
chan->readformat = rchan->readformat;
|
||||
|
@ -758,7 +758,7 @@ static int builtin_atxfer(struct ast_channel *chan, struct ast_channel *peer, st
|
|||
}
|
||||
|
||||
if ((xferchan = ast_channel_alloc(0))) {
|
||||
snprintf(xferchan->name, sizeof (xferchan->name), "Transfered/%s",transferee->name);
|
||||
ast_string_field_build(xferchan, name, "Transfered/%s", transferee->name);
|
||||
/* Make formats okay */
|
||||
xferchan->readformat = transferee->readformat;
|
||||
xferchan->writeformat = transferee->writeformat;
|
||||
|
@ -1280,7 +1280,7 @@ int ast_bridge_call(struct ast_channel *chan,struct ast_channel *peer,struct ast
|
|||
if (ast_answer(chan))
|
||||
return -1;
|
||||
peer->appl = "Bridged Call";
|
||||
peer->data = chan->name;
|
||||
peer->data = (char *) chan->name;
|
||||
|
||||
/* copy the userfield from the B-leg to A-leg if applicable */
|
||||
if (chan->cdr && peer->cdr && !ast_strlen_zero(peer->cdr->userfield)) {
|
||||
|
|
|
@ -64,6 +64,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
|
|||
#include "asterisk/config.h"
|
||||
#include "asterisk/utils.h"
|
||||
#include "asterisk/cli.h"
|
||||
#include "asterisk/stringfields.h"
|
||||
|
||||
#define MAX_MOHFILES 512
|
||||
#define MAX_MOHFILE_LEN 128
|
||||
|
@ -573,7 +574,7 @@ static int moh2_exec(struct ast_channel *chan, void *data)
|
|||
ast_log(LOG_WARNING, "SetMusicOnHold requires an argument (class)\n");
|
||||
return -1;
|
||||
}
|
||||
strncpy(chan->musicclass, data, sizeof(chan->musicclass) - 1);
|
||||
ast_string_field_set(chan, musicclass, data);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -595,7 +596,7 @@ static int moh4_exec(struct ast_channel *chan, void *data)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static struct mohclass *get_mohbyname(char *name)
|
||||
static struct mohclass *get_mohbyname(const char *name)
|
||||
{
|
||||
struct mohclass *moh;
|
||||
moh = mohclasses;
|
||||
|
@ -862,7 +863,7 @@ static void local_ast_moh_cleanup(struct ast_channel *chan)
|
|||
}
|
||||
}
|
||||
|
||||
static int local_ast_moh_start(struct ast_channel *chan, char *class)
|
||||
static int local_ast_moh_start(struct ast_channel *chan, const char *class)
|
||||
{
|
||||
struct mohclass *mohclass;
|
||||
|
||||
|
|
2
rtp.c
2
rtp.c
|
@ -742,7 +742,7 @@ static struct ast_rtp_protocol *get_proto(struct ast_channel *chan)
|
|||
|
||||
AST_LIST_LOCK(&protos);
|
||||
AST_LIST_TRAVERSE(&protos, cur, list) {
|
||||
if (cur->type == chan->type)
|
||||
if (cur->type == chan->tech->type)
|
||||
break;
|
||||
}
|
||||
AST_LIST_UNLOCK(&protos);
|
||||
|
|
Reference in New Issue