# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+CFLAGS=-std=gnu99 -ffast-math -Wall -Wunused-variable -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes
SRC=src
SOURCES=\
$(SRC)/hashtable.c \
$(SRC)/isdn/include/Q931ie.h \
$(SRC)/isdn/include/Q932.h
-
-PWD=$(shell pwd)
-INCS=-I$(PWD)/$(SRC)/include -I$(PWD)/$(SRC)/isdn/include
-CFLAGS= $(INCS) $(ZAP_CFLAGS)
-MYLIB=libopenzap.a
-LIBPRIA=libpri.a
-LIBPRI=./libpri
-TMP=-I$(LIBPRI) -I$(SRC)/include -I./src -w
-
-PIKA_DIR=$(shell ls -d /usr/include/pika 2>/dev/null)
-PIKA_LIB=$(shell ls /usr/lib/libpikahmpapi.so 2>/dev/null)
-
-ifneq ($(PIKA_DIR),)
-ifneq ($(PIKA_LIB),)
-OBJS += $(SRC)/zap_pika.o
-CFLAGS += -DZAP_PIKA_SUPPORT -I$(PIKA_DIR)
-ADD_OBJS = $(PIKA_LIB)
-endif
-endif
-
-include general.makefile
-
-all: $(MYLIB)
-
-$(MYLIB): $(OBJS) $(HEADERS) $(SOURCES)
- ar rcs $(MYLIB) $(OBJS) $(ADD_OBJS)
- ranlib $(MYLIB)
-
-testapp: $(SRC)/testapp.c $(MYLIB)
- $(CC) $(INCS) -L. $(SRC)/testapp.c -o testapp -lopenzap -lm -lpthread
-
-testcid: $(SRC)/testcid.c $(MYLIB)
- $(CC) $(INCS) -L. -g -ggdb $(SRC)/testcid.c -o testcid -lopenzap -lm -lpthread
-
-testtones: $(SRC)/testtones.c $(MYLIB)
- $(CC) $(INCS) -L. $(SRC)/testtones.c -o testtones -lopenzap -lm
-
-detect_tones: $(SRC)/detect_tones.c $(MYLIB)
- $(CC) $(INCS) -L. $(SRC)/detect_tones.c -o detect_tones -lopenzap -lm
-
-detect_dtmf: $(SRC)/detect_dtmf.c $(MYLIB)
- $(CC) $(INCS) -L. $(SRC)/detect_dtmf.c -o detect_dtmf -lopenzap -lm
-
-testisdn: $(SRC)/testisdn.c $(MYLIB)
- $(CC) $(INCS) $(ZAP_CFLAGS) -L. $(SRC)/testisdn.c -o testisdn -lopenzap -lm -lpthread
-
-testanalog: $(SRC)/testanalog.c $(MYLIB)
- $(CC) $(INCS) -L. $(SRC)/testanalog.c -o testanalog -lopenzap -lm -lpthread
-
-$(SRC)/priserver.o: $(SRC)/priserver.c
- $(CC) $(INCS) $(TMP) -c $(SRC)/priserver.c -o $(SRC)/priserver.o
-
-$(SRC)/sangoma_pri.o: $(SRC)/sangoma_pri.c
- $(CC) $(INCS) $(TMP) -c $(SRC)/sangoma_pri.c -o $(SRC)/sangoma_pri.o
-
-$(LIBPRI)/$(LIBPRIA):
- cd libpri && make
-
-priserver: $(MYLIB) $(SRC)/priserver.o $(SRC)/sangoma_pri.o $(LIBPRI)/$(LIBPRIA)
- $(CC) $(SRC)/sangoma_pri.o $(SRC)/priserver.o -L. -o priserver -lopenzap -lm -lpthread $(LIBPRI)/$(LIBPRIA)
-
-$(SRC)/zap_io.o: $(SRC)/zap_io.c
- $(CC) $(MOD_CFLAGS) $(CC_CFLAGS) $(CFLAGS) -c $< -o $@
-
-%.o: %.c $(HEADERS)
- $(CC) $(CC_CFLAGS) $(CFLAGS) -c $< -o $@
-
-dox:
- cd docs && doxygen $(PWD)/docs/Doxygen.conf
-
-mod_openzap/mod_openzap.so: $(MYLIB) mod_openzap/mod_openzap.c
- cd mod_openzap && make
-
-mod_openzap: mod_openzap/mod_openzap.so
-
-mod_openzap-install: mod_openzap
- cd mod_openzap && make install
-
-mod_openzap-clean:
- @if [ -f mod_openzap/mod_openzap.so ] ; then cd mod_openzap && make clean ; fi
-
-clean: mod_openzap-clean
- rm -f $(SRC)/*.o $(SRC)/isdn/*.o $(MYLIB) *~ \#* testapp testcid testtones detect_tones detect_dtmf priserver testisdn testanalog
- @if [ -f $(LIBPRI)/$(LIBPRIA) ] ; then cd $(LIBPRI) && make clean ; fi
-
-
-# Copyright (c) 2007, Anthony Minessale II
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# * Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-#
-# * Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in the
-# documentation and/or other materials provided with the distribution.
-#
-# * Neither the name of the original author; nor the names of any contributors
-# may be used to endorse or promote products derived from this software
-# without specific prior written permission.
-#
-#
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
-# OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-SRC=src
-SOURCES=\
-$(SRC)/hashtable.c \
-$(SRC)/hashtable_itr.c \
-$(SRC)/zap_io.c \
-$(SRC)/zap_isdn.c \
-$(SRC)/zap_analog.c \
-$(SRC)/zap_config.c \
-$(SRC)/zap_callerid.c \
-$(SRC)/fsk.c \
-$(SRC)/uart.c \
-$(SRC)/g711.c \
-$(SRC)/libteletone_detect.c \
-$(SRC)/libteletone_generate.c \
-$(SRC)/zap_buffer.c \
-$(SRC)/zap_threadmutex.c \
-$(SRC)/isdn/EuroISDNStateNT.c \
-$(SRC)/isdn/EuroISDNStateTE.c \
-$(SRC)/isdn/mfifo.c \
-$(SRC)/isdn/Q921.c \
-$(SRC)/isdn/Q931api.c \
-$(SRC)/isdn/Q931.c \
-$(SRC)/isdn/Q931ie.c \
-$(SRC)/isdn/Q931mes.c \
-$(SRC)/isdn/Q931StateNT.c \
-$(SRC)/isdn/Q931StateTE.c \
-$(SRC)/isdn/nationalmes.c \
-$(SRC)/isdn/nationalStateNT.c \
-$(SRC)/isdn/nationalStateTE.c \
-$(SRC)/isdn/DMSmes.c \
-$(SRC)/isdn/DMSStateNT.c \
-$(SRC)/isdn/DMSStateTE.c \
-$(SRC)/isdn/5ESSmes.c \
-$(SRC)/isdn/5ESSStateNT.c \
-$(SRC)/isdn/5ESSStateTE.c \
-$(SRC)/isdn/Q932mes.c \
-$(SRC)/zap_zt.c \
-$(SRC)/zap_wanpipe.c\
-$(SRC)/ss7_boost_client.c
-
-OBJS=\
-$(SRC)/hashtable.o \
-$(SRC)/hashtable_itr.o \
-$(SRC)/zap_io.o \
-$(SRC)/zap_isdn.o \
-$(SRC)/zap_analog.o \
-$(SRC)/zap_config.o \
-$(SRC)/zap_callerid.o \
-$(SRC)/fsk.o \
-$(SRC)/uart.o \
-$(SRC)/g711.o \
-$(SRC)/libteletone_detect.o \
-$(SRC)/libteletone_generate.o \
-$(SRC)/zap_buffer.o \
-$(SRC)/zap_threadmutex.o \
-$(SRC)/isdn/EuroISDNStateNT.o \
-$(SRC)/isdn/EuroISDNStateTE.o \
-$(SRC)/isdn/mfifo.o \
-$(SRC)/isdn/Q921.o \
-$(SRC)/isdn/Q931api.o \
-$(SRC)/isdn/Q931.o \
-$(SRC)/isdn/Q931ie.o \
-$(SRC)/isdn/Q931mes.o \
-$(SRC)/isdn/Q931StateNT.o \
-$(SRC)/isdn/Q931StateTE.o \
-$(SRC)/isdn/nationalmes.o \
-$(SRC)/isdn/nationalStateNT.o \
-$(SRC)/isdn/nationalStateTE.o \
-$(SRC)/isdn/DMSmes.o \
-$(SRC)/isdn/DMSStateNT.o \
-$(SRC)/isdn/DMSStateTE.o \
-$(SRC)/isdn/5ESSmes.o \
-$(SRC)/isdn/5ESSStateNT.o \
-$(SRC)/isdn/5ESSStateTE.o \
-$(SRC)/isdn/Q932mes.o \
-$(SRC)/zap_zt.o \
-$(SRC)/zap_wanpipe.o\
-$(SRC)/ss7_boost_client.o
-
-#SRCS=$(shell echo $(OBJS) | sed "s/\.o/\.c/g")
-
-HEADERS= $(SRC)/include/fsk.h \
-$(SRC)/include/g711.h \
-$(SRC)/include/hashtable.h \
-$(SRC)/include/hashtable_itr.h \
-$(SRC)/include/hashtable_private.h \
-$(SRC)/include/libteletone_detect.h \
-$(SRC)/include/libteletone_generate.h \
-$(SRC)/include/libteletone.h \
-$(SRC)/include/openzap.h \
-$(SRC)/include/sangoma_tdm_api.h \
-$(SRC)/include/uart.h \
-$(SRC)/include/wanpipe_tdm_api_iface.h \
-$(SRC)/include/zap_analog.h \
-$(SRC)/include/zap_buffer.h \
-$(SRC)/include/zap_config.h \
-$(SRC)/include/zap_isdn.h \
-$(SRC)/include/zap_skel.h \
-$(SRC)/include/zap_threadmutex.h \
-$(SRC)/include/zap_types.h \
-$(SRC)/include/zap_wanpipe.h \
-$(SRC)/include/zap_zt.h \
-$(SRC)/include/ss7_boost_client.h \
-$(SRC)/isdn/include/mfifo.h \
-$(SRC)/isdn/include/national.h \
-$(SRC)/isdn/include/DMS.h \
-$(SRC)/isdn/include/5ESS.h \
-$(SRC)/isdn/include/Q921.h \
-$(SRC)/isdn/include/Q931.h \
-$(SRC)/isdn/include/Q931ie.h \
-$(SRC)/isdn/include/Q932.h
-
-
PWD=$(shell pwd)
INCS=-I$(PWD)/$(SRC)/include -I$(PWD)/$(SRC)/isdn/include
-CFLAGS= $(INCS) $(ZAP_CFLAGS)
+CFLAGS+= $(INCS) $(ZAP_CFLAGS)
MYLIB=libopenzap.a
LIBPRIA=libpri.a
LIBPRI=./libpri
TMP=-I$(LIBPRI) -I$(SRC)/include -I./src -w
-SCTP_H=$(shell ls /usr/include/netinet/sctp.h 2>/dev/null)
-ifneq ($(SCTP_H),)
-CFLAGS += -DSS7BC_USE_SCTP
-endif
-
PIKA_DIR=$(shell ls -d /usr/include/pika 2>/dev/null)
PIKA_LIB=$(shell ls /usr/lib/libpikahmpapi.so 2>/dev/null)
endif
endif
-include general.makefile
-
all: $(MYLIB)
$(MYLIB): $(OBJS) $(HEADERS) $(SOURCES)
clean: mod_openzap-clean
rm -f $(SRC)/*.o $(SRC)/isdn/*.o $(MYLIB) *~ \#* testapp testcid testtones detect_tones detect_dtmf priserver testisdn testanalog
@if [ -f $(LIBPRI)/$(LIBPRIA) ] ; then cd $(LIBPRI) && make clean ; fi
-
-
if (switch_strlen_zero(fail_regex)) {
fail_regex = NULL;
}
-
+
+ zap_log(ZAP_LOG_DEBUG, "got DTMF sig [%s]\n", dtmf);
switch_set_string(sigmsg->channel->caller_data.collected, dtmf);
if ((regex || fail_regex) && !switch_strlen_zero(dtmf)) {
if (handle->cellpos > 1.0) {
handle->cellpos -= 1.0;
-
switch (handle->state) {
case FSK_STATE_DATA:
- {
+ {
+
(*handle->attr.bithandler) (handle->attr.bithandler_arg, handle->current_bit);
}
break;
case FSK_STATE_CHANSEIZE:
{
+
if (handle->last_bit != handle->current_bit) {
handle->conscutive_state_bits++;
} else {
handle->conscutive_state_bits = 0;
}
-
+
if (handle->conscutive_state_bits > 15) {
handle->state = FSK_STATE_CARRIERSIG;
handle->conscutive_state_bits = 0;
zap_status_t zap_span_load_tones(zap_span_t *span, char *mapname);
zap_size_t zap_channel_dequeue_dtmf(zap_channel_t *zchan, char *dtmf, zap_size_t len);
zap_status_t zap_channel_queue_dtmf(zap_channel_t *zchan, const char *dtmf);
+void zap_channel_flush_dtmf(zap_channel_t *zchan);
zap_time_t zap_current_time_in_ms(void);
zap_status_t zap_span_poll_event(zap_span_t *span, uint32_t ms);
zap_status_t zap_span_next_event(zap_span_t *span, zap_event_t **event);
ZIO_CODEC_FUNCTION(zio_ulaw2alaw);
ZIO_CODEC_FUNCTION(zio_alaw2ulaw);
+#ifdef DEBUG_LOCKS
+#define zap_mutex_lock(_x) printf("++++++lock %s:%d\n", __FILE__, __LINE__) && _zap_mutex_lock(_x)
+#define zap_mutex_trylock(_x) printf("++++++try %s:%d\n", __FILE__, __LINE__) && _zap_mutex_trylock(_x)
+#define zap_mutex_unlock(_x) printf("------unlock %s:%d\n", __FILE__, __LINE__) && _zap_mutex_unlock(_x)
+#else
+#define zap_mutex_lock(_x) _zap_mutex_lock(_x)
+#define zap_mutex_trylock(_x) _zap_mutex_trylock(_x)
+#define zap_mutex_unlock(_x) _zap_mutex_unlock(_x)
+#endif
#endif
void zap_thread_override_default_stacksize(zap_size_t size);
zap_status_t zap_mutex_create(zap_mutex_t **mutex);
zap_status_t zap_mutex_destroy(zap_mutex_t **mutex);
-zap_status_t zap_mutex_lock(zap_mutex_t *mutex);
-zap_status_t zap_mutex_trylock(zap_mutex_t *mutex);
-zap_status_t zap_mutex_unlock(zap_mutex_t *mutex);
+zap_status_t _zap_mutex_lock(zap_mutex_t *mutex);
+zap_status_t _zap_mutex_trylock(zap_mutex_t *mutex);
+zap_status_t _zap_mutex_unlock(zap_mutex_t *mutex);
#endif
static ZIO_CHANNEL_OUTGOING_CALL_FUNCTION(analog_fxo_outgoing_call)
{
if (!zap_test_flag(zchan, ZAP_CHANNEL_OFFHOOK) && !zap_test_flag(zchan, ZAP_CHANNEL_INTHREAD)) {
- //zap_channel_command(zchan, ZAP_COMMAND_TRACE_INPUT, "/tmp/inbound.ul");
- //zap_channel_command(zchan, ZAP_COMMAND_TRACE_OUTPUT, "/tmp/outbound.ul");
zap_channel_clear_needed_tones(zchan);
zap_channel_clear_detected_tones(zchan);
ts.buffer = NULL;
if (zap_channel_open_chan(zchan) != ZAP_SUCCESS) {
- zap_log(ZAP_LOG_ERROR, "OPEN ERROR\n");
+ zap_log(ZAP_LOG_ERROR, "OPEN ERROR [%s]\n", zchan->last_error);
goto done;
}
elapsed += interval;
state_counter += interval;
-
+
if (!zap_test_flag(zchan, ZAP_CHANNEL_STATE_CHANGE)) {
switch(zchan->state) {
case ZAP_CHANNEL_STATE_GET_CALLERID:
{
if (state_counter > 5000 || !zap_test_flag(zchan, ZAP_CHANNEL_CALLERID_DETECT)) {
+ zap_channel_command(zchan, ZAP_COMMAND_DISABLE_CALLERID_DETECT, NULL);
zap_set_state_locked(zchan, ZAP_CHANNEL_STATE_IDLE);
}
}
{
zap_channel_use(zchan);
zap_channel_clear_needed_tones(zchan);
-
+ zap_channel_flush_dtmf(zchan);
+
if (zchan->type == ZAP_CHAN_TYPE_FXO && !zap_test_flag(zchan, ZAP_CHANNEL_OFFHOOK)) {
zap_channel_command(zchan, ZAP_COMMAND_OFFHOOK, NULL);
}
zchan->needed_tones[ZAP_TONEMAP_FAIL1] = 1;
zchan->needed_tones[ZAP_TONEMAP_FAIL2] = 1;
zchan->needed_tones[ZAP_TONEMAP_FAIL3] = 1;
- dial_timeout = ((zchan->dtmf_on + zchan->dtmf_off) * strlen(zchan->caller_data.ani)) + 3000;
+ dial_timeout = ((zchan->dtmf_on + zchan->dtmf_off) * strlen(zchan->caller_data.ani)) + 2000;
}
}
} else if (zchan->detected_tones[ZAP_TONEMAP_RING]) {
{
zap_sigmsg_t sig;
zap_analog_data_t *analog_data = event->channel->span->signal_data;
-
+ int locked = 0;
+
memset(&sig, 0, sizeof(sig));
sig.chan_id = event->channel->chan_id;
sig.span_id = event->channel->span_id;
zap_oob_event2str(event->enum_id), event->channel->span_id, event->channel->chan_id, zap_channel_state2str(event->channel->state));
zap_mutex_lock(event->channel->mutex);
-
+ locked++;
switch(event->enum_id) {
case ZAP_OOB_RING_START:
{
-
- if (event->channel->state == ZAP_CHANNEL_STATE_DOWN && !zap_test_flag(event->channel, ZAP_CHANNEL_INTHREAD)) {
+ if (!event->channel->ring_count && (event->channel->state == ZAP_CHANNEL_STATE_DOWN && !zap_test_flag(event->channel, ZAP_CHANNEL_INTHREAD))) {
zap_set_state_locked(event->channel, ZAP_CHANNEL_STATE_GET_CALLERID);
event->channel->ring_count = 1;
+ zap_mutex_unlock(event->channel->mutex);
+ locked = 0;
zap_thread_create_detached(zap_analog_channel_run, event->channel);
} else {
event->channel->ring_count++;
if (event->channel->state != ZAP_CHANNEL_STATE_DOWN) {
zap_set_state_locked(event->channel, ZAP_CHANNEL_STATE_DOWN);
}
+
}
break;
case ZAP_OOB_FLASH:
zap_set_state_locked(event->channel, ZAP_CHANNEL_STATE_UP);
} else {
zap_set_state_locked(event->channel, ZAP_CHANNEL_STATE_DIALTONE);
+ zap_mutex_unlock(event->channel->mutex);
+ locked = 0;
zap_thread_create_detached(zap_analog_channel_run, event->channel);
}
} else {
}
}
}
-
- zap_mutex_unlock(event->channel->mutex);
+ if (locked) {
+ zap_mutex_unlock(event->channel->mutex);
+ }
return ZAP_SUCCESS;
}
if (state->dlen) {
goto add_byte;
}
-
+
if (state->bpos == 1) {
state->blen = byte;
if (!new_chan->dtmf_off) {
new_chan->dtmf_off = ZAP_DEFAULT_DTMF_OFF;
}
+
zap_mutex_create(&new_chan->mutex);
zap_buffer_create(&new_chan->digit_buffer, 128, 128, 0);
+
zap_set_flag(new_chan, ZAP_CHANNEL_CONFIGURED | ZAP_CHANNEL_READY);
*chan = new_chan;
return ZAP_SUCCESS;
assert(zchan != NULL);
if (zap_test_flag(zchan, ZAP_CHANNEL_SUSPENDED)) {
+ snprintf(zchan->last_error, sizeof(zchan->last_error), "%s", "Channel is suspended");
return ZAP_FAIL;
}
-
+
if (!zap_test_flag(zchan, ZAP_CHANNEL_READY) || (status = zap_mutex_trylock(zchan->mutex)) != ZAP_SUCCESS) {
+ snprintf(zchan->last_error, sizeof(zchan->last_error), "Channel is not ready or is in use %d %d", zap_test_flag(zchan, ZAP_CHANNEL_READY), status);
return status;
}
if (status == ZAP_SUCCESS) {
zap_set_flag(zchan, ZAP_CHANNEL_OPEN);
}
+ } else {
+ snprintf(zchan->last_error, sizeof(zchan->last_error), "%s", "Channel is not ready");
}
- zap_mutex_unlock(zchan->mutex);
+ zap_mutex_unlock(zchan->mutex);
return status;
}
zap_status_t zap_channel_done(zap_channel_t *zchan)
{
- int i;
-
assert(zchan != NULL);
memset(&zchan->caller_data, 0, sizeof(zchan->caller_data));
zap_clear_flag_locked(zchan, ZAP_CHANNEL_INUSE);
zap_clear_flag_locked(zchan, ZAP_CHANNEL_OUTBOUND);
- for (i = 0; i < 2; i++) {
- if (zchan->fds[i] > -1) {
- close(zchan->fds[i]);
- zchan->fds[i] = -1;
- }
- }
return ZAP_SUCCESS;
}
close(zchan->fds[0]);
zchan->fds[0] = -1;
}
- if ((zchan->fds[0] = open(path, O_WRONLY|O_CREAT|O_TRUNC, 755)) > -1) {
+ if ((zchan->fds[0] = open(path, O_WRONLY | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR)) > -1) {
+ zap_log(ZAP_LOG_DEBUG, "Tracing channel %u:%u to [%s]\n", zchan->span_id, zchan->chan_id, path);
GOTO_STATUS(done, ZAP_SUCCESS);
}
{
char *path = (char *) obj;
if (zchan->fds[1] > 0) {
- close(zchan->fds[0]);
+ close(zchan->fds[1]);
zchan->fds[1] = -1;
}
- if ((zchan->fds[1] = open(path, O_WRONLY|O_CREAT|O_TRUNC, 755)) > -1) {
+ if ((zchan->fds[1] = open(path, O_WRONLY | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR)) > -1) {
+ zap_log(ZAP_LOG_DEBUG, "Tracing channel %u:%u to [%s]\n", zchan->span_id, zchan->chan_id, path);
GOTO_STATUS(done, ZAP_SUCCESS);
}
return bytes;
}
+void zap_channel_flush_dtmf(zap_channel_t *zchan)
+{
+ if (zchan->digit_buffer && zap_buffer_inuse(zchan->digit_buffer)) {
+ zap_mutex_lock(zchan->mutex);
+ zap_buffer_zero(zchan->digit_buffer);
+ zap_mutex_unlock(zchan->mutex);
+ }
+}
zap_status_t zap_channel_queue_dtmf(zap_channel_t *zchan, const char *dtmf)
{
return ZAP_SUCCESS;
}
-zap_status_t zap_mutex_lock(zap_mutex_t *mutex)
+zap_status_t _zap_mutex_lock(zap_mutex_t *mutex)
{
#ifdef WIN32
EnterCriticalSection(&mutex->mutex);
return ZAP_SUCCESS;
}
-zap_status_t zap_mutex_trylock(zap_mutex_t *mutex)
+zap_status_t _zap_mutex_trylock(zap_mutex_t *mutex)
{
#ifdef WIN32
if (!TryEnterCriticalSection(&mutex->mutex))
return ZAP_SUCCESS;
}
-zap_status_t zap_mutex_unlock(zap_mutex_t *mutex)
+zap_status_t _zap_mutex_unlock(zap_mutex_t *mutex)
{
#ifdef WIN32
LeaveCriticalSection(&mutex->mutex);
return ZAP_SUCCESS;
}
+
+
+
+
/* For Emacs:
* Local Variables:
* mode:c
struct zt_chanconfig cc;
memset(&cc, 0, sizeof(cc));
cc.chan = cc.master = x;
+
switch(type) {
case ZAP_CHAN_TYPE_FXS:
{
default:
break;
}
+
if (ioctl(CONTROL_FD, ZT_CHANCONFIG, &cc)) {
- zap_log(ZAP_LOG_ERROR, "failure configuring device %s chan %d fd %d (%s)\n",
- path, x, CONTROL_FD, strerror(errno));
- close(sockfd);
- break;
+ zap_log(ZAP_LOG_WARNING, "this ioctl fails on older zaptel but is harmless if you used ztcfg\n[device %s chan %d fd %d (%s)]\n", path, x, CONTROL_FD, strerror(errno));
}
}
static ZIO_OPEN_FUNCTION(zt_open)
{
zap_channel_set_feature(zchan, ZAP_CHANNEL_FEATURE_INTERVAL);
-
+
if (zchan->type == ZAP_CHAN_TYPE_DQ921 || zchan->type == ZAP_CHAN_TYPE_DQ931) {
zchan->native_codec = zchan->effective_codec = ZAP_CODEC_NONE;
} else {