mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-08-13 09:36:46 +00:00
Merge remote branch 'fsorig/master' into releases.3.5
Conflicts: build/modules.conf.in libs/freetdm/mod_freetdm/mod_freetdm.c
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2007, Anthony Minessale II
|
||||
* Copyright (c) 2007-2012, Anthony Minessale II
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2007, Anthony Minessale II
|
||||
* Copyright (c) 2007-2012, Anthony Minessale II
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2007, Anthony Minessale II
|
||||
* Copyright (c) 2007-2012, Anthony Minessale II
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -5745,7 +5745,7 @@ done:
|
||||
|
||||
static ftdm_status_t ftdm_cpu_monitor_start(void)
|
||||
{
|
||||
if (ftdm_interrupt_create(&globals.cpu_monitor.interrupt, FTDM_INVALID_SOCKET) != FTDM_SUCCESS) {
|
||||
if (ftdm_interrupt_create(&globals.cpu_monitor.interrupt, FTDM_INVALID_SOCKET, FTDM_NO_FLAGS) != FTDM_SUCCESS) {
|
||||
ftdm_log(FTDM_LOG_CRIT, "Failed to create CPU monitor interrupt\n");
|
||||
return FTDM_FAIL;
|
||||
}
|
||||
|
@@ -98,7 +98,7 @@ static ftdm_status_t ftdm_std_queue_create(ftdm_queue_t **outqueue, ftdm_size_t
|
||||
goto failed;
|
||||
}
|
||||
|
||||
if (ftdm_interrupt_create(&queue->interrupt, FTDM_INVALID_SOCKET) != FTDM_SUCCESS) {
|
||||
if (ftdm_interrupt_create(&queue->interrupt, FTDM_INVALID_SOCKET, FTDM_NO_FLAGS) != FTDM_SUCCESS) {
|
||||
goto failed;
|
||||
}
|
||||
|
||||
|
@@ -272,7 +272,7 @@ static ftdm_status_t ftdm_core_set_state(const char *file, const char *func, int
|
||||
}
|
||||
|
||||
if (!ftdmchan->state_completed_interrupt) {
|
||||
status = ftdm_interrupt_create(&ftdmchan->state_completed_interrupt, FTDM_INVALID_SOCKET);
|
||||
status = ftdm_interrupt_create(&ftdmchan->state_completed_interrupt, FTDM_INVALID_SOCKET, FTDM_NO_FLAGS);
|
||||
if (status != FTDM_SUCCESS) {
|
||||
ftdm_log_chan_ex(ftdmchan, file, func, line, FTDM_LOG_LEVEL_CRIT,
|
||||
"Failed to create state change interrupt when moving from %s to %s\n", ftdm_channel_state2str(ftdmchan->state), ftdm_channel_state2str(state));
|
||||
|
@@ -73,6 +73,8 @@ struct ftdm_mutex {
|
||||
|
||||
struct ftdm_interrupt {
|
||||
ftdm_socket_t device;
|
||||
ftdm_wait_flag_t device_input_flags;
|
||||
ftdm_wait_flag_t device_output_flags;
|
||||
#ifdef WIN32
|
||||
/* for generic interruption */
|
||||
HANDLE event;
|
||||
@@ -323,7 +325,7 @@ FT_DECLARE(ftdm_status_t) _ftdm_mutex_unlock(const char *file, int line, const c
|
||||
}
|
||||
|
||||
|
||||
FT_DECLARE(ftdm_status_t) ftdm_interrupt_create(ftdm_interrupt_t **ininterrupt, ftdm_socket_t device)
|
||||
FT_DECLARE(ftdm_status_t) ftdm_interrupt_create(ftdm_interrupt_t **ininterrupt, ftdm_socket_t device, ftdm_wait_flag_t device_flags)
|
||||
{
|
||||
ftdm_status_t status = FTDM_SUCCESS;
|
||||
ftdm_interrupt_t *interrupt = NULL;
|
||||
@@ -340,6 +342,7 @@ FT_DECLARE(ftdm_status_t) ftdm_interrupt_create(ftdm_interrupt_t **ininterrupt,
|
||||
}
|
||||
|
||||
interrupt->device = device;
|
||||
interrupt->device_input_flags = device_flags;
|
||||
#ifdef WIN32
|
||||
interrupt->event = CreateEvent(NULL, FALSE, FALSE, NULL);
|
||||
if (!interrupt->event) {
|
||||
@@ -389,15 +392,16 @@ FT_DECLARE(ftdm_status_t) ftdm_interrupt_wait(ftdm_interrupt_t *interrupt, int m
|
||||
char pipebuf[255];
|
||||
#endif
|
||||
|
||||
ftdm_assert_return(interrupt != NULL, FTDM_FAIL, "Condition is null!\n");
|
||||
|
||||
ftdm_assert_return(interrupt != NULL, FTDM_FAIL, "Interrupt is null!\n");
|
||||
|
||||
interrupt->device_output_flags = FTDM_NO_FLAGS;
|
||||
/* start implementation */
|
||||
#ifdef WIN32
|
||||
ints[0] = interrupt->event;
|
||||
if (interrupt->device != FTDM_INVALID_SOCKET) {
|
||||
num++;
|
||||
ints[1] = interrupt->device;
|
||||
ftdm_log(FTDM_LOG_CRIT, "implement me! (Windows support for device_output_flags member!)\n");
|
||||
}
|
||||
res = WaitForMultipleObjects(num, ints, FALSE, ms >= 0 ? ms : INFINITE);
|
||||
switch (res) {
|
||||
@@ -422,7 +426,7 @@ pollagain:
|
||||
if (interrupt->device != FTDM_INVALID_SOCKET) {
|
||||
num++;
|
||||
ints[1].fd = interrupt->device;
|
||||
ints[1].events = POLLIN;
|
||||
ints[1].events = interrupt->device_input_flags;
|
||||
ints[1].revents = 0;
|
||||
}
|
||||
|
||||
@@ -446,7 +450,17 @@ pollagain:
|
||||
ftdm_log(FTDM_LOG_CRIT, "reading interrupt descriptor failed (%s)\n", strerror(errno));
|
||||
}
|
||||
}
|
||||
|
||||
if (interrupt->device != FTDM_INVALID_SOCKET) {
|
||||
if (ints[1].revents & POLLIN) {
|
||||
interrupt->device_output_flags |= FTDM_READ;
|
||||
}
|
||||
if (ints[1].revents & POLLOUT) {
|
||||
interrupt->device_output_flags |= FTDM_WRITE;
|
||||
}
|
||||
if (ints[1].revents & POLLPRI) {
|
||||
interrupt->device_output_flags |= FTDM_EVENTS;
|
||||
}
|
||||
}
|
||||
return FTDM_SUCCESS;
|
||||
#endif
|
||||
}
|
||||
@@ -515,10 +529,12 @@ FT_DECLARE(ftdm_status_t) ftdm_interrupt_multiple_wait(ftdm_interrupt_t *interru
|
||||
|
||||
for (i = 0; i < size; i++) {
|
||||
ints[i] = interrupts[i]->event;
|
||||
interrupts[i]->device_output_flags = FTDM_NO_FLAGS;
|
||||
if (interrupts[i]->device != FTDM_INVALID_SOCKET) {
|
||||
|
||||
/* WARNING: if the device is ready for data we must implement for Windows the device_output_flags member */
|
||||
ints[size+numdevices] = interrupts[i]->device;
|
||||
numdevices++;
|
||||
ftdm_log(FTDM_LOG_CRIT, "implement me! (Windows support for device_data_ready member!)\n", size);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -548,17 +564,16 @@ pollagain:
|
||||
ints[i].events = POLLIN;
|
||||
ints[i].revents = 0;
|
||||
ints[i].fd = interrupts[i]->readfd;
|
||||
interrupts[i]->device_output_flags = FTDM_NO_FLAGS;
|
||||
if (interrupts[i]->device != FTDM_INVALID_SOCKET) {
|
||||
ints[size+numdevices].events = POLLIN;
|
||||
ints[size+numdevices].events = interrupts[i]->device_input_flags;
|
||||
ints[size+numdevices].revents = 0;
|
||||
ints[size+numdevices].fd = interrupts[i]->device;
|
||||
|
||||
numdevices++;
|
||||
}
|
||||
}
|
||||
|
||||
res = poll(ints, size + numdevices, ms);
|
||||
|
||||
if (res == -1) {
|
||||
if (errno == EINTR) {
|
||||
goto pollagain;
|
||||
@@ -571,7 +586,8 @@ pollagain:
|
||||
return FTDM_TIMEOUT;
|
||||
}
|
||||
|
||||
/* check for events in the pipes, NOT in the devices */
|
||||
/* check for events in the pipes and in the devices, but service only the pipes */
|
||||
numdevices = 0;
|
||||
for (i = 0; i < size; i++) {
|
||||
if (ints[i].revents & POLLIN) {
|
||||
res = read(ints[i].fd, pipebuf, sizeof(pipebuf));
|
||||
@@ -579,6 +595,18 @@ pollagain:
|
||||
ftdm_log(FTDM_LOG_CRIT, "reading interrupt descriptor failed (%s)\n", strerror(errno));
|
||||
}
|
||||
}
|
||||
if (interrupts[i]->device != FTDM_INVALID_SOCKET) {
|
||||
if (ints[size+numdevices].revents & POLLIN) {
|
||||
interrupts[i]->device_output_flags |= FTDM_READ;
|
||||
}
|
||||
if (ints[size+numdevices].revents & POLLOUT) {
|
||||
interrupts[i]->device_output_flags |= FTDM_WRITE;
|
||||
}
|
||||
if (ints[size+numdevices].revents & POLLPRI) {
|
||||
interrupts[i]->device_output_flags |= FTDM_EVENTS;
|
||||
}
|
||||
numdevices++;
|
||||
}
|
||||
}
|
||||
#else
|
||||
/* for MacOS compilation, unused vars */
|
||||
@@ -587,6 +615,15 @@ pollagain:
|
||||
return FTDM_SUCCESS;
|
||||
}
|
||||
|
||||
FT_DECLARE(ftdm_wait_flag_t) ftdm_interrupt_device_ready(ftdm_interrupt_t *interrupt)
|
||||
{
|
||||
#if defined(__WINDOWS__)
|
||||
/* device output flags are not currently filled for Windows upon returning from a wait function */
|
||||
ftdm_log(FTDM_LOG_CRIT, "IMPLEMENT ME!\n");
|
||||
#endif
|
||||
return interrupt->device_output_flags;
|
||||
}
|
||||
|
||||
/* For Emacs:
|
||||
* Local Variables:
|
||||
* mode:c
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2007, Anthony Minessale II
|
||||
* Copyright (c) 2007-2012, Anthony Minessale II
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2007, Anthony Minessale II
|
||||
* Copyright (c) 2007-2012, Anthony Minessale II
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2008, Anthony Minessale II
|
||||
* Copyright (c) 2008-2012, Anthony Minessale II
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2008, Anthony Minessale II
|
||||
* Copyright (c) 2008-2012, Anthony Minessale II
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
1329
libs/freetdm/src/ftmod/ftmod_gsm/ftmod_gsm.c
Executable file
1329
libs/freetdm/src/ftmod/ftmod_gsm/ftmod_gsm.c
Executable file
File diff suppressed because it is too large
Load Diff
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2007, Anthony Minessale II
|
||||
* Copyright (c) 2007-2012, Anthony Minessale II
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2007, Anthony Minessale II
|
||||
* Copyright (c) 2007-2012, Anthony Minessale II
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2007, Anthony Minessale II
|
||||
* Copyright (c) 2007-2012, Anthony Minessale II
|
||||
* Copyright (c) 2010, Stefan Knoblich <s.knoblich@axsentis.de>
|
||||
* All rights reserved.
|
||||
*
|
||||
@@ -114,42 +114,40 @@ static FIO_CHANNEL_REQUEST_FUNCTION(isdn_channel_request)
|
||||
return FTDM_FAIL;
|
||||
}
|
||||
|
||||
#ifdef WIN32
|
||||
/**
|
||||
* \brief Logs a libpri error
|
||||
* \param s Error string
|
||||
*/
|
||||
static void s_pri_error(char *s)
|
||||
#else
|
||||
/**
|
||||
* \brief Logs a libpri error
|
||||
* \param pri libpri structure (unused)
|
||||
* \param s Error string
|
||||
*/
|
||||
static void s_pri_error(struct pri *pri, char *s)
|
||||
#endif
|
||||
{
|
||||
ftdm_log(FTDM_LOG_ERROR, "%s", s);
|
||||
}
|
||||
|
||||
#ifdef WIN32
|
||||
/**
|
||||
* \brief Logs a libpri message
|
||||
* \param s Message string
|
||||
*/
|
||||
static void s_pri_message(char *s)
|
||||
#else
|
||||
/**
|
||||
* \brief Logs a libpri message
|
||||
* \param pri libpri structure (unused)
|
||||
* \param s Message string
|
||||
* \param pri libpri structure
|
||||
* \param s Message string
|
||||
*/
|
||||
static void s_pri_message(struct pri *pri, char *s)
|
||||
#endif
|
||||
{
|
||||
ftdm_log(FTDM_LOG_DEBUG, "%s", s);
|
||||
struct lpwrap_pri *spri = pri_get_userdata(pri);
|
||||
|
||||
if (spri && spri->dchan) {
|
||||
ftdm_log_chan(spri->dchan, FTDM_LOG_DEBUG, "%s", s);
|
||||
} else {
|
||||
ftdm_log(FTDM_LOG_DEBUG, "%s", s);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Logs a libpri error
|
||||
* \param pri libpri structure
|
||||
* \param s Error string
|
||||
*/
|
||||
static void s_pri_error(struct pri *pri, char *s)
|
||||
{
|
||||
struct lpwrap_pri *spri = pri_get_userdata(pri);
|
||||
|
||||
if (spri && spri->dchan) {
|
||||
ftdm_log_chan(spri->dchan, FTDM_LOG_ERROR, "%s", s);
|
||||
} else {
|
||||
ftdm_log(FTDM_LOG_ERROR, "%s", s);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#define PRI_DEBUG_Q921_ALL (PRI_DEBUG_Q921_RAW | PRI_DEBUG_Q921_DUMP | PRI_DEBUG_Q921_STATE)
|
||||
#define PRI_DEBUG_Q931_ALL (PRI_DEBUG_Q931_DUMP | PRI_DEBUG_Q931_STATE | PRI_DEBUG_Q931_ANOMALY)
|
||||
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2009, Anthony Minessale II
|
||||
* Copyright (c) 2009-2012, Anthony Minessale II
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2009, Anthony Minessale II
|
||||
* Copyright (c) 2009-2012, Anthony Minessale II
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2009, Anthony Minessale II
|
||||
* Copyright (c) 2009-2012, Anthony Minessale II
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@@ -45,8 +45,6 @@
|
||||
#include <poll.h>
|
||||
#include <pthread.h>
|
||||
|
||||
#include <sys/timerfd.h>
|
||||
|
||||
/* this is how it should have been...
|
||||
#ifdef HAVE_FREETDM_FREETDM_H
|
||||
#include <freetdm/freetdm.h>
|
||||
@@ -256,7 +254,6 @@ struct misdn_chan_private {
|
||||
/* */
|
||||
int state;
|
||||
int debugfd;
|
||||
int timerfd;
|
||||
int active;
|
||||
|
||||
/* hw addr of channel */
|
||||
@@ -941,36 +938,7 @@ static FIO_OPEN_FUNCTION(misdn_open)
|
||||
ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "mISDN channel activation request sent\n");
|
||||
|
||||
switch (ftdmchan->type) {
|
||||
case FTDM_CHAN_TYPE_B: {
|
||||
#if 0
|
||||
struct itimerspec its = {
|
||||
.it_interval = { 0, 0 },
|
||||
.it_value = { 0, 0 },
|
||||
};
|
||||
|
||||
its.it_interval.tv_nsec = (ftdmchan->effective_interval * 1000000);
|
||||
its.it_value.tv_nsec = (ftdmchan->effective_interval * 1000000);
|
||||
|
||||
/* create tx timerfd */
|
||||
chan_priv->timerfd = timerfd_create(CLOCK_MONOTONIC, O_NONBLOCK);
|
||||
if (chan_priv->timerfd < 0) {
|
||||
ftdm_log_chan(ftdmchan, FTDM_LOG_ERROR, "mISDN failed to create b-channel tx interval timer: %s\n",
|
||||
strerror(errno));
|
||||
return FTDM_FAIL;
|
||||
}
|
||||
|
||||
/* start tx timerfd */
|
||||
ret = timerfd_settime(chan_priv->timerfd, 0, &its, NULL);
|
||||
if (ret < 0) {
|
||||
ftdm_log_chan(ftdmchan, FTDM_LOG_ERROR, "mISDN failed to start b-channel tx interval timer: %s\n",
|
||||
strerror(errno));
|
||||
return FTDM_FAIL;
|
||||
}
|
||||
|
||||
ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "mISDN created tx interval (%d ms) timer\n",
|
||||
ftdmchan->effective_interval);
|
||||
#endif
|
||||
}
|
||||
case FTDM_CHAN_TYPE_B:
|
||||
case FTDM_CHAN_TYPE_DQ921:
|
||||
chan_priv->state = MISDN_CHAN_STATE_OPEN;
|
||||
break;
|
||||
@@ -998,15 +966,6 @@ static FIO_CLOSE_FUNCTION(misdn_close)
|
||||
|
||||
/* deactivate b-channels on close */
|
||||
if (ftdm_channel_get_type(ftdmchan) == FTDM_CHAN_TYPE_B) {
|
||||
#if 0
|
||||
/*
|
||||
* Stop tx timerfd
|
||||
*/
|
||||
if (chan_priv->timerfd >= 0) {
|
||||
close(chan_priv->timerfd);
|
||||
chan_priv->timerfd = -1;
|
||||
}
|
||||
#endif
|
||||
/*
|
||||
* Send deactivation request (don't wait for answer)
|
||||
*/
|
||||
@@ -1570,7 +1529,6 @@ static ftdm_status_t misdn_open_range(ftdm_span_t *span, ftdm_chan_type_t type,
|
||||
|
||||
priv->addr = addr;
|
||||
priv->debugfd = -1;
|
||||
priv->timerfd = -1;
|
||||
|
||||
/*
|
||||
* Create event queue
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2007, Anthony Minessale II
|
||||
* Copyright (c) 2007-2012, Anthony Minessale II
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2007, Anthony Minessale II
|
||||
* Copyright (c) 2007-2012, Anthony Minessale II
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@@ -953,6 +953,12 @@ void sngisdn_process_sta_cfm (sngisdn_event_data_t *sngisdn_event)
|
||||
break;
|
||||
case 2: /* overlap sending */
|
||||
switch (ftdmchan->state) {
|
||||
case FTDM_CHANNEL_STATE_COLLECT:
|
||||
/* T302 Timeout reached */
|
||||
/* Send the call to user, and see if they accept it */
|
||||
ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "T302 Timer expired, proceeding with call\n");
|
||||
ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_RING);
|
||||
break;
|
||||
case FTDM_CHANNEL_STATE_PROCEED:
|
||||
case FTDM_CHANNEL_STATE_PROGRESS:
|
||||
case FTDM_CHANNEL_STATE_RINGING:
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2007, Anthony Minessale II
|
||||
* Copyright (c) 2007-2012, Anthony Minessale II
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
44
libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c
Normal file → Executable file
44
libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c
Normal file → Executable file
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2007, Anthony Minessale II
|
||||
* Copyright (c) 2007-2012, Anthony Minessale II
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -36,9 +36,9 @@
|
||||
* David Yat Sin <davidy@sangoma.com>
|
||||
* Nenad Corbic <ncorbic@sangoma.com>
|
||||
* Arnaldo Pereira <arnaldo@sangoma.com>
|
||||
* Gideon Sadan <gsadan@sangoma.com>
|
||||
*
|
||||
*/
|
||||
|
||||
*/
|
||||
#ifdef WP_DEBUG_IO
|
||||
#define _BSD_SOURCE
|
||||
#include <syscall.h>
|
||||
@@ -121,6 +121,16 @@ FIO_SPAN_POLL_EVENT_FUNCTION(wanpipe_poll_event);
|
||||
FIO_SPAN_NEXT_EVENT_FUNCTION(wanpipe_span_next_event);
|
||||
FIO_CHANNEL_NEXT_EVENT_FUNCTION(wanpipe_channel_next_event);
|
||||
|
||||
static void wp_swap16(char *data, int datalen)
|
||||
{
|
||||
int i = 0;
|
||||
uint16_t *samples = data;
|
||||
for (i = 0; i < datalen/2; i++) {
|
||||
uint16_t sample = ((samples[i] & 0x00FF) << 8) | ((samples[i] & 0xFF00) >> 8);
|
||||
samples[i] = sample;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Poll for event on a wanpipe socket
|
||||
* \param fd Wanpipe socket descriptor
|
||||
@@ -305,11 +315,20 @@ static unsigned wp_open_range(ftdm_span_t *span, unsigned spanno, unsigned start
|
||||
|
||||
err = sangoma_tdm_get_hw_coding(chan->sockfd, &tdm_api);
|
||||
|
||||
|
||||
|
||||
if (tdm_api.wp_tdm_cmd.hw_tdm_coding) {
|
||||
chan->native_codec = chan->effective_codec = FTDM_CODEC_ALAW;
|
||||
} else {
|
||||
chan->native_codec = chan->effective_codec = FTDM_CODEC_ULAW;
|
||||
}
|
||||
|
||||
|
||||
if ((span->trunk_type == FTDM_TRUNK_GSM) && (chan->type == FTDM_CHAN_TYPE_B)) {
|
||||
chan->native_codec = FTDM_CODEC_SLIN;
|
||||
chan->native_interval = 20;
|
||||
chan->packet_len = 320;
|
||||
}
|
||||
|
||||
err = sangoma_tdm_get_hw_dtmf(chan->sockfd, &tdm_api);
|
||||
if (err > 0) {
|
||||
@@ -580,8 +599,9 @@ static FIO_OPEN_FUNCTION(wanpipe_open)
|
||||
|
||||
ftdm_channel_set_feature(ftdmchan, FTDM_CHANNEL_FEATURE_INTERVAL);
|
||||
ftdmchan->effective_interval = ftdmchan->native_interval = wp_globals.codec_ms;
|
||||
ftdmchan->packet_len = ftdmchan->native_interval * 8;
|
||||
|
||||
|
||||
/* The packet len will depend on the codec and interval */
|
||||
ftdmchan->packet_len = ftdmchan->native_interval * ((ftdmchan->native_codec==FTDM_CODEC_SLIN) ? 16 : 8);
|
||||
if (wp_globals.txqueue_size > 0) {
|
||||
ftdm_channel_command(ftdmchan, FTDM_COMMAND_SET_TX_QUEUE_SIZE, &wp_globals.txqueue_size);
|
||||
}
|
||||
@@ -772,6 +792,7 @@ static FIO_COMMAND_FUNCTION(wanpipe_command)
|
||||
case FTDM_COMMAND_SET_INTERVAL:
|
||||
{
|
||||
err=sangoma_tdm_set_usr_period(ftdmchan->sockfd, &tdm_api, FTDM_COMMAND_OBJ_INT);
|
||||
|
||||
ftdmchan->packet_len = ftdmchan->native_interval * (ftdmchan->effective_codec == FTDM_CODEC_SLIN ? 16 : 8);
|
||||
}
|
||||
break;
|
||||
@@ -793,7 +814,7 @@ static FIO_COMMAND_FUNCTION(wanpipe_command)
|
||||
FTDM_COMMAND_OBJ_INT = wanpipe_swap_bits(rbsbits);
|
||||
}
|
||||
#else
|
||||
// does sangoma_tdm_read_rbs is available here?
|
||||
/* is sangoma_tdm_read_rbs available here? */
|
||||
FTDM_COMMAND_OBJ_INT = ftdmchan->rx_cas_bits;
|
||||
#endif
|
||||
}
|
||||
@@ -969,12 +990,15 @@ static void wanpipe_read_stats(ftdm_channel_t *ftdmchan, wp_tdm_api_rx_hdr_t *rx
|
||||
* \param datalen Size of data buffer
|
||||
* \return Success, failure or timeout
|
||||
*/
|
||||
|
||||
|
||||
static FIO_READ_FUNCTION(wanpipe_read)
|
||||
{
|
||||
int rx_len = 0;
|
||||
int rq_len = (int)*datalen;
|
||||
wp_tdm_api_rx_hdr_t hdrframe;
|
||||
|
||||
|
||||
#ifdef WP_DEBUG_IO
|
||||
wp_channel_t *wchan = ftdmchan->io_data;
|
||||
ftdm_time_t time_diff = 0;
|
||||
@@ -1034,6 +1058,10 @@ static FIO_READ_FUNCTION(wanpipe_read)
|
||||
wanpipe_read_stats(ftdmchan, &hdrframe);
|
||||
}
|
||||
|
||||
if ((ftdmchan->type == FTDM_CHAN_TYPE_B) && (ftdmchan->span->trunk_type == FTDM_TRUNK_GSM)) {
|
||||
wp_swap16(data, *datalen);
|
||||
}
|
||||
|
||||
return FTDM_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -1050,6 +1078,10 @@ static FIO_WRITE_FUNCTION(wanpipe_write)
|
||||
int err = 0;
|
||||
wp_tdm_api_tx_hdr_t hdrframe;
|
||||
|
||||
if ((ftdmchan->type == FTDM_CHAN_TYPE_B) && (ftdmchan->span->trunk_type == FTDM_TRUNK_GSM)) {
|
||||
wp_swap16(data, *datalen);
|
||||
}
|
||||
|
||||
/* Do we even need the headerframe here? on windows, we don't even pass it to the driver */
|
||||
memset(&hdrframe, 0, sizeof(hdrframe));
|
||||
if (*datalen == 0) {
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2007, Anthony Minessale II
|
||||
* Copyright (c) 2007-2012, Anthony Minessale II
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -561,7 +561,7 @@ static FIO_CONFIGURE_FUNCTION(zt_configure)
|
||||
}
|
||||
} else if (!strcasecmp(var, "echo_cancel_level")) {
|
||||
num = atoi(val);
|
||||
if (num < 0 || num > 256) {
|
||||
if (num < 0 || num > 1024) {
|
||||
ftdm_log(FTDM_LOG_WARNING, "invalid echo can val at line %d\n", lineno);
|
||||
} else {
|
||||
zt_globals.eclevel = num;
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2007, Anthony Minessale II
|
||||
* Copyright (c) 2007-2012, Anthony Minessale II
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2007, Anthony Minessale II
|
||||
* Copyright (c) 2007-2012, Anthony Minessale II
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -62,6 +62,9 @@
|
||||
/*! \brief Max number of groups */
|
||||
#define FTDM_MAX_GROUPS_INTERFACE FTDM_MAX_SPANS_INTERFACE
|
||||
|
||||
/*! \brief Max number of key=value pairs to be sent as signaling stack parameters */
|
||||
#define FTDM_MAX_SIG_PARAMETERS 30
|
||||
|
||||
#define FTDM_INVALID_INT_PARM 0xFF
|
||||
|
||||
/*! \brief Thread/Mutex OS abstraction API. */
|
||||
@@ -343,6 +346,11 @@ typedef struct {
|
||||
uint8_t plan;
|
||||
} ftdm_number_t;
|
||||
|
||||
typedef struct {
|
||||
char from[FTDM_MAX_NUMBER_STR_SZ];
|
||||
char body[FTDM_MAX_NAME_STR_SZ];
|
||||
} ftdm_sms_data_t;
|
||||
|
||||
/*! \brief Caller information */
|
||||
typedef struct ftdm_caller_data {
|
||||
char cid_date[8]; /*!< Caller ID date */
|
||||
@@ -454,12 +462,13 @@ typedef enum {
|
||||
FTDM_SIGEVENT_INDICATION_COMPLETED, /*!< Last requested indication was completed */
|
||||
FTDM_SIGEVENT_DIALING, /*!< Outgoing call just started */
|
||||
FTDM_SIGEVENT_TRANSFER_COMPLETED, /*!< Transfer request is completed */
|
||||
FTDM_SIGEVENT_SMS,
|
||||
FTDM_SIGEVENT_INVALID, /*!<Invalid */
|
||||
} ftdm_signal_event_t;
|
||||
#define SIGNAL_STRINGS "START", "STOP", "RELEASED", "UP", "FLASH", "PROCEED", "RINGING", "PROGRESS", \
|
||||
"PROGRESS_MEDIA", "ALARM_TRAP", "ALARM_CLEAR", \
|
||||
"COLLECTED_DIGIT", "ADD_CALL", "RESTART", "SIGSTATUS_CHANGED", "FACILITY", \
|
||||
"TRACE", "TRACE_RAW", "INDICATION_COMPLETED", "DIALING", "TRANSFER_COMPLETED", "INVALID"
|
||||
"TRACE", "TRACE_RAW", "INDICATION_COMPLETED", "DIALING", "TRANSFER_COMPLETED", "SMS", "INVALID"
|
||||
/*! \brief Move from string to ftdm_signal_event_t and viceversa */
|
||||
FTDM_STR2ENUM_P(ftdm_str2ftdm_signal_event, ftdm_signal_event2str, ftdm_signal_event_t)
|
||||
|
||||
@@ -473,9 +482,10 @@ typedef enum {
|
||||
FTDM_TRUNK_FXO,
|
||||
FTDM_TRUNK_FXS,
|
||||
FTDM_TRUNK_EM,
|
||||
FTDM_TRUNK_GSM,
|
||||
FTDM_TRUNK_NONE
|
||||
} ftdm_trunk_type_t;
|
||||
#define TRUNK_STRINGS "E1", "T1", "J1", "BRI", "BRI_PTMP", "FXO", "FXS", "EM", "NONE"
|
||||
#define TRUNK_STRINGS "E1", "T1", "J1", "BRI", "BRI_PTMP", "FXO", "FXS", "EM", "GSM", "NONE"
|
||||
|
||||
/*! \brief Move from string to ftdm_trunk_type_t and viceversa */
|
||||
FTDM_STR2ENUM_P(ftdm_str2ftdm_trunk_type, ftdm_trunk_type2str, ftdm_trunk_type_t)
|
||||
@@ -623,14 +633,6 @@ typedef enum {
|
||||
FTDM_CRASH_ON_ASSERT
|
||||
} ftdm_crash_policy_t;
|
||||
|
||||
/*! \brief I/O waiting flags */
|
||||
typedef enum {
|
||||
FTDM_NO_FLAGS = 0,
|
||||
FTDM_READ = (1 << 0),
|
||||
FTDM_WRITE = (1 << 1),
|
||||
FTDM_EVENTS = (1 << 2)
|
||||
} ftdm_wait_flag_t;
|
||||
|
||||
/*! \brief Signaling configuration parameter for the stacks (variable=value pair) */
|
||||
typedef struct ftdm_conf_parameter {
|
||||
const char *var;
|
||||
|
@@ -203,6 +203,14 @@ typedef enum {
|
||||
FTDM_TRUE
|
||||
} ftdm_bool_t;
|
||||
|
||||
/*! \brief I/O waiting flags */
|
||||
typedef enum {
|
||||
FTDM_NO_FLAGS = 0,
|
||||
FTDM_READ = (1 << 0),
|
||||
FTDM_WRITE = (1 << 1),
|
||||
FTDM_EVENTS = (1 << 2)
|
||||
} ftdm_wait_flag_t;
|
||||
|
||||
/*!
|
||||
* \brief FreeTDM channel.
|
||||
* This is the basic data structure used to place calls and I/O operations
|
||||
|
@@ -52,11 +52,12 @@ FT_DECLARE(ftdm_status_t) _ftdm_mutex_trylock(const char *file, int line, const
|
||||
#define ftdm_mutex_unlock(_x) _ftdm_mutex_unlock(__FILE__, __LINE__, __FUNCTION__, _x)
|
||||
FT_DECLARE(ftdm_status_t) _ftdm_mutex_unlock(const char *file, int line, const char *func, ftdm_mutex_t *mutex);
|
||||
|
||||
FT_DECLARE(ftdm_status_t) ftdm_interrupt_create(ftdm_interrupt_t **cond, ftdm_socket_t device);
|
||||
FT_DECLARE(ftdm_status_t) ftdm_interrupt_create(ftdm_interrupt_t **cond, ftdm_socket_t device, ftdm_wait_flag_t device_flags);
|
||||
FT_DECLARE(ftdm_status_t) ftdm_interrupt_destroy(ftdm_interrupt_t **cond);
|
||||
FT_DECLARE(ftdm_status_t) ftdm_interrupt_signal(ftdm_interrupt_t *cond);
|
||||
FT_DECLARE(ftdm_status_t) ftdm_interrupt_wait(ftdm_interrupt_t *cond, int ms);
|
||||
FT_DECLARE(ftdm_status_t) ftdm_interrupt_multiple_wait(ftdm_interrupt_t *interrupts[], ftdm_size_t size, int ms);
|
||||
FT_DECLARE(ftdm_wait_flag_t) ftdm_interrupt_device_ready(ftdm_interrupt_t *interrupt);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2007, Anthony Minessale II
|
||||
* Copyright (c) 2007-2012, Anthony Minessale II
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2007, Anthony Minessale II
|
||||
* Copyright (c) 2007-2012, Anthony Minessale II
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2007, Anthony Minessale II
|
||||
* Copyright (c) 2007-2012, Anthony Minessale II
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -163,7 +163,8 @@ typedef enum {
|
||||
FTDM_SIGTYPE_SANGOMABOOST,
|
||||
FTDM_SIGTYPE_M3UA,
|
||||
FTDM_SIGTYPE_R2,
|
||||
FTDM_SIGTYPE_SS7
|
||||
FTDM_SIGTYPE_SS7,
|
||||
FTDM_SIGTYPE_GSM
|
||||
} ftdm_signal_type_t;
|
||||
|
||||
typedef enum {
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* libteletone
|
||||
* Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org>
|
||||
* Copyright (C) 2005-2012, Anthony Minessale II <anthm@freeswitch.org>
|
||||
*
|
||||
* Version: MPL 1.1
|
||||
*
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* libteletone
|
||||
* Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org>
|
||||
* Copyright (C) 2005-2012, Anthony Minessale II <anthm@freeswitch.org>
|
||||
*
|
||||
* Version: MPL 1.1
|
||||
*
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* libteletone
|
||||
* Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org>
|
||||
* Copyright (C) 2005-2012, Anthony Minessale II <anthm@freeswitch.org>
|
||||
*
|
||||
* Version: MPL 1.1
|
||||
*
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* libteletone
|
||||
* Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org>
|
||||
* Copyright (C) 2005-2012, Anthony Minessale II <anthm@freeswitch.org>
|
||||
*
|
||||
* Version: MPL 1.1
|
||||
*
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* libteletone
|
||||
* Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org>
|
||||
* Copyright (C) 2005-2012, Anthony Minessale II <anthm@freeswitch.org>
|
||||
*
|
||||
* Version: MPL 1.1
|
||||
*
|
||||
|
@@ -4,7 +4,7 @@
|
||||
* Author(s): Anthony Minessale II <anthm@freeswitch.org>
|
||||
* Nenad Corbic <ncorbic@sangoma.com>
|
||||
*
|
||||
* Copyright: (c) 2005 Anthony Minessale II
|
||||
* Copyright: (c) 2005-2012 Anthony Minessale II
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
|
@@ -4,7 +4,7 @@
|
||||
* Author(s): Anthony Minessale II <anthm@freeswitch.org>
|
||||
* Nenad Corbic <ncorbic@sangoma.com>
|
||||
*
|
||||
* Copyright: (c) 2005 Anthony Minessale II
|
||||
* Copyright: (c) 2005-2012 Anthony Minessale II
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
|
@@ -4,7 +4,7 @@
|
||||
* Author(s): Anthony Minessale II <anthm@freeswitch.org>
|
||||
* Nenad Corbic <ncorbic@sangoma.com>
|
||||
*
|
||||
* Copyright: (c) 2005 Anthony Minessale II
|
||||
* Copyright: (c) 2005-2012 Anthony Minessale II
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
|
Reference in New Issue
Block a user