Merge branch 'releases.3.5' of ssh://git.sangoma.com/smg_freeswitch into nsg-4.3

Conflicts:
	.gitignore
	conf/insideout/autoload_configs/modules.conf.xml
	conf/vanilla/autoload_configs/modules.conf.xml
	src/mod/endpoints/mod_sofia/mod_sofia.h
	src/switch_rtp.c
This commit is contained in:
David Yat Sin committed 2012-07-25 11:15:18 -04:00
commit 8b0fbe605c
798 files changed
+62919 -81329

No files matched your search

@@ -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
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
+38 -6
View 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) {
+2 -2
View 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
@@ -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 -1
View 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