mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-19 11:42:27 +00:00
Make chan_zap reloadable (bug #2637)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@4023 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
2
CREDITS
2
CREDITS
@@ -59,6 +59,8 @@ Thorsten Lockert - OpenBSD, FreeBSD ports, making MacOS X port run on 10.3,
|
||||
dialplan include verification, route lookup on OpenBSD, various other
|
||||
bugs. tholo@sigmasoft.com
|
||||
Brian West - ODBC support and Bug Marshaling
|
||||
Josh Roberson - chan_zap reload support, Advanced Voicemail Features, other misc. patches,
|
||||
and Bug Marshalling. - josh@asteriasgi.com, http://www.asteriasgi.com
|
||||
William Waites - syslog support, SIP NAT traversal for SIP-UA. ww@styx.org
|
||||
Rich Murphey - Porting to FreeBSD, NetBSD, OpenBSD, and Darwin.
|
||||
rich@whiteoaklabs.com http://whiteoaklabs.com
|
||||
|
@@ -6007,34 +6007,6 @@ static int restart_monitor(void)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int reset_channel(struct zt_pvt *p)
|
||||
{
|
||||
int ioctlflag = 1;
|
||||
int res = 0;
|
||||
int i = 0;
|
||||
|
||||
ast_log(LOG_DEBUG, "reset_channel()\n");
|
||||
if (p->owner) {
|
||||
ioctlflag = 0;
|
||||
p->owner->_softhangup |= AST_SOFTHANGUP_DEV;
|
||||
}
|
||||
for (i = 0; i < 3; i++) {
|
||||
if (p->subs[i].owner) {
|
||||
ioctlflag = 0;
|
||||
p->subs[i].owner->_softhangup |= AST_SOFTHANGUP_DEV;
|
||||
}
|
||||
}
|
||||
if (ioctlflag) {
|
||||
res = zt_set_hook(p->subs[SUB_REAL].zfd, ZT_ONHOOK);
|
||||
if (res < 0) {
|
||||
ast_log(LOG_ERROR, "Unable to hangup chan_zap channel %d (ioctl)\n", p->channel);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef ZAPATA_PRI
|
||||
static int pri_resolve_span(int *span, int channel, int offset, struct zt_spaninfo *si)
|
||||
{
|
||||
@@ -6149,7 +6121,7 @@ static int pri_create_spanmap(int span, int trunkgroup, int logicalspan)
|
||||
|
||||
#endif
|
||||
|
||||
static struct zt_pvt *mkintf(int channel, int signalling, int radio, struct zt_pri *pri)
|
||||
static struct zt_pvt *mkintf(int channel, int signalling, int radio, struct zt_pri *pri, int reloading)
|
||||
{
|
||||
/* Make a zt_pvt structure for this interface (or CRV if "pri" is specified) */
|
||||
struct zt_pvt *tmp = NULL, *tmp2, *prev = NULL;
|
||||
@@ -6192,7 +6164,7 @@ static struct zt_pvt *mkintf(int channel, int signalling, int radio, struct zt_p
|
||||
tmp2 = tmp2->next;
|
||||
}
|
||||
|
||||
if (!here) {
|
||||
if (!here && !reloading) {
|
||||
tmp = (struct zt_pvt*)malloc(sizeof(struct zt_pvt));
|
||||
if (!tmp) {
|
||||
ast_log(LOG_ERROR, "MALLOC FAILED\n");
|
||||
@@ -6208,6 +6180,7 @@ static struct zt_pvt *mkintf(int channel, int signalling, int radio, struct zt_p
|
||||
}
|
||||
|
||||
if (tmp) {
|
||||
if (!here) {
|
||||
if ((channel != CHAN_PSEUDO) && !pri) {
|
||||
snprintf(fn, sizeof(fn), "%d", channel);
|
||||
/* Open non-blocking */
|
||||
@@ -6231,14 +6204,6 @@ static struct zt_pvt *mkintf(int channel, int signalling, int radio, struct zt_p
|
||||
destroy_zt_pvt(&tmp);
|
||||
return tmp;
|
||||
}
|
||||
if (here) {
|
||||
if (tmp->sig != signalling) {
|
||||
if (reset_channel(tmp)) {
|
||||
ast_log(LOG_ERROR, "Failed to reset chan_zap channel %d\n", tmp->channel);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
tmp->law = p.curlaw;
|
||||
tmp->span = p.spanno;
|
||||
span = p.spanno - 1;
|
||||
@@ -6383,6 +6348,12 @@ static struct zt_pvt *mkintf(int channel, int signalling, int radio, struct zt_p
|
||||
tmp->r2 = NULL;
|
||||
}
|
||||
#endif
|
||||
} else {
|
||||
signalling = tmp->sig;
|
||||
memset(&p, 0, sizeof(p));
|
||||
if (tmp->subs[SUB_REAL].zfd > -1)
|
||||
res = ioctl(tmp->subs[SUB_REAL].zfd, ZT_GET_PARAMS, &p);
|
||||
}
|
||||
/* Adjust starttime on loopstart and kewlstart trunks to reasonable values */
|
||||
if ((signalling == SIG_FXSKS) || (signalling == SIG_FXSLS) ||
|
||||
(signalling == SIG_EM) || (signalling == SIG_EM_E1) || (signalling == SIG_EMWINK) ||
|
||||
@@ -8672,6 +8643,7 @@ static char show_channels_usage[] =
|
||||
static char show_channel_usage[] =
|
||||
"Usage: zap show channel <chan num>\n"
|
||||
" Detailed information about a given channel\n";
|
||||
|
||||
static char destroy_channel_usage[] =
|
||||
"Usage: zap destroy channel <chan num>\n"
|
||||
" DON'T USE THIS UNLESS YOU KNOW WHAT YOU ARE DOING. Immediately removes a given channel, whether it is in use or not\n";
|
||||
@@ -8980,7 +8952,7 @@ int unload_module()
|
||||
return __unload_module();
|
||||
}
|
||||
|
||||
static int setup_zap(void)
|
||||
static int setup_zap(int reload)
|
||||
{
|
||||
struct ast_config *cfg;
|
||||
struct ast_variable *v;
|
||||
@@ -9081,13 +9053,16 @@ static int setup_zap(void)
|
||||
|| !strcasecmp(v->name, "crv")
|
||||
#endif
|
||||
) {
|
||||
if (reload == 0) {
|
||||
if (cur_signalling < 0) {
|
||||
ast_log(LOG_ERROR, "Signalling must be specified before any channels are.\n");
|
||||
ast_destroy(cfg);
|
||||
ast_mutex_unlock(&iflock);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
c = v->value;
|
||||
|
||||
#ifdef ZAPATA_PRI
|
||||
pri = NULL;
|
||||
if (!strcasecmp(v->name, "crv")) {
|
||||
@@ -9142,23 +9117,24 @@ static int setup_zap(void)
|
||||
}
|
||||
for (x=start;x<=finish;x++) {
|
||||
#ifdef ZAPATA_PRI
|
||||
tmp = mkintf(x, cur_signalling, cur_radio, pri);
|
||||
tmp = mkintf(x, cur_signalling, cur_radio, pri, reload);
|
||||
#else
|
||||
tmp = mkintf(x, cur_signalling, cur_radio, NULL);
|
||||
tmp = mkintf(x, cur_signalling, cur_radio, NULL, reload);
|
||||
#endif
|
||||
|
||||
if (tmp) {
|
||||
if (option_verbose > 2) {
|
||||
#ifdef ZAPATA_PRI
|
||||
if (pri)
|
||||
ast_verbose(VERBOSE_PREFIX_3 "Registered CRV %d:%d, %s signalling\n", trunkgroup,x, sig2str(tmp->sig));
|
||||
ast_verbose(VERBOSE_PREFIX_3 "%s CRV %d:%d, %s signalling\n", reload ? "Reconfigured" : "Registered", trunkgroup,x, sig2str(tmp->sig));
|
||||
else
|
||||
ast_verbose(VERBOSE_PREFIX_3 "Registered channel %d, %s signalling\n", x, sig2str(tmp->sig));
|
||||
#else
|
||||
ast_verbose(VERBOSE_PREFIX_3 "Registered channel %d, %s signalling\n", x, sig2str(tmp->sig));
|
||||
#endif
|
||||
ast_verbose(VERBOSE_PREFIX_3 "%s channel %d, %s signalling\n", reload ? "Reconfigured" : "Registered", x, sig2str(tmp->sig));
|
||||
}
|
||||
} else {
|
||||
if (reload == 1)
|
||||
ast_log(LOG_ERROR, "Unable to reconfigure channel '%s'\n", v->value);
|
||||
else
|
||||
ast_log(LOG_ERROR, "Unable to register channel '%s'\n", v->value);
|
||||
ast_destroy(cfg);
|
||||
ast_mutex_unlock(&iflock);
|
||||
@@ -9326,7 +9302,8 @@ static int setup_zap(void)
|
||||
ast_log(LOG_WARNING, "Invalid AMA flags: %s at line %d\n", v->value, v->lineno);
|
||||
else
|
||||
amaflags = y;
|
||||
} else if (!strcasecmp(v->name, "signalling")) {
|
||||
} else if(!reload){
|
||||
if (!strcasecmp(v->name, "signalling")) {
|
||||
if (!strcasecmp(v->value, "em")) {
|
||||
cur_signalling = SIG_EM;
|
||||
} else if (!strcasecmp(v->value, "em_e1")) {
|
||||
@@ -9548,6 +9525,7 @@ static int setup_zap(void)
|
||||
ast_log(LOG_WARNING, "'%s' is not a valid ISDN timer configuration string\n", v->value);
|
||||
#endif /* PRI_GETSET_TIMERS */
|
||||
#endif /* ZAPATA_PRI */
|
||||
|
||||
} else if (!strcasecmp(v->name, "cadence")) {
|
||||
/* setup to scan our argument */
|
||||
int element_count, c[16] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
|
||||
@@ -9645,6 +9623,7 @@ static int setup_zap(void)
|
||||
cur_rxflash = atoi(v->value);
|
||||
} else if (!strcasecmp(v->name, "debounce")) {
|
||||
cur_debounce = atoi(v->value);
|
||||
}
|
||||
} else
|
||||
ast_log(LOG_WARNING, "Ignoring %s\n", v->name);
|
||||
v = v->next;
|
||||
@@ -9657,7 +9636,7 @@ static int setup_zap(void)
|
||||
cur_callergroup = 0;
|
||||
cur_pickupgroup = 0;
|
||||
|
||||
tmp = mkintf(CHAN_PSEUDO, cur_signalling, cur_radio, NULL);
|
||||
tmp = mkintf(CHAN_PSEUDO, cur_signalling, cur_radio, NULL, reload);
|
||||
|
||||
if (tmp) {
|
||||
if (option_verbose > 2)
|
||||
@@ -9701,7 +9680,7 @@ int load_module(void)
|
||||
pri_set_error(zt_pri_error);
|
||||
pri_set_message(zt_pri_message);
|
||||
#endif
|
||||
res = setup_zap();
|
||||
res = setup_zap(0);
|
||||
/* Make sure we can register our Zap channel type */
|
||||
if(res) {
|
||||
return -1;
|
||||
@@ -9738,342 +9717,6 @@ int load_module(void)
|
||||
return res;
|
||||
}
|
||||
|
||||
#if 0
|
||||
|
||||
static int reload_zt(void)
|
||||
{
|
||||
struct ast_config *cfg;
|
||||
struct ast_variable *v;
|
||||
struct zt_pvt *tmp;
|
||||
struct zt_pvt *prev = NULL;
|
||||
char *chan;
|
||||
char *ringc;
|
||||
int start, finish,x;
|
||||
char *stringp=NULL;
|
||||
|
||||
/* Some crap that needs to be reinitialized on the reload */
|
||||
strncpy(context, "default", sizeof(context) - 1);
|
||||
language[0] = '\0';
|
||||
musicclass[0] = '\0';
|
||||
use_callerid = 1;
|
||||
cid_signalling = CID_SIG_BELL;
|
||||
cid_start = CID_START_RING;
|
||||
cur_signalling = -1;
|
||||
cur_group = 0;
|
||||
cur_callergroup = 0;
|
||||
cur_pickupgroup = 0;
|
||||
immediate = 0;
|
||||
stripmsd = 0;
|
||||
callwaiting = 0;
|
||||
busydetect = 0;
|
||||
busycount = 3;
|
||||
callprogress = 0;
|
||||
callwaitingcallerid = 0;
|
||||
hidecallerid = 0;
|
||||
callreturn = 0;
|
||||
threewaycalling = 0;
|
||||
transfer = 0;
|
||||
rxgain = 0.0;
|
||||
txgain = 0.0;
|
||||
tonezone = -1;
|
||||
firstdigittimeout = 16000;
|
||||
gendigittimeout = 8000;
|
||||
amaflags = 0;
|
||||
adsi = 0;
|
||||
memset(drings,0,sizeof(drings));
|
||||
strncpy(accountcode, "", sizeof(accountcode)-1);
|
||||
#ifdef ZAPATA_PRI
|
||||
strncpy(idleext, "", sizeof(idleext) - 1);
|
||||
strncpy(idledial, "", sizeof(idledial) - 1);
|
||||
minunused = 2;
|
||||
minidle = 0;
|
||||
#endif
|
||||
// usecnt = 0;
|
||||
|
||||
#if 0
|
||||
#ifdef ZAPATA_PRI
|
||||
int y;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
#if 0
|
||||
#ifdef ZAPATA_PRI
|
||||
for (y=0;y<NUM_SPANS;y++)
|
||||
ast_mutex_destroy(&pris[y]->lock);
|
||||
memset(pris, 0, sizeof(pris));
|
||||
for (y=0;y<NUM_SPANS;y++) {
|
||||
ast_mutex_init(&pris[y]->lock);
|
||||
pris[y].fd = -1;
|
||||
}
|
||||
#endif
|
||||
#endif /* 0 */
|
||||
|
||||
cfg = ast_load(config);
|
||||
|
||||
/* We *must* have a config file otherwise stop immediately */
|
||||
if (!cfg) {
|
||||
ast_log(LOG_ERROR, "Unable to load config %s\n", config);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
if (ast_mutex_lock(&iflock)) {
|
||||
/* It's a little silly to lock it, but we mind as well just to be sure */
|
||||
ast_log(LOG_ERROR, "Unable to lock interface list???\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Part of the primary changes for the reload... */
|
||||
tmp = iflist;
|
||||
|
||||
while (tmp) {
|
||||
tmp->destroy = 1;
|
||||
tmp = tmp->next;
|
||||
}
|
||||
|
||||
v = ast_variable_browse(cfg, "channels");
|
||||
|
||||
while(v) {
|
||||
/* Create the interface list */
|
||||
if (!strcasecmp(v->name, "channel")) {
|
||||
if (cur_signalling < 0) {
|
||||
ast_log(LOG_ERROR, "Signalling must be specified before any channels are.\n");
|
||||
ast_destroy(cfg);
|
||||
ast_mutex_unlock(&iflock);
|
||||
return -1;
|
||||
}
|
||||
stringp=v->value;
|
||||
chan = strsep(&stringp, ",");
|
||||
while(chan) {
|
||||
if (sscanf(chan, "%d-%d", &start, &finish) == 2) {
|
||||
/* Range */
|
||||
} else if (sscanf(chan, "%d", &start)) {
|
||||
/* Just one */
|
||||
finish = start;
|
||||
} else {
|
||||
ast_log(LOG_ERROR, "Syntax error parsing '%s' at '%s'\n", v->value, chan);
|
||||
ast_destroy(cfg);
|
||||
ast_mutex_unlock(&iflock);
|
||||
return -1;
|
||||
}
|
||||
if (finish < start) {
|
||||
ast_log(LOG_WARNING, "Sillyness: %d < %d\n", start, finish);
|
||||
x = finish;
|
||||
finish = start;
|
||||
start = x;
|
||||
}
|
||||
for (x = start; x <= finish; x++) {
|
||||
tmp = mkintf(x, cur_signalling);
|
||||
if (tmp) {
|
||||
if (option_verbose > 2)
|
||||
ast_verbose(VERBOSE_PREFIX_3 "Registered channel %d, %s signalling\n", x, sig2str(tmp->sig));
|
||||
} else {
|
||||
ast_log(LOG_ERROR, "Unable to register channel '%s'\n", v->value);
|
||||
ast_destroy(cfg);
|
||||
ast_mutex_unlock(&iflock);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
chan = strsep(&stringp, ",");
|
||||
}
|
||||
} else if (!strcasecmp(v->name, "usedistinctiveringdetection")) {
|
||||
if (ast_true(v->value))
|
||||
usedistinctiveringdetection = 1;
|
||||
} else if (!strcasecmp(v->name, "dring1context")) {
|
||||
strncpy(drings.ringContext[0].contextData,v->value,sizeof(drings.ringContext[0].contextData)-1);
|
||||
} else if (!strcasecmp(v->name, "dring2context")) {
|
||||
strncpy(drings.ringContext[1].contextData,v->value,sizeof(drings.ringContext[1].contextData)-1);
|
||||
} else if (!strcasecmp(v->name, "dring3context")) {
|
||||
strncpy(drings.ringContext[2].contextData,v->value,sizeof(drings.ringContext[2].contextData)-1);
|
||||
} else if (!strcasecmp(v->name, "dring1")) {
|
||||
ringc = v->value;
|
||||
sscanf(ringc, "%d,%d,%d", &drings.ringnum[0].ring[0], &drings.ringnum[0].ring[1], &drings.ringnum[0].ring[2]);
|
||||
} else if (!strcasecmp(v->name, "dring2")) {
|
||||
ringc = v->value;
|
||||
sscanf(ringc,"%d,%d,%d", &drings.ringnum[1].ring[0], &drings.ringnum[1].ring[1], &drings.ringnum[1].ring[2]);
|
||||
} else if (!strcasecmp(v->name, "dring3")) {
|
||||
ringc = v->value;
|
||||
sscanf(ringc, "%d,%d,%d", &drings.ringnum[2].ring[0], &drings.ringnum[2].ring[1], &drings.ringnum[2].ring[2]);
|
||||
} else if (!strcasecmp(v->name, "usecallerid")) {
|
||||
use_callerid = ast_true(v->value);
|
||||
} else if (!strcasecmp(v->name, "cidsignalling")) {
|
||||
if (!strcasecmp(v->value, "bell"))
|
||||
cid_signalling = CID_SIG_BELL;
|
||||
else if (!strcasecmp(v->value, "v23"))
|
||||
cid_signalling = CID_SIG_V23;
|
||||
else if (!strcasecmp(v->value, "dtmf"))
|
||||
cid_signalling = CID_SIG_DTMF;
|
||||
else if (ast_true(v->value))
|
||||
cid_signalling = CID_SIG_BELL;
|
||||
} else if (!strcasecmp(v->name, "cidstart")) {
|
||||
if (!strcasecmp(v->value, "ring"))
|
||||
cid_start = CID_START_RING;
|
||||
else if (!strcasecmp(v->value, "polarity"))
|
||||
cid_start = CID_START_POLARITY;
|
||||
else if (ast_true(v->value))
|
||||
cid_start = CID_START_RING;
|
||||
} else if (!strcasecmp(v->name, "threewaycalling")) {
|
||||
threewaycalling = ast_true(v->value);
|
||||
} else if (!strcasecmp(v->name, "transfer")) {
|
||||
transfer = ast_true(v->value);
|
||||
} else if (!strcasecmp(v->name, "busydetect")) {
|
||||
busydetect = ast_true(v->value);
|
||||
} else if (!strcasecmp(v->name, "busycount")) {
|
||||
busycount = atoi(v->value);
|
||||
} else if (!strcasecmp(v->name, "callprogress")) {
|
||||
callprogress = ast_true(v->value);
|
||||
} else if (!strcasecmp(v->name, "hidecallerid")) {
|
||||
hidecallerid = ast_true(v->value);
|
||||
} else if (!strcasecmp(v->name, "callreturn")) {
|
||||
callreturn = ast_true(v->value);
|
||||
} else if (!strcasecmp(v->name, "callwaiting")) {
|
||||
callwaiting = ast_true(v->value);
|
||||
} else if (!strcasecmp(v->name, "callwaitingcallerid")) {
|
||||
callwaitingcallerid = ast_true(v->value);
|
||||
} else if (!strcasecmp(v->name, "context")) {
|
||||
strncpy(context, v->value, sizeof(context)-1);
|
||||
} else if (!strcasecmp(v->name, "language")) {
|
||||
strncpy(language, v->value, sizeof(language)-1);
|
||||
} else if (!strcasecmp(v->name, "progzone")) {
|
||||
strncpy(progzone, v->value, sizeof(progzone) - 1);
|
||||
} else if (!strcasecmp(v->name, "musiconhold")) {
|
||||
strncpy(musicclass, v->value, sizeof(musicclass)-1);
|
||||
} else if (!strcasecmp(v->name, "stripmsd")) {
|
||||
stripmsd = atoi(v->value);
|
||||
} else if (!strcasecmp(v->name, "group")) {
|
||||
cur_group = get_group(v->value);
|
||||
} else if (!strcasecmp(v->name, "callgroup")) {
|
||||
cur_callergroup = get_group(v->value);
|
||||
} else if (!strcasecmp(v->name, "pickupgroup")) {
|
||||
cur_pickupgroup = get_group(v->value);
|
||||
} else if (!strcasecmp(v->name, "immediate")) {
|
||||
immediate = ast_true(v->value);
|
||||
} else if (!strcasecmp(v->name, "mailbox")) {
|
||||
strncpy(mailbox, v->value, sizeof(mailbox) -1);
|
||||
} else if (!strcasecmp(v->name, "rxgain")) {
|
||||
if (sscanf(v->value, "%f", &rxgain) != 1) {
|
||||
ast_log(LOG_WARNING, "Invalid rxgain: %s\n", v->value);
|
||||
}
|
||||
} else if (!strcasecmp(v->name, "txgain")) {
|
||||
if (sscanf(v->value, "%f", &txgain) != 1) {
|
||||
ast_log(LOG_WARNING, "Invalid txgain: %s\n", v->value);
|
||||
}
|
||||
} else if (!strcasecmp(v->name, "tonezone")) {
|
||||
if (sscanf(v->value, "%d", &tonezone) != 1) {
|
||||
ast_log(LOG_WARNING, "Invalid tonezone: %s\n", v->value);
|
||||
}
|
||||
} else if (!strcasecmp(v->name, "callerid")) {
|
||||
if (!strcasecmp(v->value, "asreceived"))
|
||||
callerid[0] = '\0';
|
||||
else
|
||||
strncpy(callerid, v->value, sizeof(callerid)-1);
|
||||
} else if (!strcasecmp(v->name, "signalling")) {
|
||||
if (!strcasecmp(v->value, "em")) {
|
||||
cur_signalling = SIG_EM;
|
||||
} else if (!strcasecmp(v->value, "em_w")) {
|
||||
cur_signalling = SIG_EMWINK;
|
||||
} else if (!strcasecmp(v->value, "fxs_ls")) {
|
||||
cur_signalling = SIG_FXSLS;
|
||||
} else if (!strcasecmp(v->value, "fxs_gs")) {
|
||||
cur_signalling = SIG_FXSGS;
|
||||
} else if (!strcasecmp(v->value, "fxs_ks")) {
|
||||
cur_signalling = SIG_FXSKS;
|
||||
} else if (!strcasecmp(v->value, "fxo_ls")) {
|
||||
cur_signalling = SIG_FXOLS;
|
||||
} else if (!strcasecmp(v->value, "fxo_gs")) {
|
||||
cur_signalling = SIG_FXOGS;
|
||||
} else if (!strcasecmp(v->value, "fxo_ks")) {
|
||||
cur_signalling = SIG_FXOKS;
|
||||
} else if (!strcasecmp(v->value, "featd")) {
|
||||
cur_signalling = SIG_FEATD;
|
||||
} else if (!strcasecmp(v->value, "featdmf")) {
|
||||
cur_signalling = SIG_FEATDMF;
|
||||
} else if (!strcasecmp(v->value, "e911")) {
|
||||
cur_signalling = SIG_E911;
|
||||
} else if (!strcasecmp(v->value, "featb")) {
|
||||
cur_signalling = SIG_FEATB;
|
||||
#ifdef ZAPATA_PRI
|
||||
} else if (!strcasecmp(v->value, "pri_net")) {
|
||||
cur_signalling = SIG_PRI;
|
||||
pritype = PRI_NETWORK;
|
||||
} else if (!strcasecmp(v->value, "pri_cpe")) {
|
||||
cur_signalling = SIG_PRI;
|
||||
pritype = PRI_CPE;
|
||||
#endif
|
||||
} else {
|
||||
ast_log(LOG_ERROR, "Unknown signalling method '%s'\n", v->value);
|
||||
}
|
||||
#ifdef ZAPATA_PRI
|
||||
} else if (!strcasecmp(v->name, "switchtype")) {
|
||||
if (!strcasecmp(v->value, "national"))
|
||||
switchtype = PRI_SWITCH_NI2;
|
||||
else if (!strcasecmp(v->value, "dms100"))
|
||||
switchtype = PRI_SWITCH_DMS100;
|
||||
else if (!strcasecmp(v->value, "4ess"))
|
||||
switchtype = PRI_SWITCH_ATT4ESS;
|
||||
else if (!strcasecmp(v->value, "5ess"))
|
||||
switchtype = PRI_SWITCH_LUCENT5E;
|
||||
else {
|
||||
ast_log(LOG_ERROR, "Unknown switchtype '%s'\n", v->value);
|
||||
ast_destroy(cfg);
|
||||
ast_mutex_unlock(&iflock);
|
||||
return -1;
|
||||
}
|
||||
} else if (!strcasecmp(v->name, "nsf")) {
|
||||
if (!strcasecmp(v->value, "sdn"))
|
||||
nsf = PRI_NSF_SDN;
|
||||
else if (!strcasecmp(v->value, "megacom"))
|
||||
nsf = PRI_NSF_MEGACOM;
|
||||
else if (!strcasecmp(v->value, "accunet"))
|
||||
nsf = PRI_NSF_ACCUNET
|
||||
else if (!strcasecmp(v->value, "none"))
|
||||
nsf = PRI_NSF_NONE;
|
||||
else {
|
||||
ast_log(LOG_WARN, "Unknown network-specific facility '%s'\n", v->value);
|
||||
nsf = PRI_NSF_NONE;
|
||||
}
|
||||
} else if (!strcasecmp(v->name, "jitterbuffers")) {
|
||||
numbufs = atoi(v->value);
|
||||
} else if (!strcasecmp(v->name, "minunused")) {
|
||||
minunused = atoi(v->value);
|
||||
} else if (!strcasecmp(v->name, "idleext")) {
|
||||
strncpy(idleext, v->value, sizeof(idleext) - 1);
|
||||
} else if (!strcasecmp(v->name, "idledial")) {
|
||||
strncpy(idledial, v->value, sizeof(idledial) - 1);
|
||||
#endif
|
||||
} else
|
||||
ast_log(LOG_WARNING, "Ignoring %s\n", v->name);
|
||||
v = v->next;
|
||||
}
|
||||
|
||||
tmp = iflist;
|
||||
prev = NULL;
|
||||
|
||||
while (tmp) {
|
||||
if (tmp->destroy) {
|
||||
if (destroy_channel(prev, tmp, 0)) {
|
||||
ast_log(LOG_ERROR, "Unable to destroy chan_zap channel %d\n", tmp->channel);
|
||||
ast_mutex_unlock(&iflock);
|
||||
return -1;
|
||||
}
|
||||
tmp = tmp->next;
|
||||
} else {
|
||||
prev = tmp;
|
||||
tmp = tmp->next;
|
||||
}
|
||||
}
|
||||
|
||||
ast_mutex_unlock(&iflock);
|
||||
|
||||
ast_destroy(cfg);
|
||||
/* And start the monitor for the first time */
|
||||
|
||||
restart_monitor();
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
static int zt_sendtext(struct ast_channel *c, char *text)
|
||||
{
|
||||
#define END_SILENCE_LEN 400
|
||||
@@ -10173,18 +9816,19 @@ static int zt_sendtext(struct ast_channel *c, char *text)
|
||||
return(0);
|
||||
}
|
||||
|
||||
#if 0
|
||||
/* XXX Very broken on PRI XXX */
|
||||
|
||||
int reload(void)
|
||||
{
|
||||
if (reload_zt()) {
|
||||
ast_log(LOG_WARNING, "Reload of chan_zap is unsuccessful\n");
|
||||
int res = 0;
|
||||
|
||||
res = setup_zap(1);
|
||||
if (res) {
|
||||
ast_log(LOG_WARNING, "Reload of chan_zap.so is unsuccessful!\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
int usecount()
|
||||
{
|
||||
int res;
|
||||
|
Reference in New Issue
Block a user