aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--acinclude.m448
-rw-r--r--apps/app_chanspy.c4
-rw-r--r--apps/app_dahdibarge.c (renamed from apps/app_zapbarge.c)34
-rw-r--r--apps/app_dahdiras.c (renamed from apps/app_zapras.c)30
-rw-r--r--apps/app_dahdiscan.c (renamed from apps/app_zapscan.c)35
-rw-r--r--apps/app_disa.c2
-rw-r--r--apps/app_flash.c21
-rw-r--r--apps/app_getcpeid.c2
-rw-r--r--apps/app_meetme.c85
-rw-r--r--apps/app_page.c2
-rw-r--r--apps/app_queue.c5
-rw-r--r--apps/app_read.c2
-rw-r--r--apps/app_rpt.c218
-rw-r--r--build_tools/menuselect-deps.in4
-rw-r--r--channels/chan_dahdi.c (renamed from channels/chan_zap.c)2194
-rw-r--r--channels/chan_iax2.c32
-rw-r--r--channels/chan_mgcp.c30
-rw-r--r--channels/chan_misdn.c4
-rw-r--r--codecs/codec_dahdi.c (renamed from codecs/codec_zap.c)35
-rwxr-xr-xconfigure290
-rw-r--r--configure.ac26
-rw-r--r--contrib/utils/zones2indications.c20
-rw-r--r--funcs/func_channel.c2
-rw-r--r--include/asterisk/autoconfig.h.in6
-rw-r--r--include/asterisk/channel.h2
-rw-r--r--include/asterisk/dahdi_compat.h189
-rw-r--r--include/asterisk/indications.h32
-rw-r--r--include/asterisk/options.h2
-rw-r--r--main/app.c2
-rw-r--r--main/asterisk.c39
-rw-r--r--main/channel.c45
-rw-r--r--main/file.c6
-rw-r--r--main/indications.c80
-rw-r--r--main/loader.c33
-rw-r--r--makeopts.in2
-rw-r--r--pbx/pbx_config.c22
-rw-r--r--res/res_indications.c16
-rw-r--r--res/res_musiconhold.c16
-rw-r--r--res/snmp/agent.c4
39 files changed, 2104 insertions, 1517 deletions
diff --git a/acinclude.m4 b/acinclude.m4
index 0fa4e546e..106688b69 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -101,6 +101,54 @@ if test "${USE_$1}" != "no"; then
fi
])
+# The next three functions check for the availability of a given package.
+# AST_C_DEFINE_CHECK looks for the presence of a #define in a header file,
+# AST_C_COMPILE_CHECK can be used for testing for various items in header files,
+# AST_EXT_LIB_CHECK looks for a symbol in a given library, or at least
+# for the presence of a header file.
+# AST_EXT_TOOL_CHECK looks for a symbol in using $1-config to determine CFLAGS and LIBS
+#
+# They are only run if PBX_$1 != 1 (where $1 is the package),
+# so you can call them multiple times and stop at the first matching one.
+# On success, they both set PBX_$1 = 1, set $1_INCLUDE and $1_LIB as applicable,
+# and also #define HAVE_$1 1 and #define HAVE_$1_VERSION ${last_argument}
+# in autoconfig.h so you can tell which test succeeded.
+# They should be called after AST_EXT_LIB_SETUP($1, ...)
+
+# Check if a given macro is defined in a certain header.
+
+# AST_C_DEFINE_CHECK([package], [macro name], [header file], [version])
+AC_DEFUN([AST_C_DEFINE_CHECK],
+[
+ if test "x${PBX_$1}" != "x1"; then
+ AC_MSG_CHECKING([for $2 in $3])
+ saved_cppflags="${CPPFLAGS}"
+ if test "x${$1_DIR}" != "x"; then
+ $1_INCLUDE="-I${$1_DIR}/include"
+ fi
+ CPPFLAGS="${CPPFLAGS} ${$1_INCLUDE}"
+
+ AC_COMPILE_IFELSE(
+ [ AC_LANG_PROGRAM( [#include <$3>],
+ [#if defined($2)
+ int foo = 0;
+ #else
+ int foo = bar;
+ #endif
+ 0
+ ])],
+ [ AC_MSG_RESULT(yes)
+ PBX_$1=1
+ AC_DEFINE([HAVE_$1], 1, [Define if your system has the $1 headers.])
+ AC_DEFINE([HAVE_$1_VERSION], $4, [Define $1 headers version])
+ ],
+ [ AC_MSG_RESULT(no) ]
+ )
+ CPPFLAGS="${saved_cppflags}"
+ fi
+ AC_SUBST(PBX_$1)
+])
+
# AST_C_COMPILE_CHECK can be used for testing for various items in header files
# AST_C_COMPILE_CHECK([package], [expression], [header file], [version])
diff --git a/apps/app_chanspy.c b/apps/app_chanspy.c
index 6432f1bbb..2cc2975e6 100644
--- a/apps/app_chanspy.c
+++ b/apps/app_chanspy.c
@@ -461,6 +461,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 *this;
+ char channel_name[AST_CHANNEL_NAME];
redo:
if (spec)
@@ -473,7 +474,8 @@ redo:
if (!this)
return NULL;
- if (!strncmp(this->name, "Zap/pseudo", 10)) {
+ snprintf(channel_name, AST_CHANNEL_NAME, "%s/pseudo", dahdi_chan_name);
+ if (!strncmp(this->name, channel_name, 10)) {
ast_channel_unlock(this);
goto redo;
} else if (this == chan) {
diff --git a/apps/app_zapbarge.c b/apps/app_dahdibarge.c
index 735020f60..b807923a4 100644
--- a/apps/app_zapbarge.c
+++ b/apps/app_dahdibarge.c
@@ -32,7 +32,7 @@
*/
/*** MODULEINFO
- <depend>zaptel</depend>
+ <depend>dahdi</depend>
***/
#include "asterisk.h"
@@ -45,7 +45,6 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
#include <unistd.h>
#include <errno.h>
#include <sys/ioctl.h>
-#include <zaptel/zaptel.h>
#include "asterisk/lock.h"
#include "asterisk/file.h"
@@ -60,7 +59,10 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
#include "asterisk/say.h"
#include "asterisk/utils.h"
-static char *app = "ZapBarge";
+#include "asterisk/dahdi_compat.h"
+
+static char *app = "DAHDIBarge";
+static char *deprecated_app = "ZapBarge";
static char *synopsis = "Barge in (monitor) Zap channel";
@@ -94,7 +96,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;
+ DAHDI_CONFINFO ztc;
struct ast_frame *f;
struct ast_channel *c;
struct ast_frame fr;
@@ -107,7 +109,7 @@ static int conf_run(struct ast_channel *chan, int confno, int confflags)
int origfd;
int ret = -1;
- ZT_BUFFERINFO bi;
+ DAHDI_BUFFERINFO bi;
char __buf[CONF_SIZE + AST_FRIENDLY_OFFSET];
char *buf = __buf + AST_FRIENDLY_OFFSET;
@@ -147,10 +149,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;
@@ -164,7 +166,7 @@ zapretry:
memset(&ztc, 0, sizeof(ztc));
/* Check to see if we're in a conference... */
ztc.chan = 0;
- if (ioctl(fd, ZT_GETCONF, &ztc)) {
+ if (ioctl(fd, DAHDI_GETCONF, &ztc)) {
ast_log(LOG_WARNING, "Error getting conference\n");
close(fd);
goto outrun;
@@ -181,9 +183,9 @@ zapretry:
/* Add us to the conference */
ztc.chan = 0;
ztc.confno = confno;
- ztc.confmode = ZT_CONF_MONITORBOTH;
+ ztc.confmode = DAHDI_CONF_MONITORBOTH;
- if (ioctl(fd, ZT_SETCONF, &ztc)) {
+ if (ioctl(fd, DAHDI_SETCONF, &ztc)) {
ast_log(LOG_WARNING, "Error setting conference\n");
close(fd);
goto outrun;
@@ -247,7 +249,7 @@ zapretry:
ztc.chan = 0;
ztc.confno = 0;
ztc.confmode = 0;
- if (ioctl(fd, ZT_SETCONF, &ztc)) {
+ if (ioctl(fd, DAHDI_SETCONF, &ztc)) {
ast_log(LOG_WARNING, "Error setting conference\n");
}
}
@@ -299,6 +301,13 @@ 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)
{
int res;
@@ -312,6 +321,7 @@ 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);
}
diff --git a/apps/app_zapras.c b/apps/app_dahdiras.c
index c3ccf30d9..3f9b68935 100644
--- a/apps/app_zapras.c
+++ b/apps/app_dahdiras.c
@@ -26,7 +26,7 @@
*/
/*** MODULEINFO
- <depend>zaptel</depend>
+ <depend>dahdi</depend>
***/
#include "asterisk.h"
@@ -48,7 +48,6 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
#include <errno.h>
#include <stdio.h>
#include <fcntl.h>
-#include <zaptel/zaptel.h>
#include "asterisk/lock.h"
#include "asterisk/file.h"
@@ -58,7 +57,10 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
#include "asterisk/module.h"
#include "asterisk/options.h"
-static char *app = "ZapRAS";
+#include "asterisk/dahdi_compat.h"
+
+static char *app = "DAHDIRAS";
+static char *deprecated_app = "ZapRAS";
static char *synopsis = "Executes Zaptel ISDN RAS application";
@@ -143,10 +145,10 @@ static void run_ras(struct ast_channel *chan, char *args)
int status;
int res;
int signalled = 0;
- struct zt_bufferinfo savebi;
+ 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;
@@ -184,10 +186,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);
}
@@ -201,7 +203,7 @@ static int zapras_exec(struct ast_channel *chan, void *data)
int res=-1;
char *args;
struct ast_module_user *u;
- ZT_PARAMS ztp;
+ DAHDI_PARAMS ztp;
if (!data)
data = "";
@@ -221,9 +223,9 @@ static int zapras_exec(struct ast_channel *chan, void *data)
sleep(2);
} else {
memset(&ztp, 0, sizeof(ztp));
- if (ioctl(chan->fds[0], ZT_GET_PARAMS, &ztp)) {
+ if (ioctl(chan->fds[0], DAHDI_GET_PARAMS, &ztp)) {
ast_log(LOG_WARNING, "Unable to get zaptel parameters\n");
- } else if (ztp.sigtype != ZT_SIG_CLEAR) {
+ } else if (ztp.sigtype != DAHDI_SIG_CLEAR) {
if (option_verbose > 1)
ast_verbose(VERBOSE_PREFIX_2 "Channel %s is not a clear channel\n", chan->name);
} else {
@@ -238,6 +240,13 @@ static int zapras_exec(struct ast_channel *chan, void *data)
return res;
}
+static int zapras_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 zapras_exec(chan, data);
+}
+
+
static int unload_module(void)
{
int res;
@@ -251,6 +260,7 @@ static int unload_module(void)
static int load_module(void)
{
+ ast_register_application(deprecated_app, zapras_exec_warn, synopsis, descrip);
return ast_register_application(app, zapras_exec, synopsis, descrip);
}
diff --git a/apps/app_zapscan.c b/apps/app_dahdiscan.c
index 690d9a5cc..ae270e484 100644
--- a/apps/app_zapscan.c
+++ b/apps/app_dahdiscan.c
@@ -31,7 +31,7 @@
*/
/*** MODULEINFO
- <depend>zaptel</depend>
+ <depend>dahdi</depend>
***/
#include "asterisk.h"
@@ -44,7 +44,6 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
#include <unistd.h>
#include <errno.h>
#include <sys/ioctl.h>
-#include <zaptel/zaptel.h>
#include "asterisk/lock.h"
#include "asterisk/file.h"
@@ -59,7 +58,10 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
#include "asterisk/cli.h"
#include "asterisk/say.h"
-static char *app = "ZapScan";
+#include "asterisk/dahdi_compat.h"
+
+static char *app = "DAHDIScan";
+static char *deprecated_app = "ZapScan";
static char *synopsis = "Scan Zap channels to monitor calls";
@@ -74,7 +76,7 @@ static char *descrip =
static struct ast_channel *get_zap_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);
}
@@ -99,7 +101,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;
+ DAHDI_CONFINFO ztc;
struct ast_frame *f;
struct ast_channel *c;
struct ast_frame fr;
@@ -114,7 +116,7 @@ static int conf_run(struct ast_channel *chan, int confno, int confflags)
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;
@@ -154,10 +156,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;
@@ -171,7 +173,7 @@ static int conf_run(struct ast_channel *chan, int confno, int confflags)
memset(&ztc, 0, sizeof(ztc));
/* Check to see if we're in a conference... */
ztc.chan = 0;
- if (ioctl(fd, ZT_GETCONF, &ztc)) {
+ if (ioctl(fd, DAHDI_GETCONF, &ztc)) {
ast_log(LOG_WARNING, "Error getting conference\n");
close(fd);
goto outrun;
@@ -188,9 +190,9 @@ static int conf_run(struct ast_channel *chan, int confno, int confflags)
/* Add us to the conference */
ztc.chan = 0;
ztc.confno = confno;
- ztc.confmode = ZT_CONF_MONITORBOTH;
+ ztc.confmode = DAHDI_CONF_MONITORBOTH;
- if (ioctl(fd, ZT_SETCONF, &ztc)) {
+ if (ioctl(fd, DAHDI_SETCONF, &ztc)) {
ast_log(LOG_WARNING, "Error setting conference\n");
close(fd);
goto outrun;
@@ -274,7 +276,7 @@ static int conf_run(struct ast_channel *chan, int confno, int confflags)
ztc.chan = 0;
ztc.confno = 0;
ztc.confmode = 0;
- if (ioctl(fd, ZT_SETCONF, &ztc)) {
+ if (ioctl(fd, DAHDI_SETCONF, &ztc)) {
ast_log(LOG_WARNING, "Error setting conference\n");
}
}
@@ -361,6 +363,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)
{
int res;
@@ -374,6 +382,7 @@ 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);
}
diff --git a/apps/app_disa.c b/apps/app_disa.c
index 4b7852a13..f0c9aced7 100644
--- a/apps/app_disa.c
+++ b/apps/app_disa.c
@@ -98,7 +98,7 @@ static char *descrip =
static void play_dialtone(struct ast_channel *chan, char *mailbox)
{
- const struct tone_zone_sound *ts = NULL;
+ const struct ind_tone_zone_sound *ts = NULL;
if(ast_app_has_voicemail(mailbox, NULL))
ts = ast_get_indication_tone(chan->zone, "dialrecall");
else
diff --git a/apps/app_flash.c b/apps/app_flash.c
index 1aa099d71..05a372f9e 100644
--- a/apps/app_flash.c
+++ b/apps/app_flash.c
@@ -26,7 +26,7 @@
*/
/*** MODULEINFO
- <depend>zaptel</depend>
+ <depend>dahdi</depend>
***/
#include "asterisk.h"
@@ -38,7 +38,6 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
#include <string.h>
#include <errno.h>
#include <sys/ioctl.h>
-#include <zaptel/zaptel.h>
#include "asterisk/lock.h"
#include "asterisk/file.h"
@@ -50,6 +49,8 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
#include "asterisk/image.h"
#include "asterisk/options.h"
+#include "asterisk/dahdi_compat.h"
+
static char *app = "Flash";
static char *synopsis = "Flashes a Zap Trunk";
@@ -65,9 +66,9 @@ static inline int zt_wait_event(int fd)
{
/* Avoid the silly zt_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;
}
@@ -76,15 +77,15 @@ static int flash_exec(struct ast_channel *chan, void *data)
int res = -1;
int x;
struct ast_module_user *u;
- struct zt_params ztp;
+ DAHDI_PARAMS ztp;
u = ast_module_user_add(chan);
if (!strcasecmp(chan->tech->type, "Zap")) {
memset(&ztp, 0, sizeof(ztp));
- res = ioctl(chan->fds[0], ZT_GET_PARAMS, &ztp);
+ res = ioctl(chan->fds[0], DAHDI_GET_PARAMS, &ztp);
if (!res) {
- if (ztp.sigtype & __ZT_SIG_FXS) {
- x = ZT_FLASH;
- res = ioctl(chan->fds[0], ZT_HOOK, &x);
+ if (ztp.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 */
diff --git a/apps/app_getcpeid.c b/apps/app_getcpeid.c
index f0c5d1b07..bebc60e9b 100644
--- a/apps/app_getcpeid.c
+++ b/apps/app_getcpeid.c
@@ -49,7 +49,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 chan_dahdi.conf for on-hook operations.\n";
static int cpeid_setstatus(struct ast_channel *chan, char *stuff[], int voice)
diff --git a/apps/app_meetme.c b/apps/app_meetme.c
index 990913b1e..5eabaa293 100644
--- a/apps/app_meetme.c
+++ b/apps/app_meetme.c
@@ -30,7 +30,7 @@
*/
/*** MODULEINFO
- <depend>zaptel</depend>
+ <depend>dahdi</depend>
***/
#include "asterisk.h"
@@ -45,7 +45,6 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
#include <sys/ioctl.h>
#include <sys/stat.h>
#include <sys/types.h>
-#include <zaptel/zaptel.h>
#include "asterisk/lock.h"
#include "asterisk/file.h"
@@ -69,6 +68,8 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
#include "asterisk/dial.h"
#include "asterisk/causes.h"
+#include "asterisk/dahdi_compat.h"
+
#include "enter.h"
#include "leave.h"
@@ -580,8 +581,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)
@@ -741,7 +742,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)
{
struct ast_conference *cnf;
- struct zt_confinfo ztc = { 0, };
+ DAHDI_CONFINFO ztc = { 0, };
int confno_int = 0;
AST_LIST_LOCK(&confs);
@@ -768,9 +769,9 @@ static struct ast_conference *build_conf(char *confno, char *pin, char *pinadmin
/* Setup a new zap conference */
ztc.confno = -1;
- ztc.confmode = ZT_CONF_CONFANN | ZT_CONF_CONFANNMON;
+ ztc.confmode = DAHDI_CONF_CONFANN | DAHDI_CONF_CONFANNMON;
cnf->fd = open("/dev/zap/pseudo", O_RDWR);
- if (cnf->fd < 0 || ioctl(cnf->fd, ZT_SETCONF, &ztc)) {
+ if (cnf->fd < 0 || ioctl(cnf->fd, DAHDI_SETCONF, &ztc)) {
ast_log(LOG_WARNING, "Unable to open pseudo device\n");
if (cnf->fd >= 0)
close(cnf->fd);
@@ -788,8 +789,8 @@ static struct ast_conference *build_conf(char *confno, char *pin, char *pinadmin
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)) {
+ ztc.confmode = DAHDI_CONF_CONFANN | DAHDI_CONF_CONFANNMON;
+ if (ioctl(cnf->chan->fds[0], DAHDI_SETCONF, &ztc)) {
ast_log(LOG_WARNING, "Error setting conference\n");
if (cnf->chan)
ast_hangup(cnf->chan);
@@ -1218,8 +1219,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");
}
@@ -1372,7 +1373,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;
+ DAHDI_CONFINFO ztc, ztc_empty;
struct ast_frame *f;
struct ast_channel *c;
struct ast_frame fr;
@@ -1405,7 +1406,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;
int setusercount = 0;
@@ -1444,8 +1445,8 @@ static int conf_run(struct ast_channel *chan, struct ast_conference *conf, int c
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)) {
+ ztc.confmode = DAHDI_CONF_CONFANN | DAHDI_CONF_CONFANNMON;
+ if (ioctl(conf->lchan->fds[0], DAHDI_SETCONF, &ztc)) {
ast_log(LOG_WARNING, "Error starting listen channel\n");
ast_hangup(conf->lchan);
conf->lchan = NULL;
@@ -1616,16 +1617,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;
@@ -1640,7 +1641,7 @@ static int conf_run(struct ast_channel *chan, struct ast_conference *conf, int c
memset(&ztc_empty, 0, sizeof(ztc_empty));
/* Check to see if we're in a conference... */
ztc.chan = 0;
- if (ioctl(fd, ZT_GETCONF, &ztc)) {
+ if (ioctl(fd, DAHDI_GETCONF, &ztc)) {
ast_log(LOG_WARNING, "Error getting conference\n");
close(fd);
goto outrun;
@@ -1670,15 +1671,15 @@ 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;
+ ztc.confmode = DAHDI_CONF_CONF;
else if (confflags & CONFFLAG_MONITOR)
- ztc.confmode = ZT_CONF_CONFMON | ZT_CONF_LISTENER;
+ ztc.confmode = DAHDI_CONF_CONFMON | DAHDI_CONF_LISTENER;
else if (confflags & CONFFLAG_TALKER)
- ztc.confmode = ZT_CONF_CONF | ZT_CONF_TALKER;
+ ztc.confmode = DAHDI_CONF_CONF | DAHDI_CONF_TALKER;
else
- ztc.confmode = ZT_CONF_CONF | ZT_CONF_TALKER | ZT_CONF_LISTENER;
+ ztc.confmode = DAHDI_CONF_CONF | DAHDI_CONF_TALKER | DAHDI_CONF_LISTENER;
- if (ioctl(fd, ZT_SETCONF, &ztc)) {
+ if (ioctl(fd, DAHDI_SETCONF, &ztc)) {
ast_log(LOG_WARNING, "Error setting conference\n");
close(fd);
ast_mutex_unlock(&conf->playlock);
@@ -1796,8 +1797,8 @@ static int conf_run(struct ast_channel *chan, struct ast_conference *conf, int c
if(confflags & CONFFLAG_MARKEDEXIT)
break;
else {
- ztc.confmode = ZT_CONF_CONF;
- if (ioctl(fd, ZT_SETCONF, &ztc)) {
+ ztc.confmode = DAHDI_CONF_CONF;
+ if (ioctl(fd, DAHDI_SETCONF, &ztc)) {
ast_log(LOG_WARNING, "Error setting conference\n");
close(fd);
goto outrun;
@@ -1812,12 +1813,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;
+ ztc.confmode = DAHDI_CONF_CONFMON | DAHDI_CONF_LISTENER;
else if (confflags & CONFFLAG_TALKER)
- ztc.confmode = ZT_CONF_CONF | ZT_CONF_TALKER;
+ ztc.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)) {
+ ztc.confmode = DAHDI_CONF_CONF | DAHDI_CONF_TALKER | DAHDI_CONF_LISTENER;
+ if (ioctl(fd, DAHDI_SETCONF, &ztc)) {
ast_log(LOG_WARNING, "Error setting conference\n");
close(fd);
goto outrun;
@@ -1858,9 +1859,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)) && (ztc.confmode & DAHDI_CONF_TALKER)) {
+ ztc.confmode ^= DAHDI_CONF_TALKER;
+ if (ioctl(fd, DAHDI_SETCONF, &ztc)) {
ast_log(LOG_WARNING, "Error setting conference - Un/Mute \n");
ret = -1;
break;
@@ -1876,9 +1877,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) && !(ztc.confmode & DAHDI_CONF_TALKER)) {
+ ztc.confmode |= DAHDI_CONF_TALKER;
+ if (ioctl(fd, DAHDI_SETCONF, &ztc)) {
ast_log(LOG_WARNING, "Error setting conference - Un/Mute \n");
ret = -1;
break;
@@ -1992,7 +1993,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, &ztc_empty)) {
ast_log(LOG_WARNING, "Error setting conference\n");
close(fd);
ast_frfree(f);
@@ -2138,7 +2139,7 @@ static int conf_run(struct ast_channel *chan, struct ast_conference *conf, int c
if (musiconhold)
ast_moh_start(chan, NULL, NULL);
- if (ioctl(fd, ZT_SETCONF, &ztc)) {
+ if (ioctl(fd, DAHDI_SETCONF, &ztc)) {
ast_log(LOG_WARNING, "Error setting conference\n");
close(fd);
ast_frfree(f);
@@ -2245,7 +2246,7 @@ bailoutandtrynormal:
ztc.chan = 0;
ztc.confno = 0;
ztc.confmode = 0;
- if (ioctl(fd, ZT_SETCONF, &ztc)) {
+ if (ioctl(fd, DAHDI_SETCONF, &ztc)) {
ast_log(LOG_WARNING, "Error setting conference\n");
}
}
@@ -3112,9 +3113,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)
diff --git a/apps/app_page.c b/apps/app_page.c
index 00574b943..c3c383ea1 100644
--- a/apps/app_page.c
+++ b/apps/app_page.c
@@ -26,7 +26,7 @@
*/
/*** MODULEINFO
- <depend>zaptel</depend>
+ <depend>dahdi</depend>
<depend>app_meetme</depend>
***/
diff --git a/apps/app_queue.c b/apps/app_queue.c
index 23930ae13..01fdcf3aa 100644
--- a/apps/app_queue.c
+++ b/apps/app_queue.c
@@ -1565,9 +1565,8 @@ static int say_position(struct queue_ent *qe)
/* If the hold time is >1 min, if it's enabled, and if it's not
supposed to be only once and we have already said it, say it */
- if ((avgholdmins+avgholdsecs) > 0 && qe->parent->announceholdtime &&
- ((qe->parent->announceholdtime == ANNOUNCEHOLDTIME_ONCE && !qe->last_pos) ||
- !(qe->parent->announceholdtime == ANNOUNCEHOLDTIME_ONCE))) {
+ if ((avgholdmins+avgholdsecs) > 0 && (qe->parent->announceholdtime) &&
+ (!(qe->parent->announceholdtime == ANNOUNCEHOLDTIME_ONCE) && qe->last_pos)) {
res = play_file(qe->chan, qe->parent->sound_holdtime);
if (res)
goto playout;
diff --git a/apps/app_read.c b/apps/app_read.c
index bb3dd669b..897ddd2fe 100644
--- a/apps/app_read.c
+++ b/apps/app_read.c
@@ -92,7 +92,7 @@ static int read_exec(struct ast_channel *chan, void *data)
int maxdigits = 255;
int tries = 1, to = 0, x = 0;
char *argcopy = NULL;
- struct tone_zone_sound *ts;
+ struct ind_tone_zone_sound *ts;
struct ast_flags flags = {0};
AST_DECLARE_APP_ARGS(arglist,
diff --git a/apps/app_rpt.c b/apps/app_rpt.c
index 952fdd0b1..8465a2627 100644
--- a/apps/app_rpt.c
+++ b/apps/app_rpt.c
@@ -2609,9 +2609,9 @@ static struct morse_bits mbits[] = {
*/
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 | ZT_IOMUX_NOWAIT;
+ res = ioctl(chan->fds[0], DAHDI_IOMUX, &flags);
+ if(flags & DAHDI_IOMUX_WRITEEMPTY)
break;
if( ast_safe_sleep(chan, 50)){
res = -1;
@@ -2660,9 +2660,9 @@ static int send_tone_telemetry(struct ast_channel *chan, char *tonestring)
*/
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 | ZT_IOMUX_NOWAIT;
+ res = ioctl(chan->fds[0], DAHDI_IOMUX, &flags);
+ if(flags & DAHDI_IOMUX_WRITEEMPTY)
break;
if( ast_safe_sleep(chan, 50)){
res = -1;
@@ -2905,7 +2905,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;
@@ -2959,9 +2959,9 @@ struct zt_params par;
ci.confno = (((mytele->mode == ID) || (mytele->mode == IDTALKOVER) || (mytele->mode == UNKEY) ||
(mytele->mode == TAILMSG) || (mytele->mode == LINKUNKEY)) || (mytele->mode == TIMEOUT) ?
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);
@@ -3144,9 +3144,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);
@@ -3174,9 +3174,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);
@@ -3385,15 +3385,15 @@ struct zt_params par;
res = -1;
break;
}
- i = ZT_FLUSH_EVENT;
- if (ioctl(myrpt->zaptxchannel->fds[0],ZT_FLUSH,&i) == -1)
+ i = DAHDI_FLUSH_EVENT;
+ if (ioctl(myrpt->zaptxchannel->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->zaprxchannel->fds[0],DAHDI_GET_PARAMS,&par) == -1)
{
ast_mutex_unlock(&myrpt->remlock);
ast_log(LOG_ERROR,"Cant get params");
@@ -4161,7 +4161,7 @@ pthread_attr_t attr;
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;
@@ -4181,10 +4181,10 @@ struct ast_channel *mychannel,*genchannel;
#endif
ci.chan = 0;
ci.confno = myrpt->conf; /* use the pseudo conference */
- ci.confmode = ZT_CONF_REALANDPSEUDO | ZT_CONF_TALKER | ZT_CONF_LISTENER
- | ZT_CONF_PSEUDO_TALKER | ZT_CONF_PSEUDO_LISTENER;
+ ci.confmode = DAHDI_CONF_REALANDPSEUDO | ZT_CONF_TALKER | ZT_CONF_LISTENER
+ | DAHDI_CONF_PSEUDO_TALKER | ZT_CONF_PSEUDO_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);
@@ -4204,10 +4204,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 | ZT_CONF_TALKER | ZT_CONF_LISTENER
+ | DAHDI_CONF_PSEUDO_TALKER | ZT_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);
@@ -4232,7 +4232,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(mychannel->fds[0],ZT_TONE_DIALTONE) < 0))
+ if ((!myrpt->patchquiet) && (tone_zone_play_tone(mychannel->fds[0],DAHDI_TONE_DIALTONE) < 0))
{
ast_log(LOG_WARNING, "Cannot start dialtone\n");
ast_hangup(mychannel);
@@ -4274,7 +4274,7 @@ struct ast_channel *mychannel,*genchannel;
if(!congstarted){
congstarted = 1;
/* start congestion tone */
- tone_zone_play_tone(mychannel->fds[0],ZT_TONE_CONGESTION);
+ tone_zone_play_tone(mychannel->fds[0],DAHDI_TONE_CONGESTION);
}
}
res = ast_safe_sleep(mychannel, MSWAIT);
@@ -4346,10 +4346,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 | ZT_CONF_LISTENER | ZT_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);
@@ -4373,7 +4373,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);
}
}
@@ -4401,10 +4401,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 | ZT_CONF_LISTENER | ZT_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");
}
@@ -4471,7 +4471,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){
@@ -4610,9 +4610,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 | ZT_CONF_LISTENER | ZT_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);
@@ -5850,17 +5850,17 @@ static void rbi_out(struct rpt *myrpt,unsigned char *data)
struct zt_radio_param r;
memset(&r,0,sizeof(struct zt_radio_param));
- r.radpar = ZT_RADPAR_REMMODE;
- r.data = ZT_RADPAR_REM_RBI1;
+ 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->zaprxchannel->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->zaprxchannel->fds[0],DAHDI_RADIO_SETPARAM,&r) == -1)
{
ast_log(LOG_WARNING,"Cannot send RBI command for channel %s\n",myrpt->zaprxchannel->name);
return;
@@ -5909,47 +5909,47 @@ static int serial_remote_io(struct rpt *myrpt, unsigned char *txbuf, int txbytes
/* if not a zap channel, cant use pciradio stuff */
if (myrpt->rxchannel != myrpt->zaprxchannel) 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->zaprxchannel->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->zaprxchannel->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->zaprxchannel->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->zaprxchannel->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->zaprxchannel->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->zaprxchannel->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->zaprxchannel->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->zaprxchannel->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->zaprxchannel->fds[0],DAHDI_RADIO_SETPARAM,&prm) == -1) return -1;
return(index);
}
@@ -8763,7 +8763,7 @@ char *tele,*idtalkover,c;
int ms = MSWAIT,i,lasttx=0,val,remrx=0,identqueued,othertelemqueued;
int tailmessagequeued,ctqueued,dtmfed;
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;
@@ -8963,9 +8963,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 | ZT_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->zaptxchannel->fds[0],DAHDI_SETCONF,&ci) == -1)
{
ast_log(LOG_WARNING, "Unable to set conference mode to Announce\n");
rpt_mutex_unlock(&myrpt->lock);
@@ -8982,10 +8982,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 | ZT_CONF_LISTENER | ZT_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);
@@ -9005,7 +9005,7 @@ char tmpstr[300],lstr[MAXLINKLIST];
(myrpt->zaptxchannel == 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);
@@ -9017,15 +9017,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);
@@ -9057,9 +9057,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 | ZT_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);
@@ -9786,7 +9786,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->zaprxchannel->fds[0], DAHDI_GETCONFMUTE, &ismuted) == -1)
{
ismuted = 0;
}
@@ -10076,7 +10076,7 @@ char tmpstr[300],lstr[MAXLINKLIST];
if (l->phonemode)
{
- if (ioctl(l->chan->fds[0], ZT_GETCONFMUTE, &ismuted) == -1)
+ if (ioctl(l->chan->fds[0], DAHDI_GETCONFMUTE, &ismuted) == -1)
{
ismuted = 0;
}
@@ -10568,8 +10568,8 @@ 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;
@@ -10948,9 +10948,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 | ZT_CONF_LISTENER | ZT_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);
@@ -11115,9 +11115,9 @@ static int rpt_exec(struct ast_channel *chan, void *data)
/* 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);
@@ -11144,28 +11144,28 @@ static int rpt_exec(struct ast_channel *chan, void *data)
memset(&z,0,sizeof(z));
if ((myrpt->iofd < 1) && (myrpt->txchannel == myrpt->zaptxchannel))
{
- 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->zaptxchannel->fds[0],DAHDI_RADIO_SETPARAM,&z);
/* if PCIRADIO and kenwood selected */
if ((!res) && (!strcmp(myrpt->remote,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->zaptxchannel->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->zaptxchannel->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->zaptxchannel->fds[0],DAHDI_HOOK,&i) == -1)
{
ast_log(LOG_ERROR,"Cannot set hook\n");
return -1;
@@ -11175,23 +11175,23 @@ static int rpt_exec(struct ast_channel *chan, void *data)
}
if (myrpt->txchannel == myrpt->zaptxchannel)
{
- i = ZT_ONHOOK;
- ioctl(myrpt->zaptxchannel->fds[0],ZT_HOOK,&i);
+ i = DAHDI_ONHOOK;
+ ioctl(myrpt->zaptxchannel->fds[0],DAHDI_HOOK,&i);
/* if PCIRADIO and Yaesu ft897/ICOM IC-706 selected */
if ((myrpt->iofd < 1) && (!res) &&
(!strcmp(myrpt->remote,remote_rig_ft897) ||
(!strcmp(myrpt->remote,remote_rig_ic706))))
{
- 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->zaptxchannel->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->zaptxchannel->fds[0],DAHDI_RADIO_SETPARAM,&z) == -1)
{
ast_log(LOG_ERROR,"Cannot set UIODATA\n");
return -1;
@@ -11227,7 +11227,7 @@ 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->zaprxchannel->fds[0],DAHDI_ECHOCANCEL,&i);
}
if (chan->_state != AST_STATE_UP) {
ast_answer(chan);
@@ -11235,7 +11235,7 @@ static int rpt_exec(struct ast_channel *chan, void *data)
if (myrpt->rxchannel == myrpt->zaprxchannel)
{
- if (ioctl(myrpt->zaprxchannel->fds[0],ZT_GET_PARAMS,&par) != -1)
+ if (ioctl(myrpt->zaprxchannel->fds[0],DAHDI_GET_PARAMS,&par) != -1)
{
if (par.rxisoffhook)
{
@@ -11500,9 +11500,9 @@ static int rpt_exec(struct ast_channel *chan, void *data)
time(&myrpt->last_activity_time);
if ((iskenwood_pci4) && (myrpt->txchannel == myrpt->zaptxchannel))
{
- 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->zaptxchannel->fds[0],DAHDI_RADIO_SETPARAM,&z) == -1)
{
ast_log(LOG_ERROR,"Cannot set UIODATA\n");
return -1;
@@ -11524,9 +11524,9 @@ static int rpt_exec(struct ast_channel *chan, void *data)
}
if ((iskenwood_pci4) && (myrpt->txchannel == myrpt->zaptxchannel))
{
- 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->zaptxchannel->fds[0],DAHDI_RADIO_SETPARAM,&z) == -1)
{
ast_log(LOG_ERROR,"Cannot set UIODATA\n");
return -1;
@@ -11576,7 +11576,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;
}
@@ -11801,22 +11801,22 @@ static int rpt_exec(struct ast_channel *chan, void *data)
myrpt->lastf2 = NULL;
if ((iskenwood_pci4) && (myrpt->txchannel == myrpt->zaptxchannel))
{
- 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->zaptxchannel->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->zaptxchannel->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->zaptxchannel->fds[0],DAHDI_HOOK,&i) == -1)
{
ast_log(LOG_ERROR,"Cannot set hook\n");
return -1;
diff --git a/build_tools/menuselect-deps.in b/build_tools/menuselect-deps.in
index 3ffb565bf..564a96731 100644
--- a/build_tools/menuselect-deps.in
+++ b/build_tools/menuselect-deps.in
@@ -1,5 +1,6 @@
ASOUND=@PBX_ALSA@
CURL=@PBX_CURL@
+DAHDI=@PBX_DAHDI@
FREETDS=@PBX_FREETDS@
GSM=@PBX_GSM@
GTK=@PBX_GTK@
@@ -32,8 +33,7 @@ UNIXODBC=@PBX_UNIXODBC@
VORBIS=@PBX_VORBIS@
VPBAPI=@PBX_VPB@
ZAPTEL=@PBX_ZAPTEL@
-ZAPTEL_VLDTMF=@PBX_ZAPTEL_VLDTMF@
-ZAPTEL_TRANSCODE=@PBX_ZAPTEL_TRANSCODE@
+DAHDI_TRANSCODE=@PBX_ZAPTEL_TRANSCODE@
ZLIB=@PBX_ZLIB@
ISDNNET=@PBX_ISDNNET@
MISDN=@PBX_MISDN@
diff --git a/channels/chan_zap.c b/channels/chan_dahdi.c
index ae7fd750a..f20834181 100644
--- a/channels/chan_zap.c
+++ b/channels/chan_dahdi.c
@@ -18,19 +18,19 @@
/*! \file
*
- * \brief Zaptel Pseudo TDM interface
+ * \brief DAHDI Pseudo TDM interface
*
* \author Mark Spencer <markster@digium.com>
*
- * Connects to the zaptel telephony library as well as
+ * Connects to the DAHDI telephony library as well as
* libpri. Libpri is optional and needed only if you are
* going to use ISDN connections.
*
* You need to install libraries before you attempt to compile
- * and install the zaptel channel.
+ * and install the DAHDI channel.
*
* \par See also
- * \arg \ref Config_zap
+ * \arg \ref Config_dahdi
*
* \ingroup channel_drivers
*
@@ -39,8 +39,7 @@
/*** MODULEINFO
<depend>res_smdi</depend>
- <depend>zaptel_vldtmf</depend>
- <depend>zaptel</depend>
+ <depend>DAHDI</depend>
<depend>tonezone</depend>
<depend>res_features</depend>
<use>pri</use>
@@ -67,8 +66,6 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
#include <sys/ioctl.h>
#include <math.h>
#include <ctype.h>
-#include <zaptel/zaptel.h>
-#include <zaptel/tonezone.h>
#ifdef HAVE_PRI
#include <libpri.h>
@@ -106,6 +103,8 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
#include "asterisk/astobj.h"
#define SMDI_MD_WAIT_TIMEOUT 1500 /* 1.5 seconds */
+#include "asterisk/dahdi_compat.h"
+
/*! Global jitterbuffer configuration - by default, jb is disabled */
static struct ast_jb_conf default_jbconf =
{
@@ -116,14 +115,14 @@ static struct ast_jb_conf default_jbconf =
};
static struct ast_jb_conf global_jbconf;
-#if !defined(ZT_SIG_EM_E1) || (defined(HAVE_PRI) && !defined(ZT_SIG_HARDHDLC))
-#error "Your zaptel is too old. Please update"
+#if !defined(DAHDI_SIG_EM_E1) || (defined(HAVE_PRI) && !defined(DAHDI_SIG_HARDHDLC))
+#error "Your DAHDI is too old. Please update"
#endif
-#ifndef ZT_TONEDETECT
+#ifndef DAHDI_TONEDETECT
/* Work around older code with no tone detect */
-#define ZT_EVENT_DTMFDOWN 0
-#define ZT_EVENT_DTMFUP 0
+#define DAHDI_EVENT_DTMFDOWN 0
+#define DAHDI_EVENT_DTMFUP 0
#endif
/* define this to send PRI user-user information elements */
@@ -145,50 +144,50 @@ static struct ast_jb_conf global_jbconf;
* before dialing on it. Certain FXO interfaces always think they're out of
* service with this method however.
*/
-/* #define ZAP_CHECK_HOOKSTATE */
+/* #define DAHDI_CHECK_HOOKSTATE */
/*! \brief Typically, how many rings before we should send Caller*ID */
#define DEFAULT_CIDRINGS 1
#define CHANNEL_PSEUDO -12
-#define AST_LAW(p) (((p)->law == ZT_LAW_ALAW) ? AST_FORMAT_ALAW : AST_FORMAT_ULAW)
+#define AST_LAW(p) (((p)->law == DAHDI_LAW_ALAW) ? AST_FORMAT_ALAW : AST_FORMAT_ULAW)
/*! \brief Signaling types that need to use MF detection should be placed in this macro */
#define NEED_MFDETECT(p) (((p)->sig == SIG_FEATDMF) || ((p)->sig == SIG_FEATDMF_TA) || ((p)->sig == SIG_E911) || ((p)->sig == SIG_FGC_CAMA) || ((p)->sig == SIG_FGC_CAMAMF) || ((p)->sig == SIG_FEATB))
-static const char tdesc[] = "Zapata Telephony Driver"
+static const char tdesc[] = "DAHDI Telephony Driver"
#ifdef HAVE_PRI
" w/PRI"
#endif
;
-static const char config[] = "zapata.conf";
-
-#define SIG_EM ZT_SIG_EM
-#define SIG_EMWINK (0x0100000 | ZT_SIG_EM)
-#define SIG_FEATD (0x0200000 | ZT_SIG_EM)
-#define SIG_FEATDMF (0x0400000 | ZT_SIG_EM)
-#define SIG_FEATB (0x0800000 | ZT_SIG_EM)
-#define SIG_E911 (0x1000000 | ZT_SIG_EM)
-#define SIG_FEATDMF_TA (0x2000000 | ZT_SIG_EM)
-#define SIG_FGC_CAMA (0x4000000 | ZT_SIG_EM)
-#define SIG_FGC_CAMAMF (0x8000000 | ZT_SIG_EM)
-#define SIG_FXSLS ZT_SIG_FXSLS
-#define SIG_FXSGS ZT_SIG_FXSGS
-#define SIG_FXSKS ZT_SIG_FXSKS
-#define SIG_FXOLS ZT_SIG_FXOLS
-#define SIG_FXOGS ZT_SIG_FXOGS
-#define SIG_FXOKS ZT_SIG_FXOKS
-#define SIG_PRI ZT_SIG_CLEAR
-#define SIG_SF ZT_SIG_SF
-#define SIG_SFWINK (0x0100000 | ZT_SIG_SF)
-#define SIG_SF_FEATD (0x0200000 | ZT_SIG_SF)
-#define SIG_SF_FEATDMF (0x0400000 | ZT_SIG_SF)
-#define SIG_SF_FEATB (0x0800000 | ZT_SIG_SF)
-#define SIG_EM_E1 ZT_SIG_EM_E1
-#define SIG_GR303FXOKS (0x0100000 | ZT_SIG_FXOKS)
-#define SIG_GR303FXSKS (0x0100000 | ZT_SIG_FXSKS)
+static const char config[] = "chan_dahdi.conf";
+
+#define SIG_EM DAHDI_SIG_EM
+#define SIG_EMWINK (0x0100000 | DAHDI_SIG_EM)
+#define SIG_FEATD (0x0200000 | DAHDI_SIG_EM)
+#define SIG_FEATDMF (0x0400000 | DAHDI_SIG_EM)
+#define SIG_FEATB (0x0800000 | DAHDI_SIG_EM)
+#define SIG_E911 (0x1000000 | DAHDI_SIG_EM)
+#define SIG_FEATDMF_TA (0x2000000 | DAHDI_SIG_EM)
+#define SIG_FGC_CAMA (0x4000000 | DAHDI_SIG_EM)
+#define SIG_FGC_CAMAMF (0x8000000 | DAHDI_SIG_EM)
+#define SIG_FXSLS DAHDI_SIG_FXSLS
+#define SIG_FXSGS DAHDI_SIG_FXSGS
+#define SIG_FXSKS DAHDI_SIG_FXSKS
+#define SIG_FXOLS DAHDI_SIG_FXOLS
+#define SIG_FXOGS DAHDI_SIG_FXOGS
+#define SIG_FXOKS DAHDI_SIG_FXOKS
+#define SIG_PRI DAHDI_SIG_CLEAR
+#define SIG_SF DAHDI_SIG_SF
+#define SIG_SFWINK (0x0100000 | DAHDI_SIG_SF)
+#define SIG_SF_FEATD (0x0200000 | DAHDI_SIG_SF)
+#define SIG_SF_FEATDMF (0x0400000 | DAHDI_SIG_SF)
+#define SIG_SF_FEATB (0x0800000 | DAHDI_SIG_SF)
+#define SIG_EM_E1 DAHDI_SIG_EM_E1
+#define SIG_GR303FXOKS (0x0100000 | DAHDI_SIG_FXOKS)
+#define SIG_GR303FXSKS (0x0100000 | DAHDI_SIG_FXSKS)
#define NUM_SPANS 32
#define NUM_DCHANS 4 /*!< No more than 4 d-channels */
@@ -229,7 +228,7 @@ static int gendigittimeout = 8000;
/*! \brief How long to wait for an extra digit, if there is an ambiguous match */
static int matchdigittimeout = 3000;
-/*! \brief Protect the interface list (of zt_pvt's) */
+/*! \brief Protect the interface list (of dahdi_pvt's) */
AST_MUTEX_DEFINE_STATIC(iflock);
@@ -249,27 +248,27 @@ static pthread_t monitor_thread = AST_PTHREADT_NULL;
static int restart_monitor(void);
-static enum ast_bridge_result zt_bridge(struct ast_channel *c0, struct ast_channel *c1, int flags, struct ast_frame **fo, struct ast_channel **rc, int timeoutms);
+static enum ast_bridge_result dahdi_bridge(struct ast_channel *c0, struct ast_channel *c1, int flags, struct ast_frame **fo, struct ast_channel **rc, int timeoutms);
-static int zt_sendtext(struct ast_channel *c, const char *text);
+static int dahdi_sendtext(struct ast_channel *c, const char *text);
-/*! \brief Avoid the silly zt_getevent which ignores a bunch of events */
-static inline int zt_get_event(int fd)
+/*! \brief Avoid the silly dahdi_getevent which ignores a bunch of events */
+static inline int dahdi_get_event(int fd)
{
int j;
- if (ioctl(fd, ZT_GETEVENT, &j) == -1)
+ if (ioctl(fd, DAHDI_GETEVENT, &j) == -1)
return -1;
return j;
}
-/*! \brief Avoid the silly zt_waitevent which ignores a bunch of events */
-static inline int zt_wait_event(int fd)
+/*! \brief Avoid the silly dahdi_waitevent which ignores a bunch of events */
+static inline int dahdi_wait_event(int fd)
{
int i, j = 0;
- i = ZT_IOMUX_SIGEVENT;
- if (ioctl(fd, ZT_IOMUX, &i) == -1)
+ i = DAHDI_IOMUX_SIGEVENT;
+ if (ioctl(fd, DAHDI_IOMUX, &i) == -1)
return -1;
- if (ioctl(fd, ZT_GETEVENT, &j) == -1)
+ if (ioctl(fd, DAHDI_GETEVENT, &j) == -1)
return -1;
return j;
}
@@ -286,7 +285,7 @@ static inline int zt_wait_event(int fd)
#define MIN_MS_SINCE_FLASH ( (2000) ) /*!< 2000 ms */
#define DEFAULT_RINGT ( (8000 * 8) / READ_SIZE) /*!< 8,000 ms */
-struct zt_pvt;
+struct dahdi_pvt;
static int ringt_base = DEFAULT_RINGT;
@@ -297,7 +296,7 @@ static int ringt_base = DEFAULT_RINGT;
#define PRI_SPAN(p) (((p) >> 8) & 0xff)
#define PRI_EXPLICIT(p) (((p) >> 16) & 0x01)
-struct zt_pri {
+struct dahdi_pri {
pthread_t master; /*!< Thread of master */
ast_mutex_t lock; /*!< Mutex */
char idleext[AST_MAX_EXTENSION]; /*!< Where to idle extra calls */
@@ -333,13 +332,13 @@ struct zt_pri {
int resetpos;
time_t lastreset; /*!< time when unused channels were last reset */
long resetinterval; /*!< Interval (in seconds) for resetting unused channels */
- struct zt_pvt *pvts[MAX_CHANNELS]; /*!< Member channel pvt structs */
- struct zt_pvt *crvs; /*!< Member CRV structs */
- struct zt_pvt *crvend; /*!< Pointer to end of CRV structs */
+ struct dahdi_pvt *pvts[MAX_CHANNELS]; /*!< Member channel pvt structs */
+ struct dahdi_pvt *crvs; /*!< Member CRV structs */
+ struct dahdi_pvt *crvend; /*!< Pointer to end of CRV structs */
};
-static struct zt_pri pris[NUM_SPANS];
+static struct dahdi_pri pris[NUM_SPANS];
#if 0
#define DEFAULT_PRI_DEBUG (PRI_DEBUG_Q931_DUMP | PRI_DEBUG_Q921_DUMP | PRI_DEBUG_Q921_RAW | PRI_DEBUG_Q921_STATE)
@@ -347,14 +346,14 @@ static struct zt_pri pris[NUM_SPANS];
#define DEFAULT_PRI_DEBUG 0
#endif
-static inline void pri_rel(struct zt_pri *pri)
+static inline void pri_rel(struct dahdi_pri *pri)
{
ast_mutex_unlock(&pri->lock);
}
#else
/*! Shut up the compiler */
-struct zt_pri;
+struct dahdi_pri;
#endif
#define SUB_REAL 0 /*!< Active call */
@@ -366,7 +365,7 @@ struct zt_pri;
#define POLARITY_REV 1
-static struct zt_distRings drings;
+static struct dahdi_distRings drings;
struct distRingData {
int ring[3];
@@ -374,7 +373,7 @@ struct distRingData {
struct ringContextData {
char contextData[AST_MAX_CONTEXT];
};
-struct zt_distRings {
+struct dahdi_distRings {
struct distRingData ringnum[3];
struct ringContextData ringContext[3];
};
@@ -385,8 +384,8 @@ static char *subnames[] = {
"Threeway"
};
-struct zt_subchannel {
- int zfd;
+struct dahdi_subchannel {
+ int dfd;
struct ast_channel *owner;
int chan;
short buffer[AST_FRIENDLY_OFFSET/2 + READ_SIZE];
@@ -401,7 +400,7 @@ struct zt_subchannel {
unsigned int needunhold:1;
unsigned int linear:1;
unsigned int inthreeway:1;
- ZT_CONFINFO curconf;
+ DAHDI_CONFINFO curconf;
};
#define CONF_USER_REAL (1 << 0)
@@ -409,29 +408,29 @@ struct zt_subchannel {
#define MAX_SLAVES 4
-static struct zt_pvt {
+static struct dahdi_pvt {
ast_mutex_t lock;
struct ast_channel *owner; /*!< Our current active owner (if applicable) */
/*!< Up to three channels can be associated with this call */
- struct zt_subchannel sub_unused; /*!< Just a safety precaution */
- struct zt_subchannel subs[3]; /*!< Sub-channels */
- struct zt_confinfo saveconf; /*!< Saved conference info */
+ struct dahdi_subchannel sub_unused; /*!< Just a safety precaution */
+ struct dahdi_subchannel subs[3]; /*!< Sub-channels */
+ DAHDI_CONFINFO saveconf; /*!< Saved conference info */
- struct zt_pvt *slaves[MAX_SLAVES]; /*!< Slave to us (follows our conferencing) */
- struct zt_pvt *master; /*!< Master to us (we follow their conferencing) */
+ struct dahdi_pvt *slaves[MAX_SLAVES]; /*!< Slave to us (follows our conferencing) */
+ struct dahdi_pvt *master; /*!< Master to us (we follow their conferencing) */
int inconference; /*!< If our real should be in the conference */
int sig; /*!< Signalling style */
int radio; /*!< radio type */
int outsigmod; /*!< Outbound Signalling style (modifier) */
int oprmode; /*!< "Operator Services" mode */
- struct zt_pvt *oprpeer; /*!< "Operator Services" peer tech_pvt ptr */
+ struct dahdi_pvt *oprpeer; /*!< "Operator Services" peer tech_pvt ptr */
float rxgain;
float txgain;
int tonezone; /*!< tone zone for this chan, or -1 for default */
- struct zt_pvt *next; /*!< Next channel in list */
- struct zt_pvt *prev; /*!< Prev channel in list */
+ struct dahdi_pvt *next; /*!< Next channel in list */
+ struct dahdi_pvt *prev; /*!< Prev channel in list */
/* flags */
unsigned int adsi:1;
@@ -477,7 +476,7 @@ static struct zt_pvt {
unsigned int use_callerid:1; /*!< Whether or not to use caller id on this channel */
unsigned int use_callingpres:1; /*!< Whether to use the callingpres the calling switch sends */
unsigned int usedistinctiveringdetection:1;
- unsigned int zaptrcallerid:1; /*!< should we use the callerid from incoming call on zap transfer or not */
+ unsigned int dahditrcallerid:1; /*!< should we use the callerid from incoming call on dahdi transfer or not */
unsigned int transfertobusy:1; /*!< allow flash-transfers to busy channels */
#if defined(HAVE_PRI)
unsigned int alerting:1;
@@ -491,7 +490,7 @@ static struct zt_pvt {
unsigned int use_smdi:1; /* Whether to use SMDI on this channel */
struct ast_smdi_interface *smdi_iface; /* The serial port to listen for SMDI data on */
- struct zt_distRings drings;
+ struct dahdi_distRings drings;
char context[AST_MAX_CONTEXT];
char defcontext[AST_MAX_CONTEXT];
@@ -546,7 +545,7 @@ static struct zt_pvt {
struct timeval flashtime; /*!< Last flash-hook time */
struct ast_dsp *dsp;
int cref; /*!< Call reference number */
- ZT_DIAL_OPERATION dop;
+ DAHDI_DIAL_OPERATION dop;
int whichwink; /*!< SIG_FEATDMF_TA Which wink are we on? */
char finaldial[64];
char accountcode[AST_MAX_ACCOUNT_CODE]; /*!< Account code */
@@ -565,9 +564,9 @@ static struct zt_pvt {
struct timeval polaritydelaytv;
int sendcalleridafter;
#ifdef HAVE_PRI
- struct zt_pri *pri;
- struct zt_pvt *bearer;
- struct zt_pvt *realcall;
+ struct dahdi_pri *pri;
+ struct dahdi_pvt *bearer;
+ struct dahdi_pvt *realcall;
q931_call *call;
int prioffset;
int logicalspan;
@@ -577,32 +576,32 @@ static struct zt_pvt {
char begindigit;
} *iflist = NULL, *ifend = NULL;
-/*! \brief Channel configuration from zapata.conf .
- * This struct is used for parsing the [channels] section of zapata.conf.
+/*! \brief Channel configuration from chan_dahdi.conf .
+ * This struct is used for parsing the [channels] section of chan_dahdi.conf.
* Generally there is a field here for every possible configuration item.
*
* The state of fields is saved along the parsing and whenever a 'channel'
- * statement is reached, the current zt_chan_conf is used to configure the
- * channel (struct zt_pvt)
+ * statement is reached, the current dahdi_chan_conf is used to configure the
+ * channel (struct dahdi_pvt)
*
- * @seealso zt_chan_init for the default values.
+ * @seealso dahdi_chan_init for the default values.
*/
-struct zt_chan_conf {
- struct zt_pvt chan;
+struct dahdi_chan_conf {
+ struct dahdi_pvt chan;
#ifdef HAVE_PRI
- struct zt_pri pri;
+ struct dahdi_pri pri;
#endif
- ZT_PARAMS timing;
+ DAHDI_PARAMS timing;
char smdi_port[SMDI_MAX_FILENAME_LEN];
};
-/** returns a new zt_chan_conf with default values (by-value) */
-static struct zt_chan_conf zt_chan_conf_default(void) {
+/** returns a new dahdi_chan_conf with default values (by-value) */
+static struct dahdi_chan_conf dahdi_chan_conf_default(void) {
/* recall that if a field is not included here it is initialized
* to 0 or equivalent
*/
- struct zt_chan_conf conf = {
+ struct dahdi_chan_conf conf = {
#ifdef HAVE_PRI
.pri = {
.nsf = PRI_NSF_NONE,
@@ -633,7 +632,7 @@ static struct zt_chan_conf zt_chan_conf_default(void) {
.cid_signalling = CID_SIG_BELL,
.cid_start = CID_START_RING,
- .zaptrcallerid = 0,
+ .dahditrcallerid = 0,
.use_callerid = 1,
.sig = -1,
.outsigmod = -1,
@@ -670,40 +669,40 @@ static struct zt_chan_conf zt_chan_conf_default(void) {
}
-static struct ast_channel *zt_request(const char *type, int format, void *data, int *cause);
-static int zt_digit_begin(struct ast_channel *ast, char digit);
-static int zt_digit_end(struct ast_channel *ast, char digit, unsigned int duration);
-static int zt_sendtext(struct ast_channel *c, const char *text);
-static int zt_call(struct ast_channel *ast, char *rdest, int timeout);
-static int zt_hangup(struct ast_channel *ast);
-static int zt_answer(struct ast_channel *ast);
-static struct ast_frame *zt_read(struct ast_channel *ast);
-static int zt_write(struct ast_channel *ast, struct ast_frame *frame);
-static struct ast_frame *zt_exception(struct ast_channel *ast);
-static int zt_indicate(struct ast_channel *chan, int condition, const void *data, size_t datalen);
-static int zt_fixup(struct ast_channel *oldchan, struct ast_channel *newchan);
-static int zt_setoption(struct ast_channel *chan, int option, void *data, int datalen);
-static int zt_func_read(struct ast_channel *chan, char *function, char *data, char *buf, size_t len);
-
-static const struct ast_channel_tech zap_tech = {
- .type = "Zap",
+static struct ast_channel *dahdi_request(const char *type, int format, void *data, int *cause);
+static int dahdi_digit_begin(struct ast_channel *ast, char digit);
+static int dahdi_digit_end(struct ast_channel *ast, char digit, unsigned int duration);
+static int dahdi_sendtext(struct ast_channel *c, const char *text);
+static int dahdi_call(struct ast_channel *ast, char *rdest, int timeout);
+static int dahdi_hangup(struct ast_channel *ast);
+static int dahdi_answer(struct ast_channel *ast);
+static struct ast_frame *dahdi_read(struct ast_channel *ast);
+static int dahdi_write(struct ast_channel *ast, struct ast_frame *frame);
+static struct ast_frame *dahdi_exception(struct ast_channel *ast);
+static int dahdi_indicate(struct ast_channel *chan, int condition, const void *data, size_t datalen);
+static int dahdi_fixup(struct ast_channel *oldchan, struct ast_channel *newchan);
+static int dahdi_setoption(struct ast_channel *chan, int option, void *data, int datalen);
+static int dahdi_func_read(struct ast_channel *chan, char *function, char *data, char *buf, size_t len);
+
+static const struct ast_channel_tech dahdi_tech = {
+ .type = "DAHDI",
.description = tdesc,
.capabilities = AST_FORMAT_SLINEAR | AST_FORMAT_ULAW | AST_FORMAT_ALAW,
- .requester = zt_request,
- .send_digit_begin = zt_digit_begin,
- .send_digit_end = zt_digit_end,
- .send_text = zt_sendtext,
- .call = zt_call,
- .hangup = zt_hangup,
- .answer = zt_answer,
- .read = zt_read,
- .write = zt_write,
- .bridge = zt_bridge,
- .exception = zt_exception,
- .indicate = zt_indicate,
- .fixup = zt_fixup,
- .setoption = zt_setoption,
- .func_channel_read = zt_func_read,
+ .requester = dahdi_request,
+ .send_digit_begin = dahdi_digit_begin,
+ .send_digit_end = dahdi_digit_end,
+ .send_text = dahdi_sendtext,
+ .call = dahdi_call,
+ .hangup = dahdi_hangup,
+ .answer = dahdi_answer,
+ .read = dahdi_read,
+ .write = dahdi_write,
+ .bridge = dahdi_bridge,
+ .exception = dahdi_exception,
+ .indicate = dahdi_indicate,
+ .fixup = dahdi_fixup,
+ .setoption = dahdi_setoption,
+ .func_channel_read = dahdi_func_read,
};
#ifdef HAVE_PRI
@@ -712,10 +711,10 @@ static const struct ast_channel_tech zap_tech = {
#define GET_CHANNEL(p) ((p)->channel)
#endif
-struct zt_pvt *round_robin[32];
+struct dahdi_pvt *round_robin[32];
#ifdef HAVE_PRI
-static inline int pri_grab(struct zt_pvt *pvt, struct zt_pri *pri)
+static inline int pri_grab(struct dahdi_pvt *pvt, struct dahdi_pri *pri)
{
int res;
/* Grab the lock first */
@@ -735,7 +734,7 @@ static inline int pri_grab(struct zt_pvt *pvt, struct zt_pri *pri)
static int num_cadence = 4;
static int user_has_defined_cadences = 0;
-static struct zt_ring_cadence cadences[NUM_CADENCE_MAX] = {
+static struct dahdi_ring_cadence cadences[NUM_CADENCE_MAX] = {
{ { 125, 125, 2000, 4000 } }, /*!< Quick chirp followed by normal ring */
{ { 250, 250, 500, 1000, 250, 250, 500, 4000 } }, /*!< British style ring */
{ { 125, 125, 125, 125, 125, 4000 } }, /*!< Three short bursts */
@@ -756,10 +755,10 @@ static int cidrings[NUM_CADENCE_MAX] = {
#define ISTRUNK(p) ((p->sig == SIG_FXSLS) || (p->sig == SIG_FXSKS) || \
(p->sig == SIG_FXSGS) || (p->sig == SIG_PRI))
-#define CANBUSYDETECT(p) (ISTRUNK(p) || (p->sig & (SIG_EM | SIG_EM_E1 | SIG_SF)) /* || (p->sig & __ZT_SIG_FXO) */)
-#define CANPROGRESSDETECT(p) (ISTRUNK(p) || (p->sig & (SIG_EM | SIG_EM_E1 | SIG_SF)) /* || (p->sig & __ZT_SIG_FXO) */)
+#define CANBUSYDETECT(p) (ISTRUNK(p) || (p->sig & (SIG_EM | SIG_EM_E1 | SIG_SF)) /* || (p->sig & __DAHDI_SIG_FXO) */)
+#define CANPROGRESSDETECT(p) (ISTRUNK(p) || (p->sig & (SIG_EM | SIG_EM_E1 | SIG_SF)) /* || (p->sig & __DAHDI_SIG_FXO) */)
-static int zt_get_index(struct ast_channel *ast, struct zt_pvt *p, int nullok)
+static int dahdi_get_index(struct ast_channel *ast, struct dahdi_pvt *p, int nullok)
{
int res;
if (p->subs[0].owner == ast)
@@ -777,9 +776,9 @@ static int zt_get_index(struct ast_channel *ast, struct zt_pvt *p, int nullok)
}
#ifdef HAVE_PRI
-static void wakeup_sub(struct zt_pvt *p, int a, struct zt_pri *pri)
+static void wakeup_sub(struct dahdi_pvt *p, int a, struct dahdi_pri *pri)
#else
-static void wakeup_sub(struct zt_pvt *p, int a, void *pri)
+static void wakeup_sub(struct dahdi_pvt *p, int a, void *pri)
#endif
{
#ifdef HAVE_PRI
@@ -805,9 +804,9 @@ static void wakeup_sub(struct zt_pvt *p, int a, void *pri)
}
#ifdef HAVE_PRI
-static void zap_queue_frame(struct zt_pvt *p, struct ast_frame *f, struct zt_pri *pri)
+static void dahdi_queue_frame(struct dahdi_pvt *p, struct ast_frame *f, struct dahdi_pri *pri)
#else
-static void zap_queue_frame(struct zt_pvt *p, struct ast_frame *f, void *pri)
+static void dahdi_queue_frame(struct dahdi_pvt *p, struct ast_frame *f, void *pri)
#endif
{
/* We must unlock the PRI to avoid the possibility of a deadlock */
@@ -833,9 +832,9 @@ static void zap_queue_frame(struct zt_pvt *p, struct ast_frame *f, void *pri)
#endif
}
-static int restore_gains(struct zt_pvt *p);
+static int restore_gains(struct dahdi_pvt *p);
-static void swap_subs(struct zt_pvt *p, int a, int b)
+static void swap_subs(struct dahdi_pvt *p, int a, int b)
{
int tchan;
int tinthreeway;
@@ -856,14 +855,14 @@ static void swap_subs(struct zt_pvt *p, int a, int b)
p->subs[b].inthreeway = tinthreeway;
if (p->subs[a].owner)
- p->subs[a].owner->fds[0] = p->subs[a].zfd;
+ p->subs[a].owner->fds[0] = p->subs[a].dfd;
if (p->subs[b].owner)
- p->subs[b].owner->fds[0] = p->subs[b].zfd;
+ p->subs[b].owner->fds[0] = p->subs[b].dfd;
wakeup_sub(p, a, NULL);
wakeup_sub(p, b, NULL);
}
-static int zt_open(char *fn)
+static int dahdi_open(char *fn)
{
int fd;
int isnum;
@@ -883,7 +882,11 @@ static int zt_open(char *fn)
ast_log(LOG_WARNING, "Invalid channel number '%s'\n", fn);
return -1;
}
+#ifdef HAVE_ZAPTEL
fn = "/dev/zap/channel";
+#else
+ fn = "/dev/dahdi/channel";
+#endif
}
fd = open(fn, O_RDWR | O_NONBLOCK);
if (fd < 0) {
@@ -891,7 +894,7 @@ static int zt_open(char *fn)
return -1;
}
if (chan) {
- if (ioctl(fd, ZT_SPECIFY, &chan)) {
+ if (ioctl(fd, DAHDI_SPECIFY, &chan)) {
x = errno;
close(fd);
errno = x;
@@ -900,7 +903,7 @@ static int zt_open(char *fn)
}
}
bs = READ_SIZE;
- if (ioctl(fd, ZT_SET_BLOCKSIZE, &bs) == -1) {
+ if (ioctl(fd, DAHDI_SET_BLOCKSIZE, &bs) == -1) {
ast_log(LOG_WARNING, "Unable to set blocksize '%d': %s\n", bs, strerror(errno));
x = errno;
close(fd);
@@ -910,48 +913,52 @@ static int zt_open(char *fn)
return fd;
}
-static void zt_close(int fd)
+static void dahdi_close(int fd)
{
if (fd > 0)
close(fd);
}
-static int zt_setlinear(int zfd, int linear)
+static int dahdi_setlinear(int dfd, int linear)
{
int res;
- res = ioctl(zfd, ZT_SETLINEAR, &linear);
+ res = ioctl(dfd, DAHDI_SETLINEAR, &linear);
if (res)
return res;
return 0;
}
-static int alloc_sub(struct zt_pvt *p, int x)
+static int alloc_sub(struct dahdi_pvt *p, int x)
{
- ZT_BUFFERINFO bi;
+ DAHDI_BUFFERINFO bi;
int res;
- if (p->subs[x].zfd < 0) {
- p->subs[x].zfd = zt_open("/dev/zap/pseudo");
- if (p->subs[x].zfd > -1) {
- res = ioctl(p->subs[x].zfd, ZT_GET_BUFINFO, &bi);
+ if (p->subs[x].dfd < 0) {
+#ifdef HAVE_ZAPTEL
+ p->subs[x].dfd = dahdi_open("/dev/zap/pseudo");
+#else
+ p->subs[x].dfd = dahdi_open("/dev/dahdi/pseudo");
+#endif
+ if (p->subs[x].dfd > -1) {
+ res = ioctl(p->subs[x].dfd, DAHDI_GET_BUFINFO, &bi);
if (!res) {
- bi.txbufpolicy = ZT_POLICY_IMMEDIATE;
- bi.rxbufpolicy = ZT_POLICY_IMMEDIATE;
+ bi.txbufpolicy = DAHDI_POLICY_IMMEDIATE;
+ bi.rxbufpolicy = DAHDI_POLICY_IMMEDIATE;
bi.numbufs = numbufs;
- res = ioctl(p->subs[x].zfd, ZT_SET_BUFINFO, &bi);
+ res = ioctl(p->subs[x].dfd, DAHDI_SET_BUFINFO, &bi);
if (res < 0) {
ast_log(LOG_WARNING, "Unable to set buffer policy on channel %d\n", x);
}
} else
ast_log(LOG_WARNING, "Unable to check buffer policy on channel %d\n", x);
- if (ioctl(p->subs[x].zfd, ZT_CHANNO, &p->subs[x].chan) == 1) {
- ast_log(LOG_WARNING, "Unable to get channel number for pseudo channel on FD %d\n", p->subs[x].zfd);
- zt_close(p->subs[x].zfd);
- p->subs[x].zfd = -1;
+ if (ioctl(p->subs[x].dfd, DAHDI_CHANNO, &p->subs[x].chan) == 1) {
+ ast_log(LOG_WARNING, "Unable to get channel number for pseudo channel on FD %d\n", p->subs[x].dfd);
+ dahdi_close(p->subs[x].dfd);
+ p->subs[x].dfd = -1;
return -1;
}
if (option_debug)
- ast_log(LOG_DEBUG, "Allocated %s subchannel on FD %d channel %d\n", subnames[x], p->subs[x].zfd, p->subs[x].chan);
+ ast_log(LOG_DEBUG, "Allocated %s subchannel on FD %d channel %d\n", subnames[x], p->subs[x].dfd, p->subs[x].chan);
return 0;
} else
ast_log(LOG_WARNING, "Unable to open pseudo channel: %s\n", strerror(errno));
@@ -961,17 +968,17 @@ static int alloc_sub(struct zt_pvt *p, int x)
return -1;
}
-static int unalloc_sub(struct zt_pvt *p, int x)
+static int unalloc_sub(struct dahdi_pvt *p, int x)
{
if (!x) {
ast_log(LOG_WARNING, "Trying to unalloc the real channel %d?!?\n", p->channel);
return -1;
}
ast_log(LOG_DEBUG, "Released sub %d of channel %d\n", x, p->channel);
- if (p->subs[x].zfd > -1) {
- zt_close(p->subs[x].zfd);
+ if (p->subs[x].dfd > -1) {
+ dahdi_close(p->subs[x].dfd);
}
- p->subs[x].zfd = -1;
+ p->subs[x].dfd = -1;
p->subs[x].linear = 0;
p->subs[x].chan = 0;
p->subs[x].owner = NULL;
@@ -984,22 +991,22 @@ static int unalloc_sub(struct zt_pvt *p, int x)
static int digit_to_dtmfindex(char digit)
{
if (isdigit(digit))
- return ZT_TONE_DTMF_BASE + (digit - '0');
+ return DAHDI_TONE_DTMF_BASE + (digit - '0');
else if (digit >= 'A' && digit <= 'D')
- return ZT_TONE_DTMF_A + (digit - 'A');
+ return DAHDI_TONE_DTMF_A + (digit - 'A');
else if (digit >= 'a' && digit <= 'd')
- return ZT_TONE_DTMF_A + (digit - 'a');
+ return DAHDI_TONE_DTMF_A + (digit - 'a');
else if (digit == '*')
- return ZT_TONE_DTMF_s;
+ return DAHDI_TONE_DTMF_s;
else if (digit == '#')
- return ZT_TONE_DTMF_p;
+ return DAHDI_TONE_DTMF_p;
else
return -1;
}
-static int zt_digit_begin(struct ast_channel *chan, char digit)
+static int dahdi_digit_begin(struct ast_channel *chan, char digit)
{
- struct zt_pvt *pvt;
+ struct dahdi_pvt *pvt;
int index;
int dtmf = -1;
@@ -1007,7 +1014,7 @@ static int zt_digit_begin(struct ast_channel *chan, char digit)
ast_mutex_lock(&pvt->lock);
- index = zt_get_index(chan, pvt, 0);
+ index = dahdi_get_index(chan, pvt, 0);
if ((index != SUB_REAL) || !pvt->owner)
goto out;
@@ -1033,15 +1040,15 @@ static int zt_digit_begin(struct ast_channel *chan, char digit)
if ((dtmf = digit_to_dtmfindex(digit)) == -1)
goto out;
- if (pvt->pulse || ioctl(pvt->subs[SUB_REAL].zfd, ZT_SENDTONE, &dtmf)) {
+ if (pvt->pulse || ioctl(pvt->subs[SUB_REAL].dfd, DAHDI_SENDTONE, &dtmf)) {
int res;
- ZT_DIAL_OPERATION zo = {
- .op = ZT_DIAL_OP_APPEND,
+ DAHDI_DIAL_OPERATION zo = {
+ .op = DAHDI_DIAL_OP_APPEND,
.dialstr[0] = 'T',
.dialstr[1] = digit,
.dialstr[2] = 0,
};
- if ((res = ioctl(pvt->subs[SUB_REAL].zfd, ZT_DIAL, &zo)))
+ if ((res = ioctl(pvt->subs[SUB_REAL].dfd, DAHDI_DIAL, &zo)))
ast_log(LOG_WARNING, "Couldn't dial digit %c\n", digit);
else
pvt->dialing = 1;
@@ -1057,9 +1064,9 @@ out:
return 0;
}
-static int zt_digit_end(struct ast_channel *chan, char digit, unsigned int duration)
+static int dahdi_digit_end(struct ast_channel *chan, char digit, unsigned int duration)
{
- struct zt_pvt *pvt;
+ struct dahdi_pvt *pvt;
int res = 0;
int index;
int x;
@@ -1068,7 +1075,7 @@ static int zt_digit_end(struct ast_channel *chan, char digit, unsigned int durat
ast_mutex_lock(&pvt->lock);
- index = zt_get_index(chan, pvt, 0);
+ index = dahdi_get_index(chan, pvt, 0);
if ((index != SUB_REAL) || !pvt->owner || pvt->pulse)
goto out;
@@ -1082,7 +1089,7 @@ static int zt_digit_end(struct ast_channel *chan, char digit, unsigned int durat
if (pvt->begindigit) {
x = -1;
ast_log(LOG_DEBUG, "Ending VLDTMF digit '%c'\n", digit);
- res = ioctl(pvt->subs[SUB_REAL].zfd, ZT_SENDTONE, &x);
+ res = ioctl(pvt->subs[SUB_REAL].dfd, DAHDI_SENDTONE, &x);
pvt->dialing = 0;
pvt->begindigit = 0;
}
@@ -1119,13 +1126,13 @@ static struct {
int alarm;
char *name;
} alarms[] = {
- { ZT_ALARM_RED, "Red Alarm" },
- { ZT_ALARM_YELLOW, "Yellow Alarm" },
- { ZT_ALARM_BLUE, "Blue Alarm" },
- { ZT_ALARM_RECOVER, "Recovering" },
- { ZT_ALARM_LOOPBACK, "Loopback" },
- { ZT_ALARM_NOTOPEN, "Not Open" },
- { ZT_ALARM_NONE, "None" },
+ { DAHDI_ALARM_RED, "Red Alarm" },
+ { DAHDI_ALARM_YELLOW, "Yellow Alarm" },
+ { DAHDI_ALARM_BLUE, "Blue Alarm" },
+ { DAHDI_ALARM_RECOVER, "Recovering" },
+ { DAHDI_ALARM_LOOPBACK, "Loopback" },
+ { DAHDI_ALARM_NOTOPEN, "Not Open" },
+ { DAHDI_ALARM_NONE, "None" },
};
static char *alarm2str(int alarm)
@@ -1157,7 +1164,7 @@ static char *dialplan2str(int dialplan)
}
#endif
-static char *zap_sig2str(int sig)
+static char *dahdi_sig2str(int sig)
{
static char buf[256];
switch (sig) {
@@ -1217,62 +1224,62 @@ static char *zap_sig2str(int sig)
}
}
-#define sig2str zap_sig2str
+#define sig2str dahdi_sig2str
-static int conf_add(struct zt_pvt *p, struct zt_subchannel *c, int index, int slavechannel)
+static int conf_add(struct dahdi_pvt *p, struct dahdi_subchannel *c, int index, int slavechannel)
{
/* If the conference already exists, and we're already in it
don't bother doing anything */
- ZT_CONFINFO zi;
+ DAHDI_CONFINFO zi;
memset(&zi, 0, sizeof(zi));
zi.chan = 0;
if (slavechannel > 0) {
/* If we have only one slave, do a digital mon */
- zi.confmode = ZT_CONF_DIGITALMON;
+ zi.confmode = DAHDI_CONF_DIGITALMON;
zi.confno = slavechannel;
} else {
if (!index) {
/* Real-side and pseudo-side both participate in conference */
- zi.confmode = ZT_CONF_REALANDPSEUDO | ZT_CONF_TALKER | ZT_CONF_LISTENER |
- ZT_CONF_PSEUDO_TALKER | ZT_CONF_PSEUDO_LISTENER;
+ zi.confmode = DAHDI_CONF_REALANDPSEUDO | DAHDI_CONF_TALKER | DAHDI_CONF_LISTENER |
+ DAHDI_CONF_PSEUDO_TALKER | DAHDI_CONF_PSEUDO_LISTENER;
} else
- zi.confmode = ZT_CONF_CONF | ZT_CONF_TALKER | ZT_CONF_LISTENER;
+ zi.confmode = DAHDI_CONF_CONF | DAHDI_CONF_TALKER | DAHDI_CONF_LISTENER;
zi.confno = p->confno;
}
if ((zi.confno == c->curconf.confno) && (zi.confmode == c->curconf.confmode))
return 0;
- if (c->zfd < 0)
+ if (c->dfd < 0)
return 0;
- if (ioctl(c->zfd, ZT_SETCONF, &zi)) {
- ast_log(LOG_WARNING, "Failed to add %d to conference %d/%d\n", c->zfd, zi.confmode, zi.confno);
+ if (ioctl(c->dfd, DAHDI_SETCONF, &zi)) {
+ ast_log(LOG_WARNING, "Failed to add %d to conference %d/%d\n", c->dfd, zi.confmode, zi.confno);
return -1;
}
if (slavechannel < 1) {
p->confno = zi.confno;
}
memcpy(&c->curconf, &zi, sizeof(c->curconf));
- ast_log(LOG_DEBUG, "Added %d to conference %d/%d\n", c->zfd, c->curconf.confmode, c->curconf.confno);
+ ast_log(LOG_DEBUG, "Added %d to conference %d/%d\n", c->dfd, c->curconf.confmode, c->curconf.confno);
return 0;
}
-static int isourconf(struct zt_pvt *p, struct zt_subchannel *c)
+static int isourconf(struct dahdi_pvt *p, struct dahdi_subchannel *c)
{
/* If they're listening to our channel, they're ours */
- if ((p->channel == c->curconf.confno) && (c->curconf.confmode == ZT_CONF_DIGITALMON))
+ if ((p->channel == c->curconf.confno) && (c->curconf.confmode == DAHDI_CONF_DIGITALMON))
return 1;
/* If they're a talker on our (allocated) conference, they're ours */
- if ((p->confno > 0) && (p->confno == c->curconf.confno) && (c->curconf.confmode & ZT_CONF_TALKER))
+ if ((p->confno > 0) && (p->confno == c->curconf.confno) && (c->curconf.confmode & DAHDI_CONF_TALKER))
return 1;
return 0;
}
-static int conf_del(struct zt_pvt *p, struct zt_subchannel *c, int index)
+static int conf_del(struct dahdi_pvt *p, struct dahdi_subchannel *c, int index)
{
- ZT_CONFINFO zi;
- if (/* Can't delete if there's no zfd */
- (c->zfd < 0) ||
+ DAHDI_CONFINFO zi;
+ if (/* Can't delete if there's no dfd */
+ (c->dfd < 0) ||
/* Don't delete from the conference if it's not our conference */
!isourconf(p, c)
/* Don't delete if we don't think it's conferenced at all (implied) */
@@ -1281,27 +1288,27 @@ static int conf_del(struct zt_pvt *p, struct zt_subchannel *c, int index)
zi.chan = 0;
zi.confno = 0;
zi.confmode = 0;
- if (ioctl(c->zfd, ZT_SETCONF, &zi)) {
- ast_log(LOG_WARNING, "Failed to drop %d from conference %d/%d\n", c->zfd, c->curconf.confmode, c->curconf.confno);
+ if (ioctl(c->dfd, DAHDI_SETCONF, &zi)) {
+ ast_log(LOG_WARNING, "Failed to drop %d from conference %d/%d\n", c->dfd, c->curconf.confmode, c->curconf.confno);
return -1;
}
- ast_log(LOG_DEBUG, "Removed %d from conference %d/%d\n", c->zfd, c->curconf.confmode, c->curconf.confno);
+ ast_log(LOG_DEBUG, "Removed %d from conference %d/%d\n", c->dfd, c->curconf.confmode, c->curconf.confno);
memcpy(&c->curconf, &zi, sizeof(c->curconf));
return 0;
}
-static int isslavenative(struct zt_pvt *p, struct zt_pvt **out)
+static int isslavenative(struct dahdi_pvt *p, struct dahdi_pvt **out)
{
int x;
int useslavenative;
- struct zt_pvt *slave = NULL;
+ struct dahdi_pvt *slave = NULL;
/* Start out optimistic */
useslavenative = 1;
/* Update conference state in a stateless fashion */
for (x = 0; x < 3; x++) {
/* Any three-way calling makes slave native mode *definitely* out
of the question */
- if ((p->subs[x].zfd > -1) && p->subs[x].inthreeway)
+ if ((p->subs[x].dfd > -1) && p->subs[x].inthreeway)
useslavenative = 0;
}
/* If we don't have any 3-way calls, check to see if we have
@@ -1334,31 +1341,31 @@ static int isslavenative(struct zt_pvt *p, struct zt_pvt **out)
return useslavenative;
}
-static int reset_conf(struct zt_pvt *p)
+static int reset_conf(struct dahdi_pvt *p)
{
- ZT_CONFINFO zi;
+ DAHDI_CONFINFO zi;
memset(&zi, 0, sizeof(zi));
p->confno = -1;
memset(&p->subs[SUB_REAL].curconf, 0, sizeof(p->subs[SUB_REAL].curconf));
- if (p->subs[SUB_REAL].zfd > -1) {
- if (ioctl(p->subs[SUB_REAL].zfd, ZT_SETCONF, &zi))
+ if (p->subs[SUB_REAL].dfd > -1) {
+ if (ioctl(p->subs[SUB_REAL].dfd, DAHDI_SETCONF, &zi))
ast_log(LOG_WARNING, "Failed to reset conferencing on channel %d!\n", p->channel);
}
return 0;
}
-static int update_conf(struct zt_pvt *p)
+static int update_conf(struct dahdi_pvt *p)
{
int needconf = 0;
int x;
int useslavenative;
- struct zt_pvt *slave = NULL;
+ struct dahdi_pvt *slave = NULL;
useslavenative = isslavenative(p, &slave);
/* Start with the obvious, general stuff */
for (x = 0; x < 3; x++) {
/* Look for three way calls */
- if ((p->subs[x].zfd > -1) && p->subs[x].inthreeway) {
+ if ((p->subs[x].dfd > -1) && p->subs[x].inthreeway) {
conf_add(p, &p->subs[x], x, 0);
needconf++;
} else {
@@ -1404,7 +1411,7 @@ static int update_conf(struct zt_pvt *p)
return 0;
}
-static void zt_enable_ec(struct zt_pvt *p)
+static void dahdi_enable_ec(struct dahdi_pvt *p)
{
int x;
int res;
@@ -1421,12 +1428,12 @@ static void zt_enable_ec(struct zt_pvt *p)
if (p->echocancel) {
if (p->sig == SIG_PRI) {
x = 1;
- res = ioctl(p->subs[SUB_REAL].zfd, ZT_AUDIOMODE, &x);
+ res = ioctl(p->subs[SUB_REAL].dfd, DAHDI_AUDIOMODE, &x);
if (res)
ast_log(LOG_WARNING, "Unable to enable audio mode on channel %d (%s)\n", p->channel, strerror(errno));
}
x = p->echocancel;
- res = ioctl(p->subs[SUB_REAL].zfd, ZT_ECHOCANCEL, &x);
+ res = ioctl(p->subs[SUB_REAL].dfd, DAHDI_ECHOCANCEL, &x);
if (res)
ast_log(LOG_WARNING, "Unable to enable echo cancellation on channel %d (%s)\n", p->channel, strerror(errno));
else {
@@ -1438,13 +1445,13 @@ static void zt_enable_ec(struct zt_pvt *p)
ast_log(LOG_DEBUG, "No echo cancellation requested\n");
}
-static void zt_train_ec(struct zt_pvt *p)
+static void dahdi_train_ec(struct dahdi_pvt *p)
{
int x;
int res;
if (p && p->echocancel && p->echotraining) {
x = p->echotraining;
- res = ioctl(p->subs[SUB_REAL].zfd, ZT_ECHOTRAIN, &x);
+ res = ioctl(p->subs[SUB_REAL].dfd, DAHDI_ECHOTRAIN, &x);
if (res)
ast_log(LOG_WARNING, "Unable to request echo training on channel %d\n", p->channel);
else {
@@ -1454,13 +1461,13 @@ static void zt_train_ec(struct zt_pvt *p)
ast_log(LOG_DEBUG, "No echo training requested\n");
}
-static void zt_disable_ec(struct zt_pvt *p)
+static void dahdi_disable_ec(struct dahdi_pvt *p)
{
int x;
int res;
if (p->echocancel) {
x = 0;
- res = ioctl(p->subs[SUB_REAL].zfd, ZT_ECHOCANCEL, &x);
+ res = ioctl(p->subs[SUB_REAL].dfd, DAHDI_ECHOCANCEL, &x);
if (res)
ast_log(LOG_WARNING, "Unable to disable echo cancellation on channel %d\n", p->channel);
else if (option_debug)
@@ -1469,14 +1476,14 @@ static void zt_disable_ec(struct zt_pvt *p)
p->echocanon = 0;
}
-static void fill_txgain(struct zt_gains *g, float gain, int law)
+static void fill_txgain(DAHDI_GAINS *g, float gain, int law)
{
int j;
int k;
float linear_gain = pow(10.0, gain / 20.0);
switch (law) {
- case ZT_LAW_ALAW:
+ case DAHDI_LAW_ALAW:
for (j = 0; j < (sizeof(g->txgain) / sizeof(g->txgain[0])); j++) {
if (gain) {
k = (int) (((float) AST_ALAW(j)) * linear_gain);
@@ -1488,7 +1495,7 @@ static void fill_txgain(struct zt_gains *g, float gain, int law)
}
}
break;
- case ZT_LAW_MULAW:
+ case DAHDI_LAW_MULAW:
for (j = 0; j < (sizeof(g->txgain) / sizeof(g->txgain[0])); j++) {
if (gain) {
k = (int) (((float) AST_MULAW(j)) * linear_gain);
@@ -1503,14 +1510,14 @@ static void fill_txgain(struct zt_gains *g, float gain, int law)
}
}
-static void fill_rxgain(struct zt_gains *g, float gain, int law)
+static void fill_rxgain(DAHDI_GAINS *g, float gain, int law)
{
int j;
int k;
float linear_gain = pow(10.0, gain / 20.0);
switch (law) {
- case ZT_LAW_ALAW:
+ case DAHDI_LAW_ALAW:
for (j = 0; j < (sizeof(g->rxgain) / sizeof(g->rxgain[0])); j++) {
if (gain) {
k = (int) (((float) AST_ALAW(j)) * linear_gain);
@@ -1522,7 +1529,7 @@ static void fill_rxgain(struct zt_gains *g, float gain, int law)
}
}
break;
- case ZT_LAW_MULAW:
+ case DAHDI_LAW_MULAW:
for (j = 0; j < (sizeof(g->rxgain) / sizeof(g->rxgain[0])); j++) {
if (gain) {
k = (int) (((float) AST_MULAW(j)) * linear_gain);
@@ -1539,12 +1546,12 @@ static void fill_rxgain(struct zt_gains *g, float gain, int law)
static int set_actual_txgain(int fd, int chan, float gain, int law)
{
- struct zt_gains g;
+ DAHDI_GAINS g;
int res;
memset(&g, 0, sizeof(g));
g.chan = chan;
- res = ioctl(fd, ZT_GETGAINS, &g);
+ res = ioctl(fd, DAHDI_GETGAINS, &g);
if (res) {
if (option_debug)
ast_log(LOG_DEBUG, "Failed to read gains: %s\n", strerror(errno));
@@ -1553,17 +1560,17 @@ static int set_actual_txgain(int fd, int chan, float gain, int law)
fill_txgain(&g, gain, law);
- return ioctl(fd, ZT_SETGAINS, &g);
+ return ioctl(fd, DAHDI_SETGAINS, &g);
}
static int set_actual_rxgain(int fd, int chan, float gain, int law)
{
- struct zt_gains g;
+ DAHDI_GAINS g;
int res;
memset(&g, 0, sizeof(g));
g.chan = chan;
- res = ioctl(fd, ZT_GETGAINS, &g);
+ res = ioctl(fd, DAHDI_GETGAINS, &g);
if (res) {
ast_log(LOG_DEBUG, "Failed to read gains: %s\n", strerror(errno));
return res;
@@ -1571,7 +1578,7 @@ static int set_actual_rxgain(int fd, int chan, float gain, int law)
fill_rxgain(&g, gain, law);
- return ioctl(fd, ZT_SETGAINS, &g);
+ return ioctl(fd, DAHDI_SETGAINS, &g);
}
static int set_actual_gain(int fd, int chan, float rxgain, float txgain, int law)
@@ -1579,12 +1586,12 @@ static int set_actual_gain(int fd, int chan, float rxgain, float txgain, int law
return set_actual_txgain(fd, chan, txgain, law) | set_actual_rxgain(fd, chan, rxgain, law);
}
-static int bump_gains(struct zt_pvt *p)
+static int bump_gains(struct dahdi_pvt *p)
{
int res;
/* Bump receive gain by 5.0db */
- res = set_actual_gain(p->subs[SUB_REAL].zfd, 0, p->rxgain + 5.0, p->txgain, p->law);
+ res = set_actual_gain(p->subs[SUB_REAL].dfd, 0, p->rxgain + 5.0, p->txgain, p->law);
if (res) {
ast_log(LOG_WARNING, "Unable to bump gain: %s\n", strerror(errno));
return -1;
@@ -1593,11 +1600,11 @@ static int bump_gains(struct zt_pvt *p)
return 0;
}
-static int restore_gains(struct zt_pvt *p)
+static int restore_gains(struct dahdi_pvt *p)
{
int res;
- res = set_actual_gain(p->subs[SUB_REAL].zfd, 0, p->rxgain, p->txgain, p->law);
+ res = set_actual_gain(p->subs[SUB_REAL].dfd, 0, p->rxgain, p->txgain, p->law);
if (res) {
ast_log(LOG_WARNING, "Unable to restore gains: %s\n", strerror(errno));
return -1;
@@ -1606,48 +1613,48 @@ static int restore_gains(struct zt_pvt *p)
return 0;
}
-static inline int zt_set_hook(int fd, int hs)
+static inline int dahdi_set_hook(int fd, int hs)
{
int x, res;
x = hs;
- res = ioctl(fd, ZT_HOOK, &x);
+ res = ioctl(fd, DAHDI_HOOK, &x);
if (res < 0) {
if (errno == EINPROGRESS)
return 0;
- ast_log(LOG_WARNING, "zt hook failed: %s\n", strerror(errno));
+ ast_log(LOG_WARNING, "dahdi hook failed: %s\n", strerror(errno));
}
return res;
}
-static inline int zt_confmute(struct zt_pvt *p, int muted)
+static inline int dahdi_confmute(struct dahdi_pvt *p, int muted)
{
int x, y, res;
x = muted;
if (p->sig == SIG_PRI) {
y = 1;
- res = ioctl(p->subs[SUB_REAL].zfd, ZT_AUDIOMODE, &y);
+ res = ioctl(p->subs[SUB_REAL].dfd, DAHDI_AUDIOMODE, &y);
if (res)
ast_log(LOG_WARNING, "Unable to set audio mode on '%d'\n", p->channel);
}
- res = ioctl(p->subs[SUB_REAL].zfd, ZT_CONFMUTE, &x);
+ res = ioctl(p->subs[SUB_REAL].dfd, DAHDI_CONFMUTE, &x);
if (res < 0)
- ast_log(LOG_WARNING, "zt confmute(%d) failed on channel %d: %s\n", muted, p->channel, strerror(errno));
+ ast_log(LOG_WARNING, "dahdi confmute(%d) failed on channel %d: %s\n", muted, p->channel, strerror(errno));
return res;
}
-static int save_conference(struct zt_pvt *p)
+static int save_conference(struct dahdi_pvt *p)
{
- struct zt_confinfo c;
+ DAHDI_CONFINFO c;
int res;
if (p->saveconf.confmode) {
ast_log(LOG_WARNING, "Can't save conference -- already in use\n");
return -1;
}
p->saveconf.chan = 0;
- res = ioctl(p->subs[SUB_REAL].zfd, ZT_GETCONF, &p->saveconf);
+ res = ioctl(p->subs[SUB_REAL].dfd, DAHDI_GETCONF, &p->saveconf);
if (res) {
ast_log(LOG_WARNING, "Unable to get conference info: %s\n", strerror(errno));
p->saveconf.confmode = 0;
@@ -1655,8 +1662,8 @@ static int save_conference(struct zt_pvt *p)
}
c.chan = 0;
c.confno = 0;
- c.confmode = ZT_CONF_NORMAL;
- res = ioctl(p->subs[SUB_REAL].zfd, ZT_SETCONF, &c);
+ c.confmode = DAHDI_CONF_NORMAL;
+ res = ioctl(p->subs[SUB_REAL].dfd, DAHDI_SETCONF, &c);
if (res) {
ast_log(LOG_WARNING, "Unable to set conference info: %s\n", strerror(errno));
return -1;
@@ -1666,11 +1673,11 @@ static int save_conference(struct zt_pvt *p)
return 0;
}
-static int restore_conference(struct zt_pvt *p)
+static int restore_conference(struct dahdi_pvt *p)
{
int res;
if (p->saveconf.confmode) {
- res = ioctl(p->subs[SUB_REAL].zfd, ZT_SETCONF, &p->saveconf);
+ res = ioctl(p->subs[SUB_REAL].dfd, DAHDI_SETCONF, &p->saveconf);
p->saveconf.confmode = 0;
if (res) {
ast_log(LOG_WARNING, "Unable to restore conference info: %s\n", strerror(errno));
@@ -1682,9 +1689,9 @@ static int restore_conference(struct zt_pvt *p)
return 0;
}
-static int send_callerid(struct zt_pvt *p);
+static int send_callerid(struct dahdi_pvt *p);
-static int send_cwcidspill(struct zt_pvt *p)
+static int send_cwcidspill(struct dahdi_pvt *p)
{
p->callwaitcas = 0;
p->cidcwexpire = 0;
@@ -1700,23 +1707,23 @@ static int send_cwcidspill(struct zt_pvt *p)
return 0;
}
-static int has_voicemail(struct zt_pvt *p)
+static int has_voicemail(struct dahdi_pvt *p)
{
return ast_app_has_voicemail(p->mailbox, NULL);
}
-static int send_callerid(struct zt_pvt *p)
+static int send_callerid(struct dahdi_pvt *p)
{
/* Assumes spill in p->cidspill, p->cidlen in length and we're p->cidpos into it */
int res;
/* Take out of linear mode if necessary */
if (p->subs[SUB_REAL].linear) {
p->subs[SUB_REAL].linear = 0;
- zt_setlinear(p->subs[SUB_REAL].zfd, 0);
+ dahdi_setlinear(p->subs[SUB_REAL].dfd, 0);
}
while (p->cidpos < p->cidlen) {
- res = write(p->subs[SUB_REAL].zfd, p->cidspill + p->cidpos, p->cidlen - p->cidpos);
+ res = write(p->subs[SUB_REAL].dfd, p->cidspill + p->cidpos, p->cidlen - p->cidpos);
if (res < 0) {
if (errno == EAGAIN)
return 0;
@@ -1739,9 +1746,9 @@ static int send_callerid(struct zt_pvt *p)
return 0;
}
-static int zt_callwait(struct ast_channel *ast)
+static int dahdi_callwait(struct ast_channel *ast)
{
- struct zt_pvt *p = ast->tech_pvt;
+ struct dahdi_pvt *p = ast->tech_pvt;
p->callwaitingrepeat = CALLWAITING_REPEAT_SAMPLES;
if (p->cidspill) {
ast_log(LOG_WARNING, "Spill already exists?!?\n");
@@ -1767,9 +1774,9 @@ static int zt_callwait(struct ast_channel *ast)
return 0;
}
-static int zt_call(struct ast_channel *ast, char *rdest, int timeout)
+static int dahdi_call(struct ast_channel *ast, char *rdest, int timeout)
{
- struct zt_pvt *p = ast->tech_pvt;
+ struct dahdi_pvt *p = ast->tech_pvt;
int x, res, index,mysig;
char *c, *n, *l;
#ifdef HAVE_PRI
@@ -1785,7 +1792,7 @@ static int zt_call(struct ast_channel *ast, char *rdest, int timeout)
return 0;
}
if ((ast->_state != AST_STATE_DOWN) && (ast->_state != AST_STATE_RESERVED)) {
- ast_log(LOG_WARNING, "zt_call called on %s, neither down nor reserved\n", ast->name);
+ ast_log(LOG_WARNING, "dahdi_call called on %s, neither down nor reserved\n", ast->name);
ast_mutex_unlock(&p->lock);
return -1;
}
@@ -1797,13 +1804,13 @@ static int zt_call(struct ast_channel *ast, char *rdest, int timeout)
ast_mutex_unlock(&p->lock);
return 0;
}
- x = ZT_FLUSH_READ | ZT_FLUSH_WRITE;
- res = ioctl(p->subs[SUB_REAL].zfd, ZT_FLUSH, &x);
+ x = DAHDI_FLUSH_READ | DAHDI_FLUSH_WRITE;
+ res = ioctl(p->subs[SUB_REAL].dfd, DAHDI_FLUSH, &x);
if (res)
ast_log(LOG_WARNING, "Unable to flush input on channel %d\n", p->channel);
p->outgoing = 1;
- set_actual_gain(p->subs[SUB_REAL].zfd, 0, p->rxgain, p->txgain, p->law);
+ set_actual_gain(p->subs[SUB_REAL].dfd, 0, p->rxgain, p->txgain, p->law);
mysig = p->sig;
if (p->outsigmod > -1)
@@ -1833,11 +1840,11 @@ static int zt_call(struct ast_channel *ast, char *rdest, int timeout)
}
/* Choose proper cadence */
if ((p->distinctivering > 0) && (p->distinctivering <= num_cadence)) {
- if (ioctl(p->subs[SUB_REAL].zfd, ZT_SETCADENCE, &cadences[p->distinctivering - 1]))
+ if (ioctl(p->subs[SUB_REAL].dfd, DAHDI_SETCADENCE, &cadences[p->distinctivering - 1]))
ast_log(LOG_WARNING, "Unable to set distinctive ring cadence %d on '%s'\n", p->distinctivering, ast->name);
p->cidrings = cidrings[p->distinctivering - 1];
} else {
- if (ioctl(p->subs[SUB_REAL].zfd, ZT_SETCADENCE, NULL))
+ if (ioctl(p->subs[SUB_REAL].dfd, DAHDI_SETCADENCE, NULL))
ast_log(LOG_WARNING, "Unable to reset default ring on '%s'\n", ast->name);
p->cidrings = p->sendcalleridafter;
}
@@ -1851,14 +1858,14 @@ static int zt_call(struct ast_channel *ast, char *rdest, int timeout)
c = NULL;
}
if (c) {
- p->dop.op = ZT_DIAL_OP_REPLACE;
+ p->dop.op = DAHDI_DIAL_OP_REPLACE;
snprintf(p->dop.dialstr, sizeof(p->dop.dialstr), "Tw%s", c);
ast_log(LOG_DEBUG, "FXO: setup deferred dialstring: %s\n", c);
} else {
p->dop.dialstr[0] = '\0';
}
- x = ZT_RING;
- if (ioctl(p->subs[SUB_REAL].zfd, ZT_HOOK, &x) && (errno != EINPROGRESS)) {
+ x = DAHDI_RING;
+ if (ioctl(p->subs[SUB_REAL].dfd, DAHDI_HOOK, &x) && (errno != EINPROGRESS)) {
ast_log(LOG_WARNING, "Unable to ring phone: %s\n", strerror(errno));
ast_mutex_unlock(&p->lock);
return -1;
@@ -1876,12 +1883,12 @@ static int zt_call(struct ast_channel *ast, char *rdest, int timeout)
else
p->callwait_name[0] = '\0';
/* Call waiting tone instead */
- if (zt_callwait(ast)) {
+ if (dahdi_callwait(ast)) {
ast_mutex_unlock(&p->lock);
return -1;
}
/* Make ring-back */
- if (tone_zone_play_tone(p->subs[SUB_CALLWAIT].zfd, ZT_TONE_RINGTONE))
+ if (tone_zone_play_tone(p->subs[SUB_CALLWAIT].dfd, DAHDI_TONE_RINGTONE))
ast_log(LOG_WARNING, "Unable to generate call-wait ring-back on channel %s\n", ast->name);
}
@@ -1896,7 +1903,7 @@ static int zt_call(struct ast_channel *ast, char *rdest, int timeout)
else
p->lastcid_name[0] = '\0';
ast_setstate(ast, AST_STATE_RINGING);
- index = zt_get_index(ast, p, 0);
+ index = dahdi_get_index(ast, p, 0);
if (index > -1) {
p->subs[index].needringing = 1;
}
@@ -1933,8 +1940,8 @@ static int zt_call(struct ast_channel *ast, char *rdest, int timeout)
/* Start the trunk, if not GR-303 */
if (!p->pri) {
#endif
- x = ZT_START;
- res = ioctl(p->subs[SUB_REAL].zfd, ZT_HOOK, &x);
+ x = DAHDI_START;
+ res = ioctl(p->subs[SUB_REAL].dfd, DAHDI_HOOK, &x);
if (res < 0) {
if (errno != EINPROGRESS) {
ast_log(LOG_WARNING, "Unable to start channel: %s\n", strerror(errno));
@@ -1946,7 +1953,7 @@ static int zt_call(struct ast_channel *ast, char *rdest, int timeout)
}
#endif
ast_log(LOG_DEBUG, "Dialing '%s'\n", c);
- p->dop.op = ZT_DIAL_OP_REPLACE;
+ p->dop.op = DAHDI_DIAL_OP_REPLACE;
c += p->stripmsd;
@@ -2013,9 +2020,9 @@ static int zt_call(struct ast_channel *ast, char *rdest, int timeout)
} else
p->echobreak = 0;
if (!res) {
- if (ioctl(p->subs[SUB_REAL].zfd, ZT_DIAL, &p->dop)) {
- x = ZT_ONHOOK;
- ioctl(p->subs[SUB_REAL].zfd, ZT_HOOK, &x);
+ if (ioctl(p->subs[SUB_REAL].dfd, DAHDI_DIAL, &p->dop)) {
+ x = DAHDI_ONHOOK;
+ ioctl(p->subs[SUB_REAL].dfd, DAHDI_HOOK, &x);
ast_log(LOG_WARNING, "Dialing failed on channel %d: %s\n", p->channel, strerror(errno));
ast_mutex_unlock(&p->lock);
return -1;
@@ -2077,7 +2084,7 @@ static int zt_call(struct ast_channel *ast, char *rdest, int timeout)
return -1;
}
if (mysig != SIG_FXSKS) {
- p->dop.op = ZT_DIAL_OP_REPLACE;
+ p->dop.op = DAHDI_DIAL_OP_REPLACE;
s = strchr(c + p->stripmsd, 'w');
if (s) {
if (strlen(s) > 1)
@@ -2131,7 +2138,7 @@ static int zt_call(struct ast_channel *ast, char *rdest, int timeout)
pri_sr_set_channel(sr, p->bearer ? PVT_TO_CHANNEL(p->bearer) : PVT_TO_CHANNEL(p), exclusive, 1);
pri_sr_set_bearer(sr, p->digital ? PRI_TRANS_CAP_DIGITAL : ast->transfercapability,
(p->digital ? -1 :
- ((p->law == ZT_LAW_ALAW) ? PRI_LAYER_1_ALAW : PRI_LAYER_1_ULAW)));
+ ((p->law == DAHDI_LAW_ALAW) ? PRI_LAYER_1_ALAW : PRI_LAYER_1_ULAW)));
if (p->pri->facilityenable)
pri_facility_enable(p->pri->pri);
@@ -2207,9 +2214,9 @@ static int zt_call(struct ast_channel *ast, char *rdest, int timeout)
return 0;
}
-static void destroy_zt_pvt(struct zt_pvt **pvt)
+static void destroy_dahdi_pvt(struct dahdi_pvt **pvt)
{
- struct zt_pvt *p = *pvt;
+ struct dahdi_pvt *p = *pvt;
/* Remove channel from the list */
if (p->prev)
p->prev->next = p->next;
@@ -2222,7 +2229,7 @@ static void destroy_zt_pvt(struct zt_pvt **pvt)
*pvt = NULL;
}
-static int destroy_channel(struct zt_pvt *prev, struct zt_pvt *cur, int now)
+static int destroy_channel(struct dahdi_pvt *prev, struct dahdi_pvt *cur, int now)
{
int owned = 0;
int i = 0;
@@ -2251,10 +2258,10 @@ static int destroy_channel(struct zt_pvt *prev, struct zt_pvt *cur, int now)
else
ifend = NULL;
}
- if (cur->subs[SUB_REAL].zfd > -1) {
- zt_close(cur->subs[SUB_REAL].zfd);
+ if (cur->subs[SUB_REAL].dfd > -1) {
+ dahdi_close(cur->subs[SUB_REAL].dfd);
}
- destroy_zt_pvt(&cur);
+ destroy_dahdi_pvt(&cur);
}
} else {
if (prev) {
@@ -2270,27 +2277,27 @@ static int destroy_channel(struct zt_pvt *prev, struct zt_pvt *cur, int now)
else
ifend = NULL;
}
- if (cur->subs[SUB_REAL].zfd > -1) {
- zt_close(cur->subs[SUB_REAL].zfd);
+ if (cur->subs[SUB_REAL].dfd > -1) {
+ dahdi_close(cur->subs[SUB_REAL].dfd);
}
- destroy_zt_pvt(&cur);
+ destroy_dahdi_pvt(&cur);
}
return 0;
}
#ifdef HAVE_PRI
-static char *zap_send_keypad_facility_app = "ZapSendKeypadFacility";
+static char *dahdi_send_keypad_facility_app = "DAHDISendKeypadFacility";
-static char *zap_send_keypad_facility_synopsis = "Send digits out of band over a PRI";
+static char *dahdi_send_keypad_facility_synopsis = "Send digits out of band over a PRI";
-static char *zap_send_keypad_facility_descrip =
-" ZapSendKeypadFacility(): This application will send the given string of digits in a Keypad Facility\n"
+static char *dahdi_send_keypad_facility_descrip =
+" DAHDISendKeypadFacility(): This application will send the given string of digits in a Keypad Facility\n"
" IE over the current channel.\n";
-static int zap_send_keypad_facility_exec(struct ast_channel *chan, void *data)
+static int dahdi_send_keypad_facility_exec(struct ast_channel *chan, void *data)
{
/* Data will be our digit string */
- struct zt_pvt *p;
+ struct dahdi_pvt *p;
char *digits = (char *) data;
if (ast_strlen_zero(digits)) {
@@ -2298,7 +2305,7 @@ static int zap_send_keypad_facility_exec(struct ast_channel *chan, void *data)
return -1;
}
- p = (struct zt_pvt *)chan->tech_pvt;
+ p = (struct dahdi_pvt *)chan->tech_pvt;
if (!p) {
ast_log(LOG_DEBUG, "Unable to find technology private\n");
@@ -2327,7 +2334,7 @@ static int zap_send_keypad_facility_exec(struct ast_channel *chan, void *data)
return 0;
}
-static int pri_is_up(struct zt_pri *pri)
+static int pri_is_up(struct dahdi_pri *pri)
{
int x;
for (x = 0; x < NUM_DCHANS; x++) {
@@ -2337,13 +2344,13 @@ static int pri_is_up(struct zt_pri *pri)
return 0;
}
-static int pri_assign_bearer(struct zt_pvt *crv, struct zt_pri *pri, struct zt_pvt *bearer)
+static int pri_assign_bearer(struct dahdi_pvt *crv, struct dahdi_pri *pri, struct dahdi_pvt *bearer)
{
bearer->owner = &inuse;
bearer->realcall = crv;
- crv->subs[SUB_REAL].zfd = bearer->subs[SUB_REAL].zfd;
+ crv->subs[SUB_REAL].dfd = bearer->subs[SUB_REAL].dfd;
if (crv->subs[SUB_REAL].owner)
- crv->subs[SUB_REAL].owner->fds[0] = crv->subs[SUB_REAL].zfd;
+ crv->subs[SUB_REAL].owner->fds[0] = crv->subs[SUB_REAL].dfd;
crv->bearer = bearer;
crv->call = bearer->call;
crv->pri = pri;
@@ -2367,7 +2374,7 @@ static char *pri_order(int level)
}
/* Returns fd of the active dchan */
-static int pri_active_dchan_fd(struct zt_pri *pri)
+static int pri_active_dchan_fd(struct dahdi_pri *pri)
{
int x = -1;
@@ -2379,7 +2386,7 @@ static int pri_active_dchan_fd(struct zt_pri *pri)
return pri->fds[x];
}
-static int pri_find_dchan(struct zt_pri *pri)
+static int pri_find_dchan(struct dahdi_pri *pri)
{
int oldslot = -1;
struct pri *old;
@@ -2406,18 +2413,18 @@ static int pri_find_dchan(struct zt_pri *pri)
}
#endif
-static int zt_hangup(struct ast_channel *ast)
+static int dahdi_hangup(struct ast_channel *ast)
{
int res;
int index,x, law;
- /*static int restore_gains(struct zt_pvt *p);*/
- struct zt_pvt *p = ast->tech_pvt;
- struct zt_pvt *tmp = NULL;
- struct zt_pvt *prev = NULL;
- ZT_PARAMS par;
+ /*static int restore_gains(struct dahdi_pvt *p);*/
+ struct dahdi_pvt *p = ast->tech_pvt;
+ struct dahdi_pvt *tmp = NULL;
+ struct dahdi_pvt *prev = NULL;
+ DAHDI_PARAMS par;
if (option_debug)
- ast_log(LOG_DEBUG, "zt_hangup(%s)\n", ast->name);
+ ast_log(LOG_DEBUG, "dahdi_hangup(%s)\n", ast->name);
if (!ast->tech_pvt) {
ast_log(LOG_WARNING, "Asked to hangup channel not connected\n");
return 0;
@@ -2425,7 +2432,7 @@ static int zt_hangup(struct ast_channel *ast)
ast_mutex_lock(&p->lock);
- index = zt_get_index(ast, p, 1);
+ index = dahdi_get_index(ast, p, 1);
if (p->sig == SIG_PRI) {
x = 1;
@@ -2433,7 +2440,7 @@ static int zt_hangup(struct ast_channel *ast)
}
x = 0;
- zt_confmute(p, 0);
+ dahdi_confmute(p, 0);
restore_gains(p);
if (p->origcid_num) {
ast_copy_string(p->cid_num, p->origcid_num, sizeof(p->cid_num));
@@ -2452,7 +2459,7 @@ static int zt_hangup(struct ast_channel *ast)
if (option_debug)
ast_log(LOG_DEBUG, "Hangup: channel: %d index = %d, normal = %d, callwait = %d, thirdcall = %d\n",
- p->channel, index, p->subs[SUB_REAL].zfd, p->subs[SUB_CALLWAIT].zfd, p->subs[SUB_THREEWAY].zfd);
+ p->channel, index, p->subs[SUB_REAL].dfd, p->subs[SUB_CALLWAIT].dfd, p->subs[SUB_THREEWAY].dfd);
p->ignoredtmf = 0;
if (index > -1) {
@@ -2466,9 +2473,9 @@ static int zt_hangup(struct ast_channel *ast)
p->subs[index].linear = 0;
p->subs[index].needcallerid = 0;
p->polarity = POLARITY_IDLE;
- zt_setlinear(p->subs[index].zfd, 0);
+ dahdi_setlinear(p->subs[index].dfd, 0);
if (index == SUB_REAL) {
- if ((p->subs[SUB_CALLWAIT].zfd > -1) && (p->subs[SUB_THREEWAY].zfd > -1)) {
+ if ((p->subs[SUB_CALLWAIT].dfd > -1) && (p->subs[SUB_THREEWAY].dfd > -1)) {
ast_log(LOG_DEBUG, "Normal call hung up with both three way call and a call waiting call in place?\n");
if (p->subs[SUB_CALLWAIT].inthreeway) {
/* We had flipped over to answer a callwait and now it's gone */
@@ -2494,7 +2501,7 @@ static int zt_hangup(struct ast_channel *ast)
}
p->subs[SUB_REAL].inthreeway = 0;
}
- } else if (p->subs[SUB_CALLWAIT].zfd > -1) {
+ } else if (p->subs[SUB_CALLWAIT].dfd > -1) {
/* Move to the call-wait and switch back to them. */
swap_subs(p, SUB_CALLWAIT, SUB_REAL);
unalloc_sub(p, SUB_CALLWAIT);
@@ -2503,7 +2510,7 @@ static int zt_hangup(struct ast_channel *ast)
p->subs[SUB_REAL].needanswer = 1;
if (ast_bridged_channel(p->subs[SUB_REAL].owner))
ast_queue_control(p->subs[SUB_REAL].owner, AST_CONTROL_UNHOLD);
- } else if (p->subs[SUB_THREEWAY].zfd > -1) {
+ } else if (p->subs[SUB_THREEWAY].dfd > -1) {
swap_subs(p, SUB_THREEWAY, SUB_REAL);
unalloc_sub(p, SUB_THREEWAY);
if (p->subs[SUB_REAL].inthreeway) {
@@ -2577,8 +2584,8 @@ static int zt_hangup(struct ast_channel *ast)
p->dsp = NULL;
}
- law = ZT_LAW_DEFAULT;
- res = ioctl(p->subs[SUB_REAL].zfd, ZT_SETLAW, &law);
+ law = DAHDI_LAW_DEFAULT;
+ res = ioctl(p->subs[SUB_REAL].dfd, DAHDI_SETLAW, &law);
if (res < 0)
ast_log(LOG_WARNING, "Unable to set law on channel %d to default\n", p->channel);
/* Perform low level hangup if no owner left */
@@ -2636,7 +2643,7 @@ static int zt_hangup(struct ast_channel *ast)
}
#endif
if (p->sig && (p->sig != SIG_PRI))
- res = zt_set_hook(p->subs[SUB_REAL].zfd, ZT_ONHOOK);
+ res = dahdi_set_hook(p->subs[SUB_REAL].dfd, DAHDI_ONHOOK);
if (res < 0) {
ast_log(LOG_WARNING, "Unable to hangup line %s\n", ast->name);
}
@@ -2644,16 +2651,16 @@ static int zt_hangup(struct ast_channel *ast)
case SIG_FXOGS:
case SIG_FXOLS:
case SIG_FXOKS:
- res = ioctl(p->subs[SUB_REAL].zfd, ZT_GET_PARAMS, &par);
+ res = ioctl(p->subs[SUB_REAL].dfd, DAHDI_GET_PARAMS, &par);
if (!res) {
#if 0
ast_log(LOG_DEBUG, "Hanging up channel %d, offhook = %d\n", p->channel, par.rxisoffhook);
#endif
/* If they're off hook, try playing congestion */
if ((par.rxisoffhook) && (!(p->radio || (p->oprmode < 0))))
- tone_zone_play_tone(p->subs[SUB_REAL].zfd, ZT_TONE_CONGESTION);
+ tone_zone_play_tone(p->subs[SUB_REAL].dfd, DAHDI_TONE_CONGESTION);
else
- tone_zone_play_tone(p->subs[SUB_REAL].zfd, -1);
+ tone_zone_play_tone(p->subs[SUB_REAL].dfd, -1);
}
break;
case SIG_FXSGS:
@@ -2667,12 +2674,12 @@ static int zt_hangup(struct ast_channel *ast)
}
break;
default:
- tone_zone_play_tone(p->subs[SUB_REAL].zfd, -1);
+ tone_zone_play_tone(p->subs[SUB_REAL].dfd, -1);
}
if (p->cidspill)
free(p->cidspill);
if (p->sig)
- zt_disable_ec(p);
+ dahdi_disable_ec(p);
x = 0;
ast_channel_setoption(ast,AST_OPTION_TONE_VERIFY,&x,sizeof(char),0);
ast_channel_setoption(ast,AST_OPTION_TDD,&x,sizeof(char),0);
@@ -2700,7 +2707,7 @@ static int zt_hangup(struct ast_channel *ast)
p->bearer->owner = NULL;
p->bearer->realcall = NULL;
p->bearer = NULL;
- p->subs[SUB_REAL].zfd = -1;
+ p->subs[SUB_REAL].dfd = -1;
p->pri = NULL;
}
#endif
@@ -2734,15 +2741,15 @@ static int zt_hangup(struct ast_channel *ast)
return 0;
}
-static int zt_answer(struct ast_channel *ast)
+static int dahdi_answer(struct ast_channel *ast)
{
- struct zt_pvt *p = ast->tech_pvt;
+ struct dahdi_pvt *p = ast->tech_pvt;
int res = 0;
int index;
int oldstate = ast->_state;
ast_setstate(ast, AST_STATE_UP);
ast_mutex_lock(&p->lock);
- index = zt_get_index(ast, p, 0);
+ index = dahdi_get_index(ast, p, 0);
if (index < 0)
index = SUB_REAL;
/* nothing to do if a radio channel */
@@ -2779,20 +2786,20 @@ static int zt_answer(struct ast_channel *ast)
if (p->hanguponpolarityswitch) {
gettimeofday(&p->polaritydelaytv, NULL);
}
- res = zt_set_hook(p->subs[SUB_REAL].zfd, ZT_OFFHOOK);
- tone_zone_play_tone(p->subs[index].zfd, -1);
+ res = dahdi_set_hook(p->subs[SUB_REAL].dfd, DAHDI_OFFHOOK);
+ tone_zone_play_tone(p->subs[index].dfd, -1);
p->dialing = 0;
if ((index == SUB_REAL) && p->subs[SUB_THREEWAY].inthreeway) {
if (oldstate == AST_STATE_RINGING) {
ast_log(LOG_DEBUG, "Finally swapping real and threeway\n");
- tone_zone_play_tone(p->subs[SUB_THREEWAY].zfd, -1);
+ tone_zone_play_tone(p->subs[SUB_THREEWAY].dfd, -1);
swap_subs(p, SUB_THREEWAY, SUB_REAL);
p->owner = p->subs[SUB_REAL].owner;
}
}
- if (p->sig & __ZT_SIG_FXS) {
- zt_enable_ec(p);
- zt_train_ec(p);
+ if (p->sig & __DAHDI_SIG_FXS) {
+ dahdi_enable_ec(p);
+ dahdi_train_ec(p);
}
break;
#ifdef HAVE_PRI
@@ -2819,13 +2826,13 @@ static int zt_answer(struct ast_channel *ast)
return res;
}
-static int zt_setoption(struct ast_channel *chan, int option, void *data, int datalen)
+static int dahdi_setoption(struct ast_channel *chan, int option, void *data, int datalen)
{
char *cp;
signed char *scp;
int x;
int index;
- struct zt_pvt *p = chan->tech_pvt, *pp;
+ struct dahdi_pvt *p = chan->tech_pvt, *pp;
struct oprmode *oprmode;
@@ -2838,24 +2845,24 @@ static int zt_setoption(struct ast_channel *chan, int option, void *data, int da
switch (option) {
case AST_OPTION_TXGAIN:
scp = (signed char *) data;
- index = zt_get_index(chan, p, 0);
+ index = dahdi_get_index(chan, p, 0);
if (index < 0) {
ast_log(LOG_WARNING, "No index in TXGAIN?\n");
return -1;
}
if (option_debug)
ast_log(LOG_DEBUG, "Setting actual tx gain on %s to %f\n", chan->name, p->txgain + (float) *scp);
- return set_actual_txgain(p->subs[index].zfd, 0, p->txgain + (float) *scp, p->law);
+ return set_actual_txgain(p->subs[index].dfd, 0, p->txgain + (float) *scp, p->law);
case AST_OPTION_RXGAIN:
scp = (signed char *) data;
- index = zt_get_index(chan, p, 0);
+ index = dahdi_get_index(chan, p, 0);
if (index < 0) {
ast_log(LOG_WARNING, "No index in RXGAIN?\n");
return -1;
}
if (option_debug)
ast_log(LOG_DEBUG, "Setting actual rx gain on %s to %f\n", chan->name, p->rxgain + (float) *scp);
- return set_actual_rxgain(p->subs[index].zfd, 0, p->rxgain + (float) *scp, p->law);
+ return set_actual_rxgain(p->subs[index].dfd, 0, p->rxgain + (float) *scp, p->law);
case AST_OPTION_TONE_VERIFY:
if (!p->dsp)
break;
@@ -2889,7 +2896,7 @@ static int zt_setoption(struct ast_channel *chan, int option, void *data, int da
}
ast_log(LOG_DEBUG, "Set option TDD MODE, value: %s(%d) on %s\n",
(*cp == 2) ? "MATE" : "ON", (int) *cp, chan->name);
- zt_disable_ec(p);
+ dahdi_disable_ec(p);
/* otherwise, turn it on */
if (!p->didtdd) { /* if havent done it yet */
unsigned char mybuf[41000], *buf;
@@ -2900,12 +2907,12 @@ static int zt_setoption(struct ast_channel *chan, int option, void *data, int da
memset(buf, 0x7f, sizeof(mybuf)); /* set to silence */
ast_tdd_gen_ecdisa(buf + 16000, 16000); /* put in tone */
len = 40000;
- index = zt_get_index(chan, p, 0);
+ index = dahdi_get_index(chan, p, 0);
if (index < 0) {
ast_log(LOG_WARNING, "No index in TDD?\n");
return -1;
}
- fd = p->subs[index].zfd;
+ fd = p->subs[index].dfd;
while (len) {
if (ast_check_hangup(chan))
return -1;
@@ -2964,12 +2971,12 @@ static int zt_setoption(struct ast_channel *chan, int option, void *data, int da
if (!*cp) {
ast_log(LOG_DEBUG, "Set option AUDIO MODE, value: OFF(0) on %s\n", chan->name);
x = 0;
- zt_disable_ec(p);
+ dahdi_disable_ec(p);
} else {
ast_log(LOG_DEBUG, "Set option AUDIO MODE, value: ON(1) on %s\n", chan->name);
x = 1;
}
- if (ioctl(p->subs[SUB_REAL].zfd, ZT_AUDIOMODE, &x) == -1)
+ if (ioctl(p->subs[SUB_REAL].dfd, DAHDI_AUDIOMODE, &x) == -1)
ast_log(LOG_WARNING, "Unable to set audio mode on channel %d to %d\n", p->channel, x);
break;
case AST_OPTION_OPRMODE: /* Operator services mode */
@@ -2992,10 +2999,10 @@ static int zt_setoption(struct ast_channel *chan, int option, void *data, int da
cp = (char *) data;
if (*cp) {
ast_log(LOG_DEBUG, "Enabling echo cancelation on %s\n", chan->name);
- zt_enable_ec(p);
+ dahdi_enable_ec(p);
} else {
ast_log(LOG_DEBUG, "Disabling echo cancelation on %s\n", chan->name);
- zt_disable_ec(p);
+ dahdi_disable_ec(p);
}
break;
}
@@ -3004,9 +3011,9 @@ static int zt_setoption(struct ast_channel *chan, int option, void *data, int da
return 0;
}
-static int zt_func_read(struct ast_channel *chan, char *function, char *data, char *buf, size_t len)
+static int dahdi_func_read(struct ast_channel *chan, char *function, char *data, char *buf, size_t len)
{
- struct zt_pvt *p = chan->tech_pvt;
+ struct dahdi_pvt *p = chan->tech_pvt;
if (!strcasecmp(data, "rxgain")) {
ast_mutex_lock(&p->lock);
@@ -3023,7 +3030,7 @@ static int zt_func_read(struct ast_channel *chan, char *function, char *data, ch
}
-static void zt_unlink(struct zt_pvt *slave, struct zt_pvt *master, int needlock)
+static void dahdi_unlink(struct dahdi_pvt *slave, struct dahdi_pvt *master, int needlock)
{
/* Unlink a specific slave or all slaves/masters from a given master */
int x;
@@ -3079,7 +3086,7 @@ static void zt_unlink(struct zt_pvt *slave, struct zt_pvt *master, int needlock)
}
}
-static void zt_link(struct zt_pvt *slave, struct zt_pvt *master) {
+static void dahdi_link(struct dahdi_pvt *slave, struct dahdi_pvt *master) {
int x;
if (!slave || !master) {
ast_log(LOG_WARNING, "Tried to link to/from NULL??\n");
@@ -3102,17 +3109,17 @@ static void zt_link(struct zt_pvt *slave, struct zt_pvt *master) {
ast_log(LOG_DEBUG, "Making %d slave to master %d at %d\n", slave->channel, master->channel, x);
}
-static void disable_dtmf_detect(struct zt_pvt *p)
+static void disable_dtmf_detect(struct dahdi_pvt *p)
{
-#ifdef ZT_TONEDETECT
+#ifdef DAHDI_TONEDETECT
int val;
#endif
p->ignoredtmf = 1;
-#ifdef ZT_TONEDETECT
+#ifdef DAHDI_TONEDETECT
val = 0;
- ioctl(p->subs[SUB_REAL].zfd, ZT_TONEDETECT, &val);
+ ioctl(p->subs[SUB_REAL].dfd, DAHDI_TONEDETECT, &val);
#endif
if (!p->hardwaredtmf && p->dsp) {
p->dsp_features &= ~DSP_FEATURE_DTMF_DETECT;
@@ -3120,9 +3127,9 @@ static void disable_dtmf_detect(struct zt_pvt *p)
}
}
-static void enable_dtmf_detect(struct zt_pvt *p)
+static void enable_dtmf_detect(struct dahdi_pvt *p)
{
-#ifdef ZT_TONEDETECT
+#ifdef DAHDI_TONEDETECT
int val;
#endif
@@ -3131,9 +3138,9 @@ static void enable_dtmf_detect(struct zt_pvt *p)
p->ignoredtmf = 0;
-#ifdef ZT_TONEDETECT
- val = ZT_TONEDETECT_ON | ZT_TONEDETECT_MUTE;
- ioctl(p->subs[SUB_REAL].zfd, ZT_TONEDETECT, &val);
+#ifdef DAHDI_TONEDETECT
+ val = DAHDI_TONEDETECT_ON | DAHDI_TONEDETECT_MUTE;
+ ioctl(p->subs[SUB_REAL].dfd, DAHDI_TONEDETECT, &val);
#endif
if (!p->hardwaredtmf && p->dsp) {
p->dsp_features |= DSP_FEATURE_DTMF_DETECT;
@@ -3141,11 +3148,11 @@ static void enable_dtmf_detect(struct zt_pvt *p)
}
}
-static enum ast_bridge_result zt_bridge(struct ast_channel *c0, struct ast_channel *c1, int flags, struct ast_frame **fo, struct ast_channel **rc, int timeoutms)
+static enum ast_bridge_result dahdi_bridge(struct ast_channel *c0, struct ast_channel *c1, int flags, struct ast_frame **fo, struct ast_channel **rc, int timeoutms)
{
struct ast_channel *who;
- struct zt_pvt *p0, *p1, *op0, *op1;
- struct zt_pvt *master = NULL, *slave = NULL;
+ struct dahdi_pvt *p0, *p1, *op0, *op1;
+ struct dahdi_pvt *master = NULL, *slave = NULL;
struct ast_frame *f;
int inconf = 0;
int nothingok = 1;
@@ -3183,8 +3190,8 @@ static enum ast_bridge_result zt_bridge(struct ast_channel *c0, struct ast_chann
return AST_BRIDGE_FAILED_NOWARN;
}
- oi0 = zt_get_index(c0, p0, 0);
- oi1 = zt_get_index(c1, p1, 0);
+ oi0 = dahdi_get_index(c0, p0, 0);
+ oi1 = dahdi_get_index(c1, p1, 0);
if ((oi0 < 0) || (oi1 < 0)) {
ast_mutex_unlock(&c0->lock);
ast_mutex_unlock(&c1->lock);
@@ -3229,9 +3236,9 @@ static enum ast_bridge_result zt_bridge(struct ast_channel *c0, struct ast_chann
ast_log(LOG_WARNING, "Huh? Both calls are callwaits or 3-ways? That's clever...?\n");
ast_log(LOG_WARNING, "p0: chan %d/%d/CW%d/3W%d, p1: chan %d/%d/CW%d/3W%d\n",
p0->channel,
- oi0, (p0->subs[SUB_CALLWAIT].zfd > -1) ? 1 : 0,
+ oi0, (p0->subs[SUB_CALLWAIT].dfd > -1) ? 1 : 0,
p0->subs[SUB_REAL].inthreeway, p0->channel,
- oi0, (p1->subs[SUB_CALLWAIT].zfd > -1) ? 1 : 0,
+ oi0, (p1->subs[SUB_CALLWAIT].dfd > -1) ? 1 : 0,
p1->subs[SUB_REAL].inthreeway);
}
nothingok = 0;
@@ -3276,11 +3283,11 @@ static enum ast_bridge_result zt_bridge(struct ast_channel *c0, struct ast_chann
p1->subs[SUB_REAL].inthreeway &&
(p1->subs[SUB_REAL].owner->_state == AST_STATE_RINGING)) {
ast_log(LOG_DEBUG, "Playing ringback on %s since %s is in a ringing three-way\n", c0->name, c1->name);
- tone_zone_play_tone(p0->subs[oi0].zfd, ZT_TONE_RINGTONE);
+ tone_zone_play_tone(p0->subs[oi0].dfd, DAHDI_TONE_RINGTONE);
os1 = p1->subs[SUB_REAL].owner->_state;
} else {
ast_log(LOG_DEBUG, "Stopping tones on %d/%d talking to %d/%d\n", p0->channel, oi0, p1->channel, oi1);
- tone_zone_play_tone(p0->subs[oi0].zfd, -1);
+ tone_zone_play_tone(p0->subs[oi0].dfd, -1);
}
if ((oi0 == SUB_THREEWAY) &&
p0->subs[SUB_THREEWAY].inthreeway &&
@@ -3288,20 +3295,20 @@ static enum ast_bridge_result zt_bridge(struct ast_channel *c0, struct ast_chann
p0->subs[SUB_REAL].inthreeway &&
(p0->subs[SUB_REAL].owner->_state == AST_STATE_RINGING)) {
ast_log(LOG_DEBUG, "Playing ringback on %s since %s is in a ringing three-way\n", c1->name, c0->name);
- tone_zone_play_tone(p1->subs[oi1].zfd, ZT_TONE_RINGTONE);
+ tone_zone_play_tone(p1->subs[oi1].dfd, DAHDI_TONE_RINGTONE);
os0 = p0->subs[SUB_REAL].owner->_state;
} else {
ast_log(LOG_DEBUG, "Stopping tones on %d/%d talking to %d/%d\n", p1->channel, oi1, p0->channel, oi0);
- tone_zone_play_tone(p1->subs[oi0].zfd, -1);
+ tone_zone_play_tone(p1->subs[oi0].dfd, -1);
}
if ((oi0 == SUB_REAL) && (oi1 == SUB_REAL)) {
if (!p0->echocanbridged || !p1->echocanbridged) {
/* Disable echo cancellation if appropriate */
- zt_disable_ec(p0);
- zt_disable_ec(p1);
+ dahdi_disable_ec(p0);
+ dahdi_disable_ec(p1);
}
}
- zt_link(slave, master);
+ dahdi_link(slave, master);
master->inconference = inconf;
} else if (!nothingok)
ast_log(LOG_WARNING, "Can't link %d/%s with %d/%s\n", p0->channel, subnames[oi0], p1->channel, subnames[oi1]);
@@ -3319,8 +3326,8 @@ static enum ast_bridge_result zt_bridge(struct ast_channel *c0, struct ast_chann
/* Native bridge failed */
if ((!master || !slave) && !nothingok) {
- zt_enable_ec(p0);
- zt_enable_ec(p1);
+ dahdi_enable_ec(p0);
+ dahdi_enable_ec(p1);
return AST_BRIDGE_FAILED;
}
@@ -3348,9 +3355,9 @@ static enum ast_bridge_result zt_bridge(struct ast_channel *c0, struct ast_chann
p1 = c1->tech_pvt;
if (op0 == p0)
- i0 = zt_get_index(c0, p0, 1);
+ i0 = dahdi_get_index(c0, p0, 1);
if (op1 == p1)
- i1 = zt_get_index(c1, p1, 1);
+ i1 = dahdi_get_index(c1, p1, 1);
ast_mutex_unlock(&c0->lock);
ast_mutex_unlock(&c1->lock);
@@ -3416,10 +3423,10 @@ static enum ast_bridge_result zt_bridge(struct ast_channel *c0, struct ast_chann
return_from_bridge:
if (op0 == p0)
- zt_enable_ec(p0);
+ dahdi_enable_ec(p0);
if (op1 == p1)
- zt_enable_ec(p1);
+ dahdi_enable_ec(p1);
if (!(flags & AST_BRIDGE_DTMF_CHANNEL_0) && (oi0 == SUB_REAL))
enable_dtmf_detect(op0);
@@ -3427,14 +3434,14 @@ return_from_bridge:
if (!(flags & AST_BRIDGE_DTMF_CHANNEL_1) && (oi1 == SUB_REAL))
enable_dtmf_detect(op1);
- zt_unlink(slave, master, 1);
+ dahdi_unlink(slave, master, 1);
return res;
}
-static int zt_fixup(struct ast_channel *oldchan, struct ast_channel *newchan)
+static int dahdi_fixup(struct ast_channel *oldchan, struct ast_channel *newchan)
{
- struct zt_pvt *p = newchan->tech_pvt;
+ struct dahdi_pvt *p = newchan->tech_pvt;
int x;
ast_mutex_lock(&p->lock);
ast_log(LOG_DEBUG, "New owner for channel %d is %s\n", p->channel, newchan->name);
@@ -3444,27 +3451,27 @@ static int zt_fixup(struct ast_channel *oldchan, struct ast_channel *newchan)
for (x = 0; x < 3; x++)
if (p->subs[x].owner == oldchan) {
if (!x)
- zt_unlink(NULL, p, 0);
+ dahdi_unlink(NULL, p, 0);
p->subs[x].owner = newchan;
}
if (newchan->_state == AST_STATE_RINGING)
- zt_indicate(newchan, AST_CONTROL_RINGING, NULL, 0);
+ dahdi_indicate(newchan, AST_CONTROL_RINGING, NULL, 0);
update_conf(p);
ast_mutex_unlock(&p->lock);
return 0;
}
-static int zt_ring_phone(struct zt_pvt *p)
+static int dahdi_ring_phone(struct dahdi_pvt *p)
{
int x;
int res;
/* Make sure our transmit state is on hook */
x = 0;
- x = ZT_ONHOOK;
- res = ioctl(p->subs[SUB_REAL].zfd, ZT_HOOK, &x);
+ x = DAHDI_ONHOOK;
+ res = ioctl(p->subs[SUB_REAL].dfd, DAHDI_HOOK, &x);
do {
- x = ZT_RING;
- res = ioctl(p->subs[SUB_REAL].zfd, ZT_HOOK, &x);
+ x = DAHDI_RING;
+ res = ioctl(p->subs[SUB_REAL].dfd, DAHDI_HOOK, &x);
if (res) {
switch (errno) {
case EBUSY:
@@ -3486,9 +3493,9 @@ static int zt_ring_phone(struct zt_pvt *p)
static void *ss_thread(void *data);
-static struct ast_channel *zt_new(struct zt_pvt *, int, int, int, int, int);
+static struct ast_channel *dahdi_new(struct dahdi_pvt *, int, int, int, int, int);
-static int attempt_transfer(struct zt_pvt *p)
+static int attempt_transfer(struct dahdi_pvt *p)
{
/* In order to transfer, we need at least one of the channels to
actually be in a call bridge. We can't conference two applications
@@ -3502,7 +3509,7 @@ static int attempt_transfer(struct zt_pvt *p)
ast_indicate(ast_bridged_channel(p->subs[SUB_REAL].owner), AST_CONTROL_RINGING);
}
if (p->subs[SUB_THREEWAY].owner->_state == AST_STATE_RING) {
- tone_zone_play_tone(p->subs[SUB_THREEWAY].zfd, ZT_TONE_RINGTONE);
+ tone_zone_play_tone(p->subs[SUB_THREEWAY].dfd, DAHDI_TONE_RINGTONE);
}
if (p->subs[SUB_REAL].owner->cdr) {
/* Move CDR from second channel to current one */
@@ -3530,7 +3537,7 @@ static int attempt_transfer(struct zt_pvt *p)
ast_indicate(ast_bridged_channel(p->subs[SUB_THREEWAY].owner), AST_CONTROL_RINGING);
}
if (p->subs[SUB_REAL].owner->_state == AST_STATE_RING) {
- tone_zone_play_tone(p->subs[SUB_REAL].zfd, ZT_TONE_RINGTONE);
+ tone_zone_play_tone(p->subs[SUB_REAL].dfd, DAHDI_TONE_RINGTONE);
}
if (p->subs[SUB_THREEWAY].owner->cdr) {
/* Move CDR from second channel to current one */
@@ -3564,14 +3571,14 @@ static int attempt_transfer(struct zt_pvt *p)
return 0;
}
-static int check_for_conference(struct zt_pvt *p)
+static int check_for_conference(struct dahdi_pvt *p)
{
- ZT_CONFINFO ci;
+ DAHDI_CONFINFO ci;
/* Fine if we already have a master, etc */
if (p->master || (p->confno > -1))
return 0;
memset(&ci, 0, sizeof(ci));
- if (ioctl(p->subs[SUB_REAL].zfd, ZT_GETCONF, &ci)) {
+ if (ioctl(p->subs[SUB_REAL].dfd, DAHDI_GETCONF, &ci)) {
ast_log(LOG_WARNING, "Failed to get conference info on channel %d\n", p->channel);
return 0;
}
@@ -3586,13 +3593,13 @@ static int check_for_conference(struct zt_pvt *p)
return 0;
}
-static int get_alarms(struct zt_pvt *p)
+static int get_alarms(struct dahdi_pvt *p)
{
int res;
- ZT_SPANINFO zi;
+ DAHDI_SPANINFO zi;
memset(&zi, 0, sizeof(zi));
zi.spanno = p->span;
- res = ioctl(p->subs[SUB_REAL].zfd, ZT_SPANSTAT, &zi);
+ res = ioctl(p->subs[SUB_REAL].dfd, DAHDI_SPANSTAT, &zi);
if (res < 0) {
ast_log(LOG_WARNING, "Unable to determine alarm on channel %d\n", p->channel);
return 0;
@@ -3600,9 +3607,9 @@ static int get_alarms(struct zt_pvt *p)
return zi.alarms;
}
-static void zt_handle_dtmfup(struct ast_channel *ast, int index, struct ast_frame **dest)
+static void dahdi_handle_dtmfup(struct ast_channel *ast, int index, struct ast_frame **dest)
{
- struct zt_pvt *p = ast->tech_pvt;
+ struct dahdi_pvt *p = ast->tech_pvt;
struct ast_frame *f = *dest;
if (option_debug)
@@ -3651,38 +3658,38 @@ static void zt_handle_dtmfup(struct ast_channel *ast, int index, struct ast_fram
ast_log(LOG_DEBUG, "Already in a fax extension, not redirecting\n");
} else if (option_debug)
ast_log(LOG_DEBUG, "Fax already handled\n");
- zt_confmute(p, 0);
+ dahdi_confmute(p, 0);
p->subs[index].f.frametype = AST_FRAME_NULL;
p->subs[index].f.subclass = 0;
*dest = &p->subs[index].f;
} else if (f->subclass == 'm') {
/* Confmute request */
- zt_confmute(p, 1);
+ dahdi_confmute(p, 1);
p->subs[index].f.frametype = AST_FRAME_NULL;
p->subs[index].f.subclass = 0;
*dest = &p->subs[index].f;
} else if (f->subclass == 'u') {
/* Unmute */
- zt_confmute(p, 0);
+ dahdi_confmute(p, 0);
p->subs[index].f.frametype = AST_FRAME_NULL;
p->subs[index].f.subclass = 0;
*dest = &p->subs[index].f;
} else
- zt_confmute(p, 0);
+ dahdi_confmute(p, 0);
}
-static struct ast_frame *zt_handle_event(struct ast_channel *ast)
+static struct ast_frame *dahdi_handle_event(struct ast_channel *ast)
{
int res, x;
int index, mysig;
char *c;
- struct zt_pvt *p = ast->tech_pvt;
+ struct dahdi_pvt *p = ast->tech_pvt;
pthread_t threadid;
pthread_attr_t attr;
struct ast_channel *chan;
struct ast_frame *f;
- index = zt_get_index(ast, p, 0);
+ index = dahdi_get_index(ast, p, 0);
mysig = p->sig;
if (p->outsigmod > -1)
mysig = p->outsigmod;
@@ -3692,7 +3699,7 @@ static struct ast_frame *zt_handle_event(struct ast_channel *ast)
p->subs[index].f.samples = 0;
p->subs[index].f.mallocd = 0;
p->subs[index].f.offset = 0;
- p->subs[index].f.src = "zt_handle_event";
+ p->subs[index].f.src = "dahdi_handle_event";
p->subs[index].f.data = NULL;
f = &p->subs[index].f;
@@ -3702,13 +3709,13 @@ static struct ast_frame *zt_handle_event(struct ast_channel *ast)
res = p->fake_event;
p->fake_event = 0;
} else
- res = zt_get_event(p->subs[index].zfd);
+ res = dahdi_get_event(p->subs[index].dfd);
if (option_debug)
ast_log(LOG_DEBUG, "Got event %s(%d) on channel %d (index %d)\n", event2str(res), res, p->channel, index);
- if (res & (ZT_EVENT_PULSEDIGIT | ZT_EVENT_DTMFUP)) {
- p->pulsedial = (res & ZT_EVENT_PULSEDIGIT) ? 1 : 0;
+ if (res & (DAHDI_EVENT_PULSEDIGIT | DAHDI_EVENT_DTMFUP)) {
+ p->pulsedial = (res & DAHDI_EVENT_PULSEDIGIT) ? 1 : 0;
ast_log(LOG_DEBUG, "Detected %sdigit '%c'\n", p->pulsedial ? "pulse ": "", res & 0xff);
#ifdef HAVE_PRI
@@ -3721,49 +3728,49 @@ static struct ast_frame *zt_handle_event(struct ast_channel *ast)
#ifdef HAVE_PRI
}
#endif
- zt_handle_dtmfup(ast, index, &f);
+ dahdi_handle_dtmfup(ast, index, &f);
return f;
}
- if (res & ZT_EVENT_DTMFDOWN) {
+ if (res & DAHDI_EVENT_DTMFDOWN) {
if (option_debug)
ast_log(LOG_DEBUG, "DTMF Down '%c'\n", res & 0xff);
/* Mute conference */
- zt_confmute(p, 1);
+ dahdi_confmute(p, 1);
p->subs[index].f.frametype = AST_FRAME_DTMF_BEGIN;
p->subs[index].f.subclass = res & 0xff;
return &p->subs[index].f;
}
switch (res) {
-#ifdef ZT_EVENT_EC_DISABLED
- case ZT_EVENT_EC_DISABLED:
+#ifdef DAHDI_EVENT_EC_DISABLED
+ case DAHDI_EVENT_EC_DISABLED:
if (option_verbose > 2)
ast_verbose(VERBOSE_PREFIX_3 "Channel %d echo canceler disabled due to CED detection\n", p->channel);
p->echocanon = 0;
break;
#endif
- case ZT_EVENT_BITSCHANGED:
+ case DAHDI_EVENT_BITSCHANGED:
ast_log(LOG_WARNING, "Recieved bits changed on %s signalling?\n", sig2str(p->sig));
- case ZT_EVENT_PULSE_START:
+ case DAHDI_EVENT_PULSE_START:
/* Stop tone if there's a pulse start and the PBX isn't started */
if (!ast->pbx)
- tone_zone_play_tone(p->subs[index].zfd, -1);
+ tone_zone_play_tone(p->subs[index].dfd, -1);
break;
- case ZT_EVENT_DIALCOMPLETE:
+ case DAHDI_EVENT_DIALCOMPLETE:
if (p->inalarm) break;
if ((p->radio || (p->oprmode < 0))) break;
- if (ioctl(p->subs[index].zfd,ZT_DIALING,&x) == -1) {
- ast_log(LOG_DEBUG, "ZT_DIALING ioctl failed on %s\n",ast->name);
+ if (ioctl(p->subs[index].dfd,DAHDI_DIALING,&x) == -1) {
+ ast_log(LOG_DEBUG, "DAHDI_DIALING ioctl failed on %s\n",ast->name);
return NULL;
}
if (!x) { /* if not still dialing in driver */
- zt_enable_ec(p);
+ dahdi_enable_ec(p);
if (p->echobreak) {
- zt_train_ec(p);
+ dahdi_train_ec(p);
ast_copy_string(p->dop.dialstr, p->echorest, sizeof(p->dop.dialstr));
- p->dop.op = ZT_DIAL_OP_REPLACE;
- res = ioctl(p->subs[SUB_REAL].zfd, ZT_DIAL, &p->dop);
+ p->dop.op = DAHDI_DIAL_OP_REPLACE;
+ res = ioctl(p->subs[SUB_REAL].dfd, DAHDI_DIAL, &p->dop);
p->echobreak = 0;
} else {
p->dialing = 0;
@@ -3798,7 +3805,7 @@ static struct ast_frame *zt_handle_event(struct ast_channel *ast)
}
}
break;
- case ZT_EVENT_ALARM:
+ case DAHDI_EVENT_ALARM:
#ifdef HAVE_PRI
if (!p->pri || !p->pri->pri || (pri_get_timer(p->pri->pri, PRI_TIMER_T309) < 0)) {
/* T309 is not enabled : hangup calls when alarm occurs */
@@ -3826,7 +3833,7 @@ static struct ast_frame *zt_handle_event(struct ast_channel *ast)
do {
const char *alarm_str = alarm2str(res);
- /* hack alert! Zaptel 1.4 now exposes FXO battery as an alarm, but asterisk 1.4
+ /* hack alert! DAHDI 1.4 now exposes FXO battery as an alarm, but asterisk 1.4
* doesn't know what to do with it. Don't confuse users with log messages. */
if (!strcasecmp(alarm_str, "No Alarm") || !strcasecmp(alarm_str, "Unknown Alarm")) {
p->unknown_alarm = 1;
@@ -3848,7 +3855,7 @@ static struct ast_frame *zt_handle_event(struct ast_channel *ast)
break;
}
#endif
- case ZT_EVENT_ONHOOK:
+ case DAHDI_EVENT_ONHOOK:
if (p->radio) {
p->subs[index].f.frametype = AST_FRAME_CONTROL;
p->subs[index].f.subclass = AST_CONTROL_RADIO_UNKEY;
@@ -3860,10 +3867,10 @@ static struct ast_frame *zt_handle_event(struct ast_channel *ast)
if ((p->sig == SIG_FXOLS) || (p->sig == SIG_FXOKS) || (p->sig == SIG_FXOGS))
{
/* Make sure it starts ringing */
- zt_set_hook(p->subs[SUB_REAL].zfd, ZT_RINGOFF);
- zt_set_hook(p->subs[SUB_REAL].zfd, ZT_RING);
+ dahdi_set_hook(p->subs[SUB_REAL].dfd, DAHDI_RINGOFF);
+ dahdi_set_hook(p->subs[SUB_REAL].dfd, DAHDI_RING);
save_conference(p->oprpeer);
- tone_zone_play_tone(p->oprpeer->subs[SUB_REAL].zfd, ZT_TONE_RINGTONE);
+ tone_zone_play_tone(p->oprpeer->subs[SUB_REAL].dfd, DAHDI_TONE_RINGTONE);
}
break;
}
@@ -3892,7 +3899,7 @@ static struct ast_frame *zt_handle_event(struct ast_channel *ast)
/* Don't start streaming audio yet if the incoming call isn't up yet */
if (p->subs[SUB_REAL].owner->_state != AST_STATE_UP)
p->dialing = 1;
- zt_ring_phone(p);
+ dahdi_ring_phone(p);
} else if (p->subs[SUB_THREEWAY].owner) {
unsigned int mssinceflash;
/* Here we have to retain the lock on both the main channel, the 3-way channel, and
@@ -3936,7 +3943,7 @@ static struct ast_frame *zt_handle_event(struct ast_channel *ast)
swap_subs(p, SUB_THREEWAY, SUB_REAL);
p->owner = NULL;
/* Ring the phone */
- zt_ring_phone(p);
+ dahdi_ring_phone(p);
} else {
if ((res = attempt_transfer(p)) < 0) {
p->subs[SUB_THREEWAY].owner->_softhangup |= AST_SOFTHANGUP_DEV;
@@ -3960,7 +3967,7 @@ static struct ast_frame *zt_handle_event(struct ast_channel *ast)
swap_subs(p, SUB_THREEWAY, SUB_REAL);
p->owner = NULL;
/* Ring the phone */
- zt_ring_phone(p);
+ dahdi_ring_phone(p);
}
}
} else {
@@ -3968,19 +3975,19 @@ static struct ast_frame *zt_handle_event(struct ast_channel *ast)
}
/* Fall through */
default:
- zt_disable_ec(p);
+ dahdi_disable_ec(p);
return NULL;
}
break;
- case ZT_EVENT_RINGOFFHOOK:
+ case DAHDI_EVENT_RINGOFFHOOK:
if (p->inalarm) break;
if (p->oprmode < 0)
{
if ((p->sig == SIG_FXOLS) || (p->sig == SIG_FXOKS) || (p->sig == SIG_FXOGS))
{
/* Make sure it stops ringing */
- zt_set_hook(p->subs[SUB_REAL].zfd, ZT_RINGOFF);
- tone_zone_play_tone(p->oprpeer->subs[SUB_REAL].zfd, -1);
+ dahdi_set_hook(p->subs[SUB_REAL].dfd, DAHDI_RINGOFF);
+ tone_zone_play_tone(p->oprpeer->subs[SUB_REAL].dfd, -1);
restore_conference(p->oprpeer);
}
break;
@@ -4009,9 +4016,9 @@ static struct ast_frame *zt_handle_event(struct ast_channel *ast)
p->dop.dialstr[strlen(p->dop.dialstr)-2] = '\0';
} else
p->echobreak = 0;
- if (ioctl(p->subs[SUB_REAL].zfd, ZT_DIAL, &p->dop)) {
- x = ZT_ONHOOK;
- ioctl(p->subs[SUB_REAL].zfd, ZT_HOOK, &x);
+ if (ioctl(p->subs[SUB_REAL].dfd, DAHDI_DIAL, &p->dop)) {
+ x = DAHDI_ONHOOK;
+ ioctl(p->subs[SUB_REAL].dfd, DAHDI_HOOK, &x);
ast_log(LOG_WARNING, "Dialing failed on channel %d: %s\n", p->channel, strerror(errno));
return NULL;
}
@@ -4024,12 +4031,12 @@ static struct ast_frame *zt_handle_event(struct ast_channel *ast)
case SIG_FXOKS:
switch (ast->_state) {
case AST_STATE_RINGING:
- zt_enable_ec(p);
- zt_train_ec(p);
+ dahdi_enable_ec(p);
+ dahdi_train_ec(p);
p->subs[index].f.frametype = AST_FRAME_CONTROL;
p->subs[index].f.subclass = AST_CONTROL_ANSWER;
/* Make sure it stops ringing */
- zt_set_hook(p->subs[index].zfd, ZT_OFFHOOK);
+ dahdi_set_hook(p->subs[index].dfd, DAHDI_OFFHOOK);
ast_log(LOG_DEBUG, "channel %d answered\n", p->channel);
if (p->cidspill) {
/* Cancel any running CallerID spill */
@@ -4044,7 +4051,7 @@ static struct ast_frame *zt_handle_event(struct ast_channel *ast)
p->subs[index].f.subclass = 0;
} else if (!ast_strlen_zero(p->dop.dialstr)) {
/* nick@dccinc.com 4/3/03 - fxo should be able to do deferred dialing */
- res = ioctl(p->subs[SUB_REAL].zfd, ZT_DIAL, &p->dop);
+ res = ioctl(p->subs[SUB_REAL].dfd, DAHDI_DIAL, &p->dop);
if (res < 0) {
ast_log(LOG_WARNING, "Unable to initiate dialing on trunk channel %d\n", p->channel);
p->dop.dialstr[0] = '\0';
@@ -4069,7 +4076,7 @@ static struct ast_frame *zt_handle_event(struct ast_channel *ast)
return &p->subs[index].f;
case AST_STATE_UP:
/* Make sure it stops ringing */
- zt_set_hook(p->subs[index].zfd, ZT_OFFHOOK);
+ dahdi_set_hook(p->subs[index].dfd, DAHDI_OFFHOOK);
/* Okay -- probably call waiting*/
if (ast_bridged_channel(p->owner))
ast_queue_control(p->owner, AST_CONTROL_UNHOLD);
@@ -4078,9 +4085,9 @@ static struct ast_frame *zt_handle_event(struct ast_channel *ast)
case AST_STATE_RESERVED:
/* Start up dialtone */
if (has_voicemail(p))
- res = tone_zone_play_tone(p->subs[SUB_REAL].zfd, ZT_TONE_STUTTER);
+ res = tone_zone_play_tone(p->subs[SUB_REAL].dfd, DAHDI_TONE_STUTTER);
else
- res = tone_zone_play_tone(p->subs[SUB_REAL].zfd, ZT_TONE_DIALTONE);
+ res = tone_zone_play_tone(p->subs[SUB_REAL].dfd, DAHDI_TONE_DIALTONE);
break;
default:
ast_log(LOG_WARNING, "FXO phone off hook in weird state %d??\n", ast->_state);
@@ -4134,8 +4141,8 @@ static struct ast_frame *zt_handle_event(struct ast_channel *ast)
ast_log(LOG_WARNING, "Don't know how to handle ring/off hook for signalling %d\n", p->sig);
}
break;
-#ifdef ZT_EVENT_RINGBEGIN
- case ZT_EVENT_RINGBEGIN:
+#ifdef DAHDI_EVENT_RINGBEGIN
+ case DAHDI_EVENT_RINGBEGIN:
switch (p->sig) {
case SIG_FXSLS:
case SIG_FXSGS:
@@ -4147,7 +4154,7 @@ static struct ast_frame *zt_handle_event(struct ast_channel *ast)
}
break;
#endif
- case ZT_EVENT_RINGEROFF:
+ case DAHDI_EVENT_RINGEROFF:
if (p->inalarm) break;
if ((p->radio || (p->oprmode < 0))) break;
ast->rings++;
@@ -4160,9 +4167,9 @@ static struct ast_frame *zt_handle_event(struct ast_channel *ast)
p->subs[index].f.frametype = AST_FRAME_CONTROL;
p->subs[index].f.subclass = AST_CONTROL_RINGING;
break;
- case ZT_EVENT_RINGERON:
+ case DAHDI_EVENT_RINGERON:
break;
- case ZT_EVENT_NOALARM:
+ case DAHDI_EVENT_NOALARM:
p->inalarm = 0;
#ifdef HAVE_PRI
/* Extremely unlikely but just in case */
@@ -4177,23 +4184,23 @@ static struct ast_frame *zt_handle_event(struct ast_channel *ast)
p->unknown_alarm = 0;
}
break;
- case ZT_EVENT_WINKFLASH:
+ case DAHDI_EVENT_WINKFLASH:
if (p->inalarm) break;
if (p->radio) break;
if (p->oprmode < 0) break;
if (p->oprmode > 1)
{
- struct zt_params par;
+ DAHDI_PARAMS par;
- if (ioctl(p->oprpeer->subs[SUB_REAL].zfd, ZT_GET_PARAMS, &par) != -1)
+ if (ioctl(p->oprpeer->subs[SUB_REAL].dfd, DAHDI_GET_PARAMS, &par) != -1)
{
if (!par.rxisoffhook)
{
/* Make sure it stops ringing */
- zt_set_hook(p->oprpeer->subs[SUB_REAL].zfd, ZT_RINGOFF);
- zt_set_hook(p->oprpeer->subs[SUB_REAL].zfd, ZT_RING);
+ dahdi_set_hook(p->oprpeer->subs[SUB_REAL].dfd, DAHDI_RINGOFF);
+ dahdi_set_hook(p->oprpeer->subs[SUB_REAL].dfd, DAHDI_RING);
save_conference(p);
- tone_zone_play_tone(p->subs[SUB_REAL].zfd, ZT_TONE_RINGTONE);
+ tone_zone_play_tone(p->subs[SUB_REAL].dfd, DAHDI_TONE_RINGTONE);
}
}
break;
@@ -4205,7 +4212,7 @@ static struct ast_frame *zt_handle_event(struct ast_channel *ast)
case SIG_FXOGS:
case SIG_FXOKS:
ast_log(LOG_DEBUG, "Winkflash, index: %d, normal: %d, callwait: %d, thirdcall: %d\n",
- index, p->subs[SUB_REAL].zfd, p->subs[SUB_CALLWAIT].zfd, p->subs[SUB_THREEWAY].zfd);
+ index, p->subs[SUB_REAL].dfd, p->subs[SUB_CALLWAIT].dfd, p->subs[SUB_THREEWAY].dfd);
p->callwaitcas = 0;
if (index != SUB_REAL) {
@@ -4216,7 +4223,7 @@ static struct ast_frame *zt_handle_event(struct ast_channel *ast)
if (p->subs[SUB_CALLWAIT].owner) {
/* Swap to call-wait */
swap_subs(p, SUB_REAL, SUB_CALLWAIT);
- tone_zone_play_tone(p->subs[SUB_REAL].zfd, -1);
+ tone_zone_play_tone(p->subs[SUB_REAL].dfd, -1);
p->owner = p->subs[SUB_REAL].owner;
ast_log(LOG_DEBUG, "Making %s the new owner\n", p->owner->name);
if (p->owner->_state == AST_STATE_RINGING) {
@@ -4247,7 +4254,7 @@ static struct ast_frame *zt_handle_event(struct ast_channel *ast)
p->subs[SUB_REAL].needflash = 1;
goto winkflashdone;
} else if (!check_for_conference(p)) {
- if (p->zaptrcallerid && p->owner) {
+ if (p->dahditrcallerid && p->owner) {
if (p->owner->cid.cid_num)
ast_copy_string(cid_num, p->owner->cid.cid_num, sizeof(cid_num));
if (p->owner->cid.cid_name)
@@ -4266,8 +4273,8 @@ static struct ast_frame *zt_handle_event(struct ast_channel *ast)
goto winkflashdone;
}
/* Make new channel */
- chan = zt_new(p, AST_STATE_RESERVED, 0, SUB_THREEWAY, 0, 0);
- if (p->zaptrcallerid) {
+ chan = dahdi_new(p, AST_STATE_RESERVED, 0, SUB_THREEWAY, 0, 0);
+ if (p->dahditrcallerid) {
if (!p->origcid_num)
p->origcid_num = ast_strdup(p->cid_num);
if (!p->origcid_name)
@@ -4278,8 +4285,8 @@ static struct ast_frame *zt_handle_event(struct ast_channel *ast)
/* Swap things around between the three-way and real call */
swap_subs(p, SUB_THREEWAY, SUB_REAL);
/* Disable echo canceller for better dialing */
- zt_disable_ec(p);
- res = tone_zone_play_tone(p->subs[SUB_REAL].zfd, ZT_TONE_DIALRECALL);
+ dahdi_disable_ec(p);
+ res = tone_zone_play_tone(p->subs[SUB_REAL].dfd, DAHDI_TONE_DIALRECALL);
if (res)
ast_log(LOG_WARNING, "Unable to start dial recall tone on channel %d\n", p->channel);
p->owner = chan;
@@ -4289,8 +4296,8 @@ static struct ast_frame *zt_handle_event(struct ast_channel *ast)
ast_log(LOG_WARNING, "Cannot allocate new structure on channel %d\n", p->channel);
} else if (ast_pthread_create(&threadid, &attr, ss_thread, chan)) {
ast_log(LOG_WARNING, "Unable to start simple switch on channel %d\n", p->channel);
- res = tone_zone_play_tone(p->subs[SUB_REAL].zfd, ZT_TONE_CONGESTION);
- zt_enable_ec(p);
+ res = tone_zone_play_tone(p->subs[SUB_REAL].dfd, DAHDI_TONE_CONGESTION);
+ dahdi_enable_ec(p);
ast_hangup(chan);
} else {
if (option_verbose > 2)
@@ -4344,8 +4351,8 @@ static struct ast_frame *zt_handle_event(struct ast_channel *ast)
p->owner = p->subs[SUB_REAL].owner;
if (ast->_state == AST_STATE_RINGING) {
ast_log(LOG_DEBUG, "Enabling ringtone on real and threeway\n");
- res = tone_zone_play_tone(p->subs[SUB_REAL].zfd, ZT_TONE_RINGTONE);
- res = tone_zone_play_tone(p->subs[SUB_THREEWAY].zfd, ZT_TONE_RINGTONE);
+ res = tone_zone_play_tone(p->subs[SUB_REAL].dfd, DAHDI_TONE_RINGTONE);
+ res = tone_zone_play_tone(p->subs[SUB_THREEWAY].dfd, DAHDI_TONE_RINGTONE);
}
} else {
if (option_verbose > 2)
@@ -4356,7 +4363,7 @@ static struct ast_frame *zt_handle_event(struct ast_channel *ast)
if (p->subs[SUB_REAL].owner && ast_bridged_channel(p->subs[SUB_REAL].owner))
ast_queue_control(p->subs[SUB_REAL].owner, AST_CONTROL_UNHOLD);
p->subs[SUB_REAL].needunhold = 1;
- zt_enable_ec(p);
+ dahdi_enable_ec(p);
}
}
@@ -4402,7 +4409,7 @@ static struct ast_frame *zt_handle_event(struct ast_channel *ast)
case SIG_SF_FEATB:
/* FGD MF *Must* wait for wink */
if (!ast_strlen_zero(p->dop.dialstr)) {
- res = ioctl(p->subs[SUB_REAL].zfd, ZT_DIAL, &p->dop);
+ res = ioctl(p->subs[SUB_REAL].dfd, DAHDI_DIAL, &p->dop);
if (res < 0) {
ast_log(LOG_WARNING, "Unable to initiate dialing on trunk channel %d\n", p->channel);
p->dop.dialstr[0] = '\0';
@@ -4416,7 +4423,7 @@ static struct ast_frame *zt_handle_event(struct ast_channel *ast)
ast_log(LOG_WARNING, "Don't know how to handle ring/off hoook for signalling %d\n", p->sig);
}
break;
- case ZT_EVENT_HOOKCOMPLETE:
+ case DAHDI_EVENT_HOOKCOMPLETE:
if (p->inalarm) break;
if ((p->radio || (p->oprmode < 0))) break;
switch (mysig) {
@@ -4431,7 +4438,7 @@ static struct ast_frame *zt_handle_event(struct ast_channel *ast)
case SIG_SFWINK:
case SIG_SF_FEATD:
if (!ast_strlen_zero(p->dop.dialstr)) {
- res = ioctl(p->subs[SUB_REAL].zfd, ZT_DIAL, &p->dop);
+ res = ioctl(p->subs[SUB_REAL].dfd, DAHDI_DIAL, &p->dop);
if (res < 0) {
ast_log(LOG_WARNING, "Unable to initiate dialing on trunk channel %d\n", p->channel);
p->dop.dialstr[0] = '\0';
@@ -4440,7 +4447,7 @@ static struct ast_frame *zt_handle_event(struct ast_channel *ast)
ast_log(LOG_DEBUG, "Sent deferred digit string: %s\n", p->dop.dialstr);
}
p->dop.dialstr[0] = '\0';
- p->dop.op = ZT_DIAL_OP_REPLACE;
+ p->dop.op = DAHDI_DIAL_OP_REPLACE;
break;
case SIG_FEATDMF:
case SIG_FEATDMF_TA:
@@ -4456,7 +4463,7 @@ static struct ast_frame *zt_handle_event(struct ast_channel *ast)
break;
}
break;
- case ZT_EVENT_POLARITY:
+ case DAHDI_EVENT_POLARITY:
/*
* If we get a Polarity Switch event, check to see
* if we should change the polarity state and
@@ -4505,16 +4512,16 @@ static struct ast_frame *zt_handle_event(struct ast_channel *ast)
return &p->subs[index].f;
}
-static struct ast_frame *__zt_exception(struct ast_channel *ast)
+static struct ast_frame *__dahdi_exception(struct ast_channel *ast)
{
- struct zt_pvt *p = ast->tech_pvt;
+ struct dahdi_pvt *p = ast->tech_pvt;
int res;
int usedindex=-1;
int index;
struct ast_frame *f;
- index = zt_get_index(ast, p, 1);
+ index = dahdi_get_index(ast, p, 1);
p->subs[index].f.frametype = AST_FRAME_NULL;
p->subs[index].f.datalen = 0;
@@ -4523,7 +4530,7 @@ static struct ast_frame *__zt_exception(struct ast_channel *ast)
p->subs[index].f.offset = 0;
p->subs[index].f.subclass = 0;
p->subs[index].f.delivery = ast_tv(0,0);
- p->subs[index].f.src = "zt_exception";
+ p->subs[index].f.src = "dahdi_exception";
p->subs[index].f.data = NULL;
@@ -4537,10 +4544,10 @@ static struct ast_frame *__zt_exception(struct ast_channel *ast)
res = p->fake_event;
p->fake_event = 0;
} else
- res = zt_get_event(p->subs[SUB_REAL].zfd);
+ res = dahdi_get_event(p->subs[SUB_REAL].dfd);
/* Switch to real if there is one and this isn't something really silly... */
- if ((res != ZT_EVENT_RINGEROFF) && (res != ZT_EVENT_RINGERON) &&
- (res != ZT_EVENT_HOOKCOMPLETE)) {
+ if ((res != DAHDI_EVENT_RINGEROFF) && (res != DAHDI_EVENT_RINGERON) &&
+ (res != DAHDI_EVENT_HOOKCOMPLETE)) {
ast_log(LOG_DEBUG, "Restoring owner of channel %d on event %d\n", p->channel, res);
p->owner = p->subs[SUB_REAL].owner;
if (p->owner && ast_bridged_channel(p->owner))
@@ -4548,39 +4555,39 @@ static struct ast_frame *__zt_exception(struct ast_channel *ast)
p->subs[SUB_REAL].needunhold = 1;
}
switch (res) {
- case ZT_EVENT_ONHOOK:
- zt_disable_ec(p);
+ case DAHDI_EVENT_ONHOOK:
+ dahdi_disable_ec(p);
if (p->owner) {
if (option_verbose > 2)
ast_verbose(VERBOSE_PREFIX_3 "Channel %s still has call, ringing phone\n", p->owner->name);
- zt_ring_phone(p);
+ dahdi_ring_phone(p);
p->callwaitingrepeat = 0;
p->cidcwexpire = 0;
} else
ast_log(LOG_WARNING, "Absorbed on hook, but nobody is left!?!?\n");
update_conf(p);
break;
- case ZT_EVENT_RINGOFFHOOK:
- zt_enable_ec(p);
- zt_set_hook(p->subs[SUB_REAL].zfd, ZT_OFFHOOK);
+ case DAHDI_EVENT_RINGOFFHOOK:
+ dahdi_enable_ec(p);
+ dahdi_set_hook(p->subs[SUB_REAL].dfd, DAHDI_OFFHOOK);
if (p->owner && (p->owner->_state == AST_STATE_RINGING)) {
p->subs[SUB_REAL].needanswer = 1;
p->dialing = 0;
}
break;
- case ZT_EVENT_HOOKCOMPLETE:
- case ZT_EVENT_RINGERON:
- case ZT_EVENT_RINGEROFF:
+ case DAHDI_EVENT_HOOKCOMPLETE:
+ case DAHDI_EVENT_RINGERON:
+ case DAHDI_EVENT_RINGEROFF:
/* Do nothing */
break;
- case ZT_EVENT_WINKFLASH:
+ case DAHDI_EVENT_WINKFLASH:
gettimeofday(&p->flashtime, NULL);
if (p->owner) {
if (option_verbose > 2)
ast_verbose(VERBOSE_PREFIX_3 "Channel %d flashed to other channel %s\n", p->channel, p->owner->name);
if (p->owner->_state != AST_STATE_UP) {
/* Answer if necessary */
- usedindex = zt_get_index(p->owner, p, 0);
+ usedindex = dahdi_get_index(p->owner, p, 0);
if (usedindex > -1) {
p->subs[usedindex].needanswer = 1;
}
@@ -4609,23 +4616,23 @@ static struct ast_frame *__zt_exception(struct ast_channel *ast)
f = &p->subs[index].f;
return f;
}
- f = zt_handle_event(ast);
+ f = dahdi_handle_event(ast);
return f;
}
-static struct ast_frame *zt_exception(struct ast_channel *ast)
+static struct ast_frame *dahdi_exception(struct ast_channel *ast)
{
- struct zt_pvt *p = ast->tech_pvt;
+ struct dahdi_pvt *p = ast->tech_pvt;
struct ast_frame *f;
ast_mutex_lock(&p->lock);
- f = __zt_exception(ast);
+ f = __dahdi_exception(ast);
ast_mutex_unlock(&p->lock);
return f;
}
-static struct ast_frame *zt_read(struct ast_channel *ast)
+static struct ast_frame *dahdi_read(struct ast_channel *ast)
{
- struct zt_pvt *p = ast->tech_pvt;
+ struct dahdi_pvt *p = ast->tech_pvt;
int res;
int index;
void *readbuf;
@@ -4634,7 +4641,7 @@ static struct ast_frame *zt_read(struct ast_channel *ast)
ast_mutex_lock(&p->lock);
- index = zt_get_index(ast, p, 0);
+ index = dahdi_get_index(ast, p, 0);
/* Hang up if we don't really exist */
if (index < 0) {
@@ -4652,16 +4659,16 @@ static struct ast_frame *zt_read(struct ast_channel *ast)
p->subs[index].f.offset = 0;
p->subs[index].f.subclass = 0;
p->subs[index].f.delivery = ast_tv(0,0);
- p->subs[index].f.src = "zt_read";
+ p->subs[index].f.src = "dahdi_read";
p->subs[index].f.data = NULL;
/* make sure it sends initial key state as first frame */
if ((p->radio || (p->oprmode < 0)) && (!p->firstradio))
{
- ZT_PARAMS ps;
+ DAHDI_PARAMS ps;
ps.channo = p->channel;
- if (ioctl(p->subs[SUB_REAL].zfd, ZT_GET_PARAMS, &ps) < 0) {
+ if (ioctl(p->subs[SUB_REAL].dfd, DAHDI_GET_PARAMS, &ps) < 0) {
ast_mutex_unlock(&p->lock);
return NULL;
}
@@ -4762,7 +4769,7 @@ static struct ast_frame *zt_read(struct ast_channel *ast)
if (ast->rawreadformat == AST_FORMAT_SLINEAR) {
if (!p->subs[index].linear) {
p->subs[index].linear = 1;
- res = zt_setlinear(p->subs[index].zfd, p->subs[index].linear);
+ res = dahdi_setlinear(p->subs[index].dfd, p->subs[index].linear);
if (res)
ast_log(LOG_WARNING, "Unable to set channel %d (index %d) to linear mode.\n", p->channel, index);
}
@@ -4770,7 +4777,7 @@ static struct ast_frame *zt_read(struct ast_channel *ast)
(ast->rawreadformat == AST_FORMAT_ALAW)) {
if (p->subs[index].linear) {
p->subs[index].linear = 0;
- res = zt_setlinear(p->subs[index].zfd, p->subs[index].linear);
+ res = dahdi_setlinear(p->subs[index].dfd, p->subs[index].linear);
if (res)
ast_log(LOG_WARNING, "Unable to set channel %d (index %d) to companded mode.\n", p->channel, index);
}
@@ -4781,7 +4788,7 @@ static struct ast_frame *zt_read(struct ast_channel *ast)
}
readbuf = ((unsigned char *)p->subs[index].buffer) + AST_FRIENDLY_OFFSET;
CHECK_BLOCKING(ast);
- res = read(p->subs[index].zfd, readbuf, p->subs[index].linear ? READ_SIZE * 2 : READ_SIZE);
+ res = read(p->subs[index].dfd, readbuf, p->subs[index].linear ? READ_SIZE * 2 : READ_SIZE);
ast_clear_flag(ast, AST_FLAG_BLOCKING);
/* Check for hangup */
if (res < 0) {
@@ -4792,16 +4799,16 @@ static struct ast_frame *zt_read(struct ast_channel *ast)
ast_mutex_unlock(&p->lock);
return &p->subs[index].f;
} else if (errno == ELAST) {
- f = __zt_exception(ast);
+ f = __dahdi_exception(ast);
} else
- ast_log(LOG_WARNING, "zt_rec: %s\n", strerror(errno));
+ ast_log(LOG_WARNING, "dahdi_rec: %s\n", strerror(errno));
}
ast_mutex_unlock(&p->lock);
return f;
}
if (res != (p->subs[index].linear ? READ_SIZE * 2 : READ_SIZE)) {
ast_log(LOG_DEBUG, "Short read (%d/%d), must be an event...\n", res, p->subs[index].linear ? READ_SIZE * 2 : READ_SIZE);
- f = __zt_exception(ast);
+ f = __dahdi_exception(ast);
ast_mutex_unlock(&p->lock);
return f;
}
@@ -4827,7 +4834,7 @@ static struct ast_frame *zt_read(struct ast_channel *ast)
}
}
/* Ensure the CW timer decrements only on a single subchannel */
- if (p->callwaitingrepeat && zt_get_index(ast, p, 1) == SUB_REAL) {
+ if (p->callwaitingrepeat && dahdi_get_index(ast, p, 1) == SUB_REAL) {
p->callwaitingrepeat--;
}
if (p->cidcwexpire)
@@ -4835,7 +4842,7 @@ static struct ast_frame *zt_read(struct ast_channel *ast)
/* Repeat callwaiting */
if (p->callwaitingrepeat == 1) {
p->callwaitrings++;
- zt_callwait(ast);
+ dahdi_callwait(ast);
}
/* Expire CID/CW */
if (p->cidcwexpire == 1) {
@@ -4877,7 +4884,7 @@ static struct ast_frame *zt_read(struct ast_channel *ast)
p->subs[index].f.datalen= 0;
}
if (p->dsp && (!p->ignoredtmf || p->callwaitcas || p->busydetect || p->callprogress) && !index) {
- /* Perform busy detection. etc on the zap line */
+ /* Perform busy detection. etc on the dahdi line */
f = ast_dsp_process(ast, p->dsp, &p->subs[index].f);
if (f) {
if ((f->frametype == AST_FRAME_CONTROL) && (f->subclass == AST_CONTROL_BUSY)) {
@@ -4902,7 +4909,7 @@ static struct ast_frame *zt_read(struct ast_channel *ast)
f = &p->subs[index].f;
if (f && (f->frametype == AST_FRAME_DTMF))
- zt_handle_dtmfup(ast, index, &f);
+ dahdi_handle_dtmfup(ast, index, &f);
/* If we have a fake_event, trigger exception to handle it */
if (p->fake_event)
@@ -4912,13 +4919,13 @@ static struct ast_frame *zt_read(struct ast_channel *ast)
return f;
}
-static int my_zt_write(struct zt_pvt *p, unsigned char *buf, int len, int index, int linear)
+static int my_dahdi_write(struct dahdi_pvt *p, unsigned char *buf, int len, int index, int linear)
{
int sent=0;
int size;
int res;
int fd;
- fd = p->subs[index].zfd;
+ fd = p->subs[index].dfd;
while (len) {
size = len;
if (size > (linear ? READ_SIZE * 2 : READ_SIZE))
@@ -4935,12 +4942,12 @@ static int my_zt_write(struct zt_pvt *p, unsigned char *buf, int len, int index,
return sent;
}
-static int zt_write(struct ast_channel *ast, struct ast_frame *frame)
+static int dahdi_write(struct ast_channel *ast, struct ast_frame *frame)
{
- struct zt_pvt *p = ast->tech_pvt;
+ struct dahdi_pvt *p = ast->tech_pvt;
int res;
int index;
- index = zt_get_index(ast, p, 0);
+ index = dahdi_get_index(ast, p, 0);
if (index < 0) {
ast_log(LOG_WARNING, "%s doesn't really exist?\n", ast->name);
return -1;
@@ -4996,20 +5003,20 @@ static int zt_write(struct ast_channel *ast, struct ast_frame *frame)
if (frame->subclass == AST_FORMAT_SLINEAR) {
if (!p->subs[index].linear) {
p->subs[index].linear = 1;
- res = zt_setlinear(p->subs[index].zfd, p->subs[index].linear);
+ res = dahdi_setlinear(p->subs[index].dfd, p->subs[index].linear);
if (res)
ast_log(LOG_WARNING, "Unable to set linear mode on channel %d\n", p->channel);
}
- res = my_zt_write(p, (unsigned char *)frame->data, frame->datalen, index, 1);
+ res = my_dahdi_write(p, (unsigned char *)frame->data, frame->datalen, index, 1);
} else {
/* x-law already */
if (p->subs[index].linear) {
p->subs[index].linear = 0;
- res = zt_setlinear(p->subs[index].zfd, p->subs[index].linear);
+ res = dahdi_setlinear(p->subs[index].dfd, p->subs[index].linear);
if (res)
ast_log(LOG_WARNING, "Unable to set companded mode on channel %d\n", p->channel);
}
- res = my_zt_write(p, (unsigned char *)frame->data, frame->datalen, index, 0);
+ res = my_dahdi_write(p, (unsigned char *)frame->data, frame->datalen, index, 0);
}
if (res < 0) {
ast_log(LOG_WARNING, "write failed: %s\n", strerror(errno));
@@ -5018,14 +5025,14 @@ static int zt_write(struct ast_channel *ast, struct ast_frame *frame)
return 0;
}
-static int zt_indicate(struct ast_channel *chan, int condition, const void *data, size_t datalen)
+static int dahdi_indicate(struct ast_channel *chan, int condition, const void *data, size_t datalen)
{
- struct zt_pvt *p = chan->tech_pvt;
+ struct dahdi_pvt *p = chan->tech_pvt;
int res=-1;
int index;
- int func = ZT_FLASH;
+ int func = DAHDI_FLASH;
ast_mutex_lock(&p->lock);
- index = zt_get_index(chan, p, 0);
+ index = dahdi_get_index(chan, p, 0);
if (option_debug)
ast_log(LOG_DEBUG, "Requested indication %d on channel %s\n", condition, chan->name);
if (index == SUB_REAL) {
@@ -5046,10 +5053,10 @@ static int zt_indicate(struct ast_channel *chan, int condition, const void *data
ast_log(LOG_WARNING, "Unable to grab PRI on span %d\n", p->span);
}
p->progress = 1;
- res = tone_zone_play_tone(p->subs[index].zfd, ZT_TONE_BUSY);
+ res = tone_zone_play_tone(p->subs[index].dfd, DAHDI_TONE_BUSY);
} else
#endif
- res = tone_zone_play_tone(p->subs[index].zfd, ZT_TONE_BUSY);
+ res = tone_zone_play_tone(p->subs[index].dfd, DAHDI_TONE_BUSY);
break;
case AST_CONTROL_RINGING:
#ifdef HAVE_PRI
@@ -5065,7 +5072,7 @@ static int zt_indicate(struct ast_channel *chan, int condition, const void *data
p->alerting = 1;
}
#endif
- res = tone_zone_play_tone(p->subs[index].zfd, ZT_TONE_RINGTONE);
+ res = tone_zone_play_tone(p->subs[index].dfd, DAHDI_TONE_RINGTONE);
if (chan->_state != AST_STATE_UP) {
if ((chan->_state != AST_STATE_RING) ||
((p->sig != SIG_FXSKS) &&
@@ -5127,10 +5134,10 @@ static int zt_indicate(struct ast_channel *chan, int condition, const void *data
ast_log(LOG_WARNING, "Unable to grab PRI on span %d\n", p->span);
}
p->progress = 1;
- res = tone_zone_play_tone(p->subs[index].zfd, ZT_TONE_CONGESTION);
+ res = tone_zone_play_tone(p->subs[index].dfd, DAHDI_TONE_CONGESTION);
} else
#endif
- res = tone_zone_play_tone(p->subs[index].zfd, ZT_TONE_CONGESTION);
+ res = tone_zone_play_tone(p->subs[index].dfd, DAHDI_TONE_CONGESTION);
break;
case AST_CONTROL_HOLD:
#ifdef HAVE_PRI
@@ -5158,12 +5165,12 @@ static int zt_indicate(struct ast_channel *chan, int condition, const void *data
break;
case AST_CONTROL_RADIO_KEY:
if (p->radio)
- res = zt_set_hook(p->subs[index].zfd, ZT_OFFHOOK);
+ res = dahdi_set_hook(p->subs[index].dfd, DAHDI_OFFHOOK);
res = 0;
break;
case AST_CONTROL_RADIO_UNKEY:
if (p->radio)
- res = zt_set_hook(p->subs[index].zfd, ZT_RINGOFF);
+ res = dahdi_set_hook(p->subs[index].dfd, DAHDI_RINGOFF);
res = 0;
break;
case AST_CONTROL_FLASH:
@@ -5171,7 +5178,7 @@ static int zt_indicate(struct ast_channel *chan, int condition, const void *data
if (ISTRUNK(p) && (p->sig != SIG_PRI)) {
/* Clear out the dial buffer */
p->dop.dialstr[0] = '\0';
- if ((ioctl(p->subs[SUB_REAL].zfd,ZT_HOOK,&func) == -1) && (errno != EINPROGRESS)) {
+ if ((ioctl(p->subs[SUB_REAL].dfd,DAHDI_HOOK,&func) == -1) && (errno != EINPROGRESS)) {
ast_log(LOG_WARNING, "Unable to flash external trunk on channel %s: %s\n",
chan->name, strerror(errno));
} else
@@ -5183,7 +5190,7 @@ static int zt_indicate(struct ast_channel *chan, int condition, const void *data
res = 0;
break;
case -1:
- res = tone_zone_play_tone(p->subs[index].zfd, -1);
+ res = tone_zone_play_tone(p->subs[index].dfd, -1);
break;
}
} else
@@ -5192,7 +5199,7 @@ static int zt_indicate(struct ast_channel *chan, int condition, const void *data
return res;
}
-static struct ast_channel *zt_new(struct zt_pvt *i, int state, int startpbx, int index, int law, int transfercapability)
+static struct ast_channel *dahdi_new(struct dahdi_pvt *i, int state, int startpbx, int index, int law, int transfercapability)
{
struct ast_channel *tmp;
int deflaw;
@@ -5200,7 +5207,7 @@ static struct ast_channel *zt_new(struct zt_pvt *i, int state, int startpbx, int
int x,y;
int features;
char *b2 = NULL;
- ZT_PARAMS ps;
+ DAHDI_PARAMS ps;
if (i->subs[index].owner) {
ast_log(LOG_WARNING, "Channel %d already has a %s call\n", i->channel,subnames[index]);
return NULL;
@@ -5224,29 +5231,29 @@ static struct ast_channel *zt_new(struct zt_pvt *i, int state, int startpbx, int
}
y++;
} while (x < 3);
- tmp = ast_channel_alloc(0, state, i->cid_num, i->cid_name, i->accountcode, i->exten, i->context, i->amaflags, "Zap/%s", b2);
+ tmp = ast_channel_alloc(0, state, i->cid_num, i->cid_name, i->accountcode, i->exten, i->context, i->amaflags, "DAHDI/%s", b2);
if (b2) /*!> b2 can be freed now, it's been copied into the channel structure */
free(b2);
if (!tmp)
return NULL;
- tmp->tech = &zap_tech;
+ tmp->tech = &dahdi_tech;
ps.channo = i->channel;
- res = ioctl(i->subs[SUB_REAL].zfd, ZT_GET_PARAMS, &ps);
+ res = ioctl(i->subs[SUB_REAL].dfd, DAHDI_GET_PARAMS, &ps);
if (res) {
ast_log(LOG_WARNING, "Unable to get parameters, assuming MULAW\n");
- ps.curlaw = ZT_LAW_MULAW;
+ ps.curlaw = DAHDI_LAW_MULAW;
}
- if (ps.curlaw == ZT_LAW_ALAW)
+ if (ps.curlaw == DAHDI_LAW_ALAW)
deflaw = AST_FORMAT_ALAW;
else
deflaw = AST_FORMAT_ULAW;
if (law) {
- if (law == ZT_LAW_ALAW)
+ if (law == DAHDI_LAW_ALAW)
deflaw = AST_FORMAT_ALAW;
else
deflaw = AST_FORMAT_ULAW;
}
- tmp->fds[0] = i->subs[index].zfd;
+ tmp->fds[0] = i->subs[index].dfd;
tmp->nativeformats = AST_FORMAT_SLINEAR | deflaw;
/* Start out assuming ulaw since it's smaller :) */
tmp->rawreadformat = deflaw;
@@ -5254,7 +5261,7 @@ static struct ast_channel *zt_new(struct zt_pvt *i, int state, int startpbx, int
tmp->rawwriteformat = deflaw;
tmp->writeformat = deflaw;
i->subs[index].linear = 0;
- zt_setlinear(i->subs[index].zfd, i->subs[index].linear);
+ dahdi_setlinear(i->subs[index].dfd, i->subs[index].linear);
features = 0;
if (index == SUB_REAL) {
if (i->busydetect && CANBUSYDETECT(i))
@@ -5265,13 +5272,13 @@ static struct ast_channel *zt_new(struct zt_pvt *i, int state, int startpbx, int
(i->outgoing && (i->callprogress & 2))) {
features |= DSP_FEATURE_FAX_DETECT;
}
-#ifdef ZT_TONEDETECT
- x = ZT_TONEDETECT_ON | ZT_TONEDETECT_MUTE;
- if (ioctl(i->subs[index].zfd, ZT_TONEDETECT, &x)) {
+#ifdef DAHDI_TONEDETECT
+ x = DAHDI_TONEDETECT_ON | DAHDI_TONEDETECT_MUTE;
+ if (ioctl(i->subs[index].dfd, DAHDI_TONEDETECT, &x)) {
#endif
i->hardwaredtmf = 0;
features |= DSP_FEATURE_DTMF_DETECT;
-#ifdef ZT_TONEDETECT
+#ifdef DAHDI_TONEDETECT
} else if (NEED_MFDETECT(i)) {
i->hardwaredtmf = 1;
features |= DSP_FEATURE_DTMF_DETECT;
@@ -5361,7 +5368,7 @@ static struct ast_channel *zt_new(struct zt_pvt *i, int state, int startpbx, int
/* clear the fake event in case we posted one before we had ast_channel */
i->fake_event = 0;
/* Assure there is no confmute on this channel */
- zt_confmute(i, 0);
+ dahdi_confmute(i, 0);
/* Configure the new channel jb */
ast_jb_configure(tmp, &global_jbconf);
if (startpbx) {
@@ -5398,28 +5405,28 @@ static int my_getsigstr(struct ast_channel *chan, char *str, const char *term, i
}
}
-static int zt_wink(struct zt_pvt *p, int index)
+static int dahdi_wink(struct dahdi_pvt *p, int index)
{
int j;
- zt_set_hook(p->subs[index].zfd, ZT_WINK);
+ dahdi_set_hook(p->subs[index].dfd, DAHDI_WINK);
for (;;)
{
/* set bits of interest */
- j = ZT_IOMUX_SIGEVENT;
+ j = DAHDI_IOMUX_SIGEVENT;
/* wait for some happening */
- if (ioctl(p->subs[index].zfd,ZT_IOMUX,&j) == -1) return(-1);
+ if (ioctl(p->subs[index].dfd,DAHDI_IOMUX,&j) == -1) return(-1);
/* exit loop if we have it */
- if (j & ZT_IOMUX_SIGEVENT) break;
+ if (j & DAHDI_IOMUX_SIGEVENT) break;
}
/* get the event info */
- if (ioctl(p->subs[index].zfd,ZT_GETEVENT,&j) == -1) return(-1);
+ if (ioctl(p->subs[index].dfd,DAHDI_GETEVENT,&j) == -1) return(-1);
return 0;
}
static void *ss_thread(void *data)
{
struct ast_channel *chan = data;
- struct zt_pvt *p = chan->tech_pvt;
+ struct dahdi_pvt *p = chan->tech_pvt;
char exten[AST_MAX_EXTENSION] = "";
char exten2[AST_MAX_EXTENSION] = "";
unsigned char buf[256];
@@ -5454,7 +5461,7 @@ static void *ss_thread(void *data)
if (option_verbose > 2)
ast_verbose( VERBOSE_PREFIX_3 "Starting simple switch on '%s'\n", chan->name);
- index = zt_get_index(chan, p, 1);
+ index = dahdi_get_index(chan, p, 1);
if (index < 0) {
ast_log(LOG_WARNING, "Huh?\n");
ast_hangup(chan);
@@ -5471,9 +5478,9 @@ static void *ss_thread(void *data)
res = 0;
while ((len < AST_MAX_EXTENSION-1) && ast_matchmore_extension(chan, chan->context, exten, 1, p->cid_num)) {
if (len && !ast_ignore_pattern(chan->context, exten))
- tone_zone_play_tone(p->subs[index].zfd, -1);
+ tone_zone_play_tone(p->subs[index].dfd, -1);
else
- tone_zone_play_tone(p->subs[index].zfd, ZT_TONE_DIALTONE);
+ tone_zone_play_tone(p->subs[index].dfd, DAHDI_TONE_DIALTONE);
if (ast_exists_extension(chan, chan->context, exten, 1, p->cid_num))
timeout = matchdigittimeout;
else
@@ -5496,12 +5503,12 @@ static void *ss_thread(void *data)
exten[0] = 's';
exten[1] = '\0';
}
- tone_zone_play_tone(p->subs[index].zfd, -1);
+ tone_zone_play_tone(p->subs[index].dfd, -1);
if (ast_exists_extension(chan, chan->context, exten, 1, p->cid_num)) {
/* Start the real PBX */
ast_copy_string(chan->exten, exten, sizeof(chan->exten));
if (p->dsp) ast_dsp_digitreset(p->dsp);
- zt_enable_ec(p);
+ dahdi_enable_ec(p);
ast_setstate(chan, AST_STATE_RING);
res = ast_pbx_run(chan);
if (res) {
@@ -5529,14 +5536,14 @@ static void *ss_thread(void *data)
case SIG_SF_FEATDMF:
case SIG_SF_FEATB:
case SIG_SFWINK:
- if (zt_wink(p, index))
+ if (dahdi_wink(p, index))
return NULL;
/* Fall through */
case SIG_EM:
case SIG_EM_E1:
case SIG_SF:
case SIG_FGC_CAMA:
- res = tone_zone_play_tone(p->subs[index].zfd, -1);
+ res = tone_zone_play_tone(p->subs[index].dfd, -1);
if (p->dsp)
ast_dsp_digitreset(p->dsp);
/* set digit mode appropriately */
@@ -5567,7 +5574,7 @@ static void *ss_thread(void *data)
case SIG_FEATDMF_TA:
res = my_getsigstr(chan, dtmfbuf + 1, "#", 3000);
if ((res < 1) && (p->dsp)) ast_dsp_digitreset(p->dsp);
- if (zt_wink(p, index)) return NULL;
+ if (dahdi_wink(p, index)) return NULL;
dtmfbuf[0] = 0;
/* Wait for the first digit (up to 5 seconds). */
res = ast_waitfordigit(chan, 5000);
@@ -5582,7 +5589,7 @@ static void *ss_thread(void *data)
/* if international caca, do it again to get real ANO */
if ((p->sig == SIG_FEATDMF) && (dtmfbuf[1] != '0') && (strlen(dtmfbuf) != 14))
{
- if (zt_wink(p, index)) return NULL;
+ if (dahdi_wink(p, index)) return NULL;
dtmfbuf[0] = 0;
/* Wait for the first digit (up to 5 seconds). */
res = ast_waitfordigit(chan, 5000);
@@ -5593,7 +5600,7 @@ static void *ss_thread(void *data)
if (res > 0) {
/* if E911, take off hook */
if (p->sig == SIG_E911)
- zt_set_hook(p->subs[SUB_REAL].zfd, ZT_OFFHOOK);
+ dahdi_set_hook(p->subs[SUB_REAL].dfd, DAHDI_OFFHOOK);
res = my_getsigstr(chan, dtmfbuf + strlen(dtmfbuf), "#", 3000);
}
if ((res < 1) && (p->dsp)) ast_dsp_digitreset(p->dsp);
@@ -5657,7 +5664,7 @@ static void *ss_thread(void *data)
ast_hangup(chan);
return NULL;
}
- zt_set_hook(p->subs[SUB_REAL].zfd, ZT_OFFHOOK);
+ dahdi_set_hook(p->subs[SUB_REAL].dfd, DAHDI_OFFHOOK);
ast_dsp_digitmode(p->dsp,DSP_DIGITMODE_MF | p->dtmfrelax);
res = my_getsigstr(chan, anibuf, "#", 10000);
if ((res > 0) && (strlen(anibuf) > 2)) {
@@ -5740,13 +5747,13 @@ static void *ss_thread(void *data)
ast_log(LOG_WARNING, "Got a non-Feature Group B input on channel %d. Assuming E&M Wink instead\n", p->channel);
}
if ((p->sig == SIG_FEATDMF) || (p->sig == SIG_FEATDMF_TA)) {
- zt_wink(p, index);
+ dahdi_wink(p, index);
/* some switches require a minimum guard time between
the last FGD wink and something that answers
immediately. This ensures it */
if (ast_safe_sleep(chan,100)) return NULL;
}
- zt_enable_ec(p);
+ dahdi_enable_ec(p);
if (NEED_MFDETECT(p)) {
if (p->dsp) {
if (!p->hardwaredtmf)
@@ -5764,14 +5771,14 @@ static void *ss_thread(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].dfd, DAHDI_TONE_CONGESTION);
}
return NULL;
} else {
if (option_verbose > 2)
ast_verbose(VERBOSE_PREFIX_2 "Unknown extension '%s' in context '%s' requested\n", exten, chan->context);
sleep(2);
- res = tone_zone_play_tone(p->subs[index].zfd, ZT_TONE_INFO);
+ res = tone_zone_play_tone(p->subs[index].dfd, DAHDI_TONE_INFO);
if (res < 0)
ast_log(LOG_WARNING, "Unable to start special tone on %d\n", p->channel);
else
@@ -5779,7 +5786,7 @@ static void *ss_thread(void *data)
res = ast_streamfile(chan, "ss-noservice", chan->language);
if (res >= 0)
ast_waitstream(chan, "");
- res = tone_zone_play_tone(p->subs[index].zfd, ZT_TONE_CONGESTION);
+ res = tone_zone_play_tone(p->subs[index].dfd, DAHDI_TONE_CONGESTION);
ast_hangup(chan);
return NULL;
}
@@ -5803,7 +5810,7 @@ static void *ss_thread(void *data)
timeout = 0;
if (res < 0) {
ast_log(LOG_DEBUG, "waitfordigit returned < 0...\n");
- res = tone_zone_play_tone(p->subs[index].zfd, -1);
+ res = tone_zone_play_tone(p->subs[index].dfd, -1);
ast_hangup(chan);
return NULL;
} else if (res) {
@@ -5811,9 +5818,9 @@ static void *ss_thread(void *data)
exten[len] = '\0';
}
if (!ast_ignore_pattern(chan->context, exten))
- tone_zone_play_tone(p->subs[index].zfd, -1);
+ tone_zone_play_tone(p->subs[index].dfd, -1);
else
- tone_zone_play_tone(p->subs[index].zfd, ZT_TONE_DIALTONE);
+ tone_zone_play_tone(p->subs[index].dfd, DAHDI_TONE_DIALTONE);
if (ast_exists_extension(chan, chan->context, exten, 1, p->cid_num) && strcmp(exten, ast_parking_ext())) {
if (!res || !ast_matchmore_extension(chan, chan->context, exten, 1, p->cid_num)) {
if (getforward) {
@@ -5821,18 +5828,18 @@ static void *ss_thread(void *data)
ast_copy_string(p->call_forward, exten, sizeof(p->call_forward));
if (option_verbose > 2)
ast_verbose(VERBOSE_PREFIX_3 "Setting call forward to '%s' on channel %d\n", p->call_forward, p->channel);
- res = tone_zone_play_tone(p->subs[index].zfd, ZT_TONE_DIALRECALL);
+ res = tone_zone_play_tone(p->subs[index].dfd, DAHDI_TONE_DIALRECALL);
if (res)
break;
usleep(500000);
- res = tone_zone_play_tone(p->subs[index].zfd, -1);
+ res = tone_zone_play_tone(p->subs[index].dfd, -1);
sleep(1);
memset(exten, 0, sizeof(exten));
- res = tone_zone_play_tone(p->subs[index].zfd, ZT_TONE_DIALTONE);
+ res = tone_zone_play_tone(p->subs[index].dfd, DAHDI_TONE_DIALTONE);
len = 0;
getforward = 0;
} else {
- res = tone_zone_play_tone(p->subs[index].zfd, -1);
+ res = tone_zone_play_tone(p->subs[index].dfd, -1);
ast_copy_string(chan->exten, exten, sizeof(chan->exten));
if (!ast_strlen_zero(p->cid_num)) {
if (!p->hidecallerid)
@@ -5845,11 +5852,11 @@ static void *ss_thread(void *data)
ast_set_callerid(chan, NULL, p->cid_name, NULL);
}
ast_setstate(chan, AST_STATE_RING);
- zt_enable_ec(p);
+ dahdi_enable_ec(p);
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].dfd, DAHDI_TONE_CONGESTION);
}
return NULL;
}
@@ -5860,8 +5867,8 @@ static void *ss_thread(void *data)
}
} else if (res == 0) {
ast_log(LOG_DEBUG, "not enough digits (and no ambiguous match)...\n");
- res = tone_zone_play_tone(p->subs[index].zfd, ZT_TONE_CONGESTION);
- zt_wait_event(p->subs[index].zfd);
+ res = tone_zone_play_tone(p->subs[index].dfd, DAHDI_TONE_CONGESTION);
+ dahdi_wait_event(p->subs[index].dfd);
ast_hangup(chan);
return NULL;
} else if (p->callwaiting && !strcmp(exten, "*70")) {
@@ -5869,13 +5876,13 @@ static void *ss_thread(void *data)
ast_verbose(VERBOSE_PREFIX_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].dfd, DAHDI_TONE_DIALRECALL);
if (res) {
ast_log(LOG_WARNING, "Unable to do dial recall on channel %s: %s\n",
chan->name, strerror(errno));
}
len = 0;
- ioctl(p->subs[index].zfd,ZT_CONFDIAG,&len);
+ ioctl(p->subs[index].dfd,DAHDI_CONFDIAG,&len);
memset(exten, 0, sizeof(exten));
timeout = firstdigittimeout;
@@ -5893,11 +5900,11 @@ static void *ss_thread(void *data)
swap_subs(p, SUB_CALLWAIT, SUB_THREEWAY);
unalloc_sub(p, SUB_THREEWAY);
}
- zt_enable_ec(p);
+ dahdi_enable_ec(p);
if (ast_pickup_call(chan)) {
ast_log(LOG_DEBUG, "No call pickup possible...\n");
- res = tone_zone_play_tone(p->subs[index].zfd, ZT_TONE_CONGESTION);
- zt_wait_event(p->subs[index].zfd);
+ res = tone_zone_play_tone(p->subs[index].dfd, DAHDI_TONE_CONGESTION);
+ dahdi_wait_event(p->subs[index].dfd);
}
ast_hangup(chan);
return NULL;
@@ -5918,7 +5925,7 @@ static void *ss_thread(void *data)
if (chan->cid.cid_name)
free(chan->cid.cid_name);
chan->cid.cid_name = NULL;
- res = tone_zone_play_tone(p->subs[index].zfd, ZT_TONE_DIALRECALL);
+ res = tone_zone_play_tone(p->subs[index].dfd, DAHDI_TONE_DIALRECALL);
if (res) {
ast_log(LOG_WARNING, "Unable to do dial recall on channel %s: %s\n",
chan->name, strerror(errno));
@@ -5932,16 +5939,16 @@ static void *ss_thread(void *data)
res = ast_say_digit_str(chan, p->lastcid_num, "", chan->language);
}
if (!res)
- res = tone_zone_play_tone(p->subs[index].zfd, ZT_TONE_DIALRECALL);
+ res = tone_zone_play_tone(p->subs[index].dfd, DAHDI_TONE_DIALRECALL);
break;
} else if (!strcmp(exten, "*78")) {
/* Do not disturb */
if (option_verbose > 2)
ast_verbose(VERBOSE_PREFIX_3 "Enabled DND on channel %d\n", p->channel);
manager_event(EVENT_FLAG_SYSTEM, "DNDState",
- "Channel: Zap/%d\r\n"
+ "Channel: DAHDI/%d\r\n"
"Status: enabled\r\n", p->channel);
- res = tone_zone_play_tone(p->subs[index].zfd, ZT_TONE_DIALRECALL);
+ res = tone_zone_play_tone(p->subs[index].dfd, DAHDI_TONE_DIALRECALL);
p->dnd = 1;
getforward = 0;
memset(exten, 0, sizeof(exten));
@@ -5951,22 +5958,22 @@ static void *ss_thread(void *data)
if (option_verbose > 2)
ast_verbose(VERBOSE_PREFIX_3 "Disabled DND on channel %d\n", p->channel);
manager_event(EVENT_FLAG_SYSTEM, "DNDState",
- "Channel: Zap/%d\r\n"
+ "Channel: DAHDI/%d\r\n"
"Status: disabled\r\n", p->channel);
- res = tone_zone_play_tone(p->subs[index].zfd, ZT_TONE_DIALRECALL);
+ res = tone_zone_play_tone(p->subs[index].dfd, DAHDI_TONE_DIALRECALL);
p->dnd = 0;
getforward = 0;
memset(exten, 0, sizeof(exten));
len = 0;
} else if (p->cancallforward && !strcmp(exten, "*72")) {
- res = tone_zone_play_tone(p->subs[index].zfd, ZT_TONE_DIALRECALL);
+ res = tone_zone_play_tone(p->subs[index].dfd, DAHDI_TONE_DIALRECALL);
getforward = 1;
memset(exten, 0, sizeof(exten));
len = 0;
} else if (p->cancallforward && !strcmp(exten, "*73")) {
if (option_verbose > 2)
ast_verbose(VERBOSE_PREFIX_3 "Cancelling call forwarding on channel %d\n", p->channel);
- res = tone_zone_play_tone(p->subs[index].zfd, ZT_TONE_DIALRECALL);
+ res = tone_zone_play_tone(p->subs[index].dfd, DAHDI_TONE_DIALRECALL);
memset(p->call_forward, 0, sizeof(p->call_forward));
getforward = 0;
memset(exten, 0, sizeof(exten));
@@ -5985,7 +5992,7 @@ static void *ss_thread(void *data)
ast_verbose(VERBOSE_PREFIX_3 "Blacklisting number %s\n", p->lastcid_num);
res = ast_db_put("blacklist", p->lastcid_num, "1");
if (!res) {
- res = tone_zone_play_tone(p->subs[index].zfd, ZT_TONE_DIALRECALL);
+ res = tone_zone_play_tone(p->subs[index].dfd, DAHDI_TONE_DIALRECALL);
memset(exten, 0, sizeof(exten));
len = 0;
}
@@ -6001,7 +6008,7 @@ static void *ss_thread(void *data)
free(chan->cid.cid_name);
chan->cid.cid_name = NULL;
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].dfd, DAHDI_TONE_DIALRECALL);
if (res) {
ast_log(LOG_WARNING, "Unable to do dial recall on channel %s: %s\n",
chan->name, strerror(errno));
@@ -6012,19 +6019,19 @@ static void *ss_thread(void *data)
} else if (!strcmp(exten, "*0")) {
struct ast_channel *nbridge =
p->subs[SUB_THREEWAY].owner;
- struct zt_pvt *pbridge = NULL;
+ struct dahdi_pvt *pbridge = NULL;
/* set up the private struct of the bridged one, if any */
if (nbridge && ast_bridged_channel(nbridge))
pbridge = ast_bridged_channel(nbridge)->tech_pvt;
if (nbridge && pbridge &&
- (nbridge->tech == &zap_tech) &&
- (ast_bridged_channel(nbridge)->tech == &zap_tech) &&
+ (nbridge->tech == &dahdi_tech) &&
+ (ast_bridged_channel(nbridge)->tech == &dahdi_tech) &&
ISTRUNK(pbridge)) {
- int func = ZT_FLASH;
+ int func = DAHDI_FLASH;
/* Clear out the dial buffer */
p->dop.dialstr[0] = '\0';
/* flash hookswitch */
- if ((ioctl(pbridge->subs[SUB_REAL].zfd,ZT_HOOK,&func) == -1) && (errno != EINPROGRESS)) {
+ if ((ioctl(pbridge->subs[SUB_REAL].dfd,DAHDI_HOOK,&func) == -1) && (errno != EINPROGRESS)) {
ast_log(LOG_WARNING, "Unable to flash external trunk on channel %s: %s\n",
nbridge->name, strerror(errno));
}
@@ -6036,9 +6043,9 @@ static void *ss_thread(void *data)
ast_hangup(chan);
return NULL;
} else {
- tone_zone_play_tone(p->subs[index].zfd, ZT_TONE_CONGESTION);
- zt_wait_event(p->subs[index].zfd);
- tone_zone_play_tone(p->subs[index].zfd, -1);
+ tone_zone_play_tone(p->subs[index].dfd, DAHDI_TONE_CONGESTION);
+ dahdi_wait_event(p->subs[index].dfd);
+ tone_zone_play_tone(p->subs[index].dfd, -1);
swap_subs(p, SUB_REAL, SUB_THREEWAY);
unalloc_sub(p, SUB_THREEWAY);
p->owner = p->subs[SUB_REAL].owner;
@@ -6054,7 +6061,7 @@ static void *ss_thread(void *data)
if (!timeout)
timeout = gendigittimeout;
if (len && !ast_ignore_pattern(chan->context, exten))
- tone_zone_play_tone(p->subs[index].zfd, -1);
+ tone_zone_play_tone(p->subs[index].dfd, -1);
}
break;
case SIG_FXSLS:
@@ -6122,7 +6129,7 @@ static void *ss_thread(void *data)
cs = NULL;
ast_log(LOG_DEBUG, "Receiving DTMF cid on "
"channel %s\n", chan->name);
- zt_setlinear(p->subs[index].zfd, 0);
+ dahdi_setlinear(p->subs[index].dfd, 0);
res = 2000;
for (;;) {
struct ast_frame *f;
@@ -6147,7 +6154,7 @@ static void *ss_thread(void *data)
break; /* Got ring */
}
dtmfbuf[i] = '\0';
- zt_setlinear(p->subs[index].zfd, p->subs[index].linear);
+ dahdi_setlinear(p->subs[index].dfd, p->subs[index].linear);
/* Got cid and ring. */
ast_log(LOG_DEBUG, "CID got string '%s'\n", dtmfbuf);
callerid_get_dtmf(dtmfbuf, dtmfcid, &flags);
@@ -6167,25 +6174,25 @@ static void *ss_thread(void *data)
bump_gains(p);
#endif
/* Take out of linear mode for Caller*ID processing */
- zt_setlinear(p->subs[index].zfd, 0);
+ dahdi_setlinear(p->subs[index].dfd, 0);
/* First we wait and listen for the Caller*ID */
for (;;) {
- i = ZT_IOMUX_READ | ZT_IOMUX_SIGEVENT;
- if ((res = ioctl(p->subs[index].zfd, ZT_IOMUX, &i))) {
+ i = DAHDI_IOMUX_READ | DAHDI_IOMUX_SIGEVENT;
+ if ((res = ioctl(p->subs[index].dfd, DAHDI_IOMUX, &i))) {
ast_log(LOG_WARNING, "I/O MUX failed: %s\n", strerror(errno));
callerid_free(cs);
ast_hangup(chan);
return NULL;
}
- if (i & ZT_IOMUX_SIGEVENT) {
- res = zt_get_event(p->subs[index].zfd);
+ if (i & DAHDI_IOMUX_SIGEVENT) {
+ res = dahdi_get_event(p->subs[index].dfd);
ast_log(LOG_NOTICE, "Got event %d (%s)...\n", res, event2str(res));
if (p->cid_signalling == CID_SIG_V23_JP) {
-#ifdef ZT_EVENT_RINGBEGIN
- if (res == ZT_EVENT_RINGBEGIN) {
- res = zt_set_hook(p->subs[SUB_REAL].zfd, ZT_OFFHOOK);
+#ifdef DAHDI_EVENT_RINGBEGIN
+ if (res == DAHDI_EVENT_RINGBEGIN) {
+ res = dahdi_set_hook(p->subs[SUB_REAL].dfd, DAHDI_OFFHOOK);
usleep(1);
}
#endif
@@ -6193,8 +6200,8 @@ static void *ss_thread(void *data)
res = 0;
break;
}
- } else if (i & ZT_IOMUX_READ) {
- res = read(p->subs[index].zfd, buf, sizeof(buf));
+ } else if (i & DAHDI_IOMUX_READ) {
+ res = read(p->subs[index].dfd, buf, sizeof(buf));
if (res < 0) {
if (errno != ELAST) {
ast_log(LOG_WARNING, "read returned error: %s\n", strerror(errno));
@@ -6227,7 +6234,7 @@ static void *ss_thread(void *data)
}
if (p->cid_signalling == CID_SIG_V23_JP) {
- res = zt_set_hook(p->subs[SUB_REAL].zfd, ZT_ONHOOK);
+ res = dahdi_set_hook(p->subs[SUB_REAL].dfd, DAHDI_ONHOOK);
usleep(1);
res = 4000;
} else {
@@ -6270,15 +6277,15 @@ static void *ss_thread(void *data)
}
for (;;) {
- i = ZT_IOMUX_READ | ZT_IOMUX_SIGEVENT;
- if ((res = ioctl(p->subs[index].zfd, ZT_IOMUX, &i))) {
+ i = DAHDI_IOMUX_READ | DAHDI_IOMUX_SIGEVENT;
+ if ((res = ioctl(p->subs[index].dfd, DAHDI_IOMUX, &i))) {
ast_log(LOG_WARNING, "I/O MUX failed: %s\n", strerror(errno));
callerid_free(cs);
ast_hangup(chan);
return NULL;
}
- if (i & ZT_IOMUX_SIGEVENT) {
- res = zt_get_event(p->subs[index].zfd);
+ if (i & DAHDI_IOMUX_SIGEVENT) {
+ res = dahdi_get_event(p->subs[index].dfd);
ast_log(LOG_NOTICE, "Got event %d (%s)...\n", res, event2str(res));
res = 0;
/* Let us detect distinctive ring */
@@ -6288,11 +6295,11 @@ static void *ss_thread(void *data)
if (p->ringt < p->ringt_base/2)
break;
/* Increment the ringT counter so we can match it against
- values in zapata.conf for distinctive ring */
+ values in chan_dahdi.conf for distinctive ring */
if (++receivedRingT == (sizeof(curRingData) / sizeof(curRingData[0])))
break;
- } else if (i & ZT_IOMUX_READ) {
- res = read(p->subs[index].zfd, buf, sizeof(buf));
+ } else if (i & DAHDI_IOMUX_READ) {
+ res = read(p->subs[index].dfd, buf, sizeof(buf));
if (res < 0) {
if (errno != ELAST) {
ast_log(LOG_WARNING, "read returned error: %s\n", strerror(errno));
@@ -6315,7 +6322,7 @@ static void *ss_thread(void *data)
ast_verbose( VERBOSE_PREFIX_3 "Detected ring pattern: %d,%d,%d\n",curRingData[0],curRingData[1],curRingData[2]);
for (counter = 0; counter < 3; counter++) {
- /* Check to see if the rings we received match any of the ones in zapata.conf for this
+ /* Check to see if the rings we received match any of the ones in chan_dahdi.conf for this
channel */
distMatches = 0;
for (counter1 = 0; counter1 < 3; counter1++) {
@@ -6335,7 +6342,7 @@ static void *ss_thread(void *data)
}
}
/* Restore linear mode (if appropriate) for Caller*ID processing */
- zt_setlinear(p->subs[index].zfd, p->subs[index].linear);
+ dahdi_setlinear(p->subs[index].dfd, p->subs[index].linear);
#if 1
restore_gains(p);
#endif
@@ -6373,20 +6380,20 @@ static void *ss_thread(void *data)
}
/* Take out of linear mode for Caller*ID processing */
- zt_setlinear(p->subs[index].zfd, 0);
+ dahdi_setlinear(p->subs[index].dfd, 0);
for (;;) {
- i = ZT_IOMUX_READ | ZT_IOMUX_SIGEVENT;
- if ((res = ioctl(p->subs[index].zfd, ZT_IOMUX, &i))) {
+ i = DAHDI_IOMUX_READ | DAHDI_IOMUX_SIGEVENT;
+ if ((res = ioctl(p->subs[index].dfd, DAHDI_IOMUX, &i))) {
ast_log(LOG_WARNING, "I/O MUX failed: %s\n", strerror(errno));
callerid_free(cs);
ast_hangup(chan);
return NULL;
}
- if (i & ZT_IOMUX_SIGEVENT) {
- res = zt_get_event(p->subs[index].zfd);
+ if (i & DAHDI_IOMUX_SIGEVENT) {
+ res = dahdi_get_event(p->subs[index].dfd);
ast_log(LOG_NOTICE, "Got event %d (%s)...\n", res, event2str(res));
/* If we get a PR event, they hung up while processing calerid */
- if ( res == ZT_EVENT_POLARITY && p->hanguponpolarityswitch && p->polarity == POLARITY_REV) {
+ if ( res == DAHDI_EVENT_POLARITY && p->hanguponpolarityswitch && p->polarity == POLARITY_REV) {
ast_log(LOG_DEBUG, "Hanging up due to polarity reversal on channel %d while detecting callerid\n", p->channel);
p->polarity = POLARITY_IDLE;
callerid_free(cs);
@@ -6401,11 +6408,11 @@ static void *ss_thread(void *data)
if (p->ringt < p->ringt_base/2)
break;
/* Increment the ringT counter so we can match it against
- values in zapata.conf for distinctive ring */
+ values in chan_dahdi.conf for distinctive ring */
if (++receivedRingT == (sizeof(curRingData) / sizeof(curRingData[0])))
break;
- } else if (i & ZT_IOMUX_READ) {
- res = read(p->subs[index].zfd, buf, sizeof(buf));
+ } else if (i & DAHDI_IOMUX_READ) {
+ res = read(p->subs[index].dfd, buf, sizeof(buf));
if (res < 0) {
if (errno != ELAST) {
ast_log(LOG_WARNING, "read returned error: %s\n", strerror(errno));
@@ -6446,15 +6453,15 @@ static void *ss_thread(void *data)
if (option_verbose > 2)
ast_verbose( VERBOSE_PREFIX_3 "Detecting post-CID distinctive ring\n");
for (;;) {
- i = ZT_IOMUX_READ | ZT_IOMUX_SIGEVENT;
- if ((res = ioctl(p->subs[index].zfd, ZT_IOMUX, &i))) {
+ i = DAHDI_IOMUX_READ | DAHDI_IOMUX_SIGEVENT;
+ if ((res = ioctl(p->subs[index].dfd, DAHDI_IOMUX, &i))) {
ast_log(LOG_WARNING, "I/O MUX failed: %s\n", strerror(errno));
callerid_free(cs);
ast_hangup(chan);
return NULL;
}
- if (i & ZT_IOMUX_SIGEVENT) {
- res = zt_get_event(p->subs[index].zfd);
+ if (i & DAHDI_IOMUX_SIGEVENT) {
+ res = dahdi_get_event(p->subs[index].dfd);
ast_log(LOG_NOTICE, "Got event %d (%s)...\n", res, event2str(res));
res = 0;
/* Let us detect callerid when the telco uses distinctive ring */
@@ -6464,11 +6471,11 @@ static void *ss_thread(void *data)
if (p->ringt < p->ringt_base/2)
break;
/* Increment the ringT counter so we can match it against
- values in zapata.conf for distinctive ring */
+ values in chan_dahdi.conf for distinctive ring */
if (++receivedRingT == (sizeof(curRingData) / sizeof(curRingData[0])))
break;
- } else if (i & ZT_IOMUX_READ) {
- res = read(p->subs[index].zfd, buf, sizeof(buf));
+ } else if (i & DAHDI_IOMUX_READ) {
+ res = read(p->subs[index].dfd, buf, sizeof(buf));
if (res < 0) {
if (errno != ELAST) {
ast_log(LOG_WARNING, "read returned error: %s\n", strerror(errno));
@@ -6493,7 +6500,7 @@ static void *ss_thread(void *data)
ast_verbose( VERBOSE_PREFIX_3 "Detected ring pattern: %d,%d,%d\n",curRingData[0],curRingData[1],curRingData[2]);
for (counter = 0; counter < 3; counter++) {
- /* Check to see if the rings we received match any of the ones in zapata.conf for this
+ /* Check to see if the rings we received match any of the ones in chan_dahdi.conf for this
channel */
if (option_verbose > 2)
/* this only shows up if you have n of the dring patterns filled in */
@@ -6519,7 +6526,7 @@ static void *ss_thread(void *data)
}
}
/* Restore linear mode (if appropriate) for Caller*ID processing */
- zt_setlinear(p->subs[index].zfd, p->subs[index].linear);
+ dahdi_setlinear(p->subs[index].dfd, p->subs[index].linear);
#if 1
restore_gains(p);
#endif
@@ -6553,22 +6560,22 @@ static void *ss_thread(void *data)
return NULL;
default:
ast_log(LOG_WARNING, "Don't know how to handle simple switch with signalling %s on channel %d\n", sig2str(p->sig), p->channel);
- res = tone_zone_play_tone(p->subs[index].zfd, ZT_TONE_CONGESTION);
+ res = tone_zone_play_tone(p->subs[index].dfd, DAHDI_TONE_CONGESTION);
if (res < 0)
ast_log(LOG_WARNING, "Unable to play congestion tone on channel %d\n", p->channel);
}
- res = tone_zone_play_tone(p->subs[index].zfd, ZT_TONE_CONGESTION);
+ res = tone_zone_play_tone(p->subs[index].dfd, DAHDI_TONE_CONGESTION);
if (res < 0)
ast_log(LOG_WARNING, "Unable to play congestion tone on channel %d\n", p->channel);
ast_hangup(chan);
return NULL;
}
-/* destroy a zaptel channel, identified by its number */
-static int zap_destroy_channel_bynum(int channel)
+/* destroy a DAHDI channel, identified by its number */
+static int dahdi_destroy_channel_bynum(int channel)
{
- struct zt_pvt *tmp = NULL;
- struct zt_pvt *prev = NULL;
+ struct dahdi_pvt *tmp = NULL;
+ struct dahdi_pvt *prev = NULL;
tmp = iflist;
while (tmp) {
@@ -6582,7 +6589,7 @@ static int zap_destroy_channel_bynum(int channel)
return RESULT_FAILURE;
}
-static int handle_init_event(struct zt_pvt *i, int event)
+static int handle_init_event(struct dahdi_pvt *i, int event)
{
int res;
pthread_t threadid;
@@ -6592,11 +6599,11 @@ static int handle_init_event(struct zt_pvt *i, int event)
pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
/* Handle an event on a given channel for the monitor thread. */
switch (event) {
- case ZT_EVENT_NONE:
- case ZT_EVENT_BITSCHANGED:
+ case DAHDI_EVENT_NONE:
+ case DAHDI_EVENT_BITSCHANGED:
break;
- case ZT_EVENT_WINKFLASH:
- case ZT_EVENT_RINGOFFHOOK:
+ case DAHDI_EVENT_WINKFLASH:
+ case DAHDI_EVENT_RINGOFFHOOK:
if (i->inalarm) break;
if (i->radio) break;
/* Got a ring/answer. What kind of channel are we? */
@@ -6604,7 +6611,7 @@ static int handle_init_event(struct zt_pvt *i, int event)
case SIG_FXOLS:
case SIG_FXOGS:
case SIG_FXOKS:
- res = zt_set_hook(i->subs[SUB_REAL].zfd, ZT_OFFHOOK);
+ res = dahdi_set_hook(i->subs[SUB_REAL].dfd, DAHDI_OFFHOOK);
if (res && (errno == EBUSY))
break;
if (i->cidspill) {
@@ -6613,29 +6620,29 @@ static int handle_init_event(struct zt_pvt *i, int event)
i->cidspill = NULL;
}
if (i->immediate) {
- zt_enable_ec(i);
+ dahdi_enable_ec(i);
/* The channel is immediately up. Start right away */
- res = tone_zone_play_tone(i->subs[SUB_REAL].zfd, ZT_TONE_RINGTONE);
- chan = zt_new(i, AST_STATE_RING, 1, SUB_REAL, 0, 0);
+ res = tone_zone_play_tone(i->subs[SUB_REAL].dfd, DAHDI_TONE_RINGTONE);
+ chan = dahdi_new(i, AST_STATE_RING, 1, SUB_REAL, 0, 0);
if (!chan) {
ast_log(LOG_WARNING, "Unable to start PBX on channel %d\n", i->channel);
- res = tone_zone_play_tone(i->subs[SUB_REAL].zfd, ZT_TONE_CONGESTION);
+ res = tone_zone_play_tone(i->subs[SUB_REAL].dfd, DAHDI_TONE_CONGESTION);
if (res < 0)
ast_log(LOG_WARNING, "Unable to play congestion tone on channel %d\n", i->channel);
}
} else {
/* Check for callerid, digits, etc */
- chan = zt_new(i, AST_STATE_RESERVED, 0, SUB_REAL, 0, 0);
+ chan = dahdi_new(i, AST_STATE_RESERVED, 0, SUB_REAL, 0, 0);
if (chan) {
if (has_voicemail(i))
- res = tone_zone_play_tone(i->subs[SUB_REAL].zfd, ZT_TONE_STUTTER);
+ res = tone_zone_play_tone(i->subs[SUB_REAL].dfd, DAHDI_TONE_STUTTER);
else
- res = tone_zone_play_tone(i->subs[SUB_REAL].zfd, ZT_TONE_DIALTONE);
+ res = tone_zone_play_tone(i->subs[SUB_REAL].dfd, DAHDI_TONE_DIALTONE);
if (res < 0)
ast_log(LOG_WARNING, "Unable to play dialtone on channel %d, do you have defaultzone and loadzone defined?\n", i->channel);
if (ast_pthread_create(&threadid, &attr, ss_thread, chan)) {
ast_log(LOG_WARNING, "Unable to start simple switch thread on channel %d\n", i->channel);
- res = tone_zone_play_tone(i->subs[SUB_REAL].zfd, ZT_TONE_CONGESTION);
+ res = tone_zone_play_tone(i->subs[SUB_REAL].dfd, DAHDI_TONE_CONGESTION);
if (res < 0)
ast_log(LOG_WARNING, "Unable to play congestion tone on channel %d\n", i->channel);
ast_hangup(chan);
@@ -6665,10 +6672,10 @@ static int handle_init_event(struct zt_pvt *i, int event)
case SIG_SF_FEATB:
case SIG_SF:
/* Check for callerid, digits, etc */
- chan = zt_new(i, AST_STATE_RING, 0, SUB_REAL, 0, 0);
+ chan = dahdi_new(i, AST_STATE_RING, 0, SUB_REAL, 0, 0);
if (chan && ast_pthread_create(&threadid, &attr, ss_thread, chan)) {
ast_log(LOG_WARNING, "Unable to start simple switch thread on channel %d\n", i->channel);
- res = tone_zone_play_tone(i->subs[SUB_REAL].zfd, ZT_TONE_CONGESTION);
+ res = tone_zone_play_tone(i->subs[SUB_REAL].dfd, DAHDI_TONE_CONGESTION);
if (res < 0)
ast_log(LOG_WARNING, "Unable to play congestion tone on channel %d\n", i->channel);
ast_hangup(chan);
@@ -6678,13 +6685,13 @@ static int handle_init_event(struct zt_pvt *i, int event)
break;
default:
ast_log(LOG_WARNING, "Don't know how to handle ring/answer with signalling %s on channel %d\n", sig2str(i->sig), i->channel);
- res = tone_zone_play_tone(i->subs[SUB_REAL].zfd, ZT_TONE_CONGESTION);
+ res = tone_zone_play_tone(i->subs[SUB_REAL].dfd, DAHDI_TONE_CONGESTION);
if (res < 0)
ast_log(LOG_WARNING, "Unable to play congestion tone on channel %d\n", i->channel);
return -1;
}
break;
- case ZT_EVENT_NOALARM:
+ case DAHDI_EVENT_NOALARM:
i->inalarm = 0;
if (!i->unknown_alarm) {
ast_log(LOG_NOTICE, "Alarm cleared on channel %d\n", i->channel);
@@ -6694,13 +6701,13 @@ static int handle_init_event(struct zt_pvt *i, int event)
i->unknown_alarm = 0;
}
break;
- case ZT_EVENT_ALARM:
+ case DAHDI_EVENT_ALARM:
i->inalarm = 1;
res = get_alarms(i);
do {
const char *alarm_str = alarm2str(res);
- /* hack alert! Zaptel 1.4 now exposes FXO battery as an alarm, but asterisk 1.4
+ /* hack alert! DAHDI 1.4 now exposes FXO battery as an alarm, but asterisk 1.4
* doesn't know what to do with it. Don't confuse users with log messages. */
if (!strcasecmp(alarm_str, "No Alarm") || !strcasecmp(alarm_str, "Unknown Alarm")) {
i->unknown_alarm = 1;
@@ -6716,7 +6723,7 @@ static int handle_init_event(struct zt_pvt *i, int event)
alarm_str, i->channel);
} while (0);
/* fall thru intentionally */
- case ZT_EVENT_ONHOOK:
+ case DAHDI_EVENT_ONHOOK:
if (i->radio)
break;
/* Back on hook. Hang up. */
@@ -6742,32 +6749,32 @@ static int handle_init_event(struct zt_pvt *i, int event)
case SIG_FXSGS:
case SIG_FXSKS:
case SIG_GR303FXSKS:
- zt_disable_ec(i);
- res = tone_zone_play_tone(i->subs[SUB_REAL].zfd, -1);
- zt_set_hook(i->subs[SUB_REAL].zfd, ZT_ONHOOK);
+ dahdi_disable_ec(i);
+ res = tone_zone_play_tone(i->subs[SUB_REAL].dfd, -1);
+ dahdi_set_hook(i->subs[SUB_REAL].dfd, DAHDI_ONHOOK);
break;
case SIG_GR303FXOKS:
case SIG_FXOKS:
- zt_disable_ec(i);
+ dahdi_disable_ec(i);
/* Diddle the battery for the zhone */
#ifdef ZHONE_HACK
- zt_set_hook(i->subs[SUB_REAL].zfd, ZT_OFFHOOK);
+ dahdi_set_hook(i->subs[SUB_REAL].dfd, DAHDI_OFFHOOK);
usleep(1);
#endif
- res = tone_zone_play_tone(i->subs[SUB_REAL].zfd, -1);
- zt_set_hook(i->subs[SUB_REAL].zfd, ZT_ONHOOK);
+ res = tone_zone_play_tone(i->subs[SUB_REAL].dfd, -1);
+ dahdi_set_hook(i->subs[SUB_REAL].dfd, DAHDI_ONHOOK);
break;
case SIG_PRI:
- zt_disable_ec(i);
- res = tone_zone_play_tone(i->subs[SUB_REAL].zfd, -1);
+ dahdi_disable_ec(i);
+ res = tone_zone_play_tone(i->subs[SUB_REAL].dfd, -1);
break;
default:
ast_log(LOG_WARNING, "Don't know how to handle on hook with signalling %s on channel %d\n", sig2str(i->sig), i->channel);
- res = tone_zone_play_tone(i->subs[SUB_REAL].zfd, -1);
+ res = tone_zone_play_tone(i->subs[SUB_REAL].dfd, -1);
return -1;
}
break;
- case ZT_EVENT_POLARITY:
+ case DAHDI_EVENT_POLARITY:
switch (i->sig) {
case SIG_FXSLS:
case SIG_FXSKS:
@@ -6784,7 +6791,7 @@ static int handle_init_event(struct zt_pvt *i, int event)
ast_verbose(VERBOSE_PREFIX_2 "Starting post polarity "
"CID detection on channel %d\n",
i->channel);
- chan = zt_new(i, AST_STATE_PRERING, 0, SUB_REAL, 0, 0);
+ chan = dahdi_new(i, AST_STATE_PRERING, 0, SUB_REAL, 0, 0);
if (chan && ast_pthread_create(&threadid, &attr, ss_thread, chan)) {
ast_log(LOG_WARNING, "Unable to start simple switch thread on channel %d\n", i->channel);
}
@@ -6796,11 +6803,11 @@ static int handle_init_event(struct zt_pvt *i, int event)
"interface %d\n", i->channel);
}
break;
- case ZT_EVENT_REMOVED: /* destroy channel */
+ case DAHDI_EVENT_REMOVED: /* destroy channel */
ast_log(LOG_NOTICE,
- "Got ZT_EVENT_REMOVED. Destroying channel %d\n",
+ "Got DAHDI_EVENT_REMOVED. Destroying channel %d\n",
i->channel);
- zap_destroy_channel_bynum(i->channel);
+ dahdi_destroy_channel_bynum(i->channel);
break;
}
pthread_attr_destroy(&attr);
@@ -6810,8 +6817,8 @@ static int handle_init_event(struct zt_pvt *i, int event)
static void *do_monitor(void *data)
{
int count, res, res2, spoint, pollres=0;
- struct zt_pvt *i;
- struct zt_pvt *last = NULL;
+ struct dahdi_pvt *i;
+ struct dahdi_pvt *last = NULL;
time_t thispass = 0, lastpass = 0;
int found;
char buf[1024];
@@ -6844,14 +6851,14 @@ static void *do_monitor(void *data)
lastalloc = ifcount;
}
/* Build the stuff we're going to poll on, that is the socket of every
- zt_pvt that does not have an associated owner channel */
+ dahdi_pvt that does not have an associated owner channel */
count = 0;
i = iflist;
while (i) {
- if ((i->subs[SUB_REAL].zfd > -1) && i->sig && (!i->radio)) {
+ if ((i->subs[SUB_REAL].dfd > -1) && i->sig && (!i->radio)) {
if (!i->owner && !i->subs[SUB_REAL].owner) {
/* This needs to be watched, as it lacks an owner */
- pfds[count].fd = i->subs[SUB_REAL].zfd;
+ pfds[count].fd = i->subs[SUB_REAL].dfd;
pfds[count].events = POLLPRI;
pfds[count].revents = 0;
/* Message waiting or r2 channels also get watched for reading */
@@ -6889,19 +6896,19 @@ static void *do_monitor(void *data)
last = i;
if (last) {
if (!last->cidspill && !last->owner && !ast_strlen_zero(last->mailbox) && (thispass - last->onhooktime > 3) &&
- (last->sig & __ZT_SIG_FXO)) {
+ (last->sig & __DAHDI_SIG_FXO)) {
res = ast_app_has_voicemail(last->mailbox, NULL);
if (last->msgstate != res) {
int x;
ast_log(LOG_DEBUG, "Message status for %s changed from %d to %d on %d\n", last->mailbox, last->msgstate, res, last->channel);
- x = ZT_FLUSH_BOTH;
- res2 = ioctl(last->subs[SUB_REAL].zfd, ZT_FLUSH, &x);
+ x = DAHDI_FLUSH_BOTH;
+ res2 = ioctl(last->subs[SUB_REAL].dfd, DAHDI_FLUSH, &x);
if (res2)
ast_log(LOG_WARNING, "Unable to flush input on channel %d\n", last->channel);
if ((last->cidspill = ast_calloc(1, MAX_CALLERID_SIZE))) {
/* Turn on on hook transfer for 4 seconds */
x = 4000;
- ioctl(last->subs[SUB_REAL].zfd, ZT_ONHOOKTRANSFER, &x);
+ ioctl(last->subs[SUB_REAL].dfd, DAHDI_ONHOOKTRANSFER, &x);
last->cidlen = vmwi_generate(last->cidspill, res, 1, AST_LAW(last));
last->cidpos = 0;
last->msgstate = res;
@@ -6914,10 +6921,10 @@ static void *do_monitor(void *data)
}
}
}
- if ((i->subs[SUB_REAL].zfd > -1) && i->sig) {
+ if ((i->subs[SUB_REAL].dfd > -1) && i->sig) {
if (i->radio && !i->owner)
{
- res = zt_get_event(i->subs[SUB_REAL].zfd);
+ res = dahdi_get_event(i->subs[SUB_REAL].dfd);
if (res)
{
if (option_debug)
@@ -6930,27 +6937,27 @@ static void *do_monitor(void *data)
i = i->next;
continue;
}
- pollres = ast_fdisset(pfds, i->subs[SUB_REAL].zfd, count, &spoint);
+ pollres = ast_fdisset(pfds, i->subs[SUB_REAL].dfd, count, &spoint);
if (pollres & POLLIN) {
if (i->owner || i->subs[SUB_REAL].owner) {
#ifdef HAVE_PRI
if (!i->pri)
#endif
- ast_log(LOG_WARNING, "Whoa.... I'm owned but found (%d) in read...\n", i->subs[SUB_REAL].zfd);
+ ast_log(LOG_WARNING, "Whoa.... I'm owned but found (%d) in read...\n", i->subs[SUB_REAL].dfd);
i = i->next;
continue;
}
if (!i->cidspill) {
- ast_log(LOG_WARNING, "Whoa.... I'm reading but have no cidspill (%d)...\n", i->subs[SUB_REAL].zfd);
+ ast_log(LOG_WARNING, "Whoa.... I'm reading but have no cidspill (%d)...\n", i->subs[SUB_REAL].dfd);
i = i->next;
continue;
}
- res = read(i->subs[SUB_REAL].zfd, buf, sizeof(buf));
+ res = read(i->subs[SUB_REAL].dfd, buf, sizeof(buf));
if (res > 0) {
/* We read some number of bytes. Write an equal amount of data */
if (res > i->cidlen - i->cidpos)
res = i->cidlen - i->cidpos;
- res2 = write(i->subs[SUB_REAL].zfd, i->cidspill + i->cidpos, res);
+ res2 = write(i->subs[SUB_REAL].dfd, i->cidspill + i->cidpos, res);
if (res2 > 0) {
i->cidpos += res2;
if (i->cidpos >= i->cidlen) {
@@ -6972,11 +6979,11 @@ static void *do_monitor(void *data)
#ifdef HAVE_PRI
if (!i->pri)
#endif
- ast_log(LOG_WARNING, "Whoa.... I'm owned but found (%d)...\n", i->subs[SUB_REAL].zfd);
+ ast_log(LOG_WARNING, "Whoa.... I'm owned but found (%d)...\n", i->subs[SUB_REAL].dfd);
i = i->next;
continue;
}
- res = zt_get_event(i->subs[SUB_REAL].zfd);
+ res = dahdi_get_event(i->subs[SUB_REAL].dfd);
if (option_debug)
ast_log(LOG_DEBUG, "Monitor doohicky got event %s on channel %d\n", event2str(res), i->channel);
/* Don't hold iflock while handling init events */
@@ -7026,7 +7033,7 @@ static int restart_monitor(void)
}
#ifdef HAVE_PRI
-static int pri_resolve_span(int *span, int channel, int offset, struct zt_spaninfo *si)
+static int pri_resolve_span(int *span, int channel, int offset, DAHDI_SPANINFO *si)
{
int x;
int trunkgroup;
@@ -7065,8 +7072,8 @@ static int pri_resolve_span(int *span, int channel, int offset, struct zt_spanin
static int pri_create_trunkgroup(int trunkgroup, int *channels)
{
- struct zt_spaninfo si;
- ZT_PARAMS p;
+ DAHDI_SPANINFO si;
+ DAHDI_PARAMS p;
int fd;
int span;
int ospan=0;
@@ -7082,35 +7089,39 @@ static int pri_create_trunkgroup(int trunkgroup, int *channels)
break;
memset(&si, 0, sizeof(si));
memset(&p, 0, sizeof(p));
+#ifdef HAVE_ZAPTEL
fd = open("/dev/zap/channel", O_RDWR);
+#else
+ fd = open("/dev/dahdi/channel", O_RDWR);
+#endif
if (fd < 0) {
ast_log(LOG_WARNING, "Failed to open channel: %s\n", strerror(errno));
return -1;
}
x = channels[y];
- if (ioctl(fd, ZT_SPECIFY, &x)) {
+ if (ioctl(fd, DAHDI_SPECIFY, &x)) {
ast_log(LOG_WARNING, "Failed to specify channel %d: %s\n", channels[y], strerror(errno));
- zt_close(fd);
+ dahdi_close(fd);
return -1;
}
- if (ioctl(fd, ZT_GET_PARAMS, &p)) {
+ if (ioctl(fd, DAHDI_GET_PARAMS, &p)) {
ast_log(LOG_WARNING, "Failed to get channel parameters for channel %d: %s\n", channels[y], strerror(errno));
return -1;
}
- if (ioctl(fd, ZT_SPANSTAT, &si)) {
+ if (ioctl(fd, DAHDI_SPANSTAT, &si)) {
ast_log(LOG_WARNING, "Failed go get span information on channel %d (span %d)\n", channels[y], p.spanno);
- zt_close(fd);
+ dahdi_close(fd);
return -1;
}
span = p.spanno - 1;
if (pris[span].trunkgroup) {
ast_log(LOG_WARNING, "Span %d is already provisioned for trunk group %d\n", span + 1, pris[span].trunkgroup);
- zt_close(fd);
+ dahdi_close(fd);
return -1;
}
if (pris[span].pvts[0]) {
ast_log(LOG_WARNING, "Span %d is already provisioned with channels (implicit PRI maybe?)\n", span + 1);
- zt_close(fd);
+ dahdi_close(fd);
return -1;
}
if (!y) {
@@ -7121,7 +7132,7 @@ static int pri_create_trunkgroup(int trunkgroup, int *channels)
pris[ospan].dchannels[y] = channels[y];
pris[ospan].dchanavail[y] |= DCHAN_PROVISIONED;
pris[span].span = span + 1;
- zt_close(fd);
+ dahdi_close(fd);
}
return 0;
}
@@ -7139,22 +7150,22 @@ static int pri_create_spanmap(int span, int trunkgroup, int logicalspan)
#endif
-static struct zt_pvt *mkintf(int channel, const struct zt_chan_conf *conf, struct zt_pri *pri, int reloading)
+static struct dahdi_pvt *mkintf(int channel, const struct dahdi_chan_conf *conf, struct dahdi_pri *pri, int reloading)
{
- /* Make a zt_pvt structure for this interface (or CRV if "pri" is specified) */
- struct zt_pvt *tmp = NULL, *tmp2, *prev = NULL;
+ /* Make a dahdi_pvt structure for this interface (or CRV if "pri" is specified) */
+ struct dahdi_pvt *tmp = NULL, *tmp2, *prev = NULL;
char fn[80];
#if 1
- struct zt_bufferinfo bi;
+ DAHDI_BUFFERINFO bi;
#endif
- struct zt_spaninfo si;
+ DAHDI_SPANINFO si;
int res;
int span=0;
int here = 0;
int x;
- struct zt_pvt **wlist;
- struct zt_pvt **wend;
- ZT_PARAMS p;
+ struct dahdi_pvt **wlist;
+ struct dahdi_pvt **wend;
+ DAHDI_PARAMS p;
wlist = &iflist;
wend = &ifend;
@@ -7186,13 +7197,13 @@ static struct zt_pvt *mkintf(int channel, const struct zt_chan_conf *conf, struc
if (!here && !reloading) {
if (!(tmp = ast_calloc(1, sizeof(*tmp)))) {
- destroy_zt_pvt(&tmp);
+ destroy_dahdi_pvt(&tmp);
return NULL;
}
ast_mutex_init(&tmp->lock);
ifcount++;
for (x = 0; x < 3; x++)
- tmp->subs[x].zfd = -1;
+ tmp->subs[x].dfd = -1;
tmp->channel = channel;
}
@@ -7203,23 +7214,23 @@ static struct zt_pvt *mkintf(int channel, const struct zt_chan_conf *conf, struc
snprintf(fn, sizeof(fn), "%d", channel);
/* Open non-blocking */
if (!here)
- tmp->subs[SUB_REAL].zfd = zt_open(fn);
- /* Allocate a zapata structure */
- if (tmp->subs[SUB_REAL].zfd < 0) {
+ tmp->subs[SUB_REAL].dfd = dahdi_open(fn);
+ /* Allocate a DAHDI structure */
+ if (tmp->subs[SUB_REAL].dfd < 0) {
ast_log(LOG_ERROR, "Unable to open channel %d: %s\nhere = %d, tmp->channel = %d, channel = %d\n", channel, strerror(errno), here, tmp->channel, channel);
- destroy_zt_pvt(&tmp);
+ destroy_dahdi_pvt(&tmp);
return NULL;
}
memset(&p, 0, sizeof(p));
- res = ioctl(tmp->subs[SUB_REAL].zfd, ZT_GET_PARAMS, &p);
+ res = ioctl(tmp->subs[SUB_REAL].dfd, DAHDI_GET_PARAMS, &p);
if (res < 0) {
ast_log(LOG_ERROR, "Unable to get parameters\n");
- destroy_zt_pvt(&tmp);
+ destroy_dahdi_pvt(&tmp);
return NULL;
}
if (p.sigtype != (conf->chan.sig & 0x3ffff)) {
ast_log(LOG_ERROR, "Signalling requested on channel %d is %s but line is in %s signalling\n", channel, sig2str(conf->chan.sig), sig2str(p.sigtype));
- destroy_zt_pvt(&tmp);
+ destroy_dahdi_pvt(&tmp);
return NULL;
}
tmp->law = p.curlaw;
@@ -7240,20 +7251,20 @@ static struct zt_pvt *mkintf(int channel, const struct zt_chan_conf *conf, struc
int matchesdchan;
int x,y;
offset = 0;
- if ((chan_sig == SIG_PRI) && ioctl(tmp->subs[SUB_REAL].zfd, ZT_AUDIOMODE, &offset)) {
+ if ((chan_sig == SIG_PRI) && ioctl(tmp->subs[SUB_REAL].dfd, DAHDI_AUDIOMODE, &offset)) {
ast_log(LOG_ERROR, "Unable to set clear mode on clear channel %d of span %d: %s\n", channel, p.spanno, strerror(errno));
- destroy_zt_pvt(&tmp);
+ destroy_dahdi_pvt(&tmp);
return NULL;
}
if (span >= NUM_SPANS) {
ast_log(LOG_ERROR, "Channel %d does not lie on a span I know of (%d)\n", channel, span);
- destroy_zt_pvt(&tmp);
+ destroy_dahdi_pvt(&tmp);
return NULL;
} else {
si.spanno = 0;
- if (ioctl(tmp->subs[SUB_REAL].zfd,ZT_SPANSTAT,&si) == -1) {
+ if (ioctl(tmp->subs[SUB_REAL].dfd,DAHDI_SPANSTAT,&si) == -1) {
ast_log(LOG_ERROR, "Unable to get span status: %s\n", strerror(errno));
- destroy_zt_pvt(&tmp);
+ destroy_dahdi_pvt(&tmp);
return NULL;
}
/* Store the logical span first based upon the real span */
@@ -7261,7 +7272,7 @@ static struct zt_pvt *mkintf(int channel, const struct zt_chan_conf *conf, struc
pri_resolve_span(&span, channel, (channel - p.chanpos), &si);
if (span < 0) {
ast_log(LOG_WARNING, "Channel %d: Unable to find locate channel/trunk group!\n", channel);
- destroy_zt_pvt(&tmp);
+ destroy_dahdi_pvt(&tmp);
return NULL;
}
if (chan_sig == SIG_PRI)
@@ -7282,43 +7293,43 @@ static struct zt_pvt *mkintf(int channel, const struct zt_chan_conf *conf, struc
if (!matchesdchan) {
if (pris[span].nodetype && (pris[span].nodetype != conf->pri.nodetype)) {
ast_log(LOG_ERROR, "Span %d is already a %s node\n", span + 1, pri_node2str(pris[span].nodetype));
- destroy_zt_pvt(&tmp);
+ destroy_dahdi_pvt(&tmp);
return NULL;
}
if (pris[span].switchtype && (pris[span].switchtype != myswitchtype)) {
ast_log(LOG_ERROR, "Span %d is already a %s switch\n", span + 1, pri_switch2str(pris[span].switchtype));
- destroy_zt_pvt(&tmp);
+ destroy_dahdi_pvt(&tmp);
return NULL;
}
if ((pris[span].dialplan) && (pris[span].dialplan != conf->pri.dialplan)) {
ast_log(LOG_ERROR, "Span %d is already a %s dialing plan\n", span + 1, dialplan2str(pris[span].dialplan));
- destroy_zt_pvt(&tmp);
+ destroy_dahdi_pvt(&tmp);
return NULL;
}
if (!ast_strlen_zero(pris[span].idledial) && strcmp(pris[span].idledial, conf->pri.idledial)) {
ast_log(LOG_ERROR, "Span %d already has idledial '%s'.\n", span + 1, conf->pri.idledial);
- destroy_zt_pvt(&tmp);
+ destroy_dahdi_pvt(&tmp);
return NULL;
}
if (!ast_strlen_zero(pris[span].idleext) && strcmp(pris[span].idleext, conf->pri.idleext)) {
ast_log(LOG_ERROR, "Span %d already has idleext '%s'.\n", span + 1, conf->pri.idleext);
- destroy_zt_pvt(&tmp);
+ destroy_dahdi_pvt(&tmp);
return NULL;
}
if (pris[span].minunused && (pris[span].minunused != conf->pri.minunused)) {
ast_log(LOG_ERROR, "Span %d already has minunused of %d.\n", span + 1, conf->pri.minunused);
- destroy_zt_pvt(&tmp);
+ destroy_dahdi_pvt(&tmp);
return NULL;
}
if (pris[span].minidle && (pris[span].minidle != conf->pri.minidle)) {
ast_log(LOG_ERROR, "Span %d already has minidle of %d.\n", span + 1, conf->pri.minidle);
- destroy_zt_pvt(&tmp);
+ destroy_dahdi_pvt(&tmp);
return NULL;
}
if (pris[span].numchans >= MAX_CHANNELS) {
ast_log(LOG_ERROR, "Unable to add channel %d: Too many channels in trunk group %d!\n", channel,
pris[span].trunkgroup);
- destroy_zt_pvt(&tmp);
+ destroy_dahdi_pvt(&tmp);
return NULL;
}
pris[span].nodetype = conf->pri.nodetype;
@@ -7345,7 +7356,7 @@ static struct zt_pvt *mkintf(int channel, const struct zt_chan_conf *conf, struc
tmp->call = NULL;
} else {
ast_log(LOG_ERROR, "Channel %d is reserved for D-channel.\n", offset);
- destroy_zt_pvt(&tmp);
+ destroy_dahdi_pvt(&tmp);
return NULL;
}
}
@@ -7356,8 +7367,8 @@ static struct zt_pvt *mkintf(int channel, const struct zt_chan_conf *conf, struc
} else {
chan_sig = tmp->sig;
memset(&p, 0, sizeof(p));
- if (tmp->subs[SUB_REAL].zfd > -1)
- res = ioctl(tmp->subs[SUB_REAL].zfd, ZT_GET_PARAMS, &p);
+ if (tmp->subs[SUB_REAL].dfd > -1)
+ res = ioctl(tmp->subs[SUB_REAL].dfd, DAHDI_GET_PARAMS, &p);
}
/* Adjust starttime on loopstart and kewlstart trunks to reasonable values */
switch (chan_sig) {
@@ -7412,24 +7423,24 @@ static struct zt_pvt *mkintf(int channel, const struct zt_chan_conf *conf, struc
}
/* dont set parms on a pseudo-channel (or CRV) */
- if (tmp->subs[SUB_REAL].zfd >= 0)
+ if (tmp->subs[SUB_REAL].dfd >= 0)
{
- res = ioctl(tmp->subs[SUB_REAL].zfd, ZT_SET_PARAMS, &p);
+ res = ioctl(tmp->subs[SUB_REAL].dfd, DAHDI_SET_PARAMS, &p);
if (res < 0) {
ast_log(LOG_ERROR, "Unable to set parameters\n");
- destroy_zt_pvt(&tmp);
+ destroy_dahdi_pvt(&tmp);
return NULL;
}
}
#if 1
- if (!here && (tmp->subs[SUB_REAL].zfd > -1)) {
+ if (!here && (tmp->subs[SUB_REAL].dfd > -1)) {
memset(&bi, 0, sizeof(bi));
- res = ioctl(tmp->subs[SUB_REAL].zfd, ZT_GET_BUFINFO, &bi);
+ res = ioctl(tmp->subs[SUB_REAL].dfd, DAHDI_GET_BUFINFO, &bi);
if (!res) {
- bi.txbufpolicy = ZT_POLICY_IMMEDIATE;
- bi.rxbufpolicy = ZT_POLICY_IMMEDIATE;
+ bi.txbufpolicy = DAHDI_POLICY_IMMEDIATE;
+ bi.rxbufpolicy = DAHDI_POLICY_IMMEDIATE;
bi.numbufs = numbufs;
- res = ioctl(tmp->subs[SUB_REAL].zfd, ZT_SET_BUFINFO, &bi);
+ res = ioctl(tmp->subs[SUB_REAL].dfd, DAHDI_SET_BUFINFO, &bi);
if (res < 0) {
ast_log(LOG_WARNING, "Unable to set buffer policy on channel %d\n", channel);
}
@@ -7481,7 +7492,7 @@ static struct zt_pvt *mkintf(int channel, const struct zt_chan_conf *conf, struc
tmp->use_callerid = conf->chan.use_callerid;
tmp->cid_signalling = conf->chan.cid_signalling;
tmp->cid_start = conf->chan.cid_start;
- tmp->zaptrcallerid = conf->chan.zaptrcallerid;
+ tmp->dahditrcallerid = conf->chan.dahditrcallerid;
tmp->restrictcid = conf->chan.restrictcid;
tmp->use_callingpres = conf->chan.use_callingpres;
tmp->priindication_oob = conf->chan.priindication_oob;
@@ -7532,17 +7543,17 @@ static struct zt_pvt *mkintf(int channel, const struct zt_chan_conf *conf, struc
tmp->txgain = conf->chan.txgain;
tmp->tonezone = conf->chan.tonezone;
tmp->onhooktime = time(NULL);
- if (tmp->subs[SUB_REAL].zfd > -1) {
- set_actual_gain(tmp->subs[SUB_REAL].zfd, 0, tmp->rxgain, tmp->txgain, tmp->law);
+ if (tmp->subs[SUB_REAL].dfd > -1) {
+ set_actual_gain(tmp->subs[SUB_REAL].dfd, 0, tmp->rxgain, tmp->txgain, tmp->law);
if (tmp->dsp)
ast_dsp_digitmode(tmp->dsp, DSP_DIGITMODE_DTMF | tmp->dtmfrelax);
update_conf(tmp);
if (!here) {
if (chan_sig != SIG_PRI)
/* Hang it up to be sure it's good */
- zt_set_hook(tmp->subs[SUB_REAL].zfd, ZT_ONHOOK);
+ dahdi_set_hook(tmp->subs[SUB_REAL].dfd, DAHDI_ONHOOK);
}
- ioctl(tmp->subs[SUB_REAL].zfd,ZT_SETTONEZONE,&tmp->tonezone);
+ ioctl(tmp->subs[SUB_REAL].dfd,DAHDI_SETTONEZONE,&tmp->tonezone);
#ifdef HAVE_PRI
/* the dchannel is down so put the channel in alarm */
if (tmp->pri && !pri_is_up(tmp->pri))
@@ -7551,9 +7562,9 @@ static struct zt_pvt *mkintf(int channel, const struct zt_chan_conf *conf, struc
tmp->inalarm = 0;
#endif
memset(&si, 0, sizeof(si));
- if (ioctl(tmp->subs[SUB_REAL].zfd,ZT_SPANSTAT,&si) == -1) {
+ if (ioctl(tmp->subs[SUB_REAL].dfd,DAHDI_SPANSTAT,&si) == -1) {
ast_log(LOG_ERROR, "Unable to get span status: %s\n", strerror(errno));
- destroy_zt_pvt(&tmp);
+ destroy_dahdi_pvt(&tmp);
return NULL;
}
if (si.alarms) tmp->inalarm = 1;
@@ -7574,7 +7585,7 @@ static struct zt_pvt *mkintf(int channel, const struct zt_chan_conf *conf, struc
*wend = tmp;
} else {
/* at least one member on the iflist */
- struct zt_pvt *working = *wlist;
+ struct dahdi_pvt *working = *wlist;
/* check if we maybe have to put it on the begining */
if (working->channel > tmp->channel) {
@@ -7612,10 +7623,10 @@ static struct zt_pvt *mkintf(int channel, const struct zt_chan_conf *conf, struc
return tmp;
}
-static inline int available(struct zt_pvt *p, int channelmatch, ast_group_t groupmatch, int *busy, int *channelmatched, int *groupmatched)
+static inline int available(struct dahdi_pvt *p, int channelmatch, ast_group_t groupmatch, int *busy, int *channelmatched, int *groupmatched)
{
int res;
- ZT_PARAMS par;
+ DAHDI_PARAMS par;
/* First, check group matching */
if (groupmatch) {
@@ -7657,8 +7668,8 @@ static inline int available(struct zt_pvt *p, int channelmatch, ast_group_t grou
if (!p->sig || (p->sig == SIG_FXSLS))
return 1;
/* Check hook state */
- if (p->subs[SUB_REAL].zfd > -1)
- res = ioctl(p->subs[SUB_REAL].zfd, ZT_GET_PARAMS, &par);
+ if (p->subs[SUB_REAL].dfd > -1)
+ res = ioctl(p->subs[SUB_REAL].dfd, DAHDI_GET_PARAMS, &par);
else {
/* Assume not off hook on CVRS */
res = 0;
@@ -7675,7 +7686,7 @@ static inline int available(struct zt_pvt *p, int channelmatch, ast_group_t grou
if (par.rxisoffhook)
return 1;
else
-#ifdef ZAP_CHECK_HOOKSTATE
+#ifdef DAHDI_CHECK_HOOKSTATE
return 0;
#else
return 1;
@@ -7698,7 +7709,7 @@ static inline int available(struct zt_pvt *p, int channelmatch, ast_group_t grou
return 0;
}
- if (p->subs[SUB_CALLWAIT].zfd > -1) {
+ if (p->subs[SUB_CALLWAIT].dfd > -1) {
/* If there is already a call waiting call, then we can't take a second one */
return 0;
}
@@ -7716,28 +7727,32 @@ static inline int available(struct zt_pvt *p, int channelmatch, ast_group_t grou
return 1;
}
-static struct zt_pvt *chandup(struct zt_pvt *src)
+static struct dahdi_pvt *chandup(struct dahdi_pvt *src)
{
- struct zt_pvt *p;
- ZT_BUFFERINFO bi;
+ struct dahdi_pvt *p;
+ DAHDI_BUFFERINFO bi;
int res;
if ((p = ast_malloc(sizeof(*p)))) {
- memcpy(p, src, sizeof(struct zt_pvt));
+ memcpy(p, src, sizeof(struct dahdi_pvt));
ast_mutex_init(&p->lock);
- p->subs[SUB_REAL].zfd = zt_open("/dev/zap/pseudo");
- /* Allocate a zapata structure */
- if (p->subs[SUB_REAL].zfd < 0) {
+#ifdef HAVE_ZAPTEL
+ p->subs[SUB_REAL].dfd = dahdi_open("/dev/zap/pseudo");
+#else
+ p->subs[SUB_REAL].dfd = dahdi_open("/dev/dahdi/pseudo");
+#endif
+ /* Allocate a DAHDI structure */
+ if (p->subs[SUB_REAL].dfd < 0) {
ast_log(LOG_ERROR, "Unable to dup channel: %s\n", strerror(errno));
- destroy_zt_pvt(&p);
+ destroy_dahdi_pvt(&p);
return NULL;
}
- res = ioctl(p->subs[SUB_REAL].zfd, ZT_GET_BUFINFO, &bi);
+ res = ioctl(p->subs[SUB_REAL].dfd, DAHDI_GET_BUFINFO, &bi);
if (!res) {
- bi.txbufpolicy = ZT_POLICY_IMMEDIATE;
- bi.rxbufpolicy = ZT_POLICY_IMMEDIATE;
+ bi.txbufpolicy = DAHDI_POLICY_IMMEDIATE;
+ bi.rxbufpolicy = DAHDI_POLICY_IMMEDIATE;
bi.numbufs = numbufs;
- res = ioctl(p->subs[SUB_REAL].zfd, ZT_SET_BUFINFO, &bi);
+ res = ioctl(p->subs[SUB_REAL].dfd, DAHDI_SET_BUFINFO, &bi);
if (res < 0) {
ast_log(LOG_WARNING, "Unable to set buffer policy on dup channel\n");
}
@@ -7755,7 +7770,7 @@ static struct zt_pvt *chandup(struct zt_pvt *src)
#ifdef HAVE_PRI
-static int pri_find_empty_chan(struct zt_pri *pri, int backwards)
+static int pri_find_empty_chan(struct dahdi_pri *pri, int backwards)
{
int x;
if (backwards)
@@ -7781,14 +7796,14 @@ static int pri_find_empty_chan(struct zt_pri *pri, int backwards)
}
#endif
-static struct ast_channel *zt_request(const char *type, int format, void *data, int *cause)
+static struct ast_channel *dahdi_request(const char *type, int format, void *data, int *cause)
{
ast_group_t groupmatch = 0;
int channelmatch = -1;
int roundrobin = 0;
int callwait = 0;
int busy = 0;
- struct zt_pvt *p;
+ struct dahdi_pvt *p;
struct ast_channel *tmp = NULL;
char *dest=NULL;
int x;
@@ -7800,9 +7815,9 @@ static struct ast_channel *zt_request(const char *type, int format, void *data,
int crv;
int bearer = -1;
int trunkgroup;
- struct zt_pri *pri=NULL;
+ struct dahdi_pri *pri=NULL;
#endif
- struct zt_pvt *exit, *start, *end;
+ struct dahdi_pvt *exit, *start, *end;
ast_mutex_t *lock;
int channelmatched = 0;
int groupmatched = 0;
@@ -7905,7 +7920,7 @@ static struct ast_channel *zt_request(const char *type, int format, void *data,
callwait = (p->owner != NULL);
#ifdef HAVE_PRI
- if (pri && (p->subs[SUB_REAL].zfd < 0)) {
+ if (pri && (p->subs[SUB_REAL].dfd < 0)) {
if (p->sig != SIG_FXSKS) {
/* Gotta find an actual channel to use for this
CRV if this isn't a callwait */
@@ -7940,7 +7955,7 @@ static struct ast_channel *zt_request(const char *type, int format, void *data,
}
}
p->outgoing = 1;
- tmp = zt_new(p, AST_STATE_RESERVED, 0, p->owner ? SUB_CALLWAIT : SUB_REAL, 0, 0);
+ tmp = dahdi_new(p, AST_STATE_RESERVED, 0, p->owner ? SUB_CALLWAIT : SUB_REAL, 0, 0);
#ifdef HAVE_PRI
if (p->bearer) {
/* Log owner to bearer channel, too */
@@ -8004,9 +8019,9 @@ next:
#ifdef HAVE_PRI
-static struct zt_pvt *pri_find_crv(struct zt_pri *pri, int crv)
+static struct dahdi_pvt *pri_find_crv(struct dahdi_pri *pri, int crv)
{
- struct zt_pvt *p;
+ struct dahdi_pvt *p;
p = pri->crvs;
while (p) {
if (p->channel == crv)
@@ -8017,19 +8032,19 @@ static struct zt_pvt *pri_find_crv(struct zt_pri *pri, int crv)
}
-static int pri_find_principle(struct zt_pri *pri, int channel)
+static int pri_find_principle(struct dahdi_pri *pri, int channel)
{
int x;
int span = PRI_SPAN(channel);
int spanfd;
- ZT_PARAMS param;
+ DAHDI_PARAMS param;
int principle = -1;
int explicit = PRI_EXPLICIT(channel);
channel = PRI_CHANNEL(channel);
if (!explicit) {
spanfd = pri_active_dchan_fd(pri);
- if (ioctl(spanfd, ZT_GET_PARAMS, &param))
+ if (ioctl(spanfd, DAHDI_GET_PARAMS, &param))
return -1;
span = pris[param.spanno - 1].prilogicalspan;
}
@@ -8044,10 +8059,10 @@ static int pri_find_principle(struct zt_pri *pri, int channel)
return principle;
}
-static int pri_fixup_principle(struct zt_pri *pri, int principle, q931_call *c)
+static int pri_fixup_principle(struct dahdi_pri *pri, int principle, q931_call *c)
{
int x;
- struct zt_pvt *crv;
+ struct dahdi_pvt *crv;
if (!c) {
if (principle < 0)
return -1;
@@ -8065,7 +8080,7 @@ static int pri_fixup_principle(struct zt_pri *pri, int principle, q931_call *c)
if (pri->pvts[x]->call == c) {
/* Found our call */
if (principle != x) {
- struct zt_pvt *new = pri->pvts[principle], *old = pri->pvts[x];
+ struct dahdi_pvt *new = pri->pvts[principle], *old = pri->pvts[x];
if (option_verbose > 2)
ast_verbose(VERBOSE_PREFIX_3 "Moving call from channel %d to channel %d\n",
@@ -8080,10 +8095,10 @@ static int pri_fixup_principle(struct zt_pri *pri, int principle, q931_call *c)
old->owner = NULL;
if (new->owner) {
ast_string_field_build(new->owner, name,
- "Zap/%d:%d-%d", pri->trunkgroup,
+ "DAHDI/%d:%d-%d", pri->trunkgroup,
new->channel, 1);
new->owner->tech_pvt = new;
- new->owner->fds[0] = new->subs[SUB_REAL].zfd;
+ new->owner->fds[0] = new->subs[SUB_REAL].dfd;
new->subs[SUB_REAL].owner = old->subs[SUB_REAL].owner;
old->subs[SUB_REAL].owner = NULL;
} else
@@ -8112,7 +8127,7 @@ static int pri_fixup_principle(struct zt_pri *pri, int principle, q931_call *c)
else {
/* Looks good. Drop the pseudo channel now, clear up the assignment, and
wakeup the potential sleeper */
- zt_close(crv->subs[SUB_REAL].zfd);
+ dahdi_close(crv->subs[SUB_REAL].dfd);
pri->pvts[principle]->call = crv->call;
pri_assign_bearer(crv, pri, pri->pvts[principle]);
ast_log(LOG_DEBUG, "Assigning bearer %d/%d to CRV %d:%d\n",
@@ -8131,7 +8146,7 @@ static int pri_fixup_principle(struct zt_pri *pri, int principle, q931_call *c)
static void *do_idle_thread(void *vchan)
{
struct ast_channel *chan = vchan;
- struct zt_pvt *pvt = chan->tech_pvt;
+ struct dahdi_pvt *pvt = chan->tech_pvt;
struct ast_frame *f;
char ex[80];
/* Wait up to 30 seconds for an answer */
@@ -8183,7 +8198,7 @@ static void *do_idle_thread(void *vchan)
#ifndef PRI_RESTART
#error "Upgrade your libpri"
#endif
-static void zt_pri_message(struct pri *pri, char *s)
+static void dahdi_pri_message(struct pri *pri, char *s)
{
int x, y;
int dchan = -1, span = -1;
@@ -8222,7 +8237,7 @@ static void zt_pri_message(struct pri *pri, char *s)
ast_mutex_unlock(&pridebugfdlock);
}
-static void zt_pri_error(struct pri *pri, char *s)
+static void dahdi_pri_error(struct pri *pri, char *s)
{
int x, y;
int dchan = -1, span = -1;
@@ -8261,7 +8276,7 @@ static void zt_pri_error(struct pri *pri, char *s)
ast_mutex_unlock(&pridebugfdlock);
}
-static int pri_check_restart(struct zt_pri *pri)
+static int pri_check_restart(struct dahdi_pri *pri)
{
do {
pri->resetpos++;
@@ -8280,7 +8295,7 @@ static int pri_check_restart(struct zt_pri *pri)
return 0;
}
-static int pri_hangup_all(struct zt_pvt *p, struct zt_pri *pri)
+static int pri_hangup_all(struct dahdi_pvt *p, struct dahdi_pri *pri)
{
int x;
int redo;
@@ -8320,7 +8335,7 @@ static char * redirectingreason2str(int redirectingreason)
}
}
-static void apply_plan_to_number(char *buf, size_t size, const struct zt_pri *pri, const char *number, const int plan)
+static void apply_plan_to_number(char *buf, size_t size, const struct dahdi_pri *pri, const char *number, const int plan)
{
switch (plan) {
case PRI_INTERNATIONAL_ISDN: /* Q.931 dialplan == 0x11 international dialplan => prepend international prefix digits */
@@ -8344,10 +8359,10 @@ static void apply_plan_to_number(char *buf, size_t size, const struct zt_pri *pr
}
}
-static int zt_setlaw(int zfd, int law)
+static int dahdi_setlaw(int dfd, int law)
{
int res;
- res = ioctl(zfd, ZT_SETLAW, &law);
+ res = ioctl(dfd, DAHDI_SETLAW, &law);
if (res)
return res;
return 0;
@@ -8355,7 +8370,7 @@ static int zt_setlaw(int zfd, int law)
static void *pri_dchannel(void *vpri)
{
- struct zt_pri *pri = vpri;
+ struct dahdi_pri *pri = vpri;
pri_event *e;
struct pollfd fds[NUM_DCHANS];
int res;
@@ -8376,7 +8391,7 @@ static void *pri_dchannel(void *vpri)
int i, which=-1;
int numdchans;
int cause=0;
- struct zt_pvt *crv;
+ struct dahdi_pvt *crv;
pthread_t threadid;
pthread_attr_t attr;
char ani2str[6];
@@ -8445,15 +8460,15 @@ static void *pri_dchannel(void *vpri)
if (ast_tvdiff_ms(ast_tvnow(), lastidle) > 1000) {
/* Don't create a new idle call more than once per second */
snprintf(idlen, sizeof(idlen), "%d/%s", pri->pvts[nextidle]->channel, pri->idledial);
- idle = zt_request("Zap", AST_FORMAT_ULAW, idlen, &cause);
+ idle = dahdi_request("DAHDI", AST_FORMAT_ULAW, idlen, &cause);
if (idle) {
pri->pvts[nextidle]->isidlecall = 1;
if (ast_pthread_create_background(&p, NULL, do_idle_thread, idle)) {
ast_log(LOG_WARNING, "Unable to start new thread for idle channel '%s'\n", idle->name);
- zt_hangup(idle);
+ dahdi_hangup(idle);
}
} else
- ast_log(LOG_WARNING, "Unable to request channel 'Zap/%s' for idle call\n", idlen);
+ ast_log(LOG_WARNING, "Unable to request channel 'DAHDI/%s' for idle call\n", idlen);
gettimeofday(&lastidle, NULL);
}
} else if ((haveidles < pri->minunused) &&
@@ -8529,14 +8544,14 @@ static void *pri_dchannel(void *vpri)
if (fds[which].revents & POLLPRI) {
/* Check for an event */
x = 0;
- res = ioctl(pri->fds[which], ZT_GETEVENT, &x);
+ res = ioctl(pri->fds[which], DAHDI_GETEVENT, &x);
if (x)
ast_log(LOG_NOTICE, "PRI got event: %s (%d) on %s D-channel of span %d\n", event2str(x), x, pri_order(which), pri->span);
/* Keep track of alarm state */
- if (x == ZT_EVENT_ALARM) {
+ if (x == DAHDI_EVENT_ALARM) {
pri->dchanavail[which] &= ~(DCHAN_NOTINALARM | DCHAN_UP);
pri_find_dchan(pri);
- } else if (x == ZT_EVENT_NOALARM) {
+ } else if (x == DAHDI_EVENT_NOALARM) {
pri->dchanavail[which] |= DCHAN_NOTINALARM;
pri_restart(pri->dchans[which]);
}
@@ -8599,7 +8614,7 @@ static void *pri_dchannel(void *vpri)
pri->resetting = 0;
/* Hangup active channels and put them in alarm mode */
for (i = 0; i < pri->numchans; i++) {
- struct zt_pvt *p = pri->pvts[i];
+ struct dahdi_pvt *p = pri->pvts[i];
if (p) {
if (!p->pri || !p->pri->pri || pri_get_timer(p->pri->pri, PRI_TIMER_T309) < 0) {
/* T309 is not enabled : hangup calls when alarm occurs */
@@ -8680,7 +8695,7 @@ static void *pri_dchannel(void *vpri)
digit = e->digit.digits[i];
{
struct ast_frame f = { AST_FRAME_DTMF, digit, };
- zap_queue_frame(pri->pvts[chanpos], &f, pri);
+ dahdi_queue_frame(pri->pvts[chanpos], &f, pri);
}
}
}
@@ -8708,7 +8723,7 @@ static void *pri_dchannel(void *vpri)
digit = e->ring.callednum[i];
{
struct ast_frame f = { AST_FRAME_DTMF, digit, };
- zap_queue_frame(pri->pvts[chanpos], &f, pri);
+ dahdi_queue_frame(pri->pvts[chanpos], &f, pri);
}
}
}
@@ -8828,17 +8843,17 @@ static void *pri_dchannel(void *vpri)
if (pri->switchtype != PRI_SWITCH_GR303_TMC) {
/* Set to audio mode at this point */
law = 1;
- if (ioctl(pri->pvts[chanpos]->subs[SUB_REAL].zfd, ZT_AUDIOMODE, &law) == -1)
+ if (ioctl(pri->pvts[chanpos]->subs[SUB_REAL].dfd, DAHDI_AUDIOMODE, &law) == -1)
ast_log(LOG_WARNING, "Unable to set audio mode on channel %d to %d\n", pri->pvts[chanpos]->channel, law);
}
if (e->ring.layer1 == PRI_LAYER_1_ALAW)
- law = ZT_LAW_ALAW;
+ law = DAHDI_LAW_ALAW;
else
- law = ZT_LAW_MULAW;
- res = zt_setlaw(pri->pvts[chanpos]->subs[SUB_REAL].zfd, law);
+ law = DAHDI_LAW_MULAW;
+ res = dahdi_setlaw(pri->pvts[chanpos]->subs[SUB_REAL].dfd, law);
if (res < 0)
ast_log(LOG_WARNING, "Unable to set law on channel %d\n", pri->pvts[chanpos]->channel);
- res = set_actual_gain(pri->pvts[chanpos]->subs[SUB_REAL].zfd, 0, pri->pvts[chanpos]->rxgain, pri->pvts[chanpos]->txgain, law);
+ res = set_actual_gain(pri->pvts[chanpos]->subs[SUB_REAL].dfd, 0, pri->pvts[chanpos]->rxgain, pri->pvts[chanpos]->txgain, law);
if (res < 0)
ast_log(LOG_WARNING, "Unable to set gains on channel %d\n", pri->pvts[chanpos]->channel);
if (e->ring.complete || !pri->overlapdial) {
@@ -8861,11 +8876,11 @@ static void *pri_dchannel(void *vpri)
if (crv) {
/* Set bearer and such */
pri_assign_bearer(crv, pri, pri->pvts[chanpos]);
- c = zt_new(crv, AST_STATE_RESERVED, 0, SUB_REAL, law, e->ring.ctype);
+ c = dahdi_new(crv, AST_STATE_RESERVED, 0, SUB_REAL, law, e->ring.ctype);
pri->pvts[chanpos]->owner = &inuse;
ast_log(LOG_DEBUG, "Started up crv %d:%d on bearer channel %d\n", pri->trunkgroup, crv->channel, crv->bearer->channel);
} else {
- c = zt_new(pri->pvts[chanpos], AST_STATE_RESERVED, 0, SUB_REAL, law, e->ring.ctype);
+ c = dahdi_new(pri->pvts[chanpos], AST_STATE_RESERVED, 0, SUB_REAL, law, e->ring.ctype);
}
ast_mutex_unlock(&pri->pvts[chanpos]->lock);
@@ -8913,7 +8928,7 @@ static void *pri_dchannel(void *vpri)
} else {
ast_mutex_unlock(&pri->lock);
/* Release PRI lock while we create the channel */
- c = zt_new(pri->pvts[chanpos], AST_STATE_RING, 1, SUB_REAL, law, e->ring.ctype);
+ c = dahdi_new(pri->pvts[chanpos], AST_STATE_RING, 1, SUB_REAL, law, e->ring.ctype);
if (c) {
char calledtonstr[10];
@@ -8943,7 +8958,7 @@ static void *pri_dchannel(void *vpri)
ast_verbose(VERBOSE_PREFIX_3 "Accepting call from '%s' to '%s' on channel %d/%d, span %d\n",
plancallingnum, pri->pvts[chanpos]->exten,
pri->pvts[chanpos]->logicalspan, pri->pvts[chanpos]->prioffset, pri->span);
- zt_enable_ec(pri->pvts[chanpos]);
+ dahdi_enable_ec(pri->pvts[chanpos]);
} else {
ast_mutex_lock(&pri->lock);
@@ -8986,7 +9001,7 @@ static void *pri_dchannel(void *vpri)
} else {
ast_mutex_lock(&pri->pvts[chanpos]->lock);
if (ast_strlen_zero(pri->pvts[chanpos]->dop.dialstr)) {
- zt_enable_ec(pri->pvts[chanpos]);
+ dahdi_enable_ec(pri->pvts[chanpos]);
pri->pvts[chanpos]->subs[SUB_REAL].needringing = 1;
pri->pvts[chanpos]->alerting = 1;
} else
@@ -9047,7 +9062,7 @@ static void *pri_dchannel(void *vpri)
ast_mutex_lock(&pri->pvts[chanpos]->lock);
ast_log(LOG_DEBUG, "Queuing frame from PRI_EVENT_PROGRESS on channel %d/%d span %d\n",
pri->pvts[chanpos]->logicalspan, pri->pvts[chanpos]->prioffset,pri->span);
- zap_queue_frame(pri->pvts[chanpos], &f, pri);
+ dahdi_queue_frame(pri->pvts[chanpos], &f, pri);
#ifdef PRI_PROGRESS_MASK
if (e->proceeding.progressmask & PRI_PROG_INBAND_AVAILABLE) {
#else
@@ -9073,7 +9088,7 @@ static void *pri_dchannel(void *vpri)
ast_mutex_lock(&pri->pvts[chanpos]->lock);
ast_log(LOG_DEBUG, "Queuing frame from PRI_EVENT_PROCEEDING on channel %d/%d span %d\n",
pri->pvts[chanpos]->logicalspan, pri->pvts[chanpos]->prioffset,pri->span);
- zap_queue_frame(pri->pvts[chanpos], &f, pri);
+ dahdi_queue_frame(pri->pvts[chanpos], &f, pri);
#ifdef PRI_PROGRESS_MASK
if (e->proceeding.progressmask & PRI_PROG_INBAND_AVAILABLE) {
#else
@@ -9086,7 +9101,7 @@ static void *pri_dchannel(void *vpri)
}
/* Bring voice path up */
f.subclass = AST_CONTROL_PROGRESS;
- zap_queue_frame(pri->pvts[chanpos], &f, pri);
+ dahdi_queue_frame(pri->pvts[chanpos], &f, pri);
}
pri->pvts[chanpos]->proceeding = 1;
ast_mutex_unlock(&pri->pvts[chanpos]->lock);
@@ -9109,7 +9124,7 @@ static void *pri_dchannel(void *vpri)
ast_copy_string(pri->pvts[chanpos]->lastcid_num, e->facname.callingnum, sizeof(pri->pvts[chanpos]->lastcid_num));
ast_copy_string(pri->pvts[chanpos]->lastcid_name, e->facname.callingname, sizeof(pri->pvts[chanpos]->lastcid_name));
pri->pvts[chanpos]->subs[SUB_REAL].needcallerid =1;
- zt_enable_ec(pri->pvts[chanpos]);
+ dahdi_enable_ec(pri->pvts[chanpos]);
ast_mutex_unlock(&pri->pvts[chanpos]->lock);
}
}
@@ -9137,8 +9152,8 @@ static void *pri_dchannel(void *vpri)
}
if (pri->pvts[chanpos]->realcall && (pri->pvts[chanpos]->realcall->sig == SIG_FXSKS)) {
ast_log(LOG_DEBUG, "Starting up GR-303 trunk now that we got CONNECT...\n");
- x = ZT_START;
- res = ioctl(pri->pvts[chanpos]->subs[SUB_REAL].zfd, ZT_HOOK, &x);
+ x = DAHDI_START;
+ res = ioctl(pri->pvts[chanpos]->subs[SUB_REAL].dfd, DAHDI_HOOK, &x);
if (res < 0) {
if (errno != EINPROGRESS) {
ast_log(LOG_WARNING, "Unable to start channel: %s\n", strerror(errno));
@@ -9147,7 +9162,7 @@ static void *pri_dchannel(void *vpri)
} else if (!ast_strlen_zero(pri->pvts[chanpos]->dop.dialstr)) {
pri->pvts[chanpos]->dialing = 1;
/* Send any "w" waited stuff */
- res = ioctl(pri->pvts[chanpos]->subs[SUB_REAL].zfd, ZT_DIAL, &pri->pvts[chanpos]->dop);
+ res = ioctl(pri->pvts[chanpos]->subs[SUB_REAL].dfd, DAHDI_DIAL, &pri->pvts[chanpos]->dop);
if (res < 0) {
ast_log(LOG_WARNING, "Unable to initiate dialing on trunk channel %d\n", pri->pvts[chanpos]->channel);
pri->pvts[chanpos]->dop.dialstr[0] = '\0';
@@ -9159,7 +9174,7 @@ static void *pri_dchannel(void *vpri)
} else {
pri->pvts[chanpos]->subs[SUB_REAL].needanswer =1;
/* Enable echo cancellation if it's not on already */
- zt_enable_ec(pri->pvts[chanpos]);
+ dahdi_enable_ec(pri->pvts[chanpos]);
}
#ifdef SUPPORT_USERUSER
@@ -9185,7 +9200,7 @@ static void *pri_dchannel(void *vpri)
if (chanpos > -1) {
ast_mutex_lock(&pri->pvts[chanpos]->lock);
if (!pri->pvts[chanpos]->alreadyhungup) {
- /* we're calling here zt_hangup so once we get there we need to clear p->call after calling pri_hangup */
+ /* we're calling here dahdi_hangup so once we get there we need to clear p->call after calling pri_hangup */
pri->pvts[chanpos]->alreadyhungup = 1;
if (pri->pvts[chanpos]->realcall)
pri_hangup_all(pri->pvts[chanpos]->realcall, pri);
@@ -9432,11 +9447,11 @@ static void *pri_dchannel(void *vpri)
switch (e->notify.info) {
case PRI_NOTIFY_REMOTE_HOLD:
f.subclass = AST_CONTROL_HOLD;
- zap_queue_frame(pri->pvts[chanpos], &f, pri);
+ dahdi_queue_frame(pri->pvts[chanpos], &f, pri);
break;
case PRI_NOTIFY_REMOTE_RETRIEVAL:
f.subclass = AST_CONTROL_UNHOLD;
- zap_queue_frame(pri->pvts[chanpos], &f, pri);
+ dahdi_queue_frame(pri->pvts[chanpos], &f, pri);
break;
}
ast_mutex_unlock(&pri->pvts[chanpos]->lock);
@@ -9452,40 +9467,44 @@ static void *pri_dchannel(void *vpri)
return NULL;
}
-static int start_pri(struct zt_pri *pri)
+static int start_pri(struct dahdi_pri *pri)
{
int res, x;
- ZT_PARAMS p;
- ZT_BUFFERINFO bi;
- struct zt_spaninfo si;
+ DAHDI_PARAMS p;
+ DAHDI_BUFFERINFO bi;
+ DAHDI_SPANINFO si;
int i;
for (i = 0; i < NUM_DCHANS; i++) {
if (!pri->dchannels[i])
break;
+#ifdef HAVE_ZAPTEL
pri->fds[i] = open("/dev/zap/channel", O_RDWR, 0600);
+#else
+ pri->fds[i] = open("/dev/dahdi/channel", O_RDWR, 0600);
+#endif
x = pri->dchannels[i];
- if ((pri->fds[i] < 0) || (ioctl(pri->fds[i],ZT_SPECIFY,&x) == -1)) {
+ if ((pri->fds[i] < 0) || (ioctl(pri->fds[i],DAHDI_SPECIFY,&x) == -1)) {
ast_log(LOG_ERROR, "Unable to open D-channel %d (%s)\n", x, strerror(errno));
return -1;
}
- res = ioctl(pri->fds[i], ZT_GET_PARAMS, &p);
+ res = ioctl(pri->fds[i], DAHDI_GET_PARAMS, &p);
if (res) {
- zt_close(pri->fds[i]);
+ dahdi_close(pri->fds[i]);
pri->fds[i] = -1;
ast_log(LOG_ERROR, "Unable to get parameters for D-channel %d (%s)\n", x, strerror(errno));
return -1;
}
- if ((p.sigtype != ZT_SIG_HDLCFCS) && (p.sigtype != ZT_SIG_HARDHDLC)) {
- zt_close(pri->fds[i]);
+ if ((p.sigtype != DAHDI_SIG_HDLCFCS) && (p.sigtype != DAHDI_SIG_HARDHDLC)) {
+ dahdi_close(pri->fds[i]);
pri->fds[i] = -1;
- ast_log(LOG_ERROR, "D-channel %d is not in HDLC/FCS mode. See /etc/zaptel.conf\n", x);
+ ast_log(LOG_ERROR, "D-channel %d is not in HDLC/FCS mode. See /etc/DAHDI.conf\n", x);
return -1;
}
memset(&si, 0, sizeof(si));
- res = ioctl(pri->fds[i], ZT_SPANSTAT, &si);
+ res = ioctl(pri->fds[i], DAHDI_SPANSTAT, &si);
if (res) {
- zt_close(pri->fds[i]);
+ dahdi_close(pri->fds[i]);
pri->fds[i] = -1;
ast_log(LOG_ERROR, "Unable to get span state for D-channel %d (%s)\n", x, strerror(errno));
}
@@ -9493,13 +9512,13 @@ static int start_pri(struct zt_pri *pri)
pri->dchanavail[i] |= DCHAN_NOTINALARM;
else
pri->dchanavail[i] &= ~DCHAN_NOTINALARM;
- bi.txbufpolicy = ZT_POLICY_IMMEDIATE;
- bi.rxbufpolicy = ZT_POLICY_IMMEDIATE;
+ bi.txbufpolicy = DAHDI_POLICY_IMMEDIATE;
+ bi.rxbufpolicy = DAHDI_POLICY_IMMEDIATE;
bi.numbufs = 32;
bi.bufsize = 1024;
- if (ioctl(pri->fds[i], ZT_SET_BUFINFO, &bi)) {
+ if (ioctl(pri->fds[i], DAHDI_SET_BUFINFO, &bi)) {
ast_log(LOG_ERROR, "Unable to set appropriate buffering on channel %d\n", x);
- zt_close(pri->fds[i]);
+ dahdi_close(pri->fds[i]);
pri->fds[i] = -1;
return -1;
}
@@ -9512,7 +9531,7 @@ static int start_pri(struct zt_pri *pri)
if (i)
pri_enslave(pri->dchans[0], pri->dchans[i]);
if (!pri->dchans[i]) {
- zt_close(pri->fds[i]);
+ dahdi_close(pri->fds[i]);
pri->fds[i] = -1;
ast_log(LOG_ERROR, "Unable to create PRI structure\n");
return -1;
@@ -9533,7 +9552,7 @@ static int start_pri(struct zt_pri *pri)
for (i = 0; i < NUM_DCHANS; i++) {
if (!pri->dchannels[i])
break;
- zt_close(pri->fds[i]);
+ dahdi_close(pri->fds[i]);
pri->fds[i] = -1;
}
ast_log(LOG_ERROR, "Unable to spawn D-channel: %s\n", strerror(errno));
@@ -9823,7 +9842,7 @@ static const char pri_show_spans_help[] =
"Usage: pri show spans\n"
" Displays PRI Information\n";
-static struct ast_cli_entry zap_pri_cli[] = {
+static struct ast_cli_entry dahdi_pri_cli[] = {
{ { "pri", "debug", "span", NULL },
handle_pri_debug, "Enables PRI debugging on a span",
pri_debug_help, complete_span_4 },
@@ -9861,7 +9880,7 @@ static struct ast_cli_entry zap_pri_cli[] = {
#endif /* HAVE_PRI */
-static int zap_destroy_channel(int fd, int argc, char **argv)
+static int dahdi_destroy_channel(int fd, int argc, char **argv)
{
int channel;
@@ -9870,61 +9889,61 @@ static int zap_destroy_channel(int fd, int argc, char **argv)
channel = atoi(argv[3]);
- return zap_destroy_channel_bynum(channel);
+ return dahdi_destroy_channel_bynum(channel);
}
-static int setup_zap(int reload);
-static int zap_restart(void)
+static int setup_dahdi(int reload);
+static int dahdi_restart(void)
{
if (option_verbose > 0)
- ast_verbose(VERBOSE_PREFIX_1 "Destroying channels and reloading zaptel configuration.\n");
+ ast_verbose(VERBOSE_PREFIX_1 "Destroying channels and reloading DAHDI configuration.\n");
while (iflist) {
if (option_debug)
- ast_log(LOG_DEBUG, "Destroying zaptel channel no. %d\n", iflist->channel);
+ ast_log(LOG_DEBUG, "Destroying DAHDI channel no. %d\n", iflist->channel);
/* Also updates iflist: */
destroy_channel(NULL, iflist, 1);
}
if (option_debug)
ast_log(LOG_DEBUG, "Channels destroyed. Now re-reading config.\n");
- if (setup_zap(0) != 0) {
- ast_log(LOG_WARNING, "Reload channels from zap config failed!\n");
+ if (setup_dahdi(0) != 0) {
+ ast_log(LOG_WARNING, "Reload channels from dahdi config failed!\n");
return 1;
}
return 0;
}
-static int zap_restart_cmd(int fd, int argc, char **argv)
+static int dahdi_restart_cmd(int fd, int argc, char **argv)
{
if (argc != 2) {
return RESULT_SHOWUSAGE;
}
- if (zap_restart() != 0)
+ if (dahdi_restart() != 0)
return RESULT_FAILURE;
return RESULT_SUCCESS;
}
-static int action_zaprestart(struct mansession *s, const struct message *m)
+static int action_dahdirestart(struct mansession *s, const struct message *m)
{
- if (zap_restart() != 0) {
- astman_send_error(s, m, "Failed rereading zaptel configuration");
+ if (dahdi_restart() != 0) {
+ astman_send_error(s, m, "Failed rereading DAHDI configuration");
return 1;
}
- astman_send_ack(s, m, "ZapRestart: Success");
+ astman_send_ack(s, m, "DAHDIRestart: Success");
return 0;
}
-static int zap_show_channels(int fd, int argc, char **argv)
+static int dahdi_show_channels(int fd, int argc, char **argv)
{
#define FORMAT "%7s %-10.10s %-15.15s %-10.10s %-20.20s\n"
#define FORMAT2 "%7s %-10.10s %-15.15s %-10.10s %-20.20s\n"
- struct zt_pvt *tmp = NULL;
+ struct dahdi_pvt *tmp = NULL;
char tmps[20] = "";
ast_mutex_t *lock;
- struct zt_pvt *start;
+ struct dahdi_pvt *start;
#ifdef HAVE_PRI
int trunkgroup;
- struct zt_pri *pri = NULL;
+ struct dahdi_pri *pri = NULL;
int x;
#endif
@@ -9975,19 +9994,19 @@ static int zap_show_channels(int fd, int argc, char **argv)
#undef FORMAT2
}
-static int zap_show_channel(int fd, int argc, char **argv)
+static int dahdi_show_channel(int fd, int argc, char **argv)
{
int channel;
- struct zt_pvt *tmp = NULL;
- ZT_CONFINFO ci;
- ZT_PARAMS ps;
+ struct dahdi_pvt *tmp = NULL;
+ DAHDI_CONFINFO ci;
+ DAHDI_PARAMS ps;
int x;
ast_mutex_t *lock;
- struct zt_pvt *start;
+ struct dahdi_pvt *start;
#ifdef HAVE_PRI
char *c;
int trunkgroup;
- struct zt_pri *pri=NULL;
+ struct dahdi_pri *pri=NULL;
#endif
lock = &iflock;
@@ -10028,7 +10047,7 @@ static int zap_show_channel(int fd, int argc, char **argv)
else
#endif
ast_cli(fd, "Channel: %d\n", tmp->channel);
- ast_cli(fd, "File Descriptor: %d\n", tmp->subs[SUB_REAL].zfd);
+ ast_cli(fd, "File Descriptor: %d\n", tmp->subs[SUB_REAL].dfd);
ast_cli(fd, "Span: %d\n", tmp->span);
ast_cli(fd, "Extension: %s\n", tmp->exten);
ast_cli(fd, "Dialing: %s\n", tmp->dialing ? "yes" : "no");
@@ -10050,7 +10069,7 @@ static int zap_show_channel(int fd, int argc, char **argv)
ast_cli(fd, "DSP: %s\n", tmp->dsp ? "yes" : "no");
ast_cli(fd, "Relax DTMF: %s\n", tmp->dtmfrelax ? "yes" : "no");
ast_cli(fd, "Dialing/CallwaitCAS: %d/%d\n", tmp->dialing, tmp->callwaitcas);
- ast_cli(fd, "Default law: %s\n", tmp->law == ZT_LAW_MULAW ? "ulaw" : tmp->law == ZT_LAW_ALAW ? "alaw" : "unknown");
+ ast_cli(fd, "Default law: %s\n", tmp->law == DAHDI_LAW_MULAW ? "ulaw" : tmp->law == DAHDI_LAW_ALAW ? "alaw" : "unknown");
ast_cli(fd, "Fax Handled: %s\n", tmp->faxhandled ? "yes" : "no");
ast_cli(fd, "Pulse phone: %s\n", tmp->pulsedial ? "yes" : "no");
ast_cli(fd, "Echo Cancellation: %d taps%s, currently %s\n", tmp->echocancel, tmp->echocanbridged ? "" : " unless TDM bridged", tmp->echocanon ? "ON" : "OFF");
@@ -10079,16 +10098,16 @@ static int zap_show_channel(int fd, int argc, char **argv)
#endif
memset(&ci, 0, sizeof(ci));
ps.channo = tmp->channel;
- if (tmp->subs[SUB_REAL].zfd > -1) {
- if (!ioctl(tmp->subs[SUB_REAL].zfd, ZT_GETCONF, &ci)) {
+ if (tmp->subs[SUB_REAL].dfd > -1) {
+ if (!ioctl(tmp->subs[SUB_REAL].dfd, DAHDI_GETCONF, &ci)) {
ast_cli(fd, "Actual Confinfo: Num/%d, Mode/0x%04x\n", ci.confno, ci.confmode);
}
-#ifdef ZT_GETCONFMUTE
- if (!ioctl(tmp->subs[SUB_REAL].zfd, ZT_GETCONFMUTE, &x)) {
+#ifdef DAHDI_GETCONFMUTE
+ if (!ioctl(tmp->subs[SUB_REAL].dfd, DAHDI_GETCONFMUTE, &x)) {
ast_cli(fd, "Actual Confmute: %s\n", x ? "Yes" : "No");
}
#endif
- if (ioctl(tmp->subs[SUB_REAL].zfd, ZT_GET_PARAMS, &ps) < 0) {
+ if (ioctl(tmp->subs[SUB_REAL].dfd, DAHDI_GET_PARAMS, &ps) < 0) {
ast_log(LOG_WARNING, "Failed to get parameters on channel %d\n", tmp->channel);
} else {
ast_cli(fd, "Hookstate (FXS only): %s\n", ps.rxisoffhook ? "Offhook" : "Onhook");
@@ -10105,11 +10124,11 @@ static int zap_show_channel(int fd, int argc, char **argv)
return RESULT_FAILURE;
}
-static char zap_show_cadences_help[] =
-"Usage: zap show cadences\n"
+static char dahdi_show_cadences_usage[] =
+"Usage: dahdi show cadences\n"
" Shows all cadences currently defined\n";
-static int handle_zap_show_cadences(int fd, int argc, char *argv[])
+static int handle_dahdi_show_cadences(int fd, int argc, char *argv[])
{
int i, j;
for (i = 0; i < num_cadence; i++) {
@@ -10136,7 +10155,7 @@ static int handle_zap_show_cadences(int fd, int argc, char *argv[])
}
/* Based on irqmiss.c */
-static int zap_show_status(int fd, int argc, char *argv[]) {
+static int dahdi_show_status(int fd, int argc, char *argv[]) {
#define FORMAT "%-40.40s %-10.10s %-10d %-10d %-10d\n"
#define FORMAT2 "%-40.40s %-10.10s %-10.10s %-10.10s %-10.10s\n"
@@ -10145,35 +10164,39 @@ static int zap_show_status(int fd, int argc, char *argv[]) {
char alarms[50];
int ctl;
- ZT_SPANINFO s;
+ DAHDI_SPANINFO s;
+#ifdef HAVE_ZAPTEL
ctl = open("/dev/zap/ctl", O_RDWR);
+#else
+ ctl = open("/dev/dahdi/ctl", O_RDWR);
+#endif
if (ctl < 0) {
- ast_log(LOG_WARNING, "Unable to open /dev/zap/ctl: %s\n", strerror(errno));
- ast_cli(fd, "No Zaptel interface found.\n");
+ ast_log(LOG_WARNING, "Unable to open /dev/dahdi/ctl: %s\n", strerror(errno));
+ ast_cli(fd, "No DAHDI interface found.\n");
return RESULT_FAILURE;
}
ast_cli(fd, FORMAT2, "Description", "Alarms", "IRQ", "bpviol", "CRC4");
- for (span = 1; span < ZT_MAX_SPANS; ++span) {
+ for (span = 1; span < DAHDI_MAX_SPANS; ++span) {
s.spanno = span;
- res = ioctl(ctl, ZT_SPANSTAT, &s);
+ res = ioctl(ctl, DAHDI_SPANSTAT, &s);
if (res) {
continue;
}
alarms[0] = '\0';
if (s.alarms > 0) {
- if (s.alarms & ZT_ALARM_BLUE)
+ if (s.alarms & DAHDI_ALARM_BLUE)
strcat(alarms, "BLU/");
- if (s.alarms & ZT_ALARM_YELLOW)
+ if (s.alarms & DAHDI_ALARM_YELLOW)
strcat(alarms, "YEL/");
- if (s.alarms & ZT_ALARM_RED)
+ if (s.alarms & DAHDI_ALARM_RED)
strcat(alarms, "RED/");
- if (s.alarms & ZT_ALARM_LOOPBACK)
+ if (s.alarms & DAHDI_ALARM_LOOPBACK)
strcat(alarms, "LB/");
- if (s.alarms & ZT_ALARM_RECOVER)
+ if (s.alarms & DAHDI_ALARM_RECOVER)
strcat(alarms, "REC/");
- if (s.alarms & ZT_ALARM_NOTOPEN)
+ if (s.alarms & DAHDI_ALARM_NOTOPEN)
strcat(alarms, "NOP/");
if (!strlen(alarms))
strcat(alarms, "UUU/");
@@ -10198,66 +10221,96 @@ static int zap_show_status(int fd, int argc, char *argv[]) {
}
static char show_channels_usage[] =
- "Usage: zap show channels\n"
+ "Usage: dahdi show channels\n"
" Shows a list of available channels\n";
static char show_channel_usage[] =
- "Usage: zap show channel <chan num>\n"
+ "Usage: dahdi show channel <chan num>\n"
" Detailed information about a given channel\n";
-static char zap_show_status_usage[] =
- "Usage: zap show status\n"
- " Shows a list of Zaptel cards with status\n";
+static char dahdi_show_status_usage[] =
+ "Usage: dahdi show status\n"
+ " Shows a list of DAHDI cards with status\n";
static char destroy_channel_usage[] =
- "Usage: zap destroy channel <chan num>\n"
+ "Usage: dahdi destroy channel <chan num>\n"
" DON'T USE THIS UNLESS YOU KNOW WHAT YOU ARE DOING. Immediately removes a given channel, whether it is in use or not\n";
-static char zap_restart_usage[] =
- "Usage: zap restart\n"
- " Restarts the zaptel channels: destroys them all and then\n"
- " re-reads them from zapata.conf.\n"
- " Note that this will STOP any running CALL on zaptel channels.\n"
+static char dahdi_restart_usage[] =
+ "Usage: dahdi restart\n"
+ " Restarts the DAHDI channels: destroys them all and then\n"
+ " re-reads them from chan_dahdi.conf.\n"
+ " Note that this will STOP any running CALL on DAHDI channels.\n"
"";
-static struct ast_cli_entry zap_cli[] = {
- { { "zap", "show", "cadences", NULL },
- handle_zap_show_cadences, "List cadences",
- zap_show_cadences_help },
-
- { { "zap", "show", "channels", NULL},
- zap_show_channels, "Show active zapata channels",
- show_channels_usage },
-
- { { "zap", "show", "channel", NULL},
- zap_show_channel, "Show information on a channel",
- show_channel_usage },
-
- { { "zap", "destroy", "channel", NULL},
- zap_destroy_channel, "Destroy a channel",
- destroy_channel_usage },
-
- { { "zap", "restart", NULL},
- zap_restart_cmd, "Fully restart zaptel channels",
- zap_restart_usage },
-
- { { "zap", "show", "status", NULL},
- zap_show_status, "Show all Zaptel cards status",
- zap_show_status_usage },
+static struct ast_cli_entry cli_zap_show_cadences_deprecated = {
+ { "zap", "show", "cadences", NULL },
+ handle_dahdi_show_cadences, NULL,
+ NULL };
+
+static struct ast_cli_entry cli_zap_show_channels_deprecated = {
+ { "zap", "show", "channels", NULL },
+ dahdi_show_channels, NULL,
+ NULL };
+
+static struct ast_cli_entry cli_zap_show_channel_deprecated = {
+ { "zap", "show", "channel", NULL },
+ dahdi_show_channel, NULL,
+ NULL };
+
+static struct ast_cli_entry cli_zap_destroy_channel_deprecated = {
+ { "zap", "destroy", "channel", NULL },
+ dahdi_destroy_channel, NULL,
+ NULL };
+
+static struct ast_cli_entry cli_zap_restart_deprecated = {
+ { "zap", "restart", NULL },
+ dahdi_restart_cmd, NULL,
+ NULL };
+
+static struct ast_cli_entry cli_zap_show_status_deprecated = {
+ { "zap", "show", "status", NULL },
+ dahdi_show_status, NULL,
+ NULL };
+
+static struct ast_cli_entry dahdi_cli[] = {
+ { { "dahdi", "show", "cadences", NULL },
+ handle_dahdi_show_cadences, "List cadences",
+ dahdi_show_cadences_usage, NULL, &cli_zap_show_cadences_deprecated },
+
+ { { "dahdi", "show", "channels", NULL},
+ dahdi_show_channels, "Show active DAHDI channels",
+ show_channels_usage, NULL, &cli_zap_show_channels_deprecated },
+
+ { { "dahdi", "show", "channel", NULL},
+ dahdi_show_channel, "Show information on a channel",
+ show_channel_usage, NULL, &cli_zap_show_channel_deprecated },
+
+ { { "dahdi", "destroy", "channel", NULL},
+ dahdi_destroy_channel, "Destroy a channel",
+ destroy_channel_usage, NULL, &cli_zap_destroy_channel_deprecated },
+
+ { { "dahdi", "restart", NULL},
+ dahdi_restart_cmd, "Fully restart DAHDI channels",
+ dahdi_restart_usage, NULL, &cli_zap_restart_deprecated },
+
+ { { "dahdi", "show", "status", NULL},
+ dahdi_show_status, "Show all DAHDI cards status",
+ dahdi_show_status_usage, NULL, &cli_zap_show_status_deprecated },
};
#define TRANSFER 0
#define HANGUP 1
-static int zap_fake_event(struct zt_pvt *p, int mode)
+static int dahdi_fake_event(struct dahdi_pvt *p, int mode)
{
if (p) {
switch (mode) {
case TRANSFER:
- p->fake_event = ZT_EVENT_WINKFLASH;
+ p->fake_event = DAHDI_EVENT_WINKFLASH;
break;
case HANGUP:
- p->fake_event = ZT_EVENT_ONHOOK;
+ p->fake_event = DAHDI_EVENT_ONHOOK;
break;
default:
ast_log(LOG_WARNING, "I don't know how to handle transfer event with this: %d on channel %s\n",mode, p->owner->name);
@@ -10265,9 +10318,9 @@ static int zap_fake_event(struct zt_pvt *p, int mode)
}
return 0;
}
-static struct zt_pvt *find_channel(int channel)
+static struct dahdi_pvt *find_channel(int channel)
{
- struct zt_pvt *p = iflist;
+ struct dahdi_pvt *p = iflist;
while (p) {
if (p->channel == channel) {
break;
@@ -10277,10 +10330,10 @@ static struct zt_pvt *find_channel(int channel)
return p;
}
-static int action_zapdndon(struct mansession *s, const struct message *m)
+static int action_dahdidndon(struct mansession *s, const struct message *m)
{
- struct zt_pvt *p = NULL;
- const char *channel = astman_get_header(m, "ZapChannel");
+ struct dahdi_pvt *p = NULL;
+ const char *channel = astman_get_header(m, "DAHDIChannel");
if (ast_strlen_zero(channel)) {
astman_send_error(s, m, "No channel specified");
@@ -10296,10 +10349,10 @@ static int action_zapdndon(struct mansession *s, const struct message *m)
return 0;
}
-static int action_zapdndoff(struct mansession *s, const struct message *m)
+static int action_dahdidndoff(struct mansession *s, const struct message *m)
{
- struct zt_pvt *p = NULL;
- const char *channel = astman_get_header(m, "ZapChannel");
+ struct dahdi_pvt *p = NULL;
+ const char *channel = astman_get_header(m, "DAHDIChannel");
if (ast_strlen_zero(channel)) {
astman_send_error(s, m, "No channel specified");
@@ -10317,8 +10370,8 @@ static int action_zapdndoff(struct mansession *s, const struct message *m)
static int action_transfer(struct mansession *s, const struct message *m)
{
- struct zt_pvt *p = NULL;
- const char *channel = astman_get_header(m, "ZapChannel");
+ struct dahdi_pvt *p = NULL;
+ const char *channel = astman_get_header(m, "DAHDIChannel");
if (ast_strlen_zero(channel)) {
astman_send_error(s, m, "No channel specified");
@@ -10329,15 +10382,15 @@ static int action_transfer(struct mansession *s, const struct message *m)
astman_send_error(s, m, "No such channel");
return 0;
}
- zap_fake_event(p,TRANSFER);
- astman_send_ack(s, m, "ZapTransfer");
+ dahdi_fake_event(p,TRANSFER);
+ astman_send_ack(s, m, "DAHDITransfer");
return 0;
}
static int action_transferhangup(struct mansession *s, const struct message *m)
{
- struct zt_pvt *p = NULL;
- const char *channel = astman_get_header(m, "ZapChannel");
+ struct dahdi_pvt *p = NULL;
+ const char *channel = astman_get_header(m, "DAHDIChannel");
if (ast_strlen_zero(channel)) {
astman_send_error(s, m, "No channel specified");
@@ -10348,15 +10401,15 @@ static int action_transferhangup(struct mansession *s, const struct message *m)
astman_send_error(s, m, "No such channel");
return 0;
}
- zap_fake_event(p,HANGUP);
- astman_send_ack(s, m, "ZapHangup");
+ dahdi_fake_event(p,HANGUP);
+ astman_send_ack(s, m, "DAHDIHangup");
return 0;
}
-static int action_zapdialoffhook(struct mansession *s, const struct message *m)
+static int action_dahdidialoffhook(struct mansession *s, const struct message *m)
{
- struct zt_pvt *p = NULL;
- const char *channel = astman_get_header(m, "ZapChannel");
+ struct dahdi_pvt *p = NULL;
+ const char *channel = astman_get_header(m, "DAHDIChannel");
const char *number = astman_get_header(m, "Number");
int i;
@@ -10379,19 +10432,19 @@ static int action_zapdialoffhook(struct mansession *s, const struct message *m)
}
for (i = 0; i < strlen(number); i++) {
struct ast_frame f = { AST_FRAME_DTMF, number[i] };
- zap_queue_frame(p, &f, NULL);
+ dahdi_queue_frame(p, &f, NULL);
}
- astman_send_ack(s, m, "ZapDialOffhook");
+ astman_send_ack(s, m, "DAHDIDialOffhook");
return 0;
}
-static int action_zapshowchannels(struct mansession *s, const struct message *m)
+static int action_dahdishowchannels(struct mansession *s, const struct message *m)
{
- struct zt_pvt *tmp = NULL;
+ struct dahdi_pvt *tmp = NULL;
const char *id = astman_get_header(m, "ActionID");
char idText[256] = "";
- astman_send_ack(s, m, "Zapata channel status will follow");
+ astman_send_ack(s, m, "DAHDI channel status will follow");
if (!ast_strlen_zero(id))
snprintf(idText, sizeof(idText) - 1, "ActionID: %s\r\n", id);
@@ -10402,7 +10455,7 @@ static int action_zapshowchannels(struct mansession *s, const struct message *m)
if (tmp->channel > 0) {
int alarm = get_alarms(tmp);
astman_append(s,
- "Event: ZapShowChannels\r\n"
+ "Event: DAHDIShowChannels\r\n"
"Channel: %d\r\n"
"Signalling: %s\r\n"
"Context: %s\r\n"
@@ -10421,7 +10474,7 @@ static int action_zapshowchannels(struct mansession *s, const struct message *m)
ast_mutex_unlock(&iflock);
astman_append(s,
- "Event: ZapShowChannelsComplete\r\n"
+ "Event: DAHDIShowChannelsComplete\r\n"
"%s"
"\r\n",
idText);
@@ -10431,7 +10484,7 @@ static int action_zapshowchannels(struct mansession *s, const struct message *m)
static int __unload_module(void)
{
int x;
- struct zt_pvt *p, *pl;
+ struct dahdi_pvt *p, *pl;
#ifdef HAVE_PRI
int i;
@@ -10439,18 +10492,18 @@ static int __unload_module(void)
if (pris[i].master != AST_PTHREADT_NULL)
pthread_cancel(pris[i].master);
}
- ast_cli_unregister_multiple(zap_pri_cli, sizeof(zap_pri_cli) / sizeof(struct ast_cli_entry));
- ast_unregister_application(zap_send_keypad_facility_app);
+ ast_cli_unregister_multiple(dahdi_pri_cli, sizeof(dahdi_pri_cli) / sizeof(struct ast_cli_entry));
+ ast_unregister_application(dahdi_send_keypad_facility_app);
#endif
- ast_cli_unregister_multiple(zap_cli, sizeof(zap_cli) / sizeof(struct ast_cli_entry));
- ast_manager_unregister( "ZapDialOffhook" );
- ast_manager_unregister( "ZapHangup" );
- ast_manager_unregister( "ZapTransfer" );
- ast_manager_unregister( "ZapDNDoff" );
- ast_manager_unregister( "ZapDNDon" );
- ast_manager_unregister("ZapShowChannels");
- ast_manager_unregister("ZapRestart");
- ast_channel_unregister(&zap_tech);
+ ast_cli_unregister_multiple(dahdi_cli, sizeof(dahdi_cli) / sizeof(struct ast_cli_entry));
+ ast_manager_unregister( "DAHDIDialOffhook" );
+ ast_manager_unregister( "DAHDIHangup" );
+ ast_manager_unregister( "DAHDITransfer" );
+ ast_manager_unregister( "DAHDIDNDoff" );
+ ast_manager_unregister( "DAHDIDNDon" );
+ ast_manager_unregister("DAHDIShowChannels");
+ ast_manager_unregister("DAHDIRestart");
+ ast_channel_unregister(&dahdi_tech);
ast_mutex_lock(&iflock);
/* Hangup all interfaces if they have an owner */
p = iflist;
@@ -10476,15 +10529,15 @@ static int __unload_module(void)
/* Free any callerid */
if (p->cidspill)
free(p->cidspill);
- /* Close the zapata thingy */
- if (p->subs[SUB_REAL].zfd > -1)
- zt_close(p->subs[SUB_REAL].zfd);
+ /* Close the DAHDI thingy */
+ if (p->subs[SUB_REAL].dfd > -1)
+ dahdi_close(p->subs[SUB_REAL].dfd);
pl = p;
p = p->next;
x = pl->channel;
/* Free associated memory */
if (pl)
- destroy_zt_pvt(&pl);
+ destroy_dahdi_pvt(&pl);
ast_verbose(VERBOSE_PREFIX_3 "Unregistered channel %d\n", x);
}
iflist = NULL;
@@ -10494,7 +10547,7 @@ static int __unload_module(void)
for (i = 0; i < NUM_SPANS; i++) {
if (pris[i].master && (pris[i].master != AST_PTHREADT_NULL))
pthread_join(pris[i].master, NULL);
- zt_close(pris[i].fds[i]);
+ dahdi_close(pris[i].fds[i]);
}
#endif
return 0;
@@ -10510,13 +10563,13 @@ static int unload_module(void)
return __unload_module();
}
-static int build_channels(struct zt_chan_conf *conf, int iscrv, const char *value, int reload, int lineno, int *found_pseudo)
+static int build_channels(struct dahdi_chan_conf *conf, int iscrv, const char *value, int reload, int lineno, int *found_pseudo)
{
char *c, *chan;
int x, start, finish;
- struct zt_pvt *tmp;
+ struct dahdi_pvt *tmp;
#ifdef HAVE_PRI
- struct zt_pri *pri;
+ struct dahdi_pri *pri;
int trunkgroup, y;
#endif
@@ -10600,16 +10653,16 @@ static int build_channels(struct zt_chan_conf *conf, int iscrv, const char *valu
return 0;
}
-/** The length of the parameters list of 'zapchan'.
+/** The length of the parameters list of 'dahdichan'.
* \todo Move definition of MAX_CHANLIST_LEN to a proper place. */
#define MAX_CHANLIST_LEN 80
-static int process_zap(struct zt_chan_conf *confp, struct ast_variable *v, int reload, int skipchannels)
+static int process_dahdi(struct dahdi_chan_conf *confp, struct ast_variable *v, int reload, int skipchannels)
{
- struct zt_pvt *tmp;
+ struct dahdi_pvt *tmp;
char *ringc; /* temporary string for parsing the dring number. */
int y;
int found_pseudo = 0;
- char zapchan[MAX_CHANLIST_LEN] = {};
+ char dahdichan[MAX_CHANLIST_LEN] = {};
for (; v; v = v->next) {
if (!ast_jb_read_conf(&global_jbconf, v->name, v->value))
@@ -10627,8 +10680,8 @@ static int process_zap(struct zt_chan_conf *confp, struct ast_variable *v, int r
iscrv = !strcasecmp(v->name, "crv");
if (build_channels(confp, iscrv, v->value, reload, v->lineno, &found_pseudo))
return -1;
- } else if (!strcasecmp(v->name, "zapchan")) {
- ast_copy_string(zapchan, v->value, sizeof(zapchan));
+ } else if (!strcasecmp(v->name, "dahdichan")) {
+ ast_copy_string(dahdichan, v->value, sizeof(dahdichan));
} else if (!strcasecmp(v->name, "usedistinctiveringdetection")) {
if (ast_true(v->value))
confp->chan.usedistinctiveringdetection = 1;
@@ -10802,8 +10855,8 @@ static int process_zap(struct zt_chan_conf *confp, struct ast_variable *v, int r
ast_copy_string(confp->chan.cid_name, v->value, sizeof(confp->chan.cid_name));
} else if (!strcasecmp(v->name, "cid_number")) {
ast_copy_string(confp->chan.cid_num, v->value, sizeof(confp->chan.cid_num));
- } else if (!strcasecmp(v->name, "useincomingcalleridonzaptransfer")) {
- confp->chan.zaptrcallerid = ast_true(v->value);
+ } else if (!strcasecmp(v->name, "useincomingcalleridondahditransfer")) {
+ confp->chan.dahditrcallerid = ast_true(v->value);
} else if (!strcasecmp(v->name, "restrictcid")) {
confp->chan.restrictcid = ast_true(v->value);
} else if (!strcasecmp(v->name, "usecallingpres")) {
@@ -11116,7 +11169,7 @@ static int process_zap(struct zt_chan_conf *confp, struct ast_variable *v, int r
/* setup to scan our argument */
int element_count, c[16] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
int i;
- struct zt_ring_cadence new_cadence;
+ struct dahdi_ring_cadence new_cadence;
int cid_location = -1;
int firstcadencepos = 0;
char original_args[80];
@@ -11152,7 +11205,7 @@ static int process_zap(struct zt_chan_conf *confp, struct ast_variable *v, int r
} else {
if (firstcadencepos == 0) {
firstcadencepos = i; /* only recorded to avoid duplicate specification */
- /* duration will be passed negative to the zaptel driver */
+ /* duration will be passed negative to the DAHDI driver */
} else {
ast_log(LOG_ERROR, "First cadence position specified twice: %s\n",original_args);
cadence_is_ok = 0;
@@ -11215,11 +11268,16 @@ static int process_zap(struct zt_chan_conf *confp, struct ast_variable *v, int r
int toneduration;
int ctlfd;
int res;
- struct zt_dialparams dps;
+ DAHDI_DIAL_PARAMS dps;
+#ifdef HAVE_ZAPTEL
ctlfd = open("/dev/zap/ctl", O_RDWR);
+#else
+ ctlfd = open("/dev/dahdi/ctl", O_RDWR);
+#endif
+
if (ctlfd == -1) {
- ast_log(LOG_ERROR, "Unable to open /dev/zap/ctl to set toneduration\n");
+ ast_log(LOG_ERROR, "Unable to open /dev/dahdi/ctl to set toneduration\n");
return -1;
}
@@ -11228,7 +11286,7 @@ static int process_zap(struct zt_chan_conf *confp, struct ast_variable *v, int r
memset(&dps, 0, sizeof(dps));
dps.dtmf_tonelen = dps.mfv1_tonelen = toneduration;
- res = ioctl(ctlfd, ZT_SET_DIALPARAMS, &dps);
+ res = ioctl(ctlfd, DAHDI_SET_DIALPARAMS, &dps);
if (res < 0) {
ast_log(LOG_ERROR, "Invalid tone duration: %d ms\n", toneduration);
return -1;
@@ -11243,10 +11301,10 @@ static int process_zap(struct zt_chan_conf *confp, struct ast_variable *v, int r
} else if (!skipchannels)
ast_log(LOG_WARNING, "Ignoring %s\n", v->name);
}
- if (zapchan[0]) {
- /* The user has set 'zapchan' */
+ if (dahdichan[0]) {
+ /* The user has set 'dahdichan' */
/*< \todo pass proper line number instead of 0 */
- if (build_channels(confp, 0, zapchan, reload, 0, &found_pseudo)) {
+ if (build_channels(confp, 0, dahdichan, reload, 0, &found_pseudo)) {
return -1;
}
}
@@ -11272,11 +11330,11 @@ static int process_zap(struct zt_chan_conf *confp, struct ast_variable *v, int r
return 0;
}
-static int setup_zap(int reload)
+static int setup_dahdi(int reload)
{
struct ast_config *cfg;
struct ast_variable *v;
- struct zt_chan_conf conf = zt_chan_conf_default();
+ struct dahdi_chan_conf conf = dahdi_chan_conf_default();
int res;
#ifdef HAVE_PRI
@@ -11290,10 +11348,14 @@ static int setup_zap(int reload)
cfg = ast_config_load(config);
- /* Error if we have no config file */
+ /* Error if we have no chan_dahdi config file... */
if (!cfg) {
- ast_log(LOG_ERROR, "Unable to load config %s\n", config);
- return 0;
+ /* ...so try and load zapata.conf */
+ cfg = ast_config_load("zapata.conf");
+ if (!cfg) {
+ ast_log(LOG_ERROR, "Unable to load either config %s or zapata.conf\n", config);
+ return 0;
+ }
}
/* It's a little silly to lock it, but we mind as well just to be sure */
@@ -11312,22 +11374,22 @@ static int setup_zap(int reload)
while (c && (i < NUM_DCHANS)) {
dchannels[i] = atoi(c + 1);
if (dchannels[i] < 0) {
- ast_log(LOG_WARNING, "D-channel for trunk group %d must be a postiive number at line %d of zapata.conf\n", trunkgroup, v->lineno);
+ ast_log(LOG_WARNING, "D-channel for trunk group %d must be a postiive number at line %d of chan_dahdi.conf\n", trunkgroup, v->lineno);
} else
i++;
c = strchr(c + 1, ',');
}
if (i) {
if (pri_create_trunkgroup(trunkgroup, dchannels)) {
- ast_log(LOG_WARNING, "Unable to create trunk group %d with Primary D-channel %d at line %d of zapata.conf\n", trunkgroup, dchannels[0], v->lineno);
+ ast_log(LOG_WARNING, "Unable to create trunk group %d with Primary D-channel %d at line %d of chan_dahdi.conf\n", trunkgroup, dchannels[0], v->lineno);
} else if (option_verbose > 1)
ast_verbose(VERBOSE_PREFIX_2 "Created trunk group %d with Primary D-channel %d and %d backup%s\n", trunkgroup, dchannels[0], i - 1, (i == 1) ? "" : "s");
} else
- ast_log(LOG_WARNING, "Trunk group %d lacks any valid D-channels at line %d of zapata.conf\n", trunkgroup, v->lineno);
+ ast_log(LOG_WARNING, "Trunk group %d lacks any valid D-channels at line %d of chan_dahdi.conf\n", trunkgroup, v->lineno);
} else
- ast_log(LOG_WARNING, "Trunk group %d lacks a primary D-channel at line %d of zapata.conf\n", trunkgroup, v->lineno);
+ ast_log(LOG_WARNING, "Trunk group %d lacks a primary D-channel at line %d of chan_dahdi.conf\n", trunkgroup, v->lineno);
} else
- ast_log(LOG_WARNING, "Trunk group identifier must be a positive integer at line %d of zapata.conf\n", v->lineno);
+ ast_log(LOG_WARNING, "Trunk group identifier must be a positive integer at line %d of chan_dahdi.conf\n", v->lineno);
} else if (!strcasecmp(v->name, "spanmap")) {
spanno = atoi(v->value);
if (spanno > 0) {
@@ -11344,13 +11406,13 @@ static int setup_zap(int reload)
} else if (option_verbose > 1)
ast_verbose(VERBOSE_PREFIX_2 "Mapped span %d to trunk group %d (logical span %d)\n", spanno, trunkgroup, logicalspan);
} else
- ast_log(LOG_WARNING, "Logical span must be a postive number, or '0' (for unspecified) at line %d of zapata.conf\n", v->lineno);
+ ast_log(LOG_WARNING, "Logical span must be a postive number, or '0' (for unspecified) at line %d of chan_dahdi.conf\n", v->lineno);
} else
- ast_log(LOG_WARNING, "Trunk group must be a postive number at line %d of zapata.conf\n", v->lineno);
+ ast_log(LOG_WARNING, "Trunk group must be a postive number at line %d of chan_dahdi.conf\n", v->lineno);
} else
- ast_log(LOG_WARNING, "Missing trunk group for span map at line %d of zapata.conf\n", v->lineno);
+ ast_log(LOG_WARNING, "Missing trunk group for span map at line %d of chan_dahdi.conf\n", v->lineno);
} else
- ast_log(LOG_WARNING, "Span number must be a postive integer at line %d of zapata.conf\n", v->lineno);
+ ast_log(LOG_WARNING, "Span number must be a postive integer at line %d of chan_dahdi.conf\n", v->lineno);
} else {
ast_log(LOG_NOTICE, "Ignoring unknown keyword '%s' in trunkgroups\n", v->name);
}
@@ -11363,7 +11425,7 @@ static int setup_zap(int reload)
memcpy(&global_jbconf, &default_jbconf, sizeof(struct ast_jb_conf));
v = ast_variable_browse(cfg, "channels");
- res = process_zap(&conf, v, reload, 0);
+ res = process_dahdi(&conf, v, reload, 0);
ast_mutex_unlock(&iflock);
ast_config_destroy(cfg);
if (res)
@@ -11372,16 +11434,16 @@ static int setup_zap(int reload)
if (cfg) {
char *cat;
const char *chans;
- process_zap(&conf, ast_variable_browse(cfg, "general"), 1, 1);
+ process_dahdi(&conf, ast_variable_browse(cfg, "general"), 1, 1);
for (cat = ast_category_browse(cfg, NULL); cat ; cat = ast_category_browse(cfg, cat)) {
if (!strcasecmp(cat, "general"))
continue;
- chans = ast_variable_retrieve(cfg, cat, "zapchan");
+ chans = ast_variable_retrieve(cfg, cat, "dahdichan");
if (!ast_strlen_zero(chans)) {
- struct zt_chan_conf sect_conf;
+ struct dahdi_chan_conf sect_conf;
memcpy(&sect_conf, &conf, sizeof(sect_conf));
- process_zap(&sect_conf, ast_variable_browse(cfg, cat), reload, 0);
+ process_dahdi(&sect_conf, ast_variable_browse(cfg, cat), reload, 0);
}
}
ast_config_destroy(cfg);
@@ -11418,40 +11480,40 @@ static int load_module(void)
for (i = 0; i < NUM_DCHANS; i++)
pris[y].fds[i] = -1;
}
- pri_set_error(zt_pri_error);
- pri_set_message(zt_pri_message);
- ast_register_application(zap_send_keypad_facility_app, zap_send_keypad_facility_exec,
- zap_send_keypad_facility_synopsis, zap_send_keypad_facility_descrip);
+ pri_set_error(dahdi_pri_error);
+ pri_set_message(dahdi_pri_message);
+ ast_register_application(dahdi_send_keypad_facility_app, dahdi_send_keypad_facility_exec,
+ dahdi_send_keypad_facility_synopsis, dahdi_send_keypad_facility_descrip);
#endif
- res = setup_zap(0);
- /* Make sure we can register our Zap channel type */
+ res = setup_dahdi(0);
+ /* Make sure we can register our DAHDI channel type */
if (res)
return AST_MODULE_LOAD_DECLINE;
- if (ast_channel_register(&zap_tech)) {
- ast_log(LOG_ERROR, "Unable to register channel class 'Zap'\n");
+ if (ast_channel_register(&dahdi_tech)) {
+ ast_log(LOG_ERROR, "Unable to register channel class 'DAHDI'\n");
__unload_module();
return -1;
}
#ifdef HAVE_PRI
ast_string_field_init(&inuse, 16);
ast_string_field_set(&inuse, name, "GR-303InUse");
- ast_cli_register_multiple(zap_pri_cli, sizeof(zap_pri_cli) / sizeof(struct ast_cli_entry));
+ ast_cli_register_multiple(dahdi_pri_cli, sizeof(dahdi_pri_cli) / sizeof(struct ast_cli_entry));
#endif
- ast_cli_register_multiple(zap_cli, sizeof(zap_cli) / sizeof(struct ast_cli_entry));
+ ast_cli_register_multiple(dahdi_cli, sizeof(dahdi_cli) / sizeof(struct ast_cli_entry));
memset(round_robin, 0, sizeof(round_robin));
- ast_manager_register( "ZapTransfer", 0, action_transfer, "Transfer Zap Channel" );
- ast_manager_register( "ZapHangup", 0, action_transferhangup, "Hangup Zap Channel" );
- ast_manager_register( "ZapDialOffhook", 0, action_zapdialoffhook, "Dial over Zap channel while offhook" );
- ast_manager_register( "ZapDNDon", 0, action_zapdndon, "Toggle Zap channel Do Not Disturb status ON" );
- ast_manager_register( "ZapDNDoff", 0, action_zapdndoff, "Toggle Zap channel Do Not Disturb status OFF" );
- ast_manager_register("ZapShowChannels", 0, action_zapshowchannels, "Show status zapata channels");
- ast_manager_register("ZapRestart", 0, action_zaprestart, "Fully Restart zaptel channels (terminates calls)");
+ ast_manager_register("DAHDITransfer", 0, action_transfer, "Transfer DAHDI Channel" );
+ ast_manager_register("DAHDIHangup", 0, action_transferhangup, "Hangup DAHDI Channel" );
+ ast_manager_register("DAHDIDialOffhook", 0, action_dahdidialoffhook, "Dial over DAHDI channel while offhook" );
+ ast_manager_register("DAHDIDNDon", 0, action_dahdidndon, "Toggle DAHDI channel Do Not Disturb status ON" );
+ ast_manager_register("DAHDIDNDoff", 0, action_dahdidndoff, "Toggle DAHDI channel Do Not Disturb status OFF" );
+ ast_manager_register("DAHDIShowChannels", 0, action_dahdishowchannels, "Show status DAHDI channels");
+ ast_manager_register("DAHDIRestart", 0, action_dahdirestart, "Fully Restart DAHDI channels (terminates calls)");
return res;
}
-static int zt_sendtext(struct ast_channel *c, const char *text)
+static int dahdi_sendtext(struct ast_channel *c, const char *text)
{
#define END_SILENCE_LEN 400
#define HEADER_MS 50
@@ -11460,7 +11522,7 @@ static int zt_sendtext(struct ast_channel *c, const char *text)
#define ASCII_BYTES_PER_CHAR 80
unsigned char *buf,*mybuf;
- struct zt_pvt *p = c->tech_pvt;
+ struct dahdi_pvt *p = c->tech_pvt;
struct pollfd fds[1];
int size,res,fd,len,x;
int bytes=0;
@@ -11470,7 +11532,7 @@ static int zt_sendtext(struct ast_channel *c, const char *text)
float scont = 0.0;
int index;
- index = zt_get_index(c, p, 0);
+ index = dahdi_get_index(c, p, 0);
if (index < 0) {
ast_log(LOG_WARNING, "Huh? I don't exist?\n");
return -1;
@@ -11508,7 +11570,7 @@ static int zt_sendtext(struct ast_channel *c, const char *text)
}
memset(buf + len, 0x7f, END_SILENCE_LEN);
len += END_SILENCE_LEN;
- fd = p->subs[index].zfd;
+ fd = p->subs[index].dfd;
while (len) {
if (ast_check_hangup(c)) {
free(mybuf);
@@ -11556,22 +11618,22 @@ static int reload(void)
{
int res = 0;
- res = setup_zap(1);
+ res = setup_dahdi(1);
if (res) {
- ast_log(LOG_WARNING, "Reload of chan_zap.so is unsuccessful!\n");
+ ast_log(LOG_WARNING, "Reload of chan_dahdi.so is unsuccessful!\n");
return -1;
}
return 0;
}
/* This is a workaround so that menuselect displays a proper description
- * AST_MODULE_INFO(, , "Zapata Telephony"
+ * AST_MODULE_INFO(, , "DAHDI Telephony"
*/
-#ifdef ZAPATA_PRI
-#define tdesc "Zapata Telephony w/PRI"
+#ifdef DAHDI_PRI
+#define tdesc "DAHDI Telephony w/PRI"
#else
-#define tdesc "Zapata Telephony"
+#define tdesc "DAHDI Telephony"
#endif
AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_DEFAULT, tdesc,
diff --git a/channels/chan_iax2.c b/channels/chan_iax2.c
index 9e0e9a388..4f40bd28c 100644
--- a/channels/chan_iax2.c
+++ b/channels/chan_iax2.c
@@ -29,7 +29,7 @@
*/
/*** MODULEINFO
- <use>zaptel</use>
+ <use>dahdi</use>
<depend>res_features</depend>
***/
@@ -59,9 +59,9 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
#include <sys/stat.h>
#include <regex.h>
-#ifdef HAVE_ZAPTEL
+#if defined(HAVE_ZAPTEL) || defined (HAVE_DAHDI)
#include <sys/ioctl.h>
-#include <zaptel/zaptel.h>
+#include "asterisk/dahdi_compat.h"
#endif
#include "asterisk/lock.h"
@@ -6538,7 +6538,7 @@ static int timing_read(int *id, int fd, short events, void *cbdata)
struct iax2_trunk_peer *tpeer, *prev = NULL, *drop=NULL;
int processed = 0;
int totalcalls = 0;
-#ifdef ZT_TIMERACK
+#ifdef DAHDI_TIMERACK
int x = 1;
#endif
struct timeval now;
@@ -6546,9 +6546,9 @@ static int timing_read(int *id, int fd, short events, void *cbdata)
ast_verbose("Beginning trunk processing. Trunk queue ceiling is %d bytes per host\n", MAX_TRUNKDATA);
gettimeofday(&now, NULL);
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)) {
+ if (ioctl(fd, DAHDI_TIMERACK, &x)) {
ast_log(LOG_WARNING, "Unable to acknowledge zap timer. IAX trunking will fail!\n");
usleep(1);
return -1;
@@ -9810,14 +9810,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
@@ -11093,14 +11093,22 @@ static int load_module(void)
jb_setoutput(jb_error_output, jb_warning_output, NULL);
#ifdef HAVE_ZAPTEL
-#ifdef ZT_TIMERACK
+#ifdef ZAPTEL_TIMERACK
timingfd = open("/dev/zap/timer", O_RDWR);
if (timingfd < 0)
#endif
timingfd = open("/dev/zap/pseudo", O_RDWR);
if (timingfd < 0)
ast_log(LOG_WARNING, "Unable to open IAX timing interface: %s\n", strerror(errno));
-#endif
+#elif defined(HAVE_DAHDI)
+#ifdef DAHDI_TIMERACK
+ timingfd = open("/dev/dahdi/timer", O_RDWR);
+ if (timingfd < 0)
+#endif
+ 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
memset(iaxs, 0, sizeof(iaxs));
diff --git a/channels/chan_mgcp.c b/channels/chan_mgcp.c
index 5bc1afd99..0a76c02cd 100644
--- a/channels/chan_mgcp.c
+++ b/channels/chan_mgcp.c
@@ -2677,7 +2677,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)) {
@@ -2689,7 +2689,7 @@ static void *mgcp_ss(void *data)
ast_verbose(VERBOSE_PREFIX_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;
@@ -2698,7 +2698,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;
@@ -2720,7 +2720,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");
}
@@ -2733,7 +2733,7 @@ static void *mgcp_ss(void *data)
}
} else if (res == 0) {
ast_log(LOG_DEBUG, "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);*/
ast_hangup(chan);
@@ -2745,7 +2745,7 @@ static void *mgcp_ss(void *data)
}
/* 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));
@@ -2757,7 +2757,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));
@@ -2770,7 +2770,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));
@@ -2781,7 +2781,7 @@ 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")) {
@@ -2789,7 +2789,7 @@ static void *mgcp_ss(void *data)
if (option_verbose > 2) {
ast_verbose(VERBOSE_PREFIX_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;
@@ -2800,14 +2800,14 @@ static void *mgcp_ss(void *data)
if (option_verbose > 2) {
ast_verbose(VERBOSE_PREFIX_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));
@@ -2816,7 +2816,7 @@ static void *mgcp_ss(void *data)
if (option_verbose > 2) {
ast_verbose(VERBOSE_PREFIX_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;
@@ -2837,7 +2837,7 @@ static void *mgcp_ss(void *data)
}
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;
@@ -2849,7 +2849,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));
diff --git a/channels/chan_misdn.c b/channels/chan_misdn.c
index bb31de0ba..81e070b44 100644
--- a/channels/chan_misdn.c
+++ b/channels/chan_misdn.c
@@ -211,7 +211,7 @@ struct chan_list {
int other_pid;
struct chan_list *other_ch;
- const struct tone_zone_sound *ts;
+ const struct ind_tone_zone_sound *ts;
int overlap_dial;
int overlap_dial_task;
@@ -2989,7 +2989,7 @@ static enum ast_bridge_result misdn_bridge (struct ast_channel *c0,
static int dialtone_indicate(struct chan_list *cl)
{
- const struct tone_zone_sound *ts= NULL;
+ const struct ind_tone_zone_sound *ts= NULL;
struct ast_channel *ast=cl->ast;
int nd=0;
diff --git a/codecs/codec_zap.c b/codecs/codec_dahdi.c
index f4ea5886f..1223c9c77 100644
--- a/codecs/codec_zap.c
+++ b/codecs/codec_dahdi.c
@@ -27,8 +27,8 @@
*/
/*** MODULEINFO
- <depend>zaptel_transcode</depend>
- <depend>zaptel</depend>
+ <depend>dahdi_transcode</depend>
+ <depend>dahdi</depend>
***/
#include "asterisk.h"
@@ -44,7 +44,6 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
#include <sys/ioctl.h>
#include <errno.h>
#include <sys/mman.h>
-#include <zaptel/zaptel.h>
#include "asterisk/lock.h"
#include "asterisk/translate.h"
@@ -57,6 +56,8 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
#include "asterisk/utils.h"
#include "asterisk/linkedlists.h"
+#include "asterisk/dahdi_compat.h"
+
#define BUFFER_SAMPLES 8000
static unsigned int global_useplc = 0;
@@ -113,7 +114,7 @@ struct pvt {
int totalms;
int lasttotalms;
#endif
- struct zt_transcode_header *hdr;
+ DAHDI_TRANSCODE_HEADER *hdr;
};
static int transcoder_show(int fd, int argc, char **argv)
@@ -133,7 +134,7 @@ static int transcoder_show(int fd, int argc, char **argv)
static int zap_framein(struct ast_trans_pvt *pvt, struct ast_frame *f)
{
struct pvt *ztp = pvt->pvt;
- struct zt_transcode_header *hdr = ztp->hdr;
+ DAHDI_TRANSCODE_HEADER *hdr = ztp->hdr;
if (!f->subclass) {
/* Fake a return frame for calculation purposes */
@@ -180,7 +181,7 @@ static int zap_framein(struct ast_trans_pvt *pvt, struct ast_frame *f)
static struct ast_frame *zap_frameout(struct ast_trans_pvt *pvt)
{
struct pvt *ztp = pvt->pvt;
- struct zt_transcode_header *hdr = ztp->hdr;
+ DAHDI_TRANSCODE_HEADER *hdr = ztp->hdr;
unsigned int x;
if (ztp->fake == 2) {
@@ -219,8 +220,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(ztp->fd, DAHDI_TRANSCODE_OP, &x))
ast_log(LOG_WARNING, "Failed to transcode: %s\n", strerror(errno));
}
return NULL;
@@ -235,8 +236,8 @@ static void zap_destroy(struct ast_trans_pvt *pvt)
struct pvt *ztp = pvt->pvt;
unsigned int x;
- x = ZT_TCOP_RELEASE;
- if (ioctl(ztp->fd, ZT_TRANSCODE_OP, &x))
+ x = DAHDI_TCOP_RELEASE;
+ if (ioctl(ztp->fd, DAHDI_TRANSCODE_OP, &x))
ast_log(LOG_WARNING, "Failed to release transcoder channel: %s\n", strerror(errno));
switch (ztp->hdr->dstfmt) {
@@ -257,9 +258,9 @@ static int zap_translate(struct ast_trans_pvt *pvt, int dest, int source)
{
/* Request translation through zap if possible */
int fd;
- unsigned int x = ZT_TCOP_ALLOCATE;
+ unsigned int x = DAHDI_TCOP_ALLOCATE;
struct pvt *ztp = pvt->pvt;
- struct zt_transcode_header *hdr;
+ DAHDI_TRANSCODE_HEADER *hdr;
int flags;
if ((fd = open("/dev/zap/transcode", O_RDWR)) < 0)
@@ -278,7 +279,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);
@@ -288,7 +289,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);
@@ -441,7 +442,7 @@ static void build_translators(struct format_map *map, unsigned int dstfmts, unsi
static int find_transcoders(void)
{
- struct zt_transcode_info info = { 0, };
+ DAHDI_TRANSCODE_INFO info = { 0, };
struct format_map map = { { { 0 } } };
int fd, res;
unsigned int x, y;
@@ -451,8 +452,8 @@ static int find_transcoders(void)
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++) {
if (option_verbose > 1)
ast_verbose(VERBOSE_PREFIX_2 "Found transcoder '%s'.\n", info.name);
build_translators(&map, info.dstfmts, info.srcfmts);
diff --git a/configure b/configure
index 27028fd9d..8f3bce1a3 100755
--- a/configure
+++ b/configure
@@ -1,5 +1,5 @@
#! /bin/sh
-# From configure.ac Revision: 115341 .
+# From configure.ac Revision: 121802 .
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.61 for asterisk 1.4.
#
@@ -733,6 +733,10 @@ CURSES_LIB
CURSES_INCLUDE
CURSES_DIR
PBX_CURSES
+DAHDI_LIB
+DAHDI_INCLUDE
+DAHDI_DIR
+PBX_DAHDI
GNUTLS_LIB
GNUTLS_INCLUDE
GNUTLS_DIR
@@ -884,6 +888,7 @@ GC_CFLAGS
GC_LDFLAGS
AST_DECLARATION_AFTER_STATEMENT
AST_NO_STRICT_OVERFLOW
+PBX_ZAPTEL_TRANSCODE
GSM_INTERNAL
KDEINIT
KDEDIR
@@ -901,7 +906,6 @@ OPENH323_SUFFIX
OPENH323_BUILD
PBX_SPEEX_PREPROCESS
PBX_ZAPTEL_VLDTMF
-PBX_ZAPTEL_TRANSCODE
EDITLINE_LIB
PBX_H323
PBX_IXJUSER
@@ -1514,6 +1518,7 @@ Optional Packages:
--with-curl=PATH use cURL files in PATH
--with-cap=PATH use POSIX 1.e capabilities files in PATH
--with-curses=PATH use curses files in PATH
+ --with-dahdi=PATH use DAHDI files in PATH
--with-gnutls=PATH use GNU TLS support (used for iksemel only) files in
PATH
--with-gsm=PATH use GSM files in PATH , or 'internal'
@@ -7856,6 +7861,34 @@ PBX_CURSES=0
+DAHDI_DESCRIP="DAHDI"
+DAHDI_OPTION="dahdi"
+
+# Check whether --with-dahdi was given.
+if test "${with_dahdi+set}" = set; then
+ withval=$with_dahdi;
+case ${withval} in
+ n|no)
+ USE_DAHDI=no
+ ;;
+ y|ye|yes)
+ DAHDI_MANDATORY="yes"
+ ;;
+ *)
+ DAHDI_DIR="${withval}"
+ DAHDI_MANDATORY="yes"
+ ;;
+esac
+
+fi
+
+PBX_DAHDI=0
+
+
+
+
+
+
GNUTLS_DESCRIP="GNU TLS support (used for iksemel only)"
GNUTLS_OPTION="gnutls"
@@ -17537,6 +17570,89 @@ fi
fi
+if test "${USE_DAHDI}" != "no" ; then
+
+ if test "x${PBX_DAHDI}" != "x1"; then
+ { echo "$as_me:$LINENO: checking for DAHDI_CODE in dahdi/user.h" >&5
+echo $ECHO_N "checking for DAHDI_CODE in dahdi/user.h... $ECHO_C" >&6; }
+ saved_cppflags="${CPPFLAGS}"
+ if test "x${DAHDI_DIR}" != "x"; then
+ DAHDI_INCLUDE="-I${DAHDI_DIR}/include"
+ fi
+ CPPFLAGS="${CPPFLAGS} ${DAHDI_INCLUDE}"
+
+ cat >conftest.$ac_ext <<_ACEOF
+ /* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <dahdi/user.h>
+int
+main ()
+{
+#if defined(DAHDI_CODE)
+ int foo = 0;
+ #else
+ int foo = bar;
+ #endif
+ 0
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ { echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6; }
+ PBX_DAHDI=1
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_DAHDI 1
+_ACEOF
+
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_DAHDI_VERSION
+_ACEOF
+
+
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ CPPFLAGS="${saved_cppflags}"
+ fi
+
+
+ if test "x${PBX_DAHDI}" = "x1" ; then
+ PBX_ZAPTEL_TRANSCODE=1
+
+ fi
+fi
+
if test "x${PBX_GETIFADDRS}" != "x1" -a "${USE_GETIFADDRS}" != "no"; then
{ echo "$as_me:$LINENO: checking if \"struct ifaddrs *p; getifaddrs(&p)\" compiles using ifaddrs.h" >&5
@@ -32802,6 +32918,12 @@ if test "${host_os}" != "linux-gnu" ; then
tonezone_extra="-lm"
fi
+if test "${USE_DAHDI}" != "no" ; then
+ tonezone_dir="dahdi"
+else
+ tonezone_dir="zaptel"
+fi
+
if test "${USE_TONEZONE}" != "no"; then
pbxlibdir=""
@@ -32888,11 +33010,11 @@ fi
TONEZONE_INCLUDE="-I${TONEZONE_DIR}/include"
saved_cppflags="${CPPFLAGS}"
CPPFLAGS="${CPPFLAGS} -I${TONEZONE_DIR}/include"
- if test "xzaptel/tonezone.h" != "x" ; then
- as_ac_Header=`echo "ac_cv_header_${TONEZONE_DIR}/include/zaptel/tonezone.h" | $as_tr_sh`
+ if test "x${tonezone_dir}/tonezone.h" != "x" ; then
+ as_ac_Header=`echo "ac_cv_header_${TONEZONE_DIR}/include/${tonezone_dir}/tonezone.h" | $as_tr_sh`
if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
- { echo "$as_me:$LINENO: checking for ${TONEZONE_DIR}/include/zaptel/tonezone.h" >&5
-echo $ECHO_N "checking for ${TONEZONE_DIR}/include/zaptel/tonezone.h... $ECHO_C" >&6; }
+ { echo "$as_me:$LINENO: checking for ${TONEZONE_DIR}/include/${tonezone_dir}/tonezone.h" >&5
+echo $ECHO_N "checking for ${TONEZONE_DIR}/include/${tonezone_dir}/tonezone.h... $ECHO_C" >&6; }
if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
echo $ECHO_N "(cached) $ECHO_C" >&6
fi
@@ -32901,8 +33023,8 @@ ac_res=`eval echo '${'$as_ac_Header'}'`
echo "${ECHO_T}$ac_res" >&6; }
else
# Is the header compilable?
-{ echo "$as_me:$LINENO: checking ${TONEZONE_DIR}/include/zaptel/tonezone.h usability" >&5
-echo $ECHO_N "checking ${TONEZONE_DIR}/include/zaptel/tonezone.h usability... $ECHO_C" >&6; }
+{ echo "$as_me:$LINENO: checking ${TONEZONE_DIR}/include/${tonezone_dir}/tonezone.h usability" >&5
+echo $ECHO_N "checking ${TONEZONE_DIR}/include/${tonezone_dir}/tonezone.h usability... $ECHO_C" >&6; }
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
@@ -32910,7 +33032,7 @@ cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
$ac_includes_default
-#include <${TONEZONE_DIR}/include/zaptel/tonezone.h>
+#include <${TONEZONE_DIR}/include/${tonezone_dir}/tonezone.h>
_ACEOF
rm -f conftest.$ac_objext
if { (ac_try="$ac_compile"
@@ -32942,15 +33064,15 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
echo "${ECHO_T}$ac_header_compiler" >&6; }
# Is the header present?
-{ echo "$as_me:$LINENO: checking ${TONEZONE_DIR}/include/zaptel/tonezone.h presence" >&5
-echo $ECHO_N "checking ${TONEZONE_DIR}/include/zaptel/tonezone.h presence... $ECHO_C" >&6; }
+{ echo "$as_me:$LINENO: checking ${TONEZONE_DIR}/include/${tonezone_dir}/tonezone.h presence" >&5
+echo $ECHO_N "checking ${TONEZONE_DIR}/include/${tonezone_dir}/tonezone.h presence... $ECHO_C" >&6; }
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
-#include <${TONEZONE_DIR}/include/zaptel/tonezone.h>
+#include <${TONEZONE_DIR}/include/${tonezone_dir}/tonezone.h>
_ACEOF
if { (ac_try="$ac_cpp conftest.$ac_ext"
case "(($ac_try" in
@@ -32983,25 +33105,25 @@ echo "${ECHO_T}$ac_header_preproc" >&6; }
# So? What about this header?
case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
yes:no: )
- { echo "$as_me:$LINENO: WARNING: ${TONEZONE_DIR}/include/zaptel/tonezone.h: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: ${TONEZONE_DIR}/include/zaptel/tonezone.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
- { echo "$as_me:$LINENO: WARNING: ${TONEZONE_DIR}/include/zaptel/tonezone.h: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: ${TONEZONE_DIR}/include/zaptel/tonezone.h: proceeding with the compiler's result" >&2;}
+ { echo "$as_me:$LINENO: WARNING: ${TONEZONE_DIR}/include/${tonezone_dir}/tonezone.h: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: ${TONEZONE_DIR}/include/${tonezone_dir}/tonezone.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
+ { echo "$as_me:$LINENO: WARNING: ${TONEZONE_DIR}/include/${tonezone_dir}/tonezone.h: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: ${TONEZONE_DIR}/include/${tonezone_dir}/tonezone.h: proceeding with the compiler's result" >&2;}
ac_header_preproc=yes
;;
no:yes:* )
- { echo "$as_me:$LINENO: WARNING: ${TONEZONE_DIR}/include/zaptel/tonezone.h: present but cannot be compiled" >&5
-echo "$as_me: WARNING: ${TONEZONE_DIR}/include/zaptel/tonezone.h: present but cannot be compiled" >&2;}
- { echo "$as_me:$LINENO: WARNING: ${TONEZONE_DIR}/include/zaptel/tonezone.h: check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: ${TONEZONE_DIR}/include/zaptel/tonezone.h: check for missing prerequisite headers?" >&2;}
- { echo "$as_me:$LINENO: WARNING: ${TONEZONE_DIR}/include/zaptel/tonezone.h: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: ${TONEZONE_DIR}/include/zaptel/tonezone.h: see the Autoconf documentation" >&2;}
- { echo "$as_me:$LINENO: WARNING: ${TONEZONE_DIR}/include/zaptel/tonezone.h: section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: ${TONEZONE_DIR}/include/zaptel/tonezone.h: section \"Present But Cannot Be Compiled\"" >&2;}
- { echo "$as_me:$LINENO: WARNING: ${TONEZONE_DIR}/include/zaptel/tonezone.h: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: ${TONEZONE_DIR}/include/zaptel/tonezone.h: proceeding with the preprocessor's result" >&2;}
- { echo "$as_me:$LINENO: WARNING: ${TONEZONE_DIR}/include/zaptel/tonezone.h: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: ${TONEZONE_DIR}/include/zaptel/tonezone.h: in the future, the compiler will take precedence" >&2;}
+ { echo "$as_me:$LINENO: WARNING: ${TONEZONE_DIR}/include/${tonezone_dir}/tonezone.h: present but cannot be compiled" >&5
+echo "$as_me: WARNING: ${TONEZONE_DIR}/include/${tonezone_dir}/tonezone.h: present but cannot be compiled" >&2;}
+ { echo "$as_me:$LINENO: WARNING: ${TONEZONE_DIR}/include/${tonezone_dir}/tonezone.h: check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: ${TONEZONE_DIR}/include/${tonezone_dir}/tonezone.h: check for missing prerequisite headers?" >&2;}
+ { echo "$as_me:$LINENO: WARNING: ${TONEZONE_DIR}/include/${tonezone_dir}/tonezone.h: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: ${TONEZONE_DIR}/include/${tonezone_dir}/tonezone.h: see the Autoconf documentation" >&2;}
+ { echo "$as_me:$LINENO: WARNING: ${TONEZONE_DIR}/include/${tonezone_dir}/tonezone.h: section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: ${TONEZONE_DIR}/include/${tonezone_dir}/tonezone.h: section \"Present But Cannot Be Compiled\"" >&2;}
+ { echo "$as_me:$LINENO: WARNING: ${TONEZONE_DIR}/include/${tonezone_dir}/tonezone.h: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: ${TONEZONE_DIR}/include/${tonezone_dir}/tonezone.h: proceeding with the preprocessor's result" >&2;}
+ { echo "$as_me:$LINENO: WARNING: ${TONEZONE_DIR}/include/${tonezone_dir}/tonezone.h: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: ${TONEZONE_DIR}/include/${tonezone_dir}/tonezone.h: in the future, the compiler will take precedence" >&2;}
( cat <<\_ASBOX
## ------------------------------- ##
## Report this to www.asterisk.org ##
@@ -33010,8 +33132,8 @@ _ASBOX
) | sed "s/^/$as_me: WARNING: /" >&2
;;
esac
-{ echo "$as_me:$LINENO: checking for ${TONEZONE_DIR}/include/zaptel/tonezone.h" >&5
-echo $ECHO_N "checking for ${TONEZONE_DIR}/include/zaptel/tonezone.h... $ECHO_C" >&6; }
+{ echo "$as_me:$LINENO: checking for ${TONEZONE_DIR}/include/${tonezone_dir}/tonezone.h" >&5
+echo $ECHO_N "checking for ${TONEZONE_DIR}/include/${tonezone_dir}/tonezone.h... $ECHO_C" >&6; }
if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
@@ -33032,19 +33154,21 @@ fi
fi
CPPFLAGS="${saved_cppflags}"
else
- if test "xzaptel/tonezone.h" != "x" ; then
- if test "${ac_cv_header_zaptel_tonezone_h+set}" = set; then
- { echo "$as_me:$LINENO: checking for zaptel/tonezone.h" >&5
-echo $ECHO_N "checking for zaptel/tonezone.h... $ECHO_C" >&6; }
-if test "${ac_cv_header_zaptel_tonezone_h+set}" = set; then
+ if test "x${tonezone_dir}/tonezone.h" != "x" ; then
+ as_ac_Header=`echo "ac_cv_header_${tonezone_dir}/tonezone.h" | $as_tr_sh`
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+ { echo "$as_me:$LINENO: checking for ${tonezone_dir}/tonezone.h" >&5
+echo $ECHO_N "checking for ${tonezone_dir}/tonezone.h... $ECHO_C" >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
echo $ECHO_N "(cached) $ECHO_C" >&6
fi
-{ echo "$as_me:$LINENO: result: $ac_cv_header_zaptel_tonezone_h" >&5
-echo "${ECHO_T}$ac_cv_header_zaptel_tonezone_h" >&6; }
+ac_res=`eval echo '${'$as_ac_Header'}'`
+ { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
else
# Is the header compilable?
-{ echo "$as_me:$LINENO: checking zaptel/tonezone.h usability" >&5
-echo $ECHO_N "checking zaptel/tonezone.h usability... $ECHO_C" >&6; }
+{ echo "$as_me:$LINENO: checking ${tonezone_dir}/tonezone.h usability" >&5
+echo $ECHO_N "checking ${tonezone_dir}/tonezone.h usability... $ECHO_C" >&6; }
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
@@ -33052,7 +33176,7 @@ cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
$ac_includes_default
-#include <zaptel/tonezone.h>
+#include <${tonezone_dir}/tonezone.h>
_ACEOF
rm -f conftest.$ac_objext
if { (ac_try="$ac_compile"
@@ -33084,15 +33208,15 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
echo "${ECHO_T}$ac_header_compiler" >&6; }
# Is the header present?
-{ echo "$as_me:$LINENO: checking zaptel/tonezone.h presence" >&5
-echo $ECHO_N "checking zaptel/tonezone.h presence... $ECHO_C" >&6; }
+{ echo "$as_me:$LINENO: checking ${tonezone_dir}/tonezone.h presence" >&5
+echo $ECHO_N "checking ${tonezone_dir}/tonezone.h presence... $ECHO_C" >&6; }
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
-#include <zaptel/tonezone.h>
+#include <${tonezone_dir}/tonezone.h>
_ACEOF
if { (ac_try="$ac_cpp conftest.$ac_ext"
case "(($ac_try" in
@@ -33125,25 +33249,25 @@ echo "${ECHO_T}$ac_header_preproc" >&6; }
# So? What about this header?
case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
yes:no: )
- { echo "$as_me:$LINENO: WARNING: zaptel/tonezone.h: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: zaptel/tonezone.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
- { echo "$as_me:$LINENO: WARNING: zaptel/tonezone.h: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: zaptel/tonezone.h: proceeding with the compiler's result" >&2;}
+ { echo "$as_me:$LINENO: WARNING: ${tonezone_dir}/tonezone.h: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: ${tonezone_dir}/tonezone.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
+ { echo "$as_me:$LINENO: WARNING: ${tonezone_dir}/tonezone.h: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: ${tonezone_dir}/tonezone.h: proceeding with the compiler's result" >&2;}
ac_header_preproc=yes
;;
no:yes:* )
- { echo "$as_me:$LINENO: WARNING: zaptel/tonezone.h: present but cannot be compiled" >&5
-echo "$as_me: WARNING: zaptel/tonezone.h: present but cannot be compiled" >&2;}
- { echo "$as_me:$LINENO: WARNING: zaptel/tonezone.h: check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: zaptel/tonezone.h: check for missing prerequisite headers?" >&2;}
- { echo "$as_me:$LINENO: WARNING: zaptel/tonezone.h: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: zaptel/tonezone.h: see the Autoconf documentation" >&2;}
- { echo "$as_me:$LINENO: WARNING: zaptel/tonezone.h: section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: zaptel/tonezone.h: section \"Present But Cannot Be Compiled\"" >&2;}
- { echo "$as_me:$LINENO: WARNING: zaptel/tonezone.h: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: zaptel/tonezone.h: proceeding with the preprocessor's result" >&2;}
- { echo "$as_me:$LINENO: WARNING: zaptel/tonezone.h: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: zaptel/tonezone.h: in the future, the compiler will take precedence" >&2;}
+ { echo "$as_me:$LINENO: WARNING: ${tonezone_dir}/tonezone.h: present but cannot be compiled" >&5
+echo "$as_me: WARNING: ${tonezone_dir}/tonezone.h: present but cannot be compiled" >&2;}
+ { echo "$as_me:$LINENO: WARNING: ${tonezone_dir}/tonezone.h: check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: ${tonezone_dir}/tonezone.h: check for missing prerequisite headers?" >&2;}
+ { echo "$as_me:$LINENO: WARNING: ${tonezone_dir}/tonezone.h: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: ${tonezone_dir}/tonezone.h: see the Autoconf documentation" >&2;}
+ { echo "$as_me:$LINENO: WARNING: ${tonezone_dir}/tonezone.h: section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: ${tonezone_dir}/tonezone.h: section \"Present But Cannot Be Compiled\"" >&2;}
+ { echo "$as_me:$LINENO: WARNING: ${tonezone_dir}/tonezone.h: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: ${tonezone_dir}/tonezone.h: proceeding with the preprocessor's result" >&2;}
+ { echo "$as_me:$LINENO: WARNING: ${tonezone_dir}/tonezone.h: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: ${tonezone_dir}/tonezone.h: in the future, the compiler will take precedence" >&2;}
( cat <<\_ASBOX
## ------------------------------- ##
## Report this to www.asterisk.org ##
@@ -33152,18 +33276,19 @@ _ASBOX
) | sed "s/^/$as_me: WARNING: /" >&2
;;
esac
-{ echo "$as_me:$LINENO: checking for zaptel/tonezone.h" >&5
-echo $ECHO_N "checking for zaptel/tonezone.h... $ECHO_C" >&6; }
-if test "${ac_cv_header_zaptel_tonezone_h+set}" = set; then
+{ echo "$as_me:$LINENO: checking for ${tonezone_dir}/tonezone.h" >&5
+echo $ECHO_N "checking for ${tonezone_dir}/tonezone.h... $ECHO_C" >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
- ac_cv_header_zaptel_tonezone_h=$ac_header_preproc
+ eval "$as_ac_Header=\$ac_header_preproc"
fi
-{ echo "$as_me:$LINENO: result: $ac_cv_header_zaptel_tonezone_h" >&5
-echo "${ECHO_T}$ac_cv_header_zaptel_tonezone_h" >&6; }
+ac_res=`eval echo '${'$as_ac_Header'}'`
+ { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
fi
-if test $ac_cv_header_zaptel_tonezone_h = yes; then
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
TONEZONE_HEADER_FOUND=1
else
TONEZONE_HEADER_FOUND=0
@@ -34546,7 +34671,7 @@ echo "$as_me: *** without explicitly specifying --with-${ZLIB_OPTION}" >&6;}
fi
-if test "${USE_ZAPTEL}" != "no"; then
+if test "${USE_ZAPTEL}" != "no" && test "x${PBX_DAHDI}" != "x1"; then
{ echo "$as_me:$LINENO: checking for ZT_DIAL_OP_CANCEL in zaptel/zaptel.h" >&5
echo $ECHO_N "checking for ZT_DIAL_OP_CANCEL in zaptel/zaptel.h... $ECHO_C" >&6; }
saved_cppflags="${CPPFLAGS}"
@@ -34628,7 +34753,7 @@ echo "$as_me: *** including --without-zaptel." >&6;}
fi
fi
-if test "${PBX_ZAPTEL}" = 1; then
+if test "${PBX_ZAPTEL}" = 1 && test "x${PBX_DAHDI}" != "x1"; then
{ echo "$as_me:$LINENO: checking for ZT_EVENT_REMOVED in zaptel/zaptel.h" >&5
echo $ECHO_N "checking for ZT_EVENT_REMOVED in zaptel/zaptel.h... $ECHO_C" >&6; }
saved_cppflags="${CPPFLAGS}"
@@ -34753,6 +34878,11 @@ fi
+if test "x${PBX_ZAPTEL}" = "x1" ; then
+ PBX_DAHDI=1
+
+fi
+
EDITLINE_LIB=""
if test "x$TERMCAP_LIB" != "x" ; then
EDITLINE_LIB="$TERMCAP_LIB"
@@ -36309,6 +36439,10 @@ CURSES_LIB!$CURSES_LIB$ac_delim
CURSES_INCLUDE!$CURSES_INCLUDE$ac_delim
CURSES_DIR!$CURSES_DIR$ac_delim
PBX_CURSES!$PBX_CURSES$ac_delim
+DAHDI_LIB!$DAHDI_LIB$ac_delim
+DAHDI_INCLUDE!$DAHDI_INCLUDE$ac_delim
+DAHDI_DIR!$DAHDI_DIR$ac_delim
+PBX_DAHDI!$PBX_DAHDI$ac_delim
GNUTLS_LIB!$GNUTLS_LIB$ac_delim
GNUTLS_INCLUDE!$GNUTLS_INCLUDE$ac_delim
GNUTLS_DIR!$GNUTLS_DIR$ac_delim
@@ -36385,10 +36519,6 @@ PRI_LIB!$PRI_LIB$ac_delim
PRI_INCLUDE!$PRI_INCLUDE$ac_delim
PRI_DIR!$PRI_DIR$ac_delim
PBX_PRI!$PBX_PRI$ac_delim
-PWLIB_LIB!$PWLIB_LIB$ac_delim
-PWLIB_INCLUDE!$PWLIB_INCLUDE$ac_delim
-PWLIB_DIR!$PWLIB_DIR$ac_delim
-PBX_PWLIB!$PBX_PWLIB$ac_delim
_ACEOF
if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 97; then
@@ -36430,6 +36560,10 @@ _ACEOF
ac_delim='%!_!# '
for ac_last_try in false false false false false :; do
cat >conf$$subs.sed <<_ACEOF
+PWLIB_LIB!$PWLIB_LIB$ac_delim
+PWLIB_INCLUDE!$PWLIB_INCLUDE$ac_delim
+PWLIB_DIR!$PWLIB_DIR$ac_delim
+PBX_PWLIB!$PBX_PWLIB$ac_delim
OPENH323_LIB!$OPENH323_LIB$ac_delim
OPENH323_INCLUDE!$OPENH323_INCLUDE$ac_delim
OPENH323_DIR!$OPENH323_DIR$ac_delim
@@ -36501,6 +36635,7 @@ GC_CFLAGS!$GC_CFLAGS$ac_delim
GC_LDFLAGS!$GC_LDFLAGS$ac_delim
AST_DECLARATION_AFTER_STATEMENT!$AST_DECLARATION_AFTER_STATEMENT$ac_delim
AST_NO_STRICT_OVERFLOW!$AST_NO_STRICT_OVERFLOW$ac_delim
+PBX_ZAPTEL_TRANSCODE!$PBX_ZAPTEL_TRANSCODE$ac_delim
GSM_INTERNAL!$GSM_INTERNAL$ac_delim
KDEINIT!$KDEINIT$ac_delim
KDEDIR!$KDEDIR$ac_delim
@@ -36518,15 +36653,10 @@ OPENH323_SUFFIX!$OPENH323_SUFFIX$ac_delim
OPENH323_BUILD!$OPENH323_BUILD$ac_delim
PBX_SPEEX_PREPROCESS!$PBX_SPEEX_PREPROCESS$ac_delim
PBX_ZAPTEL_VLDTMF!$PBX_ZAPTEL_VLDTMF$ac_delim
-PBX_ZAPTEL_TRANSCODE!$PBX_ZAPTEL_TRANSCODE$ac_delim
EDITLINE_LIB!$EDITLINE_LIB$ac_delim
PBX_H323!$PBX_H323$ac_delim
PBX_IXJUSER!$PBX_IXJUSER$ac_delim
GTKCONFIG!$GTKCONFIG$ac_delim
-PBX_GTK!$PBX_GTK$ac_delim
-GTK_INCLUDE!$GTK_INCLUDE$ac_delim
-GTK_LIB!$GTK_LIB$ac_delim
-PKGCONFIG!$PKGCONFIG$ac_delim
_ACEOF
if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 97; then
@@ -36568,6 +36698,10 @@ _ACEOF
ac_delim='%!_!# '
for ac_last_try in false false false false false :; do
cat >conf$$subs.sed <<_ACEOF
+PBX_GTK!$PBX_GTK$ac_delim
+GTK_INCLUDE!$GTK_INCLUDE$ac_delim
+GTK_LIB!$GTK_LIB$ac_delim
+PKGCONFIG!$PKGCONFIG$ac_delim
PBX_GTK2!$PBX_GTK2$ac_delim
GTK2_INCLUDE!$GTK2_INCLUDE$ac_delim
GTK2_LIB!$GTK2_LIB$ac_delim
@@ -36575,7 +36709,7 @@ CURL_CONFIG!$CURL_CONFIG$ac_delim
LTLIBOBJS!$LTLIBOBJS$ac_delim
_ACEOF
- if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 5; then
+ if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 9; then
break
elif $ac_last_try; then
{ { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
diff --git a/configure.ac b/configure.ac
index aeda896e1..f8548b756 100644
--- a/configure.ac
+++ b/configure.ac
@@ -176,6 +176,7 @@ AST_EXT_LIB_SETUP([ALSA], [Advanced Linux Sound Architecture], [asound])
AST_EXT_LIB_SETUP([CURL], [cURL], [curl])
AST_EXT_LIB_SETUP([CAP], [POSIX 1.e capabilities], [cap])
AST_EXT_LIB_SETUP([CURSES], [curses], [curses])
+AST_EXT_LIB_SETUP([DAHDI], [DAHDI], [dahdi])
AST_EXT_LIB_SETUP([GNUTLS], [GNU TLS support (used for iksemel only)], [gnutls])
AST_EXT_LIB_SETUP([GSM], [GSM], [gsm], [, or 'internal'])
AST_EXT_LIB_SETUP([IKSEMEL], [Iksemel Jabber Library], [iksemel])
@@ -435,6 +436,14 @@ if test "x${host_os}" = "xlinux-gnu" ; then
AST_EXT_LIB_CHECK([CAP], [cap], [cap_from_text], [sys/capability.h])
fi
+if test "${USE_DAHDI}" != "no" ; then
+ AST_C_DEFINE_CHECK([DAHDI], [DAHDI_CODE], [dahdi/user.h])
+ if test "x${PBX_DAHDI}" = "x1" ; then
+ PBX_ZAPTEL_TRANSCODE=1
+ AC_SUBST(PBX_ZAPTEL_TRANSCODE)
+ fi
+fi
+
AST_C_COMPILE_CHECK([GETIFADDRS], [struct ifaddrs *p; getifaddrs(&p)], [ifaddrs.h])
GSM_INTERNAL="yes"
@@ -1349,7 +1358,13 @@ if test "${host_os}" != "linux-gnu" ; then
tonezone_extra="-lm"
fi
-AST_EXT_LIB_CHECK([TONEZONE], [tonezone], [tone_zone_find], [zaptel/tonezone.h], [${tonezone_extra}])
+if test "${USE_DAHDI}" != "no" ; then
+ tonezone_dir="dahdi"
+else
+ tonezone_dir="zaptel"
+fi
+
+AST_EXT_LIB_CHECK([TONEZONE], [tonezone], [tone_zone_find], [${tonezone_dir}/tonezone.h], [${tonezone_extra}])
AST_EXT_LIB_CHECK([USB], [usb], [usb_init], [usb.h], [])
@@ -1407,7 +1422,7 @@ AC_LANG_POP
AST_EXT_LIB_CHECK([ZLIB], [z], [compress], [zlib.h])
-if test "${USE_ZAPTEL}" != "no"; then
+if test "${USE_ZAPTEL}" != "no" && test "x${PBX_DAHDI}" != "x1"; then
AC_MSG_CHECKING(for ZT_DIAL_OP_CANCEL in zaptel/zaptel.h)
saved_cppflags="${CPPFLAGS}"
if test "x${ZAPTEL_DIR}" != "x"; then
@@ -1443,7 +1458,7 @@ if test "${USE_ZAPTEL}" != "no"; then
fi
fi
-if test "${PBX_ZAPTEL}" = 1; then
+if test "${PBX_ZAPTEL}" = 1 && test "x${PBX_DAHDI}" != "x1"; then
AC_MSG_CHECKING(for ZT_EVENT_REMOVED in zaptel/zaptel.h)
saved_cppflags="${CPPFLAGS}"
if test "x${ZAPTEL_DIR}" != "x"; then
@@ -1492,6 +1507,11 @@ fi
AC_SUBST(PBX_ZAPTEL_VLDTMF)
AC_SUBST(PBX_ZAPTEL_TRANSCODE)
+if test "x${PBX_ZAPTEL}" = "x1" ; then
+ PBX_DAHDI=1
+ AC_SUBST(PBX_DAHDI)
+fi
+
EDITLINE_LIB=""
if test "x$TERMCAP_LIB" != "x" ; then
EDITLINE_LIB="$TERMCAP_LIB"
diff --git a/contrib/utils/zones2indications.c b/contrib/utils/zones2indications.c
index 186e53c9f..6a3156751 100644
--- a/contrib/utils/zones2indications.c
+++ b/contrib/utils/zones2indications.c
@@ -30,7 +30,7 @@
void print_tone_zone_sound(struct 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 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");
}
diff --git a/funcs/func_channel.c b/funcs/func_channel.c
index 9184cf955..a881872c4 100644
--- a/funcs/func_channel.c
+++ b/funcs/func_channel.c
@@ -111,7 +111,7 @@ static int func_channel_write(struct ast_channel *chan, char *function,
else if (!strcasecmp(data, "musicclass"))
locked_string_field_set(chan, musicclass, value);
else if (!strcasecmp(data, "tonezone")) {
- struct tone_zone *new_zone;
+ struct ind_tone_zone *new_zone;
if (!(new_zone = ast_get_indication_zone(value))) {
ast_log(LOG_ERROR, "Unknown country code '%s' for tonezone. Check indications.conf for available country codes.\n", value);
ret = -1;
diff --git a/include/asterisk/autoconfig.h.in b/include/asterisk/autoconfig.h.in
index cfed51b0c..4639e31ac 100644
--- a/include/asterisk/autoconfig.h.in
+++ b/include/asterisk/autoconfig.h.in
@@ -74,6 +74,12 @@
/* Define to indicate the ${CURSES_DESCRIP} library */
#undef HAVE_CURSES
+/* Define if your system has the DAHDI headers. */
+#undef HAVE_DAHDI
+
+/* Define DAHDI headers version */
+#undef HAVE_DAHDI_VERSION
+
/* Define to 1 if you have the <dirent.h> header file, and it defines `DIR'.
*/
#undef HAVE_DIRENT_H
diff --git a/include/asterisk/channel.h b/include/asterisk/channel.h
index 41371ccc0..29bfbef0e 100644
--- a/include/asterisk/channel.h
+++ b/include/asterisk/channel.h
@@ -414,7 +414,7 @@ struct ast_channel {
struct ast_cdr *cdr; /*!< Call Detail Record */
enum ast_channel_adsicpe adsicpe; /*!< Whether or not ADSI is detected on CPE */
- struct tone_zone *zone; /*!< Tone zone as set in indications.conf or
+ struct ind_tone_zone *zone; /*!< Tone zone as set in indications.conf or
in the CHANNEL dialplan function */
struct ast_channel_monitor *monitor; /*!< Channel monitoring */
diff --git a/include/asterisk/dahdi_compat.h b/include/asterisk/dahdi_compat.h
new file mode 100644
index 000000000..bf23f1054
--- /dev/null
+++ b/include/asterisk/dahdi_compat.h
@@ -0,0 +1,189 @@
+/*
+ * Asterisk -- An open source telephony toolkit.
+ *
+ * Copyright (C) 2008, Digium, Inc.
+ *
+ * See http://www.asterisk.org for more information about
+ * the Asterisk project. Please do not directly contact
+ * any of the maintainers of this project for assistance;
+ * the project provides a web site, mailing lists and IRC
+ * channels for your use.
+ *
+ * This program is free software, distributed under the terms of
+ * the GNU General Public License Version 2. See the LICENSE file
+ * at the top of the source tree.
+ */
+
+/*!
+ * \file
+ * \brief DAHDI compatibility with zaptel
+ */
+
+#ifndef DAHDI_COMPAT_H
+#define DAHDI_COMPAT_H
+
+#ifndef HAVE_ZAPTEL
+
+#include <dahdi/user.h>
+#include <dahdi/tonezone.h>
+
+#else
+
+#include <zaptel/zaptel.h>
+#include <zaptel/tonezone.h>
+
+/* Compiling against Zaptel instead of DAHDI */
+
+#define __DAHDI_SIG_FXO __ZT_SIG_FXO
+#define __DAHDI_SIG_FXS __ZT_SIG_FXS
+#define DAHDI_ALARM_BLUE ZT_ALARM_BLUE
+#define DAHDI_ALARM_LOOPBACK ZT_ALARM_LOOPBACK
+#define DAHDI_ALARM_NONE ZT_ALARM_NONE
+#define DAHDI_ALARM_NOTOPEN ZT_ALARM_NOTOPEN
+#define DAHDI_ALARM_RECOVER ZT_ALARM_RECOVER
+#define DAHDI_ALARM_RED ZT_ALARM_RED
+#define DAHDI_ALARM_YELLOW ZT_ALARM_YELLOW
+#define DAHDI_AUDIOMODE ZT_AUDIOMODE
+#define DAHDI_BUFFERINFO ZT_BUFFERINFO
+#define DAHDI_CHANNO ZT_CHANNO
+#define DAHDI_CHECK_HOOKSTATE ZT_CHECK_HOOKSTATE
+#define DAHDI_CONF_CONF ZT_CONF_CONF
+#define DAHDI_CONF_CONFANN ZT_CONF_CONFANN
+#define DAHDI_CONF_CONFANNMON ZT_CONF_CONFANNMON
+#define DAHDI_CONF_CONFMON ZT_CONF_CONFMON
+#define DAHDI_CONF_DIGITALMON ZT_CONF_DIGITALMON
+#define DAHDI_CONF_LISTENER ZT_CONF_LISTENER
+#define DAHDI_CONF_MONITORBOTH ZT_CONF_MONITORBOTH
+#define DAHDI_CONF_NORMAL ZT_CONF_NORMAL
+#define DAHDI_CONF_PSEUDO_LISTENER ZT_CONF_PSEUDO_LISTENER
+#define DAHDI_CONF_PSEUDO_TALKER ZT_CONF_PSEUDO_TALKER
+#define DAHDI_CONF_REALANDPSEUDO ZT_CONF_REALANDPSEUDO
+#define DAHDI_CONF_TALKER ZT_CONF_TALKER
+#define DAHDI_CONFDIAG ZT_CONFDIAG
+#define DAHDI_CONFINFO ZT_CONFINFO
+#define DAHDI_CONFMUTE ZT_CONFMUTE
+#define DAHDI_DEFAULT_NUM_BUFS ZT_DEFAULT_NUM_BUFS
+#define DAHDI_DIAL ZT_DIAL
+#define DAHDI_DIALING ZT_DIALING
+#define DAHDI_DIAL_OP_APPEND ZT_DIAL_OP_APPEND
+#define DAHDI_DIAL_OPERATION ZT_DIAL_OPERATION
+#define DAHDI_DIAL_OP_REPLACE ZT_DIAL_OP_REPLACE
+#define DAHDI_DIAL_PARAMS ZT_DIAL_PARAMS
+#define DAHDI_ECHOCANCEL ZT_ECHOCANCEL
+#define DAHDI_ECHOTRAIN ZT_ECHOTRAIN
+#define DAHDI_EVENT_ALARM ZT_EVENT_ALARM
+#define DAHDI_EVENT_BITSCHANGED ZT_EVENT_BITSCHANGED
+#define DAHDI_EVENT_DIALCOMPLETE ZT_EVENT_DIALCOMPLETE
+#define DAHDI_EVENT_DTMFDOWN ZT_EVENT_DTMFDOWN
+#define DAHDI_EVENT_DTMFUP ZT_EVENT_DTMFUP
+#define DAHDI_EVENT_EC_DISABLED ZT_EVENT_EC_DISABLED
+#define DAHDI_EVENT_HOOKCOMPLETE ZT_EVENT_HOOKCOMPLETE
+#define DAHDI_EVENT_NOALARM ZT_EVENT_NOALARM
+#define DAHDI_EVENT_NONE ZT_EVENT_NONE
+#define DAHDI_EVENT_ONHOOK ZT_EVENT_ONHOOK
+#define DAHDI_EVENT_POLARITY ZT_EVENT_POLARITY
+#define DAHDI_EVENT_PULSEDIGIT ZT_EVENT_PULSEDIGIT
+#define DAHDI_EVENT_PULSE_START ZT_EVENT_PULSE_START
+#define DAHDI_EVENT_REMOVED ZT_EVENT_REMOVED
+#define DAHDI_EVENT_RINGBEGIN ZT_EVENT_RINGBEGIN
+#define DAHDI_EVENT_RINGEROFF ZT_EVENT_RINGEROFF
+#define DAHDI_EVENT_RINGERON ZT_EVENT_RINGERON
+#define DAHDI_EVENT_RINGOFFHOOK ZT_EVENT_RINGOFFHOOK
+#define DAHDI_EVENT_TIMER_EXPIRED ZT_EVENT_TIMER_EXPIRED
+#define DAHDI_EVENT_TIMER_PING ZT_EVENT_TIMER_PING
+#define DAHDI_EVENT_WINKFLASH ZT_EVENT_WINKFLASH
+#define DAHDI_FLASH ZT_FLASH
+#define DAHDI_FLUSH ZT_FLUSH
+#define DAHDI_FLUSH_ALL ZT_FLUSH_ALL
+#define DAHDI_FLUSH_BOTH ZT_FLUSH_BOTH
+#define DAHDI_FLUSH_READ ZT_FLUSH_READ
+#define DAHDI_FLUSH_WRITE ZT_FLUSH_WRITE
+#define DAHDI_GAINS ZT_GAINS
+#define DAHDI_GET_BUFINFO ZT_GET_BUFINFO
+#define DAHDI_GETCONF ZT_GETCONF
+#define DAHDI_GETCONFMUTE ZT_GETCONFMUTE
+#define DAHDI_GETEVENT ZT_GETEVENT
+#define DAHDI_GETGAINS ZT_GETGAINS
+#define DAHDI_GET_PARAMS ZT_GET_PARAMS
+#define DAHDI_HOOK ZT_HOOK
+#define DAHDI_IOMUX ZT_IOMUX
+#define DAHDI_IOMUX_READ ZT_IOMUX_READ
+#define DAHDI_IOMUX_SIGEVENT ZT_IOMUX_SIGEVENT
+#define DAHDI_IOMUX_WRITE ZT_IOMUX_WRITE
+#define DAHDI_LAW_ALAW ZT_LAW_ALAW
+#define DAHDI_LAW_DEFAULT ZT_LAW_DEFAULT
+#define DAHDI_LAW_MULAW ZT_LAW_MULAW
+#define DAHDI_MAX_NUM_BUFS ZT_MAX_NUM_BUFS
+#define DAHDI_MAX_SPANS ZT_MAX_SPANS
+#define DAHDI_OFFHOOK ZT_OFFHOOK
+#define DAHDI_ONHOOK ZT_ONHOOK
+#define DAHDI_ONHOOKTRANSFER ZT_ONHOOKTRANSFER
+#define DAHDI_PARAMS ZT_PARAMS
+#define DAHDI_POLICY_IMMEDIATE ZT_POLICY_IMMEDIATE
+#define DAHDI_PRI ZT_PRI
+#define DAHDI_RING ZT_RING
+#define DAHDI_RINGOFF ZT_RINGOFF
+#define DAHDI_SENDTONE ZT_SENDTONE
+#define DAHDI_SET_BLOCKSIZE ZT_SET_BLOCKSIZE
+#define DAHDI_SET_BUFINFO ZT_SET_BUFINFO
+#define DAHDI_SETCADENCE ZT_SETCADENCE
+#define DAHDI_SETCONF ZT_SETCONF
+#define DAHDI_SET_DIALPARAMS ZT_SET_DIALPARAMS
+#define DAHDI_SETGAINS ZT_SETGAINS
+#define DAHDI_SETLAW ZT_SETLAW
+#define DAHDI_SETLINEAR ZT_SETLINEAR
+#define DAHDI_SET_PARAMS ZT_SET_PARAMS
+#define DAHDI_SETTONEZONE ZT_SETTONEZONE
+#define DAHDI_SIG_CLEAR ZT_SIG_CLEAR
+#define DAHDI_SIG_EM ZT_SIG_EM
+#define DAHDI_SIG_EM_E1 ZT_SIG_EM_E1
+#define DAHDI_SIG_FXO ZT_SIG_FXO
+#define DAHDI_SIG_FXOGS ZT_SIG_FXOGS
+#define DAHDI_SIG_FXOKS ZT_SIG_FXOKS
+#define DAHDI_SIG_FXOLS ZT_SIG_FXOLS
+#define DAHDI_SIG_FXS ZT_SIG_FXS
+#define DAHDI_SIG_FXSGS ZT_SIG_FXSGS
+#define DAHDI_SIG_FXSKS ZT_SIG_FXSKS
+#define DAHDI_SIG_FXSLS ZT_SIG_FXSLS
+#define DAHDI_SIG_HARDHDLC ZT_SIG_HARDHDLC
+#define DAHDI_SIG_HDLCFCS ZT_SIG_HDLCFCS
+#define DAHDI_SIG_SF ZT_SIG_SF
+#define DAHDI_SPANINFO ZT_SPANINFO
+#define DAHDI_SPANSTAT ZT_SPANSTAT
+#define DAHDI_SPECIFY ZT_SPECIFY
+#define DAHDI_START ZT_START
+#define DAHDI_TCOP_ALLOCATE ZT_TCOP_ALLOCATE
+#define DAHDI_TCOP_GETINFO ZT_TCOP_GETINFO
+#define DAHDI_TCOP_RELEASE ZT_TCOP_RELEASE
+#define DAHDI_TCOP_TRANSCODE ZT_TCOP_TRANSCODE
+#define DAHDI_TIMERACK ZT_TIMERACK
+#define DAHDI_TIMERCONFIG ZT_TIMERCONFIG
+#define DAHDI_TIMERPING ZT_TIMERPING
+#define DAHDI_TIMERPONG ZT_TIMERPONG
+#define DAHDI_TONE_BUSY ZT_TONE_BUSY
+#define DAHDI_TONE_CONGESTION ZT_TONE_CONGESTION
+#define DAHDI_TONEDETECT ZT_TONEDETECT
+#define DAHDI_TONEDETECT_MUTE ZT_TONEDETECT_MUTE
+#define DAHDI_TONEDETECT_ON ZT_TONEDETECT_ON
+#define DAHDI_TONE_DIALRECALL ZT_TONE_DIALRECALL
+#define DAHDI_TONE_DIALTONE ZT_TONE_DIALTONE
+#define DAHDI_TONE_DTMF_A ZT_TONE_DTMF_A
+#define DAHDI_TONE_DTMF_BASE ZT_TONE_DTMF_BASE
+#define DAHDI_TONE_DTMF_p ZT_TONE_DTMF_p
+#define DAHDI_TONE_DTMF_s ZT_TONE_DTMF_s
+#define DAHDI_TONE_INFO ZT_TONE_INFO
+#define DAHDI_TONE_RINGTONE ZT_TONE_RINGTONE
+#define DAHDI_TONE_STUTTER ZT_TONE_STUTTER
+#define DAHDI_TRANSCODE_HEADER ZT_TRANSCODE_HEADER
+#define DAHDI_TRANSCODE_INFO ZT_TRANSCODE_INFO
+#define DAHDI_TRANSCODE_MAGIC ZT_TRANSCODE_MAGIC
+#define DAHDI_TRANSCODE_OP ZT_TRANSCODE_OP
+#define DAHDI_vldtmf ZT_vldtmf
+#define DAHDI_WINK ZT_WINK
+#define HAVE_DAHDI HAVE_ZAPTEL
+
+#define dahdi_ring_cadence zt_ring_cadence
+
+#endif
+
+#endif /* DAHDI_COMPAT_H */
diff --git a/include/asterisk/indications.h b/include/asterisk/indications.h
index a6c1d7c9d..ba342675e 100644
--- a/include/asterisk/indications.h
+++ b/include/asterisk/indications.h
@@ -34,8 +34,8 @@
#include "asterisk/lock.h"
-struct tone_zone_sound {
- struct tone_zone_sound *next; /* next element */
+struct ind_tone_zone_sound {
+ struct ind_tone_zone_sound *next; /* next element */
const char *name; /* Identifing name */
const char *data; /* Actual zone description */
/* Description is a series of tones of the format:
@@ -45,33 +45,33 @@ struct tone_zone_sound {
specified in milliseconds */
};
-struct tone_zone {
- struct tone_zone* next; /* next in list */
+struct ind_tone_zone {
+ struct ind_tone_zone* next; /* next in list */
char country[5]; /* Country code */
char alias[5]; /* is this an alias? */
char description[40]; /* Description */
int nrringcadence; /* # registered ringcadence elements */
int *ringcadence; /* Ring cadence */
- struct tone_zone_sound *tones; /* The known tones for this zone */
+ struct ind_tone_zone_sound *tones; /* The known tones for this zone */
};
/* set the default tone country */
int ast_set_indication_country(const char *country);
-/* locate tone_zone, given the country. if country == NULL, use the default country */
-struct tone_zone *ast_get_indication_zone(const char *country);
-/* locate a tone_zone_sound, given the tone_zone. if tone_zone == NULL, use the default tone_zone */
-struct tone_zone_sound *ast_get_indication_tone(const struct tone_zone *zone, const char *indication);
+/* locate ind_tone_zone, given the country. if country == NULL, use the default country */
+struct ind_tone_zone *ast_get_indication_zone(const char *country);
+/* locate a ind_tone_zone_sound, given the ind_tone_zone. if ind_tone_zone == NULL, use the default ind_tone_zone */
+struct ind_tone_zone_sound *ast_get_indication_tone(const struct ind_tone_zone *zone, const char *indication);
/* add a new country, if country exists, it will be replaced. */
-int ast_register_indication_country(struct tone_zone *country);
+int ast_register_indication_country(struct ind_tone_zone *country);
/* remove an existing country and all its indications, country must exist */
int ast_unregister_indication_country(const char *country);
-/* add a new indication to a tone_zone. tone_zone must exist. if the indication already
+/* add a new indication to a ind_tone_zone. ind_tone_zone must exist. if the indication already
* exists, it will be replaced. */
-int ast_register_indication(struct tone_zone *zone, const char *indication, const char *tonelist);
-/* remove an existing tone_zone's indication. tone_zone must exist */
-int ast_unregister_indication(struct tone_zone *zone, const char *indication);
+int ast_register_indication(struct ind_tone_zone *zone, const char *indication, const char *tonelist);
+/* remove an existing ind_tone_zone's indication. ind_tone_zone must exist */
+int ast_unregister_indication(struct ind_tone_zone *zone, const char *indication);
/* Start a tone-list going */
int ast_playtones_start(struct ast_channel *chan, int vol, const char* tonelist, int interruptible);
@@ -79,10 +79,10 @@ int ast_playtones_start(struct ast_channel *chan, int vol, const char* tonelist,
void ast_playtones_stop(struct ast_channel *chan);
/* support for walking through a list of indications */
-struct tone_zone *ast_walk_indications(const struct tone_zone *cur);
+struct ind_tone_zone *ast_walk_indications(const struct ind_tone_zone *cur);
#if 0
-extern struct tone_zone *tone_zones;
+extern struct ind_tone_zone *ind_tone_zones;
extern ast_mutex_t tzlock;
#endif
diff --git a/include/asterisk/options.h b/include/asterisk/options.h
index 6ec2a7e0b..492feccd8 100644
--- a/include/asterisk/options.h
+++ b/include/asterisk/options.h
@@ -29,6 +29,7 @@ extern "C" {
#define AST_CACHE_DIR_LEN 512
#define AST_FILENAME_MAX 80
+#define AST_CHANNEL_NAME 80
/*! \ingroup main_options */
enum ast_option_flags {
@@ -121,6 +122,7 @@ extern pid_t ast_mainpid;
extern char record_cache_dir[AST_CACHE_DIR_LEN];
extern char debug_filename[AST_FILENAME_MAX];
+extern char dahdi_chan_name[AST_CHANNEL_NAME];
extern int ast_language_is_prefix;
diff --git a/main/app.c b/main/app.c
index 33083649f..5e7b98272 100644
--- a/main/app.c
+++ b/main/app.c
@@ -64,7 +64,7 @@ of 'maxlen' or 'size' minus the original strlen() of collect digits.
*/
int ast_app_dtget(struct ast_channel *chan, const char *context, char *collect, size_t size, int maxlen, int timeout)
{
- struct tone_zone_sound *ts;
+ struct ind_tone_zone_sound *ts;
int res=0, x=0;
if (maxlen > size)
diff --git a/main/asterisk.c b/main/asterisk.c
index e7b917075..a5784884e 100644
--- a/main/asterisk.c
+++ b/main/asterisk.c
@@ -81,9 +81,9 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
#include <pwd.h>
#include <sys/stat.h>
-#ifdef HAVE_ZAPTEL
+#if defined(HAVE_ZAPTEL) || defined (HAVE_DAHDI)
#include <sys/ioctl.h>
-#include <zaptel/zaptel.h>
+#include "asterisk/dahdi_compat.h"
#endif
#ifdef linux
@@ -172,6 +172,7 @@ int option_maxcalls; /*!< Max number of active calls */
char record_cache_dir[AST_CACHE_DIR_LEN] = AST_TMP_DIR;
char debug_filename[AST_FILENAME_MAX] = "";
+char dahdi_chan_name[AST_CHANNEL_NAME] = "ZAP";
static int ast_socket = -1; /*!< UNIX Socket for allowing remote control */
static int ast_consock = -1; /*!< UNIX Socket for controlling another asterisk */
@@ -2578,6 +2579,10 @@ static void ast_readconfig(void)
ast_copy_string(ast_config_AST_SYSTEM_NAME, v->value, sizeof(ast_config_AST_SYSTEM_NAME));
} else if (!strcasecmp(v->name, "languageprefix")) {
ast_language_is_prefix = ast_true(v->value);
+ } else if (!strcasecmp(v->name, "dahdichanname")) {
+ if (!strcasecmp(v->value, "yes")) {
+ ast_copy_string(dahdi_chan_name, "DAHDI", sizeof(dahdi_chan_name));
+ }
}
}
ast_config_destroy(cfg);
@@ -2964,7 +2969,7 @@ int main(int argc, char *argv[])
int x = 160;
fd = open("/dev/zap/timer", O_RDWR);
if (fd >= 0) {
- if (ioctl(fd, ZT_TIMERCONFIG, &x)) {
+ if (ioctl(fd, DAHDI_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);
exit(1);
}
@@ -2985,6 +2990,34 @@ int main(int argc, char *argv[])
close(fd);
}
}
+#elif defined(HAVE_DAHDI)
+{
+ int fd;
+ int x = 160;
+ fd = open("/dev/dahdi/timer", O_RDWR);
+ if (fd >= 0) {
+ 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 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 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", dahdi_timer_error);
+ exit(1);
+ }
+ close(fd);
+ }
+ }
+
#endif
threadstorage_init();
diff --git a/main/channel.c b/main/channel.c
index 4947e7621..49b097f35 100644
--- a/main/channel.c
+++ b/main/channel.c
@@ -37,9 +37,9 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
#include <unistd.h>
#include <math.h>
-#ifdef HAVE_ZAPTEL
+#if defined(HAVE_ZAPTEL) || defined (HAVE_DAHDI)
#include <sys/ioctl.h>
-#include <zaptel/zaptel.h>
+#include "asterisk/dahdi_compat.h"
#endif
#include "asterisk/pbx.h"
@@ -742,13 +742,19 @@ struct ast_channel *ast_channel_alloc(int needqueue, int state, const char *cid_
for (x = 0; x < AST_MAX_FDS - 2; x++)
tmp->fds[x] = -1;
+#ifdef HAVE_DAHDI
+
#ifdef HAVE_ZAPTEL
tmp->timingfd = open("/dev/zap/timer", O_RDWR);
+#else
+ tmp->timingfd = open("/dev/dahdi/timer", O_RDWR);
+#endif
+
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
@@ -759,7 +765,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
@@ -937,9 +943,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);
@@ -1805,7 +1811,7 @@ 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;
@@ -1813,7 +1819,7 @@ int ast_settimeout(struct ast_channel *c, int samples, int (*func)(const void *d
}
if (option_debug)
ast_log(LOG_DEBUG, "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;
}
@@ -2020,26 +2026,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;
@@ -2048,7 +2054,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);
}
@@ -2405,7 +2411,7 @@ int ast_indicate_data(struct ast_channel *chan, int condition, const void *data,
if (condition < 0)
ast_playtones_stop(chan);
else {
- const struct tone_zone_sound *ts = NULL;
+ const struct ind_tone_zone_sound *ts = NULL;
switch (condition) {
case AST_CONTROL_RINGING:
ts = ast_get_indication_tone(chan->zone, "ring");
@@ -3024,6 +3030,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;
diff --git a/main/file.c b/main/file.c
index 340eb4ee3..a3f14fbe6 100644
--- a/main/file.c
+++ b/main/file.c
@@ -679,7 +679,7 @@ 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;
@@ -702,7 +702,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;
@@ -813,7 +813,7 @@ int ast_closestream(struct ast_filestream *f)
if (f->fmt->format < AST_FORMAT_MAX_AUDIO) {
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 {
diff --git a/main/indications.c b/main/indications.c
index 359a5900f..555e80161 100644
--- a/main/indications.c
+++ b/main/indications.c
@@ -329,21 +329,21 @@ void ast_playtones_stop(struct ast_channel *chan)
/*--------------------------------------------*/
-static struct tone_zone *tone_zones;
-static struct tone_zone *current_tonezone;
+static struct ind_tone_zone *ind_tone_zones;
+static struct ind_tone_zone *current_tonezone;
-/* Protect the tone_zones list (highly unlikely that two things would change
+/* Protect the ind_tone_zones list (highly unlikely that two things would change
* it at the same time, but still! */
AST_MUTEX_DEFINE_STATIC(tzlock);
-struct tone_zone *ast_walk_indications(const struct tone_zone *cur)
+struct ind_tone_zone *ast_walk_indications(const struct ind_tone_zone *cur)
{
- struct tone_zone *tz;
+ struct ind_tone_zone *tz;
if (cur == NULL)
- return tone_zones;
+ return ind_tone_zones;
ast_mutex_lock(&tzlock);
- for (tz = tone_zones; tz; tz = tz->next)
+ for (tz = ind_tone_zones; tz; tz = tz->next)
if (tz == cur)
break;
if (tz)
@@ -356,7 +356,7 @@ struct tone_zone *ast_walk_indications(const struct tone_zone *cur)
int ast_set_indication_country(const char *country)
{
if (country) {
- struct tone_zone *z = ast_get_indication_zone(country);
+ struct ind_tone_zone *z = ast_get_indication_zone(country);
if (z) {
if (option_verbose > 2)
ast_verbose(VERBOSE_PREFIX_3 "Setting default indication country to '%s'\n",country);
@@ -367,25 +367,25 @@ int ast_set_indication_country(const char *country)
return 1; /* not found */
}
-/* locate tone_zone, given the country. if country == NULL, use the default country */
-struct tone_zone *ast_get_indication_zone(const char *country)
+/* locate ind_tone_zone, given the country. if country == NULL, use the default country */
+struct ind_tone_zone *ast_get_indication_zone(const char *country)
{
- struct tone_zone *tz;
+ struct ind_tone_zone *tz;
int alias_loop = 0;
/* we need some tonezone, pick the first */
if (country == NULL && current_tonezone)
return current_tonezone; /* default country? */
- if (country == NULL && tone_zones)
- return tone_zones; /* any country? */
+ if (country == NULL && ind_tone_zones)
+ return ind_tone_zones; /* any country? */
if (country == NULL)
return 0; /* not a single country insight */
ast_mutex_lock(&tzlock);
do {
- for (tz=tone_zones; tz; tz=tz->next) {
+ for (tz=ind_tone_zones; tz; tz=tz->next) {
if (strcasecmp(country,tz->country)==0) {
- /* tone_zone found */
+ /* ind_tone_zone found */
if (tz->alias && tz->alias[0]) {
country = tz->alias;
break;
@@ -402,16 +402,16 @@ struct tone_zone *ast_get_indication_zone(const char *country)
return 0;
}
-/* locate a tone_zone_sound, given the tone_zone. if tone_zone == NULL, use the default tone_zone */
-struct tone_zone_sound *ast_get_indication_tone(const struct tone_zone *zone, const char *indication)
+/* locate a ind_tone_zone_sound, given the ind_tone_zone. if ind_tone_zone == NULL, use the default ind_tone_zone */
+struct ind_tone_zone_sound *ast_get_indication_tone(const struct ind_tone_zone *zone, const char *indication)
{
- struct tone_zone_sound *ts;
+ struct ind_tone_zone_sound *ts;
/* we need some tonezone, pick the first */
if (zone == NULL && current_tonezone)
zone = current_tonezone; /* default country? */
- if (zone == NULL && tone_zones)
- zone = tone_zones; /* any country? */
+ if (zone == NULL && ind_tone_zones)
+ zone = ind_tone_zones; /* any country? */
if (zone == NULL)
return 0; /* not a single country insight */
@@ -428,11 +428,11 @@ struct tone_zone_sound *ast_get_indication_tone(const struct tone_zone *zone, co
return 0;
}
-/* helper function to delete a tone_zone in its entirety */
-static inline void free_zone(struct tone_zone* zone)
+/* helper function to delete a ind_tone_zone in its entirety */
+static inline void free_zone(struct ind_tone_zone* zone)
{
while (zone->tones) {
- struct tone_zone_sound *tmp = zone->tones->next;
+ struct ind_tone_zone_sound *tmp = zone->tones->next;
free((void*)zone->tones->name);
free((void*)zone->tones->data);
free(zone->tones);
@@ -446,19 +446,19 @@ static inline void free_zone(struct tone_zone* zone)
/*--------------------------------------------*/
/* add a new country, if country exists, it will be replaced. */
-int ast_register_indication_country(struct tone_zone *zone)
+int ast_register_indication_country(struct ind_tone_zone *zone)
{
- struct tone_zone *tz,*pz;
+ struct ind_tone_zone *tz,*pz;
ast_mutex_lock(&tzlock);
- for (pz=NULL,tz=tone_zones; tz; pz=tz,tz=tz->next) {
+ for (pz=NULL,tz=ind_tone_zones; tz; pz=tz,tz=tz->next) {
if (strcasecmp(zone->country,tz->country)==0) {
- /* tone_zone already there, replace */
+ /* ind_tone_zone already there, replace */
zone->next = tz->next;
if (pz)
pz->next = zone;
else
- tone_zones = zone;
+ ind_tone_zones = zone;
/* if we are replacing the default zone, re-point it */
if (tz == current_tonezone)
current_tonezone = zone;
@@ -473,7 +473,7 @@ int ast_register_indication_country(struct tone_zone *zone)
if (pz)
pz->next = zone;
else
- tone_zones = zone;
+ ind_tone_zones = zone;
ast_mutex_unlock(&tzlock);
if (option_verbose > 2)
@@ -485,21 +485,21 @@ int ast_register_indication_country(struct tone_zone *zone)
* Also, all countries which are an alias for the specified country are removed. */
int ast_unregister_indication_country(const char *country)
{
- struct tone_zone *tz, *pz = NULL, *tmp;
+ struct ind_tone_zone *tz, *pz = NULL, *tmp;
int res = -1;
ast_mutex_lock(&tzlock);
- tz = tone_zones;
+ tz = ind_tone_zones;
while (tz) {
if (country==NULL ||
(strcasecmp(country, tz->country)==0 ||
strcasecmp(country, tz->alias)==0)) {
- /* tone_zone found, remove */
+ /* ind_tone_zone found, remove */
tmp = tz->next;
if (pz)
pz->next = tmp;
else
- tone_zones = tmp;
+ ind_tone_zones = tmp;
/* if we are unregistering the default country, w'll notice */
if (tz == current_tonezone) {
ast_log(LOG_NOTICE,"Removed default indication country '%s'\n",tz->country);
@@ -508,8 +508,8 @@ int ast_unregister_indication_country(const char *country)
if (option_verbose > 2)
ast_verbose(VERBOSE_PREFIX_3 "Unregistered indication country '%s'\n",tz->country);
free_zone(tz);
- if (tone_zones == tz)
- tone_zones = tmp;
+ if (ind_tone_zones == tz)
+ ind_tone_zones = tmp;
tz = tmp;
res = 0;
}
@@ -523,11 +523,11 @@ int ast_unregister_indication_country(const char *country)
return res;
}
-/* add a new indication to a tone_zone. tone_zone must exist. if the indication already
+/* add a new indication to a ind_tone_zone. ind_tone_zone must exist. if the indication already
* exists, it will be replaced. */
-int ast_register_indication(struct tone_zone *zone, const char *indication, const char *tonelist)
+int ast_register_indication(struct ind_tone_zone *zone, const char *indication, const char *tonelist)
{
- struct tone_zone_sound *ts,*ps;
+ struct ind_tone_zone_sound *ts,*ps;
/* is it an alias? stop */
if (zone->alias[0])
@@ -563,9 +563,9 @@ int ast_register_indication(struct tone_zone *zone, const char *indication, cons
}
/* remove an existing country's indication. Both country and indication must exist */
-int ast_unregister_indication(struct tone_zone *zone, const char *indication)
+int ast_unregister_indication(struct ind_tone_zone *zone, const char *indication)
{
- struct tone_zone_sound *ts,*ps = NULL, *tmp;
+ struct ind_tone_zone_sound *ts,*ps = NULL, *tmp;
int res = -1;
/* is it an alias? stop */
diff --git a/main/loader.c b/main/loader.c
index d423af234..7203ded21 100644
--- a/main/loader.c
+++ b/main/loader.c
@@ -742,6 +742,23 @@ static struct load_order_entry *add_to_load_order(const char *resource, struct l
return order;
}
+static int translate_module_name(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;
@@ -751,6 +768,9 @@ int load_modules(unsigned int preload_only)
unsigned int load_count;
struct load_order load_order;
int res = 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;
@@ -773,8 +793,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 */
@@ -830,7 +854,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(&load_order, entry);
free(order->resource);
free(order);
diff --git a/makeopts.in b/makeopts.in
index 9d45c3c88..eb54b59e3 100644
--- a/makeopts.in
+++ b/makeopts.in
@@ -165,6 +165,8 @@ VORBIS_LIB=@VORBIS_LIB@
VPBAPI_INCLUDE=@VPB_INCLUDE@
VPBAPI_LIB=@VPB_LIB@
+DAHDI_INCLUDE=@DAHDI_INCLUDE@
+
ZAPTEL_INCLUDE=@ZAPTEL_INCLUDE@
ZLIB_INCLUDE=@ZLIB_INCLUDE@
diff --git a/pbx/pbx_config.c b/pbx/pbx_config.c
index 3d4a08c29..63f6c04f1 100644
--- a/pbx/pbx_config.c
+++ b/pbx/pbx_config.c
@@ -2361,7 +2361,7 @@ 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];
@@ -2397,11 +2397,21 @@ 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));
+ 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(zapcopy, dahdichan, sizeof(zapcopy));
c = zapcopy;
chan = strsep(&c, ",");
while (chan) {
diff --git a/res/res_indications.c b/res/res_indications.c
index ed8a24b33..2147546af 100644
--- a/res/res_indications.c
+++ b/res/res_indications.c
@@ -85,7 +85,7 @@ char *playtones_desc=
*/
static int handle_add_indication(int fd, int argc, char *argv[])
{
- struct tone_zone *tz;
+ struct ind_tone_zone *tz;
int created_country = 0;
if (argc != 5) return RESULT_SHOWUSAGE;
@@ -119,7 +119,7 @@ static int handle_add_indication(int fd, int argc, char *argv[])
*/
static int handle_remove_indication(int fd, int argc, char *argv[])
{
- struct tone_zone *tz;
+ struct ind_tone_zone *tz;
if (argc != 3 && argc != 4) return RESULT_SHOWUSAGE;
if (argc == 3) {
@@ -148,7 +148,7 @@ static int handle_remove_indication(int fd, int argc, char *argv[])
*/
static int handle_show_indications(int fd, int argc, char *argv[])
{
- struct tone_zone *tz = NULL;
+ struct ind_tone_zone *tz = NULL;
char buf[256];
int found_country = 0;
@@ -166,7 +166,7 @@ static int handle_show_indications(int fd, int argc, char *argv[])
for (i=2; i<argc; i++) {
if (strcasecmp(tz->country,argv[i])==0 &&
!tz->alias[0]) {
- struct tone_zone_sound* ts;
+ struct ind_tone_zone_sound* ts;
if (!found_country) {
found_country = 1;
ast_cli(fd,"Country Indication PlayList\n"
@@ -196,7 +196,7 @@ static int handle_show_indications(int fd, int argc, char *argv[])
*/
static int handle_playtones(struct ast_channel *chan, void *data)
{
- struct tone_zone_sound *ts;
+ struct ind_tone_zone_sound *ts;
int res;
if (!data || !((char*)data)[0]) {
@@ -231,7 +231,7 @@ static int ind_load_module(void)
struct ast_variable *v;
char *cxt;
char *c;
- struct tone_zone *tones;
+ struct ind_tone_zone *tones;
const char *country = NULL;
/* that the following cast is needed, is yuk! */
@@ -284,7 +284,7 @@ static int ind_load_module(void)
c = countries;
country = strsep(&c,",");
while (country) {
- struct tone_zone* azone;
+ struct ind_tone_zone* azone;
if (!(azone = ast_calloc(1, sizeof(*azone)))) {
ast_config_destroy(cfg);
return -1;
@@ -300,7 +300,7 @@ static int ind_load_module(void)
}
} else {
/* add tone to country */
- struct tone_zone_sound *ps,*ts;
+ struct ind_tone_zone_sound *ps,*ts;
for (ps=NULL,ts=tones->tones; ts; ps=ts, ts=ts->next) {
if (strcasecmp(v->name,ts->name)==0) {
/* already there */
diff --git a/res/res_musiconhold.c b/res/res_musiconhold.c
index faab84cae..476c7d120 100644
--- a/res/res_musiconhold.c
+++ b/res/res_musiconhold.c
@@ -52,10 +52,6 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
#include <thread.h>
#endif
-#ifdef HAVE_ZAPTEL
-#include <zaptel/zaptel.h>
-#endif
-
#include "asterisk/lock.h"
#include "asterisk/file.h"
#include "asterisk/logger.h"
@@ -72,6 +68,8 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
#include "asterisk/stringfields.h"
#include "asterisk/linkedlists.h"
+#include "asterisk/dahdi_compat.h"
+
#define INITIAL_NUM_FILES 8
static char *app0 = "MusicOnHold";
@@ -865,7 +863,7 @@ static int moh_scan_files(struct mohclass *class) {
static int moh_register(struct mohclass *moh, int reload)
{
-#ifdef HAVE_ZAPTEL
+#ifdef HAVE_DAHDI
int x;
#endif
struct mohclass *mohclass = NULL;
@@ -909,15 +907,19 @@ static int moh_register(struct mohclass *moh, int reload)
ast_set_flag(moh, MOH_QUIET);
moh->srcfd = -1;
-#ifdef HAVE_ZAPTEL
+#ifdef HAVE_DAHDI
/* Open /dev/zap/pseudo for timing... Is
there a better, yet reliable way to do this? */
+#ifdef HAVE_ZAPTEL
moh->pseudofd = open("/dev/zap/pseudo", O_RDONLY);
+#else
+ moh->pseudofd = open("/dev/dahdi/pseudo", O_RDONLY);
+#endif
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;
diff --git a/res/snmp/agent.c b/res/snmp/agent.c
index 96398e8a8..7ab0d68f9 100644
--- a/res/snmp/agent.c
+++ b/res/snmp/agent.c
@@ -621,7 +621,7 @@ static u_char *ast_var_indications(struct variable *vp, oid *name, size_t *lengt
int exact, size_t *var_len, WriteMethod **write_method)
{
static unsigned long long_ret;
- struct tone_zone *tz = NULL;
+ struct ind_tone_zone *tz = NULL;
if (header_generic(vp, name, length, exact, var_len, write_method))
return NULL;
@@ -651,7 +651,7 @@ static u_char *ast_var_indications_table(struct variable *vp, oid *name, size_t
int exact, size_t *var_len, WriteMethod **write_method)
{
static unsigned long long_ret;
- struct tone_zone *tz = NULL;
+ struct ind_tone_zone *tz = NULL;
int i;
if (header_simple_table(vp, name, length, exact, var_len, write_method, -1))