Merge remote branch 'smgfs/master'
This commit is contained in:
commit
0d87954a46
|
@ -1,134 +0,0 @@
|
|||
Index: src/ozmod/ozmod_wanpipe/ozmod_wanpipe.c
|
||||
===================================================================
|
||||
--- src/ozmod/ozmod_wanpipe/ozmod_wanpipe.c (revision 745)
|
||||
+++ src/ozmod/ozmod_wanpipe/ozmod_wanpipe.c (working copy)
|
||||
@@ -98,19 +98,21 @@
|
||||
* so we can have one analong handler thread that will deal with all the idle analog channels for events
|
||||
* the alternative would be for the driver to provide one socket for all of the oob events for all analog channels
|
||||
*/
|
||||
-static __inline__ int tdmv_api_wait_socket(sng_fd_t fd, int timeout, int *flags)
|
||||
+static __inline__ int tdmv_api_wait_socket(zap_channel_t *zchan, int timeout, int *flags)
|
||||
{
|
||||
|
||||
#ifdef LIBSANGOMA_VERSION
|
||||
int err;
|
||||
- sangoma_wait_obj_t sangoma_wait_obj;
|
||||
+ sangoma_wait_obj_t *sangoma_wait_obj = zchan->mod_data;
|
||||
|
||||
- sangoma_init_wait_obj(&sangoma_wait_obj, fd, 1, 1, *flags, SANGOMA_WAIT_OBJ);
|
||||
+ sangoma_init_wait_obj(sangoma_wait_obj, zchan->sockfd, 1, 1, 0, SANGOMA_WAIT_OBJ);
|
||||
|
||||
- err=sangoma_socket_waitfor_many(&sangoma_wait_obj,1 , timeout);
|
||||
+ err = sangoma_socket_waitfor_many(&sangoma_wait_obj, 1, timeout);
|
||||
+
|
||||
if (err > 0) {
|
||||
- *flags=sangoma_wait_obj.flags_out;
|
||||
+ *flags = sangoma_wait_obj.flags_out;
|
||||
}
|
||||
+
|
||||
return err;
|
||||
|
||||
#else
|
||||
@@ -118,7 +120,7 @@
|
||||
int res;
|
||||
|
||||
memset(&pfds[0], 0, sizeof(pfds[0]));
|
||||
- pfds[0].fd = fd;
|
||||
+ pfds[0].fd = zchan->sockfd;
|
||||
pfds[0].events = *flags;
|
||||
res = poll(pfds, 1, timeout);
|
||||
*flags = 0;
|
||||
@@ -200,6 +202,15 @@
|
||||
|
||||
if (sockfd != WP_INVALID_SOCKET && zap_span_add_channel(span, sockfd, type, &chan) == ZAP_SUCCESS) {
|
||||
wanpipe_tdm_api_t tdm_api;
|
||||
+#ifdef LIBSANGOMA_VERSION
|
||||
+ sangoma_wait_obj_t *sangoma_wait_obj;
|
||||
+
|
||||
+ sangoma_wait_obj = malloc(sizeof(*sangoma_wait_obj));
|
||||
+ memset(sangoma_wait_obj, 0, sizeof(*sangoma_wait_obj));
|
||||
+ sangoma_init_wait_obj(sangoma_wait_obj, sockfd, 1, 1, 0, SANGOMA_WAIT_OBJ);
|
||||
+ chan->mod_data = sangoma_wait_obj;
|
||||
+#endif
|
||||
+
|
||||
memset(&tdm_api,0,sizeof(tdm_api));
|
||||
|
||||
chan->physical_span_id = spanno;
|
||||
@@ -211,7 +222,7 @@
|
||||
|
||||
dtmf = "software";
|
||||
|
||||
- /* FIXME: Handle Error Conditino Check for return code */
|
||||
+ /* FIXME: Handle Error Condition Check for return code */
|
||||
err= sangoma_tdm_get_hw_coding(chan->sockfd, &tdm_api);
|
||||
|
||||
if (tdm_api.wp_tdm_cmd.hw_tdm_coding) {
|
||||
@@ -606,7 +617,7 @@
|
||||
inflags |= POLLPRI;
|
||||
}
|
||||
|
||||
- result = tdmv_api_wait_socket(zchan->sockfd, to, &inflags);
|
||||
+ result = tdmv_api_wait_socket(zchan, to, &inflags);
|
||||
|
||||
*flags = ZAP_NO_FLAGS;
|
||||
|
||||
@@ -643,26 +654,30 @@
|
||||
ZIO_SPAN_POLL_EVENT_FUNCTION(wanpipe_poll_event)
|
||||
{
|
||||
#ifdef LIBSANGOMA_VERSION
|
||||
- sangoma_wait_obj_t pfds[ZAP_MAX_CHANNELS_SPAN];
|
||||
+ sangoma_wait_obj_t *pfds[ZAP_MAX_CHANNELS_SPAN] = { 0 };
|
||||
#else
|
||||
struct pollfd pfds[ZAP_MAX_CHANNELS_SPAN];
|
||||
#endif
|
||||
|
||||
uint32_t i, j = 0, k = 0, l = 0;
|
||||
- int objects=0;
|
||||
int r;
|
||||
|
||||
for(i = 1; i <= span->chan_count; i++) {
|
||||
zap_channel_t *zchan = span->channels[i];
|
||||
|
||||
+
|
||||
#ifdef LIBSANGOMA_VERSION
|
||||
- sangoma_init_wait_obj(&pfds[j], zchan->sockfd , 1, 1, POLLPRI, SANGOMA_WAIT_OBJ);
|
||||
+ if (!zchan->mod_data) {
|
||||
+ continue;
|
||||
+ }
|
||||
+ pfds[j] = zchan->mod_data;
|
||||
+
|
||||
#else
|
||||
memset(&pfds[j], 0, sizeof(pfds[j]));
|
||||
pfds[j].fd = span->channels[i]->sockfd;
|
||||
pfds[j].events = POLLPRI;
|
||||
#endif
|
||||
- objects++;
|
||||
+
|
||||
/* The driver probably should be able to do this wink/flash/ringing by itself this is sort of a hack to make it work! */
|
||||
|
||||
if (zap_test_flag(zchan, ZAP_CHANNEL_WINK) || zap_test_flag(zchan, ZAP_CHANNEL_FLASH)) {
|
||||
@@ -703,7 +718,7 @@
|
||||
ms = l;
|
||||
}
|
||||
#ifdef LIBSANGOMA_VERSION
|
||||
- r = sangoma_socket_waitfor_many(pfds,objects,ms);
|
||||
+ r = sangoma_socket_waitfor_many(pfds, j, ms);
|
||||
#else
|
||||
r = poll(pfds, j, ms);
|
||||
#endif
|
||||
@@ -935,6 +950,15 @@
|
||||
*/
|
||||
static ZIO_CHANNEL_DESTROY_FUNCTION(wanpipe_channel_destroy)
|
||||
{
|
||||
+ sangoma_wait_obj_t *sangoma_wait_obj;
|
||||
+
|
||||
+ if (zchan->mod_data) {
|
||||
+ sangoma_wait_obj = zchan->mod_data;
|
||||
+ zchan->mod_data = NULL;
|
||||
+ sangoma_release_wait_obj(sangoma_wait_obj);
|
||||
+ free(sangoma_wait_obj);
|
||||
+ }
|
||||
+
|
||||
if (zchan->sockfd > -1) {
|
||||
close(zchan->sockfd);
|
||||
zchan->sockfd = WP_INVALID_SOCKET;
|
|
@ -1751,7 +1751,7 @@ FT_DECLARE(ftdm_status_t) ftdm_channel_open_chan(ftdm_channel_t *ftdmchan)
|
|||
goto done;
|
||||
}
|
||||
|
||||
if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_IN_ALARM)) {
|
||||
if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_IN_ALARM) && !ftdm_test_flag(ftdmchan->span, FTDM_SPAN_PWR_SAVING)) {
|
||||
snprintf(ftdmchan->last_error, sizeof(ftdmchan->last_error), "%s", "Channel is alarmed\n");
|
||||
ftdm_log_chan_msg(ftdmchan, FTDM_LOG_WARNING, "Cannot open channel when is alarmed\n");
|
||||
goto done;
|
||||
|
@ -3950,6 +3950,11 @@ static ftdm_status_t ftdm_set_channels_alarms(ftdm_span_t *span, int currindex)
|
|||
ftdm_log(FTDM_LOG_ERROR, "%d:%d: Failed to get alarms\n", span->channels[chan_index]->physical_span_id, span->channels[chan_index]->physical_chan_id);
|
||||
return FTDM_FAIL;
|
||||
}
|
||||
if (span->channels[chan_index]->alarm_flags) {
|
||||
ftdm_set_flag_locked(span->channels[chan_index], FTDM_CHANNEL_IN_ALARM);
|
||||
} else {
|
||||
ftdm_clear_flag_locked(span->channels[chan_index], FTDM_CHANNEL_IN_ALARM);
|
||||
}
|
||||
}
|
||||
return FTDM_SUCCESS;
|
||||
}
|
||||
|
|
|
@ -484,7 +484,7 @@ static FIO_SPAN_NEXT_EVENT_FUNCTION(m3ua_next_event)
|
|||
|
||||
static FIO_SPAN_DESTROY_FUNCTION(m3ua_span_destroy)
|
||||
{
|
||||
m3ua_span_data_t *span_data = (m3ua_span_data_t *) span->mod_data;
|
||||
m3ua_span_data_t *span_data = (m3ua_span_data_t *) span->io_data;
|
||||
|
||||
if (span_data) {
|
||||
ftdm_safe_free(span_data);
|
||||
|
@ -494,8 +494,8 @@ static FIO_SPAN_DESTROY_FUNCTION(m3ua_span_destroy)
|
|||
}
|
||||
static FIO_CHANNEL_DESTROY_FUNCTION(m3ua_channel_destroy)
|
||||
{
|
||||
m3ua_chan_data_t *chan_data = (m3ua_chan_data_t *) ftdmchan->mod_data;
|
||||
m3ua_span_data_t *span_data = (m3ua_span_data_t *) ftdmchan->span->mod_data;
|
||||
m3ua_chan_data_t *chan_data = (m3ua_chan_data_t *) ftdmchan->io_data;
|
||||
m3ua_span_data_t *span_data = (m3ua_span_data_t *) ftdmchan->span->io_data;
|
||||
|
||||
if (!chan_data) {
|
||||
return FTDM_FAIL;
|
||||
|
|
|
@ -48,7 +48,6 @@
|
|||
#define LINE "--------------------------------------------------------------------------------"
|
||||
|
||||
/* helper macros */
|
||||
#define FTDM_SPAN_IS_BRI(x) ((x)->trunk_type == FTDM_TRUNK_BRI || (x)->trunk_type == FTDM_TRUNK_BRI_PTMP)
|
||||
#define FTDM_SPAN_IS_NT(x) (((ftdm_isdn_data_t *)(x)->signal_data)->mode == Q921_NT)
|
||||
|
||||
#define DEFAULT_NATIONAL_PREFIX "0"
|
||||
|
@ -1081,8 +1080,8 @@ static L3INT ftdm_isdn_931_34(void *pvt, struct Q931_Call *call, Q931mes_Generic
|
|||
isdn_data->channels_remote_crv[gen->CRV] = ftdmchan;
|
||||
memset(&ftdmchan->caller_data, 0, sizeof(ftdmchan->caller_data));
|
||||
|
||||
if (ftdmchan->mod_data) {
|
||||
memset(ftdmchan->mod_data, 0, sizeof(ftdm_isdn_bchan_data_t));
|
||||
if (ftdmchan->call_data) {
|
||||
memset(ftdmchan->call_data, 0, sizeof(ftdm_isdn_bchan_data_t));
|
||||
}
|
||||
|
||||
/* copy number readd prefix as needed */
|
||||
|
@ -1214,7 +1213,7 @@ static L3INT ftdm_isdn_931_34(void *pvt, struct Q931_Call *call, Q931mes_Generic
|
|||
* overlap dial digit indication
|
||||
*/
|
||||
if (Q931IsIEPresent(gen->CalledNum)) {
|
||||
ftdm_isdn_bchan_data_t *data = (ftdm_isdn_bchan_data_t *)ftdmchan->mod_data;
|
||||
ftdm_isdn_bchan_data_t *data = (ftdm_isdn_bchan_data_t *)ftdmchan->call_data;
|
||||
Q931ie_CalledNum *callednum = Q931GetIEPtr(gen->CalledNum, gen->buf);
|
||||
int pos;
|
||||
|
||||
|
@ -1370,7 +1369,7 @@ static __inline__ void state_advance(ftdm_channel_t *ftdmchan)
|
|||
break;
|
||||
case FTDM_CHANNEL_STATE_DIALTONE:
|
||||
{
|
||||
ftdm_isdn_bchan_data_t *data = (ftdm_isdn_bchan_data_t *)ftdmchan->mod_data;
|
||||
ftdm_isdn_bchan_data_t *data = (ftdm_isdn_bchan_data_t *)ftdmchan->call_data;
|
||||
|
||||
if (data) {
|
||||
data->digit_timeout = ftdm_time_now() + isdn_data->digit_timeout;
|
||||
|
@ -1862,7 +1861,7 @@ static void *ftdm_isdn_tones_run(ftdm_thread_t *me, void *obj)
|
|||
switch (ftdm_channel_get_state(chan)) {
|
||||
case FTDM_CHANNEL_STATE_DIALTONE:
|
||||
{
|
||||
ftdm_isdn_bchan_data_t *data = (ftdm_isdn_bchan_data_t *)chan->mod_data;
|
||||
ftdm_isdn_bchan_data_t *data = (ftdm_isdn_bchan_data_t *)chan->call_data;
|
||||
ftdm_caller_data_t *caller_data = ftdm_channel_get_caller_data(chan);
|
||||
|
||||
/* check overlap dial timeout first before generating tone */
|
||||
|
@ -2741,7 +2740,7 @@ static FIO_CONFIGURE_SPAN_SIGNALING_FUNCTION(isdn_configure_span)
|
|||
ftdm_channel_t *chan = ftdm_span_get_channel(span, i);
|
||||
|
||||
if (ftdm_channel_get_type(chan) == FTDM_CHAN_TYPE_B) {
|
||||
chan->mod_data = data;
|
||||
chan->call_data = data;
|
||||
memset(data, 0, sizeof(ftdm_isdn_bchan_data_t));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -266,7 +266,7 @@ PK_VOID PK_CALLBACK media_out_callback(PKH_TPikaEvent *event)
|
|||
{
|
||||
PK_STATUS pk_status;
|
||||
ftdm_channel_t *ftdmchan = event->userData;
|
||||
pika_chan_data_t *chan_data = (pika_chan_data_t *) ftdmchan->mod_data;
|
||||
pika_chan_data_t *chan_data = (pika_chan_data_t *) ftdmchan->io_data;
|
||||
|
||||
//PK_CHAR event_text[PKH_EVENT_MAX_NAME_LENGTH];
|
||||
//PKH_EVENT_GetText(event->id, event_text, sizeof(event_text));
|
||||
|
@ -345,8 +345,8 @@ static unsigned pika_open_range(ftdm_span_t *span, unsigned boardno, unsigned sp
|
|||
|
||||
}
|
||||
|
||||
if (span->mod_data) {
|
||||
span_data = span->mod_data;
|
||||
if (span->io_data) {
|
||||
span_data = span->io_data;
|
||||
} else {
|
||||
span_data = ftdm_malloc(sizeof(*span_data));
|
||||
assert(span_data != NULL);
|
||||
|
@ -364,7 +364,7 @@ static unsigned pika_open_range(ftdm_span_t *span, unsigned boardno, unsigned sp
|
|||
|
||||
//PKH_QUEUE_Attach(span_data->event_queue, globals.open_boards[boardno], NULL);
|
||||
|
||||
span->mod_data = span_data;
|
||||
span->io_data = span_data;
|
||||
}
|
||||
|
||||
if (type == FTDM_CHAN_TYPE_FXS || type == FTDM_CHAN_TYPE_FXO) {
|
||||
|
@ -380,7 +380,7 @@ static unsigned pika_open_range(ftdm_span_t *span, unsigned boardno, unsigned sp
|
|||
assert(chan_data);
|
||||
memset(chan_data, 0, sizeof(*chan_data));
|
||||
ftdm_span_add_channel(span, 0, type, &chan);
|
||||
chan->mod_data = chan_data;
|
||||
chan->io_data = chan_data;
|
||||
|
||||
if ((type == FTDM_CHAN_TYPE_B || type == FTDM_CHAN_TYPE_DQ921) && !span_data->handle) {
|
||||
PKH_TBoardConfig boardConfig;
|
||||
|
@ -680,7 +680,7 @@ static FIO_CONFIGURE_SPAN_FUNCTION(pika_configure_span)
|
|||
*/
|
||||
static FIO_OPEN_FUNCTION(pika_open)
|
||||
{
|
||||
pika_chan_data_t *chan_data = (pika_chan_data_t *) ftdmchan->mod_data;
|
||||
pika_chan_data_t *chan_data = (pika_chan_data_t *) ftdmchan->io_data;
|
||||
|
||||
if (!chan_data && !ftdm_test_flag(chan_data, PK_FLAG_READY)) {
|
||||
return FTDM_FAIL;
|
||||
|
@ -715,7 +715,7 @@ static FIO_CLOSE_FUNCTION(pika_close)
|
|||
*/
|
||||
static FIO_WAIT_FUNCTION(pika_wait)
|
||||
{
|
||||
pika_chan_data_t *chan_data = (pika_chan_data_t *) ftdmchan->mod_data;
|
||||
pika_chan_data_t *chan_data = (pika_chan_data_t *) ftdmchan->io_data;
|
||||
PK_STATUS status;
|
||||
ftdm_wait_flag_t myflags = *flags;
|
||||
PK_CHAR event_text[PKH_EVENT_MAX_NAME_LENGTH];
|
||||
|
@ -754,7 +754,7 @@ static FIO_WAIT_FUNCTION(pika_wait)
|
|||
*/
|
||||
static FIO_READ_FUNCTION(pika_read)
|
||||
{
|
||||
pika_chan_data_t *chan_data = (pika_chan_data_t *) ftdmchan->mod_data;
|
||||
pika_chan_data_t *chan_data = (pika_chan_data_t *) ftdmchan->io_data;
|
||||
PK_STATUS status;
|
||||
PK_CHAR event_text[PKH_EVENT_MAX_NAME_LENGTH];
|
||||
uint32_t len;
|
||||
|
@ -795,7 +795,7 @@ static FIO_READ_FUNCTION(pika_read)
|
|||
*/
|
||||
static FIO_WRITE_FUNCTION(pika_write)
|
||||
{
|
||||
pika_chan_data_t *chan_data = (pika_chan_data_t *) ftdmchan->mod_data;
|
||||
pika_chan_data_t *chan_data = (pika_chan_data_t *) ftdmchan->io_data;
|
||||
PK_STATUS status;
|
||||
|
||||
if (ftdmchan->type == FTDM_CHAN_TYPE_DQ921) {
|
||||
|
@ -821,8 +821,8 @@ static FIO_WRITE_FUNCTION(pika_write)
|
|||
*/
|
||||
static FIO_COMMAND_FUNCTION(pika_command)
|
||||
{
|
||||
pika_chan_data_t *chan_data = (pika_chan_data_t *) ftdmchan->mod_data;
|
||||
//pika_span_data_t *span_data = (pika_span_data_t *) ftdmchan->span->mod_data;
|
||||
pika_chan_data_t *chan_data = (pika_chan_data_t *) ftdmchan->io_data;
|
||||
//pika_span_data_t *span_data = (pika_span_data_t *) ftdmchan->span->io_data;
|
||||
PK_STATUS pk_status;
|
||||
ftdm_status_t status = FTDM_SUCCESS;
|
||||
|
||||
|
@ -956,7 +956,7 @@ static FIO_COMMAND_FUNCTION(pika_command)
|
|||
*/
|
||||
static FIO_SPAN_POLL_EVENT_FUNCTION(pika_poll_event)
|
||||
{
|
||||
pika_span_data_t *span_data = (pika_span_data_t *) span->mod_data;
|
||||
pika_span_data_t *span_data = (pika_span_data_t *) span->io_data;
|
||||
PK_STATUS status;
|
||||
PK_CHAR event_text[PKH_EVENT_MAX_NAME_LENGTH];
|
||||
|
||||
|
@ -1025,7 +1025,7 @@ static FIO_SPAN_POLL_EVENT_FUNCTION(pika_poll_event)
|
|||
for(x = 1; x <= span->chan_count; x++) {
|
||||
ftdmchan = span->channels[x];
|
||||
assert(ftdmchan != NULL);
|
||||
chan_data = (pika_chan_data_t *) ftdmchan->mod_data;
|
||||
chan_data = (pika_chan_data_t *) ftdmchan->io_data;
|
||||
assert(chan_data != NULL);
|
||||
|
||||
|
||||
|
@ -1042,7 +1042,7 @@ static FIO_SPAN_POLL_EVENT_FUNCTION(pika_poll_event)
|
|||
//ftdm_log(FTDM_LOG_DEBUG, "Event: %s\n", event_text);
|
||||
|
||||
if (ftdmchan) {
|
||||
pika_chan_data_t *chan_data = (pika_chan_data_t *) ftdmchan->mod_data;
|
||||
pika_chan_data_t *chan_data = (pika_chan_data_t *) ftdmchan->io_data;
|
||||
|
||||
assert(chan_data != NULL);
|
||||
ftdm_set_flag(ftdmchan, FTDM_CHANNEL_EVENT);
|
||||
|
@ -1068,7 +1068,7 @@ static FIO_SPAN_NEXT_EVENT_FUNCTION(pika_next_event)
|
|||
|
||||
for(i = 1; i <= span->chan_count; i++) {
|
||||
if (ftdm_test_flag(span->channels[i], FTDM_CHANNEL_EVENT)) {
|
||||
pika_chan_data_t *chan_data = (pika_chan_data_t *) span->channels[i]->mod_data;
|
||||
pika_chan_data_t *chan_data = (pika_chan_data_t *) span->channels[i]->io_data;
|
||||
PK_CHAR event_text[PKH_EVENT_MAX_NAME_LENGTH];
|
||||
|
||||
ftdm_clear_flag(span->channels[i], FTDM_CHANNEL_EVENT);
|
||||
|
@ -1207,7 +1207,7 @@ static FIO_SPAN_NEXT_EVENT_FUNCTION(pika_next_event)
|
|||
*/
|
||||
static FIO_SPAN_DESTROY_FUNCTION(pika_span_destroy)
|
||||
{
|
||||
pika_span_data_t *span_data = (pika_span_data_t *) span->mod_data;
|
||||
pika_span_data_t *span_data = (pika_span_data_t *) span->io_data;
|
||||
|
||||
if (span_data) {
|
||||
PKH_QUEUE_Destroy(span_data->event_queue);
|
||||
|
@ -1224,8 +1224,8 @@ static FIO_SPAN_DESTROY_FUNCTION(pika_span_destroy)
|
|||
*/
|
||||
static FIO_CHANNEL_DESTROY_FUNCTION(pika_channel_destroy)
|
||||
{
|
||||
pika_chan_data_t *chan_data = (pika_chan_data_t *) ftdmchan->mod_data;
|
||||
pika_span_data_t *span_data = (pika_span_data_t *) ftdmchan->span->mod_data;
|
||||
pika_chan_data_t *chan_data = (pika_chan_data_t *) ftdmchan->io_data;
|
||||
pika_span_data_t *span_data = (pika_span_data_t *) ftdmchan->span->io_data;
|
||||
|
||||
if (!chan_data) {
|
||||
return FTDM_FAIL;
|
||||
|
|
|
@ -31,11 +31,15 @@
|
|||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#ifdef __linux__
|
||||
#ifndef _BSD_SOURCE
|
||||
#define _BSD_SOURCE /* for strsep() */
|
||||
#endif
|
||||
#include <syscall.h>
|
||||
#include <poll.h>
|
||||
#include <string.h>
|
||||
#endif
|
||||
#include <stdio.h>
|
||||
#include <openr2.h>
|
||||
#include "freetdm.h"
|
||||
#include "private/ftdm_core.h"
|
||||
|
@ -879,7 +883,7 @@ static FIO_SIG_CONFIGURE_FUNCTION(ftdm_r2_configure_span)
|
|||
ftdm_r2_call_t *r2call = NULL;
|
||||
openr2_chan_t *r2chan = NULL;
|
||||
openr2_log_level_t tmplevel;
|
||||
char *clevel;
|
||||
char *clevel = NULL;
|
||||
char *logval = NULL;
|
||||
|
||||
ft_r2_conf_t r2conf =
|
||||
|
@ -887,20 +891,21 @@ static FIO_SIG_CONFIGURE_FUNCTION(ftdm_r2_configure_span)
|
|||
/* .variant */ OR2_VAR_ITU,
|
||||
/* .category */ OR2_CALLING_PARTY_CATEGORY_NATIONAL_SUBSCRIBER,
|
||||
/* .loglevel */ OR2_LOG_ERROR | OR2_LOG_WARNING,
|
||||
/* .logdir */ NULL,
|
||||
/* .advanced_protocol_file */ NULL,
|
||||
/* .max_ani */ 10,
|
||||
/* .max_dnis */ 4,
|
||||
/* .mfback_timeout */ -1,
|
||||
/* .metering_pulse_timeout */ -1,
|
||||
/* .allow_collect_calls */ -1,
|
||||
/* .immediate_accept */ -1,
|
||||
/* .skip_category */ -1,
|
||||
/* .forced_release */ -1,
|
||||
/* .charge_calls */ -1,
|
||||
/* .get_ani_first */ -1,
|
||||
/* .call_files */ 0,
|
||||
/* .mf_files */ 0,
|
||||
/* .logdir */ NULL,
|
||||
/* .advanced_protocol_file */ NULL
|
||||
/* .double_answer */ 0,
|
||||
/* .charge_calls */ -1,
|
||||
/* .forced_release */ -1,
|
||||
/* .allow_collect_calls */ -1
|
||||
};
|
||||
|
||||
assert(sig_cb != NULL);
|
||||
|
@ -982,15 +987,6 @@ static FIO_SIG_CONFIGURE_FUNCTION(ftdm_r2_configure_span)
|
|||
}
|
||||
if (ftdm_strlen_zero_buf(val)) {
|
||||
ftdm_log(FTDM_LOG_NOTICE, "Ignoring empty R2 advanced_protocol_file parameter\n");
|
||||
/*
|
||||
* TODO: investigate this
|
||||
*
|
||||
* despite the fact advanced_protocol_file was initialized as NULL, it's now a bad
|
||||
* pointer - hence, this workaround.
|
||||
* this seems to happen only on windows.
|
||||
*
|
||||
*/
|
||||
r2conf.advanced_protocol_file = NULL;
|
||||
continue;
|
||||
}
|
||||
r2conf.advanced_protocol_file = val;
|
||||
|
@ -1615,22 +1611,13 @@ static FIO_API_FUNCTION(ftdm_r2_api)
|
|||
r2data->loops,
|
||||
r2data->monitor_thread_id);
|
||||
stream->write_function(stream, "\n");
|
||||
stream->write_function(stream, "%4s %-12.12s %-12.12s %6s %6s %6s %6s\n", "Channel", "Tx CAS", "Rx CAS",
|
||||
"Rx Avg", "Tx Avg", "Rx", "Tx");
|
||||
stream->write_function(stream, "%4s %-12.12s %-12.12s\n", "Channel", "Tx CAS", "Rx CAS");
|
||||
for (i = 1; i <= span->chan_count; i++) {
|
||||
char rx_str[25];
|
||||
char tx_str[25];
|
||||
char rxavg_str[25];
|
||||
char txavg_str[25];
|
||||
r2chan = R2CALL(span->channels[i])->r2chan;
|
||||
stream->write_function(stream, "%4d %-12.12s %-12.12s %6s %6s %6s %6s\n",
|
||||
stream->write_function(stream, "%4d %-12.12s %-12.12s\n",
|
||||
span->channels[i]->chan_id,
|
||||
openr2_chan_get_tx_cas_string(r2chan),
|
||||
openr2_chan_get_rx_cas_string(r2chan),
|
||||
rxavg_str,
|
||||
txavg_str,
|
||||
rx_str,
|
||||
tx_str);
|
||||
openr2_chan_get_rx_cas_string(r2chan));
|
||||
}
|
||||
stream->write_function(stream, "\n");
|
||||
stream->write_function(stream, "+OK.\n");
|
||||
|
|
|
@ -47,6 +47,7 @@ static ftdm_status_t ftdm_sangoma_isdn_start(ftdm_span_t *span);
|
|||
|
||||
ftdm_channel_t* ftdm_sangoma_isdn_process_event_states(ftdm_span_t *span, sngisdn_event_data_t *sngisdn_event);
|
||||
static void ftdm_sangoma_isdn_advance_chan_states(ftdm_channel_t *ftdmchan);
|
||||
static void ftdm_sangoma_isdn_poll_events(ftdm_span_t *span);
|
||||
|
||||
static void ftdm_sangoma_isdn_process_state_change(ftdm_channel_t *ftdmchan);
|
||||
static void ftdm_sangoma_isdn_process_stack_event (ftdm_span_t *span, sngisdn_event_data_t *sngisdn_event);
|
||||
|
@ -235,6 +236,50 @@ static __inline__ void ftdm_sangoma_isdn_advance_chan_states(ftdm_channel_t *ftd
|
|||
}
|
||||
}
|
||||
|
||||
static void ftdm_sangoma_isdn_poll_events(ftdm_span_t *span)
|
||||
{
|
||||
ftdm_status_t ret_status;
|
||||
ftdm_channel_t *ftdmchan;
|
||||
ftdm_iterator_t *chaniter = NULL;
|
||||
ftdm_iterator_t *curr = NULL;
|
||||
|
||||
ret_status = ftdm_span_poll_event(span, 0, NULL);
|
||||
switch(ret_status) {
|
||||
case FTDM_SUCCESS:
|
||||
{
|
||||
ftdm_event_t *event;
|
||||
while (ftdm_span_next_event(span, &event) == FTDM_SUCCESS) {
|
||||
|
||||
if (FTDM_SPAN_IS_BRI(span)) {
|
||||
switch (event->enum_id) {
|
||||
/* Check if the span woke up from power-saving mode */
|
||||
case FTDM_OOB_ALARM_CLEAR:
|
||||
{
|
||||
chaniter = ftdm_span_get_chan_iterator(span, NULL);
|
||||
for (curr = chaniter; curr; curr = ftdm_iterator_next(curr)) {
|
||||
ftdmchan = (ftdm_channel_t*)ftdm_iterator_current(curr);
|
||||
sngisdn_chan_data_t *sngisdn_info = ftdmchan->call_data;
|
||||
|
||||
if (ftdm_test_flag(sngisdn_info, FLAG_ACTIVATING)) {
|
||||
ftdm_clear_flag(sngisdn_info, FLAG_ACTIVATING);
|
||||
sngisdn_snd_setup((ftdm_channel_t*)ftdmchan);
|
||||
}
|
||||
}
|
||||
ftdm_iterator_free(chaniter);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case FTDM_TIMEOUT:
|
||||
/* No events pending */
|
||||
break;
|
||||
default:
|
||||
ftdm_log(FTDM_LOG_WARNING, "%s:Failed to poll span event\n", span->name);
|
||||
}
|
||||
}
|
||||
|
||||
static void *ftdm_sangoma_isdn_run(ftdm_thread_t *me, void *obj)
|
||||
{
|
||||
ftdm_interrupt_t *ftdm_sangoma_isdn_int[2];
|
||||
|
@ -297,21 +342,8 @@ static void *ftdm_sangoma_isdn_run(ftdm_thread_t *me, void *obj)
|
|||
}
|
||||
|
||||
/* Poll for events, e.g HW DTMF */
|
||||
ret_status = ftdm_span_poll_event(span, 0, NULL);
|
||||
switch(ret_status) {
|
||||
case FTDM_SUCCESS:
|
||||
{
|
||||
ftdm_event_t *event;
|
||||
while (ftdm_span_next_event(span, &event) == FTDM_SUCCESS);
|
||||
}
|
||||
break;
|
||||
case FTDM_TIMEOUT:
|
||||
/* No events pending */
|
||||
break;
|
||||
default:
|
||||
ftdm_log(FTDM_LOG_WARNING, "%s:Failed to poll span event\n", span->name);
|
||||
}
|
||||
|
||||
ftdm_sangoma_isdn_poll_events(span);
|
||||
|
||||
if (ftdm_sched_get_time_to_next_timer(signal_data->sched, &sleep) == FTDM_SUCCESS) {
|
||||
if (sleep < 0 || sleep > SNGISDN_EVENT_POLL_RATE) {
|
||||
sleep = SNGISDN_EVENT_POLL_RATE;
|
||||
|
@ -495,8 +527,20 @@ static void ftdm_sangoma_isdn_process_state_change(ftdm_channel_t *ftdmchan)
|
|||
}
|
||||
break;
|
||||
case FTDM_CHANNEL_STATE_DIALING: /* outgoing call request */
|
||||
{
|
||||
sngisdn_snd_setup(ftdmchan);
|
||||
{
|
||||
if (FTDM_SPAN_IS_BRI(ftdmchan->span) &&
|
||||
ftdm_test_flag(ftdmchan, FTDM_CHANNEL_IN_ALARM) &&
|
||||
ftdm_test_flag(ftdmchan->span, FTDM_SPAN_PWR_SAVING)) {
|
||||
|
||||
sngisdn_span_data_t *signal_data = (sngisdn_span_data_t*) ftdmchan->span->signal_data;
|
||||
|
||||
ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Requesting Line activation\n");
|
||||
sngisdn_set_flag(sngisdn_info, FLAG_ACTIVATING);
|
||||
sng_isdn_wake_up_phy(ftdmchan->span);
|
||||
ftdm_sched_timer(signal_data->sched, "timer_t3", signal_data->timer_t3*1000, sngisdn_t3_timeout, (void*) sngisdn_info, NULL);
|
||||
} else {
|
||||
sngisdn_snd_setup(ftdmchan);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case FTDM_CHANNEL_STATE_PROGRESS:
|
||||
|
@ -853,8 +897,7 @@ static FIO_CONFIGURE_SPAN_SIGNALING_FUNCTION(ftdm_sangoma_isdn_span_config)
|
|||
|
||||
if (span->trunk_type == FTDM_TRUNK_BRI_PTMP ||
|
||||
span->trunk_type == FTDM_TRUNK_BRI) {
|
||||
|
||||
ftdm_set_flag(span, FTDM_SPAN_USE_AV_RATE);
|
||||
|
||||
sng_isdn_set_avail_rate(span, SNGISDN_AVAIL_PWR_SAVING);
|
||||
}
|
||||
|
||||
|
@ -911,7 +954,7 @@ static FIO_SIG_LOAD_FUNCTION(ftdm_sangoma_isdn_init)
|
|||
|
||||
/* initalize sng_isdn library */
|
||||
|
||||
ftdm_assert_return(!sng_isdn_init(&g_sngisdn_event_interface), FTDM_FAIL, "Failed to initialize stack\n");
|
||||
ftdm_assert_return(!sng_isdn_init(&g_sngisdn_event_interface), FTDM_FAIL, "Failed to initialize stack\n");
|
||||
return FTDM_SUCCESS;
|
||||
}
|
||||
|
||||
|
|
|
@ -74,6 +74,7 @@ typedef enum {
|
|||
FLAG_DELAYED_REL = (1 << 7),
|
||||
FLAG_SENT_PROCEED = (1 << 8),
|
||||
FLAG_SEND_DISC = (1 << 9),
|
||||
FLAG_ACTIVATING = (1 << 10), /* Used for BRI only, flag is set after we request line CONNECTED */
|
||||
} sngisdn_flag_t;
|
||||
|
||||
|
||||
|
@ -181,6 +182,7 @@ typedef struct sngisdn_span_data {
|
|||
uint8_t facility;
|
||||
int8_t facility_timeout;
|
||||
uint8_t num_local_numbers;
|
||||
uint8_t timer_t3;
|
||||
char* local_numbers[SNGISDN_NUM_LOCAL_NUMBERS];
|
||||
ftdm_sched_t *sched;
|
||||
ftdm_queue_t *event_queue;
|
||||
|
@ -387,11 +389,13 @@ void sngisdn_delayed_release(void* p_sngisdn_info);
|
|||
void sngisdn_delayed_connect(void* p_sngisdn_info);
|
||||
void sngisdn_delayed_disconnect(void* p_sngisdn_info);
|
||||
void sngisdn_facility_timeout(void* p_sngisdn_info);
|
||||
void sngisdn_t3_timeout(void* p_sngisdn_info);
|
||||
|
||||
/* Stack management functions */
|
||||
ftdm_status_t sng_isdn_stack_cfg(ftdm_span_t *span);
|
||||
ftdm_status_t sng_isdn_stack_start(ftdm_span_t *span);
|
||||
ftdm_status_t sng_isdn_stack_stop(ftdm_span_t *span);
|
||||
ftdm_status_t sng_isdn_wake_up_phy(ftdm_span_t *span);
|
||||
|
||||
void sngisdn_print_phy_stats(ftdm_stream_handle_t *stream, ftdm_span_t *span);
|
||||
void sngisdn_print_spans(ftdm_stream_handle_t *stream);
|
||||
|
|
|
@ -98,6 +98,8 @@ ftdm_status_t parse_switchtype(const char* switch_name, ftdm_span_t *span)
|
|||
ftdm_log(FTDM_LOG_ERROR, "%s:Unsupported switchtype %s for trunktype:%s\n", span->name, switch_name, ftdm_trunk_type2str(span->trunk_type));
|
||||
return FTDM_FAIL;
|
||||
}
|
||||
ftdm_set_flag(span, FTDM_SPAN_USE_AV_RATE);
|
||||
ftdm_set_flag(span, FTDM_SPAN_PWR_SAVING);
|
||||
/* can be > 1 for some BRI variants */
|
||||
break;
|
||||
default:
|
||||
|
@ -179,6 +181,7 @@ ftdm_status_t ftmod_isdn_parse_cfg(ftdm_conf_parameter_t *ftdm_parameters, ftdm_
|
|||
signal_data->min_digits = 8;
|
||||
signal_data->overlap_dial = SNGISDN_OPT_DEFAULT;
|
||||
signal_data->setup_arb = SNGISDN_OPT_DEFAULT;
|
||||
signal_data->timer_t3 = 8;
|
||||
|
||||
signal_data->link_id = span->span_id;
|
||||
span->default_caller_data.bearer_capability = IN_ITC_SPEECH;
|
||||
|
@ -189,6 +192,7 @@ ftdm_status_t ftmod_isdn_parse_cfg(ftdm_conf_parameter_t *ftdm_parameters, ftdm_
|
|||
if (span->trunk_type == FTDM_TRUNK_BRI ||
|
||||
span->trunk_type == FTDM_TRUNK_BRI_PTMP) {
|
||||
|
||||
|
||||
ftdm_span_set_npi("unknown", &span->default_caller_data.dnis.plan);
|
||||
ftdm_span_set_ton("unknown", &span->default_caller_data.dnis.type);
|
||||
ftdm_span_set_npi("unknown", &span->default_caller_data.cid_num.plan);
|
||||
|
|
|
@ -113,6 +113,40 @@ ftdm_status_t sng_isdn_stack_stop(ftdm_span_t *span)
|
|||
}
|
||||
|
||||
|
||||
ftdm_status_t sng_isdn_wake_up_phy(ftdm_span_t *span)
|
||||
{
|
||||
L1Mngmt cntrl;
|
||||
Pst pst;
|
||||
|
||||
sngisdn_span_data_t *signal_data = (sngisdn_span_data_t*)span->signal_data;
|
||||
|
||||
/* initalize the post structure */
|
||||
stack_pst_init(&pst);
|
||||
|
||||
/* insert the destination Entity */
|
||||
pst.dstEnt = ENTL1;
|
||||
|
||||
/* initalize the control structure */
|
||||
memset(&cntrl, 0, sizeof(cntrl));
|
||||
|
||||
/* initalize the control header */
|
||||
stack_hdr_init(&cntrl.hdr);
|
||||
|
||||
cntrl.hdr.msgType = TCNTRL; /* configuration */
|
||||
cntrl.hdr.entId.ent = ENTL1; /* entity */
|
||||
cntrl.hdr.entId.inst = S_INST; /* instance */
|
||||
cntrl.hdr.elmId.elmnt = STTSAP; /* SAP Specific cntrl */
|
||||
|
||||
cntrl.t.cntrl.action = AENA;
|
||||
cntrl.t.cntrl.subAction = SAELMNT;
|
||||
cntrl.t.cntrl.sapId = signal_data->link_id;
|
||||
|
||||
if (sng_isdn_phy_cntrl(&pst, &cntrl)) {
|
||||
return FTDM_FAIL;
|
||||
}
|
||||
return FTDM_SUCCESS;
|
||||
}
|
||||
|
||||
ftdm_status_t sng_isdn_activate_phy(ftdm_span_t *span)
|
||||
{
|
||||
|
||||
|
|
|
@ -41,7 +41,6 @@ void sngisdn_snd_connect(ftdm_channel_t *ftdmchan);
|
|||
void sngisdn_snd_disconnect(ftdm_channel_t *ftdmchan);
|
||||
void sngisdn_snd_release(ftdm_channel_t *ftdmchan, uint8_t glare);
|
||||
|
||||
|
||||
void sngisdn_snd_setup(ftdm_channel_t *ftdmchan)
|
||||
{
|
||||
ConEvnt conEvnt;
|
||||
|
|
|
@ -372,6 +372,28 @@ FT_DECLARE(ftdm_status_t) cpy_calling_name_from_user(ConEvnt *conEvnt, ftdm_chan
|
|||
return FTDM_SUCCESS;
|
||||
}
|
||||
|
||||
void sngisdn_t3_timeout(void* p_sngisdn_info)
|
||||
{
|
||||
sngisdn_chan_data_t *sngisdn_info = (sngisdn_chan_data_t*)p_sngisdn_info;
|
||||
ftdm_channel_t *ftdmchan = sngisdn_info->ftdmchan;
|
||||
sngisdn_span_data_t *signal_data = (sngisdn_span_data_t*) ftdmchan->span->signal_data;
|
||||
|
||||
ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Timer T3 expired (suId:%d suInstId:%u spInstId:%u)\n",
|
||||
signal_data->cc_id, sngisdn_info->glare.spInstId, sngisdn_info->glare.suInstId);
|
||||
ftdm_mutex_lock(ftdmchan->mutex);
|
||||
if (ftdm_test_flag(sngisdn_info, FLAG_ACTIVATING)){
|
||||
/* PHY layer timed-out, need to clear the call */
|
||||
ftdm_log_chan(ftdmchan, FTDM_LOG_INFO, "Failed to Wake-Up line (suId:%d suInstId:%u spInstId:%u)\n",
|
||||
signal_data->cc_id, sngisdn_info->glare.spInstId, sngisdn_info->glare.suInstId);
|
||||
|
||||
ftdmchan->caller_data.hangup_cause = FTDM_CAUSE_NO_ROUTE_DESTINATION;
|
||||
ftdm_clear_flag(sngisdn_info, FLAG_ACTIVATING);
|
||||
ftdm_set_flag(sngisdn_info, FLAG_LOCAL_ABORT);
|
||||
ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_TERMINATING);
|
||||
}
|
||||
ftdm_mutex_unlock(ftdmchan->mutex);
|
||||
}
|
||||
|
||||
void sngisdn_delayed_release(void* p_sngisdn_info)
|
||||
{
|
||||
sngisdn_chan_data_t *sngisdn_info = (sngisdn_chan_data_t*)p_sngisdn_info;
|
||||
|
|
|
@ -1347,7 +1347,7 @@ int ftmod_ss7_isup_isap_config(int id)
|
|||
cfg.t.cfg.s.siSap.natAddrInd = ADDR_NOTPRSNT; /* SID Nature of Addres Indicator */
|
||||
cfg.t.cfg.s.siSap.sidNPlan = NP_ISDN; /* SID Numbering Plan */
|
||||
cfg.t.cfg.s.siSap.sidPresInd = FALSE; /* default presentation indicator */
|
||||
cfg.t.cfg.s.siSap.incSidPresRes = TRUE; /* Presentation Restriction of incoming SID */
|
||||
cfg.t.cfg.s.siSap.incSidPresRes = FALSE; /* Presentation Restriction of incoming SID */
|
||||
cfg.t.cfg.s.siSap.sidPresRes = 0; /* Presentation Restriction */
|
||||
}
|
||||
cfg.t.cfg.s.siSap.reqOpt = FALSE; /* Request option */
|
||||
|
|
|
@ -1482,7 +1482,7 @@ static ftdm_status_t handle_tx_grs(ftdm_stream_handle_t *stream, int span, int c
|
|||
|
||||
sngss7_info = (sngss7_chan_data_t *)g_ftdm_sngss7_data.cfg.isupCkt[x].obj;
|
||||
ftdmchan = sngss7_info->ftdmchan;
|
||||
sngss7_span = ftdmchan->span->mod_data;
|
||||
sngss7_span = ftdmchan->span->signal_data;
|
||||
|
||||
if ((ftdmchan->physical_span_id == span) &&
|
||||
((ftdmchan->physical_chan_id >= chan) && (ftdmchan->physical_chan_id < (chan+range)))) {
|
||||
|
@ -1529,7 +1529,7 @@ static ftdm_status_t handle_tx_grs(ftdm_stream_handle_t *stream, int span, int c
|
|||
|
||||
sngss7_info = (sngss7_chan_data_t *)g_ftdm_sngss7_data.cfg.isupCkt[x].obj;
|
||||
ftdmchan = sngss7_info->ftdmchan;
|
||||
sngss7_span = ftdmchan->span->mod_data;
|
||||
sngss7_span = ftdmchan->span->signal_data;
|
||||
|
||||
if ((ftdmchan->physical_span_id == span) &&
|
||||
((ftdmchan->physical_chan_id >= chan) && (ftdmchan->physical_chan_id < (chan+range)))) {
|
||||
|
@ -1572,7 +1572,7 @@ static ftdm_status_t handle_tx_cgb(ftdm_stream_handle_t *stream, int span, int c
|
|||
/* extract the channel and span info for this circuit */
|
||||
sngss7_info = (sngss7_chan_data_t *)g_ftdm_sngss7_data.cfg.isupCkt[x].obj;
|
||||
ftdmchan = sngss7_info->ftdmchan;
|
||||
sngss7_span = ftdmchan->span->mod_data;
|
||||
sngss7_span = ftdmchan->span->signal_data;
|
||||
|
||||
/* check if this circuit is part of the block */
|
||||
if ((ftdmchan->physical_span_id == span) &&
|
||||
|
@ -1628,7 +1628,7 @@ static ftdm_status_t handle_tx_cgb(ftdm_stream_handle_t *stream, int span, int c
|
|||
|
||||
sngss7_info = (sngss7_chan_data_t *)g_ftdm_sngss7_data.cfg.isupCkt[x].obj;
|
||||
ftdmchan = sngss7_info->ftdmchan;
|
||||
sngss7_span = ftdmchan->span->mod_data;
|
||||
sngss7_span = ftdmchan->span->signal_data;
|
||||
|
||||
if ((ftdmchan->physical_span_id == span) &&
|
||||
((ftdmchan->physical_chan_id >= chan) && (ftdmchan->physical_chan_id < (chan+range)))) {
|
||||
|
@ -1672,7 +1672,7 @@ static ftdm_status_t handle_tx_cgu(ftdm_stream_handle_t *stream, int span, int c
|
|||
/* extract the channel and span info for this circuit */
|
||||
sngss7_info = (sngss7_chan_data_t *)g_ftdm_sngss7_data.cfg.isupCkt[x].obj;
|
||||
ftdmchan = sngss7_info->ftdmchan;
|
||||
sngss7_span = ftdmchan->span->mod_data;
|
||||
sngss7_span = ftdmchan->span->signal_data;
|
||||
|
||||
/* check if this circuit is part of the block */
|
||||
if ((ftdmchan->physical_span_id == span) &&
|
||||
|
@ -1728,7 +1728,7 @@ static ftdm_status_t handle_tx_cgu(ftdm_stream_handle_t *stream, int span, int c
|
|||
|
||||
sngss7_info = (sngss7_chan_data_t *)g_ftdm_sngss7_data.cfg.isupCkt[x].obj;
|
||||
ftdmchan = sngss7_info->ftdmchan;
|
||||
sngss7_span = ftdmchan->span->mod_data;
|
||||
sngss7_span = ftdmchan->span->signal_data;
|
||||
|
||||
if ((ftdmchan->physical_span_id == span) &&
|
||||
((ftdmchan->physical_chan_id >= chan) && (ftdmchan->physical_chan_id < (chan+range)))) {
|
||||
|
|
|
@ -1722,7 +1722,7 @@ ftdm_status_t handle_grs_req(uint32_t suInstId, uint32_t spInstId, uint32_t circ
|
|||
}
|
||||
|
||||
/* fill in the span structure for this circuit */
|
||||
sngss7_span = ftdmchan->span->mod_data;
|
||||
sngss7_span = ftdmchan->span->signal_data;
|
||||
sngss7_span->rx_grs.circuit = circuit;
|
||||
sngss7_span->rx_grs.range = range;
|
||||
|
||||
|
@ -1758,7 +1758,7 @@ ftdm_status_t handle_grs_rsp(uint32_t suInstId, uint32_t spInstId, uint32_t circ
|
|||
}
|
||||
|
||||
/* fill in the span structure for this circuit */
|
||||
sngss7_span = ftdmchan->span->mod_data;
|
||||
sngss7_span = ftdmchan->span->signal_data;
|
||||
sngss7_span->rx_gra.circuit = circuit;
|
||||
sngss7_span->rx_gra.range = range;
|
||||
|
||||
|
@ -1866,7 +1866,7 @@ ftdm_status_t handle_ucic(uint32_t suInstId, uint32_t spInstId, uint32_t circuit
|
|||
}
|
||||
|
||||
/* check if we just sent a GRS request...*/
|
||||
sngss7_span = ftdmchan->span->mod_data;
|
||||
sngss7_span = ftdmchan->span->signal_data;
|
||||
if (sngss7_span->tx_grs.circuit > 0) {
|
||||
/* we need to put all circuits on this UCIC */
|
||||
sngss7_span->ucic.circuit = sngss7_span->tx_grs.circuit;
|
||||
|
@ -1917,7 +1917,7 @@ ftdm_status_t handle_cgb_req(uint32_t suInstId, uint32_t spInstId, uint32_t circ
|
|||
}
|
||||
|
||||
/* grab the span info */
|
||||
sngss7_span = ftdmchan->span->mod_data;
|
||||
sngss7_span = ftdmchan->span->signal_data;
|
||||
|
||||
/* figure out what type of block needs to be applied */
|
||||
if ((siStaEvnt->cgsmti.eh.pres == PRSNT_NODEF) && (siStaEvnt->cgsmti.typeInd.pres == PRSNT_NODEF)) {
|
||||
|
@ -2058,7 +2058,7 @@ ftdm_status_t handle_cgu_req(uint32_t suInstId, uint32_t spInstId, uint32_t circ
|
|||
}
|
||||
|
||||
/* grab the span info */
|
||||
sngss7_span = ftdmchan->span->mod_data;
|
||||
sngss7_span = ftdmchan->span->signal_data;
|
||||
|
||||
/* figure out what type of block needs to be applied */
|
||||
if ((siStaEvnt->cgsmti.eh.pres == PRSNT_NODEF) && (siStaEvnt->cgsmti.typeInd.pres == PRSNT_NODEF)) {
|
||||
|
|
|
@ -90,7 +90,7 @@ void sngss7_con_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, SiCo
|
|||
memcpy(&sngss7_event->event.siConEvnt, siConEvnt, sizeof(*siConEvnt));
|
||||
|
||||
/* enqueue this event */
|
||||
ftdm_queue_enqueue(((sngss7_span_data_t*)sngss7_info->ftdmchan->span->mod_data)->event_queue, sngss7_event);
|
||||
ftdm_queue_enqueue(((sngss7_span_data_t*)sngss7_info->ftdmchan->span->signal_data)->event_queue, sngss7_event);
|
||||
|
||||
SS7_FUNC_TRACE_EXIT(__FUNCTION__);
|
||||
}
|
||||
|
@ -128,7 +128,7 @@ void sngss7_con_cfm(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, SiCo
|
|||
memcpy(&sngss7_event->event.siConEvnt, siConEvnt, sizeof(*siConEvnt));
|
||||
|
||||
/* enqueue this event */
|
||||
ftdm_queue_enqueue(((sngss7_span_data_t*)sngss7_info->ftdmchan->span->mod_data)->event_queue, sngss7_event);
|
||||
ftdm_queue_enqueue(((sngss7_span_data_t*)sngss7_info->ftdmchan->span->signal_data)->event_queue, sngss7_event);
|
||||
|
||||
SS7_FUNC_TRACE_EXIT(__FUNCTION__);
|
||||
}
|
||||
|
@ -167,7 +167,7 @@ void sngss7_con_sta(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, SiCn
|
|||
memcpy(&sngss7_event->event.siCnStEvnt, siCnStEvnt, sizeof(*siCnStEvnt));
|
||||
|
||||
/* enqueue this event */
|
||||
ftdm_queue_enqueue(((sngss7_span_data_t*)sngss7_info->ftdmchan->span->mod_data)->event_queue, sngss7_event);
|
||||
ftdm_queue_enqueue(((sngss7_span_data_t*)sngss7_info->ftdmchan->span->signal_data)->event_queue, sngss7_event);
|
||||
|
||||
SS7_FUNC_TRACE_EXIT(__FUNCTION__);
|
||||
}
|
||||
|
@ -205,7 +205,7 @@ void sngss7_rel_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, SiRe
|
|||
memcpy(&sngss7_event->event.siRelEvnt, siRelEvnt, sizeof(*siRelEvnt));
|
||||
|
||||
/* enqueue this event */
|
||||
ftdm_queue_enqueue(((sngss7_span_data_t*)sngss7_info->ftdmchan->span->mod_data)->event_queue, sngss7_event);
|
||||
ftdm_queue_enqueue(((sngss7_span_data_t*)sngss7_info->ftdmchan->span->signal_data)->event_queue, sngss7_event);
|
||||
|
||||
SS7_FUNC_TRACE_EXIT(__FUNCTION__);
|
||||
}
|
||||
|
@ -243,7 +243,7 @@ void sngss7_rel_cfm(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, SiRe
|
|||
memcpy(&sngss7_event->event.siRelEvnt, siRelEvnt, sizeof(*siRelEvnt));
|
||||
|
||||
/* enqueue this event */
|
||||
ftdm_queue_enqueue(((sngss7_span_data_t*)sngss7_info->ftdmchan->span->mod_data)->event_queue, sngss7_event);
|
||||
ftdm_queue_enqueue(((sngss7_span_data_t*)sngss7_info->ftdmchan->span->signal_data)->event_queue, sngss7_event);
|
||||
|
||||
SS7_FUNC_TRACE_EXIT(__FUNCTION__);
|
||||
}
|
||||
|
@ -281,7 +281,7 @@ void sngss7_dat_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, SiIn
|
|||
memcpy(&sngss7_event->event.siInfoEvnt, siInfoEvnt, sizeof(*siInfoEvnt));
|
||||
|
||||
/* enqueue this event */
|
||||
ftdm_queue_enqueue(((sngss7_span_data_t*)sngss7_info->ftdmchan->span->mod_data)->event_queue, sngss7_event);
|
||||
ftdm_queue_enqueue(((sngss7_span_data_t*)sngss7_info->ftdmchan->span->signal_data)->event_queue, sngss7_event);
|
||||
|
||||
SS7_FUNC_TRACE_EXIT(__FUNCTION__);
|
||||
}
|
||||
|
@ -320,7 +320,7 @@ void sngss7_fac_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint
|
|||
memcpy(&sngss7_event->event.siFacEvnt, siFacEvnt, sizeof(*siFacEvnt));
|
||||
|
||||
/* enqueue this event */
|
||||
ftdm_queue_enqueue(((sngss7_span_data_t*)sngss7_info->ftdmchan->span->mod_data)->event_queue, sngss7_event);
|
||||
ftdm_queue_enqueue(((sngss7_span_data_t*)sngss7_info->ftdmchan->span->signal_data)->event_queue, sngss7_event);
|
||||
|
||||
SS7_FUNC_TRACE_EXIT(__FUNCTION__);
|
||||
}
|
||||
|
@ -359,7 +359,7 @@ void sngss7_fac_cfm(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint
|
|||
memcpy(&sngss7_event->event.siFacEvnt, siFacEvnt, sizeof(*siFacEvnt));
|
||||
|
||||
/* enqueue this event */
|
||||
ftdm_queue_enqueue(((sngss7_span_data_t*)sngss7_info->ftdmchan->span->mod_data)->event_queue, sngss7_event);
|
||||
ftdm_queue_enqueue(((sngss7_span_data_t*)sngss7_info->ftdmchan->span->signal_data)->event_queue, sngss7_event);
|
||||
|
||||
SS7_FUNC_TRACE_EXIT(__FUNCTION__);
|
||||
}
|
||||
|
@ -396,7 +396,7 @@ void sngss7_umsg_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit)
|
|||
sngss7_event->event_id = SNGSS7_UMSG_IND_EVENT;
|
||||
|
||||
/* enqueue this event */
|
||||
ftdm_queue_enqueue(((sngss7_span_data_t*)sngss7_info->ftdmchan->span->mod_data)->event_queue, sngss7_event);
|
||||
ftdm_queue_enqueue(((sngss7_span_data_t*)sngss7_info->ftdmchan->span->signal_data)->event_queue, sngss7_event);
|
||||
|
||||
SS7_FUNC_TRACE_EXIT(__FUNCTION__);
|
||||
|
||||
|
@ -438,7 +438,7 @@ void sngss7_sta_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint
|
|||
}
|
||||
|
||||
/* enqueue this event */
|
||||
ftdm_queue_enqueue(((sngss7_span_data_t*)sngss7_info->ftdmchan->span->mod_data)->event_queue, sngss7_event);
|
||||
ftdm_queue_enqueue(((sngss7_span_data_t*)sngss7_info->ftdmchan->span->signal_data)->event_queue, sngss7_event);
|
||||
|
||||
SS7_FUNC_TRACE_EXIT(__FUNCTION__);
|
||||
}
|
||||
|
@ -478,7 +478,7 @@ void sngss7_susp_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, SiS
|
|||
}
|
||||
|
||||
/* enqueue this event */
|
||||
ftdm_queue_enqueue(((sngss7_span_data_t*)sngss7_info->ftdmchan->span->mod_data)->event_queue, sngss7_event);
|
||||
ftdm_queue_enqueue(((sngss7_span_data_t*)sngss7_info->ftdmchan->span->signal_data)->event_queue, sngss7_event);
|
||||
|
||||
SS7_FUNC_TRACE_EXIT(__FUNCTION__);
|
||||
|
||||
|
@ -519,7 +519,7 @@ void sngss7_resm_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, SiR
|
|||
}
|
||||
|
||||
/* enqueue this event */
|
||||
ftdm_queue_enqueue(((sngss7_span_data_t*)sngss7_info->ftdmchan->span->mod_data)->event_queue, sngss7_event);
|
||||
ftdm_queue_enqueue(((sngss7_span_data_t*)sngss7_info->ftdmchan->span->signal_data)->event_queue, sngss7_event);
|
||||
|
||||
SS7_FUNC_TRACE_EXIT(__FUNCTION__);
|
||||
|
||||
|
@ -560,7 +560,7 @@ void sngss7_ssp_sta_cfm(uint32_t infId)
|
|||
}
|
||||
|
||||
/* enqueue this event */
|
||||
ftdm_queue_enqueue(((sngss7_span_data_t*)sngss7_info->ftdmchan->span->mod_data)->event_queue, sngss7_event);
|
||||
ftdm_queue_enqueue(((sngss7_span_data_t*)sngss7_info->ftdmchan->span->signal_data)->event_queue, sngss7_event);
|
||||
#endif
|
||||
SS7_FUNC_TRACE_EXIT(__FUNCTION__);
|
||||
|
||||
|
|
|
@ -275,7 +275,7 @@ static void *ftdm_sangoma_ss7_run(ftdm_thread_t * me, void *obj)
|
|||
ftdm_span_t *ftdmspan = (ftdm_span_t *) obj;
|
||||
ftdm_channel_t *ftdmchan = NULL;
|
||||
sngss7_event_data_t *sngss7_event = NULL;
|
||||
sngss7_span_data_t *sngss7_span = (sngss7_span_data_t *)ftdmspan->mod_data;
|
||||
sngss7_span_data_t *sngss7_span = (sngss7_span_data_t *)ftdmspan->signal_data;
|
||||
|
||||
ftdm_log (FTDM_LOG_INFO, "ftmod_sangoma_ss7 monitor thread for span=%u started.\n", ftdmspan->span_id);
|
||||
|
||||
|
@ -788,7 +788,7 @@ void ftdm_sangoma_ss7_process_state_change (ftdm_channel_t * ftdmchan)
|
|||
/* check if this is the base circuit and send out the GRA
|
||||
* we insure that this is the last circuit to have the state change queued
|
||||
*/
|
||||
sngss7_span_data_t *span = ftdmchan->span->mod_data;
|
||||
sngss7_span_data_t *span = ftdmchan->span->signal_data;
|
||||
if (span->rx_grs.circuit == sngss7_info->circuit->id) {
|
||||
/* send out the GRA */
|
||||
ft_to_sngss7_gra(ftdmchan);
|
||||
|
@ -1350,7 +1350,7 @@ static ftdm_status_t ftdm_sangoma_ss7_start(ftdm_span_t * span)
|
|||
ftdmchan = span->channels[x];
|
||||
if (ftdmchan->call_data == NULL) continue;
|
||||
sngss7_info = ftdmchan->call_data;
|
||||
sngss7_span = ftdmchan->span->mod_data;
|
||||
sngss7_span = ftdmchan->span->signal_data;
|
||||
sngss7_intf = &g_ftdm_sngss7_data.cfg.isupIntf[sngss7_info->circuit->infId];
|
||||
|
||||
|
||||
|
@ -1474,7 +1474,7 @@ static FIO_CONFIGURE_SPAN_SIGNALING_FUNCTION(ftdm_sangoma_ss7_span_config)
|
|||
span->get_channel_sig_status = ftdm_sangoma_ss7_get_sig_status;
|
||||
span->set_channel_sig_status = ftdm_sangoma_ss7_set_sig_status;
|
||||
span->state_map = &sangoma_ss7_state_map;
|
||||
span->mod_data = ss7_span_info;
|
||||
span->signal_data = ss7_span_info;
|
||||
|
||||
/* set the flag to indicate that this span uses channel state change queues */
|
||||
ftdm_set_flag (span, FTDM_SPAN_USE_CHAN_QUEUE);
|
||||
|
|
|
@ -619,7 +619,7 @@ void ft_to_sngss7_gra (ftdm_channel_t * ftdmchan)
|
|||
{
|
||||
SS7_FUNC_TRACE_ENTER (__FUNCTION__);
|
||||
|
||||
sngss7_span_data_t *sngss7_span = ftdmchan->span->mod_data;
|
||||
sngss7_span_data_t *sngss7_span = ftdmchan->span->signal_data;
|
||||
sngss7_chan_data_t *sngss7_info = ftdmchan->call_data;
|
||||
SiStaEvnt gra;
|
||||
|
||||
|
@ -663,7 +663,7 @@ void ft_to_sngss7_grs (ftdm_channel_t * ftdmchan)
|
|||
{
|
||||
SS7_FUNC_TRACE_ENTER (__FUNCTION__);
|
||||
|
||||
sngss7_span_data_t *sngss7_span = ftdmchan->span->mod_data;
|
||||
sngss7_span_data_t *sngss7_span = ftdmchan->span->signal_data;
|
||||
sngss7_chan_data_t *sngss7_info = ftdmchan->call_data;
|
||||
|
||||
SiStaEvnt grs;
|
||||
|
@ -696,7 +696,7 @@ void ft_to_sngss7_cgba(ftdm_channel_t * ftdmchan)
|
|||
{
|
||||
SS7_FUNC_TRACE_ENTER (__FUNCTION__);
|
||||
|
||||
sngss7_span_data_t *sngss7_span = ftdmchan->span->mod_data;
|
||||
sngss7_span_data_t *sngss7_span = ftdmchan->span->signal_data;
|
||||
sngss7_chan_data_t *sngss7_info = ftdmchan->call_data;
|
||||
int x = 0;
|
||||
|
||||
|
@ -745,7 +745,7 @@ void ft_to_sngss7_cgua(ftdm_channel_t * ftdmchan)
|
|||
{
|
||||
SS7_FUNC_TRACE_ENTER (__FUNCTION__);
|
||||
|
||||
sngss7_span_data_t *sngss7_span = ftdmchan->span->mod_data;
|
||||
sngss7_span_data_t *sngss7_span = ftdmchan->span->signal_data;
|
||||
sngss7_chan_data_t *sngss7_info = ftdmchan->call_data;
|
||||
int x = 0;
|
||||
|
||||
|
@ -794,7 +794,7 @@ void ft_to_sngss7_cgb(ftdm_channel_t * ftdmchan)
|
|||
{
|
||||
SS7_FUNC_TRACE_ENTER (__FUNCTION__);
|
||||
|
||||
sngss7_span_data_t *sngss7_span = ftdmchan->span->mod_data;
|
||||
sngss7_span_data_t *sngss7_span = ftdmchan->span->signal_data;
|
||||
sngss7_chan_data_t *sngss7_info = ftdmchan->call_data;
|
||||
SiStaEvnt cgb;
|
||||
int x = 0;
|
||||
|
@ -844,7 +844,7 @@ void ft_to_sngss7_cgu(ftdm_channel_t * ftdmchan)
|
|||
{
|
||||
SS7_FUNC_TRACE_ENTER (__FUNCTION__);
|
||||
|
||||
sngss7_span_data_t *sngss7_span = ftdmchan->span->mod_data;
|
||||
sngss7_span_data_t *sngss7_span = ftdmchan->span->signal_data;
|
||||
sngss7_chan_data_t *sngss7_info = ftdmchan->call_data;
|
||||
SiStaEvnt cgu;
|
||||
int x = 0;
|
||||
|
|
|
@ -513,7 +513,7 @@ ftdm_status_t check_if_rx_grs_started(ftdm_span_t *ftdmspan)
|
|||
{
|
||||
ftdm_channel_t *ftdmchan = NULL;
|
||||
sngss7_chan_data_t *sngss7_info = NULL;
|
||||
sngss7_span_data_t *sngss7_span = (sngss7_span_data_t *)ftdmspan->mod_data;
|
||||
sngss7_span_data_t *sngss7_span = (sngss7_span_data_t *)ftdmspan->signal_data;
|
||||
int i;
|
||||
|
||||
for ( i = sngss7_span->rx_grs.circuit; i < (sngss7_span->rx_grs.circuit + sngss7_span->rx_grs.range + 1); i++) {
|
||||
|
@ -575,7 +575,7 @@ ftdm_status_t check_if_rx_grs_processed(ftdm_span_t *ftdmspan)
|
|||
{
|
||||
ftdm_channel_t *ftdmchan = NULL;
|
||||
sngss7_chan_data_t *sngss7_info = NULL;
|
||||
sngss7_span_data_t *sngss7_span = (sngss7_span_data_t *)ftdmspan->mod_data;
|
||||
sngss7_span_data_t *sngss7_span = (sngss7_span_data_t *)ftdmspan->signal_data;
|
||||
int i;
|
||||
int byte = 0;
|
||||
int bit = 0;
|
||||
|
@ -667,7 +667,7 @@ ftdm_status_t check_if_rx_gra_started(ftdm_span_t *ftdmspan)
|
|||
{
|
||||
ftdm_channel_t *ftdmchan = NULL;
|
||||
sngss7_chan_data_t *sngss7_info = NULL;
|
||||
sngss7_span_data_t *sngss7_span = (sngss7_span_data_t *)ftdmspan->mod_data;
|
||||
sngss7_span_data_t *sngss7_span = (sngss7_span_data_t *)ftdmspan->signal_data;
|
||||
int i;
|
||||
|
||||
for (i = sngss7_span->rx_gra.circuit; i < (sngss7_span->rx_gra.circuit + sngss7_span->rx_gra.range + 1); i++) {
|
||||
|
@ -817,7 +817,7 @@ ftdm_status_t process_span_ucic(ftdm_span_t *ftdmspan)
|
|||
{
|
||||
ftdm_channel_t *ftdmchan = NULL;
|
||||
sngss7_chan_data_t *sngss7_info = NULL;
|
||||
sngss7_span_data_t *sngss7_span = (sngss7_span_data_t *)ftdmspan->mod_data;
|
||||
sngss7_span_data_t *sngss7_span = (sngss7_span_data_t *)ftdmspan->signal_data;
|
||||
int i;
|
||||
|
||||
for (i = sngss7_span->ucic.circuit; i < (sngss7_span->ucic.circuit + sngss7_span->ucic.range + 1); i++) {
|
||||
|
@ -869,7 +869,7 @@ ftdm_status_t clear_rx_grs_flags(sngss7_chan_data_t *sngss7_info)
|
|||
ftdm_status_t clear_rx_grs_data(sngss7_chan_data_t *sngss7_info)
|
||||
{
|
||||
ftdm_channel_t *ftdmchan = sngss7_info->ftdmchan;
|
||||
sngss7_span_data_t *sngss7_span = ftdmchan->span->mod_data;
|
||||
sngss7_span_data_t *sngss7_span = ftdmchan->span->signal_data;
|
||||
|
||||
/* clear the rx_grs data fields */
|
||||
memset(&sngss7_span->rx_grs, 0x0, sizeof(sngss7_group_data_t));
|
||||
|
@ -881,7 +881,7 @@ ftdm_status_t clear_rx_grs_data(sngss7_chan_data_t *sngss7_info)
|
|||
ftdm_status_t clear_rx_gra_data(sngss7_chan_data_t *sngss7_info)
|
||||
{
|
||||
ftdm_channel_t *ftdmchan = sngss7_info->ftdmchan;
|
||||
sngss7_span_data_t *sngss7_span = ftdmchan->span->mod_data;
|
||||
sngss7_span_data_t *sngss7_span = ftdmchan->span->signal_data;
|
||||
|
||||
/* clear the rx_grs data fields */
|
||||
memset(&sngss7_span->rx_gra, 0x0, sizeof(sngss7_group_data_t));
|
||||
|
@ -904,7 +904,7 @@ ftdm_status_t clear_tx_grs_flags(sngss7_chan_data_t *sngss7_info)
|
|||
ftdm_status_t clear_tx_grs_data(sngss7_chan_data_t *sngss7_info)
|
||||
{
|
||||
ftdm_channel_t *ftdmchan = sngss7_info->ftdmchan;
|
||||
sngss7_span_data_t *sngss7_span = ftdmchan->span->mod_data;
|
||||
sngss7_span_data_t *sngss7_span = ftdmchan->span->signal_data;
|
||||
|
||||
/* clear the rx_grs data fields */
|
||||
memset(&sngss7_span->tx_grs, 0x0, sizeof(sngss7_group_data_t));
|
||||
|
|
|
@ -2121,7 +2121,7 @@ static int ftmod_ss7_fill_in_circuits(sng_isupCkt_t *isupCkt)
|
|||
ftdmchan->call_data = ss7_info;
|
||||
|
||||
/* prepare the timer structures */
|
||||
ss7_info->t35.sched = ((sngss7_span_data_t *)isupCkt->span->mod_data)->sched;
|
||||
ss7_info->t35.sched = ((sngss7_span_data_t *)isupCkt->span->signal_data)->sched;
|
||||
ss7_info->t35.counter = 1;
|
||||
ss7_info->t35.beat = g_ftdm_sngss7_data.cfg.isupIntf[isupCkt->isupInf].t35*100; /* beat is in ms, t35 is in 100ms */
|
||||
ss7_info->t35.callback = handle_isup_t35;
|
||||
|
|
|
@ -117,28 +117,28 @@ static __inline__ int tdmv_api_wait_socket(ftdm_channel_t *ftdmchan, int timeout
|
|||
|
||||
#ifdef LIBSANGOMA_VERSION
|
||||
int err;
|
||||
uint32_t inflags = *flags;
|
||||
uint32_t outflags = 0;
|
||||
sangoma_wait_obj_t *sangoma_wait_obj = ftdmchan->mod_data;
|
||||
uint32_t inflags = *flags;
|
||||
uint32_t outflags = 0;
|
||||
sangoma_wait_obj_t *sangoma_wait_obj = ftdmchan->io_data;
|
||||
|
||||
err = sangoma_waitfor(sangoma_wait_obj, inflags, &outflags, timeout);
|
||||
*flags = 0;
|
||||
if (err == SANG_STATUS_SUCCESS) {
|
||||
*flags = outflags;
|
||||
err = 1; /* ideally should be the number of file descriptors with something to read */
|
||||
}
|
||||
if (err == SANG_STATUS_APIPOLL_TIMEOUT) {
|
||||
err = 0;
|
||||
}
|
||||
return err;
|
||||
if (err == SANG_STATUS_SUCCESS) {
|
||||
*flags = outflags;
|
||||
err = 1; /* ideally should be the number of file descriptors with something to read */
|
||||
}
|
||||
if (err == SANG_STATUS_APIPOLL_TIMEOUT) {
|
||||
err = 0;
|
||||
}
|
||||
return err;
|
||||
#else
|
||||
struct pollfd pfds[1];
|
||||
int res;
|
||||
int res;
|
||||
|
||||
memset(&pfds[0], 0, sizeof(pfds[0]));
|
||||
pfds[0].fd = ftdmchan->sockfd;
|
||||
pfds[0].events = *flags;
|
||||
res = poll(pfds, 1, timeout);
|
||||
memset(&pfds[0], 0, sizeof(pfds[0]));
|
||||
pfds[0].fd = ftdmchan->sockfd;
|
||||
pfds[0].events = *flags;
|
||||
res = poll(pfds, 1, timeout);
|
||||
*flags = 0;
|
||||
|
||||
if (pfds[0].revents & POLLERR) {
|
||||
|
@ -149,7 +149,7 @@ static __inline__ int tdmv_api_wait_socket(ftdm_channel_t *ftdmchan, int timeout
|
|||
*flags = pfds[0].revents;
|
||||
}
|
||||
|
||||
return res;
|
||||
return res;
|
||||
#endif
|
||||
|
||||
}
|
||||
|
@ -252,7 +252,7 @@ static unsigned wp_open_range(ftdm_span_t *span, unsigned spanno, unsigned start
|
|||
ftdm_log(FTDM_LOG_ERROR, "failure create waitable object for s%dc%d\n", spanno, x);
|
||||
continue;
|
||||
}
|
||||
chan->mod_data = sangoma_wait_obj;
|
||||
chan->io_data = sangoma_wait_obj;
|
||||
#endif
|
||||
|
||||
chan->physical_span_id = spanno;
|
||||
|
@ -541,7 +541,7 @@ static FIO_OPEN_FUNCTION(wanpipe_open)
|
|||
static FIO_CLOSE_FUNCTION(wanpipe_close)
|
||||
{
|
||||
#ifdef LIBSANGOMA_VERSION
|
||||
sangoma_wait_obj_t *waitobj = ftdmchan->mod_data;
|
||||
sangoma_wait_obj_t *waitobj = ftdmchan->io_data;
|
||||
/* kick any I/O waiters */
|
||||
sangoma_wait_obj_signal(waitobj);
|
||||
#endif
|
||||
|
@ -895,10 +895,10 @@ FIO_SPAN_POLL_EVENT_FUNCTION(wanpipe_poll_event)
|
|||
for(i = 1; i <= span->chan_count; i++) {
|
||||
ftdm_channel_t *ftdmchan = span->channels[i];
|
||||
#ifdef LIBSANGOMA_VERSION
|
||||
if (!ftdmchan->mod_data) {
|
||||
if (!ftdmchan->io_data) {
|
||||
continue; /* should never happen but happens when shutting down */
|
||||
}
|
||||
pfds[j] = ftdmchan->mod_data;
|
||||
pfds[j] = ftdmchan->io_data;
|
||||
inflags[j] = poll_events ? poll_events[j] : POLLPRI;
|
||||
#else
|
||||
memset(&pfds[j], 0, sizeof(pfds[j]));
|
||||
|
@ -1011,13 +1011,15 @@ static FIO_GET_ALARMS_FUNCTION(wanpipe_get_alarms)
|
|||
}
|
||||
alarms = tdm_api.wp_tdm_cmd.fe_alarms;
|
||||
#endif
|
||||
#if 1
|
||||
/* DAVIDY - Temporary fix: in the current trunk of libsangoma, for BRI,
|
||||
#ifdef WIN32
|
||||
/* Temporary fix: in the current trunk of libsangoma, for BRI,
|
||||
WAN_TE_BIT_ALARM_RED bit is set if the card is in disconnected state, but this has
|
||||
not been ported to Windows-libsangoma yet */
|
||||
if (alarms) {
|
||||
ftdmchan->alarm_flags |= FTDM_ALARM_RED;
|
||||
alarms = 0;
|
||||
if (FTDM_SPAN_IS_BRI(ftdmchan->span)) {
|
||||
if (alarms) {
|
||||
ftdmchan->alarm_flags |= FTDM_ALARM_RED;
|
||||
alarms = 0;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -1027,6 +1029,7 @@ static FIO_GET_ALARMS_FUNCTION(wanpipe_get_alarms)
|
|||
ftdmchan->alarm_flags |= FTDM_ALARM_RED;
|
||||
alarms &= ~WAN_TE_BIT_ALARM_RED;
|
||||
}
|
||||
|
||||
|
||||
if (alarms & WAN_TE_BIT_ALARM_AIS) {
|
||||
ftdmchan->alarm_flags |= FTDM_ALARM_BLUE;
|
||||
|
@ -1231,10 +1234,10 @@ FIO_SPAN_NEXT_EVENT_FUNCTION(wanpipe_next_event)
|
|||
static FIO_CHANNEL_DESTROY_FUNCTION(wanpipe_channel_destroy)
|
||||
{
|
||||
#ifdef LIBSANGOMA_VERSION
|
||||
if (ftdmchan->mod_data) {
|
||||
if (ftdmchan->io_data) {
|
||||
sangoma_wait_obj_t *sangoma_wait_obj;
|
||||
sangoma_wait_obj = ftdmchan->mod_data;
|
||||
ftdmchan->mod_data = NULL;
|
||||
sangoma_wait_obj = ftdmchan->io_data;
|
||||
ftdmchan->io_data = NULL;
|
||||
sangoma_wait_obj_delete(&sangoma_wait_obj);
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -222,6 +222,8 @@ extern "C" {
|
|||
|
||||
#define ftdm_is_dtmf(key) ((key > 47 && key < 58) || (key > 64 && key < 69) || (key > 96 && key < 101) || key == 35 || key == 42 || key == 87 || key == 119)
|
||||
|
||||
#define FTDM_SPAN_IS_BRI(x) ((x)->trunk_type == FTDM_TRUNK_BRI || (x)->trunk_type == FTDM_TRUNK_BRI_PTMP)
|
||||
|
||||
/*!
|
||||
\brief Copy flags from one arbitrary object to another
|
||||
\command dest the object to copy the flags to
|
||||
|
@ -422,7 +424,9 @@ struct ftdm_channel {
|
|||
ftdm_fsk_data_state_t fsk;
|
||||
uint8_t fsk_buf[80];
|
||||
uint32_t ring_count;
|
||||
void *mod_data;
|
||||
/* Private I/O data. Do not touch unless you are an I/O module */
|
||||
void *io_data;
|
||||
/* Private signaling data. Do not touch unless you are a signaling module */
|
||||
void *call_data;
|
||||
struct ftdm_caller_data caller_data;
|
||||
struct ftdm_span *span;
|
||||
|
@ -454,6 +458,7 @@ struct ftdm_span {
|
|||
ftdm_trunk_type_t trunk_type;
|
||||
ftdm_analog_start_type_t start_type;
|
||||
ftdm_signal_type_t signal_type;
|
||||
/* Private signaling data. Do not touch unless you are a signaling module */
|
||||
void *signal_data;
|
||||
fio_signal_cb_t signal_cb;
|
||||
ftdm_event_t event_header;
|
||||
|
@ -471,7 +476,8 @@ struct ftdm_span {
|
|||
ftdm_span_start_t start;
|
||||
ftdm_span_stop_t stop;
|
||||
ftdm_channel_sig_read_t sig_read;
|
||||
void *mod_data;
|
||||
/* Private I/O data per span. Do not touch unless you are an I/O module */
|
||||
void *io_data;
|
||||
char *type;
|
||||
char *dtmf_hangup;
|
||||
size_t dtmf_hangup_len;
|
||||
|
|
|
@ -176,10 +176,11 @@ typedef enum {
|
|||
FTDM_SPAN_USE_CHAN_QUEUE = (1 << 6),
|
||||
FTDM_SPAN_SUGGEST_CHAN_ID = (1 << 7),
|
||||
FTDM_SPAN_USE_AV_RATE = (1 << 8),
|
||||
FTDM_SPAN_PWR_SAVING = (1 << 9),
|
||||
/* If you use this flag, you MUST call ftdm_span_trigger_signals to deliver the user signals
|
||||
* after having called ftdm_send_span_signal(), which with this flag it will just enqueue the signal
|
||||
* for later delivery */
|
||||
FTDM_SPAN_USE_SIGNALS_QUEUE = (1 << 9),
|
||||
FTDM_SPAN_USE_SIGNALS_QUEUE = (1 << 10),
|
||||
} ftdm_span_flag_t;
|
||||
|
||||
/*! \brief Channel supported features */
|
||||
|
|
Loading…
Reference in New Issue