dect
/
asterisk
Archived
13
0
Fork 0

Goodbye Zaptel, hello DAHDI. Removes Zaptel driver support with DAHDI. Configuration file and dialplan backwards compatability has been put in place where appropiate. Release announcement to follow.

git-svn-id: http://svn.digium.com/svn/asterisk/trunk@122234 f38db490-d61c-443f-a65b-d21fe96a405b
This commit is contained in:
jpeeler 2008-06-12 17:27:55 +00:00
parent b97df61759
commit 490730a6b3
77 changed files with 2424 additions and 6049 deletions

View File

@ -680,6 +680,7 @@ samples: adsi
echo ";transcode_via_sln = yes ; Build transcode paths via SLINEAR, instead of directly" ; \
echo ";runuser = asterisk ; The user to run as" ; \
echo ";rungroup = asterisk ; The group to run as" ; \
echo "dahdichanname = yes" ; Set channel name as DAHDI\
echo "" ; \
echo "; Changing the following lines may compromise your security." ; \
echo ";[files]" ; \

2
README
View File

@ -175,7 +175,7 @@ they're used only to help make the configuration file easier to
understand, and do not affect how it is actually parsed.
Entries of the form 'variable=value' set the value of some parameter in
asterisk. For example, in zapata.conf, one might specify:
asterisk. For example, in dahdi.conf, one might specify:
switchtype=national

View File

@ -75,7 +75,7 @@ static int chanavail_exec(struct ast_channel *chan, void *data)
);
if (ast_strlen_zero(data)) {
ast_log(LOG_WARNING, "ChanIsAvail requires an argument (Zap/1&Zap/2)\n");
ast_log(LOG_WARNING, "ChanIsAvail requires an argument (DAHDI/1&DAHDI/2)\n");
return -1;
}

View File

@ -47,6 +47,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
#include "asterisk/translate.h"
#include "asterisk/module.h"
#include "asterisk/lock.h"
#include "asterisk/options.h"
#define AST_NAME_STRLEN 256
#define NUM_SPYGROUPS 128
@ -587,6 +588,7 @@ static struct chanspy_ds *next_channel(struct ast_channel *chan,
const char *exten, const char *context, struct chanspy_ds *chanspy_ds)
{
struct ast_channel *next;
char channel_name[AST_CHANNEL_NAME];
redo:
if (!ast_strlen_zero(spec))
@ -599,7 +601,8 @@ redo:
if (!next)
return NULL;
if (!strncmp(next->name, "Zap/pseudo", 10)) {
snprintf(channel_name, AST_CHANNEL_NAME, "%s/pseudo", dahdi_chan_name);
if (!strncmp(next->name, channel_name, 10)) {
ast_channel_unlock(next);
goto redo;
} else if (next == chan) {

View File

@ -21,7 +21,7 @@
/*! \file
*
* \brief Zap Barge support
* \brief DAHDI Barge support
*
* \author Mark Spencer <markster@digium.com>
*
@ -32,14 +32,14 @@
*/
/*** MODULEINFO
<depend>zaptel</depend>
<depend>dahdi</depend>
***/
#include "asterisk.h"
ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
#include "asterisk/zapata.h"
#include "asterisk/dahdi.h"
#include "asterisk/lock.h"
#include "asterisk/file.h"
@ -52,12 +52,13 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
#include "asterisk/say.h"
#include "asterisk/utils.h"
static char *app = "ZapBarge";
static char *app = "DAHDIBarge";
static char *deprecated_app = "ZapBarge";
static char *synopsis = "Barge in (monitor) Zap channel";
static char *synopsis = "Barge in (monitor) DAHDI channel";
static char *descrip =
" ZapBarge([channel]): Barges in on a specified zap\n"
" DAHDIBarge([channel]): Barges in on a specified DAHDI\n"
"channel or prompts if one is not specified. Returns\n"
"-1 when caller user hangs up and is independent of the\n"
"state of the channel being monitored.";
@ -86,7 +87,7 @@ static int careful_write(int fd, unsigned char *data, int len)
static int conf_run(struct ast_channel *chan, int confno, int confflags)
{
int fd;
struct zt_confinfo ztc;
struct dahdi_confinfo dahdic;
struct ast_frame *f;
struct ast_channel *c;
struct ast_frame fr;
@ -95,11 +96,11 @@ static int conf_run(struct ast_channel *chan, int confno, int confflags)
int nfds;
int res;
int flags;
int retryzap;
int retrydahdi;
int origfd;
int ret = -1;
ZT_BUFFERINFO bi;
DAHDI_BUFFERINFO bi;
char __buf[CONF_SIZE + AST_FRIENDLY_OFFSET];
char *buf = __buf + AST_FRIENDLY_OFFSET;
@ -115,11 +116,11 @@ static int conf_run(struct ast_channel *chan, int confno, int confflags)
goto outrun;
}
ast_indicate(chan, -1);
retryzap = strcasecmp(chan->tech->type, "Zap");
zapretry:
retrydahdi = strcasecmp(chan->tech->type, "DAHDI");
dahdiretry:
origfd = chan->fds[0];
if (retryzap) {
fd = open("/dev/zap/pseudo", O_RDWR);
if (retrydahdi) {
fd = open("/dev/dahdi/pseudo", O_RDWR);
if (fd < 0) {
ast_log(LOG_WARNING, "Unable to open pseudo channel: %s\n", strerror(errno));
goto outrun;
@ -139,10 +140,10 @@ zapretry:
/* Setup buffering information */
memset(&bi, 0, sizeof(bi));
bi.bufsize = CONF_SIZE;
bi.txbufpolicy = ZT_POLICY_IMMEDIATE;
bi.rxbufpolicy = ZT_POLICY_IMMEDIATE;
bi.txbufpolicy = DAHDI_POLICY_IMMEDIATE;
bi.rxbufpolicy = DAHDI_POLICY_IMMEDIATE;
bi.numbufs = 4;
if (ioctl(fd, ZT_SET_BUFINFO, &bi)) {
if (ioctl(fd, DAHDI_SET_BUFINFO, &bi)) {
ast_log(LOG_WARNING, "Unable to set buffering information: %s\n", strerror(errno));
close(fd);
goto outrun;
@ -153,34 +154,34 @@ zapretry:
fd = chan->fds[0];
nfds = 0;
}
memset(&ztc, 0, sizeof(ztc));
memset(&dahdic, 0, sizeof(dahdic));
/* Check to see if we're in a conference... */
ztc.chan = 0;
if (ioctl(fd, ZT_GETCONF, &ztc)) {
dahdic.chan = 0;
if (ioctl(fd, DAHDI_GETCONF, &dahdic)) {
ast_log(LOG_WARNING, "Error getting conference\n");
close(fd);
goto outrun;
}
if (ztc.confmode) {
if (dahdic.confmode) {
/* Whoa, already in a conference... Retry... */
if (!retryzap) {
ast_debug(1, "Zap channel is in a conference already, retrying with pseudo\n");
retryzap = 1;
goto zapretry;
if (!retrydahdi) {
ast_debug(1, "DAHDI channel is in a conference already, retrying with pseudo\n");
retrydahdi = 1;
goto dahdiretry;
}
}
memset(&ztc, 0, sizeof(ztc));
memset(&dahdic, 0, sizeof(dahdic));
/* Add us to the conference */
ztc.chan = 0;
ztc.confno = confno;
ztc.confmode = ZT_CONF_MONITORBOTH;
dahdic.chan = 0;
dahdic.confno = confno;
dahdic.confmode = DAHDI_CONF_MONITORBOTH;
if (ioctl(fd, ZT_SETCONF, &ztc)) {
if (ioctl(fd, DAHDI_SETCONF, &dahdic)) {
ast_log(LOG_WARNING, "Error setting conference\n");
close(fd);
goto outrun;
}
ast_debug(1, "Placed channel %s in ZAP channel %d monitor\n", chan->name, confno);
ast_debug(1, "Placed channel %s in DAHDI channel %d monitor\n", chan->name, confno);
for(;;) {
outfd = -1;
@ -188,13 +189,13 @@ zapretry:
c = ast_waitfor_nandfds(&chan, 1, &fd, nfds, NULL, &outfd, &ms);
if (c) {
if (c->fds[0] != origfd) {
if (retryzap) {
if (retrydahdi) {
/* Kill old pseudo */
close(fd);
}
ast_debug(1, "Ooh, something swapped out under us, starting over\n");
retryzap = 0;
goto zapretry;
retrydahdi = 0;
goto dahdiretry;
}
f = ast_read(c);
if (!f)
@ -236,10 +237,10 @@ zapretry:
else {
/* Take out of conference */
/* Add us to the conference */
ztc.chan = 0;
ztc.confno = 0;
ztc.confmode = 0;
if (ioctl(fd, ZT_SETCONF, &ztc)) {
dahdic.chan = 0;
dahdic.confno = 0;
dahdic.confmode = 0;
if (ioctl(fd, DAHDI_SETCONF, &dahdic)) {
ast_log(LOG_WARNING, "Error setting conference\n");
}
}
@ -258,9 +259,9 @@ static int conf_exec(struct ast_channel *chan, void *data)
char confstr[80] = "";
if (!ast_strlen_zero(data)) {
if ((sscanf(data, "Zap/%d", &confno) != 1) &&
if ((sscanf(data, "DAHDI/%d", &confno) != 1) &&
(sscanf(data, "%d", &confno) != 1)) {
ast_log(LOG_WARNING, "ZapBarge Argument (if specified) must be a channel number, not '%s'\n", (char *)data);
ast_log(LOG_WARNING, "DAHDIBarge Argument (if specified) must be a channel number, not '%s'\n", (char *)data);
return 0;
}
}
@ -286,6 +287,12 @@ out:
return res;
}
static int conf_exec_warn(struct ast_channel *chan, void *data)
{
ast_log(LOG_WARNING, "Use of the command %s is deprecated, please use %s instead.\n", deprecated_app, app);
return conf_exec(chan, data);
}
static int unload_module(void)
{
return ast_unregister_application(app);
@ -293,7 +300,8 @@ static int unload_module(void)
static int load_module(void)
{
ast_register_application(deprecated_app, conf_exec_warn, synopsis, descrip);
return ((ast_register_application(app, conf_exec, synopsis, descrip)) ? AST_MODULE_LOAD_FAILURE : AST_MODULE_LOAD_SUCCESS);
}
AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Barge in on Zap channel application");
AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Barge in on DAHDI channel application");

View File

@ -26,7 +26,7 @@
*/
/*** MODULEINFO
<depend>zaptel</depend>
<depend>dahdi</depend>
***/
#include "asterisk.h"
@ -43,7 +43,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
#include <fcntl.h>
#include "asterisk/zapata.h"
#include "asterisk/dahdi.h"
#include "asterisk/lock.h"
#include "asterisk/file.h"
@ -52,15 +52,16 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
#include "asterisk/module.h"
#include "asterisk/app.h"
static char *app = "ZapRAS";
static char *app = "DAHDIRAS";
static char *deprecated_app = "ZapRAS";
static char *synopsis = "Executes Zaptel ISDN RAS application";
static char *synopsis = "Executes DAHDI ISDN RAS application";
static char *descrip =
" ZapRAS(args): Executes a RAS server using pppd on the given channel.\n"
"The channel must be a clear channel (i.e. PRI source) and a Zaptel\n"
" DAHDIRAS(args): Executes a RAS server using pppd on the given channel.\n"
"The channel must be a clear channel (i.e. PRI source) and a DAHDI\n"
"channel to be able to use this function (No modem emulation is included).\n"
"Your pppd must be patched to be zaptel aware. Arguments should be\n"
"Your pppd must be patched to be DAHDI aware. Arguments should be\n"
"separated by , characters.\n";
@ -96,7 +97,7 @@ static pid_t spawn_ras(struct ast_channel *chan, char *args)
memset(argv, 0, sizeof(argv));
/* First argument is executable, followed by standard
arguments for zaptel PPP */
arguments for DAHDI PPP */
argv[argc++] = PPP_EXEC;
argv[argc++] = "nodetach";
@ -109,7 +110,7 @@ static pid_t spawn_ras(struct ast_channel *chan, char *args)
}
argv[argc++] = "plugin";
argv[argc++] = "zaptel.so";
argv[argc++] = "dahdi.so";
argv[argc++] = "stdin";
/* Finally launch PPP */
@ -124,10 +125,10 @@ static void run_ras(struct ast_channel *chan, char *args)
int status;
int res;
int signalled = 0;
struct zt_bufferinfo savebi;
struct dahdi_bufferinfo savebi;
int x;
res = ioctl(chan->fds[0], ZT_GET_BUFINFO, &savebi);
res = ioctl(chan->fds[0], DAHDI_GET_BUFINFO, &savebi);
if(res) {
ast_log(LOG_WARNING, "Unable to check buffer policy on channel %s\n", chan->name);
return;
@ -163,10 +164,10 @@ static void run_ras(struct ast_channel *chan, char *args)
}
/* Throw back into audio mode */
x = 1;
ioctl(chan->fds[0], ZT_AUDIOMODE, &x);
ioctl(chan->fds[0], DAHDI_AUDIOMODE, &x);
/* Restore saved values */
res = ioctl(chan->fds[0], ZT_SET_BUFINFO, &savebi);
res = ioctl(chan->fds[0], DAHDI_SET_BUFINFO, &savebi);
if (res < 0) {
ast_log(LOG_WARNING, "Unable to set buffer policy on channel %s\n", chan->name);
}
@ -176,11 +177,11 @@ static void run_ras(struct ast_channel *chan, char *args)
ast_safe_fork_cleanup();
}
static int zapras_exec(struct ast_channel *chan, void *data)
static int dahdiras_exec(struct ast_channel *chan, void *data)
{
int res=-1;
char *args;
ZT_PARAMS ztp;
DAHDI_PARAMS dahdip;
if (!data)
data = "";
@ -190,16 +191,16 @@ 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->tech->type, "Zap")) {
/* If it's not a zap channel, we're done. Wait a couple of
if (strcasecmp(chan->tech->type, "DAHDI")) {
/* If it's not a DAHDI channel, we're done. Wait a couple of
seconds and then hangup... */
ast_verb(2, "Channel %s is not a Zap channel\n", chan->name);
ast_verb(2, "Channel %s is not a DAHDI channel\n", chan->name);
sleep(2);
} else {
memset(&ztp, 0, sizeof(ztp));
if (ioctl(chan->fds[0], ZT_GET_PARAMS, &ztp)) {
ast_log(LOG_WARNING, "Unable to get zaptel parameters\n");
} else if (ztp.sigtype != ZT_SIG_CLEAR) {
memset(&dahdip, 0, sizeof(dahdip));
if (ioctl(chan->fds[0], DAHDI_GET_PARAMS, &dahdip)) {
ast_log(LOG_WARNING, "Unable to get DAHDI parameters\n");
} else if (dahdip.sigtype != DAHDI_SIG_CLEAR) {
ast_verb(2, "Channel %s is not a clear channel\n", chan->name);
} else {
/* Everything should be okay. Run PPP. */
@ -211,6 +212,12 @@ static int zapras_exec(struct ast_channel *chan, void *data)
return res;
}
static int dahdiras_exec_warn(struct ast_channel *chan, void *data)
{
ast_log(LOG_WARNING, "Use of the command %s is deprecated, please use %s instead.\n", deprecated_app, app);
return dahdiras_exec(chan, data);
}
static int unload_module(void)
{
return ast_unregister_application(app);
@ -218,8 +225,9 @@ static int unload_module(void)
static int load_module(void)
{
return ((ast_register_application(app, zapras_exec, synopsis, descrip)) ? AST_MODULE_LOAD_FAILURE : AST_MODULE_LOAD_SUCCESS);
ast_register_application(deprecated_app, dahdiras_exec_warn, synopsis, descrip);
return ((ast_register_application(app, dahdiras_exec, synopsis, descrip)) ? AST_MODULE_LOAD_FAILURE : AST_MODULE_LOAD_SUCCESS);
}
AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Zaptel ISDN Remote Access Server");
AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "DAHDI ISDN Remote Access Server");

View File

@ -23,7 +23,7 @@
/*! \file
*
* \brief Zap Scanner
* \brief DAHDI Scanner
*
* \author Mark Spencer <markster@digium.com>
*
@ -31,14 +31,14 @@
*/
/*** MODULEINFO
<depend>zaptel</depend>
<depend>dahdi</depend>
***/
#include "asterisk.h"
ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
#include "asterisk/zapata.h"
#include "asterisk/dahdi.h"
#include "asterisk/lock.h"
#include "asterisk/file.h"
@ -50,23 +50,25 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
#include "asterisk/utils.h"
#include "asterisk/cli.h"
#include "asterisk/say.h"
#include "asterisk/options.h"
static char *app = "ZapScan";
static char *app = "DAHDIScan";
static char *deprecated_app = "ZapScan";
static char *synopsis = "Scan Zap channels to monitor calls";
static char *synopsis = "Scan DAHDI channels to monitor calls";
static char *descrip =
" ZapScan([group]) allows a call center manager to monitor Zap channels in\n"
" DAHDIScan([group]) allows a call center manager to monitor DAHDI channels in\n"
"a convenient way. Use '#' to select the next channel and use '*' to exit\n"
"Limit scanning to a channel GROUP by setting the option group argument.\n";
#define CONF_SIZE 160
static struct ast_channel *get_zap_channel_locked(int num) {
static struct ast_channel *get_dahdi_channel_locked(int num) {
char name[80];
snprintf(name, sizeof(name), "Zap/%d-1", num);
snprintf(name, sizeof(name), "%s/%d-1", dahdi_chan_name, num);
return ast_get_channel_by_name_locked(name);
}
@ -92,7 +94,7 @@ static int careful_write(int fd, unsigned char *data, int len)
static int conf_run(struct ast_channel *chan, int confno, int confflags)
{
int fd;
struct zt_confinfo ztc;
struct dahdi_confinfo dahdic;
struct ast_frame *f;
struct ast_channel *c;
struct ast_frame fr;
@ -101,13 +103,13 @@ static int conf_run(struct ast_channel *chan, int confno, int confflags)
int nfds;
int res;
int flags;
int retryzap;
int retrydahdi;
int origfd;
int ret = -1;
char input[4];
int ic = 0;
ZT_BUFFERINFO bi;
DAHDI_BUFFERINFO bi;
char __buf[CONF_SIZE + AST_FRIENDLY_OFFSET];
char *buf = __buf + AST_FRIENDLY_OFFSET;
@ -123,11 +125,11 @@ static int conf_run(struct ast_channel *chan, int confno, int confflags)
goto outrun;
}
ast_indicate(chan, -1);
retryzap = strcasecmp(chan->tech->type, "Zap");
zapretry:
retrydahdi = strcasecmp(chan->tech->type, "DAHDI");
dahdiretry:
origfd = chan->fds[0];
if (retryzap) {
fd = open("/dev/zap/pseudo", O_RDWR);
if (retrydahdi) {
fd = open("/dev/dahdi/pseudo", O_RDWR);
if (fd < 0) {
ast_log(LOG_WARNING, "Unable to open pseudo channel: %s\n", strerror(errno));
goto outrun;
@ -147,10 +149,10 @@ static int conf_run(struct ast_channel *chan, int confno, int confflags)
/* Setup buffering information */
memset(&bi, 0, sizeof(bi));
bi.bufsize = CONF_SIZE;
bi.txbufpolicy = ZT_POLICY_IMMEDIATE;
bi.rxbufpolicy = ZT_POLICY_IMMEDIATE;
bi.txbufpolicy = DAHDI_POLICY_IMMEDIATE;
bi.rxbufpolicy = DAHDI_POLICY_IMMEDIATE;
bi.numbufs = 4;
if (ioctl(fd, ZT_SET_BUFINFO, &bi)) {
if (ioctl(fd, DAHDI_SET_BUFINFO, &bi)) {
ast_log(LOG_WARNING, "Unable to set buffering information: %s\n", strerror(errno));
close(fd);
goto outrun;
@ -161,34 +163,34 @@ static int conf_run(struct ast_channel *chan, int confno, int confflags)
fd = chan->fds[0];
nfds = 0;
}
memset(&ztc, 0, sizeof(ztc));
memset(&dahdic, 0, sizeof(dahdic));
/* Check to see if we're in a conference... */
ztc.chan = 0;
if (ioctl(fd, ZT_GETCONF, &ztc)) {
dahdic.chan = 0;
if (ioctl(fd, DAHDI_GETCONF, &dahdic)) {
ast_log(LOG_WARNING, "Error getting conference\n");
close(fd);
goto outrun;
}
if (ztc.confmode) {
if (dahdic.confmode) {
/* Whoa, already in a conference... Retry... */
if (!retryzap) {
ast_debug(1, "Zap channel is in a conference already, retrying with pseudo\n");
retryzap = 1;
goto zapretry;
if (!retrydahdi) {
ast_debug(1, "DAHDI channel is in a conference already, retrying with pseudo\n");
retrydahdi = 1;
goto dahdiretry;
}
}
memset(&ztc, 0, sizeof(ztc));
memset(&dahdic, 0, sizeof(dahdic));
/* Add us to the conference */
ztc.chan = 0;
ztc.confno = confno;
ztc.confmode = ZT_CONF_MONITORBOTH;
dahdic.chan = 0;
dahdic.confno = confno;
dahdic.confmode = DAHDI_CONF_MONITORBOTH;
if (ioctl(fd, ZT_SETCONF, &ztc)) {
if (ioctl(fd, DAHDI_SETCONF, &dahdic)) {
ast_log(LOG_WARNING, "Error setting conference\n");
close(fd);
goto outrun;
}
ast_debug(1, "Placed channel %s in ZAP channel %d monitor\n", chan->name, confno);
ast_debug(1, "Placed channel %s in DAHDI channel %d monitor\n", chan->name, confno);
for (;;) {
outfd = -1;
@ -196,13 +198,13 @@ static int conf_run(struct ast_channel *chan, int confno, int confflags)
c = ast_waitfor_nandfds(&chan, 1, &fd, nfds, NULL, &outfd, &ms);
if (c) {
if (c->fds[0] != origfd) {
if (retryzap) {
if (retrydahdi) {
/* Kill old pseudo */
close(fd);
}
ast_debug(1, "Ooh, something swapped out under us, starting over\n");
retryzap = 0;
goto zapretry;
retrydahdi = 0;
goto dahdiretry;
}
f = ast_read(c);
if (!f) {
@ -222,7 +224,7 @@ static int conf_run(struct ast_channel *chan, int confno, int confflags)
input[ic++] = '\0';
ic = 0;
ret = atoi(input);
ast_verb(3, "Zapscan: change channel to %d\n", ret);
ast_verb(3, "DAHDIScan: change channel to %d\n", ret);
break;
}
}
@ -265,10 +267,10 @@ static int conf_run(struct ast_channel *chan, int confno, int confflags)
} else {
/* Take out of conference */
/* Add us to the conference */
ztc.chan = 0;
ztc.confno = 0;
ztc.confmode = 0;
if (ioctl(fd, ZT_SETCONF, &ztc)) {
dahdic.chan = 0;
dahdic.confno = 0;
dahdic.confmode = 0;
if (ioctl(fd, DAHDI_SETCONF, &dahdic)) {
ast_log(LOG_WARNING, "Error setting conference\n");
}
}
@ -312,7 +314,7 @@ static int conf_exec(struct ast_channel *chan, void *data)
ast_frfree(f);
ichan = NULL;
if(input) {
ichan = get_zap_channel_locked(input);
ichan = get_dahdi_channel_locked(input);
input = 0;
}
@ -332,8 +334,8 @@ static int conf_exec(struct ast_channel *chan, void *data)
continue;
}
}
if (tempchan && (!strcmp(tempchan->tech->type, "Zap")) && (tempchan != chan)) {
ast_verb(3, "Zap channel %s is in-use, monitoring...\n", tempchan->name);
if (tempchan && (!strcmp(tempchan->tech->type, "DAHDI")) && (tempchan != chan)) {
ast_verb(3, "DAHDI channel %s is in-use, monitoring...\n", tempchan->name);
ast_copy_string(confstr, tempchan->name, sizeof(confstr));
ast_channel_unlock(tempchan);
if ((tmp = strchr(confstr, '-'))) {
@ -355,6 +357,12 @@ static int conf_exec(struct ast_channel *chan, void *data)
return res;
}
static int conf_exec_warn(struct ast_channel *chan, void *data)
{
ast_log(LOG_WARNING, "Use of the command %s is deprecated, please use %s instead.\n", deprecated_app, app);
return conf_exec(chan, data);
}
static int unload_module(void)
{
return ast_unregister_application(app);
@ -362,8 +370,9 @@ static int unload_module(void)
static int load_module(void)
{
ast_register_application(deprecated_app, conf_exec_warn, synopsis, descrip);
return ((ast_register_application(app, conf_exec, synopsis, descrip)) ? AST_MODULE_LOAD_FAILURE : AST_MODULE_LOAD_SUCCESS);
}
AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Scan Zap channels application");
AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Scan DAHDI channels application");

View File

@ -171,8 +171,8 @@ static char *descrip =
" o - Specify that the CallerID that was present on the *calling* channel\n"
" be set as the CallerID on the *called* channel. This was the\n"
" behavior of Asterisk 1.0 and earlier.\n"
" O([x]) - \"Operator Services\" mode (Zaptel channel to Zaptel channel\n"
" only, if specified on non-Zaptel interface, it will be ignored).\n"
" O([x]) - \"Operator Services\" mode (DAHDI channel to DAHDI channel\n"
" only, if specified on non-DAHDI interface, it will be ignored).\n"
" When the destination answers (presumably an operator services\n"
" station), the originator no longer has control of their line.\n"
" They may hang up, but the switch will not release their line\n"
@ -1895,9 +1895,9 @@ static int dial_exec_full(struct ast_channel *chan, void *data, struct ast_flags
res = -1;
goto done;
}
if (opermode && !strncmp(chan->name, "Zap", 3) && !strncmp(peer->name, "Zap", 3)) {
/* what's this special handling for Zap <-> Zap ?
* A: Zap to Zap calls are natively bridged at the kernel driver
if (opermode && !strncmp(chan->tech->type, "DAHDI", 3) && !strncmp(peer->name, "DAHDI", 3)) {
/* what's this special handling for dahdi <-> dahdi ?
* A: dahdi to dahdi calls are natively bridged at the kernel driver
* level, so we need to ensure that this mode gets propagated
* all the way down. */
struct oprmode oprmode;

View File

@ -1,741 +0,0 @@
/*
* Asterisk -- A telephony toolkit for Linux.
*
* Simple fax applications
*
* 2007-2008, Dmitry Andrianov <asterisk@dima.spb.ru>
*
* Code based on original implementation by Steve Underwood <steveu@coppice.org>
*
* This program is free software, distributed under the terms of
* the GNU General Public License
*
*/
/*** MODULEINFO
<depend>spandsp</depend>
***/
#include "asterisk.h"
ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <inttypes.h>
#include <pthread.h>
#include <errno.h>
#include <tiffio.h>
#include <spandsp.h>
#include "asterisk/lock.h"
#include "asterisk/file.h"
#include "asterisk/logger.h"
#include "asterisk/channel.h"
#include "asterisk/pbx.h"
#include "asterisk/app.h"
#include "asterisk/dsp.h"
#include "asterisk/module.h"
#include "asterisk/manager.h"
static char *app_sndfax_name = "SendFAX";
static char *app_sndfax_synopsis = "Send a FAX";
static char *app_sndfax_desc =
" SendFAX(filename[|options]):\n"
"Send a given TIFF file to the channel as a FAX.\n"
"The option string may contain zero or more of the following characters:\n"
" 'a' -- makes the application behave as an answering machine\n"
" The default behaviour is to behave as a calling machine.\n"
"\n"
"This application uses following variables:\n"
" LOCALSTATIONID to identify itself to the remote end.\n"
" LOCALHEADERINFO to generate a header line on each page.\n"
"\n"
"This application sets the following channel variables upon completion:\n"
" FAXSTATUS - status of operation:\n"
" SUCCESS | FAILED\n"
" FAXERROR - Error when FAILED\n"
" REMOTESTATIONID - CSID of the remote side.\n"
" FAXPAGES - number of pages sent.\n"
" FAXBITRATE - transmition rate.\n"
" FAXRESOLUTION - resolution.\n"
"\n"
"Returns -1 in case of user hang up or any channel error.\n"
"Returns 0 on success.\n";
static char *app_rcvfax_name = "ReceiveFAX";
static char *app_rcvfax_synopsis = "Receive a FAX";
static char *app_rcvfax_desc =
" ReceiveFAX(filename[|options]):\n"
"Receives a fax from the channel into the given filename overwriting\n"
"the file if it already exists. File created will have TIFF format.\n"
"The option string may contain zero or more of the following characters:\n"
" 'c' -- makes the application behave as a calling machine\n"
" The default behaviour is to behave as an answering machine.\n"
"\n"
"This application uses following variables:\n"
" LOCALSTATIONID to identify itself to the remote end.\n"
" LOCALHEADERINFO to generate a header line on each page.\n"
"\n"
"This application sets the following channel variables upon completion:\n"
" FAXSTATUS - status of operation:\n"
" SUCCESS | FAILED\n"
" FAXERROR - Error when FAILED\n"
" REMOTESTATIONID - CSID of the remote side.\n"
" FAXPAGES - number of pages sent.\n"
" FAXBITRATE - transmition rate.\n"
" FAXRESOLUTION - resolution.\n"
"\n"
"Returns -1 in case of user hang up or any channel error.\n"
"Returns 0 on success.\n";
#define MAX_SAMPLES 240
/* Watchdog. I have seen situations when remote fax disconnects (because of poor line
quality) while SpanDSP continues staying in T30_STATE_IV_CTC state forever.
To avoid this, we terminate when we see that T30 state does not change for 5 minutes.
We also terminate application when more than 30 minutes passed regardless of
state changes. This is just a precaution measure - no fax should take that long */
#define WATCHDOG_TOTAL_TIMEOUT 30 * 60
#define WATCHDOG_STATE_TIMEOUT 5 * 60
typedef struct {
struct ast_channel *chan;
enum ast_t38_state t38state; /* T38 state of the channel */
int direction; /* Fax direction: 0 - receiving, 1 - sending */
int caller_mode;
char *file_name;
volatile int finished;
} fax_session;
static void span_message(int level, const char *msg)
{
if (level == SPAN_LOG_ERROR) {
ast_log(LOG_ERROR, "%s", msg);
} else if (level == SPAN_LOG_WARNING) {
ast_log(LOG_WARNING, "%s", msg);
} else {
ast_log(LOG_DEBUG, "%s", msg);
}
}
static int t38_tx_packet_handler(t38_core_state_t *s, void *user_data, const uint8_t *buf, int len, int count)
{
struct ast_channel *chan = (struct ast_channel *) user_data;
struct ast_frame outf = {
.frametype = AST_FRAME_MODEM,
.subclass = AST_MODEM_T38,
.src = __FUNCTION__,
};
/* TODO: Asterisk does not provide means of resending the same packet multiple
times so count is ignored at the moment */
AST_FRAME_SET_BUFFER(&outf, buf, 0, len);
if (ast_write(chan, &outf) < 0) {
ast_log(LOG_WARNING, "Unable to write frame to channel; %s\n", strerror(errno));
return -1;
}
return 0;
}
static void phase_e_handler(t30_state_t *f, void *user_data, int result)
{
const char *local_ident;
const char *far_ident;
char buf[20];
fax_session *s = (fax_session *) user_data;
t30_stats_t stat;
ast_debug(1, "Fax phase E handler. result=%d\n", result);
t30_get_transfer_statistics(f, &stat);
s = (fax_session *) user_data;
if (result != T30_ERR_OK) {
s->finished = -1;
/* FAXSTATUS is already set to FAILED */
pbx_builtin_setvar_helper(s->chan, "FAXERROR", t30_completion_code_to_str(result));
ast_log(LOG_WARNING, "Error transmitting fax. result=%d: %s.\n", result, t30_completion_code_to_str(result));
return;
}
s->finished = 1;
local_ident = t30_get_tx_ident(f);
far_ident = t30_get_rx_ident(f);
pbx_builtin_setvar_helper(s->chan, "FAXSTATUS", "SUCCESS");
pbx_builtin_setvar_helper(s->chan, "FAXERROR", NULL);
pbx_builtin_setvar_helper(s->chan, "REMOTESTATIONID", far_ident);
snprintf(buf, sizeof(buf), "%d", stat.pages_transferred);
pbx_builtin_setvar_helper(s->chan, "FAXPAGES", buf);
snprintf(buf, sizeof(buf), "%d", stat.y_resolution);
pbx_builtin_setvar_helper(s->chan, "FAXRESOLUTION", buf);
snprintf(buf, sizeof(buf), "%d", stat.bit_rate);
pbx_builtin_setvar_helper(s->chan, "FAXBITRATE", buf);
ast_debug(1, "Fax transmitted successfully.\n");
ast_debug(1, " Remote station ID: %s\n", far_ident);
ast_debug(1, " Pages transferred: %d\n", stat.pages_transferred);
ast_debug(1, " Image resolution: %d x %d\n", stat.x_resolution, stat.y_resolution);
ast_debug(1, " Transfer Rate: %d\n", stat.bit_rate);
manager_event(EVENT_FLAG_CALL,
s->direction ? "FaxSent" : "FaxReceived",
"Channel: %s\r\n"
"Exten: %s\r\n"
"CallerID: %s\r\n"
"RemoteStationID: %s\r\n"
"LocalStationID: %s\r\n"
"PagesTransferred: %d\r\n"
"Resolution: %d\r\n"
"TransferRate: %d\r\n"
"FileName: %s\r\n",
s->chan->name,
s->chan->exten,
S_OR(s->chan->cid.cid_num, ""),
far_ident,
local_ident,
stat.pages_transferred,
stat.y_resolution,
stat.bit_rate,
s->file_name);
}
/* === Helper functions to configure fax === */
/* Setup SPAN logging according to Asterisk debug level */
static int set_logging(logging_state_t *state)
{
int level = SPAN_LOG_WARNING + option_debug;
span_log_set_message_handler(state, span_message);
span_log_set_level(state, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | level);
return 0;
}
static void set_local_info(t30_state_t *state, fax_session *s)
{
const char *x;
x = pbx_builtin_getvar_helper(s->chan, "LOCALSTATIONID");
if (!ast_strlen_zero(x))
t30_set_tx_ident(state, x);
x = pbx_builtin_getvar_helper(s->chan, "LOCALHEADERINFO");
if (!ast_strlen_zero(x))
t30_set_tx_page_header_info(state, x);
}
static void set_file(t30_state_t *state, fax_session *s)
{
if (s->direction)
t30_set_tx_file(state, s->file_name, -1, -1);
else
t30_set_rx_file(state, s->file_name, -1);
}
static void set_ecm(t30_state_t *state, int ecm)
{
t30_set_ecm_capability(state, ecm);
t30_set_supported_compressions(state, T30_SUPPORT_T4_1D_COMPRESSION | T30_SUPPORT_T4_2D_COMPRESSION | T30_SUPPORT_T6_COMPRESSION);
}
/* === Generator === */
/* This function is only needed to return passed params so
generator_activate will save it to channel's generatordata */
static void *fax_generator_alloc(struct ast_channel *chan, void *params)
{
return params;
}
static int fax_generator_generate(struct ast_channel *chan, void *data, int len, int samples)
{
fax_state_t *fax = (fax_state_t*) data;
uint8_t buffer[AST_FRIENDLY_OFFSET + MAX_SAMPLES * sizeof(uint16_t)];
int16_t *buf = (int16_t *) (buffer + AST_FRIENDLY_OFFSET);
struct ast_frame outf = {
.frametype = AST_FRAME_VOICE,
.subclass = AST_FORMAT_SLINEAR,
.src = __FUNCTION__,
};
if (samples > MAX_SAMPLES) {
ast_log(LOG_WARNING, "Only generating %d samples, where %d requested\n", MAX_SAMPLES, samples);
samples = MAX_SAMPLES;
}
if ((len = fax_tx(fax, buf, samples)) > 0) {
outf.samples = len;
AST_FRAME_SET_BUFFER(&outf, buffer, AST_FRIENDLY_OFFSET, len * sizeof(int16_t));
if (ast_write(chan, &outf) < 0) {
ast_log(LOG_WARNING, "Failed to write frame to '%s': %s\n", chan->name, strerror(errno));
return -1;
}
}
return 0;
}
struct ast_generator generator = {
alloc: fax_generator_alloc,
generate: fax_generator_generate,
};
/* === Transmission === */
static int transmit_audio(fax_session *s)
{
int res = -1;
int original_read_fmt = AST_FORMAT_SLINEAR;
int original_write_fmt = AST_FORMAT_SLINEAR;
fax_state_t fax;
struct ast_dsp *dsp = NULL;
int detect_tone = 0;
struct ast_frame *inf = NULL;
struct ast_frame *fr;
int last_state = 0;
struct timeval now, start, state_change;
enum ast_control_t38 t38control;
original_read_fmt = s->chan->readformat;
if (original_read_fmt != AST_FORMAT_SLINEAR) {
res = ast_set_read_format(s->chan, AST_FORMAT_SLINEAR);
if (res < 0) {
ast_log(LOG_WARNING, "Unable to set to linear read mode, giving up\n");
goto done;
}
}
original_write_fmt = s->chan->writeformat;
if (original_write_fmt != AST_FORMAT_SLINEAR) {
res = ast_set_write_format(s->chan, AST_FORMAT_SLINEAR);
if (res < 0) {
ast_log(LOG_WARNING, "Unable to set to linear write mode, giving up\n");
goto done;
}
}
/* Initialize T30 terminal */
fax_init(&fax, s->caller_mode);
/* Setup logging */
set_logging(&fax.logging);
set_logging(&fax.t30_state.logging);
/* Configure terminal */
set_local_info(&fax.t30_state, s);
set_file(&fax.t30_state, s);
set_ecm(&fax.t30_state, TRUE);
fax_set_transmit_on_idle(&fax, TRUE);
t30_set_phase_e_handler(&fax.t30_state, phase_e_handler, s);
if (s->t38state == T38_STATE_UNAVAILABLE) {
ast_debug(1, "T38 is unavailable on %s\n", s->chan->name);
} else if (!s->direction) {
/* We are receiving side and this means we are the side which should
request T38 when the fax is detected. Use DSP to detect fax tone */
ast_debug(1, "Setting up CNG detection on %s\n", s->chan->name);
dsp = ast_dsp_new();
ast_dsp_set_features(dsp, DSP_FEATURE_FAX_DETECT);
ast_dsp_set_faxmode(dsp, DSP_FAXMODE_DETECT_CNG);
detect_tone = 1;
}
start = state_change = ast_tvnow();
ast_activate_generator(s->chan, &generator, &fax);
while (!s->finished) {
res = ast_waitfor(s->chan, 20);
if (res < 0)
break;
else if (res > 0)
res = 0;
inf = ast_read(s->chan);
if (inf == NULL) {
ast_debug(1, "Channel hangup\n");
res = -1;
break;
}
ast_debug(10, "frame %d/%d, len=%d\n", inf->frametype, inf->subclass, inf->datalen);
/* Detect fax tone */
if (detect_tone && inf->frametype == AST_FRAME_VOICE) {
/* Duplicate frame because ast_dsp_process may free the frame passed */
fr = ast_frdup(inf);
/* Do not pass channel to ast_dsp_process otherwise it may queue modified audio frame back */
fr = ast_dsp_process(NULL, dsp, fr);
if (fr && fr->frametype == AST_FRAME_DTMF && fr->subclass == 'f') {
ast_debug(1, "Fax tone detected. Requesting T38\n");
t38control = AST_T38_REQUEST_NEGOTIATE;
ast_indicate_data(s->chan, AST_CONTROL_T38, &t38control, sizeof(t38control));
detect_tone = 0;
}
ast_frfree(fr);
}
/* Check the frame type. Format also must be checked because there is a chance
that a frame in old format was already queued before we set chanel format
to slinear so it will still be received by ast_read */
if (inf->frametype == AST_FRAME_VOICE && inf->subclass == AST_FORMAT_SLINEAR) {
if (fax_rx(&fax, inf->data.ptr, inf->samples) < 0) {
/* I know fax_rx never returns errors. The check here is for good style only */
ast_log(LOG_WARNING, "fax_rx returned error\n");
res = -1;
break;
}
/* Watchdog */
if (last_state != fax.t30_state.state) {
state_change = ast_tvnow();
last_state = fax.t30_state.state;
}
} else if (inf->frametype == AST_FRAME_CONTROL && inf->subclass == AST_CONTROL_T38 &&
inf->datalen == sizeof(enum ast_control_t38)) {
t38control =*((enum ast_control_t38 *) inf->data.ptr);
if (t38control == AST_T38_NEGOTIATED) {
/* T38 switchover completed */
ast_debug(1, "T38 negotiated, finishing audio loop\n");
res = 1;
break;
}
}
ast_frfree(inf);
inf = NULL;
/* Watchdog */
now = ast_tvnow();
if (ast_tvdiff_sec(now, start) > WATCHDOG_TOTAL_TIMEOUT || ast_tvdiff_sec(now, state_change) > WATCHDOG_STATE_TIMEOUT) {
ast_log(LOG_WARNING, "It looks like we hung. Aborting.\n");
res = -1;
break;
}
}
ast_debug(1, "Loop finished, res=%d\n", res);
if (inf)
ast_frfree(inf);
if (dsp)
ast_dsp_free(dsp);
ast_deactivate_generator(s->chan);
/* Remove phase E handler because we do not want it to be executed
only because we called t30_terminate */
t30_set_phase_e_handler(&fax.t30_state, NULL, NULL);
t30_terminate(&fax.t30_state);
fax_release(&fax);
done:
if (original_write_fmt != AST_FORMAT_SLINEAR) {
if (ast_set_write_format(s->chan, original_write_fmt) < 0)
ast_log(LOG_WARNING, "Unable to restore write format on '%s'\n", s->chan->name);
}
if (original_read_fmt != AST_FORMAT_SLINEAR) {
if (ast_set_read_format(s->chan, original_read_fmt) < 0)
ast_log(LOG_WARNING, "Unable to restore read format on '%s'\n", s->chan->name);
}
return res;
}
static int transmit_t38(fax_session *s)
{
int res = 0;
t38_terminal_state_t t38;
struct ast_frame *inf = NULL;
int last_state = 0;
struct timeval now, start, state_change, last_frame;
enum ast_control_t38 t38control;
/* Initialize terminal */
memset(&t38, 0, sizeof(t38));
if (t38_terminal_init(&t38, s->caller_mode, t38_tx_packet_handler, s->chan) == NULL) {
ast_log(LOG_WARNING, "Unable to start T.38 termination.\n");
return -1;
}
/* Setup logging */
set_logging(&t38.logging);
set_logging(&t38.t30_state.logging);
set_logging(&t38.t38.logging);
/* Configure terminal */
set_local_info(&t38.t30_state, s);
set_file(&t38.t30_state, s);
set_ecm(&t38.t30_state, TRUE);
t30_set_phase_e_handler(&t38.t30_state, phase_e_handler, s);
now = start = state_change = ast_tvnow();
while (!s->finished) {
res = ast_waitfor(s->chan, 20);
if (res < 0)
break;
else if (res > 0)
res = 0;
last_frame = now;
now = ast_tvnow();
t38_terminal_send_timeout(&t38, ast_tvdiff_us(now, last_frame) / (1000000 / 8000));
inf = ast_read(s->chan);
if (inf == NULL) {
ast_debug(1, "Channel hangup\n");
res = -1;
break;
}
ast_debug(10, "frame %d/%d, len=%d\n", inf->frametype, inf->subclass, inf->datalen);
if (inf->frametype == AST_FRAME_MODEM && inf->subclass == AST_MODEM_T38) {
t38_core_rx_ifp_packet(&t38.t38, inf->data.ptr, inf->datalen, inf->seqno);
/* Watchdog */
if (last_state != t38.t30_state.state) {
state_change = ast_tvnow();
last_state = t38.t30_state.state;
}
} else if (inf->frametype == AST_FRAME_CONTROL && inf->subclass == AST_CONTROL_T38 &&
inf->datalen == sizeof(enum ast_control_t38)) {
t38control = *((enum ast_control_t38 *) inf->data.ptr);
if (t38control == AST_T38_TERMINATED || t38control == AST_T38_REFUSED) {
ast_debug(1, "T38 down, terminating\n");
res = -1;
break;
}
}
ast_frfree(inf);
inf = NULL;
/* Watchdog */
if (ast_tvdiff_sec(now, start) > WATCHDOG_TOTAL_TIMEOUT || ast_tvdiff_sec(now, state_change) > WATCHDOG_STATE_TIMEOUT) {
ast_log(LOG_WARNING, "It looks like we hung. Aborting.\n");
res = -1;
break;
}
}
ast_debug(1, "Loop finished, res=%d\n", res);
if (inf)
ast_frfree(inf);
/* Remove phase E handler because we do not want it to be executed
only because we called t30_terminate */
t30_set_phase_e_handler(&t38.t30_state, NULL, NULL);
t30_terminate(&t38.t30_state);
return res;
}
static int transmit(fax_session *s)
{
int res = 0;
/* Clear all channel variables which to be set by the application.
Pre-set status to error so in case of any problems we can just leave */
pbx_builtin_setvar_helper(s->chan, "FAXSTATUS", "FAILED");
pbx_builtin_setvar_helper(s->chan, "FAXERROR", "Channel problems");
pbx_builtin_setvar_helper(s->chan, "REMOTESTATIONID", NULL);
pbx_builtin_setvar_helper(s->chan, "FAXPAGES", NULL);
pbx_builtin_setvar_helper(s->chan, "FAXRESOLUTION", NULL);
pbx_builtin_setvar_helper(s->chan, "FAXBITRATE", NULL);
if (s->chan->_state != AST_STATE_UP) {
/* Shouldn't need this, but checking to see if channel is already answered
* Theoretically asterisk should already have answered before running the app */
res = ast_answer(s->chan);
if (res) {
ast_log(LOG_WARNING, "Could not answer channel '%s'\n", s->chan->name);
return res;
}
}
s->t38state = ast_channel_get_t38_state(s->chan);
if (s->t38state != T38_STATE_NEGOTIATED) {
/* T38 is not negotiated on the channel yet. First start regular transmission. If it switches to T38, follow */
res = transmit_audio(s);
if (res > 0) {
/* transmit_audio reports switchover to T38. Update t38state */
s->t38state = ast_channel_get_t38_state(s->chan);
if (s->t38state != T38_STATE_NEGOTIATED) {
ast_log(LOG_ERROR, "Audio loop reports T38 switchover but t38state != T38_STATE_NEGOTIATED\n");
}
}
}
if (s->t38state == T38_STATE_NEGOTIATED) {
res = transmit_t38(s);
}
if (res) {
ast_log(LOG_WARNING, "Transmission error\n");
res = -1;
} else if (s->finished < 0) {
ast_log(LOG_WARNING, "Transmission failed\n");
} else if (s->finished > 0) {
ast_debug(1, "Transmission finished Ok\n");
}
return res;
}
/* === Application functions === */
static int sndfax_exec(struct ast_channel *chan, void *data)
{
int res = 0;
char *parse;
fax_session session;
AST_DECLARE_APP_ARGS(args,
AST_APP_ARG(file_name);
AST_APP_ARG(options);
);
if (chan == NULL) {
ast_log(LOG_ERROR, "Fax channel is NULL. Giving up.\n");
return -1;
}
/* The next few lines of code parse out the filename and header from the input string */
if (ast_strlen_zero(data)) {
/* No data implies no filename or anything is present */
ast_log(LOG_ERROR, "SendFAX requires an argument (filename)\n");
return -1;
}
parse = ast_strdupa(data);
AST_STANDARD_APP_ARGS(args, parse);
session.caller_mode = TRUE;
if (args.options) {
if (strchr(args.options, 'a'))
session.caller_mode = FALSE;
}
/* Done parsing */
session.direction = 1;
session.file_name = args.file_name;
session.chan = chan;
session.finished = 0;
res = transmit(&session);
return res;
}
static int rcvfax_exec(struct ast_channel *chan, void *data)
{
int res = 0;
char *parse;
fax_session session;
AST_DECLARE_APP_ARGS(args,
AST_APP_ARG(file_name);
AST_APP_ARG(options);
);
if (chan == NULL) {
ast_log(LOG_ERROR, "Fax channel is NULL. Giving up.\n");
return -1;
}
/* The next few lines of code parse out the filename and header from the input string */
if (ast_strlen_zero(data)) {
/* No data implies no filename or anything is present */
ast_log(LOG_ERROR, "ReceiveFAX requires an argument (filename)\n");
return -1;
}
parse = ast_strdupa(data);
AST_STANDARD_APP_ARGS(args, parse);
session.caller_mode = FALSE;
if (args.options) {
if (strchr(args.options, 'c'))
session.caller_mode = TRUE;
}
/* Done parsing */
session.direction = 0;
session.file_name = args.file_name;
session.chan = chan;
session.finished = 0;
res = transmit(&session);
return res;
}
static int unload_module(void)
{
int res;
res = ast_unregister_application(app_sndfax_name);
res |= ast_unregister_application(app_rcvfax_name);
return res;
}
static int load_module(void)
{
int res ;
res = ast_register_application(app_sndfax_name, sndfax_exec, app_sndfax_synopsis, app_sndfax_desc);
res |= ast_register_application(app_rcvfax_name, rcvfax_exec, app_rcvfax_synopsis, app_rcvfax_desc);
/* The default SPAN message handler prints to stderr. It is something we do not want */
span_set_message_handler(NULL);
return res;
}
AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_DEFAULT, "Simple FAX Application",
.load = load_module,
.unload = unload_module,
);

View File

@ -18,7 +18,7 @@
/*! \file
*
* \brief App to flash a zap trunk
* \brief App to flash a DAHDI trunk
*
* \author Mark Spencer <markster@digium.com>
*
@ -26,14 +26,14 @@
*/
/*** MODULEINFO
<depend>zaptel</depend>
<depend>dahdi</depend>
***/
#include "asterisk.h"
ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
#include "asterisk/zapata.h"
#include "asterisk/dahdi.h"
#include "asterisk/lock.h"
#include "asterisk/file.h"
@ -45,22 +45,22 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
static char *app = "Flash";
static char *synopsis = "Flashes a Zap Trunk";
static char *synopsis = "Flashes a DAHDI Trunk";
static char *descrip =
"Performs a flash on a zap trunk. This can be used\n"
"Performs a flash on a DAHDI trunk. This can be used\n"
"to access features provided on an incoming analogue circuit\n"
"such as conference and call waiting. Use with SendDTMF() to\n"
"perform external transfers\n";
static inline int zt_wait_event(int fd)
static inline int dahdi_wait_event(int fd)
{
/* Avoid the silly zt_waitevent which ignores a bunch of events */
/* Avoid the silly dahdi_waitevent which ignores a bunch of events */
int i,j=0;
i = ZT_IOMUX_SIGEVENT;
if (ioctl(fd, ZT_IOMUX, &i) == -1) return -1;
if (ioctl(fd, ZT_GETEVENT, &j) == -1) return -1;
i = DAHDI_IOMUX_SIGEVENT;
if (ioctl(fd, DAHDI_IOMUX, &i) == -1) return -1;
if (ioctl(fd, DAHDI_GETEVENT, &j) == -1) return -1;
return j;
}
@ -68,23 +68,23 @@ static int flash_exec(struct ast_channel *chan, void *data)
{
int res = -1;
int x;
struct zt_params ztp;
struct dahdi_params dahdip;
if (strcasecmp(chan->tech->type, "Zap")) {
ast_log(LOG_WARNING, "%s is not a Zap channel\n", chan->name);
if (strcasecmp(chan->tech->type, "DAHDI")) {
ast_log(LOG_WARNING, "%s is not a DAHDI channel\n", chan->name);
return -1;
}
memset(&ztp, 0, sizeof(ztp));
res = ioctl(chan->fds[0], ZT_GET_PARAMS, &ztp);
memset(&dahdip, 0, sizeof(dahdip));
res = ioctl(chan->fds[0], DAHDI_GET_PARAMS, &dahdip);
if (!res) {
if (ztp.sigtype & __ZT_SIG_FXS) {
x = ZT_FLASH;
res = ioctl(chan->fds[0], ZT_HOOK, &x);
if (dahdip.sigtype & __DAHDI_SIG_FXS) {
x = DAHDI_FLASH;
res = ioctl(chan->fds[0], DAHDI_HOOK, &x);
if (!res || (errno == EINPROGRESS)) {
if (res) {
/* Wait for the event to finish */
zt_wait_event(chan->fds[0]);
dahdi_wait_event(chan->fds[0]);
}
res = ast_safe_sleep(chan, 1000);
ast_verb(3, "Flashed channel %s\n", chan->name);

View File

@ -42,7 +42,7 @@ static char *synopsis = "Get ADSI CPE ID";
static char *descrip =
" GetCPEID(): Obtains and displays ADSI CPE ID and other information in order\n"
"to properly setup zapata.conf for on-hook operations.\n";
"to properly setup dahdi.conf for on-hook operations.\n";
static int cpeid_setstatus(struct ast_channel *chan, char *stuff[], int voice)

View File

@ -30,14 +30,14 @@
*/
/*** MODULEINFO
<depend>zaptel</depend>
<depend>dahdi</depend>
***/
#include "asterisk.h"
ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
#include "asterisk/zapata.h"
#include "asterisk/dahdi.h"
#include "asterisk/lock.h"
#include "asterisk/file.h"
@ -228,15 +228,15 @@ static const char *descrip =
"conference. If the conference number is omitted, the user will be prompted\n"
"to enter one. User can exit the conference by hangup, or if the 'p' option\n"
"is specified, by pressing '#'.\n"
"Please note: The Zaptel kernel modules and at least one hardware driver (or ztdummy)\n"
" must be present for conferencing to operate properly. In addition, the chan_zap\n"
"Please note: The DAHDI kernel modules and at least one hardware driver (or dahdi_dummy)\n"
" must be present for conferencing to operate properly. In addition, the chan_dahdi\n"
" channel driver must be loaded for the 'i' and 'r' options to operate at all.\n\n"
"The option string may contain zero or more of the following characters:\n"
" 'a' -- set admin mode\n"
" 'A' -- set marked mode\n"
" 'b' -- run AGI script specified in ${MEETME_AGI_BACKGROUND}\n"
" Default: conf-background.agi (Note: This does not work with\n"
" non-Zap channels in the same conference)\n"
" non-DAHDI channels in the same conference)\n"
" 'c' -- announce user(s) count on joining a conference\n"
" 'C' -- continue in dialplan when kicked out of conference\n"
" 'd' -- dynamically add conference\n"
@ -361,7 +361,7 @@ struct ast_conference {
struct ast_channel *chan; /*!< Announcements channel */
struct ast_channel *lchan; /*!< Listen/Record channel */
int fd; /*!< Announcements fd */
int zapconf; /*!< Zaptel Conf # */
int dahdiconf; /*!< DAHDI Conf # */
int users; /*!< Number of active users */
int markedusers; /*!< Number of marked users */
int maxusers; /*!< Participant limit if scheduled */
@ -403,7 +403,7 @@ struct ast_conf_user {
int adminflags; /*!< Flags set by the Admin */
struct ast_channel *chan; /*!< Connected channel */
int talking; /*!< Is user talking */
int zapchannel; /*!< Is a Zaptel channel */
int dahdichannel; /*!< Is a DAHDI channel */
char usrvalue[50]; /*!< Custom User Value */
char namerecloc[PATH_MAX]; /*!< Name Recorded file Location */
time_t jointime; /*!< Time the user joined the conference */
@ -639,8 +639,8 @@ static int careful_write(int fd, unsigned char *data, int len, int block)
while (len) {
if (block) {
x = ZT_IOMUX_WRITE | ZT_IOMUX_SIGEVENT;
res = ioctl(fd, ZT_IOMUX, &x);
x = DAHDI_IOMUX_WRITE | DAHDI_IOMUX_SIGEVENT;
res = ioctl(fd, DAHDI_IOMUX, &x);
} else
res = 0;
if (res >= 0)
@ -801,7 +801,7 @@ static void conf_play(struct ast_channel *chan, struct ast_conference *conf, enu
static struct ast_conference *build_conf(char *confno, char *pin, char *pinadmin, int make, int dynamic, int refcount, const struct ast_channel *chan)
{
struct ast_conference *cnf;
struct zt_confinfo ztc = { 0, };
struct dahdi_confinfo dahdic = { 0, };
int confno_int = 0;
AST_LIST_LOCK(&confs);
@ -827,11 +827,11 @@ static struct ast_conference *build_conf(char *confno, char *pin, char *pinadmin
ast_copy_string(cnf->pinadmin, pinadmin, sizeof(cnf->pinadmin));
ast_copy_string(cnf->uniqueid, chan->uniqueid, sizeof(cnf->uniqueid));
/* Setup a new zap conference */
ztc.confno = -1;
ztc.confmode = ZT_CONF_CONFANN | ZT_CONF_CONFANNMON;
cnf->fd = open("/dev/zap/pseudo", O_RDWR);
if (cnf->fd < 0 || ioctl(cnf->fd, ZT_SETCONF, &ztc)) {
/* Setup a new dahdi conference */
dahdic.confno = -1;
dahdic.confmode = DAHDI_CONF_CONFANN | DAHDI_CONF_CONFANNMON;
cnf->fd = open("/dev/dahdi/pseudo", O_RDWR);
if (cnf->fd < 0 || ioctl(cnf->fd, DAHDI_SETCONF, &dahdic)) {
ast_log(LOG_WARNING, "Unable to open pseudo device\n");
if (cnf->fd >= 0)
close(cnf->fd);
@ -840,17 +840,17 @@ static struct ast_conference *build_conf(char *confno, char *pin, char *pinadmin
goto cnfout;
}
cnf->zapconf = ztc.confno;
cnf->dahdiconf = dahdic.confno;
/* Setup a new channel for playback of audio files */
cnf->chan = ast_request("zap", AST_FORMAT_SLINEAR, "pseudo", NULL);
cnf->chan = ast_request("DAHDI", AST_FORMAT_SLINEAR, "pseudo", NULL);
if (cnf->chan) {
ast_set_read_format(cnf->chan, AST_FORMAT_SLINEAR);
ast_set_write_format(cnf->chan, AST_FORMAT_SLINEAR);
ztc.chan = 0;
ztc.confno = cnf->zapconf;
ztc.confmode = ZT_CONF_CONFANN | ZT_CONF_CONFANNMON;
if (ioctl(cnf->chan->fds[0], ZT_SETCONF, &ztc)) {
dahdic.chan = 0;
dahdic.confno = cnf->dahdiconf;
dahdic.confmode = DAHDI_CONF_CONFANN | DAHDI_CONF_CONFANNMON;
if (ioctl(cnf->chan->fds[0], DAHDI_SETCONF, &dahdic)) {
ast_log(LOG_WARNING, "Error setting conference\n");
if (cnf->chan)
ast_hangup(cnf->chan);
@ -867,7 +867,7 @@ static struct ast_conference *build_conf(char *confno, char *pin, char *pinadmin
cnf->start = time(NULL);
cnf->maxusers = 0x7fffffff;
cnf->isdynamic = dynamic ? 1 : 0;
ast_verb(3, "Created MeetMe conference %d for conference '%s'\n", cnf->zapconf, cnf->confno);
ast_verb(3, "Created MeetMe conference %d for conference '%s'\n", cnf->dahdiconf, cnf->confno);
AST_LIST_INSERT_HEAD(&confs, cnf, list);
/* Reserve conference number in map */
@ -1309,8 +1309,8 @@ static void conf_flush(int fd, struct ast_channel *chan)
}
/* flush any data sitting in the pseudo channel */
x = ZT_FLUSH_ALL;
if (ioctl(fd, ZT_FLUSH, &x))
x = DAHDI_FLUSH_ALL;
if (ioctl(fd, DAHDI_FLUSH, &x))
ast_log(LOG_WARNING, "Error flushing channel\n");
}
@ -1484,7 +1484,7 @@ static int conf_run(struct ast_channel *chan, struct ast_conference *conf, int c
struct ast_conf_user *user = NULL;
struct ast_conf_user *usr = NULL;
int fd;
struct zt_confinfo ztc, ztc_empty;
struct dahdi_confinfo dahdic, dahdic_empty;
struct ast_frame *f;
struct ast_channel *c;
struct ast_frame fr;
@ -1493,7 +1493,7 @@ static int conf_run(struct ast_channel *chan, struct ast_conference *conf, int c
int nfds;
int res;
int flags;
int retryzap;
int retrydahdi;
int origfd;
int musiconhold = 0;
int firstpass = 0;
@ -1520,7 +1520,7 @@ static int conf_run(struct ast_channel *chan, struct ast_conference *conf, int c
char members[10] = "";
int dtmf, opt_waitmarked_timeout = 0;
time_t timeout = 0;
ZT_BUFFERINFO bi;
DAHDI_BUFFERINFO bi;
char __buf[CONF_SIZE + AST_FRIENDLY_OFFSET];
char *buf = __buf + AST_FRIENDLY_OFFSET;
char *exitkeys = NULL;
@ -1645,13 +1645,13 @@ static int conf_run(struct ast_channel *chan, struct ast_conference *conf, int c
}
ast_mutex_lock(&conf->recordthreadlock);
if ((conf->recordthread == AST_PTHREADT_NULL) && (confflags & CONFFLAG_RECORDCONF) && ((conf->lchan = ast_request("zap", AST_FORMAT_SLINEAR, "pseudo", NULL)))) {
if ((conf->recordthread == AST_PTHREADT_NULL) && (confflags & CONFFLAG_RECORDCONF) && ((conf->lchan = ast_request("DAHDI", AST_FORMAT_SLINEAR, "pseudo", NULL)))) {
ast_set_read_format(conf->lchan, AST_FORMAT_SLINEAR);
ast_set_write_format(conf->lchan, AST_FORMAT_SLINEAR);
ztc.chan = 0;
ztc.confno = conf->zapconf;
ztc.confmode = ZT_CONF_CONFANN | ZT_CONF_CONFANNMON;
if (ioctl(conf->lchan->fds[0], ZT_SETCONF, &ztc)) {
dahdic.chan = 0;
dahdic.confno = conf->dahdiconf;
dahdic.confmode = DAHDI_CONF_CONFANN | DAHDI_CONF_CONFANNMON;
if (ioctl(conf->lchan->fds[0], DAHDI_SETCONF, &dahdic)) {
ast_log(LOG_WARNING, "Error starting listen channel\n");
ast_hangup(conf->lchan);
conf->lchan = NULL;
@ -1832,13 +1832,13 @@ static int conf_run(struct ast_channel *chan, struct ast_conference *conf, int c
goto outrun;
}
retryzap = (strcasecmp(chan->tech->type, "Zap") || (chan->audiohooks || chan->monitor) ? 1 : 0);
user->zapchannel = !retryzap;
retrydahdi = (strcasecmp(chan->tech->type, "DAHDI") || (chan->audiohooks || chan->monitor) ? 1 : 0);
user->dahdichannel = !retrydahdi;
zapretry:
dahdiretry:
origfd = chan->fds[0];
if (retryzap) {
fd = open("/dev/zap/pseudo", O_RDWR);
if (retrydahdi) {
fd = open("/dev/dahdi/pseudo", O_RDWR);
if (fd < 0) {
ast_log(LOG_WARNING, "Unable to open pseudo channel: %s\n", strerror(errno));
goto outrun;
@ -1859,16 +1859,16 @@ static int conf_run(struct ast_channel *chan, struct ast_conference *conf, int c
/* Setup buffering information */
memset(&bi, 0, sizeof(bi));
bi.bufsize = CONF_SIZE / 2;
bi.txbufpolicy = ZT_POLICY_IMMEDIATE;
bi.rxbufpolicy = ZT_POLICY_IMMEDIATE;
bi.txbufpolicy = DAHDI_POLICY_IMMEDIATE;
bi.rxbufpolicy = DAHDI_POLICY_IMMEDIATE;
bi.numbufs = audio_buffers;
if (ioctl(fd, ZT_SET_BUFINFO, &bi)) {
if (ioctl(fd, DAHDI_SET_BUFINFO, &bi)) {
ast_log(LOG_WARNING, "Unable to set buffering information: %s\n", strerror(errno));
close(fd);
goto outrun;
}
x = 1;
if (ioctl(fd, ZT_SETLINEAR, &x)) {
if (ioctl(fd, DAHDI_SETLINEAR, &x)) {
ast_log(LOG_WARNING, "Unable to set linear mode: %s\n", strerror(errno));
close(fd);
goto outrun;
@ -1879,27 +1879,27 @@ static int conf_run(struct ast_channel *chan, struct ast_conference *conf, int c
fd = chan->fds[0];
nfds = 0;
}
memset(&ztc, 0, sizeof(ztc));
memset(&ztc_empty, 0, sizeof(ztc_empty));
memset(&dahdic, 0, sizeof(dahdic));
memset(&dahdic_empty, 0, sizeof(dahdic_empty));
/* Check to see if we're in a conference... */
ztc.chan = 0;
if (ioctl(fd, ZT_GETCONF, &ztc)) {
dahdic.chan = 0;
if (ioctl(fd, DAHDI_GETCONF, &dahdic)) {
ast_log(LOG_WARNING, "Error getting conference\n");
close(fd);
goto outrun;
}
if (ztc.confmode) {
if (dahdic.confmode) {
/* Whoa, already in a conference... Retry... */
if (!retryzap) {
ast_debug(1, "Zap channel is in a conference already, retrying with pseudo\n");
retryzap = 1;
goto zapretry;
if (!retrydahdi) {
ast_debug(1, "DAHDI channel is in a conference already, retrying with pseudo\n");
retrydahdi = 1;
goto dahdiretry;
}
}
memset(&ztc, 0, sizeof(ztc));
memset(&dahdic, 0, sizeof(dahdic));
/* Add us to the conference */
ztc.chan = 0;
ztc.confno = conf->zapconf;
dahdic.chan = 0;
dahdic.confno = conf->dahdiconf;
ast_mutex_lock(&conf->playlock);
@ -1913,21 +1913,21 @@ static int conf_run(struct ast_channel *chan, struct ast_conference *conf, int c
}
if (confflags & CONFFLAG_WAITMARKED && !conf->markedusers)
ztc.confmode = ZT_CONF_CONF;
dahdic.confmode = DAHDI_CONF_CONF;
else if (confflags & CONFFLAG_MONITOR)
ztc.confmode = ZT_CONF_CONFMON | ZT_CONF_LISTENER;
dahdic.confmode = DAHDI_CONF_CONFMON | DAHDI_CONF_LISTENER;
else if (confflags & CONFFLAG_TALKER)
ztc.confmode = ZT_CONF_CONF | ZT_CONF_TALKER;
dahdic.confmode = DAHDI_CONF_CONF | DAHDI_CONF_TALKER;
else
ztc.confmode = ZT_CONF_CONF | ZT_CONF_TALKER | ZT_CONF_LISTENER;
dahdic.confmode = DAHDI_CONF_CONF | DAHDI_CONF_TALKER | DAHDI_CONF_LISTENER;
if (ioctl(fd, ZT_SETCONF, &ztc)) {
if (ioctl(fd, DAHDI_SETCONF, &dahdic)) {
ast_log(LOG_WARNING, "Error setting conference\n");
close(fd);
ast_mutex_unlock(&conf->playlock);
goto outrun;
}
ast_debug(1, "Placed channel %s in ZAP conf %d\n", chan->name, conf->zapconf);
ast_debug(1, "Placed channel %s in ZAP conf %d\n", chan->name, conf->dahdiconf);
if (!sent_event) {
manager_event(EVENT_FLAG_CALL, "MeetmeJoin",
@ -1968,8 +1968,8 @@ static int conf_run(struct ast_channel *chan, struct ast_conference *conf, int c
}
ast_channel_unlock(chan);
if (user->zapchannel) {
/* Set CONFMUTE mode on Zap channel to mute DTMF tones */
if (user->dahdichannel) {
/* Set CONFMUTE mode on DAHDI channel to mute DTMF tones */
x = 1;
ast_channel_setoption(chan, AST_OPTION_TONE_VERIFY, &x, sizeof(char), 0);
}
@ -1981,14 +1981,14 @@ static int conf_run(struct ast_channel *chan, struct ast_conference *conf, int c
ast_log(LOG_WARNING, "Could not find application (agi)\n");
ret = -2;
}
if (user->zapchannel) {
/* Remove CONFMUTE mode on Zap channel */
if (user->dahdichannel) {
/* Remove CONFMUTE mode on DAHDI channel */
x = 0;
ast_channel_setoption(chan, AST_OPTION_TONE_VERIFY, &x, sizeof(char), 0);
}
} else {
if (user->zapchannel && (confflags & CONFFLAG_STARMENU)) {
/* Set CONFMUTE mode on Zap channel to mute DTMF tones when the menu is enabled */
if (user->dahdichannel && (confflags & CONFFLAG_STARMENU)) {
/* Set CONFMUTE mode on DAHDI channel to mute DTMF tones when the menu is enabled */
x = 1;
ast_channel_setoption(chan, AST_OPTION_TONE_VERIFY, &x, sizeof(char), 0);
}
@ -2139,8 +2139,8 @@ static int conf_run(struct ast_channel *chan, struct ast_conference *conf, int c
ret = 0;
break;
} else {
ztc.confmode = ZT_CONF_CONF;
if (ioctl(fd, ZT_SETCONF, &ztc)) {
dahdic.confmode = DAHDI_CONF_CONF;
if (ioctl(fd, DAHDI_SETCONF, &dahdic)) {
ast_log(LOG_WARNING, "Error setting conference\n");
close(fd);
goto outrun;
@ -2155,12 +2155,12 @@ static int conf_run(struct ast_channel *chan, struct ast_conference *conf, int c
/* Marked user entered, so cancel timeout */
timeout = 0;
if (confflags & CONFFLAG_MONITOR)
ztc.confmode = ZT_CONF_CONFMON | ZT_CONF_LISTENER;
dahdic.confmode = DAHDI_CONF_CONFMON | DAHDI_CONF_LISTENER;
else if (confflags & CONFFLAG_TALKER)
ztc.confmode = ZT_CONF_CONF | ZT_CONF_TALKER;
dahdic.confmode = DAHDI_CONF_CONF | DAHDI_CONF_TALKER;
else
ztc.confmode = ZT_CONF_CONF | ZT_CONF_TALKER | ZT_CONF_LISTENER;
if (ioctl(fd, ZT_SETCONF, &ztc)) {
dahdic.confmode = DAHDI_CONF_CONF | DAHDI_CONF_TALKER | DAHDI_CONF_LISTENER;
if (ioctl(fd, DAHDI_SETCONF, &dahdic)) {
ast_log(LOG_WARNING, "Error setting conference\n");
close(fd);
goto outrun;
@ -2204,9 +2204,9 @@ static int conf_run(struct ast_channel *chan, struct ast_conference *conf, int c
/* Check if my modes have changed */
/* If I should be muted but am still talker, mute me */
if ((user->adminflags & (ADMINFLAG_MUTED | ADMINFLAG_SELFMUTED)) && (ztc.confmode & ZT_CONF_TALKER)) {
ztc.confmode ^= ZT_CONF_TALKER;
if (ioctl(fd, ZT_SETCONF, &ztc)) {
if ((user->adminflags & (ADMINFLAG_MUTED | ADMINFLAG_SELFMUTED)) && (dahdic.confmode & DAHDI_CONF_TALKER)) {
dahdic.confmode ^= DAHDI_CONF_TALKER;
if (ioctl(fd, DAHDI_SETCONF, &dahdic)) {
ast_log(LOG_WARNING, "Error setting conference - Un/Mute \n");
ret = -1;
break;
@ -2222,9 +2222,9 @@ static int conf_run(struct ast_channel *chan, struct ast_conference *conf, int c
}
/* If I should be un-muted but am not talker, un-mute me */
if (!(user->adminflags & (ADMINFLAG_MUTED | ADMINFLAG_SELFMUTED)) && !(confflags & CONFFLAG_MONITOR) && !(ztc.confmode & ZT_CONF_TALKER)) {
ztc.confmode |= ZT_CONF_TALKER;
if (ioctl(fd, ZT_SETCONF, &ztc)) {
if (!(user->adminflags & (ADMINFLAG_MUTED | ADMINFLAG_SELFMUTED)) && !(confflags & CONFFLAG_MONITOR) && !(dahdic.confmode & DAHDI_CONF_TALKER)) {
dahdic.confmode |= DAHDI_CONF_TALKER;
if (ioctl(fd, DAHDI_SETCONF, &dahdic)) {
ast_log(LOG_WARNING, "Error setting conference - Un/Mute \n");
ret = -1;
break;
@ -2283,16 +2283,16 @@ static int conf_run(struct ast_channel *chan, struct ast_conference *conf, int c
if (c) {
char dtmfstr[2] = "";
if (c->fds[0] != origfd || (user->zapchannel && (c->audiohooks || c->monitor))) {
if (c->fds[0] != origfd || (user->dahdichannel && (c->audiohooks || c->monitor))) {
if (using_pseudo) {
/* Kill old pseudo */
close(fd);
using_pseudo = 0;
}
ast_debug(1, "Ooh, something swapped out under us, starting over\n");
retryzap = (strcasecmp(c->tech->type, "Zap") || (c->audiohooks || c->monitor) ? 1 : 0);
user->zapchannel = !retryzap;
goto zapretry;
retrydahdi = (strcasecmp(c->tech->type, "DAHDI") || (c->audiohooks || c->monitor) ? 1 : 0);
user->dahdichannel = !retrydahdi;
goto dahdiretry;
}
if ((confflags & CONFFLAG_MONITOR) || (user->adminflags & (ADMINFLAG_MUTED | ADMINFLAG_SELFMUTED)))
f = ast_read_noaudio(c);
@ -2358,7 +2358,7 @@ static int conf_run(struct ast_channel *chan, struct ast_conference *conf, int c
} else if (((f->frametype == AST_FRAME_DTMF) && (f->subclass == '*') && (confflags & CONFFLAG_STARMENU)) || ((f->frametype == AST_FRAME_DTMF) && menu_active)) {
if (confflags & CONFFLAG_PASS_DTMF)
conf_queue_dtmf(conf, user, f);
if (ioctl(fd, ZT_SETCONF, &ztc_empty)) {
if (ioctl(fd, DAHDI_SETCONF, &dahdic_empty)) {
ast_log(LOG_WARNING, "Error setting conference\n");
close(fd);
ast_frfree(f);
@ -2513,7 +2513,7 @@ static int conf_run(struct ast_channel *chan, struct ast_conference *conf, int c
if (musiconhold)
conf_start_moh(chan, optargs[OPT_ARG_MOH_CLASS]);
if (ioctl(fd, ZT_SETCONF, &ztc)) {
if (ioctl(fd, DAHDI_SETCONF, &dahdic)) {
ast_log(LOG_WARNING, "Error setting conference\n");
close(fd);
ast_frfree(f);
@ -2625,10 +2625,10 @@ bailoutandtrynormal:
close(fd);
else {
/* Take out of conference */
ztc.chan = 0;
ztc.confno = 0;
ztc.confmode = 0;
if (ioctl(fd, ZT_SETCONF, &ztc)) {
dahdic.chan = 0;
dahdic.confno = 0;
dahdic.confmode = 0;
if (ioctl(fd, DAHDI_SETCONF, &dahdic)) {
ast_log(LOG_WARNING, "Error setting conference\n");
}
}
@ -2834,13 +2834,13 @@ static struct ast_conference *find_conf_realtime(struct ast_channel *chan, char
if (confflags && !cnf->chan &&
!ast_test_flag(confflags, CONFFLAG_QUIET) &&
ast_test_flag(confflags, CONFFLAG_INTROUSER)) {
ast_log(LOG_WARNING, "No Zap channel available for conference, user introduction disabled (is chan_zap loaded?)\n");
ast_log(LOG_WARNING, "No DAHDI channel available for conference, user introduction disabled (is chan_dahdi loaded?)\n");
ast_clear_flag(confflags, CONFFLAG_INTROUSER);
}
if (confflags && !cnf->chan &&
ast_test_flag(confflags, CONFFLAG_RECORDCONF)) {
ast_log(LOG_WARNING, "No Zap channel available for conference, conference recording disabled (is chan_zap loaded?)\n");
ast_log(LOG_WARNING, "No DAHDI channel available for conference, conference recording disabled (is chan_dahdi loaded?)\n");
ast_clear_flag(confflags, CONFFLAG_RECORDCONF);
}
}
@ -2932,13 +2932,13 @@ static struct ast_conference *find_conf(struct ast_channel *chan, char *confno,
if (confflags && !cnf->chan &&
!ast_test_flag(confflags, CONFFLAG_QUIET) &&
ast_test_flag(confflags, CONFFLAG_INTROUSER)) {
ast_log(LOG_WARNING, "No Zap channel available for conference, user introduction disabled (is chan_zap loaded?)\n");
ast_log(LOG_WARNING, "No DAHDI channel available for conference, user introduction disabled (is chan_dahdi loaded?)\n");
ast_clear_flag(confflags, CONFFLAG_INTROUSER);
}
if (confflags && !cnf->chan &&
ast_test_flag(confflags, CONFFLAG_RECORDCONF)) {
ast_log(LOG_WARNING, "No Zap channel available for conference, conference recording disabled (is chan_zap loaded?)\n");
ast_log(LOG_WARNING, "No DAHDI channel available for conference, conference recording disabled (is chan_dahdi loaded?)\n");
ast_clear_flag(confflags, CONFFLAG_RECORDCONF);
}
}
@ -3722,9 +3722,9 @@ static void load_config_meetme(void)
if ((sscanf(val, "%d", &audio_buffers) != 1)) {
ast_log(LOG_WARNING, "audiobuffers setting must be a number, not '%s'\n", val);
audio_buffers = DEFAULT_AUDIO_BUFFERS;
} else if ((audio_buffers < ZT_DEFAULT_NUM_BUFS) || (audio_buffers > ZT_MAX_NUM_BUFS)) {
} else if ((audio_buffers < DAHDI_DEFAULT_NUM_BUFS) || (audio_buffers > DAHDI_MAX_NUM_BUFS)) {
ast_log(LOG_WARNING, "audiobuffers setting must be between %d and %d\n",
ZT_DEFAULT_NUM_BUFS, ZT_MAX_NUM_BUFS);
DAHDI_DEFAULT_NUM_BUFS, DAHDI_MAX_NUM_BUFS);
audio_buffers = DEFAULT_AUDIO_BUFFERS;
}
if (audio_buffers != DEFAULT_AUDIO_BUFFERS)

View File

@ -26,7 +26,7 @@
*/
/*** MODULEINFO
<depend>zaptel</depend>
<depend>dahdi</depend>
<depend>app_meetme</depend>
***/

View File

@ -529,7 +529,6 @@ static struct ao2_container *queues;
static void update_realtime_members(struct call_queue *q);
static int set_member_paused(const char *queuename, const char *interface, const char *reason, int paused);
static void queue_transfer_fixup(void *data, struct ast_channel *old_chan, struct ast_channel *new_chan);
/*! \brief sets the QUEUESTATUS channel variable */
static void set_queue_result(struct ast_channel *chan, enum queue_result res)
{
@ -3043,82 +3042,6 @@ static void send_agent_complete(const struct queue_ent *qe, const char *queuenam
qe->parent->eventwhencalled == QUEUE_EVENT_VARIABLES ? vars2manager(qe->chan, vars, vars_len) : "");
}
struct queue_transfer_ds {
struct queue_ent *qe;
struct member *member;
int starttime;
};
/*! \brief a datastore used to help correctly log attended transfers of queue callers
*/
static const struct ast_datastore_info queue_transfer_info = {
.type = "queue_transfer",
.chan_fixup = queue_transfer_fixup,
};
/*! \brief Log an attended transfer when a queue caller channel is masqueraded
*
* When a caller is masqueraded, we want to log a transfer. Fixup time is the closest we can come to when
* the actual transfer occurs. This happens during the masquerade after datastores are moved from old_chan
* to new_chan. This is why new_chan is referenced for exten, context, and datastore information.
*
* At the end of this, we want to remove the datastore so that this fixup function is not called on any
* future masquerades of the caller during the current call.
*/
static void queue_transfer_fixup(void *data, struct ast_channel *old_chan, struct ast_channel *new_chan)
{
struct queue_transfer_ds *qtds = data;
struct queue_ent *qe = qtds->qe;
struct member *member = qtds->member;
int callstart = qtds->starttime;
struct ast_datastore *datastore;
ast_queue_log(qe->parent->name, qe->chan->uniqueid, member->membername, "TRANSFER", "%s|%s|%ld|%ld",
new_chan->exten, new_chan->context, (long) (callstart - qe->start),
(long) (time(NULL) - callstart));
if (!(datastore = ast_channel_datastore_find(new_chan, &queue_transfer_info, NULL))) {
ast_log(LOG_WARNING, "Can't find the queue_transfer datastore.\n");
return;
}
ast_channel_datastore_remove(new_chan, datastore);
}
/*! \brief mechanism to tell if a queue caller was atxferred by a queue member.
*
* When a caller is atxferred, then the queue_transfer_info datastore
* is removed from the channel. If it's still there after the bridge is
* broken, then the caller was not atxferred.
*/
static int attended_transfer_occurred(struct ast_channel *chan)
{
return ast_channel_datastore_find(chan, &queue_transfer_info, NULL) ? 0 : 1;
}
/*! \brief create a datastore for storing relevant info to log attended transfers in the queue_log
*/
static void setup_transfer_datastore(struct queue_ent *qe, struct member *member, int starttime)
{
struct ast_datastore *ds;
struct queue_transfer_ds qtds;
ast_channel_lock(qe->chan);
if (!(ds = ast_channel_datastore_alloc(&queue_transfer_info, NULL))) {
ast_channel_unlock(qe->chan);
ast_log(LOG_WARNING, "Unable to create transfer datastore. queue_log will not show attended transfer\n");
return;
}
qtds.qe = qe;
/* This member is refcounted in try_calling, so no need to add it here, too */
qtds.member = member;
qtds.starttime = starttime;
ds->data = &qtds;
ast_channel_datastore_add(qe->chan, ds);
ast_channel_unlock(qe->chan);
}
/*! \brief A large function which calls members, updates statistics, and bridges the caller and a member
*
* Here is the process of this function
@ -3396,9 +3319,9 @@ static int try_calling(struct queue_ent *qe, const char *options, char *announce
/* Ah ha! Someone answered within the desired timeframe. Of course after this
we will always return with -1 so that it is hung up properly after the
conversation. */
if (!strcmp(qe->chan->tech->type, "Zap"))
if (!strcmp(qe->chan->tech->type, "DAHDI"))
ast_channel_setoption(qe->chan, AST_OPTION_TONE_VERIFY, &nondataquality, sizeof(nondataquality), 0);
if (!strcmp(peer->tech->type, "Zap"))
if (!strcmp(peer->tech->type, "DAHDI"))
ast_channel_setoption(peer, AST_OPTION_TONE_VERIFY, &nondataquality, sizeof(nondataquality), 0);
/* Update parameters for the queue */
time(&now);
@ -3758,27 +3681,22 @@ static int try_calling(struct queue_ent *qe, const char *options, char *announce
ast_copy_string(oldcontext, qe->chan->context, sizeof(oldcontext));
ast_copy_string(oldexten, qe->chan->exten, sizeof(oldexten));
time(&callstart);
setup_transfer_datastore(qe, member, callstart);
bridge = ast_bridge_call(qe->chan,peer, &bridge_config);
/* If the queue member did an attended transfer, then the TRANSFER already was logged in the queue_log
* when the masquerade occurred. These other "ending" queue_log messages are unnecessary
*/
if (!attended_transfer_occurred(qe->chan)) {
if (strcasecmp(oldcontext, qe->chan->context) || strcasecmp(oldexten, qe->chan->exten)) {
ast_queue_log(queuename, qe->chan->uniqueid, member->membername, "TRANSFER", "%s|%s|%ld|%ld",
qe->chan->exten, qe->chan->context, (long) (callstart - qe->start),
(long) (time(NULL) - callstart));
send_agent_complete(qe, queuename, peer, member, callstart, vars, sizeof(vars), TRANSFER);
} else if (ast_check_hangup(qe->chan)) {
ast_queue_log(queuename, qe->chan->uniqueid, member->membername, "COMPLETECALLER", "%ld|%ld|%d",
(long) (callstart - qe->start), (long) (time(NULL) - callstart), qe->opos);
send_agent_complete(qe, queuename, peer, member, callstart, vars, sizeof(vars), CALLER);
} else {
ast_queue_log(queuename, qe->chan->uniqueid, member->membername, "COMPLETEAGENT", "%ld|%ld|%d",
(long) (callstart - qe->start), (long) (time(NULL) - callstart), qe->opos);
send_agent_complete(qe, queuename, peer, member, callstart, vars, sizeof(vars), AGENT);
}
if (strcasecmp(oldcontext, qe->chan->context) || strcasecmp(oldexten, qe->chan->exten)) {
ast_queue_log(queuename, qe->chan->uniqueid, member->membername, "TRANSFER", "%s|%s|%ld|%ld",
qe->chan->exten, qe->chan->context, (long) (callstart - qe->start),
(long) (time(NULL) - callstart));
send_agent_complete(qe, queuename, peer, member, callstart, vars, sizeof(vars), TRANSFER);
} else if (ast_check_hangup(qe->chan)) {
ast_queue_log(queuename, qe->chan->uniqueid, member->membername, "COMPLETECALLER", "%ld|%ld|%d",
(long) (callstart - qe->start), (long) (time(NULL) - callstart), qe->opos);
send_agent_complete(qe, queuename, peer, member, callstart, vars, sizeof(vars), CALLER);
} else {
ast_queue_log(queuename, qe->chan->uniqueid, member->membername, "COMPLETEAGENT", "%ld|%ld|%d",
(long) (callstart - qe->start), (long) (time(NULL) - callstart), qe->opos);
send_agent_complete(qe, queuename, peer, member, callstart, vars, sizeof(vars), AGENT);
}
if (bridge != AST_PBX_NO_HANGUP_PEER)

View File

@ -152,7 +152,7 @@
*/
/*** MODULEINFO
<depend>zaptel</depend>
<depend>dahdi</depend>
<depend>tonezone</depend>
<defaultenabled>no</defaultenabled>
***/
@ -763,7 +763,7 @@ static struct rpt
int parrottimer;
unsigned int parrotcnt;
struct ast_channel *rxchannel,*txchannel, *monchannel, *parrotchannel;
struct ast_channel *pchannel,*txpchannel, *zaprxchannel, *zaptxchannel;
struct ast_channel *pchannel,*txpchannel, *dahdirxchannel, *dahditxchannel;
struct ast_channel *voxchannel;
struct ast_frame *lastf1,*lastf2;
struct rpt_tele tele;
@ -3601,13 +3601,13 @@ static struct morse_bits mbits[] = {
ast_stopstream(chan);
/*
* Wait for the zaptel driver to physically write the tone blocks to the hardware
* Wait for the DAHDI driver to physically write the tone blocks to the hardware
*/
for(i = 0; i < 20 ; i++){
flags = ZT_IOMUX_WRITEEMPTY | ZT_IOMUX_NOWAIT;
res = ioctl(chan->fds[0], ZT_IOMUX, &flags);
if(flags & ZT_IOMUX_WRITEEMPTY)
flags = DAHDI_IOMUX_WRITEEMPTY | DAHDI_IOMUX_NOWAIT;
res = ioctl(chan->fds[0], DAHDI_IOMUX, &flags);
if(flags & DAHDI_IOMUX_WRITEEMPTY)
break;
if( ast_safe_sleep(chan, 50)){
res = -1;
@ -3658,13 +3658,13 @@ static int send_tone_telemetry(struct ast_channel *chan, char *tonestring)
ast_stopstream(chan);
/*
* Wait for the zaptel driver to physically write the tone blocks to the hardware
* Wait for the DAHDI driver to physically write the tone blocks to the hardware
*/
for(i = 0; i < 20 ; i++){
flags = ZT_IOMUX_WRITEEMPTY | ZT_IOMUX_NOWAIT;
res = ioctl(chan->fds[0], ZT_IOMUX, &flags);
if(flags & ZT_IOMUX_WRITEEMPTY)
flags = DAHDI_IOMUX_WRITEEMPTY | DAHDI_IOMUX_NOWAIT;
res = ioctl(chan->fds[0], DAHDI_IOMUX, &flags);
if(flags & DAHDI_IOMUX_WRITEEMPTY)
break;
if( ast_safe_sleep(chan, 50)){
res = -1;
@ -3934,7 +3934,7 @@ static int split_freq(char *mhz, char *decimals, char *freq);
static void *rpt_tele_thread(void *this)
{
ZT_CONFINFO ci; /* conference info */
DAHDI_CONFINFO ci; /* conference info */
int res = 0,haslink,hastx,hasremote,imdone = 0, unkeys_queued, x;
struct rpt_tele *mytele = (struct rpt_tele *)this;
struct rpt_tele *tlist;
@ -3954,7 +3954,7 @@ int i,ns,rbimode;
char mhz[MAXREMSTR];
char decimals[MAXREMSTR];
char mystr[200];
struct zt_params par;
struct dahdi_params par;
/* get a pointer to myrpt */
@ -4002,7 +4002,7 @@ struct zt_params par;
/* allocate a pseudo-channel thru asterisk */
mychannel = ast_request("zap",AST_FORMAT_SLINEAR,"pseudo",NULL);
mychannel = ast_request("DAHDI",AST_FORMAT_SLINEAR,"pseudo",NULL);
if (!mychannel)
{
fprintf(stderr,"rpt:Sorry unable to obtain pseudo channel\n");
@ -4047,9 +4047,9 @@ struct zt_params par;
(mytele->mode == TAILMSG) || (mytele->mode == LINKUNKEY) || (mytele->mode == TIMEOUT) ||
(mytele->mode == PARROT) || (mytele->mode == STATS_TIME_LOCAL)) ?
myrpt->txconf : myrpt->conf);
ci.confmode = ZT_CONF_CONFANN;
ci.confmode = DAHDI_CONF_CONFANN;
/* first put the channel on the conference in announce mode */
if (ioctl(mychannel->fds[0],ZT_SETCONF,&ci) == -1)
if (ioctl(mychannel->fds[0],DAHDI_SETCONF,&ci) == -1)
{
ast_log(LOG_WARNING, "Unable to set conference mode to Announce\n");
rpt_mutex_lock(&myrpt->lock);
@ -4242,9 +4242,9 @@ struct zt_params par;
/* set for all to hear */
ci.chan = 0;
ci.confno = myrpt->conf;
ci.confmode = ZT_CONF_CONFANN;
ci.confmode = DAHDI_CONF_CONFANN;
/* first put the channel on the conference in announce mode */
if (ioctl(mychannel->fds[0],ZT_SETCONF,&ci) == -1)
if (ioctl(mychannel->fds[0],DAHDI_SETCONF,&ci) == -1)
{
ast_log(LOG_WARNING, "Unable to set conference mode to Announce\n");
rpt_mutex_lock(&myrpt->lock);
@ -4283,9 +4283,9 @@ struct zt_params par;
/* set for all to hear */
ci.chan = 0;
ci.confno = myrpt->txconf;
ci.confmode = ZT_CONF_CONFANN;
ci.confmode = DAHDI_CONF_CONFANN;
/* first put the channel on the conference in announce mode */
if (ioctl(mychannel->fds[0],ZT_SETCONF,&ci) == -1)
if (ioctl(mychannel->fds[0],DAHDI_SETCONF,&ci) == -1)
{
ast_log(LOG_WARNING, "Unable to set conference mode to Announce\n");
rpt_mutex_lock(&myrpt->lock);
@ -4512,15 +4512,15 @@ struct zt_params par;
}
if (myrpt->iofd < 0)
{
i = ZT_FLUSH_EVENT;
if (ioctl(myrpt->zaptxchannel->fds[0],ZT_FLUSH,&i) == -1)
i = DAHDI_FLUSH_EVENT;
if (ioctl(myrpt->dahditxchannel->fds[0],DAHDI_FLUSH,&i) == -1)
{
ast_mutex_unlock(&myrpt->remlock);
ast_log(LOG_ERROR,"Cant flush events");
res = -1;
break;
}
if (ioctl(myrpt->zaprxchannel->fds[0],ZT_GET_PARAMS,&par) == -1)
if (ioctl(myrpt->dahdirxchannel->fds[0],DAHDI_GET_PARAMS,&par) == -1)
{
ast_mutex_unlock(&myrpt->remlock);
ast_log(LOG_ERROR,"Cant get params");
@ -5285,7 +5285,7 @@ char *v1, *v2;
static void *rpt_call(void *this)
{
ZT_CONFINFO ci; /* conference info */
DAHDI_CONFINFO ci; /* conference info */
struct rpt *myrpt = (struct rpt *)this;
int res;
int stopped,congstarted,dialtimer,lastcidx,aborted;
@ -5293,7 +5293,7 @@ struct ast_channel *mychannel,*genchannel;
myrpt->mydtmf = 0;
/* allocate a pseudo-channel thru asterisk */
mychannel = ast_request("zap",AST_FORMAT_SLINEAR,"pseudo",NULL);
mychannel = ast_request("DAHDI",AST_FORMAT_SLINEAR,"pseudo",NULL);
if (!mychannel)
{
fprintf(stderr,"rpt:Sorry unable to obtain pseudo channel\n");
@ -5306,12 +5306,12 @@ struct ast_channel *mychannel,*genchannel;
ci.chan = 0;
ci.confno = myrpt->conf; /* use the pseudo conference */
#if 0
ci.confmode = ZT_CONF_REALANDPSEUDO | ZT_CONF_TALKER | ZT_CONF_LISTENER
| ZT_CONF_PSEUDO_TALKER | ZT_CONF_PSEUDO_LISTENER;
ci.confmode = DAHDI_CONF_REALANDPSEUDO | DAHDI_CONF_TALKER | DAHDI_CONF_LISTENER
| DAHDI_CONF_PSEUDO_TALKER | DAHDI_CONF_PSEUDO_LISTENER;
#endif
ci.confmode = ZT_CONF_CONF | ZT_CONF_TALKER | ZT_CONF_LISTENER;
ci.confmode = DAHDI_CONF_CONF | DAHDI_CONF_TALKER | DAHDI_CONF_LISTENER;
/* first put the channel on the conference */
if (ioctl(mychannel->fds[0],ZT_SETCONF,&ci) == -1)
if (ioctl(mychannel->fds[0],DAHDI_SETCONF,&ci) == -1)
{
ast_log(LOG_WARNING, "Unable to set conference mode to Announce\n");
ast_hangup(mychannel);
@ -5319,7 +5319,7 @@ struct ast_channel *mychannel,*genchannel;
pthread_exit(NULL);
}
/* allocate a pseudo-channel thru asterisk */
genchannel = ast_request("zap",AST_FORMAT_SLINEAR,"pseudo",NULL);
genchannel = ast_request("DAHDI",AST_FORMAT_SLINEAR,"pseudo",NULL);
if (!genchannel)
{
fprintf(stderr,"rpt:Sorry unable to obtain pseudo channel\n");
@ -5332,10 +5332,10 @@ struct ast_channel *mychannel,*genchannel;
#endif
ci.chan = 0;
ci.confno = myrpt->conf;
ci.confmode = ZT_CONF_REALANDPSEUDO | ZT_CONF_TALKER | ZT_CONF_LISTENER
| ZT_CONF_PSEUDO_TALKER | ZT_CONF_PSEUDO_LISTENER;
ci.confmode = DAHDI_CONF_REALANDPSEUDO | DAHDI_CONF_TALKER | DAHDI_CONF_LISTENER
| DAHDI_CONF_PSEUDO_TALKER | DAHDI_CONF_PSEUDO_LISTENER;
/* first put the channel on the conference */
if (ioctl(genchannel->fds[0],ZT_SETCONF,&ci) == -1)
if (ioctl(genchannel->fds[0],DAHDI_SETCONF,&ci) == -1)
{
ast_log(LOG_WARNING, "Unable to set conference mode to Announce\n");
ast_hangup(mychannel);
@ -5360,7 +5360,7 @@ struct ast_channel *mychannel,*genchannel;
pthread_exit(NULL);
}
/* start dialtone if patchquiet is 0. Special patch modes don't send dial tone */
if ((!myrpt->patchquiet) && (tone_zone_play_tone(genchannel->fds[0],ZT_TONE_DIALTONE) < 0))
if ((!myrpt->patchquiet) && (tone_zone_play_tone(genchannel->fds[0],DAHDI_TONE_DIALTONE) < 0))
{
ast_log(LOG_WARNING, "Cannot start dialtone\n");
ast_hangup(mychannel);
@ -5414,7 +5414,7 @@ struct ast_channel *mychannel,*genchannel;
if(!congstarted){
congstarted = 1;
/* start congestion tone */
tone_zone_play_tone(genchannel->fds[0],ZT_TONE_CONGESTION);
tone_zone_play_tone(genchannel->fds[0],DAHDI_TONE_CONGESTION);
}
}
res = ast_safe_sleep(mychannel, MSWAIT);
@ -5492,10 +5492,10 @@ struct ast_channel *mychannel,*genchannel;
/* set appropriate conference for the pseudo */
ci.chan = 0;
ci.confno = myrpt->conf;
ci.confmode = (myrpt->p.duplex == 2) ? ZT_CONF_CONFANNMON :
(ZT_CONF_CONF | ZT_CONF_LISTENER | ZT_CONF_TALKER);
ci.confmode = (myrpt->p.duplex == 2) ? DAHDI_CONF_CONFANNMON :
(DAHDI_CONF_CONF | DAHDI_CONF_LISTENER | DAHDI_CONF_TALKER);
/* first put the channel on the conference in announce mode */
if (ioctl(myrpt->pchannel->fds[0],ZT_SETCONF,&ci) == -1)
if (ioctl(myrpt->pchannel->fds[0],DAHDI_SETCONF,&ci) == -1)
{
ast_log(LOG_WARNING, "Unable to set conference mode to Announce\n");
ast_hangup(mychannel);
@ -5504,7 +5504,7 @@ struct ast_channel *mychannel,*genchannel;
pthread_exit(NULL);
}
/* get its channel number */
if (ioctl(mychannel->fds[0],ZT_CHANNO,&res) == -1)
if (ioctl(mychannel->fds[0],DAHDI_CHANNO,&res) == -1)
{
ast_log(LOG_WARNING, "Unable to get autopatch channel number\n");
ast_hangup(mychannel);
@ -5513,9 +5513,9 @@ struct ast_channel *mychannel,*genchannel;
}
ci.chan = 0;
ci.confno = res;
ci.confmode = ZT_CONF_MONITOR;
ci.confmode = DAHDI_CONF_MONITOR;
/* put vox channel monitoring on the channel */
if (ioctl(myrpt->voxchannel->fds[0],ZT_SETCONF,&ci) == -1)
if (ioctl(myrpt->voxchannel->fds[0],DAHDI_SETCONF,&ci) == -1)
{
ast_log(LOG_WARNING, "Unable to set conference mode to Announce\n");
ast_hangup(mychannel);
@ -5542,7 +5542,7 @@ struct ast_channel *mychannel,*genchannel;
myrpt->callmode = 4;
rpt_mutex_unlock(&myrpt->lock);
/* start congestion tone */
tone_zone_play_tone(genchannel->fds[0],ZT_TONE_CONGESTION);
tone_zone_play_tone(genchannel->fds[0],DAHDI_TONE_CONGESTION);
rpt_mutex_lock(&myrpt->lock);
}
}
@ -5578,10 +5578,10 @@ struct ast_channel *mychannel,*genchannel;
/* set appropriate conference for the pseudo */
ci.chan = 0;
ci.confno = myrpt->conf;
ci.confmode = ((myrpt->p.duplex == 2) || (myrpt->p.duplex == 4)) ? ZT_CONF_CONFANNMON :
(ZT_CONF_CONF | ZT_CONF_LISTENER | ZT_CONF_TALKER);
ci.confmode = ((myrpt->p.duplex == 2) || (myrpt->p.duplex == 4)) ? DAHDI_CONF_CONFANNMON :
(DAHDI_CONF_CONF | DAHDI_CONF_LISTENER | DAHDI_CONF_TALKER);
/* first put the channel on the conference in announce mode */
if (ioctl(myrpt->pchannel->fds[0],ZT_SETCONF,&ci) == -1)
if (ioctl(myrpt->pchannel->fds[0],DAHDI_SETCONF,&ci) == -1)
{
ast_log(LOG_WARNING, "Unable to set conference mode to Announce\n");
}
@ -5690,7 +5690,7 @@ static int connect_link(struct rpt *myrpt, char* node, int mode, int perma)
struct rpt_link *l;
int reconnects = 0;
int i,n;
ZT_CONFINFO ci; /* conference info */
DAHDI_CONFINFO ci; /* conference info */
val = node_lookup(myrpt,node);
if (!val){
@ -5829,7 +5829,7 @@ static int connect_link(struct rpt *myrpt, char* node, int mode, int perma)
return -1;
}
/* allocate a pseudo-channel thru asterisk */
l->pchan = ast_request("zap",AST_FORMAT_SLINEAR,"pseudo",NULL);
l->pchan = ast_request("DAHDI",AST_FORMAT_SLINEAR,"pseudo",NULL);
if (!l->pchan){
ast_log(LOG_WARNING,"rpt connect: Sorry unable to obtain pseudo channel\n");
ast_hangup(l->chan);
@ -5845,9 +5845,9 @@ static int connect_link(struct rpt *myrpt, char* node, int mode, int perma)
/* make a conference for the tx */
ci.chan = 0;
ci.confno = myrpt->conf;
ci.confmode = ZT_CONF_CONF | ZT_CONF_LISTENER | ZT_CONF_TALKER;
ci.confmode = DAHDI_CONF_CONF | DAHDI_CONF_LISTENER | DAHDI_CONF_TALKER;
/* first put the channel on the conference in proper mode */
if (ioctl(l->pchan->fds[0], ZT_SETCONF, &ci) == -1)
if (ioctl(l->pchan->fds[0], DAHDI_SETCONF, &ci) == -1)
{
ast_log(LOG_WARNING, "Unable to set conference mode to Announce\n");
ast_hangup(l->chan);
@ -7384,22 +7384,22 @@ static void rbi_out_parallel(struct rpt *myrpt,unsigned char *data)
static void rbi_out(struct rpt *myrpt,unsigned char *data)
{
struct zt_radio_param r;
struct dahdi_radio_param r;
memset(&r,0,sizeof(struct zt_radio_param));
r.radpar = ZT_RADPAR_REMMODE;
r.data = ZT_RADPAR_REM_RBI1;
memset(&r,0,sizeof(struct dahdi_radio_param));
r.radpar = DAHDI_RADPAR_REMMODE;
r.data = DAHDI_RADPAR_REM_RBI1;
/* if setparam ioctl fails, its probably not a pciradio card */
if (ioctl(myrpt->zaprxchannel->fds[0],ZT_RADIO_SETPARAM,&r) == -1)
if (ioctl(myrpt->dahdirxchannel->fds[0],DAHDI_RADIO_SETPARAM,&r) == -1)
{
rbi_out_parallel(myrpt,data);
return;
}
r.radpar = ZT_RADPAR_REMCOMMAND;
r.radpar = DAHDI_RADPAR_REMCOMMAND;
memcpy(&r.data,data,5);
if (ioctl(myrpt->zaprxchannel->fds[0],ZT_RADIO_SETPARAM,&r) == -1)
if (ioctl(myrpt->dahdirxchannel->fds[0],DAHDI_RADIO_SETPARAM,&r) == -1)
{
ast_log(LOG_WARNING,"Cannot send RBI command for channel %s\n",myrpt->zaprxchannel->name);
ast_log(LOG_WARNING,"Cannot send RBI command for channel %s\n",myrpt->dahdirxchannel->name);
return;
}
}
@ -7408,7 +7408,7 @@ static int serial_remote_io(struct rpt *myrpt, unsigned char *txbuf, int txbytes
unsigned char *rxbuf, int rxmaxbytes, int asciiflag)
{
int i,j,index,oldmode,olddata;
struct zt_radio_param prm;
struct dahdi_radio_param prm;
char c;
if(debug) {
@ -7453,50 +7453,50 @@ static int serial_remote_io(struct rpt *myrpt, unsigned char *txbuf, int txbytes
return(i);
}
/* if not a zap channel, cant use pciradio stuff */
if (myrpt->rxchannel != myrpt->zaprxchannel) return -1;
/* if not a DAHDI channel, cant use pciradio stuff */
if (myrpt->rxchannel != myrpt->dahdirxchannel) return -1;
prm.radpar = ZT_RADPAR_UIOMODE;
if (ioctl(myrpt->zaprxchannel->fds[0],ZT_RADIO_GETPARAM,&prm) == -1) return -1;
prm.radpar = DAHDI_RADPAR_UIOMODE;
if (ioctl(myrpt->dahdirxchannel->fds[0],DAHDI_RADIO_GETPARAM,&prm) == -1) return -1;
oldmode = prm.data;
prm.radpar = ZT_RADPAR_UIODATA;
if (ioctl(myrpt->zaprxchannel->fds[0],ZT_RADIO_GETPARAM,&prm) == -1) return -1;
prm.radpar = DAHDI_RADPAR_UIODATA;
if (ioctl(myrpt->dahdirxchannel->fds[0],DAHDI_RADIO_GETPARAM,&prm) == -1) return -1;
olddata = prm.data;
prm.radpar = ZT_RADPAR_REMMODE;
if (asciiflag & 1) prm.data = ZT_RADPAR_REM_SERIAL_ASCII;
else prm.data = ZT_RADPAR_REM_SERIAL;
if (ioctl(myrpt->zaprxchannel->fds[0],ZT_RADIO_SETPARAM,&prm) == -1) return -1;
prm.radpar = DAHDI_RADPAR_REMMODE;
if (asciiflag & 1) prm.data = DAHDI_RADPAR_REM_SERIAL_ASCII;
else prm.data = DAHDI_RADPAR_REM_SERIAL;
if (ioctl(myrpt->dahdirxchannel->fds[0],DAHDI_RADIO_SETPARAM,&prm) == -1) return -1;
if (asciiflag & 2)
{
i = ZT_ONHOOK;
if (ioctl(myrpt->zaprxchannel->fds[0],ZT_HOOK,&i) == -1) return -1;
i = DAHDI_ONHOOK;
if (ioctl(myrpt->dahdirxchannel->fds[0],DAHDI_HOOK,&i) == -1) return -1;
usleep(100000);
}
prm.radpar = ZT_RADPAR_REMCOMMAND;
prm.radpar = DAHDI_RADPAR_REMCOMMAND;
prm.data = rxmaxbytes;
memcpy(prm.buf,txbuf,txbytes);
prm.index = txbytes;
if (ioctl(myrpt->zaprxchannel->fds[0],ZT_RADIO_SETPARAM,&prm) == -1) return -1;
if (ioctl(myrpt->dahdirxchannel->fds[0],DAHDI_RADIO_SETPARAM,&prm) == -1) return -1;
if (rxbuf)
{
*rxbuf = 0;
memcpy(rxbuf,prm.buf,prm.index);
}
index = prm.index;
prm.radpar = ZT_RADPAR_REMMODE;
prm.data = ZT_RADPAR_REM_NONE;
if (ioctl(myrpt->zaprxchannel->fds[0],ZT_RADIO_SETPARAM,&prm) == -1) return -1;
prm.radpar = DAHDI_RADPAR_REMMODE;
prm.data = DAHDI_RADPAR_REM_NONE;
if (ioctl(myrpt->dahdirxchannel->fds[0],DAHDI_RADIO_SETPARAM,&prm) == -1) return -1;
if (asciiflag & 2)
{
i = ZT_OFFHOOK;
if (ioctl(myrpt->zaprxchannel->fds[0],ZT_HOOK,&i) == -1) return -1;
i = DAHDI_OFFHOOK;
if (ioctl(myrpt->dahdirxchannel->fds[0],DAHDI_HOOK,&i) == -1) return -1;
}
prm.radpar = ZT_RADPAR_UIOMODE;
prm.radpar = DAHDI_RADPAR_UIOMODE;
prm.data = oldmode;
if (ioctl(myrpt->zaprxchannel->fds[0],ZT_RADIO_SETPARAM,&prm) == -1) return -1;
prm.radpar = ZT_RADPAR_UIODATA;
if (ioctl(myrpt->dahdirxchannel->fds[0],DAHDI_RADIO_SETPARAM,&prm) == -1) return -1;
prm.radpar = DAHDI_RADPAR_UIODATA;
prm.data = olddata;
if (ioctl(myrpt->zaprxchannel->fds[0],ZT_RADIO_SETPARAM,&prm) == -1) return -1;
if (ioctl(myrpt->dahdirxchannel->fds[0],DAHDI_RADIO_SETPARAM,&prm) == -1) return -1;
return(index);
}
@ -10726,7 +10726,7 @@ char *tele,*idtalkover,c,myfirst,*p;
int ms = MSWAIT,i,lasttx=0,val,remrx=0,identqueued,othertelemqueued;
int tailmessagequeued,ctqueued,dtmfed,lastmyrx,localmsgqueued;
struct ast_channel *who;
ZT_CONFINFO ci; /* conference info */
DAHDI_CONFINFO ci; /* conference info */
time_t t;
struct rpt_link *l,*m;
struct rpt_tele *telem;
@ -10782,9 +10782,9 @@ char tmpstr[300],lstr[MAXLINKLIST];
}
*tele++ = 0;
myrpt->rxchannel = ast_request(tmpstr,AST_FORMAT_SLINEAR,tele,NULL);
myrpt->zaprxchannel = NULL;
if (!strcasecmp(tmpstr,"Zap"))
myrpt->zaprxchannel = myrpt->rxchannel;
myrpt->dahdirxchannel = NULL;
if (!strcasecmp(tmpstr,"DAHDI"))
myrpt->dahdirxchannel = myrpt->rxchannel;
if (myrpt->rxchannel)
{
if (myrpt->rxchannel->_state == AST_STATE_BUSY)
@ -10825,7 +10825,7 @@ char tmpstr[300],lstr[MAXLINKLIST];
myrpt->rpt_thread = AST_PTHREADT_STOP;
pthread_exit(NULL);
}
myrpt->zaptxchannel = NULL;
myrpt->dahditxchannel = NULL;
if (myrpt->txchanname)
{
strncpy(tmpstr,myrpt->txchanname,sizeof(tmpstr) - 1);
@ -10840,8 +10840,8 @@ char tmpstr[300],lstr[MAXLINKLIST];
}
*tele++ = 0;
myrpt->txchannel = ast_request(tmpstr,AST_FORMAT_SLINEAR,tele,NULL);
if (!strcasecmp(tmpstr,"Zap"))
myrpt->zaptxchannel = myrpt->txchannel;
if (!strcasecmp(tmpstr,"DAHDI"))
myrpt->dahditxchannel = myrpt->txchannel;
if (myrpt->txchannel)
{
if (myrpt->txchannel->_state == AST_STATE_BUSY)
@ -10889,13 +10889,13 @@ char tmpstr[300],lstr[MAXLINKLIST];
else
{
myrpt->txchannel = myrpt->rxchannel;
if (!strncasecmp(myrpt->rxchanname,"Zap",3))
myrpt->zaptxchannel = myrpt->txchannel;
if (!strncasecmp(myrpt->rxchanname,"DAHDI",3))
myrpt->dahditxchannel = myrpt->txchannel;
}
ast_indicate(myrpt->txchannel,AST_CONTROL_RADIO_KEY);
ast_indicate(myrpt->txchannel,AST_CONTROL_RADIO_UNKEY);
/* allocate a pseudo-channel thru asterisk */
myrpt->pchannel = ast_request("zap",AST_FORMAT_SLINEAR,"pseudo",NULL);
myrpt->pchannel = ast_request("DAHDI",AST_FORMAT_SLINEAR,"pseudo",NULL);
if (!myrpt->pchannel)
{
fprintf(stderr,"rpt:Sorry unable to obtain pseudo channel\n");
@ -10910,12 +10910,12 @@ char tmpstr[300],lstr[MAXLINKLIST];
if (myrpt->pchannel->cdr)
ast_set_flag(myrpt->pchannel->cdr,AST_CDR_FLAG_POST_DISABLED);
#endif
if (!myrpt->zaprxchannel) myrpt->zaprxchannel = myrpt->pchannel;
if (!myrpt->zaptxchannel)
if (!myrpt->dahdirxchannel) myrpt->dahdirxchannel = myrpt->pchannel;
if (!myrpt->dahditxchannel)
{
/* allocate a pseudo-channel thru asterisk */
myrpt->zaptxchannel = ast_request("zap",AST_FORMAT_SLINEAR,"pseudo",NULL);
if (!myrpt->zaptxchannel)
myrpt->dahditxchannel = ast_request("DAHDI",AST_FORMAT_SLINEAR,"pseudo",NULL);
if (!myrpt->dahditxchannel)
{
fprintf(stderr,"rpt:Sorry unable to obtain pseudo channel\n");
rpt_mutex_unlock(&myrpt->lock);
@ -10925,15 +10925,15 @@ char tmpstr[300],lstr[MAXLINKLIST];
myrpt->rpt_thread = AST_PTHREADT_STOP;
pthread_exit(NULL);
}
ast_set_read_format(myrpt->zaptxchannel,AST_FORMAT_SLINEAR);
ast_set_write_format(myrpt->zaptxchannel,AST_FORMAT_SLINEAR);
ast_set_read_format(myrpt->dahditxchannel,AST_FORMAT_SLINEAR);
ast_set_write_format(myrpt->dahditxchannel,AST_FORMAT_SLINEAR);
#ifdef AST_CDR_FLAG_POST_DISABLED
if (myrpt->zaptxchannel->cdr)
ast_set_flag(myrpt->zaptxchannel->cdr,AST_CDR_FLAG_POST_DISABLED);
if (myrpt->dahditxchannel->cdr)
ast_set_flag(myrpt->dahditxchannel->cdr,AST_CDR_FLAG_POST_DISABLED);
#endif
}
/* allocate a pseudo-channel thru asterisk */
myrpt->monchannel = ast_request("zap",AST_FORMAT_SLINEAR,"pseudo",NULL);
myrpt->monchannel = ast_request("DAHDI",AST_FORMAT_SLINEAR,"pseudo",NULL);
if (!myrpt->monchannel)
{
fprintf(stderr,"rpt:Sorry unable to obtain pseudo channel\n");
@ -10953,9 +10953,9 @@ char tmpstr[300],lstr[MAXLINKLIST];
/* make a conference for the tx */
ci.chan = 0;
ci.confno = -1; /* make a new conf */
ci.confmode = ZT_CONF_CONF | ZT_CONF_LISTENER;
ci.confmode = DAHDI_CONF_CONF | DAHDI_CONF_LISTENER;
/* first put the channel on the conference in proper mode */
if (ioctl(myrpt->zaptxchannel->fds[0],ZT_SETCONF,&ci) == -1)
if (ioctl(myrpt->dahditxchannel->fds[0],DAHDI_SETCONF,&ci) == -1)
{
ast_log(LOG_WARNING, "Unable to set conference mode to Announce\n");
rpt_mutex_unlock(&myrpt->lock);
@ -10972,10 +10972,10 @@ char tmpstr[300],lstr[MAXLINKLIST];
/* make a conference for the pseudo */
ci.chan = 0;
ci.confno = -1; /* make a new conf */
ci.confmode = ((myrpt->p.duplex == 2) || (myrpt->p.duplex == 4)) ? ZT_CONF_CONFANNMON :
(ZT_CONF_CONF | ZT_CONF_LISTENER | ZT_CONF_TALKER);
ci.confmode = ((myrpt->p.duplex == 2) || (myrpt->p.duplex == 4)) ? DAHDI_CONF_CONFANNMON :
(DAHDI_CONF_CONF | DAHDI_CONF_LISTENER | DAHDI_CONF_TALKER);
/* first put the channel on the conference in announce mode */
if (ioctl(myrpt->pchannel->fds[0],ZT_SETCONF,&ci) == -1)
if (ioctl(myrpt->pchannel->fds[0],DAHDI_SETCONF,&ci) == -1)
{
ast_log(LOG_WARNING, "Unable to set conference mode to Announce\n");
rpt_mutex_unlock(&myrpt->lock);
@ -10992,10 +10992,10 @@ char tmpstr[300],lstr[MAXLINKLIST];
/* make a conference for the pseudo */
ci.chan = 0;
if ((strstr(myrpt->txchannel->name,"pseudo") == NULL) &&
(myrpt->zaptxchannel == myrpt->txchannel))
(myrpt->dahditxchannel == myrpt->txchannel))
{
/* get tx channel's port number */
if (ioctl(myrpt->txchannel->fds[0],ZT_CHANNO,&ci.confno) == -1)
if (ioctl(myrpt->txchannel->fds[0],DAHDI_CHANNO,&ci.confno) == -1)
{
ast_log(LOG_WARNING, "Unable to set tx channel's chan number\n");
rpt_mutex_unlock(&myrpt->lock);
@ -11007,15 +11007,15 @@ char tmpstr[300],lstr[MAXLINKLIST];
myrpt->rpt_thread = AST_PTHREADT_STOP;
pthread_exit(NULL);
}
ci.confmode = ZT_CONF_MONITORTX;
ci.confmode = DAHDI_CONF_MONITORTX;
}
else
{
ci.confno = myrpt->txconf;
ci.confmode = ZT_CONF_CONFANNMON;
ci.confmode = DAHDI_CONF_CONFANNMON;
}
/* first put the channel on the conference in announce mode */
if (ioctl(myrpt->monchannel->fds[0],ZT_SETCONF,&ci) == -1)
if (ioctl(myrpt->monchannel->fds[0],DAHDI_SETCONF,&ci) == -1)
{
ast_log(LOG_WARNING, "Unable to set conference mode for monitor\n");
rpt_mutex_unlock(&myrpt->lock);
@ -11028,7 +11028,7 @@ char tmpstr[300],lstr[MAXLINKLIST];
pthread_exit(NULL);
}
/* allocate a pseudo-channel thru asterisk */
myrpt->parrotchannel = ast_request("zap",AST_FORMAT_SLINEAR,"pseudo",NULL);
myrpt->parrotchannel = ast_request("DAHDI",AST_FORMAT_SLINEAR,"pseudo",NULL);
if (!myrpt->parrotchannel)
{
fprintf(stderr,"rpt:Sorry unable to obtain pseudo channel\n");
@ -11046,7 +11046,7 @@ char tmpstr[300],lstr[MAXLINKLIST];
ast_set_flag(myrpt->parrotchannel->cdr,AST_CDR_FLAG_POST_DISABLED);
#endif
/* allocate a pseudo-channel thru asterisk */
myrpt->voxchannel = ast_request("zap",AST_FORMAT_SLINEAR,"pseudo",NULL);
myrpt->voxchannel = ast_request("DAHDI",AST_FORMAT_SLINEAR,"pseudo",NULL);
if (!myrpt->voxchannel)
{
fprintf(stderr,"rpt:Sorry unable to obtain pseudo channel\n");
@ -11064,7 +11064,7 @@ char tmpstr[300],lstr[MAXLINKLIST];
ast_set_flag(myrpt->voxchannel->cdr,AST_CDR_FLAG_POST_DISABLED);
#endif
/* allocate a pseudo-channel thru asterisk */
myrpt->txpchannel = ast_request("zap",AST_FORMAT_SLINEAR,"pseudo",NULL);
myrpt->txpchannel = ast_request("DAHDI",AST_FORMAT_SLINEAR,"pseudo",NULL);
if (!myrpt->txpchannel)
{
fprintf(stderr,"rpt:Sorry unable to obtain pseudo channel\n");
@ -11084,9 +11084,9 @@ char tmpstr[300],lstr[MAXLINKLIST];
/* make a conference for the tx */
ci.chan = 0;
ci.confno = myrpt->txconf;
ci.confmode = ZT_CONF_CONF | ZT_CONF_TALKER ;
ci.confmode = DAHDI_CONF_CONF | DAHDI_CONF_TALKER ;
/* first put the channel on the conference in proper mode */
if (ioctl(myrpt->txpchannel->fds[0],ZT_SETCONF,&ci) == -1)
if (ioctl(myrpt->txpchannel->fds[0],DAHDI_SETCONF,&ci) == -1)
{
ast_log(LOG_WARNING, "Unable to set conference mode to Announce\n");
rpt_mutex_unlock(&myrpt->lock);
@ -11179,8 +11179,8 @@ char tmpstr[300],lstr[MAXLINKLIST];
/* DEBUG Dump */
if((myrpt->disgorgetime) && (time(NULL) >= myrpt->disgorgetime)){
struct rpt_link *zl;
struct rpt_tele *zt;
struct rpt_link *dl;
struct rpt_tele *dt;
myrpt->disgorgetime = 0;
ast_log(LOG_NOTICE,"********** Variable Dump Start (app_rpt) **********\n");
@ -11201,30 +11201,30 @@ char tmpstr[300],lstr[MAXLINKLIST];
ast_log(LOG_NOTICE,"myrpt->tailtimer = %d\n",myrpt->tailtimer);
ast_log(LOG_NOTICE,"myrpt->tailevent = %d\n",myrpt->tailevent);
zl = myrpt->links.next;
while(zl != &myrpt->links){
ast_log(LOG_NOTICE,"*** Link Name: %s ***\n",zl->name);
ast_log(LOG_NOTICE," link->lasttx %d\n",zl->lasttx);
ast_log(LOG_NOTICE," link->lastrx %d\n",zl->lastrx);
ast_log(LOG_NOTICE," link->connected %d\n",zl->connected);
ast_log(LOG_NOTICE," link->hasconnected %d\n",zl->hasconnected);
ast_log(LOG_NOTICE," link->outbound %d\n",zl->outbound);
ast_log(LOG_NOTICE," link->disced %d\n",zl->disced);
ast_log(LOG_NOTICE," link->killme %d\n",zl->killme);
ast_log(LOG_NOTICE," link->disctime %ld\n",zl->disctime);
ast_log(LOG_NOTICE," link->retrytimer %ld\n",zl->retrytimer);
ast_log(LOG_NOTICE," link->retries = %d\n",zl->retries);
ast_log(LOG_NOTICE," link->reconnects = %d\n",zl->reconnects);
ast_log(LOG_NOTICE," link->newkey = %d\n",zl->newkey);
zl = zl->next;
dl = myrpt->links.next;
while(dl != &myrpt->links){
ast_log(LOG_NOTICE,"*** Link Name: %s ***\n",dl->name);
ast_log(LOG_NOTICE," link->lasttx %d\n",dl->lasttx);
ast_log(LOG_NOTICE," link->lastrx %d\n",dl->lastrx);
ast_log(LOG_NOTICE," link->connected %d\n",dl->connected);
ast_log(LOG_NOTICE," link->hasconnected %d\n",dl->hasconnected);
ast_log(LOG_NOTICE," link->outbound %d\n",dl->outbound);
ast_log(LOG_NOTICE," link->disced %d\n",dl->disced);
ast_log(LOG_NOTICE," link->killme %d\n",dl->killme);
ast_log(LOG_NOTICE," link->disctime %ld\n",dl->disctime);
ast_log(LOG_NOTICE," link->retrytimer %ld\n",dl->retrytimer);
ast_log(LOG_NOTICE," link->retries = %d\n",dl->retries);
ast_log(LOG_NOTICE," link->reconnects = %d\n",dl->reconnects);
ast_log(LOG_NOTICE," link->newkey = %d\n",dl->newkey);
dl = dl->next;
}
zt = myrpt->tele.next;
if(zt != &myrpt->tele)
dt = myrpt->tele.next;
if(dt != &myrpt->tele)
ast_log(LOG_NOTICE,"*** Telemetry Queue ***\n");
while(zt != &myrpt->tele){
ast_log(LOG_NOTICE," Telemetry mode: %d\n",zt->mode);
zt = zt->next;
while(dt != &myrpt->tele){
ast_log(LOG_NOTICE," Telemetry mode: %d\n",dt->mode);
dt = dt->next;
}
ast_log(LOG_NOTICE,"******* Variable Dump End (app_rpt) *******\n");
@ -11266,7 +11266,7 @@ char tmpstr[300],lstr[MAXLINKLIST];
if (myrpt->voxchannel &&
ast_check_hangup(myrpt->voxchannel)) break;
if (ast_check_hangup(myrpt->txpchannel)) break;
if (myrpt->zaptxchannel && ast_check_hangup(myrpt->zaptxchannel)) break;
if (myrpt->dahditxchannel && ast_check_hangup(myrpt->dahditxchannel)) break;
/* Set local tx with keyed */
myrpt->localtx = myrpt->keyed;
@ -11547,11 +11547,11 @@ char tmpstr[300],lstr[MAXLINKLIST];
char myfname[300];
ci.confno = myrpt->conf;
ci.confmode = ZT_CONF_CONFANNMON;
ci.confmode = DAHDI_CONF_CONFANNMON;
ci.chan = 0;
/* first put the channel on the conference in announce mode */
if (ioctl(myrpt->parrotchannel->fds[0],ZT_SETCONF,&ci) == -1)
if (ioctl(myrpt->parrotchannel->fds[0],DAHDI_SETCONF,&ci) == -1)
{
ast_log(LOG_WARNING, "Unable to set conference mode for parrot\n");
break;
@ -11601,8 +11601,8 @@ char tmpstr[300],lstr[MAXLINKLIST];
if (myrpt->voxchannel) cs[n++] = myrpt->voxchannel;
cs[n++] = myrpt->txpchannel;
if (myrpt->txchannel != myrpt->rxchannel) cs[n++] = myrpt->txchannel;
if (myrpt->zaptxchannel != myrpt->txchannel)
cs[n++] = myrpt->zaptxchannel;
if (myrpt->dahditxchannel != myrpt->txchannel)
cs[n++] = myrpt->dahditxchannel;
l = myrpt->links.next;
while(l != &myrpt->links)
{
@ -11977,7 +11977,7 @@ char tmpstr[300],lstr[MAXLINKLIST];
ci.chan = 0;
/* first put the channel on the conference in announce mode */
if (ioctl(myrpt->parrotchannel->fds[0],ZT_SETCONF,&ci) == -1)
if (ioctl(myrpt->parrotchannel->fds[0],DAHDI_SETCONF,&ci) == -1)
{
ast_log(LOG_WARNING, "Unable to set conference mode for parrot\n");
break;
@ -12088,7 +12088,7 @@ char tmpstr[300],lstr[MAXLINKLIST];
/* apply inbound filters, if any */
rpt_filter(myrpt,f->data,f->datalen / 2);
#endif
if (ioctl(myrpt->zaprxchannel->fds[0], ZT_GETCONFMUTE, &ismuted) == -1)
if (ioctl(myrpt->dahdirxchannel->fds[0], DAHDI_GETCONFMUTE, &ismuted) == -1)
{
ismuted = 0;
}
@ -12276,9 +12276,9 @@ char tmpstr[300],lstr[MAXLINKLIST];
ast_frfree(f);
continue;
}
if (who == myrpt->zaptxchannel) /* if it was a read from pseudo-tx */
if (who == myrpt->dahditxchannel) /* if it was a read from pseudo-tx */
{
f = ast_read(myrpt->zaptxchannel);
f = ast_read(myrpt->dahditxchannel);
if (!f)
{
if (debug) printf("@@@@ rpt:Hung Up\n");
@ -12517,7 +12517,7 @@ char tmpstr[300],lstr[MAXLINKLIST];
ast_frfree(f);
f = AST_LIST_REMOVE_HEAD(&l->rxq,frame_list);
}
if (ioctl(l->chan->fds[0], ZT_GETCONFMUTE, &ismuted) == -1)
if (ioctl(l->chan->fds[0], DAHDI_GETCONFMUTE, &ismuted) == -1)
{
ismuted = 0;
}
@ -12878,7 +12878,7 @@ char tmpstr[300],lstr[MAXLINKLIST];
if (myrpt->voxchannel) ast_hangup(myrpt->voxchannel);
ast_hangup(myrpt->txpchannel);
if (myrpt->txchannel != myrpt->rxchannel) ast_hangup(myrpt->txchannel);
if (myrpt->zaptxchannel != myrpt->txchannel) ast_hangup(myrpt->zaptxchannel);
if (myrpt->dahditxchannel != myrpt->txchannel) ast_hangup(myrpt->dahditxchannel);
if (myrpt->lastf1) ast_frfree(myrpt->lastf1);
myrpt->lastf1 = NULL;
if (myrpt->lastf2) ast_frfree(myrpt->lastf2);
@ -13125,11 +13125,11 @@ static int rpt_exec(struct ast_channel *chan, void *data)
struct ast_channel *who;
struct ast_channel *cs[20];
struct rpt_link *l;
ZT_CONFINFO ci; /* conference info */
ZT_PARAMS par;
DAHDI_CONFINFO ci; /* conference info */
DAHDI_PARAMS par;
int ms,elap,nullfd;
time_t t,last_timeout_warning;
struct zt_radio_param z;
struct dahdi_radio_param z;
struct rpt_tele *telem;
int numlinks;
@ -13617,7 +13617,7 @@ static int rpt_exec(struct ast_channel *chan, void *data)
ast_set_read_format(l->chan,AST_FORMAT_SLINEAR);
ast_set_write_format(l->chan,AST_FORMAT_SLINEAR);
/* allocate a pseudo-channel thru asterisk */
l->pchan = ast_request("zap",AST_FORMAT_SLINEAR,"pseudo",NULL);
l->pchan = ast_request("DAHDI",AST_FORMAT_SLINEAR,"pseudo",NULL);
if (!l->pchan)
{
fprintf(stderr,"rpt:Sorry unable to obtain pseudo channel\n");
@ -13632,9 +13632,9 @@ static int rpt_exec(struct ast_channel *chan, void *data)
/* make a conference for the tx */
ci.chan = 0;
ci.confno = myrpt->conf;
ci.confmode = ZT_CONF_CONF | ZT_CONF_LISTENER | ZT_CONF_TALKER;
ci.confmode = DAHDI_CONF_CONF | DAHDI_CONF_LISTENER | DAHDI_CONF_TALKER;
/* first put the channel on the conference in proper mode */
if (ioctl(l->pchan->fds[0],ZT_SETCONF,&ci) == -1)
if (ioctl(l->pchan->fds[0],DAHDI_SETCONF,&ci) == -1)
{
ast_log(LOG_WARNING, "Unable to set conference mode to Announce\n");
pthread_exit(NULL);
@ -13760,9 +13760,9 @@ static int rpt_exec(struct ast_channel *chan, void *data)
}
*tele++ = 0;
myrpt->rxchannel = ast_request(myrpt->rxchanname,AST_FORMAT_SLINEAR,tele,NULL);
myrpt->zaprxchannel = NULL;
if (!strcasecmp(myrpt->rxchanname,"Zap"))
myrpt->zaprxchannel = myrpt->rxchannel;
myrpt->dahdirxchannel = NULL;
if (!strcasecmp(myrpt->rxchanname,"DAHDI"))
myrpt->dahdirxchannel = myrpt->rxchannel;
if (myrpt->rxchannel)
{
ast_set_read_format(myrpt->rxchannel,AST_FORMAT_SLINEAR);
@ -13790,7 +13790,7 @@ static int rpt_exec(struct ast_channel *chan, void *data)
pthread_exit(NULL);
}
*--tele = '/';
myrpt->zaptxchannel = NULL;
myrpt->dahditxchannel = NULL;
if (myrpt->txchanname)
{
tele = strchr(myrpt->txchanname,'/');
@ -13803,8 +13803,8 @@ static int rpt_exec(struct ast_channel *chan, void *data)
}
*tele++ = 0;
myrpt->txchannel = ast_request(myrpt->txchanname,AST_FORMAT_SLINEAR,tele,NULL);
if (!strncasecmp(myrpt->txchanname,"Zap",3))
myrpt->zaptxchannel = myrpt->txchannel;
if (!strncasecmp(myrpt->txchanname,"DAHDI",3))
myrpt->dahditxchannel = myrpt->txchannel;
if (myrpt->txchannel)
{
ast_set_read_format(myrpt->txchannel,AST_FORMAT_SLINEAR);
@ -13837,11 +13837,11 @@ static int rpt_exec(struct ast_channel *chan, void *data)
else
{
myrpt->txchannel = myrpt->rxchannel;
if (!strncasecmp(myrpt->rxchanname,"Zap",3))
myrpt->zaptxchannel = myrpt->rxchannel;
if (!strncasecmp(myrpt->rxchanname,"DAHDI",3))
myrpt->dahditxchannel = myrpt->rxchannel;
}
/* allocate a pseudo-channel thru asterisk */
myrpt->pchannel = ast_request("zap",AST_FORMAT_SLINEAR,"pseudo",NULL);
myrpt->pchannel = ast_request("DAHDI",AST_FORMAT_SLINEAR,"pseudo",NULL);
if (!myrpt->pchannel)
{
fprintf(stderr,"rpt:Sorry unable to obtain pseudo channel\n");
@ -13857,14 +13857,14 @@ static int rpt_exec(struct ast_channel *chan, void *data)
if (myrpt->pchannel->cdr)
ast_set_flag(myrpt->pchannel->cdr,AST_CDR_FLAG_POST_DISABLED);
#endif
if (!myrpt->zaprxchannel) myrpt->zaprxchannel = myrpt->pchannel;
if (!myrpt->zaptxchannel) myrpt->zaptxchannel = myrpt->pchannel;
if (!myrpt->dahdirxchannel) myrpt->dahdirxchannel = myrpt->pchannel;
if (!myrpt->dahditxchannel) myrpt->dahditxchannel = myrpt->pchannel;
/* make a conference for the pseudo */
ci.chan = 0;
ci.confno = -1; /* make a new conf */
ci.confmode = ZT_CONF_CONFANNMON ;
ci.confmode = DAHDI_CONF_CONFANNMON ;
/* first put the channel on the conference in announce/monitor mode */
if (ioctl(myrpt->pchannel->fds[0],ZT_SETCONF,&ci) == -1)
if (ioctl(myrpt->pchannel->fds[0],DAHDI_SETCONF,&ci) == -1)
{
ast_log(LOG_WARNING, "Unable to set conference mode to Announce\n");
rpt_mutex_unlock(&myrpt->lock);
@ -13889,30 +13889,30 @@ static int rpt_exec(struct ast_channel *chan, void *data)
}
iskenwood_pci4 = 0;
memset(&z,0,sizeof(z));
if ((myrpt->iofd < 1) && (myrpt->txchannel == myrpt->zaptxchannel))
if ((myrpt->iofd < 1) && (myrpt->txchannel == myrpt->dahditxchannel))
{
z.radpar = ZT_RADPAR_REMMODE;
z.data = ZT_RADPAR_REM_NONE;
res = ioctl(myrpt->zaptxchannel->fds[0],ZT_RADIO_SETPARAM,&z);
z.radpar = DAHDI_RADPAR_REMMODE;
z.data = DAHDI_RADPAR_REM_NONE;
res = ioctl(myrpt->dahditxchannel->fds[0],DAHDI_RADIO_SETPARAM,&z);
/* if PCIRADIO and kenwood selected */
if ((!res) && (!strcmp(myrpt->remoterig,remote_rig_kenwood)))
{
z.radpar = ZT_RADPAR_UIOMODE;
z.radpar = DAHDI_RADPAR_UIOMODE;
z.data = 1;
if (ioctl(myrpt->zaptxchannel->fds[0],ZT_RADIO_SETPARAM,&z) == -1)
if (ioctl(myrpt->dahditxchannel->fds[0],DAHDI_RADIO_SETPARAM,&z) == -1)
{
ast_log(LOG_ERROR,"Cannot set UIOMODE\n");
return -1;
}
z.radpar = ZT_RADPAR_UIODATA;
z.radpar = DAHDI_RADPAR_UIODATA;
z.data = 3;
if (ioctl(myrpt->zaptxchannel->fds[0],ZT_RADIO_SETPARAM,&z) == -1)
if (ioctl(myrpt->dahditxchannel->fds[0],DAHDI_RADIO_SETPARAM,&z) == -1)
{
ast_log(LOG_ERROR,"Cannot set UIODATA\n");
return -1;
}
i = ZT_OFFHOOK;
if (ioctl(myrpt->zaptxchannel->fds[0],ZT_HOOK,&i) == -1)
i = DAHDI_OFFHOOK;
if (ioctl(myrpt->dahditxchannel->fds[0],DAHDI_HOOK,&i) == -1)
{
ast_log(LOG_ERROR,"Cannot set hook\n");
return -1;
@ -13920,26 +13920,26 @@ static int rpt_exec(struct ast_channel *chan, void *data)
iskenwood_pci4 = 1;
}
}
if (myrpt->txchannel == myrpt->zaptxchannel)
if (myrpt->txchannel == myrpt->dahditxchannel)
{
i = ZT_ONHOOK;
ioctl(myrpt->zaptxchannel->fds[0],ZT_HOOK,&i);
i = DAHDI_ONHOOK;
ioctl(myrpt->dahditxchannel->fds[0],DAHDI_HOOK,&i);
/* if PCIRADIO and Yaesu ft897/ICOM IC-706 selected */
if ((myrpt->iofd < 1) && (!res) &&
((!strcmp(myrpt->remoterig,remote_rig_ft897)) ||
(!strcmp(myrpt->remoterig,remote_rig_ic706)) ||
(!strcmp(myrpt->remoterig,remote_rig_tm271))))
{
z.radpar = ZT_RADPAR_UIOMODE;
z.radpar = DAHDI_RADPAR_UIOMODE;
z.data = 1;
if (ioctl(myrpt->zaptxchannel->fds[0],ZT_RADIO_SETPARAM,&z) == -1)
if (ioctl(myrpt->dahditxchannel->fds[0],DAHDI_RADIO_SETPARAM,&z) == -1)
{
ast_log(LOG_ERROR,"Cannot set UIOMODE\n");
return -1;
}
z.radpar = ZT_RADPAR_UIODATA;
z.radpar = DAHDI_RADPAR_UIODATA;
z.data = 3;
if (ioctl(myrpt->zaptxchannel->fds[0],ZT_RADIO_SETPARAM,&z) == -1)
if (ioctl(myrpt->dahditxchannel->fds[0],DAHDI_RADIO_SETPARAM,&z) == -1)
{
ast_log(LOG_ERROR,"Cannot set UIODATA\n");
return -1;
@ -13976,16 +13976,16 @@ static int rpt_exec(struct ast_channel *chan, void *data)
if (myrpt->remote && (myrpt->rxchannel == myrpt->txchannel))
{
i = 128;
ioctl(myrpt->zaprxchannel->fds[0],ZT_ECHOCANCEL,&i);
ioctl(myrpt->dahdirxchannel->fds[0],DAHDI_ECHOCANCEL,&i);
}
if (chan->_state != AST_STATE_UP) {
ast_answer(chan);
if (!phone_mode) send_newkey(chan);
}
if (myrpt->rxchannel == myrpt->zaprxchannel)
if (myrpt->rxchannel == myrpt->dahdirxchannel)
{
if (ioctl(myrpt->zaprxchannel->fds[0],ZT_GET_PARAMS,&par) != -1)
if (ioctl(myrpt->dahdirxchannel->fds[0],DAHDI_GET_PARAMS,&par) != -1)
{
if (par.rxisoffhook)
{
@ -14255,11 +14255,11 @@ static int rpt_exec(struct ast_channel *chan, void *data)
if((myrpt->remtxfreqok = check_tx_freq(myrpt)))
{
time(&myrpt->last_activity_time);
if ((iskenwood_pci4) && (myrpt->txchannel == myrpt->zaptxchannel))
if ((iskenwood_pci4) && (myrpt->txchannel == myrpt->dahditxchannel))
{
z.radpar = ZT_RADPAR_UIODATA;
z.radpar = DAHDI_RADPAR_UIODATA;
z.data = 1;
if (ioctl(myrpt->zaptxchannel->fds[0],ZT_RADIO_SETPARAM,&z) == -1)
if (ioctl(myrpt->dahditxchannel->fds[0],DAHDI_RADIO_SETPARAM,&z) == -1)
{
ast_log(LOG_ERROR,"Cannot set UIODATA\n");
return -1;
@ -14279,11 +14279,11 @@ static int rpt_exec(struct ast_channel *chan, void *data)
if(!myrpt->remtxfreqok){
rpt_telemetry(myrpt,UNAUTHTX,NULL);
}
if ((iskenwood_pci4) && (myrpt->txchannel == myrpt->zaptxchannel))
if ((iskenwood_pci4) && (myrpt->txchannel == myrpt->dahditxchannel))
{
z.radpar = ZT_RADPAR_UIODATA;
z.radpar = DAHDI_RADPAR_UIODATA;
z.data = 3;
if (ioctl(myrpt->zaptxchannel->fds[0],ZT_RADIO_SETPARAM,&z) == -1)
if (ioctl(myrpt->dahditxchannel->fds[0],DAHDI_RADIO_SETPARAM,&z) == -1)
{
ast_log(LOG_ERROR,"Cannot set UIODATA\n");
return -1;
@ -14333,7 +14333,7 @@ static int rpt_exec(struct ast_channel *chan, void *data)
}
if (f->frametype == AST_FRAME_VOICE)
{
if (ioctl(chan->fds[0], ZT_GETCONFMUTE, &ismuted) == -1)
if (ioctl(chan->fds[0], DAHDI_GETCONFMUTE, &ismuted) == -1)
{
ismuted = 0;
}
@ -14556,24 +14556,24 @@ static int rpt_exec(struct ast_channel *chan, void *data)
myrpt->lastf1 = NULL;
if (myrpt->lastf2) ast_frfree(myrpt->lastf2);
myrpt->lastf2 = NULL;
if ((iskenwood_pci4) && (myrpt->txchannel == myrpt->zaptxchannel))
if ((iskenwood_pci4) && (myrpt->txchannel == myrpt->dahditxchannel))
{
z.radpar = ZT_RADPAR_UIOMODE;
z.radpar = DAHDI_RADPAR_UIOMODE;
z.data = 3;
if (ioctl(myrpt->zaptxchannel->fds[0],ZT_RADIO_SETPARAM,&z) == -1)
if (ioctl(myrpt->dahditxchannel->fds[0],DAHDI_RADIO_SETPARAM,&z) == -1)
{
ast_log(LOG_ERROR,"Cannot set UIOMODE\n");
return -1;
}
z.radpar = ZT_RADPAR_UIODATA;
z.radpar = DAHDI_RADPAR_UIODATA;
z.data = 3;
if (ioctl(myrpt->zaptxchannel->fds[0],ZT_RADIO_SETPARAM,&z) == -1)
if (ioctl(myrpt->dahditxchannel->fds[0],DAHDI_RADIO_SETPARAM,&z) == -1)
{
ast_log(LOG_ERROR,"Cannot set UIODATA\n");
return -1;
}
i = ZT_OFFHOOK;
if (ioctl(myrpt->zaptxchannel->fds[0],ZT_HOOK,&i) == -1)
i = DAHDI_OFFHOOK;
if (ioctl(myrpt->dahditxchannel->fds[0],DAHDI_HOOK,&i) == -1)
{
ast_log(LOG_ERROR,"Cannot set hook\n");
return -1;

View File

@ -1,6 +1,7 @@
ASOUND=@PBX_ALSA@
CRYPTO=@PBX_CRYPTO@
CURL=@PBX_CURL@
DAHDI=@PBX_DAHDI@
FREETDS=@PBX_FREETDS@
GMIME=@PBX_GMIME@
GNU_LD=@GNU_LD@
@ -47,7 +48,4 @@ USB=@PBX_USB@
VORBIS=@PBX_VORBIS@
VPBAPI=@PBX_VPB@
WINARCH=@WINARCH@
ZAPTEL=@PBX_ZAPTEL@
ZAPTEL_TRANSCODE=@PBX_ZAPTEL_TRANSCODE@
ZAPTEL_VLDTMF=@PBX_ZAPTEL_VLDTMF@
ZLIB=@PBX_ZLIB@

View File

@ -62,7 +62,7 @@ static char *config = "cdr.conf";
"accountcode", accountcode is the account name of detail records, Master.csv contains all records *
Detail records are configured on a channel basis, IAX and SIP are determined by user *
Zap is determined by channel in zaptel.conf
DAHDI is determined by channel in dahdi.conf
"source",
"destination",
"destination context",

File diff suppressed because it is too large Load Diff

View File

@ -31,7 +31,7 @@
*/
/*** MODULEINFO
<use>zaptel</use>
<use>dahdi</use>
<use>crypto</use>
***/
@ -55,7 +55,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
#include <sys/stat.h>
#include <regex.h>
#include "asterisk/zapata.h"
#include "asterisk/dahdi.h"
#include "asterisk/paths.h" /* need ast_config_AST_DATA_DIR for firmware */
#include "asterisk/lock.h"
@ -7238,17 +7238,17 @@ static int timing_read(int *id, int fd, short events, void *cbdata)
char buf[1024];
int res, processed = 0, totalcalls = 0;
struct iax2_trunk_peer *tpeer = NULL, *drop = NULL;
#ifdef ZT_TIMERACK
#ifdef DAHDI_TIMERACK
int x = 1;
#endif
struct timeval now = ast_tvnow();
if (iaxtrunkdebug)
ast_verbose("Beginning trunk processing. Trunk queue ceiling is %d bytes per host\n", trunkmaxsize);
if (events & AST_IO_PRI) {
#ifdef ZT_TIMERACK
#ifdef DAHDI_TIMERACK
/* Great, this is a timing interface, just call the ioctl */
if (ioctl(fd, ZT_TIMERACK, &x)) {
ast_log(LOG_WARNING, "Unable to acknowledge zap timer. IAX trunking will fail!\n");
if (ioctl(fd, DAHDI_TIMERACK, &x)) {
ast_log(LOG_WARNING, "Unable to acknowledge DAHDI timer. IAX trunking will fail!\n");
usleep(1);
return -1;
}
@ -10366,7 +10366,7 @@ static struct iax2_peer *build_peer(const char *name, struct ast_variable *v, st
} else if (!strcasecmp(v->name, "trunk")) {
ast_set2_flag(peer, ast_true(v->value), IAX_TRUNK);
if (ast_test_flag(peer, IAX_TRUNK) && (timingfd < 0)) {
ast_log(LOG_WARNING, "Unable to support trunking on peer '%s' without zaptel timing\n", peer->name);
ast_log(LOG_WARNING, "Unable to support trunking on peer '%s' without DAHDI timing\n", peer->name);
ast_clear_flag(peer, IAX_TRUNK);
}
} else if (!strcasecmp(v->name, "auth")) {
@ -10634,7 +10634,7 @@ static struct iax2_user *build_user(const char *name, struct ast_variable *v, st
} else if (!strcasecmp(v->name, "trunk")) {
ast_set2_flag(user, ast_true(v->value), IAX_TRUNK);
if (ast_test_flag(user, IAX_TRUNK) && (timingfd < 0)) {
ast_log(LOG_WARNING, "Unable to support trunking on user '%s' without zaptel timing\n", user->name);
ast_log(LOG_WARNING, "Unable to support trunking on user '%s' without DAHDI timing\n", user->name);
ast_clear_flag(user, IAX_TRUNK);
}
} else if (!strcasecmp(v->name, "auth")) {
@ -10828,14 +10828,14 @@ static void prune_peers(void)
static void set_timing(void)
{
#ifdef HAVE_ZAPTEL
#ifdef HAVE_DAHDI
int bs = trunkfreq * 8;
if (timingfd > -1) {
if (
#ifdef ZT_TIMERACK
ioctl(timingfd, ZT_TIMERCONFIG, &bs) &&
#ifdef DAHDI_TIMERACK
ioctl(timingfd, DAHDI_TIMERCONFIG, &bs) &&
#endif
ioctl(timingfd, ZT_SET_BLOCKSIZE, &bs))
ioctl(timingfd, DAHDI_SET_BLOCKSIZE, &bs))
ast_log(LOG_WARNING, "Unable to set blocksize on timing source\n");
}
#endif
@ -12103,12 +12103,12 @@ static int load_module(void)
iax_set_error(iax_error_output);
jb_setoutput(jb_error_output, jb_warning_output, NULL);
#ifdef HAVE_ZAPTEL
#ifdef ZT_TIMERACK
timingfd = open("/dev/zap/timer", O_RDWR);
#ifdef HAVE_DAHDI
#ifdef DAHDI_TIMERACK
timingfd = open("/dev/dahdi/timer", O_RDWR);
if (timingfd < 0)
#endif
timingfd = open("/dev/zap/pseudo", O_RDWR);
timingfd = open("/dev/dahdi/pseudo", O_RDWR);
if (timingfd < 0)
ast_log(LOG_WARNING, "Unable to open IAX timing interface: %s\n", strerror(errno));
#endif

View File

@ -2696,7 +2696,7 @@ static void *mgcp_ss(void *data)
ast_indicate(chan, -1);
} else {
/* XXX Redundant? We should already be playing dialtone */
/*tone_zone_play_tone(p->subs[index].zfd, ZT_TONE_DIALTONE);*/
/*tone_zone_play_tone(p->subs[index].zfd, DAHDI_TONE_DIALTONE);*/
transmit_notify_request(sub, "L/dl");
}
if (ast_exists_extension(chan, chan->context, p->dtmf_buf, 1, p->cid_num)) {
@ -2706,7 +2706,7 @@ static void *mgcp_ss(void *data)
ast_copy_string(p->call_forward, p->dtmf_buf, sizeof(p->call_forward));
ast_verb(3, "Setting call forward to '%s' on channel %s\n",
p->call_forward, chan->name);
/*res = tone_zone_play_tone(p->subs[index].zfd, ZT_TONE_DIALRECALL);*/
/*res = tone_zone_play_tone(p->subs[index].zfd, DAHDI_TONE_DIALRECALL);*/
transmit_notify_request(sub, "L/sl");
if (res)
break;
@ -2715,7 +2715,7 @@ static void *mgcp_ss(void *data)
ast_indicate(chan, -1);
sleep(1);
memset(p->dtmf_buf, 0, sizeof(p->dtmf_buf));
/*res = tone_zone_play_tone(p->subs[index].zfd, ZT_TONE_DIALTONE);*/
/*res = tone_zone_play_tone(p->subs[index].zfd, DAHDI_TONE_DIALTONE);*/
transmit_notify_request(sub, "L/dl");
len = 0;
getforward = 0;
@ -2729,7 +2729,7 @@ static void *mgcp_ss(void *data)
p->hidecallerid ? "" : p->cid_name,
chan->cid.cid_ani ? NULL : p->cid_num);
ast_setstate(chan, AST_STATE_RING);
/*zt_enable_ec(p);*/
/*dahdi_enable_ec(p);*/
if (p->dtmfmode & MGCP_DTMF_HYBRID) {
p->dtmfmode |= MGCP_DTMF_INBAND;
ast_indicate(chan, -1);
@ -2737,7 +2737,7 @@ static void *mgcp_ss(void *data)
res = ast_pbx_run(chan);
if (res) {
ast_log(LOG_WARNING, "PBX exited non-zero\n");
/*res = tone_zone_play_tone(p->subs[index].zfd, ZT_TONE_CONGESTION);*/
/*res = tone_zone_play_tone(p->subs[index].zfd, DAHDI_TONE_CONGESTION);*/
/*transmit_notify_request(p, "nbz", 1);*/
transmit_notify_request(sub, "G/cg");
}
@ -2750,9 +2750,9 @@ static void *mgcp_ss(void *data)
}
} else if (res == 0) {
ast_debug(1, "not enough digits (and no ambiguous match)...\n");
/*res = tone_zone_play_tone(p->subs[index].zfd, ZT_TONE_CONGESTION);*/
/*res = tone_zone_play_tone(p->subs[index].zfd, DAHDI_TONE_CONGESTION);*/
transmit_notify_request(sub, "G/cg");
/*zt_wait_event(p->subs[index].zfd);*/
/*dahdi_wait_event(p->subs[index].zfd);*/
ast_hangup(chan);
memset(p->dtmf_buf, 0, sizeof(p->dtmf_buf));
return NULL;
@ -2760,7 +2760,7 @@ static void *mgcp_ss(void *data)
ast_verb(3, "Disabling call waiting on %s\n", chan->name);
/* Disable call waiting if enabled */
p->callwaiting = 0;
/*res = tone_zone_play_tone(p->subs[index].zfd, ZT_TONE_DIALRECALL);*/
/*res = tone_zone_play_tone(p->subs[index].zfd, DAHDI_TONE_DIALRECALL);*/
transmit_notify_request(sub, "L/sl");
len = 0;
memset(p->dtmf_buf, 0, sizeof(p->dtmf_buf));
@ -2772,7 +2772,7 @@ static void *mgcp_ss(void *data)
*/
if (ast_pickup_call(chan)) {
ast_log(LOG_WARNING, "No call pickup possible...\n");
/*res = tone_zone_play_tone(p->subs[index].zfd, ZT_TONE_CONGESTION);*/
/*res = tone_zone_play_tone(p->subs[index].zfd, DAHDI_TONE_CONGESTION);*/
transmit_notify_request(sub, "G/cg");
}
memset(p->dtmf_buf, 0, sizeof(p->dtmf_buf));
@ -2783,7 +2783,7 @@ static void *mgcp_ss(void *data)
/* Disable Caller*ID if enabled */
p->hidecallerid = 1;
ast_set_callerid(chan, "", "", NULL);
/*res = tone_zone_play_tone(p->subs[index].zfd, ZT_TONE_DIALRECALL);*/
/*res = tone_zone_play_tone(p->subs[index].zfd, DAHDI_TONE_DIALRECALL);*/
transmit_notify_request(sub, "L/sl");
len = 0;
memset(p->dtmf_buf, 0, sizeof(p->dtmf_buf));
@ -2794,13 +2794,13 @@ static void *mgcp_ss(void *data)
res = ast_say_digit_str(chan, p->lastcallerid, "", chan->language);
}
if (!res)
/*res = tone_zone_play_tone(p->subs[index].zfd, ZT_TONE_DIALRECALL);*/
/*res = tone_zone_play_tone(p->subs[index].zfd, DAHDI_TONE_DIALRECALL);*/
transmit_notify_request(sub, "L/sl");
break;
} else if (!strcmp(p->dtmf_buf, "*78")) {
/* Do not disturb */
ast_verb(3, "Enabled DND on channel %s\n", chan->name);
/*res = tone_zone_play_tone(p->subs[index].zfd, ZT_TONE_DIALRECALL);*/
/*res = tone_zone_play_tone(p->subs[index].zfd, DAHDI_TONE_DIALRECALL);*/
transmit_notify_request(sub, "L/sl");
p->dnd = 1;
getforward = 0;
@ -2809,21 +2809,21 @@ static void *mgcp_ss(void *data)
} else if (!strcmp(p->dtmf_buf, "*79")) {
/* Do not disturb */
ast_verb(3, "Disabled DND on channel %s\n", chan->name);
/*res = tone_zone_play_tone(p->subs[index].zfd, ZT_TONE_DIALRECALL);*/
/*res = tone_zone_play_tone(p->subs[index].zfd, DAHDI_TONE_DIALRECALL);*/
transmit_notify_request(sub, "L/sl");
p->dnd = 0;
getforward = 0;
memset(p->dtmf_buf, 0, sizeof(p->dtmf_buf));
len = 0;
} else if (p->cancallforward && !strcmp(p->dtmf_buf, "*72")) {
/*res = tone_zone_play_tone(p->subs[index].zfd, ZT_TONE_DIALRECALL);*/
/*res = tone_zone_play_tone(p->subs[index].zfd, DAHDI_TONE_DIALRECALL);*/
transmit_notify_request(sub, "L/sl");
getforward = 1;
memset(p->dtmf_buf, 0, sizeof(p->dtmf_buf));
len = 0;
} else if (p->cancallforward && !strcmp(p->dtmf_buf, "*73")) {
ast_verb(3, "Cancelling call forwarding on channel %s\n", chan->name);
/*res = tone_zone_play_tone(p->subs[index].zfd, ZT_TONE_DIALRECALL);*/
/*res = tone_zone_play_tone(p->subs[index].zfd, DAHDI_TONE_DIALRECALL);*/
transmit_notify_request(sub, "L/sl");
memset(p->call_forward, 0, sizeof(p->call_forward));
getforward = 0;
@ -2840,7 +2840,7 @@ static void *mgcp_ss(void *data)
ast_verb(3, "Blacklisting number %s\n", p->lastcallerid);
res = ast_db_put("blacklist", p->lastcallerid, "1");
if (!res) {
/*res = tone_zone_play_tone(p->subs[index].zfd, ZT_TONE_DIALRECALL);*/
/*res = tone_zone_play_tone(p->subs[index].zfd, DAHDI_TONE_DIALRECALL);*/
transmit_notify_request(sub, "L/sl");
memset(p->dtmf_buf, 0, sizeof(p->dtmf_buf));
len = 0;
@ -2850,7 +2850,7 @@ static void *mgcp_ss(void *data)
/* Enable Caller*ID if enabled */
p->hidecallerid = 0;
ast_set_callerid(chan, p->cid_num, p->cid_name, NULL);
/*res = tone_zone_play_tone(p->subs[index].zfd, ZT_TONE_DIALRECALL);*/
/*res = tone_zone_play_tone(p->subs[index].zfd, DAHDI_TONE_DIALRECALL);*/
transmit_notify_request(sub, "L/sl");
len = 0;
memset(p->dtmf_buf, 0, sizeof(p->dtmf_buf));

View File

@ -1,7 +1,7 @@
/*
* Asterisk -- An open source telephony toolkit.
*
* Zaptel native transcoding support
* DAHDI native transcoding support
*
* Copyright (C) 1999 - 2006, Digium, Inc.
*
@ -21,14 +21,13 @@
/*! \file
*
* \brief Translate between various formats natively through Zaptel transcoding
* \brief Translate between various formats natively through DAHDI transcoding
*
* \ingroup codecs
*/
/*** MODULEINFO
<depend>zaptel_transcode</depend>
<depend>zaptel</depend>
<depend>dahdi</depend>
***/
#include "asterisk.h"
@ -39,8 +38,8 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
#include <netinet/in.h>
#include <sys/ioctl.h>
#include <sys/mman.h>
#include <zaptel/zaptel.h>
#include "asterisk/dahdi.h"
#include "asterisk/lock.h"
#include "asterisk/translate.h"
#include "asterisk/config.h"
@ -63,7 +62,7 @@ static struct channel_usage {
static char *handle_cli_transcoder_show(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a);
static struct ast_cli_entry cli[] = {
AST_CLI_DEFINE(handle_cli_transcoder_show, "Display Zaptel transcoder utilization.")
AST_CLI_DEFINE(handle_cli_transcoder_show, "Display DAHDI transcoder utilization.")
};
struct format_map {
@ -86,7 +85,7 @@ struct pvt {
int totalms;
int lasttotalms;
#endif
struct zt_transcode_header *hdr;
struct dahdi_transcode_header *hdr;
};
static char *handle_cli_transcoder_show(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
@ -98,7 +97,7 @@ static char *handle_cli_transcoder_show(struct ast_cli_entry *e, int cmd, struct
e->command = "transcoder show";
e->usage =
"Usage: transcoder show\n"
" Displays channel utilization of Zaptel transcoder(s).\n";
" Displays channel utilization of DAHDI transcoder(s).\n";
return NULL;
case CLI_GENERATE:
return NULL;
@ -110,21 +109,21 @@ static char *handle_cli_transcoder_show(struct ast_cli_entry *e, int cmd, struct
copy = channels;
if (copy.total == 0)
ast_cli(a->fd, "No Zaptel transcoders found.\n");
ast_cli(a->fd, "No DAHDI transcoders found.\n");
else
ast_cli(a->fd, "%d/%d encoders/decoders of %d channels are in use.\n", copy.encoders, copy.decoders, copy.total);
return CLI_SUCCESS;
}
static int zap_framein(struct ast_trans_pvt *pvt, struct ast_frame *f)
static int dahdi_framein(struct ast_trans_pvt *pvt, struct ast_frame *f)
{
struct pvt *ztp = pvt->pvt;
struct zt_transcode_header *hdr = ztp->hdr;
struct pvt *dahdip = pvt->pvt;
struct dahdi_transcode_header *hdr = dahdip->hdr;
if (!f->subclass) {
/* Fake a return frame for calculation purposes */
ztp->fake = 2;
dahdip->fake = 2;
pvt->samples = f->samples;
return 0;
}
@ -151,14 +150,14 @@ static int zap_framein(struct ast_trans_pvt *pvt, struct ast_frame *f)
return -1;
}
static struct ast_frame *zap_frameout(struct ast_trans_pvt *pvt)
static struct ast_frame *dahdi_frameout(struct ast_trans_pvt *pvt)
{
struct pvt *ztp = pvt->pvt;
struct zt_transcode_header *hdr = ztp->hdr;
struct pvt *dahdip = pvt->pvt;
struct dahdi_transcode_header *hdr = dahdip->hdr;
unsigned int x;
if (ztp->fake == 2) {
ztp->fake = 1;
if (dahdip->fake == 2) {
dahdip->fake = 1;
pvt->f.frametype = AST_FRAME_VOICE;
pvt->f.subclass = 0;
pvt->f.samples = 160;
@ -168,15 +167,15 @@ static struct ast_frame *zap_frameout(struct ast_trans_pvt *pvt)
pvt->f.mallocd = 0;
ast_set_flag(&pvt->f, AST_FRFLAG_FROM_TRANSLATOR);
pvt->samples = 0;
} else if (ztp->fake == 1) {
} else if (dahdip->fake == 1) {
return NULL;
} else {
if (hdr->dstlen) {
#ifdef DEBUG_TRANSCODE
ztp->totalms += hdr->dstsamples;
if ((ztp->totalms - ztp->lasttotalms) > 8000) {
printf("Whee %p, %d (%d to %d)\n", ztp, hdr->dstlen, ztp->lasttotalms, ztp->totalms);
ztp->lasttotalms = ztp->totalms;
dahdip->totalms += hdr->dstsamples;
if ((dahdip->totalms - dahdip->lasttotalms) > 8000) {
printf("Whee %p, %d (%d to %d)\n", dahdip, hdr->dstlen, dahdip->lasttotalms, dahdip->totalms);
dahdip->lasttotalms = dahdip->totalms;
}
#endif
pvt->f.frametype = AST_FRAME_VOICE;
@ -193,8 +192,8 @@ static struct ast_frame *zap_frameout(struct ast_trans_pvt *pvt)
} else {
if (hdr->srclen) {
hdr->dstoffset = AST_FRIENDLY_OFFSET;
x = ZT_TCOP_TRANSCODE;
if (ioctl(ztp->fd, ZT_TRANSCODE_OP, &x))
x = DAHDI_TCOP_TRANSCODE;
if (ioctl(dahdip->fd, DAHDI_TRANSCODE_OP, &x))
ast_log(LOG_WARNING, "Failed to transcode: %s\n", strerror(errno));
}
return NULL;
@ -204,16 +203,16 @@ static struct ast_frame *zap_frameout(struct ast_trans_pvt *pvt)
return &pvt->f;
}
static void zap_destroy(struct ast_trans_pvt *pvt)
static void dahdi_destroy(struct ast_trans_pvt *pvt)
{
struct pvt *ztp = pvt->pvt;
struct pvt *dahdip = pvt->pvt;
unsigned int x;
x = ZT_TCOP_RELEASE;
if (ioctl(ztp->fd, ZT_TRANSCODE_OP, &x))
x = DAHDI_TCOP_RELEASE;
if (ioctl(dahdip->fd, DAHDI_TRANSCODE_OP, &x))
ast_log(LOG_WARNING, "Failed to release transcoder channel: %s\n", strerror(errno));
switch (ztp->hdr->dstfmt) {
switch (dahdip->hdr->dstfmt) {
case AST_FORMAT_G729A:
case AST_FORMAT_G723_1:
ast_atomic_fetchadd_int(&channels.encoders, -1);
@ -223,20 +222,20 @@ static void zap_destroy(struct ast_trans_pvt *pvt)
break;
}
munmap(ztp->hdr, sizeof(*ztp->hdr));
close(ztp->fd);
munmap(dahdip->hdr, sizeof(*dahdip->hdr));
close(dahdip->fd);
}
static int zap_translate(struct ast_trans_pvt *pvt, int dest, int source)
static int dahdi_translate(struct ast_trans_pvt *pvt, int dest, int source)
{
/* Request translation through zap if possible */
/* Request translation through dahdi if possible */
int fd;
unsigned int x = ZT_TCOP_ALLOCATE;
struct pvt *ztp = pvt->pvt;
struct zt_transcode_header *hdr;
unsigned int x = DAHDI_TCOP_ALLOCATE;
struct pvt *dahdip = pvt->pvt;
struct dahdi_transcode_header *hdr;
int flags;
if ((fd = open("/dev/zap/transcode", O_RDWR)) < 0)
if ((fd = open("/dev/dahdi/transcode", O_RDWR)) < 0)
return -1;
flags = fcntl(fd, F_GETFL);
if (flags > - 1) {
@ -252,7 +251,7 @@ static int zap_translate(struct ast_trans_pvt *pvt, int dest, int source)
return -1;
}
if (hdr->magic != ZT_TRANSCODE_MAGIC) {
if (hdr->magic != DAHDI_TRANSCODE_MAGIC) {
ast_log(LOG_ERROR, "Transcoder header (%08x) wasn't magic. Abandoning\n", hdr->magic);
munmap(hdr, sizeof(*hdr));
close(fd);
@ -262,7 +261,7 @@ static int zap_translate(struct ast_trans_pvt *pvt, int dest, int source)
hdr->srcfmt = (1 << source);
hdr->dstfmt = (1 << dest);
if (ioctl(fd, ZT_TRANSCODE_OP, &x)) {
if (ioctl(fd, DAHDI_TRANSCODE_OP, &x)) {
ast_log(LOG_ERROR, "Unable to attach transcoder: %s\n", strerror(errno));
munmap(hdr, sizeof(*hdr));
close(fd);
@ -270,9 +269,9 @@ static int zap_translate(struct ast_trans_pvt *pvt, int dest, int source)
return -1;
}
ztp = pvt->pvt;
ztp->fd = fd;
ztp->hdr = hdr;
dahdip = pvt->pvt;
dahdip->fd = fd;
dahdip->hdr = hdr;
switch (hdr->dstfmt) {
case AST_FORMAT_G729A:
@ -287,9 +286,9 @@ static int zap_translate(struct ast_trans_pvt *pvt, int dest, int source)
return 0;
}
static int zap_new(struct ast_trans_pvt *pvt)
static int dahdi_new(struct ast_trans_pvt *pvt)
{
return zap_translate(pvt, pvt->t->dstfmt, pvt->t->srcfmt);
return dahdi_translate(pvt, pvt->t->dstfmt, pvt->t->srcfmt);
}
static struct ast_frame *fakesrc_sample(void)
@ -306,31 +305,31 @@ static struct ast_frame *fakesrc_sample(void)
static int register_translator(int dst, int src)
{
struct translator *zt;
struct translator *dahdi;
int res;
if (!(zt = ast_calloc(1, sizeof(*zt))))
if (!(dahdi = ast_calloc(1, sizeof(*dahdi))))
return -1;
snprintf((char *) (zt->t.name), sizeof(zt->t.name), "zap%sto%s",
snprintf((char *) (dahdi->t.name), sizeof(dahdi->t.name), "DAHDI%sto%s",
ast_getformatname((1 << src)), ast_getformatname((1 << dst)));
zt->t.srcfmt = (1 << src);
zt->t.dstfmt = (1 << dst);
zt->t.newpvt = zap_new;
zt->t.framein = zap_framein;
zt->t.frameout = zap_frameout;
zt->t.destroy = zap_destroy;
zt->t.sample = fakesrc_sample;
zt->t.useplc = global_useplc;
zt->t.buf_size = BUFFER_SAMPLES * 2;
zt->t.desc_size = sizeof(struct pvt);
if ((res = ast_register_translator(&zt->t))) {
ast_free(zt);
dahdi->t.srcfmt = (1 << src);
dahdi->t.dstfmt = (1 << dst);
dahdi->t.newpvt = dahdi_new;
dahdi->t.framein = dahdi_framein;
dahdi->t.frameout = dahdi_frameout;
dahdi->t.destroy = dahdi_destroy;
dahdi->t.sample = fakesrc_sample;
dahdi->t.useplc = global_useplc;
dahdi->t.buf_size = BUFFER_SAMPLES * 2;
dahdi->t.desc_size = sizeof(struct pvt);
if ((res = ast_register_translator(&dahdi->t))) {
ast_free(dahdi);
return -1;
}
AST_LIST_LOCK(&translators);
AST_LIST_INSERT_HEAD(&translators, zt, entry);
AST_LIST_INSERT_HEAD(&translators, dahdi, entry);
AST_LIST_UNLOCK(&translators);
global_format_map.map[dst][src] = 1;
@ -386,7 +385,7 @@ static int parse_config(int reload)
for (var = ast_variable_browse(cfg, "plc"); var; var = var->next) {
if (!strcasecmp(var->name, "genericplc")) {
global_useplc = ast_true(var->value);
ast_verb(3, "codec_zap: %susing generic PLC\n",
ast_verb(3, "codec_dahdi: %susing generic PLC\n",
global_useplc ? "" : "not ");
}
}
@ -417,18 +416,18 @@ static void build_translators(struct format_map *map, unsigned int dstfmts, unsi
static int find_transcoders(void)
{
struct zt_transcode_info info = { 0, };
struct dahdi_transcode_info info = { 0, };
struct format_map map = { { { 0 } } };
int fd, res;
unsigned int x, y;
if ((fd = open("/dev/zap/transcode", O_RDWR)) < 0) {
if ((fd = open("/dev/dahdi/transcode", O_RDWR)) < 0) {
ast_verbose(VERBOSE_PREFIX_2 "No hardware transcoders found.\n");
return 0;
}
info.op = ZT_TCOP_GETINFO;
for (info.tcnum = 0; !(res = ioctl(fd, ZT_TRANSCODE_OP, &info)); info.tcnum++) {
info.op = DAHDI_TCOP_GETINFO;
for (info.tcnum = 0; !(res = ioctl(fd, DAHDI_TRANSCODE_OP, &info)); info.tcnum++) {
ast_verb(2, "Found transcoder '%s'.\n", info.name);
build_translators(&map, info.dstfmts, info.srcfmts);
ast_atomic_fetchadd_int(&channels.total, info.numchannels / 2);
@ -481,7 +480,7 @@ static int load_module(void)
return AST_MODULE_LOAD_SUCCESS;
}
AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_DEFAULT, "Generic Zaptel Transcoder Codec Translator",
AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_DEFAULT, "Generic DAHDI Transcoder Codec Translator",
.load = load_module,
.unload = unload_module,
.reload = reload,

View File

@ -20,19 +20,19 @@
globals {
CONSOLE="Console/dsp"; // Console interface for demo
//CONSOLE=Zap/1
//CONSOLE=DAHDI/1
//CONSOLE=Phone/phone0
IAXINFO=guest; // IAXtel username/password
//IAXINFO="myuser:mypass";
TRUNK="Zap/G2"; // Trunk interface
TRUNK="DAHDI/G2"; // Trunk interface
//
// Note the 'G2' in the TRUNK variable above. It specifies which group (defined
// in zapata.conf) to dial, i.e. group 2, and how to choose a channel to use in
// in dahdi.conf) to dial, i.e. group 2, and how to choose a channel to use in
// the specified group. The four possible options are:
//
// g: select the lowest-numbered non-busy Zap channel
// g: select the lowest-numbered non-busy DAHDI channel
// (aka. ascending sequential hunt group).
// G: select the highest-numbered non-busy Zap channel
// G: select the highest-numbered non-busy DAHDI channel
// (aka. descending sequential hunt group).
// r: use a round-robin search, starting at the next highest channel than last
// time (aka. ascending rotary hunt group).
@ -129,8 +129,8 @@ context ael-dundi-e164-via-pstn {
//
// If you are freely delivering calls to the PSTN, list them here
//
//_1256428XXXX => Dial(Zap/G2/${EXTEN:7}); // Expose all of 256-428
//_1256325XXXX => Dial(Zap/G2/${EXTEN:7}); // Ditto for 256-325
//_1256428XXXX => Dial(DAHDI/G2/${EXTEN:7}); // Expose all of 256-428
//_1256325XXXX => Dial(DAHDI/G2/${EXTEN:7}); // Ditto for 256-325
};
context ael-dundi-e164-local {
@ -418,7 +418,7 @@ context ael-default {
// 6389 => Dial(MGCP/aaln/1@192.168.0.14);
// 6394 => Dial(Local/6275/n); // this will dial ${MARK}
// 6275 => &ael-stdexten(6275,${MARK}); // assuming ${MARK} is something like Zap/2
// 6275 => &ael-stdexten(6275,${MARK}); // assuming ${MARK} is something like DAHDI/2
// mark => goto 6275|1; // alias mark to 6275
// 6536 => &ael-stdexten(6236,${WIL}); // Ditto for wil
// wil => goto 6236|1;

View File

@ -116,19 +116,19 @@ clearglobalvars=no
;
[globals]
CONSOLE=Console/dsp ; Console interface for demo
;CONSOLE=Zap/1
;CONSOLE=DAHDI/1
;CONSOLE=Phone/phone0
IAXINFO=guest ; IAXtel username/password
;IAXINFO=myuser:mypass
TRUNK=Zap/G2 ; Trunk interface
TRUNK=DAHDI/G2 ; Trunk interface
;
; Note the 'G2' in the TRUNK variable above. It specifies which group (defined
; in zapata.conf) to dial, i.e. group 2, and how to choose a channel to use in
; in dahdi.conf) to dial, i.e. group 2, and how to choose a channel to use in
; the specified group. The four possible options are:
;
; g: select the lowest-numbered non-busy Zap channel
; g: select the lowest-numbered non-busy DAHDI channel
; (aka. ascending sequential hunt group).
; G: select the highest-numbered non-busy Zap channel
; G: select the highest-numbered non-busy DAHDI channel
; (aka. descending sequential hunt group).
; r: use a round-robin search, starting at the next highest channel than last
; time (aka. ascending rotary hunt group).
@ -225,8 +225,8 @@ TRUNKMSD=1 ; MSD digits to strip (usually 1 or 0)
;
; If you are freely delivering calls to the PSTN, list them here
;
;exten => _1256428XXXX,1,Dial(Zap/G2/${EXTEN:7}) ; Expose all of 256-428
;exten => _1256325XXXX,1,Dial(Zap/G2/${EXTEN:7}) ; Ditto for 256-325
;exten => _1256428XXXX,1,Dial(DAHDI/G2/${EXTEN:7}) ; Expose all of 256-428
;exten => _1256325XXXX,1,Dial(DAHDI/G2/${EXTEN:7}) ; Ditto for 256-325
[dundi-e164-local]
;
@ -618,7 +618,7 @@ include => demo
;exten => 6394,1,Dial(Local/6275/n) ; this will dial ${MARK}
;exten => 6275,1,Gosub(stdexten,s,1(6275,${MARK}))
; assuming ${MARK} is something like Zap/2
; assuming ${MARK} is something like DAHDI/2
;exten => 6275,n,Goto(default,s,1) ; exited Voicemail
;exten => mark,1,Goto(6275|1) ; alias mark to 6275
;exten => 6536,1,Gosub(stdexten,s,1(6236,${WIL}))

View File

@ -1,13 +1,13 @@
CONSOLE = "Console/dsp" -- Console interface for demo
--CONSOLE = "Zap/1"
--CONSOLE = "DAHDI/1"
--CONSOLE = "Phone/phone0"
IAXINFO = "guest" -- IAXtel username/password
--IAXINFO = "myuser:mypass"
TRUNK = "Zap/G2"
TRUNK = "DAHDI/G2"
TRUNKMSD = 1
-- TRUNK = "IAX2/user:pass@provider"
@ -92,8 +92,8 @@ TRUNKMSD = 1
--
-- Dialplan applications can be accessed through the global 'app' table.
--
-- app.Dial("Zap/1")
-- app.dial("Zap/1")
-- app.Dial("DAHDI/1")
-- app.dial("DAHDI/1")
--
-- More examples can be found below.
--
@ -106,7 +106,7 @@ TRUNKMSD = 1
--
function outgoing_local(c, e)
app.dial("zap/1/" .. e, "", "")
app.dial("DAHDI/1/" .. e, "", "")
end
function demo_instruct()

View File

@ -5,7 +5,7 @@
[general]
;audiobuffers=32 ; The number of 20ms audio buffers to be used
; when feeding audio frames from non-Zap channels
; when feeding audio frames from non-DAHDI channels
; into the conference; larger numbers will allow
; for the conference to 'de-jitter' audio that arrives
; at different timing than the conference's timing

View File

@ -25,8 +25,8 @@ pass pass
#
# List each channel we're supposed to watch
#
channel Zap/1
channel Zap/2
channel DAHDI/1
channel DAHDI/2
channel SIP/mark
#
# Mute level is the percentage of the current volume we should

View File

@ -401,9 +401,9 @@ shared_lastcall=no
; must also preload pbx_config.so (or pbx_ael.so, pbx_lua.so, or
; pbx_realtime.so, depending on how your dialplan is configured).
;
;member => Zap/1
;member => Zap/2,10
;member => Zap/3,10,Bob Johnson
;member => DAHDI/1
;member => DAHDI/2,10
;member => DAHDI/3,10,Bob Johnson
;member => Agent/1001
;member => Agent/1002
;member => Local/1000@default,0,John Smith,SIP/1000

View File

@ -4,10 +4,10 @@
;[000] ; Node ID of first repeater
;rxchannel = Zap/1 ; Rx audio/signalling channel
;rxchannel = DAHDI/1 ; Rx audio/signalling channel
; Note: if you use a unified interface (tx/rx on one channel), only
; specify the rxchannel and the txchannel will be assumed from the rxchannel
;txchannel = Zap/2 ; Tx audio/signalling channel
;txchannel = DAHDI/2 ; Tx audio/signalling channel
;duplex = 2 ; (Optional) set duplex operating mode
;; 0 = half duplex (telemetry and courtesy tones do not transmit)
;; 1 = semi-half duplex (telemetry and courtesy tones transmit, but not
@ -51,10 +51,10 @@
;[001] ; Node ID of first repeater
;rxchannel = Zap/3 ; Rx audio/signalling channel
;rxchannel = DAHDI/3 ; Rx audio/signalling channel
; Note: if you use a unified interface (tx/rx on one channel), only
; specify the rxchannel and the txchannel will be assumed from the rxchannel
;txchannel = Zap/4 ; Tx audio/signalling channel
;txchannel = DAHDI/4 ; Tx audio/signalling channel
;functions = functions-repeater ; DTMF function list
;; specify this for a different function list then local when on link
;;link_functions = functions-different ; DTMF function list for link
@ -81,10 +81,10 @@
;[002] ; Node ID of remote base
;rxchannel = Zap/5 ; Rx audio/signalling channel
;rxchannel = DAHDI/5 ; Rx audio/signalling channel
; Note: if you use a unified interface (tx/rx on one channel), only
; specify the rxchannel and the txchannel will be assumed from the rxchannel
;txchannel = Zap/6 ; Tx audio/signalling channel
;txchannel = DAHDI/6 ; Tx audio/signalling channel
;functions = functions-remote
;remote = ft897 ; Set remote=y for dumb remote or
; remote=ft897 for Yaesu FT-897 or

View File

@ -21,15 +21,15 @@
;type=trunk ; This line is what marks this entry as a trunk.
;device=Zap/3 ; Map this trunk declaration to a specific device.
;device=DAHDI/3 ; Map this trunk declaration to a specific device.
; NOTE: You can not just put any type of channel here.
; Zap channels can be directly used. IP trunks
; DAHDI channels can be directly used. IP trunks
; require some indirect configuration which is
; described in doc/asterisk.pdf.
;autocontext=line1 ; This supports automatic generation of the dialplan entries
; if the autocontext option is used. Each trunk should have
; a unique context name. Then, in zapata.conf, this device
; a unique context name. Then, in dahdi.conf, this device
; should be configured to have incoming calls go to this context.
;ringtimeout=30 ; Set how long to allow this trunk to ring on an inbound call before hanging
@ -49,12 +49,12 @@
;[line2]
;type=trunk
;device=Zap/4
;device=DAHDI/4
;autocontext=line2
;[line3]
;type=trunk
;device=Zap/3
;device=DAHDI/3
;autocontext=line3
;[line4]

View File

@ -2,7 +2,7 @@
[interfaces]
; Specify serial ports to listen for SMDI messages on below. These will be
; referenced later in zapata.conf. If you do not specify any interfaces then
; referenced later in dahdi.conf. If you do not specify any interfaces then
; SMDI will be disabled. Interfaces can have several different attributes
; associated with them.

View File

@ -68,7 +68,7 @@ pickupgroup = 1
;fullname = Joe User
;email = joe@foo.bar
;secret = 1234
;zapchan = 1
;dahdichan = 1
;hasvoicemail = yes
;vmsecret = 1234
;hassip = yes

View File

@ -97,7 +97,7 @@ echocancel=off
;
; NOTE that other caller ID standards are supported in Asterisk, but are
; not yet active in chan_vpb. It should be reasonably trivial to add
; support for the other standards (see the default zapata.conf for a list
; support for the other standards (see the default dahdi.conf for a list
; of them) that Asterisk already handles.
;
callerid=bell

View File

@ -1,10 +1,10 @@
;
; Zapata telephony interface
; DAHDI telephony
;
; Configuration file
;
; You need to restart Asterisk to re-configure the Zap channel
; CLI> reload chan_zap.so
; You need to restart Asterisk to re-configure the DAHDI channel
; CLI> reload chan_dahdi.so
; will reload the configuration file,
; but not all configuration options are
; re-configured during a reload (signalling, as well as
@ -30,7 +30,7 @@
; trunkgroup => <trunkgroup>,<dchannel>[,<backup1>...]
;
; trunkgroup is the numerical trunk group to create
; dchannel is the zap channel which will have the
; dchannel is the DAHDI channel which will have the
; d-channel for the trunk.
; backup1 is an optional list of backup d-channels.
;
@ -38,9 +38,9 @@
;trunkgroup => 1,24
;
; Spanmap: Associates a span with a trunk group
; spanmap => <zapspan>,<trunkgroup>[,<logicalspan>]
; spanmap => <dahdispan>,<trunkgroup>[,<logicalspan>]
;
; zapspan is the zap span number to associate
; dahdispan is the DAHDI span number to associate
; trunkgroup is the trunkgroup (specified above) for the mapping
; logicalspan is the logical span number within the trunk group to use.
; if unspecified, no logical span number is used.
@ -208,7 +208,7 @@
; pritimer cannot be changed on a reload.
;
; Signalling method. The default is "auto". Valid values:
; auto: Use the current value from Zaptel.
; auto: Use the current value from DAHDI.
; em: E & M
; em_e1: E & M E1
; em_w: E & M Wink
@ -286,8 +286,8 @@
;
; A variety of timing parameters can be specified as well
; The default values for those are "-1", which is to use the
; compile-time defaults of the Zaptel kernel modules. The timing
; parameters, (with the standard default from Zaptel):
; compile-time defaults of the DAHDI kernel modules. The timing
; parameters, (with the standard default from DAHDI):
;
; prewink: Pre-wink time (default 50ms)
; preflash: Pre-flash time (default 50ms)
@ -364,7 +364,7 @@ usecallerid=yes
; first is the corresponding mailbox, and the second is 1 or 0, indicating if
; there are messages waiting or not.
;
;mwimonitornotify=/usr/local/bin/zapnotify.sh
;mwimonitornotify=/usr/local/bin/dahdinotify.sh
;
; Whether or not to enable call waiting on internal extensions
; With this set to 'yes', busy extensions will hear the call-waiting
@ -450,23 +450,23 @@ callreturn=yes
; Note that when setting the number of taps, the number 256 does not translate
; to 256 ms of echo cancellation. echocancel=256 means 256 / 8 = 32 ms.
;
; Note that if any of your Zaptel cards have hardware echo cancellers,
; Note that if any of your DAHDI cards have hardware echo cancellers,
; then this setting only turns them on and off; numeric settings will
; be treated as "yes". There are no special settings required for
; hardware echo cancellers; when present and enabled in their kernel
; modules, they take precedence over the software echo canceller compiled
; into Zaptel automatically.
; into DAHDI automatically.
;
;
echocancel=yes
;
; As of Zaptel 1.4.8, some Zaptel echo cancellers (software and hardware)
; As of Zaptel 1.4.8, some DAHDI echo cancellers (software and hardware)
; support adjustable parameters; these parameters can be supplied as
; additional options to the 'echocancel' setting. Note that Asterisk
; does not attempt to validate the parameters or their values, so if you
; supply an invalid parameter you will not know the specific reason it
; failed without checking the kernel message log for the error(s)
; put there by Zaptel.
; put there by DAHDI.
;
;echocancel=128,param1=32,param2=0,param3=14
;
@ -478,7 +478,7 @@ echocancelwhenbridged=yes
;
; In some cases, the echo canceller doesn't train quickly enough and there
; is echo at the beginning of the call. Enabling echo training will cause
; Zaptel to briefly mute the channel, send an impulse, and use the impulse
; DAHDI to briefly mute the channel, send an impulse, and use the impulse
; response to pre-train the echo canceller so it can start out with a much
; closer idea of the actual echo. Value may be "yes", "no", or a number of
; milliseconds to delay before training (default = 400)
@ -566,9 +566,9 @@ pickupgroup=1
;
;callerid = asreceived
;
; should we use the caller ID from incoming call on zap transfer?
; should we use the caller ID from incoming call on DAHDI transfer?
;
;useincomingcalleridonzaptransfer = yes
;useincomingcalleridondahditransfer = yes
;
; AMA flags affects the recording of Call Detail Records. If specified
; it may be 'default', 'omit', 'billing', or 'documentation'.
@ -665,14 +665,14 @@ pickupgroup=1
;progzone=uk
;
; Set the tonezone. Equivalent of the defaultzone settings in
; /etc/zaptel.conf . This sets the tone zone by number.
; Note that you'd still need to load tonezones (loadzone in zaptel.conf).
; /etc/dahdi.conf . This sets the tone zone by number.
; Note that you'd still need to load tonezones (loadzone in dahdi.conf).
; The default is -1: not to set anything.
;tonezone = 0 ; 0 is US
;
; FXO (FXS signalled) devices must have a timeout to determine if there was a
; hangup before the line was answered. This value can be tweaked to shorten
; how long it takes before Zap considers a non-ringing line to have hungup.
; how long it takes before DAHDI considers a non-ringing line to have hungup.
;
; ringtimeout will not update on a reload.
;
@ -708,7 +708,7 @@ pickupgroup=1
;mohsuggest=default
;
; PRI channels can have an idle extension and a minunused number. So long as
; at least "minunused" channels are idle, chan_zap will try to call "idledial"
; at least "minunused" channels are idle, chan_dahdi will try to call "idledial"
; on them, and then dump them into the PBX in the "idleext" extension (which
; is of the form exten@context). When channels are needed the "idle" calls
; are disconnected (so long as there are at least "minidle" calls still
@ -724,17 +724,17 @@ pickupgroup=1
;minunused=2
;minidle=1
;
; Configure jitter buffers in Zapata (each one is 20ms, default is 4)
; Configure jitter buffers in DAHDI (each one is 20ms, default is 4)
; This is set globally, rather than per-channel.
;
;jitterbuffers=4
;
;------------------------------ JITTER BUFFER CONFIGURATION --------------------------
; jbenable = yes ; Enables the use of a jitterbuffer on the receiving side of a
; ZAP channel. Defaults to "no". An enabled jitterbuffer will
; DAHDI channel. Defaults to "no". An enabled jitterbuffer will
; be used only if the sending side can create and the receiving
; side can not accept jitter. The ZAP channel can't accept jitter,
; thus an enabled jitterbuffer on the receive ZAP side will always
; side can not accept jitter. The DAHDI channel can't accept jitter,
; thus an enabled jitterbuffer on the receive DAHDI side will always
; be used if the sending side can create jitter.
; jbmaxsize = 200 ; Max length of the jitterbuffer in milliseconds.
@ -744,7 +744,7 @@ pickupgroup=1
; big jumps in/broken timestamps, usually sent from exotic devices
; and programs. Defaults to 1000.
; jbimpl = fixed ; Jitterbuffer implementation, used on the receiving side of a ZAP
; jbimpl = fixed ; Jitterbuffer implementation, used on the receiving side of a DAHDI
; channel. Two implementations are currently available - "fixed"
; (with size always equals to jbmax-size) and "adaptive" (with
; variable size, actually the new jb of IAX2). Defaults to fixed.
@ -928,15 +928,15 @@ pickupgroup=1
; Configuration Sections
; ~~~~~~~~~~~~~~~~~~~~~~
; You can also configure channels in a separate zapata.conf section. In
; You can also configure channels in a separate dahdi.conf section. In
; this case the keyword 'channel' is not used. Instead the keyword
; 'zapchan' is used (as in users.conf) - configuration is only processed
; in a section where the keyword zapchan is used. It will only be
; 'dahdichan' is used (as in users.conf) - configuration is only processed
; in a section where the keyword dahdichan is used. It will only be
; processed in the end of the section. Thus the following section:
;
;[phones]
;echocancel = 64
;zapchan = 1-8
;dahdichan = 1-8
;group = 1
;
; Is somewhat equivalent to the following snippet in the section
@ -948,7 +948,7 @@ pickupgroup=1
;
; When starting a new section almost all of the configuration values are
; copied from their values at the end of the section [channels] in
; zapata.conf and [general] in users.conf - one section's configuration
; dahdi.conf and [general] in users.conf - one section's configuration
; does not affect another one's.
;
; Instead of letting common configuration values "slide through" you can
@ -966,16 +966,16 @@ pickupgroup=1
;faxdetect = incoming
;
;[phone-1](phones)
;zapchan = 1
;dahdichan = 1
;callerid = My Name <501>
;mailbox = 501@mailboxes
;
;
;[fax](phones)
;zapchan = 2
;dahdichan = 2
;faxdetect = no
;context = fax
;
;[phone-3](phones)
;zapchan = 3
;dahdichan = 3
;pickupgroup = 3,4

3261
configure vendored

File diff suppressed because it is too large Load Diff

View File

@ -207,6 +207,7 @@ AST_EXT_LIB_SETUP([CAP], [POSIX 1.e capabilities], [cap])
AST_EXT_LIB_SETUP([CURL], [cURL], [curl])
AST_EXT_LIB_SETUP([CURSES], [curses], [curses])
AST_EXT_LIB_SETUP([CRYPTO], [OpenSSL Cryptography support], [crypto])
AST_EXT_LIB_SETUP([DAHDI], [DAHDI], [dahdi])
AST_EXT_LIB_SETUP([FFMPEG], [Ffmpeg and avcodec library], [avcodec])
AST_EXT_LIB_SETUP([GSM], [External GSM library], [gsm], [, use 'internal' GSM otherwise])
AST_EXT_LIB_SETUP([GTK], [gtk libraries], [gtk])
@ -257,7 +258,6 @@ AST_EXT_LIB_SETUP([VORBIS], [Vorbis], [vorbis])
AST_EXT_LIB_SETUP([VPB], [Voicetronix API], [vpb])
AST_EXT_LIB_SETUP([X11], [X11 support], [x11])
AST_EXT_LIB_SETUP([ZLIB], [zlib], [z])
AST_EXT_LIB_SETUP([ZAPTEL], [Zaptel], [zaptel])
# check for basic system features and functionality before
# checking for package libraries
@ -552,6 +552,8 @@ if test "x${host_os}" = "xlinux-gnu" ; then
AST_EXT_LIB_CHECK([CAP], [cap], [cap_from_text], [sys/capability.h])
fi
AST_C_DEFINE_CHECK([DAHDI], [DAHDI_CODE], [dahdi/user.h])
# BSD might not have exp2, and/or log2
AST_EXT_LIB_CHECK([EXP2L], [m], [exp2l])
AST_EXT_LIB_CHECK([LOG2L], [m], [log2l])
@ -1424,9 +1426,7 @@ if test "${host_os}" != "linux-gnu" ; then
fi
# new tonezone, version 1.4.0
AST_EXT_LIB_CHECK([TONEZONE], [tonezone], [tone_zone_find], [zaptel/tonezone.h], [${tonezone_extra}], [], [140])
# other case, old tonezone (0.80)
AST_EXT_LIB_CHECK([TONEZONE], [tonezone], [tone_zone_find], [zaptel/zaptel.h], [${tonezone_extra}], [], [80])
AST_EXT_LIB_CHECK([TONEZONE], [tonezone], [tone_zone_find], [dahdi/tonezone.h], [${tonezone_extra}])
AST_EXT_LIB_CHECK([USB], [usb], [usb_init], [usb.h], [])
@ -1478,47 +1478,6 @@ AC_LANG_POP
AST_EXT_LIB_CHECK([ZLIB], [z], [compress], [zlib.h])
# Check for various zaptel features and locations.
# The version number, which goes into HAVE_ZAPTEL_VERSION,
# will be used in the system headers to determine the location
# of the zaptel.h header.
AST_C_DEFINE_CHECK([ZAPTEL], [ZT_TONE_DTMF_BASE], [zaptel/zaptel.h], [140])
AST_C_DEFINE_CHECK([ZAPTEL], [ZT_DIAL_OP_CANCEL], [zaptel/zaptel.h], [90])
# Check for VLDTMF support
AST_C_DEFINE_CHECK([ZAPTEL_VLDTMF], [ZT_EVENT_REMOVED], [zaptel/zaptel.h])
# Check for echo canceler parameters support
AST_C_DEFINE_CHECK([ZAPTEL_ECHOCANPARAMS], [ZT_ECHOCANCEL_PARAMS], [zaptel/zaptel.h])
# Check for transcoder support
AST_C_DEFINE_CHECK([ZAPTEL_TRANSCODE], [ZT_TCOP_ALLOCATE], [zaptel/zaptel.h])
# Check for hwgain support
AST_C_DEFINE_CHECK([ZAPTEL_HWGAIN], [ZT_SET_HWGAIN], [zaptel/zaptel.h])
# Check for neon mwi support
AST_C_DEFINE_CHECK([ZAPTEL_NEONMWI], [ZT_EVENT_NEONMWI_ACTIVE], [zaptel/zaptel.h])
# Check for channel alarm support
AST_C_COMPILE_CHECK([ZAPTEL_CHANALARMS], [size_t foo = sizeof(struct zt_params_v1)], [zaptel/zaptel.h])
# Check for ZT_SIG_MTP2
AST_C_DEFINE_CHECK([ZAPTEL_SIG_MTP2], [ZT_SIG_MTP2], [zaptel/zaptel.h])
# On FreeBSD, try old zaptel (0.80 or so) and pretend we have vldtmf
case "${host_os}" in
freebsd*)
AST_EXT_LIB_CHECK([ZAPTEL], [zaptel],, [zaptel.h],,, [80])
AST_EXT_LIB_CHECK([ZAPTEL_VLDTMF], [zaptel],, [zaptel/zaptel.h],,, [90])
AST_EXT_LIB_CHECK([ZAPTEL_VLDTMF], [zaptel],, [zaptel.h],,, [80])
# other case, old tonezone (0.80)
AST_EXT_LIB_CHECK([TONEZONE], [tonezone], [tone_zone_find], [zaptel.h], [${tonezone_extra}],, [80])
;;
esac
EDITLINE_LIB=""
if test "x$TERMCAP_LIB" != "x" ; then
EDITLINE_LIB="$TERMCAP_LIB"

View File

@ -168,12 +168,12 @@ case "$1" in
;;
fullrestart)
$0 stop
service zaptel restart
service dahdi restart
$0 start
;;
fullrestartnow)
$0 stopnow
service zaptel restart
service dahdi restart
$0 start
;;
status)

View File

@ -1,11 +1,11 @@
#!/bin/sh
#
# zaptel: Loads Asterisk modules
# DAHDI: Loads Asterisk modules
#
# Version: @(#) /etc/rc.d/init.d/zaptel 1.0
# Version: @(#) /etc/rc.d/init.d/dahdi 1.0
#
# chkconfig: 2345 90 10
# description: Loads and unloads zaptel modules at boot time and shutdown.
# description: Loads and unloads DAHDI modules at boot time and shutdown.
#
# hide: true
@ -14,12 +14,12 @@
# Source function library.
. /etc/rc.d/init.d/functions
# Default modules - override in /etc/sysconfig/zaptel
# Default modules - override in /etc/sysconfig/dahdi
######################################
MODULES="usb-uhci zaptel wcfxo wcusb"
MODULES="usb-uhci dahdi wcfxo wcusb"
######################################
# Resolve back to the basename (i.e. zaptel, not S90zaptel)
# Resolve back to the basename (i.e. dahdi, not S90dahdi)
if [ 0`readlink $0` = "0" ]; then
CONFIGFILE=/etc/sysconfig/`basename $0`
else

View File

@ -22,11 +22,11 @@
### BEGIN INIT INFO
# Provides: asterisk
# Required-Start: +zaptel $network $named
# Required-Start: +dahdi $network $named
# Required-Stop:
# Default-Start: 3 5
# Default-Stop: 0 1 2 4 6
# Description: zaptel - zaptel modules for Asterisk
# Description: dahdi - dahdi modules for Asterisk
### END INIT INFO
# Source function library.

View File

@ -101,9 +101,9 @@ if [ "$ans" = "y" ]; then
echo >> $OUTPUT;
echo "------------------" >> $OUTPUT;
echo "ZAPTEL MODULE INFO" >> $OUTPUT;
echo "DAHDI MODULE INFO" >> $OUTPUT;
echo "------------------" >> $OUTPUT;
modinfo /lib/modules/$(uname -r)/misc/*.ko >> $OUTPUT;
modinfo /lib/modules/$(uname -r)/dahdi/*.ko >> $OUTPUT;
echo >> $OUTPUT;
echo >> $OUTPUT;
@ -149,17 +149,18 @@ if [ "$ans" = "y" ]; then
echo >> $OUTPUT;
echo >> $OUTPUT;
#jpeeler: REVISIT
echo "------------------" >> $OUTPUT;
echo "ZAPTEL CONFIG" >> $OUTPUT;
echo "------------------" >> $OUTPUT;
grep -v '^#' /etc/zaptel.conf >> $OUTPUT;
grep -v '^#' /etc/dahdi.conf >> $OUTPUT;
echo >> $OUTPUT;
echo >> $OUTPUT;
echo "------------------" >> $OUTPUT;
echo "ZAPATA CONFIG" >> $OUTPUT;
echo "------------------" >> $OUTPUT;
grep -v '^;' /etc/asterisk/zapata.conf >> $OUTPUT;
grep -v '^;' /etc/asterisk/chan_dahdi.conf >> $OUTPUT;
echo >> $OUTPUT;
echo >> $OUTPUT;

View File

@ -8,7 +8,7 @@
#
# Create a (huge) bunch of call files to dial via pbx_spool.
# Defaults are selected with 'Enter' and, if all defaults
# are selected, you'll dial Zap/1/s into default|s|1
# are selected, you'll dial DAHDI/1/s into default|s|1
#
@ -98,8 +98,8 @@ Account: $::account
}
# prompt the user for some info
get technology "Zap" "\nEnter technology type
Zap, IAX, SIP, etc."
get technology "DAHDI" "\nEnter technology type
DAHDI, IAX, SIP, etc."
get chans "1" "\nEnter channel(s) or group to test in formats like
2\n1-4\n3 5 7 9\n1-23,25-47,49-71,73-95\ng4\ng2,g1"
set channels [splitchans $chans]

View File

@ -30,7 +30,7 @@
void print_tone_zone_sound(struct ind_tone_zone *zone_data, const char* name,
int toneid) {
int i;
for (i=0; i<ZT_TONE_MAX; i++) {
for (i=0; i<DAHDI_TONE_MAX; i++) {
if (zone_data->tones[i].toneid == toneid){
printf("%s = %s\n", name, zone_data->tones[i].data);
break;
@ -61,15 +61,15 @@ void print_indications(struct ind_tone_zone *zone_data) {
}
putchar('\n');
print_tone_zone_sound(zone_data, "dial", ZT_TONE_DIALTONE);
print_tone_zone_sound(zone_data, "busy", ZT_TONE_BUSY);
print_tone_zone_sound(zone_data, "ring", ZT_TONE_RINGTONE);
print_tone_zone_sound(zone_data, "congestion", ZT_TONE_CONGESTION);
print_tone_zone_sound(zone_data, "callwaiting", ZT_TONE_CALLWAIT);
print_tone_zone_sound(zone_data, "dialrecall", ZT_TONE_DIALRECALL);
print_tone_zone_sound(zone_data, "record", ZT_TONE_RECORDTONE);
print_tone_zone_sound(zone_data, "info", ZT_TONE_INFO);
print_tone_zone_sound(zone_data, "stutter", ZT_TONE_STUTTER);
print_tone_zone_sound(zone_data, "dial", DAHDI_TONE_DIALTONE);
print_tone_zone_sound(zone_data, "busy", DAHDI_TONE_BUSY);
print_tone_zone_sound(zone_data, "ring", DAHDI_TONE_RINGTONE);
print_tone_zone_sound(zone_data, "congestion", DAHDI_TONE_CONGESTION);
print_tone_zone_sound(zone_data, "callwaiting", DAHDI_TONE_CALLWAIT);
print_tone_zone_sound(zone_data, "dialrecall", DAHDI_TONE_DIALRECALL);
print_tone_zone_sound(zone_data, "record", DAHDI_TONE_RECORDTONE);
print_tone_zone_sound(zone_data, "info", DAHDI_TONE_INFO);
print_tone_zone_sound(zone_data, "stutter", DAHDI_TONE_STUTTER);
printf("\n\n");
}

View File

@ -122,10 +122,10 @@ Allows to specify the socket file to be used to connect to the
Asterisk console. Used in conjunction with \fB-r\fR or \fB-R\fR.
.TP
\fB-I\fR
Enable internal timing if Zaptel timer is available
Enable internal timing if DAHDI timer is available
The default behaviour is that outbound packets are phase locked
to inbound packets. Enabling this switch causes them to be
locked to the internal Zaptel timer instead.
locked to the internal DAHDI timer instead.
.TP
\fB-t\fR
When recording files, write them first into a temporary holding directory,

View File

@ -157,10 +157,10 @@
<term>-I</term>
<listitem>
<para>
Enable internal timing if Zaptel timing is available.
Enable internal timing if DAHDI timing is available.
The default behaviour is that outbound packets are phase locked
to inbound packets. Enabling this switch causes them to be
locked to the internal Zaptel timer instead.
locked to the internal DAHDI timer instead.
</para>
</listitem>
</varlistentry>

View File

@ -97,7 +97,7 @@ You would see output similar to:
#10 0x000000a0 in ?? ()
#11 0x000000a0 in ?? ()
#12 0x00000000 in ?? ()
#13 0x407513c3 in confcall_careful_stream (conf=0x8180bf8, filename=0x8181de8 "Zap/pseudo-1324221520") at app_meetme.c:262
#13 0x407513c3 in confcall_careful_stream (conf=0x8180bf8, filename=0x8181de8 "DAHDI/pseudo-1324221520") at app_meetme.c:262
#14 0x40751332 in streamconfthread (args=0x8180bf8) at app_meetme.c:1965
#15 0xbcdffbe0 in ?? ()
#16 0x40028e51 in pthread_start_thread () from /lib/libpthread.so.0
@ -135,7 +135,7 @@ No symbol table info available.
No symbol table info available.
#12 0x00000000 in ?? ()
No symbol table info available.
#13 0x407513c3 in confcall_careful_stream (conf=0x8180bf8, filename=0x8181de8 "Zap/pseudo-1324221520") at app_meetme.c:262
#13 0x407513c3 in confcall_careful_stream (conf=0x8180bf8, filename=0x8181de8 "DAHDI/pseudo-1324221520") at app_meetme.c:262
f = (struct ast_frame *) 0x8180bf8
trans = (struct ast_trans_pvt *) 0x0
#14 0x40751332 in streamconfthread (args=0x8180bf8) at app_meetme.c:1965
@ -173,7 +173,7 @@ Thread 1 (process 26252):
#10 0x000000a0 in ?? ()
#11 0x000000a0 in ?? ()
#12 0x00000000 in ?? ()
#13 0x407513c3 in confcall_careful_stream (conf=0x8180bf8, filename=0x8181de8 "Zap/pseudo-1324221520") at app_meetme.c:262
#13 0x407513c3 in confcall_careful_stream (conf=0x8180bf8, filename=0x8181de8 "DAHDI/pseudo-1324221520") at app_meetme.c:262
#14 0x40751332 in streamconfthread (args=0x8180bf8) at app_meetme.c:1965
#15 0xbcdffbe0 in ?? ()
#16 0x40028e51 in pthread_start_thread () from /lib/libpthread.so.0

View File

@ -17,7 +17,7 @@
-- Convert all existing uses of astobj.h to astobj2.h
-- (chan_sip already in progress in a branch)
-- There are many places where large character buffers are allocated in structures. There is a new system for string handling that uses dynamically allocatted memory pools which is documented in include/asterisk/stringfields.h. Examples of where they are currently used are the ast_channel structure defined in include/asterisk/channel.h, some structures in chan_sip.c, and chan_zap.c.
-- There are many places where large character buffers are allocated in structures. There is a new system for string handling that uses dynamically allocatted memory pools which is documented in include/asterisk/stringfields.h. Examples of where they are currently used are the ast_channel structure defined in include/asterisk/channel.h, some structures in chan_sip.c, and chan_dahdi.c.
-- There is a convenient set of macros defined in include/asterisk/linkedlists.h for handling linked lists. However, there are some open-coded lists throughout the code. Converting linked lists to use these macros will make list handling more consistent and reduce the possibility of coding errors.

View File

@ -99,14 +99,14 @@ Changes to manager version 1.1:
- The MeetmeJoin now has caller ID name and Caller ID number fields (like MeetMeLeave)
- Action ZapShowChannels
- Action DAHDIShowChannels
Header changes
- Channel: -> ZapChannel
- Channel: -> DAHDIChannel
For active channels, the Channel: and Uniqueid: headers are added
You can now add a "ZapChannel: " argument to zapshowchannels actions
You can now add a "DAHDIChannel: " argument to DAHDIshowchannels actions
to only get information about one channel.
- Event ZapShowChannelsComplete
- Event DAHDIShowChannelsComplete
New header
- (new) -> Items: Reports number of channels reported

View File

@ -25,7 +25,7 @@ Revision History 3
3.1.1 Build Asterisk with OSP Toolkit 8
3.1.2 osp.conf 8
3.1.3 extensions.conf 10
3.1.4 zapata/sip/iax/h323/ooh323.conf 13
3.1.4 dahdi/sip/iax/h323/ooh323.conf 13
3.2 OSP Dial Plan Functions 13
3.2.1 OSPAuth 13
3.2.2 OSPLookup 14
@ -447,7 +447,7 @@ exten => s,300,GoTo(1000)
; --------------------------------------------------------------
exten => s,1000,MacroExit
3.1.4 zapata/sip/iax/h323/ooh323.conf
3.1.4 dahdi/sip/iax/h323/ooh323.conf
There is no configuration required for OSP.
3.2 OSP Dial Plan Functions

View File

@ -5,7 +5,7 @@ message centres using ETSI ES 201 912 protocol 1 FSK messaging over analog calls
Basically it allows sending and receiving of text messages over the PSTN. It is
compatible with BT Text service in the UK and works on ISDN and PSTN lines. It is
designed to connect to an ISDN or zap interface directly and uses FSK so would
designed to connect to an ISDN or DAHDI interface directly and uses FSK so would
probably not work over any sort of compressed link (like a VoIP call using GSM codec).
Typical applications include:-

View File

@ -31,6 +31,7 @@ is how to check them out from the public subversion server.
These are the commands you would type to install them:
#jpeeler: REVISIT
`svn co http://svn.digium.com/svn/zaptel/branches/1.4 zaptel-1.4`
`cd zaptel-1.4`
`make; make install`

View File

@ -44,10 +44,10 @@ as well as the Expression syntax, and the Variable syntax.
\section{Asterisk in a Nutshell}
Asterisk acts as a server. Devices involved in telephony, like Zapata
Asterisk acts as a server. Devices involved in telephony, like DAHDI
cards, or Voip phones, all indicate some context that should be
activated in their behalf. See the config file formats for IAX, SIP,
zapata.conf, etc. They all help describe a device, and they all
dahdi.conf, etc. They all help describe a device, and they all
specify a context to activate when somebody picks up a phone, or a
call comes in from the phone company, or a voip phone, etc.
@ -707,7 +707,7 @@ Global variables are set in their own block.
\begin{verbatim}
globals {
CONSOLE=Console/dsp;
TRUNK=Zap/g2;
TRUNK=DAHDI/g2;
}
\end{verbatim}
\end{astlisting}

View File

@ -151,7 +151,7 @@ exten = _X./_80058752[0-8]0,1,Goto(smsmtrx,${EXTEN}-${CALLERID(num):8:1},1)
\end{astlisting}
Alternatively, if you have the correct national prefix on incoming
CLI, e.g. using zaphfc, you might use:
CLI, e.g. using dahdi_hfc, you might use:
\begin{astlisting}
\begin{verbatim}
exten = _X./08005875290,1,Goto(smsmtrx,${EXTEN},1)

View File

@ -111,7 +111,7 @@ You would see output similar to:
#10 0x000000a0 in ?? ()
#11 0x000000a0 in ?? ()
#12 0x00000000 in ?? ()
#13 0x407513c3 in confcall_careful_stream (conf=0x8180bf8, filename=0x8181de8 "Zap/pseudo-1324221520") at app_meetme.c:262
#13 0x407513c3 in confcall_careful_stream (conf=0x8180bf8, filename=0x8181de8 "DAHDI/pseudo-1324221520") at app_meetme.c:262
#14 0x40751332 in streamconfthread (args=0x8180bf8) at app_meetme.c:1965
#15 0xbcdffbe0 in ?? ()
#16 0x40028e51 in pthread_start_thread () from /lib/libpthread.so.0
@ -152,7 +152,7 @@ No symbol table info available.
No symbol table info available.
#12 0x00000000 in ?? ()
No symbol table info available.
#13 0x407513c3 in confcall_careful_stream (conf=0x8180bf8, filename=0x8181de8 "Zap/pseudo-1324221520") at app_meetme.c:262
#13 0x407513c3 in confcall_careful_stream (conf=0x8180bf8, filename=0x8181de8 "DAHDI/pseudo-1324221520") at app_meetme.c:262
f = (struct ast_frame *) 0x8180bf8
trans = (struct ast_trans_pvt *) 0x0
#14 0x40751332 in streamconfthread (args=0x8180bf8) at app_meetme.c:1965
@ -194,7 +194,7 @@ Thread 1 (process 26252):
#10 0x000000a0 in ?? ()
#11 0x000000a0 in ?? ()
#12 0x00000000 in ?? ()
#13 0x407513c3 in confcall_careful_stream (conf=0x8180bf8, filename=0x8181de8 "Zap/pseudo-1324221520") at app_meetme.c:262
#13 0x407513c3 in confcall_careful_stream (conf=0x8180bf8, filename=0x8181de8 "DAHDI/pseudo-1324221520") at app_meetme.c:262
#14 0x40751332 in streamconfthread (args=0x8180bf8) at app_meetme.c:1965
#15 0xbcdffbe0 in ?? ()
#16 0x40028e51 in pthread_start_thread () from /lib/libpthread.so.0

View File

@ -871,7 +871,7 @@ ${MEETME_RECORDINGFILE} Name of file for recording a conference with
the "r" option
${MEETME_RECORDINGFORMAT} Format of file to be recorded
${MEETME_EXIT_CONTEXT} Context for exit out of meetme meeting
${MEETME_AGI_BACKGROUND} AGI script for Meetme (zap only)
${MEETME_AGI_BACKGROUND} AGI script for Meetme (DAHDI only)
${MEETMESECS} * Number of seconds a user participated in a MeetMe conference
${CONF_LIMIT_TIMEOUT_FILE} File to play when time is up. Used with the L() option.
${CONF_LIMIT_WARNING_FILE} File to play as warning if 'y' is defined.
@ -903,7 +903,7 @@ ${DUNDTECH} * The Technology of the result from a call to DUNDiLookup()
${DUNDDEST} * The Destination of the result from a call to DUNDiLookup()
\end{verbatim}
\subsection{chan\_zap}
\subsection{chan\_dahdi}
\begin{verbatim}
${ANI2} * The ANI2 Code provided by the network on the incoming call.
(ie, Code 29 identifies call as a Prison/Inmate Call)

View File

@ -20,7 +20,7 @@ Asterisk configuration files are defined as follows:
\end{verbatim}
\end{astlisting}
In some files, (e.g. mgcp.conf, zapata.conf and agents.conf), the syntax
In some files, (e.g. mgcp.conf, dahdi.conf and agents.conf), the syntax
is a bit different. In these files the syntax is as follows:
\begin{astlisting}

View File

@ -286,7 +286,7 @@ ENUMLOOKUP function calls.
;
exten => _011.,1,Set(enumresult=${ENUMLOOKUP(+${EXTEN:3})})
exten => _011.,n,Dial(SIP/${enumresult})
exten => _011.,n,Dial(Zap/g1/${EXTEN})
exten => _011.,n,Dial(DAHDI/g1/${EXTEN})
;
; end example 1
@ -302,7 +302,7 @@ exten => _011.,n,While($["${counter}"<"${sipcount}"])
exten => _011.,n,Set(counter=$[${counter}+1])
exten => _011.,n,Dial(SIP/${ENUMLOOKUP(+${EXTEN:3},sip,,${counter})})
exten => _011.,n,EndWhile
exten => _011.,n,Dial(Zap/g1/${EXTEN})
exten => _011.,n,Dial(DAHDI/g1/${EXTEN})
;
; end example 2
@ -312,7 +312,7 @@ exten => _011.,n,Dial(Zap/g1/${EXTEN})
; 14102241145 or 437203001721)
; Search through e164.arpa and then also search through e164.org
; to see if there are any valid SIP or IAX termination capabilities.
; If none, send call out via Zap channel 1.
; If none, send call out via DAHDI channel 1.
;
; Start first with e164.arpa zone...
;
@ -346,8 +346,8 @@ exten => _X.,21,GotoIf($["${counter}"<"${iaxcount}"]?19:22)
;
; ...then send out PRI.
;
exten => _X.,22,NoOp("No valid entries in e164.org for ${EXTEN} - sending out via Zap")
exten => _X.,23,Dial(Zap/g1/${EXTEN})
exten => _X.,22,NoOp("No valid entries in e164.org for ${EXTEN} - sending out via DAHDI")
exten => _X.,23,Dial(DAHDI/g1/${EXTEN})
;
; end example 3

View File

@ -4,12 +4,12 @@ A PBX is only really useful if you can get calls into it. Of course, you
can use Asterisk with VoIP calls (SIP, H.323, IAX, etc.), but you can also
talk to the real PSTN through various cards.
Supported Hardware is divided into two general groups: Zaptel devices and
non-zaptel devices. The Zaptel compatible hardware supports pseudo-TDM
conferencing and all call features through chan\_zap, whereas non-zaptel
Supported Hardware is divided into two general groups: DAHDI devices and
non-DAHDI devices. The DAHDI compatible hardware supports pseudo-TDM
conferencing and all call features through chan\_dahdi, whereas non-DAHDI
compatible hardware may have different features.
\subsection{Zaptel compatible hardware}
\subsection{DAHDI compatible hardware}
\begin{itemize}
\item Digium, Inc. (Primary Developer of Asterisk)
@ -37,7 +37,7 @@ compatible hardware may have different features.
\end{itemize}
\end{itemize}
\subsection{Non-zaptel compatible hardware}
\subsection{Non-DAHDI compatible hardware}
\begin{itemize}
\item QuickNet, Inc.

View File

@ -61,10 +61,10 @@ exten => s,4,Hangup
exten => 200,1,Dial(sip/blah)
exten => 200,102,VoiceMail(${EXTEN}@default)
exten => 201,1,Dial(zap/1)
exten => 201,1,Dial(DAHDI/1)
exten => 201,102,VoiceMail(${EXTEN}@default)
exten => _0.,1,Dial(Zap/g1/${EXTEN:1}) ; outgoing calls with 0+number
exten => _0.,1,Dial(DAHDI/g1/${EXTEN:1}) ; outgoing calls with 0+number
\end{verbatim}
\end{astlisting}

View File

@ -99,7 +99,7 @@ Redirect with ExtraChannel:
\begin{verbatim}
Action: Redirect
Channel: Zap/1-1
Channel: DAHDI/1-1
ExtraChannel: SIP/3064-7e00 (varies)
Exten: 680
Priority: 1
@ -147,7 +147,7 @@ the mailing list archives and the documentation page on the
Channel: <dialstring> -- Dialstring in Originate
Channel: <tech/[peer/username]> -- Channel in Registry events (SIP, IAX2)
Channel: <tech> -- Technology (SIP/IAX2 etc) in Registry events
ChannelType: -- Tech: SIP, IAX2, ZAP, MGCP etc
ChannelType: -- Tech: SIP, IAX2, DAHDI, MGCP etc
Channel1: -- Link channel 1
Channel2: -- Link channel 2
ChanObjectType: -- "peer", "user"

View File

@ -169,11 +169,11 @@ There are some variations, and these will be explained in due course.
To use these options, set your Dial to something like:
\begin{astlisting}
\begin{verbatim}
exten => 3,3,Dial(Zap/5r3&Zap/6r3,35,tmPA(beep))
exten => 3,3,Dial(DAHDI/5r3&DAHDI/6r3,35,tmPA(beep))
or
exten => 3,3,Dial(Zap/5r3&Zap/6r3,35,tmP(something)A(beep))
exten => 3,3,Dial(DAHDI/5r3&DAHDI/6r3,35,tmP(something)A(beep))
or
exten => 3,3,Dial(Zap/5r3&Zap/6r3,35,tmpA(beep))
exten => 3,3,Dial(DAHDI/5r3&DAHDI/6r3,35,tmpA(beep))
\end{verbatim}
\end{astlisting}

View File

@ -466,7 +466,7 @@ context agents
In the above, the variables \$\{RAQUEL\}, etc stand for
actual devices to ring that person's
phone (like Zap/37).
phone (like DAHDI/37).
The 8010, 8011, and 8013 extensions are purely for transferring
incoming callers to queues. For instance, a customer service

View File

@ -57,15 +57,15 @@ in the appropriate section. A well designed PBX might look like this:
\begin{astlisting}
\begin{verbatim}
[longdistance]
exten => _91NXXNXXXXXX,1,Dial(Zap/g2/${EXTEN:1})
exten => _91NXXNXXXXXX,1,Dial(DAHDI/g2/${EXTEN:1})
include => local
[local]
exten => _9NXXNXXX,1,Dial(Zap/g2/${EXTEN:1})
exten => _9NXXNXXX,1,Dial(DAHDI/g2/${EXTEN:1})
include => default
[default]
exten => 6123,Dial(Zap/1)
exten => 6123,Dial(DAHDI/1)
\end{verbatim}
\end{astlisting}

View File

@ -23,7 +23,7 @@ IP channels.
An SLA system is built up of virtual trunks and stations mapped to real
Asterisk devices. The configuration for all of this is done in three
different files: extensions.conf, sla.conf, and the channel specific
configuration file such as sip.conf or zapata.conf.
configuration file such as sip.conf or dahdi.conf.
\subsection{Dialplan}
@ -55,21 +55,21 @@ Please refer to the examples section for full dialplan samples for SLA.
An SLA trunk is a mapping between a virtual trunk and a real Asterisk device.
This device may be an analog FXO line, or something like a SIP trunk. A trunk
must be configured in two places. First, configure the device itself in the
channel specific configuration file such as zapata.conf or sip.conf. Once the
channel specific configuration file such as dahdi.conf or sip.conf. Once the
trunk is configured, then map it to an SLA trunk in sla.conf.
\begin{astlisting}
\begin{verbatim}
[line1]
type=trunk
device=Zap/1
device=DAHDI/1
\end{verbatim}
\end{astlisting}
Be sure to configure the trunk's context to be the same one that is set for the
"autocontext" option in sla.conf if automatic dialplan configuration is used.
This would be done in the regular device entry in zapata.conf, sip.conf, etc.
This would be done in the regular device entry in dahdi.conf, sip.conf, etc.
Note that the automatic dialplan generation creates the SLATrunk() extension
at extension 's'. This is perfect for Zap channels that are FXO trunks, for
at extension 's'. This is perfect for DAHDI channels that are FXO trunks, for
example. However, it may not be good enough for an IP trunk, since the call
coming in over the trunk may specify an actual number.
@ -173,12 +173,12 @@ sla.conf:
\begin{verbatim}
[line1]
type=trunk
device=Zap/1
device=DAHDI/1
autocontext=line1
[line2]
type=trunk
device=Zap/2
device=DAHDI/2
autocontext=line2
[station](!)
@ -199,8 +199,8 @@ device=SIP/station3
\end{astlisting}
With this configuration, the dialplan is generated automatically. The first
zap channel should have its context set to "line1" and the second should be
set to "line2" in zapata.conf. In sip.conf, station1, station2, and station3
DAHDI channel should have its context set to "line1" and the second should be
set to "line2" in dahdi.conf. In sip.conf, station1, station2, and station3
should all have their context set to "sla\_stations".
For reference, here is the automatically generated dialplan for this situation:
@ -241,10 +241,10 @@ phone system. The voicemail box number used in this example is 1234, which
would be configured in voicemail.conf.
For this example, assume that there are 2 trunks and 3 stations. The trunks
are Zap/1 and Zap/2. The stations are SIP/station1, SIP/station2, and
are DAHDI/1 and DAHDI/2. The stations are SIP/station1, SIP/station2, and
SIP/station3.
In zapata.conf, channel 1 has context=line1 and channel 2 has context=line2.
In dahdi.conf, channel 1 has context=line1 and channel 2 has context=line2.
In sip.conf, all three stations are configured with context=sla\_stations.
@ -297,12 +297,12 @@ exten => s,2,Macro(slaline,line2)
[line1_outbound]
exten => disa,1,Disa(no-password,line1_outbound)
exten => _1NXXNXXXXXX,1,Dial(Zap/1/${EXTEN})
exten => _1NXXNXXXXXX,1,Dial(DAHDI/1/${EXTEN})
exten => 8500,1,VoicemailMain(1234)
[line2_outbound]
exten => disa,1,Disa(no-password|line2_outbound)
exten => _1NXXNXXXXXX,1,Dial(Zap/2/${EXTEN})
exten => _1NXXNXXXXXX,1,Dial(DAHDI/2/${EXTEN})
exten => 8500,1,VoicemailMain(1234)
[sla_stations]

View File

@ -173,6 +173,12 @@
/* Define to indicate the ${CURSES_DESCRIP} library version */
#undef HAVE_CURSES_VERSION
/* Define if your system has the DAHDI headers. */
#undef HAVE_DAHDI
/* Define DAHDI headers version */
#undef HAVE_DAHDI_VERSION
/* Define to 1 if your system has /dev/urandom. */
#undef HAVE_DEV_URANDOM
@ -1053,54 +1059,6 @@
/* Define to indicate the ${X11_DESCRIP} library version */
#undef HAVE_X11_VERSION
/* Define this to indicate the ${ZAPTEL_DESCRIP} library */
#undef HAVE_ZAPTEL
/* Define if your system has the ZAPTEL_CHANALARMS headers. */
#undef HAVE_ZAPTEL_CHANALARMS
/* Define ZAPTEL_CHANALARMS headers version */
#undef HAVE_ZAPTEL_CHANALARMS_VERSION
/* Define if your system has the ZAPTEL_ECHOCANPARAMS headers. */
#undef HAVE_ZAPTEL_ECHOCANPARAMS
/* Define ZAPTEL_ECHOCANPARAMS headers version */
#undef HAVE_ZAPTEL_ECHOCANPARAMS_VERSION
/* Define if your system has the ZAPTEL_HWGAIN headers. */
#undef HAVE_ZAPTEL_HWGAIN
/* Define ZAPTEL_HWGAIN headers version */
#undef HAVE_ZAPTEL_HWGAIN_VERSION
/* Define if your system has the ZAPTEL_NEONMWI headers. */
#undef HAVE_ZAPTEL_NEONMWI
/* Define ZAPTEL_NEONMWI headers version */
#undef HAVE_ZAPTEL_NEONMWI_VERSION
/* Define if your system has the ZAPTEL_SIG_MTP2 headers. */
#undef HAVE_ZAPTEL_SIG_MTP2
/* Define ZAPTEL_SIG_MTP2 headers version */
#undef HAVE_ZAPTEL_SIG_MTP2_VERSION
/* Define if your system has the ZAPTEL_TRANSCODE headers. */
#undef HAVE_ZAPTEL_TRANSCODE
/* Define ZAPTEL_TRANSCODE headers version */
#undef HAVE_ZAPTEL_TRANSCODE_VERSION
/* Define to indicate the ${ZAPTEL_DESCRIP} library version */
#undef HAVE_ZAPTEL_VERSION
/* Define this to indicate the ${ZAPTEL_VLDTMF_DESCRIP} library */
#undef HAVE_ZAPTEL_VLDTMF
/* Define to indicate the ${ZAPTEL_VLDTMF_DESCRIP} library version */
#undef HAVE_ZAPTEL_VLDTMF_VERSION
/* Define this to indicate the ${ZLIB_DESCRIP} library */
#undef HAVE_ZLIB

View File

@ -28,7 +28,7 @@
A phone call through Asterisk consists of an incoming
connection and an outbound connection. Each call comes
in through a channel driver that supports one technology,
like SIP, ZAP, IAX2 etc.
like SIP, DAHDI, IAX2 etc.
\par
Each channel driver, technology, has it's own private
channel or dialog structure, that is technology-dependent.
@ -92,7 +92,7 @@
them together.
The conference bridge (meetme) handles several channels simultaneously
with the support of an external timer (zaptel timer). This is used
with the support of an external timer (DAHDI timer). This is used
not only by the Conference application (meetme) but also by the
page application and the SLA system introduced in 1.4.
The conference bridge does not handle video.
@ -224,10 +224,10 @@ struct ast_datastore {
*
* SIP and IAX2 has utf8 encoded Unicode caller ID names.
* In some cases, we also have an alternative (RPID) E.164 number that can be used
* as caller ID on numeric E.164 phone networks (zaptel or SIP/IAX2 to pstn gateway).
* as caller ID on numeric E.164 phone networks (DAHDI or SIP/IAX2 to pstn gateway).
*
* \todo Implement settings for transliteration between UTF8 caller ID names in
* to Ascii Caller ID's (Zaptel). Östen Åsklund might be transliterated into
* to Ascii Caller ID's (DAHDI). Östen Åsklund might be transliterated into
* Osten Asklund or Oesten Aasklund depending upon language and person...
* We need automatic routines for incoming calls and static settings for
* our own accounts.
@ -249,7 +249,7 @@ struct ast_callerid {
See for examples:
\arg chan_iax2.c - The Inter-Asterisk exchange protocol
\arg chan_sip.c - The SIP channel driver
\arg chan_zap.c - PSTN connectivity (TDM, PRI, T1/E1, FXO, FXS)
\arg chan_dahdi.c - PSTN connectivity (TDM, PRI, T1/E1, FXO, FXS)
If you develop your own channel driver, this is where you
tell the PBX at registration of your driver what properties
@ -1423,7 +1423,7 @@ int ast_autoservice_start(struct ast_channel *chan);
*/
int ast_autoservice_stop(struct ast_channel *chan);
/* If built with zaptel optimizations, force a scheduled expiration on the
/* If built with dahdi optimizations, force a scheduled expiration on the
timer fd, at which point we call the callback function / data */
int ast_settimeout(struct ast_channel *c, int samples, int (*func)(const void *data), void *data);

View File

@ -18,31 +18,25 @@
*/
/*! \file
* \brief Stub to find zaptel headers
* \brief Stub to find DAHDI headers
*
* Stub to find the zaptel headers. The configure script will
* define HAVE_ZAPTEL_VERSION according to what it has found.
* Applications should include "zapata.h" and not (directly)
* <foo/zaptel.h> or <foo/tonezone.h>.
* Stub to find the DAHDI headers. The configure script will
* define HAVE_DAHDI_VERSION according to what it has found.
* Applications should include "user.h" and not (directly)
* <foo/user.h>
* For the mapping of version numbers to location see below.
*
*/
#ifndef _AST_ZAPATA_H
#define _AST_ZAPATA_H
#ifndef _AST_DAHDI_H
#define _AST_DAHDI_H
#ifdef HAVE_ZAPTEL
#ifdef HAVE_DAHDI
#include <sys/ioctl.h>
#if defined(HAVE_ZAPTEL_VERSION) && HAVE_ZAPTEL_VERSION < 100
/* Very old versions of zaptel drivers on FreeBSD install in ${PREFIX} */
#include <zaptel.h>
#include <tonezone.h>
#else
/* newer versions install in ${PREFIX}/zaptel */
#include <zaptel/zaptel.h>
#include <zaptel/tonezone.h>
#endif /* HAVE_ZAPTEL_VERSION < 100 */
/* newer versions install in ${PREFIX}/dahdi */
#include <dahdi/user.h>
#include <dahdi/tonezone.h>
#endif /* HAVE_ZAPTEL */
#endif /* HAVE_DAHDI */
#endif /* _AST_ZAPATA_H */
#endif /* _AST_DAHDI_H */

View File

@ -225,7 +225,7 @@ DUNDi is not itself a Voice-over IP signaling or media protocol. Instead, it pub
* \arg \link Config_sip SIP configuration \endlink
* \arg \link Config_mgcp MGCP configuration \endlink
* \arg \link Config_rtp RTP configuration \endlink
* \arg \link Config_zap Zaptel configuration \endlink
* \arg \link Config_dahdi DAHDI configuration \endlink
* \arg \link Config_oss OSS (sound card) configuration \endlink
* \arg \link Config_alsa ALSA (sound card) configuration \endlink
* \arg \link Config_agent Agent (proxy channel) configuration \endlink
@ -339,10 +339,10 @@ DUNDi is not itself a Voice-over IP signaling or media protocol. Instead, it pub
* \verbinclude voicemail.conf.sample
*/
/*! \page Config_zap Zaptel configuration
* \section zapconf zapata.conf
* \arg Implemented in \ref chan_zap.c
* \verbinclude zapata.conf.sample
/*! \page Config_dahdi DAHDI configuration
* \section dahdiconf dahdi.conf
* \arg Implemented in \ref chan_dahdi.c
* \verbinclude dahdi.conf.sample
*/
/*! \page Config_h323 H.323 channel driver information

View File

@ -143,7 +143,7 @@ int ast_dsp_init(void);
*
* This is called from ast_frame_free if AST_FRFLAG_FROM_DSP is set. This occurs
* because it is possible for the dsp to be freed while someone still holds a reference
* to the frame that is in that dsp. This has been known to happen when the dsp on a Zap
* to the frame that is in that dsp. This has been known to happen when the dsp on a DAHDI
* channel detects a busy signal. The channel is hung up, and the application that read the
* frame to begin with still has a reference to the frame.
*

View File

@ -29,6 +29,8 @@ extern "C" {
#define AST_CACHE_DIR_LEN 512
#define AST_FILENAME_MAX 80
#define AST_CHANNEL_NAME 80 /*!< Max length of an ast_channel name */
/*! \ingroup main_options */
enum ast_option_flags {
@ -70,7 +72,7 @@ enum ast_option_flags {
AST_OPT_FLAG_DONT_WARN = (1 << 18),
/*! End CDRs before the 'h' extension */
AST_OPT_FLAG_END_CDR_BEFORE_H_EXTEN = (1 << 19),
/*! Use Zaptel Timing for generators if available */
/*! Use DAHDI Timing for generators if available */
AST_OPT_FLAG_INTERNAL_TIMING = (1 << 20),
/*! Always fork, even if verbose or debug settings are non-zero */
AST_OPT_FLAG_ALWAYS_FORK = (1 << 21),
@ -139,6 +141,7 @@ extern struct timeval ast_lastreloadtime;
extern pid_t ast_mainpid;
extern char record_cache_dir[AST_CACHE_DIR_LEN];
extern char dahdi_chan_name[AST_CHANNEL_NAME];
extern int ast_language_is_prefix;

View File

@ -86,7 +86,7 @@ int daemon(int, int); /* defined in libresolv of all places */
#include <sys/loadavg.h>
#endif
#include "asterisk/zapata.h"
#include "asterisk/dahdi.h"
#ifdef linux
#include <sys/prctl.h>
@ -166,6 +166,7 @@ int option_maxfiles; /*!< Max number of open file handles (files, sockets) */
#if defined(HAVE_SYSINFO)
long option_minmemfree; /*!< Minimum amount of free system memory - stop accepting calls if free memory falls below this watermark */
#endif
char dahdi_chan_name[AST_CHANNEL_NAME] = "ZAP";
/*! @} */
@ -2560,7 +2561,7 @@ static int show_cli_help(void) {
printf(" -g Dump core in case of a crash\n");
printf(" -h This help screen\n");
printf(" -i Initialize crypto keys at startup\n");
printf(" -I Enable internal timing if Zaptel timer is available\n");
printf(" -I Enable internal timing if DAHDI timer is available\n");
printf(" -L <load> Limit the maximum load average before rejecting new calls\n");
printf(" -M <value> Limit the maximum number of calls to the specified value\n");
printf(" -m Mute debugging and console output on the console\n");
@ -2781,6 +2782,10 @@ static void ast_readconfig(void)
option_minmemfree = 0;
}
#endif
} else if (!strcasecmp(v->name, "dahdichanname")) {
if (!strcasecmp(v->value, "yes")) {
ast_copy_string(dahdi_chan_name, "DAHDI", sizeof(dahdi_chan_name));
}
} else if (!strcasecmp(v->name, "entityid")) {
struct ast_eid tmp_eid;
if (!ast_str_to_eid(&tmp_eid, v->value)) {
@ -3294,28 +3299,28 @@ int main(int argc, char *argv[])
printf("%s", term_quit());
exit(1);
}
#ifdef HAVE_ZAPTEL
#ifdef HAVE_DAHDI
{
int fd;
int x = 160;
fd = open("/dev/zap/timer", O_RDWR);
fd = open("/dev/dahdi/timer", O_RDWR);
if (fd >= 0) {
if (ioctl(fd, ZT_TIMERCONFIG, &x)) {
ast_log(LOG_ERROR, "You have Zaptel built and drivers loaded, but the Zaptel timer test failed to set ZT_TIMERCONFIG to %d.\n", x);
if (ioctl(fd, DAHDI_TIMERCONFIG, &x)) {
ast_log(LOG_ERROR, "You have DAHDI built and drivers loaded, but the DAHDI timer test failed to set DAHDI_TIMERCONFIG to %d.\n", x);
exit(1);
}
if ((x = ast_wait_for_input(fd, 300)) < 0) {
ast_log(LOG_ERROR, "You have Zaptel built and drivers loaded, but the Zaptel timer could not be polled during the Zaptel timer test.\n");
ast_log(LOG_ERROR, "You have DAHDI built and drivers loaded, but the DAHDI timer could not be polled during the DAHDI timer test.\n");
exit(1);
}
if (!x) {
const char zaptel_timer_error[] = {
"Asterisk has detected a problem with your Zaptel configuration and will shutdown for your protection. You have options:"
"\n\t1. You only have to compile Zaptel support into Asterisk if you need it. One option is to recompile without Zaptel support."
"\n\t2. You only have to load Zaptel drivers if you want to take advantage of Zaptel services. One option is to unload zaptel modules if you don't need them."
"\n\t3. If you need Zaptel services, you must correctly configure Zaptel."
const char dahdi_timer_error[] = {
"Asterisk has detected a problem with your DAHDI configuration and will shutdown for your protection. You have options:"
"\n\t1. You only have to compile DAHDI support into Asterisk if you need it. One option is to recompile without DAHDI support."
"\n\t2. You only have to load DAHDI drivers if you want to take advantage of DAHDI services. One option is to unload DAHDI modules if you don't need them."
"\n\t3. If you need DAHDI services, you must correctly configure DAHDI."
};
ast_log(LOG_ERROR, "%s\n", zaptel_timer_error);
ast_log(LOG_ERROR, "%s\n", dahdi_timer_error);
usleep(100);
exit(1);
}

View File

@ -34,7 +34,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
#include <math.h>
#include "asterisk/paths.h" /* use ast_config_AST_SYSTEM_NAME */
#include "asterisk/zapata.h"
#include "asterisk/dahdi.h"
#include "asterisk/pbx.h"
#include "asterisk/frame.h"
@ -808,13 +808,13 @@ struct ast_channel *ast_channel_alloc(int needqueue, int state, const char *cid_
#endif
}
#ifdef HAVE_ZAPTEL
tmp->timingfd = open("/dev/zap/timer", O_RDWR);
#ifdef HAVE_DAHDI
tmp->timingfd = open("/dev/dahdi/timer", O_RDWR);
if (tmp->timingfd > -1) {
/* Check if timing interface supports new
ping/pong scheme */
flags = 1;
if (!ioctl(tmp->timingfd, ZT_TIMERPONG, &flags))
if (!ioctl(tmp->timingfd, DAHDI_TIMERPONG, &flags))
needqueue = 0;
}
#else
@ -825,7 +825,7 @@ struct ast_channel *ast_channel_alloc(int needqueue, int state, const char *cid_
if (pipe(tmp->alertpipe)) {
ast_log(LOG_WARNING, "Channel allocation failed: Can't create alert pipe!\n");
alertpipe_failed:
#ifdef HAVE_ZAPTEL
#ifdef HAVE_DAHDI
if (tmp->timingfd > -1)
close(tmp->timingfd);
#endif
@ -1007,9 +1007,9 @@ int ast_queue_frame(struct ast_channel *chan, struct ast_frame *fin)
if (write(chan->alertpipe[1], &blah, sizeof(blah)) != sizeof(blah))
ast_log(LOG_WARNING, "Unable to write to alert pipe on %s, frametype/subclass %d/%d (qlen = %d): %s!\n",
chan->name, f->frametype, f->subclass, qlen, strerror(errno));
#ifdef HAVE_ZAPTEL
#ifdef HAVE_DAHDI
} else if (chan->timingfd > -1) {
ioctl(chan->timingfd, ZT_TIMERPING, &blah);
ioctl(chan->timingfd, DAHDI_TIMERPING, &blah);
#endif
} else if (ast_test_flag(chan, AST_FLAG_BLOCKING)) {
pthread_kill(chan->blocker, SIGURG);
@ -2184,14 +2184,14 @@ int ast_waitfordigit(struct ast_channel *c, int ms)
int ast_settimeout(struct ast_channel *c, int samples, int (*func)(const void *data), void *data)
{
int res = -1;
#ifdef HAVE_ZAPTEL
#ifdef HAVE_DAHDI
if (c->timingfd > -1) {
if (!func) {
samples = 0;
data = 0;
}
ast_debug(1, "Scheduling timer at %d sample intervals\n", samples);
res = ioctl(c->timingfd, ZT_TIMERCONFIG, &samples);
res = ioctl(c->timingfd, DAHDI_TIMERCONFIG, &samples);
c->timingfunc = func;
c->timingdata = data;
}
@ -2411,26 +2411,26 @@ static struct ast_frame *__ast_read(struct ast_channel *chan, int dropaudio)
read(chan->alertpipe[0], &blah, sizeof(blah));
}
#ifdef HAVE_ZAPTEL
#ifdef HAVE_DAHDI
if (chan->timingfd > -1 && chan->fdno == AST_TIMING_FD && ast_test_flag(chan, AST_FLAG_EXCEPTION)) {
int res;
ast_clear_flag(chan, AST_FLAG_EXCEPTION);
blah = -1;
/* IF we can't get event, assume it's an expired as-per the old interface */
res = ioctl(chan->timingfd, ZT_GETEVENT, &blah);
res = ioctl(chan->timingfd, DAHDI_GETEVENT, &blah);
if (res)
blah = ZT_EVENT_TIMER_EXPIRED;
blah = DAHDI_EVENT_TIMER_EXPIRED;
if (blah == ZT_EVENT_TIMER_PING) {
if (blah == DAHDI_EVENT_TIMER_PING) {
if (AST_LIST_EMPTY(&chan->readq) || !AST_LIST_NEXT(AST_LIST_FIRST(&chan->readq), frame_list)) {
/* Acknowledge PONG unless we need it again */
if (ioctl(chan->timingfd, ZT_TIMERPONG, &blah)) {
if (ioctl(chan->timingfd, DAHDI_TIMERPONG, &blah)) {
ast_log(LOG_WARNING, "Failed to pong timer on '%s': %s\n", chan->name, strerror(errno));
}
}
} else if (blah == ZT_EVENT_TIMER_EXPIRED) {
ioctl(chan->timingfd, ZT_TIMERACK, &blah);
} else if (blah == DAHDI_EVENT_TIMER_EXPIRED) {
ioctl(chan->timingfd, DAHDI_TIMERACK, &blah);
if (chan->timingfunc) {
/* save a copy of func/data before unlocking the channel */
int (*func)(const void *) = chan->timingfunc;
@ -2439,7 +2439,7 @@ static struct ast_frame *__ast_read(struct ast_channel *chan, int dropaudio)
func(data);
} else {
blah = 0;
ioctl(chan->timingfd, ZT_TIMERCONFIG, &blah);
ioctl(chan->timingfd, DAHDI_TIMERCONFIG, &blah);
chan->timingdata = NULL;
ast_channel_unlock(chan);
}
@ -3433,6 +3433,11 @@ struct ast_channel *ast_request(const char *type, int format, void *data, int *c
return NULL;
}
if (!strcasecmp(type, "Zap")) {
type = "DAHDI";
ast_log(LOG_NOTICE, "Zap interface translated to DAHDI.\n");
}
AST_LIST_TRAVERSE(&backends, chan, list) {
if (strcasecmp(type, chan->tech->type))
continue;

View File

@ -2390,7 +2390,7 @@ int manage_parkinglot(struct ast_parkinglot *curlot, fd_set *rfds, fd_set *efds,
if (pu->peername[0]) {
char *peername = ast_strdupa(pu->peername);
char *cp = strrchr(peername, '-');
char peername_flat[AST_MAX_EXTENSION]; /* using something like Zap/52 for an extension name is NOT a good idea */
char peername_flat[AST_MAX_EXTENSION]; /* using something like DAHDI/52 for an extension name is NOT a good idea */
int i;
if (cp)

View File

@ -659,11 +659,11 @@ static enum fsread_res ast_readaudio_callback(struct ast_filestream *s)
}
}
if (whennext != s->lasttimeout) {
#ifdef HAVE_ZAPTEL
#ifdef HAVE_DAHDI
if (s->owner->timingfd > -1) {
int zap_timer_samples = whennext;
int rate;
/* whennext is in samples, but zaptel timers operate in 8 kHz samples. */
/* whennext is in samples, but DAHDI timers operate in 8 kHz samples. */
if ((rate = ast_format_rate(s->fmt->format)) != 8000) {
float factor;
factor = ((float) rate) / ((float) 8000.0);
@ -681,7 +681,7 @@ static enum fsread_res ast_readaudio_callback(struct ast_filestream *s)
return_failure:
s->owner->streamid = -1;
#ifdef HAVE_ZAPTEL
#ifdef HAVE_DAHDI
ast_settimeout(s->owner, 0, NULL, NULL);
#endif
return FSREAD_FAILURE;
@ -792,7 +792,7 @@ int ast_closestream(struct ast_filestream *f)
if (f->fmt->format & AST_FORMAT_AUDIO_MASK) {
f->owner->stream = NULL;
AST_SCHED_DEL(f->owner->sched, f->owner->streamid);
#ifdef HAVE_ZAPTEL
#ifdef HAVE_DAHDI
ast_settimeout(f->owner, 0, NULL, NULL);
#endif
} else {

View File

@ -758,6 +758,23 @@ static struct load_order_entry *add_to_load_order(const char *resource, struct l
return order;
}
static int translate_module_name(const char *oldname, char *newname)
{
if (!strcasecmp(oldname, "app_zapbarge.so"))
ast_copy_string(newname, "app_dahdibarge.so", 18);
else if(!strcasecmp(oldname, "app_zapras.so"))
ast_copy_string(newname, "app_dahdiras.so", 16);
else if(!strcasecmp(oldname, "app_zapscan.so"))
ast_copy_string(newname, "app_dahdiscan.so", 17);
else if(!strcasecmp(oldname, "codec_zap.so"))
ast_copy_string(newname, "codec_dahdi.so", 16);
else
return -1; /* no use for newname, oldname is fine */
return 0;
}
int load_modules(unsigned int preload_only)
{
struct ast_config *cfg;
@ -769,6 +786,9 @@ int load_modules(unsigned int preload_only)
int res = 0;
struct ast_flags config_flags = { 0 };
int modulecount = 0;
int translate_status;
char newname[18]; /* although this would normally be 80, max length in translate_module_name is 18 */
#ifdef LOADABLE_MODULES
struct dirent *dirent;
DIR *dir;
@ -796,8 +816,12 @@ int load_modules(unsigned int preload_only)
/* first, find all the modules we have been explicitly requested to load */
for (v = ast_variable_browse(cfg, "modules"); v; v = v->next) {
if (!strcasecmp(v->name, preload_only ? "preload" : "load"))
add_to_load_order(v->value, &load_order);
if (!strcasecmp(v->name, preload_only ? "preload" : "load")) {
translate_status = translate_module_name(v->value, newname);
if (!translate_status)
ast_log(LOG_WARNING, "Use of old module name %s is deprecated, please use %s instead.\n", v->value, newname);
add_to_load_order(translate_status ? v->value : newname, &load_order);
}
}
/* check if 'autoload' is on */
@ -853,7 +877,10 @@ int load_modules(unsigned int preload_only)
continue;
AST_LIST_TRAVERSE_SAFE_BEGIN(&load_order, order, entry) {
if (!resource_name_match(order->resource, v->value)) {
translate_status = translate_module_name(v->value, newname);
if (!resource_name_match(order->resource, translate_status ? v->value : newname)) {
if (!translate_status)
ast_log(LOG_WARNING, "Use of old module name %s is deprecated, please use %s instead.\n", v->value, newname);
AST_LIST_REMOVE_CURRENT(entry);
ast_free(order->resource);
ast_free(order);

View File

@ -211,7 +211,7 @@ VORBIS_LIB=@VORBIS_LIB@
VPBAPI_INCLUDE=@VPB_INCLUDE@
VPBAPI_LIB=@VPB_LIB@
ZAPTEL_INCLUDE=@ZAPTEL_INCLUDE@
DAHDI_INCLUDE=@DAHDI_INCLUDE@
ZLIB_INCLUDE=@ZLIB_INCLUDE@
ZLIB_LIB=@ZLIB_LIB@

View File

@ -1548,11 +1548,11 @@ static void pbx_load_users(void)
{
struct ast_config *cfg;
char *cat, *chan;
const char *zapchan;
const char *dahdichan;
const char *hasexten;
char tmp[256];
char iface[256];
char zapcopy[256];
char dahdicopy[256];
char *c;
int len;
int hasvoicemail;
@ -1585,12 +1585,22 @@ static void pbx_load_users(void)
if (hasexten && !ast_true(hasexten))
continue;
hasvoicemail = ast_true(ast_config_option(cfg, cat, "hasvoicemail"));
zapchan = ast_variable_retrieve(cfg, cat, "zapchan");
if (!zapchan)
zapchan = ast_variable_retrieve(cfg, "general", "zapchan");
if (!ast_strlen_zero(zapchan)) {
ast_copy_string(zapcopy, zapchan, sizeof(zapcopy));
c = zapcopy;
dahdichan = ast_variable_retrieve(cfg, cat, "dahdichan");
if (!dahdichan)
dahdichan = ast_variable_retrieve(cfg, "general", "dahdichan");
if (!dahdichan) {
/* no dahdichan, but look for zapchan too */
dahdichan = ast_variable_retrieve(cfg, cat, "zapchan");
if (!dahdichan) {
dahdichan = ast_variable_retrieve(cfg, "general", "zapchan");
}
if (!ast_strlen_zero(dahdichan)) {
ast_log(LOG_WARNING, "Use of zapchan in users.conf is deprecated. Please update configuration to use dahdichan instead.\n");
}
}
if (!ast_strlen_zero(dahdichan)) {
ast_copy_string(dahdicopy, dahdichan, sizeof(dahdicopy));
c = dahdicopy;
chan = strsep(&c, ",");
while (chan) {
if (sscanf(chan, "%d-%d", &start, &finish) == 2) {
@ -1607,7 +1617,7 @@ static void pbx_load_users(void)
start = x;
}
for (x = start; x <= finish; x++) {
snprintf(tmp, sizeof(tmp), "Zap/%d", x);
snprintf(tmp, sizeof(tmp), "DAHDI/%d", x);
append_interface(iface, sizeof(iface), tmp);
}
chan = strsep(&c, ",");

View File

@ -27,7 +27,7 @@
/*** MODULEINFO
<conflict>win32</conflict>
<use>zaptel</use>
<use>dahdi</use>
***/
#include "asterisk.h"
@ -46,7 +46,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
#include <thread.h>
#endif
#include "asterisk/zapata.h"
#include "asterisk/dahdi.h"
#include "asterisk/lock.h"
#include "asterisk/file.h"
@ -984,7 +984,7 @@ static int moh_diff(struct mohclass *old, struct mohclass *new)
static int moh_register(struct mohclass *moh, int reload)
{
#ifdef HAVE_ZAPTEL
#ifdef HAVE_DAHDI
int x;
#endif
struct mohclass *mohclass = NULL;
@ -1028,15 +1028,15 @@ static int moh_register(struct mohclass *moh, int reload)
ast_set_flag(moh, MOH_QUIET);
moh->srcfd = -1;
#ifdef HAVE_ZAPTEL
/* Open /dev/zap/pseudo for timing... Is
#ifdef HAVE_DAHDI
/* Open /dev/dahdi/pseudo for timing... Is
there a better, yet reliable way to do this? */
moh->pseudofd = open("/dev/zap/pseudo", O_RDONLY);
moh->pseudofd = open("/dev/dahdi/pseudo", O_RDONLY);
if (moh->pseudofd < 0) {
ast_log(LOG_WARNING, "Unable to open pseudo channel for timing... Sound may be choppy.\n");
} else {
x = 320;
ioctl(moh->pseudofd, ZT_SET_BLOCKSIZE, &x);
ioctl(moh->pseudofd, DAHDI_SET_BLOCKSIZE, &x);
}
#else
moh->pseudofd = -1;
@ -1105,7 +1105,7 @@ static int local_ast_moh_start(struct ast_channel *chan, const char *mclass, con
struct ast_variable *var = NULL;
struct ast_variable *tmp = NULL;
struct moh_files_state *state = chan->music_state;
#ifdef HAVE_ZAPTEL
#ifdef HAVE_DAHDI
int x;
#endif
@ -1228,15 +1228,15 @@ static int local_ast_moh_start(struct ast_channel *chan, const char *mclass, con
ast_set_flag(mohclass, MOH_QUIET);
mohclass->srcfd = -1;
#ifdef HAVE_ZAPTEL
/* Open /dev/zap/pseudo for timing... Is
#ifdef HAVE_DAHDI
/* Open /dev/dahdi/pseudo for timing... Is
there a better, yet reliable way to do this? */
mohclass->pseudofd = open("/dev/zap/pseudo", O_RDONLY);
mohclass->pseudofd = open("/dev/dahdi/pseudo", O_RDONLY);
if (mohclass->pseudofd < 0) {
ast_log(LOG_WARNING, "Unable to open pseudo channel for timing... Sound may be choppy.\n");
} else {
x = 320;
ioctl(mohclass->pseudofd, ZT_SET_BLOCKSIZE, &x);
ioctl(mohclass->pseudofd, DAHDI_SET_BLOCKSIZE, &x);
}
#else
mohclass->pseudofd = -1;

View File

@ -1809,7 +1809,7 @@ enum ast_option_flags {
AST_OPT_FLAG_DONT_WARN = (1 << 18),
/*! End CDRs before the 'h' extension */
AST_OPT_FLAG_END_CDR_BEFORE_H_EXTEN = (1 << 19),
/*! Use Zaptel Timing for generators if available */
/*! Use DAHDI Timing for generators if available */
AST_OPT_FLAG_INTERNAL_TIMING = (1 << 20),
/*! Always fork, even if verbose or debug settings are non-zero */
AST_OPT_FLAG_ALWAYS_FORK = (1 << 21),