mirror of
https://github.com/signalwire/freeswitch.git
synced 2026-10-31 15:44:21 +00:00
Merge remote branch 'smgfs/master'
This commit is contained in:
commit
c79bfa768a
58 files changed
+1859
-6585
No files matched your search
@@ -285,10 +285,7 @@ static FIO_SPAN_GET_SIG_STATUS_FUNCTION(isdn_get_span_sig_status)
|
||||
*/
|
||||
static FIO_CHANNEL_OUTGOING_CALL_FUNCTION(isdn_outgoing_call)
|
||||
{
|
||||
ftdm_status_t status = FTDM_SUCCESS;
|
||||
ftdm_set_flag(ftdmchan, FTDM_CHANNEL_OUTBOUND);
|
||||
ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_DIALING);
|
||||
return status;
|
||||
return FTDM_SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -300,7 +297,14 @@ static FIO_CHANNEL_OUTGOING_CALL_FUNCTION(isdn_outgoing_call)
|
||||
#ifdef __TODO__
|
||||
static FIO_CHANNEL_REQUEST_FUNCTION(isdn_channel_request)
|
||||
{
|
||||
#if 1 /* FIXME caller_data.raw_data does not exist anymore, see docs/variables.txt for more info */
|
||||
Q931mes_Generic empty_gen;
|
||||
Q931mes_Generic *gen = &empty_gen;
|
||||
|
||||
memset(&empty_gen, 0, sizeof(empty_gen)) ;
|
||||
#else
|
||||
Q931mes_Generic *gen = (Q931mes_Generic *) caller_data->raw_data;
|
||||
#endif
|
||||
Q931ie_BearerCap BearerCap;
|
||||
Q931ie_ChanID ChanID = { 0 };
|
||||
Q931ie_CallingNum CallingNum;
|
||||
@@ -1095,12 +1099,16 @@ static L3INT ftdm_isdn_931_34(void *pvt, struct Q931_Call *call, Q931mes_Generic
|
||||
#ifdef __TODO_OR_REMOVE__
|
||||
ftdmchan->caller_data.CRV = gen->CRV;
|
||||
#endif
|
||||
#if 0 /* FIXME */
|
||||
if (cplen > sizeof(caller_data->raw_data)) {
|
||||
cplen = sizeof(caller_data->raw_data);
|
||||
}
|
||||
#endif
|
||||
gen->CRVFlag = !(gen->CRVFlag);
|
||||
#if 0 /* FIXME */
|
||||
memcpy(caller_data->raw_data, msg, cplen);
|
||||
caller_data->raw_data_len = cplen;
|
||||
#endif
|
||||
fail = 0;
|
||||
}
|
||||
}
|
||||
@@ -1298,12 +1306,20 @@ static int ftdm_isdn_921_21(void *pvt, L2UCHAR *msg, L2INT mlen)
|
||||
|
||||
static __inline__ void state_advance(ftdm_channel_t *ftdmchan)
|
||||
{
|
||||
Q931mes_Generic *gen = (Q931mes_Generic *) ftdmchan->caller_data.raw_data;
|
||||
ftdm_isdn_data_t *isdn_data = ftdmchan->span->signal_data;
|
||||
ftdm_span_t *span = ftdm_channel_get_span(ftdmchan);
|
||||
ftdm_sigmsg_t sig;
|
||||
ftdm_status_t status;
|
||||
|
||||
#if 1 /* FIXME caller_data.raw_data does not exist anymore, see docs/variables.txt for more info */
|
||||
Q931mes_Generic empty_gen;
|
||||
Q931mes_Generic *gen = &empty_gen;
|
||||
|
||||
memset(&empty_gen, 0, sizeof(empty_gen)) ;
|
||||
#else
|
||||
Q931mes_Generic *gen = (Q931mes_Generic *) ftdmchan->caller_data.raw_data;
|
||||
#endif
|
||||
|
||||
ftdm_log(FTDM_LOG_DEBUG, "%d:%d STATE [%s]\n",
|
||||
ftdm_channel_get_span_id(ftdmchan),
|
||||
ftdm_channel_get_id(ftdmchan),
|
||||
@@ -1431,7 +1447,9 @@ static __inline__ void state_advance(ftdm_channel_t *ftdmchan)
|
||||
gen->MesType = Q931mes_CONNECT;
|
||||
gen->BearerCap = 0;
|
||||
gen->CRVFlag = 1; /* inbound call */
|
||||
#if 0 /* FIXME */
|
||||
Q931Rx43(&isdn_data->q931, gen, ftdmchan->caller_data.raw_data_len);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -93,10 +93,7 @@ static FIO_SPAN_GET_SIG_STATUS_FUNCTION(isdn_get_span_sig_status)
|
||||
*/
|
||||
static FIO_CHANNEL_OUTGOING_CALL_FUNCTION(isdn_outgoing_call)
|
||||
{
|
||||
ftdm_status_t status = FTDM_SUCCESS;
|
||||
ftdm_set_flag(ftdmchan, FTDM_CHANNEL_OUTBOUND);
|
||||
ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_DIALING);
|
||||
return status;
|
||||
return FTDM_SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -185,6 +185,10 @@
|
||||
RelativePath=".\ftmod_r2.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\ftmod_r2_io_mf_lib.c"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
</Files>
|
||||
<Globals>
|
||||
|
||||
Regular → Executable
+48
-18
@@ -47,8 +47,10 @@
|
||||
#endif
|
||||
#include <stdio.h>
|
||||
#include <openr2.h>
|
||||
#include "freetdm.h"
|
||||
#include "private/ftdm_core.h"
|
||||
#include <freetdm.h>
|
||||
#include <private/ftdm_core.h>
|
||||
|
||||
#include "ftmod_r2_io_mf_lib.h" // ftdm_r2_get_native_channel_mf_generation_iface
|
||||
|
||||
/* when the user stops a span, we clear FTDM_R2_SPAN_STARTED, so that the signaling thread
|
||||
* knows it must stop, and we wait for FTDM_R2_RUNNING to be clear, which tells us the
|
||||
@@ -105,6 +107,7 @@ typedef struct ft_r2_conf_s {
|
||||
int charge_calls;
|
||||
int forced_release;
|
||||
int allow_collect_calls;
|
||||
int use_channel_native_mf_generation;
|
||||
} ft_r2_conf_t;
|
||||
|
||||
/* r2 configuration stored in span->signal_data */
|
||||
@@ -286,9 +289,6 @@ static ftdm_call_cause_t ftdm_r2_cause_to_ftdm_cause(ftdm_channel_t *fchan, open
|
||||
case OR2_CAUSE_UNSPECIFIED:
|
||||
return FTDM_CAUSE_NORMAL_UNSPECIFIED;
|
||||
|
||||
case OR2_CAUSE_COLLECT_CALL_REJECTED:
|
||||
return FTDM_CAUSE_CALL_REJECTED;
|
||||
|
||||
case OR2_CAUSE_FORCED_RELEASE:
|
||||
return FTDM_CAUSE_NORMAL_CLEARING;
|
||||
|
||||
@@ -307,6 +307,7 @@ static openr2_call_disconnect_cause_t ftdm_r2_ftdm_cause_to_openr2_cause(ftdm_ch
|
||||
return OR2_CAUSE_NORMAL_CLEARING;
|
||||
|
||||
case FTDM_CAUSE_USER_BUSY:
|
||||
case FTDM_CAUSE_CALL_REJECTED:
|
||||
return OR2_CAUSE_BUSY_NUMBER;
|
||||
|
||||
case FTDM_CAUSE_SWITCH_CONGESTION:
|
||||
@@ -334,7 +335,7 @@ static openr2_call_disconnect_cause_t ftdm_r2_ftdm_cause_to_openr2_cause(ftdm_ch
|
||||
return OR2_CAUSE_GLARE;
|
||||
|
||||
}
|
||||
ftdm_log_chan(fchan, FTDM_LOG_WARNING, "freetdm hangup cause %d mapped to openr2 cause %s\n",
|
||||
ftdm_log_chan(fchan, FTDM_LOG_NOTICE, "freetdm hangup cause %d mapped to openr2 cause %s\n",
|
||||
fchan->caller_data.hangup_cause, openr2_proto_get_disconnect_string(OR2_CAUSE_UNSPECIFIED));
|
||||
return OR2_CAUSE_UNSPECIFIED;
|
||||
}
|
||||
@@ -471,12 +472,9 @@ static FIO_CHANNEL_OUTGOING_CALL_FUNCTION(r2_outgoing_call)
|
||||
return FTDM_FAIL;
|
||||
}
|
||||
|
||||
ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_DIALING);
|
||||
|
||||
ftdm_channel_set_feature(ftdmchan, FTDM_CHANNEL_FEATURE_IO_STATS);
|
||||
ftdm_channel_command(ftdmchan, FTDM_COMMAND_FLUSH_TX_BUFFERS, NULL);
|
||||
ftdm_channel_command(ftdmchan, FTDM_COMMAND_FLUSH_RX_BUFFERS, NULL);
|
||||
|
||||
return FTDM_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -673,13 +671,13 @@ static void ftdm_r2_on_call_offered(openr2_chan_t *r2chan, const char *ani, cons
|
||||
ftdm_channel_t *ftdmchan = openr2_chan_get_client_data(r2chan);
|
||||
ftdm_r2_data_t *r2data = ftdmchan->span->signal_data;
|
||||
|
||||
ftdm_log_chan(ftdmchan, FTDM_LOG_NOTICE, "Call offered with ANI = %s, DNIS = %s, Category = %d, ANI restricted = %s\n",
|
||||
ani, dnis, category, ani_restricted ? "Yes" : "No");
|
||||
ftdm_log_chan(ftdmchan, FTDM_LOG_NOTICE, "Call offered with ANI = %s, DNIS = %s, Category = %s, ANI restricted = %s\n",
|
||||
ani, dnis, openr2_proto_get_category_string(category), ani_restricted ? "Yes" : "No");
|
||||
|
||||
/* check if this is a collect call and if we should accept it */
|
||||
if (!r2data->allow_collect_calls && category == OR2_CALLING_PARTY_CATEGORY_COLLECT_CALL) {
|
||||
ftdm_log_chan_msg(ftdmchan, FTDM_LOG_NOTICE, "Rejecting collect call\n");
|
||||
openr2_chan_disconnect_call(r2chan, OR2_CAUSE_COLLECT_CALL_REJECTED);
|
||||
openr2_chan_disconnect_call(r2chan, OR2_CAUSE_UNALLOCATED_NUMBER);
|
||||
} else {
|
||||
ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_RING);
|
||||
}
|
||||
@@ -714,6 +712,7 @@ static void dump_mf(openr2_chan_t *r2chan)
|
||||
{
|
||||
char dfile[512];
|
||||
FILE *f = NULL;
|
||||
int rc = 0;
|
||||
ftdm_channel_t *ftdmchan = openr2_chan_get_client_data(r2chan);
|
||||
ftdm_r2_data_t *r2data = ftdmchan->span->signal_data;
|
||||
if (r2data->mf_dump_size) {
|
||||
@@ -727,7 +726,10 @@ static void dump_mf(openr2_chan_t *r2chan)
|
||||
if (f) {
|
||||
ftdm_log_chan(ftdmchan, FTDM_LOG_ERROR, "Dumping IO input in file %s\n", dfile);
|
||||
ftdm_channel_command(ftdmchan, FTDM_COMMAND_DUMP_INPUT, f);
|
||||
fclose(f);
|
||||
rc = fclose(f);
|
||||
if (rc) {
|
||||
ftdm_log_chan(ftdmchan, FTDM_LOG_ERROR, "Failure closing IO input file %s: %s\n", dfile, strerror(errno));
|
||||
}
|
||||
} else {
|
||||
ftdm_log_chan(ftdmchan, FTDM_LOG_ERROR, "Could not dump IO input in file %s, error: %s", dfile, strerror(errno));
|
||||
}
|
||||
@@ -738,7 +740,10 @@ static void dump_mf(openr2_chan_t *r2chan)
|
||||
if (f) {
|
||||
ftdm_log_chan(ftdmchan, FTDM_LOG_ERROR, "Dumping IO output in file %s\n", dfile);
|
||||
ftdm_channel_command(ftdmchan, FTDM_COMMAND_DUMP_OUTPUT, f);
|
||||
fclose(f);
|
||||
rc = fclose(f);
|
||||
if (rc) {
|
||||
ftdm_log_chan(ftdmchan, FTDM_LOG_ERROR, "Failure closing IO output file %s: %s\n", dfile, strerror(errno));
|
||||
}
|
||||
} else {
|
||||
ftdm_log_chan(ftdmchan, FTDM_LOG_ERROR, "Could not dump IO output in file %s, error: %s", dfile, strerror(errno));
|
||||
}
|
||||
@@ -1440,7 +1445,8 @@ static FIO_CONFIGURE_SPAN_SIGNALING_FUNCTION(ftdm_r2_configure_span_signaling)
|
||||
/* .double_answer */ -1,
|
||||
/* .charge_calls */ -1,
|
||||
/* .forced_release */ -1,
|
||||
/* .allow_collect_calls */ -1
|
||||
/* .allow_collect_calls */ -1,
|
||||
/* .use_channel_native_mf_generation */ 0
|
||||
};
|
||||
|
||||
ftdm_assert_return(sig_cb != NULL, FTDM_FAIL, "No signaling cb provided\n");
|
||||
@@ -1559,6 +1565,9 @@ static FIO_CONFIGURE_SPAN_SIGNALING_FUNCTION(ftdm_r2_configure_span_signaling)
|
||||
} else if (!strcasecmp(var, "max_dnis")) {
|
||||
r2conf.max_dnis = atoi(val);
|
||||
ftdm_log(FTDM_LOG_DEBUG, "Configuring R2 span %s with max dnis = %d\n", span->name, r2conf.max_dnis);
|
||||
} else if (!strcasecmp(var, "use_channel_native_mf_generation")) {
|
||||
r2conf.use_channel_native_mf_generation = ftdm_true(val);
|
||||
ftdm_log(FTDM_LOG_DEBUG, "Configuring R2 span %s with \"use native channel MF generation\" = %d\n", span->name, r2conf.use_channel_native_mf_generation);
|
||||
} else {
|
||||
snprintf(span->last_error, sizeof(span->last_error), "Unknown R2 parameter [%s]", var);
|
||||
return FTDM_FAIL;
|
||||
@@ -1610,6 +1619,10 @@ static FIO_CONFIGURE_SPAN_SIGNALING_FUNCTION(ftdm_r2_configure_span_signaling)
|
||||
openr2_context_configure_from_advanced_file(r2data->r2context, r2conf.advanced_protocol_file);
|
||||
}
|
||||
|
||||
if(r2conf.use_channel_native_mf_generation) {
|
||||
openr2_context_set_mflib_interface(r2data->r2context, ftdm_r2_get_native_channel_mf_generation_iface());
|
||||
}
|
||||
|
||||
spanpvt->r2calls = create_hashtable(FTDM_MAX_CHANNELS_SPAN, ftdm_hash_hashfromstring, ftdm_hash_equalkeys);
|
||||
if (!spanpvt->r2calls) {
|
||||
snprintf(span->last_error, sizeof(span->last_error), "Cannot create channel calls hash for span.");
|
||||
@@ -1627,13 +1640,29 @@ static FIO_CONFIGURE_SPAN_SIGNALING_FUNCTION(ftdm_r2_configure_span_signaling)
|
||||
openr2_chan_enable_call_files(r2chan);
|
||||
}
|
||||
|
||||
r2call = ftdm_malloc(sizeof(*r2call));
|
||||
if (r2conf.use_channel_native_mf_generation) {
|
||||
/* Allocate a new write handle per r2chan */
|
||||
ftdm_r2_mf_write_handle_t *mf_write_handle = ftdm_calloc(1, sizeof(*mf_write_handle));
|
||||
/* Associate to the FreeTDM channel */
|
||||
mf_write_handle->ftdmchan = span->channels[i];
|
||||
/* Make sure the FreeTDM channel supports MF the generation feature */
|
||||
if (!ftdm_channel_test_feature(mf_write_handle->ftdmchan, FTDM_CHANNEL_FEATURE_MF_GENERATE)) {
|
||||
ftdm_log_chan_msg(mf_write_handle->ftdmchan, FTDM_LOG_ERROR,
|
||||
"FreeTDM channel does not support native MF generation: "
|
||||
"\"use_channel_native_mf_generation\" configuration parameter cannot"
|
||||
" be used\n");
|
||||
goto fail;
|
||||
}
|
||||
/* Associate the mf_write_handle to the openR2 channel */
|
||||
openr2_chan_set_mflib_handles(r2chan, mf_write_handle, NULL);
|
||||
}
|
||||
|
||||
r2call = ftdm_calloc(1, sizeof(*r2call));
|
||||
if (!r2call) {
|
||||
snprintf(span->last_error, sizeof(span->last_error), "Cannot create all R2 call data structures for the span.");
|
||||
ftdm_safe_free(r2chan);
|
||||
goto fail;
|
||||
}
|
||||
memset(r2call, 0, sizeof(*r2call));
|
||||
openr2_chan_set_logging_func(r2chan, ftdm_r2_on_chan_log);
|
||||
openr2_chan_set_client_data(r2chan, span->channels[i]);
|
||||
r2call->r2chan = r2chan;
|
||||
@@ -1644,6 +1673,7 @@ static FIO_CONFIGURE_SPAN_SIGNALING_FUNCTION(ftdm_r2_configure_span_signaling)
|
||||
}
|
||||
r2data->mf_dump_size = r2conf.mf_dump_size;
|
||||
r2data->category = r2conf.category;
|
||||
r2data->allow_collect_calls = r2conf.allow_collect_calls;
|
||||
r2data->flags = 0;
|
||||
spanpvt->r2context = r2data->r2context;
|
||||
|
||||
@@ -2363,5 +2393,5 @@ EX_DECLARE_DATA ftdm_module_t ftdm_module = {
|
||||
* c-basic-offset:4
|
||||
* End:
|
||||
* For VIM:
|
||||
* vim:set softtabstop=4 shiftwidth=4 tabstop=4
|
||||
* vim:set softtabstop=4 shiftwidth=4 tabstop=4:
|
||||
*/
|
||||
+163
@@ -0,0 +1,163 @@
|
||||
/*
|
||||
* Copyright (c) 2011 Sebastien Trottier
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* * Neither the name of the original author; nor the names of any contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
|
||||
* OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <freetdm.h>
|
||||
#include <private/ftdm_core.h>
|
||||
|
||||
#include <openr2.h>
|
||||
|
||||
#include "ftmod_r2_io_mf_lib.h"
|
||||
|
||||
/* Convert openr2 MF tone enum value to FreeTDM MF tone value
|
||||
1-15 bitwise OR FTDM_MF_DIRECTION_FORWARD/BACKWARD
|
||||
0 (stop playing)
|
||||
openr2_mf_tone_t defined in r2proto.h
|
||||
*/
|
||||
static int ftdm_r2_openr2_mf_tone_to_ftdm_mf_tone(openr2_mf_tone_t
|
||||
openr2_tone_value, int forward_signals)
|
||||
{
|
||||
int tone;
|
||||
|
||||
switch (openr2_tone_value) {
|
||||
case 0: return 0;
|
||||
#define TONE_FROM_NAME(name) case OR2_MF_TONE_##name: tone = name; break;
|
||||
TONE_FROM_NAME(1)
|
||||
TONE_FROM_NAME(2)
|
||||
TONE_FROM_NAME(3)
|
||||
TONE_FROM_NAME(4)
|
||||
TONE_FROM_NAME(5)
|
||||
TONE_FROM_NAME(6)
|
||||
TONE_FROM_NAME(7)
|
||||
TONE_FROM_NAME(8)
|
||||
TONE_FROM_NAME(9)
|
||||
TONE_FROM_NAME(10)
|
||||
TONE_FROM_NAME(11)
|
||||
TONE_FROM_NAME(12)
|
||||
TONE_FROM_NAME(13)
|
||||
TONE_FROM_NAME(14)
|
||||
TONE_FROM_NAME(15)
|
||||
#undef TONE_FROM_NAME
|
||||
default:
|
||||
ftdm_assert(0, "Invalid openr2_tone_value\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Add flag corresponding to direction */
|
||||
if (forward_signals) {
|
||||
tone |= FTDM_MF_DIRECTION_FORWARD;
|
||||
} else {
|
||||
tone |= FTDM_MF_DIRECTION_BACKWARD;
|
||||
}
|
||||
|
||||
return tone;
|
||||
}
|
||||
|
||||
/* MF generation routines (using IO command of a FreeTDM channel)
|
||||
write_init stores the direction of the MF to generate */
|
||||
static void *ftdm_r2_io_mf_write_init(ftdm_r2_mf_write_handle_t *handle, int forward_signals)
|
||||
{
|
||||
ftdm_log_chan(handle->ftdmchan, FTDM_LOG_DEBUG, "ftdm_r2_io_mf_write_init, "
|
||||
"forward = %d\n", forward_signals);
|
||||
|
||||
handle->fwd = forward_signals;
|
||||
return handle;
|
||||
}
|
||||
|
||||
static int ftdm_r2_io_mf_generate_tone(ftdm_r2_mf_write_handle_t *handle, int16_t buffer[], int samples)
|
||||
{
|
||||
/* Our mf_want_generate implementation always return 0, so mf_generate_tone should never be called */
|
||||
ftdm_assert(0, "ftdm_r2_io_mf_generate_tone not implemented\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* \brief mf_select_tone starts tone generation or stops current tone
|
||||
* \return 0 on success, -1 on error
|
||||
*/
|
||||
static int ftdm_r2_io_mf_select_tone(ftdm_r2_mf_write_handle_t *handle, char signal)
|
||||
{
|
||||
int tone; /* (0, 1-15) (0 meaning to stop playing) */
|
||||
|
||||
ftdm_log_chan(handle->ftdmchan, FTDM_LOG_DEBUG, "ftdm_r2_io_mf_select_tone, "
|
||||
"signal = %c\n", signal);
|
||||
|
||||
if (-1 == (tone = ftdm_r2_openr2_mf_tone_to_ftdm_mf_tone(signal, handle->fwd))) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Start/stop playback directly here, as select tone is called each time a tone
|
||||
is started or stopped (called if tone changes, but silence is tone 0,
|
||||
triggering a tone change) */
|
||||
if (tone > 0) {
|
||||
ftdm_channel_command(handle->ftdmchan, FTDM_COMMAND_START_MF_PLAYBACK, &tone);
|
||||
} else {
|
||||
/* tone 0 means to stop current tone */
|
||||
ftdm_channel_command(handle->ftdmchan, FTDM_COMMAND_STOP_MF_PLAYBACK, NULL);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int ftdm_r2_io_mf_want_generate(ftdm_r2_mf_write_handle_t *handle, int signal)
|
||||
{
|
||||
/* Return 0, meaning mf_generate_tone doesn't need to be called */
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* MF lib interface that generate MF tones via FreeTDM channel IO commands
|
||||
MF detection using the default openr2 provider (r2engine) */
|
||||
static openr2_mflib_interface_t g_mf_ftdm_io_iface = {
|
||||
/* .mf_read_init */ (openr2_mf_read_init_func)openr2_mf_rx_init,
|
||||
/* .mf_write_init */ (openr2_mf_write_init_func)ftdm_r2_io_mf_write_init,
|
||||
/* .mf_detect_tone */ (openr2_mf_detect_tone_func)openr2_mf_rx,
|
||||
/* .mf_generate_tone */ (openr2_mf_generate_tone_func)ftdm_r2_io_mf_generate_tone,
|
||||
/* .mf_select_tone */ (openr2_mf_select_tone_func)ftdm_r2_io_mf_select_tone,
|
||||
/* .mf_want_generate */ (openr2_mf_want_generate_func)ftdm_r2_io_mf_want_generate,
|
||||
/* .mf_read_dispose */ NULL,
|
||||
/* .mf_write_dispose */ NULL
|
||||
};
|
||||
|
||||
openr2_mflib_interface_t *ftdm_r2_get_native_channel_mf_generation_iface()
|
||||
{
|
||||
return &g_mf_ftdm_io_iface;
|
||||
}
|
||||
|
||||
/* For Emacs:
|
||||
* Local Variables:
|
||||
* mode:c
|
||||
* indent-tabs-mode:t
|
||||
* tab-width:4
|
||||
* c-basic-offset:4
|
||||
* End:
|
||||
* For VIM:
|
||||
* vim:set softtabstop=4 shiftwidth=4 tabstop=4
|
||||
*/
|
||||
Regular → Executable
+26
-28
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2007, Anthony Minessale II
|
||||
* Copyright (c) 2011 Sebastien Trottier
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -29,39 +29,38 @@
|
||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef FTDM_SANGOMA_BOOST_H
|
||||
#define FTDM_SANGOMA_BOOST_H
|
||||
#include "sangoma_boost_client.h"
|
||||
#include "freetdm.h"
|
||||
#ifndef _FTMOD_R2_IO_MFLIB_H_
|
||||
#define _FTMOD_R2_IO_MFLIB_H_
|
||||
|
||||
#define MAX_CHANS_PER_TRUNKGROUP 1024
|
||||
#include <ftdm_declare.h>
|
||||
|
||||
typedef enum {
|
||||
FTDM_SANGOMA_BOOST_RUNNING = (1 << 0),
|
||||
FTDM_SANGOMA_BOOST_RESTARTING = (1 << 1),
|
||||
FTDM_SANGOMA_BOOST_EVENTS_RUNNING = (1 << 2),
|
||||
} ftdm_sangoma_boost_flag_t;
|
||||
#include <openr2.h>
|
||||
|
||||
typedef struct ftdm_sangoma_boost_data {
|
||||
sangomabc_connection_t mcon;
|
||||
sangomabc_connection_t pcon;
|
||||
int iteration;
|
||||
uint32_t flags;
|
||||
boost_sigmod_interface_t *sigmod;
|
||||
ftdm_queue_t *boost_queue;
|
||||
} ftdm_sangoma_boost_data_t;
|
||||
|
||||
typedef struct ftdm_sangoma_boost_trunkgroup {
|
||||
ftdm_mutex_t *mutex;
|
||||
ftdm_size_t size; /* Number of b-channels in group */
|
||||
unsigned int last_used_index; /* index of last b-channel used */
|
||||
ftdm_channel_t* ftdmchans[MAX_CHANS_PER_TRUNKGROUP];
|
||||
//TODO need to merge congestion timeouts to this struct
|
||||
} ftdm_sangoma_boost_trunkgroup_t;
|
||||
#if defined(__cplusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* MFC/R2 tone generator handle (mf_write_handle) */
|
||||
typedef struct {
|
||||
/*! FTDM channel performing the MF generation */
|
||||
ftdm_channel_t *ftdmchan;
|
||||
/*! 1 if generating forward tones, otherwise generating reverse tones. */
|
||||
int fwd;
|
||||
} ftdm_r2_mf_write_handle_t;
|
||||
|
||||
/* MF lib interface that generate MF tones via FreeTDM channel IO commands
|
||||
MF detection using the default openr2 provider (r2engine) */
|
||||
openr2_mflib_interface_t *ftdm_r2_get_native_channel_mf_generation_iface(void);
|
||||
|
||||
#if defined(__cplusplus)
|
||||
} /* endif extern "C" */
|
||||
#endif
|
||||
|
||||
#endif /* endif defined _FTMOD_R2_IO_MFLIB_H_ */
|
||||
|
||||
/* For Emacs:
|
||||
* Local Variables:
|
||||
* mode:c
|
||||
@@ -72,4 +71,3 @@ typedef struct ftdm_sangoma_boost_trunkgroup {
|
||||
* For VIM:
|
||||
* vim:set softtabstop=4 shiftwidth=4 tabstop=4:
|
||||
*/
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
== Boost sigmod current limitations ==
|
||||
- we don't support having openzap spans with physical channels
|
||||
belonging to other physical spans. this is due to netborder sangoma abstraction, therefore
|
||||
any openzap span using sigboost must have only channels belonging to the corresponding
|
||||
physical span.
|
||||
|
||||
This is the reason we added group functionality in openzap core, furthermore, previous groups in openzap
|
||||
were only possible through adding of b-channels to a single span, but this forces the user to create groups
|
||||
of channels only whithin the same type of trunk among other things.
|
||||
|
||||
- all spans must be configured and then started, cannot configure, start, configure start etc
|
||||
this is due to netborder telesoft abstraction. that requires configuring everything and
|
||||
then starting everything at once.
|
||||
|
||||
- sangoma_prid and sangoma_brid on Windows had to be compiled hacking make/Makefile.platform to comment all VC runtime checks,
|
||||
otherwise when running in debug mode exceptions are thrown due to loss of data ie short to char conversions.
|
||||
|
||||
== TODO ==
|
||||
- proper upper layer management of HW alarms (this must be done in mod_openzap.c)
|
||||
|
||||
@@ -1,146 +0,0 @@
|
||||
== General Design ==
|
||||
|
||||
NBE will do its current loading of spans and configuration process through Sangoma Board Manager (SBM).
|
||||
After doing SangomaBoardManager::getInstance().configure -> start. It will proceed to initalize
|
||||
the openzap stack (just as the TelesoftStack is loaded after starting SMB. The procedure will be:
|
||||
|
||||
- create a static or malloced zap_io_interface_t
|
||||
- call zap_global_set_logger with the logging hooks.
|
||||
- call zap_global_set_memhandler() with the memory hooks.
|
||||
- call zap_global_init() to initialize the stack
|
||||
- call zap_add_io_iface() to add the I/O iface.
|
||||
- iterate over all SBM spans configured for BRI or any boost-managed signaling and:
|
||||
* call zap_span_create(NBE I/O mod, in_ptrSpan, SMB span name)
|
||||
* Fill in some members like:
|
||||
span->trunk_type = E1/T1/J1/FXO/FXS etc ...
|
||||
* iterate over all channels in SMB span and:
|
||||
* zap_span_add_channel(zap_span, sock, type:CAS|BCHAN|DCHAN|ETC)
|
||||
* call zap_configure_span("sangoma_boost", span, sigmsg_callback, "param1", value1, "param2", value1 ...)
|
||||
* zap_span_start(span);
|
||||
|
||||
|
||||
At this point, NBE would receive signaling msgs via sigmsg_callback registered when configuring
|
||||
and NBE would request hangup or making calls throug openzap API, like zap_set_state_* and zap_channel_outgoing_call() to place calls.
|
||||
|
||||
When NBE wants to check for link status.
|
||||
|
||||
zap_get_siglink_state() which would return
|
||||
ZAP_SIG_STATE_UP (D-chan UP, R2 bits in IDLE, ss7?)
|
||||
ZAP_SIG_STATE_SUSPENDED (D-chan in power saving mode?)
|
||||
ZAP_SIG_STATE_DOWN (D-chan down, R2 bits in blocked, ss7?)
|
||||
|
||||
Whenever a state in sig link changes, the sigmsg_callback will be used to notify NBE or any other user.
|
||||
|
||||
NOTE: right now hardware alarms notification in openzap is seriously broken,
|
||||
see ozmod_libpri.c process_event ... reads an event from hardware (zap_event_t *),
|
||||
then checks the event type, if its ZAP_OOB_ALARM_TRAP prepares a zap_sigmsg_t
|
||||
(signaling event) setting its event_id to ZAP_OOB_ALARM_TRAP, which is *WRONG*
|
||||
because event_id is of type zap_signal_event_t and not zap_oob_event_t!
|
||||
this means on alarm the user will get ZAP_SIGEVENT_PROGRESS_MEDIA!! which is
|
||||
value 7 that is in conflict with ZAP_OOB_ALARM_TRAP, I think a separate
|
||||
callback should be used if the outside user wants to be notified about
|
||||
hardware events like HW DTMF or so. Currently there is alreadya generic DTMF
|
||||
listener.
|
||||
|
||||
== Tasks Stage 1 / OpenZAP and Boost changes (To be tested with FreeSWITCH) ==
|
||||
|
||||
- Change malloc and other mem functions in openzap
|
||||
to use internal hooks provided via zap_global_set_memhandler()
|
||||
which would be called before zap_global_init(), this is
|
||||
already done for the logger via zap_global_set_logger()
|
||||
|
||||
question: should the mem routines allow for memory pool ptr?
|
||||
this could be useful to provide a memory pool to
|
||||
the whole module.
|
||||
|
||||
question: should we allow hooks for threads and locking?
|
||||
I think we can skip this one unless needed. They already
|
||||
use their own threading abstraction which is working for
|
||||
Linux and Windows. If we ever need to profile threading
|
||||
we can add profiling hooks.
|
||||
|
||||
question: I had to add openzap calls to the hash table and libteletone implementations, is that acceptable?
|
||||
|
||||
- Modify zap_global_init() API
|
||||
|
||||
This API must just initialize vars, mutexes etc.
|
||||
and NOT DO ANY CONFIGURATION LOADING, PARSING, SPAN CREATION and I/O
|
||||
configuration, which is what is currently doing.
|
||||
We don't want zap_global_init() to create the spans based on that configuration
|
||||
since NBE will have its own configuration and will take care of creating
|
||||
the needed data structures on its own.
|
||||
|
||||
- Add new zap_std_io_config() API
|
||||
|
||||
This API will parse the standard openzap.conf module and create the spans.
|
||||
This will be used by FS but not by NBE, which will create the openzap spans by itself.
|
||||
The NBE flow to initialize openzap will be:
|
||||
|
||||
- Add new API zap_global_add_io_iface(),
|
||||
|
||||
This API will add a new I/O interface structure to the internal openzap hash of I/O structs.
|
||||
This is needed because NBE I/O structure will NOT be loaded from an openzap module (.so/.dll)
|
||||
but rather just registered on runtime (probably from a static structure in NBE code).
|
||||
This openzap hash is used by zap_api_execute() for example, to find the module that can
|
||||
handle a given API, ie (oz libpri status). This is an example of how an openzap I/O interface
|
||||
can decide to implement just the ->api() member to handle commands and NOTHING else,
|
||||
so I/O interfaces not necessary are hardware-related.
|
||||
|
||||
- Add new zap_channel_get_siglink_state(zap_channel, zap_siglink_status_t &status)
|
||||
|
||||
- Modify mod_openzap.c to read proto= setting in boost spans, this will determine wich boost sig
|
||||
module will handle the configuration and those channels.
|
||||
|
||||
<boost_spans> <span sigmod="bri|ss7|blah"> <param="proto-specific-setting" value="setting"> </span> </boost_spans>
|
||||
|
||||
Then as first config arg to zap_config_span() the boost proto module name would be included as "sigmod" which will be used
|
||||
by ozmod_sangoma_boost to decide which sig module must handle that span configuration
|
||||
|
||||
- Create minimal boost mod interface.
|
||||
|
||||
ozmod_boost_ss7 should load sig boost mods and get interface via dlsym(boost_get_interface) boost_get_interface(boost_iface);
|
||||
The boost interface will have
|
||||
* const char *name // boost sigmod name (brid,ss7d)
|
||||
* set_write_boost_msg_cb(callback) // tell the stack how to send us boost messages
|
||||
* set_sig_status_cb(callback); // tell the stack how to notify us about link status changes
|
||||
* write_boost_msg(struct boost_msg) // send a boost msg to the stack
|
||||
* configure_span(zap_span_t span, "configuration", value, "configuration", value) // configure a given span
|
||||
* get_sig_status(openzap_sigstatus_t status)
|
||||
* start(span) // to start a given openzap span
|
||||
* stop(span) // to stop the stack on a given openzap span
|
||||
|
||||
- Migrate current sangoma_brid sig module to openzap
|
||||
* Make sangoma_brid a library
|
||||
* Move from using malloc, threading, locking, logging and I/O to openzap functions. Export the boost sigmod interface and its supporting code.
|
||||
|
||||
== State 2 Tasks ==
|
||||
|
||||
- Create the I/O NBE interface and supporting functions. It must be possible to poll over the span
|
||||
given that ozmod_sangoma_boost BRI module and others may need to *wait* for data. The poll()
|
||||
function in I/O NBE interface would wait on a pthread condition or Windows event, which would
|
||||
be triggered by some external NBE component registered with Sangoma Board Manager (SMB) for d-chan
|
||||
data, whenever d-chan data arrives, saves the data in a buffer and triggers the condition to wakeup
|
||||
any waiter, then the waiter (sangoma_brid or any other boost client) calls zap_channel_read which calls
|
||||
our own I/O NBE interface read method and retrieves the data from the buffer.
|
||||
|
||||
Dropped alternative design:
|
||||
Another option is to add a new API zap_span_push_incoming_data(span/chan, data); However this changes
|
||||
the model openzap has followed and I don't think fits that well, since now we have 2 different models
|
||||
to support in openzap.
|
||||
|
||||
== TODO ==
|
||||
|
||||
- how about logging specific modules, like, just ozmod_boost, or just the BRI stack?
|
||||
more work to be done so the BRI module uses zap_log instead of current syslog
|
||||
then work to be done to be able to filter logs from specific openzap code? is it worth it?
|
||||
|
||||
- remove FORCE_SEGFAULT from sprid
|
||||
|
||||
|
||||
=== Shortcomings ==
|
||||
|
||||
- we had to drop smg support in the branch where we work on sangoma prid.
|
||||
After all, most people using sangoma_prid is using freeswitch/openzap and not Sangoma Media Gateway
|
||||
The problem is in freeswitch/openzap mode, sangoma_boost ozmod takes care of span events (POLLPRI)
|
||||
where in SMG and Netborder POLLPRI is done typically by sangoma board manager.
|
||||
|
||||
@@ -1,373 +0,0 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="9.00"
|
||||
Name="ftmod_sangoma_boost"
|
||||
ProjectGUID="{D021EF2A-460D-4827-A0F7-41FDECF46F1B}"
|
||||
RootNamespace="ftmod_sangoma_boost"
|
||||
Keyword="Win32Proj"
|
||||
TargetFrameworkVersion="196613"
|
||||
>
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"
|
||||
/>
|
||||
<Platform
|
||||
Name="x64"
|
||||
/>
|
||||
</Platforms>
|
||||
<ToolFiles>
|
||||
</ToolFiles>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
||||
IntermediateDirectory="$(ConfigurationName)"
|
||||
ConfigurationType="2"
|
||||
CharacterSet="1"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="..\..\include;..\..\isdn\include"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;FTMOD_SANGOMA_BOOST_EXPORTS"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="3"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="4"
|
||||
WarnAsError="true"
|
||||
DebugInformationFormat="4"
|
||||
DisableSpecificWarnings="4100"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="freetdm.lib"
|
||||
LinkIncremental="2"
|
||||
AdditionalLibraryDirectories=""$(OutDir)""
|
||||
GenerateDebugInformation="true"
|
||||
SubSystem="2"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Debug|x64"
|
||||
OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
|
||||
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
|
||||
ConfigurationType="2"
|
||||
CharacterSet="1"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
TargetEnvironment="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="..\..\include;..\..\isdn\include"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;FTMOD_SANGOMA_BOOST_EXPORTS"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="3"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="4"
|
||||
WarnAsError="true"
|
||||
DebugInformationFormat="3"
|
||||
DisableSpecificWarnings="4100"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="freetdm.lib"
|
||||
LinkIncremental="2"
|
||||
AdditionalLibraryDirectories=""$(OutDir)""
|
||||
GenerateDebugInformation="true"
|
||||
SubSystem="2"
|
||||
TargetMachine="17"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
||||
IntermediateDirectory="$(ConfigurationName)"
|
||||
ConfigurationType="2"
|
||||
CharacterSet="1"
|
||||
WholeProgramOptimization="1"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="2"
|
||||
EnableIntrinsicFunctions="true"
|
||||
AdditionalIncludeDirectories="..\..\include"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;FTMOD_SANGOMA_BOOST_EXPORTS"
|
||||
RuntimeLibrary="2"
|
||||
EnableFunctionLevelLinking="true"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="4"
|
||||
WarnAsError="true"
|
||||
DebugInformationFormat="3"
|
||||
DisableSpecificWarnings="4100"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
LinkIncremental="1"
|
||||
GenerateDebugInformation="true"
|
||||
SubSystem="2"
|
||||
OptimizeReferences="2"
|
||||
EnableCOMDATFolding="2"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|x64"
|
||||
OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
|
||||
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
|
||||
ConfigurationType="2"
|
||||
CharacterSet="1"
|
||||
WholeProgramOptimization="1"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
TargetEnvironment="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="2"
|
||||
EnableIntrinsicFunctions="true"
|
||||
AdditionalIncludeDirectories="..\..\include"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;FTMOD_SANGOMA_BOOST_EXPORTS"
|
||||
RuntimeLibrary="2"
|
||||
EnableFunctionLevelLinking="true"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="4"
|
||||
WarnAsError="false"
|
||||
DebugInformationFormat="3"
|
||||
DisableSpecificWarnings="4100"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
LinkIncremental="1"
|
||||
GenerateDebugInformation="true"
|
||||
SubSystem="2"
|
||||
OptimizeReferences="2"
|
||||
EnableCOMDATFolding="2"
|
||||
TargetMachine="17"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<Filter
|
||||
Name="Source Files"
|
||||
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
|
||||
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
|
||||
>
|
||||
<File
|
||||
RelativePath="ftmod_sangoma_boost.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="sangoma_boost_client.c"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Header Files"
|
||||
Filter="h;hpp;hxx;hm;inl;inc;xsd"
|
||||
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
|
||||
>
|
||||
<File
|
||||
RelativePath="ftdm_sangoma_boost.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="sangoma_boost_client.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="sangoma_boost_interface.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="sigboost.h"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
||||
@@ -1,206 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectName>ftmod_sangoma_boost</ProjectName>
|
||||
<ProjectGuid>{D021EF2A-460D-4827-A0F7-41FDECF46F1B}</ProjectGuid>
|
||||
<RootNamespace>ftmod_sangoma_boost</RootNamespace>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup>
|
||||
<_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(Platform)\$(Configuration)\</IntDir>
|
||||
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(Platform)\$(Configuration)\</IntDir>
|
||||
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(Platform)\$(Configuration)\</IntDir>
|
||||
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</LinkIncremental>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(Platform)\$(Configuration)\</IntDir>
|
||||
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</LinkIncremental>
|
||||
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
|
||||
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
|
||||
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" />
|
||||
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" />
|
||||
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
|
||||
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
|
||||
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|x64'">AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|x64'" />
|
||||
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|x64'" />
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>..\..\include;..\..\isdn\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;FTMOD_SANGOMA_BOOST_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MinimalRebuild>true</MinimalRebuild>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level4</WarningLevel>
|
||||
<TreatWarningAsError>true</TreatWarningAsError>
|
||||
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
|
||||
<DisableSpecificWarnings>4100;%(DisableSpecificWarnings)</DisableSpecificWarnings>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalLibraryDirectories>$(OutDir);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<TargetMachine>MachineX86</TargetMachine>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<AdditionalIncludeDirectories>..\..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;FTMOD_SANGOMA_BOOST_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level4</WarningLevel>
|
||||
<TreatWarningAsError>true</TreatWarningAsError>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
<DisableSpecificWarnings>4100;%(DisableSpecificWarnings)</DisableSpecificWarnings>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<TargetMachine>MachineX86</TargetMachine>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<Midl>
|
||||
<TargetEnvironment>X64</TargetEnvironment>
|
||||
</Midl>
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>..\..\include;..\..\isdn\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;FTMOD_SANGOMA_BOOST_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MinimalRebuild>true</MinimalRebuild>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level4</WarningLevel>
|
||||
<TreatWarningAsError>true</TreatWarningAsError>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
<DisableSpecificWarnings>4100;%(DisableSpecificWarnings)</DisableSpecificWarnings>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalLibraryDirectories>$(OutDir);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<TargetMachine>MachineX64</TargetMachine>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<Midl>
|
||||
<TargetEnvironment>X64</TargetEnvironment>
|
||||
</Midl>
|
||||
<ClCompile>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<AdditionalIncludeDirectories>..\..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;FTMOD_SANGOMA_BOOST_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level4</WarningLevel>
|
||||
<TreatWarningAsError>false</TreatWarningAsError>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
<DisableSpecificWarnings>4100;%(DisableSpecificWarnings)</DisableSpecificWarnings>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<TargetMachine>MachineX64</TargetMachine>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="ftmod_sangoma_boost.c" />
|
||||
<ClCompile Include="sangoma_boost_client.c" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="ftdm_sangoma_boost.h" />
|
||||
<ClInclude Include="sangoma_boost_client.h" />
|
||||
<ClInclude Include="sangoma_boost_interface.h" />
|
||||
<ClInclude Include="sigboost.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\..\msvc\freetdm.2010.vcxproj">
|
||||
<Project>{93b8812c-3ec4-4f78-8970-ffbfc99e167d}</Project>
|
||||
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
@@ -1,35 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="Source Files">
|
||||
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
||||
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Header Files">
|
||||
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
||||
<Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="ftmod_sangoma_boost.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="sangoma_boost_client.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="ftdm_sangoma_boost.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="sangoma_boost_client.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="sangoma_boost_interface.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="sigboost.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
File diff suppressed because it is too large.
Load diff
@@ -1,589 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2007, Anthony Minessale II, Nenad Corbic
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* * Neither the name of the original author; nor the names of any contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
|
||||
* OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#define _GNU_SOURCE
|
||||
|
||||
#if HAVE_NETDB_H
|
||||
#include <netdb.h>
|
||||
#endif
|
||||
|
||||
#include "freetdm.h"
|
||||
#include "sangoma_boost_client.h"
|
||||
|
||||
#ifndef HAVE_GETHOSTBYNAME_R
|
||||
extern int gethostbyname_r (const char *__name,
|
||||
struct hostent *__result_buf,
|
||||
char *__buf, size_t __buflen,
|
||||
struct hostent **__result,
|
||||
int *__h_errnop);
|
||||
#endif
|
||||
|
||||
struct sangomabc_map {
|
||||
uint32_t event_id;
|
||||
const char *name;
|
||||
};
|
||||
|
||||
static struct sangomabc_map sangomabc_table[] = {
|
||||
{SIGBOOST_EVENT_CALL_START, "CALL_START"},
|
||||
{SIGBOOST_EVENT_CALL_START_ACK, "CALL_START_ACK"},
|
||||
{SIGBOOST_EVENT_CALL_START_NACK, "CALL_START_NACK"},
|
||||
{SIGBOOST_EVENT_CALL_PROGRESS, "CALL PROGRESS"},
|
||||
{SIGBOOST_EVENT_CALL_START_NACK_ACK, "CALL_START_NACK_ACK"},
|
||||
{SIGBOOST_EVENT_CALL_ANSWERED, "CALL_ANSWERED"},
|
||||
{SIGBOOST_EVENT_CALL_STOPPED, "CALL_STOPPED"},
|
||||
{SIGBOOST_EVENT_CALL_STOPPED_ACK, "CALL_STOPPED_ACK"},
|
||||
{SIGBOOST_EVENT_CALL_RELEASED, "CALL_RELEASED"},
|
||||
{SIGBOOST_EVENT_SYSTEM_RESTART, "SYSTEM_RESTART"},
|
||||
{SIGBOOST_EVENT_SYSTEM_RESTART_ACK, "SYSTEM_RESTART_ACK"},
|
||||
{SIGBOOST_EVENT_HEARTBEAT, "HEARTBEAT"},
|
||||
{SIGBOOST_EVENT_INSERT_CHECK_LOOP, "LOOP START"},
|
||||
{SIGBOOST_EVENT_REMOVE_CHECK_LOOP, "LOOP STOP"},
|
||||
{SIGBOOST_EVENT_AUTO_CALL_GAP_ABATE, "AUTO_CALL_GAP_ABATE"},
|
||||
{SIGBOOST_EVENT_DIGIT_IN, "DIGIT_IN"}
|
||||
};
|
||||
|
||||
|
||||
|
||||
static void sangomabc_print_event_call(sangomabc_connection_t *mcon, sangomabc_event_t *event, int priority, int dir, const char *file, const char *func, int line)
|
||||
{
|
||||
if (event->event_id == SIGBOOST_EVENT_HEARTBEAT)
|
||||
return;
|
||||
|
||||
ftdm_log(file, func, line, mcon->debuglevel, "%s EVENT (%s): %s:(%X) [w%dg%d] CSid=%i Seq=%i Cn=[%s] Cd=[%s] Ci=[%s] Rdnis=[%s]\n",
|
||||
dir ? "TX":"RX",
|
||||
priority ? "P":"N",
|
||||
sangomabc_event_id_name(event->event_id),
|
||||
event->event_id,
|
||||
BOOST_EVENT_SPAN(mcon->sigmod, event),
|
||||
BOOST_EVENT_CHAN(mcon->sigmod, event),
|
||||
event->call_setup_id,
|
||||
event->fseqno,
|
||||
strlen(event->calling_name)?event->calling_name:"N/A",
|
||||
(event->called_number_digits_count ? (char *) event->called_number_digits : "N/A"),
|
||||
(event->calling_number_digits_count ? (char *) event->calling_number_digits : "N/A"),
|
||||
event->isup_in_rdnis);
|
||||
|
||||
}
|
||||
static void sangomabc_print_event_short(sangomabc_connection_t *mcon, sangomabc_short_event_t *event, int priority, int dir, const char *file, const char *func, int line)
|
||||
{
|
||||
if (event->event_id == SIGBOOST_EVENT_HEARTBEAT)
|
||||
return;
|
||||
ftdm_log(file, func, line, mcon->debuglevel, "%s EVENT (%s): %s:(%X) [s%dc%d] Rc=%i CSid=%i Seq=%i \n",
|
||||
dir ? "TX":"RX",
|
||||
priority ? "P":"N",
|
||||
sangomabc_event_id_name(event->event_id),
|
||||
event->event_id,
|
||||
BOOST_EVENT_SPAN(mcon->sigmod, event),
|
||||
BOOST_EVENT_CHAN(mcon->sigmod, event),
|
||||
event->release_cause,
|
||||
event->call_setup_id,
|
||||
event->fseqno);
|
||||
}
|
||||
|
||||
|
||||
static int create_conn_socket(sangomabc_connection_t *mcon, char *local_ip, int local_port, char *ip, int port)
|
||||
{
|
||||
#ifndef WIN32
|
||||
int rc;
|
||||
struct hostent *result, *local_result;
|
||||
char buf[512], local_buf[512];
|
||||
int err = 0, local_err = 0;
|
||||
|
||||
if (mcon->sigmod) {
|
||||
ftdm_log(FTDM_LOG_WARNING, "I should not be called on a sigmod-managed connection!\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
memset(&mcon->remote_hp, 0, sizeof(mcon->remote_hp));
|
||||
memset(&mcon->local_hp, 0, sizeof(mcon->local_hp));
|
||||
#ifdef HAVE_NETINET_SCTP_H
|
||||
ftdm_log(FTDM_LOG_DEBUG, "Creating SCTP socket L=%s:%d R=%s:%d\n",
|
||||
local_ip, local_port, ip, port);
|
||||
mcon->socket = socket(AF_INET, SOCK_SEQPACKET, IPPROTO_SCTP);
|
||||
#else
|
||||
ftdm_log(FTDM_LOG_DEBUG, "Creating UDP socket L=%s:%d R=%s:%d\n",
|
||||
local_ip, local_port, ip, port);
|
||||
mcon->socket = socket(AF_INET, SOCK_DGRAM, 0);
|
||||
#endif
|
||||
|
||||
if (mcon->socket >= 0) {
|
||||
int flag;
|
||||
|
||||
flag = 1;
|
||||
#ifdef HAVE_GETHOSTBYNAME_R_FIVE
|
||||
gethostbyname_r(ip, &mcon->remote_hp, buf, sizeof(buf), &err);
|
||||
gethostbyname_r(local_ip, &mcon->local_hp, local_buf, sizeof(local_buf), &local_err);
|
||||
if (!err && !local_err) {
|
||||
#else
|
||||
gethostbyname_r(ip, &mcon->remote_hp, buf, sizeof(buf), &result, &err);
|
||||
gethostbyname_r(local_ip, &mcon->local_hp, local_buf, sizeof(local_buf), &local_result, &local_err);
|
||||
if (result && local_result) {
|
||||
#endif
|
||||
mcon->remote_addr.sin_family = mcon->remote_hp.h_addrtype;
|
||||
memcpy((char *) &mcon->remote_addr.sin_addr.s_addr, mcon->remote_hp.h_addr_list[0], mcon->remote_hp.h_length);
|
||||
mcon->remote_addr.sin_port = htons(port);
|
||||
|
||||
mcon->local_addr.sin_family = mcon->local_hp.h_addrtype;
|
||||
memcpy((char *) &mcon->local_addr.sin_addr.s_addr, mcon->local_hp.h_addr_list[0], mcon->local_hp.h_length);
|
||||
mcon->local_addr.sin_port = htons(local_port);
|
||||
|
||||
#ifdef HAVE_NETINET_SCTP_H
|
||||
setsockopt(mcon->socket, IPPROTO_SCTP, SCTP_NODELAY,
|
||||
(char *)&flag, sizeof(int));
|
||||
#endif
|
||||
|
||||
if ((rc = bind(mcon->socket,
|
||||
(struct sockaddr *) &mcon->local_addr,
|
||||
sizeof(mcon->local_addr))) < 0) {
|
||||
close(mcon->socket);
|
||||
mcon->socket = -1;
|
||||
} else {
|
||||
#ifdef HAVE_NETINET_SCTP_H
|
||||
rc=listen(mcon->socket, 100);
|
||||
if (rc) {
|
||||
close(mcon->socket);
|
||||
mcon->socket = -1;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return mcon->socket;
|
||||
#else
|
||||
return 0;
|
||||
#endif // ifndef WIN32
|
||||
}
|
||||
|
||||
int sangomabc_connection_close(sangomabc_connection_t *mcon)
|
||||
{
|
||||
#ifndef WIN32
|
||||
if (mcon->sigmod) {
|
||||
ftdm_log(FTDM_LOG_WARNING, "I should not be called on a sigmod-managed connection!\n");
|
||||
return 0;
|
||||
}
|
||||
if (mcon->socket > -1) {
|
||||
close(mcon->socket);
|
||||
}
|
||||
|
||||
if (mcon->mutex) {
|
||||
ftdm_mutex_lock(mcon->mutex);
|
||||
ftdm_mutex_unlock(mcon->mutex);
|
||||
ftdm_mutex_destroy(&mcon->mutex);
|
||||
}
|
||||
memset(mcon, 0, sizeof(*mcon));
|
||||
mcon->socket = -1;
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
int sangomabc_connection_open(sangomabc_connection_t *mcon, char *local_ip, int local_port, char *ip, int port)
|
||||
{
|
||||
ftdm_mutex_create(&mcon->mutex);
|
||||
if (mcon->sigmod) {
|
||||
/*value of mcon->socket will be ignored in sigmod mode */
|
||||
return 0;
|
||||
}
|
||||
#ifndef WIN32
|
||||
create_conn_socket(mcon, local_ip, local_port, ip, port);
|
||||
return mcon->socket;
|
||||
#else
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
int sangomabc_exec_command(sangomabc_connection_t *mcon, int span, int chan, int id, int cmd, int cause, int flags)
|
||||
{
|
||||
sangomabc_event_t *oevent;
|
||||
sangomabc_short_event_t sevent;
|
||||
sangomabc_event_t fevent;
|
||||
int retry = 5;
|
||||
|
||||
if (boost_full_event(cmd)) {
|
||||
sangomabc_event_init((void *)&fevent, cmd, chan, span);
|
||||
oevent = &fevent;
|
||||
} else {
|
||||
sangomabc_event_init(&sevent, cmd, chan, span);
|
||||
sevent.release_cause = (uint8_t)cause;
|
||||
oevent = (sangomabc_event_t *)&sevent;
|
||||
}
|
||||
oevent->flags = flags;
|
||||
|
||||
if (cmd == SIGBOOST_EVENT_SYSTEM_RESTART || cmd == SIGBOOST_EVENT_SYSTEM_RESTART_ACK) {
|
||||
mcon->rxseq_reset = 1;
|
||||
mcon->txseq = 0;
|
||||
mcon->rxseq = 0;
|
||||
mcon->txwindow = 0;
|
||||
}
|
||||
|
||||
if (id >= 0) {
|
||||
oevent->call_setup_id = (uint16_t)id;
|
||||
}
|
||||
|
||||
while (sangomabc_connection_write(mcon, (sangomabc_event_t*)oevent) <= 0) {
|
||||
if (--retry <= 0) {
|
||||
ftdm_log(FTDM_LOG_CRIT, "Failed to tx on boost socket: %s\n", strerror(errno));
|
||||
return -1;
|
||||
} else {
|
||||
ftdm_log(FTDM_LOG_WARNING, "Failed to tx on boost socket: %s :retry %i\n", strerror(errno), retry);
|
||||
ftdm_sleep(1);
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int sangomabc_exec_commandp(sangomabc_connection_t *pcon, int span, int chan, int id, int cmd, int cause)
|
||||
{
|
||||
sangomabc_short_event_t oevent;
|
||||
int retry = 5;
|
||||
|
||||
sangomabc_event_init(&oevent, cmd, chan, span);
|
||||
oevent.release_cause = (uint8_t)cause;
|
||||
|
||||
if (id >= 0) {
|
||||
oevent.call_setup_id = (uint16_t)id;
|
||||
}
|
||||
|
||||
while (sangomabc_connection_writep(pcon, (sangomabc_event_t*)&oevent) <= 0) {
|
||||
if (--retry <= 0) {
|
||||
ftdm_log(FTDM_LOG_CRIT, "Failed to tx on boost socket: %s\n", strerror(errno));
|
||||
return -1;
|
||||
} else {
|
||||
ftdm_log(FTDM_LOG_WARNING, "Failed to tx on boost socket: %s :retry %i\n", strerror(errno), retry);
|
||||
ftdm_sleep(1);
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
sangomabc_event_t *__sangomabc_connection_read(sangomabc_connection_t *mcon, int iteration, const char *file, const char *func, int line)
|
||||
{
|
||||
#ifndef WIN32
|
||||
unsigned int fromlen = sizeof(struct sockaddr_in);
|
||||
#endif
|
||||
int bytes = 0;
|
||||
int msg_ok = 0;
|
||||
sangomabc_queue_element_t *e = NULL;
|
||||
|
||||
if (mcon->sigmod) {
|
||||
e = ftdm_queue_dequeue(mcon->boost_queue);
|
||||
if (e) {
|
||||
bytes = (int)e->size;
|
||||
memcpy(&mcon->event, e->boostmsg, bytes);
|
||||
ftdm_safe_free(e);
|
||||
}
|
||||
}
|
||||
#ifndef WIN32
|
||||
else {
|
||||
bytes = recvfrom(mcon->socket, &mcon->event, sizeof(mcon->event), MSG_DONTWAIT,
|
||||
(struct sockaddr *) &mcon->local_addr, &fromlen);
|
||||
}
|
||||
#endif
|
||||
if (bytes <= 0) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (mcon->event.version != SIGBOOST_VERSION) {
|
||||
ftdm_log(FTDM_LOG_CRIT, "Invalid Boost Version %i Expecting %i\n",mcon->event.version, SIGBOOST_VERSION);
|
||||
}
|
||||
|
||||
if ((bytes >= MIN_SIZE_CALLSTART_MSG) && boost_full_event(mcon->event.event_id)) {
|
||||
msg_ok=1;
|
||||
|
||||
} else if (bytes == sizeof(sangomabc_short_event_t)) {
|
||||
msg_ok=1;
|
||||
|
||||
} else {
|
||||
msg_ok=0;
|
||||
}
|
||||
|
||||
if (msg_ok) {
|
||||
if (sangomabc_test_flag(mcon, MSU_FLAG_DOWN)) {
|
||||
if (mcon->event.event_id != SIGBOOST_EVENT_SYSTEM_RESTART &&
|
||||
mcon->event.event_id != SIGBOOST_EVENT_SYSTEM_RESTART_ACK &&
|
||||
mcon->event.event_id != SIGBOOST_EVENT_HEARTBEAT) {
|
||||
ftdm_log(file, func, line, FTDM_LOG_LEVEL_WARNING, "Not reading packets when connection is down. [%s]\n",
|
||||
sangomabc_event_id_name(mcon->event.event_id));
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
if (boost_full_event(mcon->event.event_id)) {
|
||||
sangomabc_print_event_call(mcon, &mcon->event, 0, 0, file, func, line);
|
||||
} else {
|
||||
sangomabc_print_event_short(mcon, (sangomabc_short_event_t*)&mcon->event, 0, 0, file, func, line);
|
||||
}
|
||||
|
||||
#if 0
|
||||
/* NC: NOT USED ANY MORE */
|
||||
if (mcon->rxseq_reset) {
|
||||
//if (mcon->event.event_id == SIGBOOST_EVENT_SYSTEM_RESTART_ACK) {
|
||||
ftdm_log(FTDM_LOG_DEBUG, "Rx sync ok\n");
|
||||
mcon->rxseq = mcon->event.fseqno;
|
||||
return &mcon->event;
|
||||
//}
|
||||
errno=EAGAIN;
|
||||
ftdm_log(FTDM_LOG_DEBUG, "Waiting for rx sync...\n");
|
||||
return NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
mcon->txwindow = mcon->txseq - mcon->event.bseqno;
|
||||
mcon->rxseq++;
|
||||
|
||||
#if 0
|
||||
if (mcon->rxseq != mcon->event.fseqno) {
|
||||
ftdm_log(FTDM_LOG_CRIT, "Invalid Sequence Number Expect=%i Rx=%i\n", mcon->rxseq, mcon->event.fseqno);
|
||||
return NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
return &mcon->event;
|
||||
} else {
|
||||
if (iteration == 0) {
|
||||
ftdm_log(FTDM_LOG_CRIT, "NC - Invalid Event length from boost rxlen=%i evsz=%i\n", bytes, sizeof(mcon->event));
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
sangomabc_event_t *__sangomabc_connection_readp(sangomabc_connection_t *mcon, int iteration, const char *file, const char *func, int line)
|
||||
{
|
||||
#ifndef WIN32
|
||||
unsigned int fromlen = sizeof(struct sockaddr_in);
|
||||
#endif
|
||||
int bytes = 0;
|
||||
|
||||
if (mcon->sigmod) {
|
||||
/* priority stuff is handled just the same when there is a sigmod */
|
||||
return sangomabc_connection_read(mcon, iteration);
|
||||
}
|
||||
#ifndef WIN32
|
||||
else {
|
||||
bytes = recvfrom(mcon->socket, &mcon->event, sizeof(mcon->event), MSG_DONTWAIT, (struct sockaddr *) &mcon->local_addr, &fromlen);
|
||||
}
|
||||
#endif
|
||||
if (bytes <= 0) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (mcon->event.version != SIGBOOST_VERSION) {
|
||||
ftdm_log(FTDM_LOG_CRIT, "Invalid Boost Version %i Expecting %i\n",mcon->event.version, SIGBOOST_VERSION);
|
||||
}
|
||||
|
||||
if (bytes == sizeof(sangomabc_short_event_t)) {
|
||||
|
||||
if (boost_full_event(mcon->event.event_id)) {
|
||||
sangomabc_print_event_call(mcon, &mcon->event, 1, 0, file, func, line);
|
||||
} else {
|
||||
sangomabc_print_event_short(mcon, (sangomabc_short_event_t*)&mcon->event, 1, 0, file, func, line);
|
||||
}
|
||||
|
||||
return &mcon->event;
|
||||
} else {
|
||||
if (iteration == 0) {
|
||||
ftdm_log(FTDM_LOG_CRIT, "Critical Error: PQ Invalid Event lenght from boost rxlen=%i evsz=%i\n", bytes, sizeof(mcon->event));
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
int __sangomabc_connection_write(sangomabc_connection_t *mcon, sangomabc_event_t *event, const char *file, const char *func, int line)
|
||||
{
|
||||
int err = 0;
|
||||
int event_size=MIN_SIZE_CALLSTART_MSG+event->isup_in_rdnis_size;
|
||||
|
||||
ftdm_assert_return(event != NULL, -1, "No event!");
|
||||
ftdm_assert_return(mcon->socket >= 0, -1, "No mcon->socket!");
|
||||
ftdm_assert_return(mcon->mutex != NULL, -1, "No mcon->mutex!");
|
||||
|
||||
ftdm_assert_return(event->span <= FTDM_MAX_PHYSICAL_SPANS_PER_LOGICAL_SPAN, -1, "Invalid span when writing boost event\n");
|
||||
ftdm_assert_return(event->chan <= FTDM_MAX_CHANNELS_PHYSICAL_SPAN, -1, "Invalid chan when writing boost event\n");
|
||||
|
||||
if (!boost_full_event(event->event_id)) {
|
||||
event_size=sizeof(sangomabc_short_event_t);
|
||||
}
|
||||
|
||||
if (sangomabc_test_flag(mcon, MSU_FLAG_DOWN)) {
|
||||
if (event->event_id != SIGBOOST_EVENT_SYSTEM_RESTART &&
|
||||
event->event_id != SIGBOOST_EVENT_SYSTEM_RESTART_ACK &&
|
||||
event->event_id != SIGBOOST_EVENT_HEARTBEAT) {
|
||||
ftdm_log(file, func, line, FTDM_LOG_LEVEL_WARNING, "Not writing packets when connection is down. [%s]\n",
|
||||
sangomabc_event_id_name(event->event_id));
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
ftdm_mutex_lock(mcon->mutex);
|
||||
if (event->event_id == SIGBOOST_EVENT_SYSTEM_RESTART_ACK) {
|
||||
mcon->txseq=0;
|
||||
mcon->rxseq=0;
|
||||
event->fseqno=0;
|
||||
} else {
|
||||
event->fseqno = mcon->txseq++;
|
||||
}
|
||||
event->bseqno = mcon->rxseq;
|
||||
event->version = SIGBOOST_VERSION;
|
||||
|
||||
if (boost_full_event(event->event_id)) {
|
||||
sangomabc_print_event_call(mcon, event, 0, 1, file, func, line);
|
||||
} else {
|
||||
sangomabc_print_event_short(mcon, (sangomabc_short_event_t*)event, 0, 1, file, func, line);
|
||||
}
|
||||
|
||||
if (mcon->sigmod) {
|
||||
mcon->sigmod->write_msg(mcon->span, event, event_size);
|
||||
err = event_size;
|
||||
}
|
||||
#ifndef WIN32
|
||||
else {
|
||||
err = sendto(mcon->socket, event, event_size, 0, (struct sockaddr *) &mcon->remote_addr, sizeof(mcon->remote_addr));
|
||||
}
|
||||
#endif
|
||||
|
||||
ftdm_mutex_unlock(mcon->mutex);
|
||||
|
||||
ftdm_assert_return(err == event_size, -1, "Failed to send the boost message completely!");
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
|
||||
int __sangomabc_connection_writep(sangomabc_connection_t *mcon, sangomabc_event_t *event, const char *file, const char *func, int line)
|
||||
{
|
||||
int err = 0;
|
||||
int event_size=sizeof(sangomabc_event_t);
|
||||
|
||||
if (!mcon->sigmod) {
|
||||
ftdm_assert_return(event != NULL, -1, "No event!");
|
||||
ftdm_assert_return(mcon->socket >= 0, -1, "No mcon->socket!");
|
||||
ftdm_assert_return(mcon->mutex != NULL, -1, "No mcon->mutex!");
|
||||
}
|
||||
|
||||
if (!boost_full_event(event->event_id)) {
|
||||
event_size=sizeof(sangomabc_short_event_t);
|
||||
}
|
||||
|
||||
ftdm_mutex_lock(mcon->mutex);
|
||||
event->version = SIGBOOST_VERSION;
|
||||
if (mcon->sigmod) {
|
||||
mcon->sigmod->write_msg(mcon->span, event, event_size);
|
||||
err = event_size;
|
||||
|
||||
}
|
||||
#ifndef WIN32
|
||||
else {
|
||||
err = sendto(mcon->socket, event, event_size, 0, (struct sockaddr *) &mcon->remote_addr, sizeof(mcon->remote_addr));
|
||||
}
|
||||
#endif
|
||||
ftdm_mutex_unlock(mcon->mutex);
|
||||
|
||||
ftdm_assert_return(err == event_size, -1, "Failed to send boost message completely!");
|
||||
|
||||
if (boost_full_event(event->event_id)) {
|
||||
sangomabc_print_event_call(mcon, event, 1, 1, file, func, line);
|
||||
} else {
|
||||
sangomabc_print_event_short(mcon, (sangomabc_short_event_t*)event, 1, 1, file, func, line);
|
||||
}
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
|
||||
void sangomabc_call_init(sangomabc_event_t *event, const char *calling, const char *called, int setup_id)
|
||||
{
|
||||
memset(event, 0, sizeof(sangomabc_event_t));
|
||||
event->event_id = SIGBOOST_EVENT_CALL_START;
|
||||
|
||||
if (calling) {
|
||||
strncpy((char*)event->calling_number_digits, calling, sizeof(event->calling_number_digits)-1);
|
||||
event->calling_number_digits_count = (uint8_t)strlen(calling);
|
||||
}
|
||||
|
||||
if (called) {
|
||||
strncpy((char*)event->called_number_digits, called, sizeof(event->called_number_digits)-1);
|
||||
event->called_number_digits_count = (uint8_t)strlen(called);
|
||||
}
|
||||
|
||||
event->call_setup_id = (uint16_t)setup_id;
|
||||
|
||||
}
|
||||
|
||||
void sangomabc_event_init(sangomabc_short_event_t *event, sangomabc_event_id_t event_id, int chan, int span)
|
||||
{
|
||||
if (boost_full_event(event_id)) {
|
||||
memset(event, 0, sizeof(sangomabc_event_t));
|
||||
} else {
|
||||
memset(event, 0, sizeof(sangomabc_short_event_t));
|
||||
}
|
||||
event->event_id = event_id;
|
||||
event->chan = (uint8_t)chan;
|
||||
event->span = (uint8_t)span;
|
||||
}
|
||||
|
||||
const char *sangomabc_event_id_name(uint32_t event_id)
|
||||
{
|
||||
unsigned int x;
|
||||
const char *ret = NULL;
|
||||
|
||||
for (x = 0 ; x < sizeof(sangomabc_table)/sizeof(struct sangomabc_map); x++) {
|
||||
if (sangomabc_table[x].event_id == event_id) {
|
||||
ret = sangomabc_table[x].name;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
/* For Emacs:
|
||||
* Local Variables:
|
||||
* mode:c
|
||||
* indent-tabs-mode:t
|
||||
* tab-width:4
|
||||
* c-basic-offset:4
|
||||
* End:
|
||||
* For VIM:
|
||||
* vim:set softtabstop=4 shiftwidth=4 tabstop=4:
|
||||
*/
|
||||
|
||||
@@ -1,164 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2007, Anthony Minessale II, Nenad Corbic
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* * Neither the name of the original author; nor the names of any contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
|
||||
* OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef _SANGOMABC_H
|
||||
#define _SANGOMABC_H
|
||||
|
||||
#include "sangoma_boost_interface.h"
|
||||
|
||||
#include <ctype.h>
|
||||
#include <string.h>
|
||||
#ifndef WIN32
|
||||
#include <unistd.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#ifdef HAVE_NETINET_SCTP_H
|
||||
#include <netinet/sctp.h>
|
||||
#endif
|
||||
#include <arpa/inet.h>
|
||||
#include <netdb.h>
|
||||
#include <sys/time.h>
|
||||
#endif
|
||||
#include <stdlib.h>
|
||||
#include <errno.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
#include <sys/types.h>
|
||||
#include <stdarg.h>
|
||||
#include "sigboost.h"
|
||||
|
||||
#define sangomabc_test_flag(p,flag) ((p)->flags & (flag))
|
||||
|
||||
#define sangomabc_set_flag(p,flag) do { \
|
||||
((p)->flags |= (flag)); \
|
||||
} while (0)
|
||||
|
||||
#define sangomabc_clear_flag(p,flag) do { \
|
||||
((p)->flags &= ~(flag)); \
|
||||
} while (0)
|
||||
|
||||
#define sangomabc_copy_flags(dest,src,flagz) do { \
|
||||
(dest)->flags &= ~(flagz); \
|
||||
(dest)->flags |= ((src)->flags & (flagz)); \
|
||||
} while (0)
|
||||
|
||||
typedef t_sigboost_callstart sangomabc_event_t;
|
||||
typedef t_sigboost_short sangomabc_short_event_t;
|
||||
typedef uint32_t sangomabc_event_id_t;
|
||||
|
||||
typedef struct sangomabc_ip_cfg
|
||||
{
|
||||
char local_ip[25];
|
||||
int local_port;
|
||||
char remote_ip[25];
|
||||
int remote_port;
|
||||
}sangomabc_ip_cfg_t;
|
||||
|
||||
typedef enum {
|
||||
MSU_FLAG_EVENT = (1 << 0),
|
||||
MSU_FLAG_DOWN = (1 << 1)
|
||||
} sangomabc_flag_t;
|
||||
|
||||
|
||||
struct sangomabc_connection {
|
||||
ftdm_socket_t socket;
|
||||
struct sockaddr_in local_addr;
|
||||
struct sockaddr_in remote_addr;
|
||||
sangomabc_event_t event;
|
||||
struct hostent remote_hp;
|
||||
struct hostent local_hp;
|
||||
unsigned int flags;
|
||||
ftdm_mutex_t *mutex;
|
||||
FILE *log;
|
||||
unsigned int txseq;
|
||||
unsigned int rxseq;
|
||||
unsigned int txwindow;
|
||||
unsigned int rxseq_reset;
|
||||
sangomabc_ip_cfg_t cfg;
|
||||
/* boost signaling mod interface pointer (if not working in TCP mode) */
|
||||
boost_sigmod_interface_t *sigmod;
|
||||
ftdm_queue_t *boost_queue;
|
||||
ftdm_interrupt_t *sock_interrupt;
|
||||
ftdm_span_t *span;
|
||||
int debuglevel;
|
||||
};
|
||||
|
||||
typedef struct sangomabc_connection sangomabc_connection_t;
|
||||
|
||||
typedef struct sangomabc_queue_element {
|
||||
unsigned char boostmsg[sizeof(sangomabc_event_t)];
|
||||
ftdm_size_t size;
|
||||
} sangomabc_queue_element_t;
|
||||
|
||||
/* disable nagle's algorythm */
|
||||
static __inline__ void sctp_no_nagle(int socket)
|
||||
{
|
||||
#ifdef HAVE_NETINET_SCTP_H
|
||||
int flag = 1;
|
||||
setsockopt(socket, IPPROTO_SCTP, SCTP_NODELAY, (char *) &flag, sizeof(int));
|
||||
#endif
|
||||
}
|
||||
|
||||
int sangomabc_connection_close(sangomabc_connection_t *mcon);
|
||||
int sangomabc_connection_open(sangomabc_connection_t *mcon, char *local_ip, int local_port, char *ip, int port);
|
||||
sangomabc_event_t *__sangomabc_connection_read(sangomabc_connection_t *mcon, int iteration, const char *file, const char *func, int line);
|
||||
sangomabc_event_t *__sangomabc_connection_readp(sangomabc_connection_t *mcon, int iteration, const char *file, const char *func, int line);
|
||||
int __sangomabc_connection_write(sangomabc_connection_t *mcon, sangomabc_event_t *event, const char *file, const char *func, int line);
|
||||
int __sangomabc_connection_writep(sangomabc_connection_t *mcon, sangomabc_event_t *event, const char *file, const char *func, int line);
|
||||
#define sangomabc_connection_write(_m,_e) __sangomabc_connection_write(_m, _e, __FILE__, __FUNCTION__, __LINE__)
|
||||
#define sangomabc_connection_writep(_m,_e) __sangomabc_connection_writep(_m, _e, __FILE__, __FUNCTION__, __LINE__)
|
||||
#define sangomabc_connection_read(_m,_e) __sangomabc_connection_read(_m, _e, __FILE__, __FUNCTION__, __LINE__)
|
||||
#define sangomabc_connection_readp(_m,_e) __sangomabc_connection_readp(_m, _e, __FILE__, __FUNCTION__, __LINE__)
|
||||
void sangomabc_event_init(sangomabc_short_event_t *event, sangomabc_event_id_t event_id, int chan, int span);
|
||||
void sangomabc_call_init(sangomabc_event_t *event, const char *calling, const char *called, int setup_id);
|
||||
const char *sangomabc_event_id_name(uint32_t event_id);
|
||||
int sangomabc_exec_command(sangomabc_connection_t *mcon, int span, int chan, int id, int cmd, int cause, int flags);
|
||||
int sangomabc_exec_commandp(sangomabc_connection_t *pcon, int span, int chan, int id, int cmd, int cause);
|
||||
|
||||
#define BOOST_EVENT_SPAN(sigmod, event) ((sigmod) ? event->span : event->span + 1)
|
||||
#define BOOST_EVENT_CHAN(sigmod, event) ((sigmod) ? event->chan : event->chan + 1)
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
/* For Emacs:
|
||||
* Local Variables:
|
||||
* mode:c
|
||||
* indent-tabs-mode:t
|
||||
* tab-width:4
|
||||
* c-basic-offset:4
|
||||
* End:
|
||||
* For VIM:
|
||||
* vim:set softtabstop=4 shiftwidth=4 tabstop=4:
|
||||
*/
|
||||
@@ -1,254 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2009, Sangoma Technologies
|
||||
* Moises Silva <moy@sangoma.com>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* * Neither the name of the original author; nor the names of any contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
|
||||
* OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef SANGOMA_BOOST_INTERFACE_H
|
||||
#define SANGOMA_BOOST_INTERFACE_H
|
||||
|
||||
#include "private/ftdm_core.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*!
|
||||
\brief Callback used to notify signaling status changes on a channel
|
||||
\param ftdmchan The freetdm channel where the signaling status just changed
|
||||
\param status The new signaling status
|
||||
*/
|
||||
#define BOOST_SIG_STATUS_CB_ARGS (ftdm_channel_t *ftdmchan, ftdm_signaling_status_t status)
|
||||
typedef void (*boost_sig_status_cb_func_t) BOOST_SIG_STATUS_CB_ARGS;
|
||||
#define BOOST_SIG_STATUS_CB_FUNCTION(name) void name BOOST_SIG_STATUS_CB_ARGS
|
||||
|
||||
/*!
|
||||
\brief Write a boost msg to a boost endpoint
|
||||
\param span The freetdm span where this msg was generated
|
||||
\param msg The generic message pointer, owned by the caller
|
||||
\param msglen The length of the provided structure pointed by msg
|
||||
\return FTDM_SUCCESS or FTDM_FAIL
|
||||
|
||||
The msg buffer is owned by the caller and it should
|
||||
be either t_sigboost_callstart or t_sigboost_short
|
||||
the endpoint receiving the msg will first cast to
|
||||
t_sigboost_short, check the event type, and if needed.
|
||||
*/
|
||||
#define BOOST_WRITE_MSG_ARGS (ftdm_span_t *span, void *msg, ftdm_size_t msglen)
|
||||
typedef ftdm_status_t (*boost_write_msg_func_t) BOOST_WRITE_MSG_ARGS;
|
||||
#define BOOST_WRITE_MSG_FUNCTION(name) ftdm_status_t name BOOST_WRITE_MSG_ARGS
|
||||
|
||||
/*!
|
||||
\brief Set the callback to be used by a signaling module to write boost messages
|
||||
\param callback The callback to be used by the signaling module
|
||||
|
||||
The provided callback will be used for the signaling boost module to notify the
|
||||
user with boost messages.
|
||||
*/
|
||||
#define BOOST_SET_WRITE_MSG_CB_ARGS (boost_write_msg_func_t callback)
|
||||
typedef void (*boost_set_write_msg_cb_func_t) BOOST_SET_WRITE_MSG_CB_ARGS;
|
||||
#define BOOST_SET_WRITE_MSG_CB_FUNCTION(name) void name BOOST_SET_WRITE_MSG_CB_ARGS
|
||||
|
||||
/*!
|
||||
\brief Notify hardware status change
|
||||
\param ftdmchan The freetdm channel
|
||||
\param status The hw status
|
||||
\return FTDM_SUCCESS or FTDM_FAIL
|
||||
*/
|
||||
#define BOOST_ON_HW_LINK_STATUS_CHANGE_ARGS (ftdm_channel_t *ftdmchan, ftdm_channel_hw_link_status_t status)
|
||||
typedef void (*boost_on_hw_link_status_change_func_t) BOOST_ON_HW_LINK_STATUS_CHANGE_ARGS;
|
||||
#define BOOST_ON_HW_LINK_STATUS_CHANGE_FUNCTION(name) void name BOOST_ON_HW_LINK_STATUS_CHANGE_ARGS
|
||||
|
||||
/*!
|
||||
\brief Set signaling status callback used by the signaling module to report signaling status changes
|
||||
\param callback The callback to be used by the signaling module
|
||||
|
||||
The provided callback will be used for the signaling boost module to notify the
|
||||
user with signaling link status changes.
|
||||
*/
|
||||
#define BOOST_SET_SIG_STATUS_CB_ARGS (boost_sig_status_cb_func_t callback)
|
||||
typedef void (*boost_set_sig_status_cb_func_t) BOOST_SET_SIG_STATUS_CB_ARGS;
|
||||
#define BOOST_SET_SIG_STATUS_CB_FUNCTION(name) void name BOOST_SET_SIG_STATUS_CB_ARGS
|
||||
|
||||
/*!
|
||||
\brief Get the signaling status on the given channel.
|
||||
\param ftdmchan The freetdm channel
|
||||
\param status The status pointer where the current signaling status will be set
|
||||
*/
|
||||
#define BOOST_GET_CHANNEL_SIG_STATUS_ARGS (ftdm_channel_t *ftdmchan, ftdm_signaling_status_t *status)
|
||||
typedef ftdm_status_t (*boost_get_channel_sig_status_func_t) BOOST_GET_CHANNEL_SIG_STATUS_ARGS;
|
||||
#define BOOST_GET_CHANNEL_SIG_STATUS_FUNCTION(name) ftdm_status_t name BOOST_GET_CHANNEL_SIG_STATUS_ARGS
|
||||
|
||||
/*!
|
||||
\brief Set the signaling status on the given channel.
|
||||
\param ftdmchan The freetdm channel
|
||||
\param status The new status for the channel
|
||||
\return FTDM_SUCCESS or FTDM_FAIL
|
||||
*/
|
||||
#define BOOST_SET_CHANNEL_SIG_STATUS_ARGS (ftdm_channel_t *ftdmchan, ftdm_signaling_status_t status)
|
||||
typedef ftdm_status_t (*boost_set_channel_sig_status_func_t) BOOST_SET_CHANNEL_SIG_STATUS_ARGS;
|
||||
#define BOOST_SET_CHANNEL_SIG_STATUS_FUNCTION(name) ftdm_status_t name BOOST_SET_CHANNEL_SIG_STATUS_ARGS
|
||||
|
||||
/*!
|
||||
\brief Get the signaling status on the given span.
|
||||
\param span The freetdm span
|
||||
\param status The status pointer where the current signaling status will be set
|
||||
*/
|
||||
#define BOOST_GET_SPAN_SIG_STATUS_ARGS (ftdm_span_t *span, ftdm_signaling_status_t *status)
|
||||
typedef ftdm_status_t (*boost_get_span_sig_status_func_t) BOOST_GET_SPAN_SIG_STATUS_ARGS;
|
||||
#define BOOST_GET_SPAN_SIG_STATUS_FUNCTION(name) ftdm_status_t name BOOST_GET_SPAN_SIG_STATUS_ARGS
|
||||
|
||||
/*!
|
||||
\brief Set the signaling status on the given span.
|
||||
\param ftdmchan The freetdm span
|
||||
\param status The new status for the span
|
||||
\return FTDM_SUCCESS or FTDM_FAIL
|
||||
*/
|
||||
#define BOOST_SET_SPAN_SIG_STATUS_ARGS (ftdm_span_t *span, ftdm_signaling_status_t status)
|
||||
typedef ftdm_status_t (*boost_set_span_sig_status_func_t) BOOST_SET_SPAN_SIG_STATUS_ARGS;
|
||||
#define BOOST_SET_SPAN_SIG_STATUS_FUNCTION(name) ftdm_status_t name BOOST_SET_SPAN_SIG_STATUS_ARGS
|
||||
|
||||
/*!
|
||||
\brief Configure the given span signaling
|
||||
\param span The freetdm span
|
||||
\param parameters The array of configuration key,value pairs (must be null terminated)
|
||||
\return FTDM_SUCCESS or FTDM_FAIL
|
||||
*/
|
||||
#define BOOST_CONFIGURE_SPAN_ARGS (ftdm_span_t *span, ftdm_conf_parameter_t *parameters)
|
||||
typedef ftdm_status_t (*boost_configure_span_func_t) BOOST_CONFIGURE_SPAN_ARGS;
|
||||
#define BOOST_CONFIGURE_SPAN_FUNCTION(name) ftdm_status_t name BOOST_CONFIGURE_SPAN_ARGS
|
||||
|
||||
/*!
|
||||
\brief Start the given span
|
||||
\param span The freetdm span
|
||||
\return FTDM_SUCCESS or FTDM_FAIL
|
||||
*/
|
||||
#define BOOST_START_SPAN_ARGS (ftdm_span_t *span)
|
||||
typedef ftdm_status_t (*boost_start_span_func_t) BOOST_START_SPAN_ARGS;
|
||||
#define BOOST_START_SPAN_FUNCTION(name) ftdm_status_t name BOOST_START_SPAN_ARGS
|
||||
|
||||
/*!
|
||||
\brief Stop the given span
|
||||
\param span The freetdm span
|
||||
\return FTDM_SUCCESS or FTDM_FAIL
|
||||
*/
|
||||
#define BOOST_STOP_SPAN_ARGS (ftdm_span_t *span)
|
||||
typedef ftdm_status_t (*boost_stop_span_func_t) BOOST_START_SPAN_ARGS;
|
||||
#define BOOST_STOP_SPAN_FUNCTION(name) ftdm_status_t name BOOST_STOP_SPAN_ARGS
|
||||
|
||||
/*!
|
||||
\brief Called when the module is being loaded BEFORE calling anything else
|
||||
\return FTDM_SUCCESS or FTDM_FAIL
|
||||
*/
|
||||
#define BOOST_ON_LOAD_ARGS (void)
|
||||
typedef ftdm_status_t (*boost_on_load_func_t) BOOST_ON_LOAD_ARGS;
|
||||
#define BOOST_ON_LOAD_FUNCTION(name) ftdm_status_t name BOOST_ON_LOAD_ARGS
|
||||
|
||||
/*!
|
||||
\brief Called when the module is being unloaded, last chance to stop everything!
|
||||
*/
|
||||
#define BOOST_ON_UNLOAD_ARGS (void)
|
||||
typedef ftdm_status_t (*boost_on_unload_func_t) BOOST_ON_UNLOAD_ARGS;
|
||||
#define BOOST_ON_UNLOAD_FUNCTION(name) ftdm_status_t name BOOST_ON_UNLOAD_ARGS
|
||||
|
||||
/*!
|
||||
\brief Called when user wants to execute sigmod api function
|
||||
\return FTDM_SUCCESS or FTDM_FAIL
|
||||
*/
|
||||
#define BOOST_API_ARGS (ftdm_stream_handle_t *stream, char *cmd)
|
||||
typedef ftdm_status_t (*boost_api_func_t) BOOST_API_ARGS;
|
||||
#define BOOST_API_FUNCTION(name) ftdm_status_t name BOOST_API_ARGS
|
||||
|
||||
|
||||
/*!
|
||||
\brief The boost signaling module interface
|
||||
*/
|
||||
typedef struct boost_sigmod_interface_s {
|
||||
/*! \brief Module name */
|
||||
const char *name;
|
||||
/*! \brief write boost message function */
|
||||
boost_write_msg_func_t write_msg;
|
||||
/*! \brief set the user write boost message function */
|
||||
boost_set_write_msg_cb_func_t set_write_msg_cb;
|
||||
/*! \brief set the user signaling status function */
|
||||
boost_set_sig_status_cb_func_t set_sig_status_cb;
|
||||
/*! \brief get channel signaling status */
|
||||
boost_get_channel_sig_status_func_t get_channel_sig_status;
|
||||
/*! \brief set channel signaling status */
|
||||
boost_set_channel_sig_status_func_t set_channel_sig_status;
|
||||
/*! \brief get span signaling status */
|
||||
boost_get_span_sig_status_func_t get_span_sig_status;
|
||||
/*! \brief set span signaling status */
|
||||
boost_set_span_sig_status_func_t set_span_sig_status;
|
||||
/*! \brief set notify hardware link status change */
|
||||
boost_on_hw_link_status_change_func_t on_hw_link_status_change;
|
||||
/*! \brief configure span signaling */
|
||||
boost_configure_span_func_t configure_span;
|
||||
/*! \brief start freetdm span */
|
||||
boost_start_span_func_t start_span;
|
||||
/*! \brief stop freetdm span */
|
||||
boost_stop_span_func_t stop_span;
|
||||
/*! \brief the module was just loaded */
|
||||
boost_on_load_func_t on_load;
|
||||
/*! \brief the module is about to be unloaded */
|
||||
boost_on_unload_func_t on_unload;
|
||||
/*! \brief module api function */
|
||||
boost_api_func_t exec_api;
|
||||
/*! \brief private pointer for the interface user */
|
||||
void *pvt;
|
||||
} boost_sigmod_interface_t;
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern C
|
||||
#endif
|
||||
|
||||
#define BOOST_INTERFACE_NAME boost_sigmod_interface
|
||||
#define BOOST_INTERFACE_NAME_STR "boost_sigmod_interface"
|
||||
/* use this in your sig boost module to declare your interface */
|
||||
#ifndef WIN32
|
||||
#define BOOST_INTERFACE boost_sigmod_interface_t BOOST_INTERFACE_NAME
|
||||
#else
|
||||
#define BOOST_INTERFACE __declspec(dllexport) boost_sigmod_interface_t BOOST_INTERFACE_NAME
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
/* For Emacs:
|
||||
* Local Variables:
|
||||
* mode:c
|
||||
* indent-tabs-mode:t
|
||||
* tab-width:4
|
||||
* c-basic-offset:4
|
||||
* End:
|
||||
* For VIM:
|
||||
* vim:set softtabstop=4 shiftwidth=4 tabstop=4:
|
||||
*/
|
||||
|
||||
@@ -1,221 +0,0 @@
|
||||
/****************************************************************************
|
||||
* sigboost.h $Revision: 1.13 $
|
||||
*
|
||||
* Definitions for the sigboost interface.
|
||||
*
|
||||
* WARNING WARNING WARNING
|
||||
*
|
||||
* This file is used by sangoma_mgd and perhaps other programs. Any changes
|
||||
* to this file must be coordinated with other user programs,
|
||||
*
|
||||
* Copyright (C) 2005 Xygnada Technology, Inc.
|
||||
*
|
||||
****************************************************************************/
|
||||
#ifndef _SIGBOOST_H_
|
||||
#define _SIGBOOST_H_
|
||||
|
||||
#define SIGBOOST_VERSION 103
|
||||
|
||||
// handy to define integer types that actually work on both Lin and Win
|
||||
#include <freetdm.h>
|
||||
|
||||
enum e_sigboost_event_id_values
|
||||
{
|
||||
SIGBOOST_EVENT_CALL_START = 0x80, /*128*/
|
||||
SIGBOOST_EVENT_CALL_START_ACK = 0x81, /*129*/
|
||||
SIGBOOST_EVENT_CALL_START_NACK = 0x82, /*130*/
|
||||
SIGBOOST_EVENT_CALL_START_NACK_ACK = 0x83, /*131*/
|
||||
SIGBOOST_EVENT_CALL_ANSWERED = 0x84, /*132*/
|
||||
SIGBOOST_EVENT_CALL_STOPPED = 0x85, /*133*/
|
||||
SIGBOOST_EVENT_CALL_STOPPED_ACK = 0x86, /*134*/
|
||||
SIGBOOST_EVENT_SYSTEM_RESTART = 0x87, /*135*/
|
||||
SIGBOOST_EVENT_SYSTEM_RESTART_ACK = 0x88, /*136*/
|
||||
/* CALL_RELEASED is aimed to fix a race condition that became obvious
|
||||
* when the boost socket was replaced by direct function calls
|
||||
* and the channel hunting was moved to freetdm, the problem is
|
||||
* we can get CALL_STOPPED msg and reply with CALL_STOPPED_ACK
|
||||
* but the signaling module will still (in PRI) send RELEASE and
|
||||
* wait for RELEASE_COMPLETE from the isdn network before
|
||||
* marking the channel as available, therefore freetdm should
|
||||
* also not mark the channel as available until CALL_RELEASED
|
||||
* is received, for socket mode we can continue working as usual
|
||||
* with CALL_STOPPED being the last step because the hunting is
|
||||
* done in the signaling module.
|
||||
* */
|
||||
SIGBOOST_EVENT_CALL_RELEASED = 0x51, /* 81 */
|
||||
SIGBOOST_EVENT_CALL_PROGRESS = 0x50, /*decimal 80*/
|
||||
/* Following IDs are ss7boost to sangoma_mgd only. */
|
||||
SIGBOOST_EVENT_HEARTBEAT = 0x89, /*137*/
|
||||
SIGBOOST_EVENT_INSERT_CHECK_LOOP = 0x8a, /*138*/
|
||||
SIGBOOST_EVENT_REMOVE_CHECK_LOOP = 0x8b, /*139*/
|
||||
SIGBOOST_EVENT_AUTO_CALL_GAP_ABATE = 0x8c, /*140*/
|
||||
SIGBOOST_EVENT_DIGIT_IN = 0x8d, /*141*/
|
||||
};
|
||||
|
||||
#define BOOST_DECODE_EVENT_ID(id) \
|
||||
(id==SIGBOOST_EVENT_CALL_START)?"SIGBOOST_EVENT_CALL_START": \
|
||||
(id==SIGBOOST_EVENT_CALL_START_ACK)?"SIGBOOST_EVENT_CALL_START_ACK": \
|
||||
(id==SIGBOOST_EVENT_CALL_START_NACK)?"SIGBOOST_EVENT_CALL_START_NACK": \
|
||||
(id==SIGBOOST_EVENT_CALL_ANSWERED)?"SIGBOOST_EVENT_CALL_ANSWERED": \
|
||||
(id==SIGBOOST_EVENT_CALL_STOPPED)?"SIGBOOST_EVENT_CALL_STOPPED": \
|
||||
(id==SIGBOOST_EVENT_CALL_STOPPED_ACK)?"SIGBOOST_EVENT_CALL_STOPPED_ACK": \
|
||||
(id==SIGBOOST_EVENT_SYSTEM_RESTART)?"SIGBOOST_EVENT_SYSTEM_RESTART": \
|
||||
(id==SIGBOOST_EVENT_SYSTEM_RESTART_ACK)?"SIGBOOST_EVENT_SYSTEM_RESTART_ACK": \
|
||||
(id==SIGBOOST_EVENT_CALL_RELEASED)?"SIGBOOST_EVENT_CALL_RELEASED": \
|
||||
(id==SIGBOOST_EVENT_CALL_PROGRESS)?"SIGBOOST_EVENT_CALL_PROGRESS": \
|
||||
(id==SIGBOOST_EVENT_HEARTBEAT)?"SIGBOOST_EVENT_HEARTBEAT": \
|
||||
(id==SIGBOOST_EVENT_INSERT_CHECK_LOOP)?"SIGBOOST_EVENT_INSERT_CHECK_LOOP": \
|
||||
(id==SIGBOOST_EVENT_REMOVE_CHECK_LOOP)?"SIGBOOST_EVENT_REMOVE_CHECK_LOOP": \
|
||||
(id==SIGBOOST_EVENT_AUTO_CALL_GAP_ABATE)?"SIGBOOST_EVENT_AUTO_CALL_GAP_ABATE": \
|
||||
(id==SIGBOOST_EVENT_DIGIT_IN)?"SIGBOOST_EVENT_DIGIT_IN": "Unknown"
|
||||
|
||||
enum e_sigboost_release_cause_values
|
||||
{
|
||||
SIGBOOST_RELEASE_CAUSE_UNDEFINED = 0,
|
||||
SIGBOOST_RELEASE_CAUSE_NORMAL = 16,
|
||||
/* probable elimination */
|
||||
//SIGBOOST_RELEASE_CAUSE_BUSY = 0x91, /* 145 */
|
||||
//SIGBOOST_RELEASE_CAUSE_CALLED_NOT_EXIST = 0x92, /* 146 */
|
||||
//SIGBOOST_RELEASE_CAUSE_CIRCUIT_RESET = 0x93, /* 147 */
|
||||
//SIGBOOST_RELEASE_CAUSE_NOANSWER = 0x94, /* 148 */
|
||||
};
|
||||
|
||||
enum e_sigboost_call_setup_ack_nack_cause_values
|
||||
{
|
||||
//SIGBOOST_CALL_SETUP_NACK_ALL_CKTS_BUSY = 34, /* Q.850 value - don't use */
|
||||
SIGBOOST_CALL_SETUP_NACK_ALL_CKTS_BUSY = 117, /* non Q.850 value indicates local all ckt busy
|
||||
causing sangoma_mgd to perform automatic call
|
||||
gapping*/
|
||||
SIGBOOST_CALL_SETUP_NACK_TEST_CKT_BUSY = 17, /* Q.850 value */
|
||||
SIGBOOST_CALL_SETUP_NACK_INVALID_NUMBER = 28, /* Q.850 value */
|
||||
SIGBOOST_CALL_SETUP_CSUPID_DBL_USE = 200, /* unused Q.850 value */
|
||||
};
|
||||
|
||||
|
||||
enum e_sigboost_huntgroup_values
|
||||
{
|
||||
SIGBOOST_HUNTGRP_SEQ_ASC = 0x00, /* sequential with lowest available first */
|
||||
SIGBOOST_HUNTGRP_SEQ_DESC = 0x01, /* sequential with highest available first */
|
||||
SIGBOOST_HUNTGRP_RR_ASC = 0x02, /* round-robin with lowest available first */
|
||||
SIGBOOST_HUNTGRP_RR_DESC = 0x03, /* round-robin with highest available first */
|
||||
};
|
||||
|
||||
enum e_sigboost_event_info_par_values
|
||||
{
|
||||
SIGBOOST_EVI_SPARE = 0x00,
|
||||
SIGBOOST_EVI_ALERTING = 0x01,
|
||||
SIGBOOST_EVI_PROGRESS = 0x02,
|
||||
};
|
||||
|
||||
enum e_sigboost_progress_flags
|
||||
{
|
||||
SIGBOOST_PROGRESS_RING = (1 << 0),
|
||||
SIGBOOST_PROGRESS_MEDIA = (1 << 1)
|
||||
};
|
||||
|
||||
#define MAX_DIALED_DIGITS 31
|
||||
|
||||
/* Next two defines are used to create the range of values for call_setup_id
|
||||
* in the t_sigboost structure.
|
||||
* 0..((CORE_MAX_SPANS * CORE_MAX_CHAN_PER_SPAN) - 1) */
|
||||
#define CORE_MAX_SPANS 200
|
||||
#define CORE_MAX_CHAN_PER_SPAN 32
|
||||
#define MAX_PENDING_CALLS CORE_MAX_SPANS * CORE_MAX_CHAN_PER_SPAN
|
||||
/* 0..(MAX_PENDING_CALLS-1) is range of call_setup_id below */
|
||||
|
||||
/* Should only be used by server */
|
||||
#define MAX_CALL_SETUP_ID 0xFFFF
|
||||
|
||||
#define SIZE_CUSTOM 900
|
||||
#define SIZE_RDNIS SIZE_CUSTOM
|
||||
|
||||
|
||||
#pragma pack(1)
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint8_t capability;
|
||||
uint8_t uil1p;
|
||||
} t_sigboost_bearer;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint8_t digits_count;
|
||||
char digits [MAX_DIALED_DIGITS + 1]; /* it's a null terminated string */
|
||||
uint8_t npi;
|
||||
uint8_t ton;
|
||||
uint8_t screening_ind;
|
||||
uint8_t presentation_ind;
|
||||
}t_sigboost_digits;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint16_t version;
|
||||
uint32_t event_id;
|
||||
/* delete sequence numbers - SCTP does not need them */
|
||||
uint32_t fseqno;
|
||||
uint32_t bseqno;
|
||||
uint16_t call_setup_id;
|
||||
uint32_t trunk_group;
|
||||
uint8_t span;
|
||||
uint8_t chan;
|
||||
uint32_t flags;
|
||||
/* struct timeval tv; */
|
||||
t_sigboost_digits called;
|
||||
t_sigboost_digits calling;
|
||||
t_sigboost_digits rdnis;
|
||||
/* ref. Q.931 Table 4-11 and Q.951 Section 3 */
|
||||
char calling_name[MAX_DIALED_DIGITS + 1];
|
||||
t_sigboost_bearer bearer;
|
||||
uint8_t hunt_group;
|
||||
uint16_t custom_data_size;
|
||||
char custom_data[SIZE_CUSTOM]; /* it's a null terminated string */
|
||||
|
||||
} t_sigboost_callstart;
|
||||
|
||||
#define called_number_digits_count called.digits_count
|
||||
#define called_number_digits called.digits
|
||||
#define calling_number_digits_count calling.digits_count
|
||||
#define calling_number_digits calling.digits
|
||||
#define calling_number_screening_ind calling.screening_ind
|
||||
#define calling_number_presentation calling.presentation_ind
|
||||
|
||||
#define isup_in_rdnis_size custom_data_size
|
||||
#define isup_in_rdnis custom_data
|
||||
|
||||
|
||||
#define MIN_SIZE_CALLSTART_MSG sizeof(t_sigboost_callstart) - SIZE_CUSTOM
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint16_t version;
|
||||
uint32_t event_id;
|
||||
/* delete sequence numbers - SCTP does not need them */
|
||||
uint32_t fseqno;
|
||||
uint32_t bseqno;
|
||||
uint16_t call_setup_id;
|
||||
uint32_t trunk_group;
|
||||
uint8_t span;
|
||||
uint8_t chan;
|
||||
uint32_t flags;
|
||||
/* struct timeval tv; */
|
||||
uint8_t release_cause;
|
||||
} t_sigboost_short;
|
||||
#pragma pack()
|
||||
|
||||
|
||||
static __inline__ int boost_full_event(int event_id)
|
||||
{
|
||||
switch (event_id) {
|
||||
case SIGBOOST_EVENT_CALL_START:
|
||||
case SIGBOOST_EVENT_DIGIT_IN:
|
||||
case SIGBOOST_EVENT_CALL_PROGRESS:
|
||||
return 1;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -603,6 +603,7 @@ static ftdm_status_t ftdm_sangoma_isdn_process_state_change(ftdm_channel_t *ftdm
|
||||
ftdm_sigmsg_t sigev;
|
||||
ftdm_channel_state_t initial_state;
|
||||
sngisdn_chan_data_t *sngisdn_info = ftdmchan->call_data;
|
||||
uint8_t state_change = 0;
|
||||
|
||||
memset(&sigev, 0, sizeof(sigev));
|
||||
|
||||
@@ -610,9 +611,6 @@ static ftdm_status_t ftdm_sangoma_isdn_process_state_change(ftdm_channel_t *ftdm
|
||||
sigev.span_id = ftdmchan->span_id;
|
||||
sigev.channel = ftdmchan;
|
||||
|
||||
/* Acknowledge the state change */
|
||||
ftdm_channel_complete_state(ftdmchan);
|
||||
|
||||
#ifdef FTDM_DEBUG_CHAN_MEMORY
|
||||
if (ftdmchan->state == FTDM_CHANNEL_STATE_DIALING) {
|
||||
ftdm_assert(mprotect(ftdmchan, sizeof(*ftdmchan), PROT_READ) == 0, "Failed to mprotect");
|
||||
@@ -649,8 +647,7 @@ static ftdm_status_t ftdm_sangoma_isdn_process_state_change(ftdm_channel_t *ftdm
|
||||
ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Sending incoming call from %s to %s to FTDM core\n", ftdmchan->caller_data.ani.digits, ftdmchan->caller_data.dnis.digits);
|
||||
|
||||
/* we have enough information to inform FTDM of the call*/
|
||||
sigev.event_id = FTDM_SIGEVENT_START;
|
||||
ftdm_span_send_signal(ftdmchan->span, &sigev);
|
||||
sngisdn_send_signal(sngisdn_info, FTDM_SIGEVENT_START);
|
||||
}
|
||||
break;
|
||||
case FTDM_CHANNEL_STATE_DIALING: /* outgoing call request */
|
||||
@@ -674,9 +671,10 @@ static ftdm_status_t ftdm_sangoma_isdn_process_state_change(ftdm_channel_t *ftdm
|
||||
{
|
||||
if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OUTBOUND)) {
|
||||
/*OUTBOUND...so we were told by the line of this so noifiy the user*/
|
||||
sigev.event_id = FTDM_SIGEVENT_PROCEED;
|
||||
ftdm_span_send_signal(ftdmchan->span, &sigev);
|
||||
sngisdn_send_signal(sngisdn_info, FTDM_SIGEVENT_PROCEED);
|
||||
|
||||
if (sngisdn_test_flag(sngisdn_info, FLAG_MEDIA_READY)) {
|
||||
state_change++;
|
||||
ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_PROGRESS_MEDIA);
|
||||
}
|
||||
} else {
|
||||
@@ -694,9 +692,10 @@ static ftdm_status_t ftdm_sangoma_isdn_process_state_change(ftdm_channel_t *ftdm
|
||||
{
|
||||
if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OUTBOUND)) {
|
||||
/* OUTBOUND...so we were told by the line of this so notify the user */
|
||||
sigev.event_id = FTDM_SIGEVENT_RINGING;
|
||||
ftdm_span_send_signal(ftdmchan->span, &sigev);
|
||||
sngisdn_send_signal(sngisdn_info, FTDM_SIGEVENT_RINGING);
|
||||
|
||||
if (sngisdn_test_flag(sngisdn_info, FLAG_MEDIA_READY)) {
|
||||
state_change++;
|
||||
ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_PROGRESS_MEDIA);
|
||||
}
|
||||
} else {
|
||||
@@ -710,8 +709,8 @@ static ftdm_status_t ftdm_sangoma_isdn_process_state_change(ftdm_channel_t *ftdm
|
||||
/*check if the channel is inbound or outbound*/
|
||||
if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OUTBOUND)) {
|
||||
/*OUTBOUND...so we were told by the line of this so noifiy the user*/
|
||||
sigev.event_id = FTDM_SIGEVENT_PROGRESS;
|
||||
ftdm_span_send_signal(ftdmchan->span, &sigev);
|
||||
|
||||
sngisdn_send_signal(sngisdn_info, FTDM_SIGEVENT_PROGRESS);
|
||||
} else {
|
||||
/* Send a progress message, indicating: Call is not end-to-end ISDN, further call progress may be available */
|
||||
ftdm_sngisdn_progind_t prog_ind = {SNGISDN_PROGIND_LOC_USER, SNGISDN_PROGIND_DESCR_NETE_ISDN};
|
||||
@@ -722,8 +721,7 @@ static ftdm_status_t ftdm_sangoma_isdn_process_state_change(ftdm_channel_t *ftdm
|
||||
case FTDM_CHANNEL_STATE_PROGRESS_MEDIA:
|
||||
{
|
||||
if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OUTBOUND)) {
|
||||
sigev.event_id = FTDM_SIGEVENT_PROGRESS_MEDIA;
|
||||
ftdm_span_send_signal(ftdmchan->span, &sigev);
|
||||
sngisdn_send_signal(sngisdn_info, FTDM_SIGEVENT_PROGRESS_MEDIA);
|
||||
} else {
|
||||
/* Send a progress message, indicating: In-band information/pattern available */
|
||||
ftdm_sngisdn_progind_t prog_ind = {SNGISDN_PROGIND_LOC_USER, SNGISDN_PROGIND_DESCR_IB_AVAIL};
|
||||
@@ -736,8 +734,8 @@ static ftdm_status_t ftdm_sangoma_isdn_process_state_change(ftdm_channel_t *ftdm
|
||||
/* check if the channel is inbound or outbound */
|
||||
if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OUTBOUND)) {
|
||||
/* OUTBOUND ... so we were told by the line that the other side answered */
|
||||
sigev.event_id = FTDM_SIGEVENT_UP;
|
||||
ftdm_span_send_signal(ftdmchan->span, &sigev);
|
||||
|
||||
sngisdn_send_signal(sngisdn_info, FTDM_SIGEVENT_UP);
|
||||
|
||||
if (ftdmchan->span->trunk_type == FTDM_TRUNK_BRI_PTMP &&
|
||||
((sngisdn_span_data_t*)ftdmchan->span->signal_data)->signalling == SNGISDN_SIGNALING_NET) {
|
||||
@@ -757,14 +755,14 @@ static ftdm_status_t ftdm_sangoma_isdn_process_state_change(ftdm_channel_t *ftdm
|
||||
/* Send a release complete */
|
||||
sngisdn_snd_release(ftdmchan, 0);
|
||||
/*now go to the HANGUP complete state*/
|
||||
state_change++;
|
||||
ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_HANGUP_COMPLETE);
|
||||
}
|
||||
break;
|
||||
case FTDM_CHANNEL_STATE_TERMINATING: /* call is hung up by the remote end */
|
||||
{
|
||||
/* this state is set when the line is hanging up */
|
||||
sigev.event_id = FTDM_SIGEVENT_STOP;
|
||||
ftdm_span_send_signal(ftdmchan->span, &sigev);
|
||||
sngisdn_send_signal(sngisdn_info, FTDM_SIGEVENT_STOP);
|
||||
}
|
||||
break;
|
||||
case FTDM_CHANNEL_STATE_HANGUP: /* call is hung up locally */
|
||||
@@ -817,6 +815,7 @@ static ftdm_status_t ftdm_sangoma_isdn_process_state_change(ftdm_channel_t *ftdm
|
||||
}
|
||||
}
|
||||
/* now go to the HANGUP complete state */
|
||||
state_change++;
|
||||
ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_HANGUP_COMPLETE);
|
||||
}
|
||||
break;
|
||||
@@ -825,6 +824,7 @@ static ftdm_status_t ftdm_sangoma_isdn_process_state_change(ftdm_channel_t *ftdm
|
||||
if (sngisdn_test_flag(sngisdn_info, FLAG_REMOTE_ABORT) ||
|
||||
sngisdn_test_flag(sngisdn_info, FLAG_LOCAL_ABORT)) {
|
||||
/* If the remote side aborted, we will not get anymore message for this call */
|
||||
state_change++;
|
||||
ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_DOWN);
|
||||
} else {
|
||||
/* waiting on remote confirmation before moving to down */
|
||||
@@ -878,7 +878,27 @@ static ftdm_status_t ftdm_sangoma_isdn_process_state_change(ftdm_channel_t *ftdm
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if (!state_change) {
|
||||
/* Acknowledge the state change */
|
||||
ftdm_channel_complete_state(ftdmchan);
|
||||
}
|
||||
|
||||
/* If sngisdn_info->variables is not NULL, it means did not send any
|
||||
* sigevent to the user, therefore we have to free that hashtable */
|
||||
if (sngisdn_info->variables) {
|
||||
hashtable_destroy(sngisdn_info->variables);
|
||||
sngisdn_info->variables = NULL;
|
||||
}
|
||||
|
||||
/* If sngisdn_info->raw_data is not NULL, it means did not send any
|
||||
* sigevent to the user, therefore we have to free that raw data */
|
||||
if (sngisdn_info->raw_data) {
|
||||
ftdm_safe_free(sngisdn_info->raw_data);
|
||||
sngisdn_info->raw_data = NULL;
|
||||
sngisdn_info->raw_data_len = 0;
|
||||
}
|
||||
|
||||
if (ftdmchan->state == initial_state) {
|
||||
ftdm_assert(!ftdm_test_flag(ftdmchan, FTDM_CHANNEL_STATE_CHANGE), "state change flag is still set, but we did not change state\n");
|
||||
}
|
||||
@@ -890,20 +910,18 @@ static ftdm_status_t ftdm_sangoma_isdn_process_state_change(ftdm_channel_t *ftdm
|
||||
return FTDM_SUCCESS;
|
||||
}
|
||||
|
||||
static FIO_CHANNEL_SEND_MSG_FUNCTION(ftdm_sangoma_isdn_send_msg)
|
||||
static FIO_CHANNEL_INDICATE_FUNCTION(ftdm_sangoma_isdn_indicate)
|
||||
{
|
||||
ftdm_status_t status = FTDM_FAIL;
|
||||
|
||||
switch (sigmsg->event_id) {
|
||||
case FTDM_SIGEVENT_FACILITY:
|
||||
switch (indication) {
|
||||
case FTDM_CHANNEL_INDICATE_FACILITY:
|
||||
sngisdn_snd_fac_req(ftdmchan);
|
||||
status = FTDM_SUCCESS;
|
||||
break;
|
||||
default:
|
||||
ftdm_log_chan_msg(ftdmchan, FTDM_LOG_WARNING, "Unsupported signalling msg requested\n");
|
||||
status = FTDM_BREAK;
|
||||
}
|
||||
ftdm_call_clear_data(&ftdmchan->caller_data);
|
||||
status = FTDM_NOTIMPL;
|
||||
}
|
||||
return status;
|
||||
}
|
||||
|
||||
@@ -911,34 +929,25 @@ static FIO_CHANNEL_OUTGOING_CALL_FUNCTION(ftdm_sangoma_isdn_outgoing_call)
|
||||
{
|
||||
sngisdn_chan_data_t *sngisdn_info = ftdmchan->call_data;
|
||||
ftdm_status_t status = FTDM_FAIL;
|
||||
|
||||
switch (ftdmchan->state) {
|
||||
|
||||
case FTDM_CHANNEL_STATE_DOWN:
|
||||
{
|
||||
if (sngisdn_test_flag(sngisdn_info, FLAG_GLARE)) {
|
||||
/* A call came in after we called ftdm_channel_open_chan for this call, but before we got here */
|
||||
ftdm_log_chan_msg(ftdmchan, FTDM_LOG_WARNING, "Glare detected - aborting outgoing call\n");
|
||||
if (ftdmchan->state == FTDM_CHANNEL_STATE_DOWN) {
|
||||
if (sngisdn_test_flag(sngisdn_info, FLAG_GLARE)) {
|
||||
/* A call came in after we called ftdm_channel_open_chan for this call, but before we got here */
|
||||
ftdm_log_chan_msg(ftdmchan, FTDM_LOG_WARNING, "Glare detected - aborting outgoing call\n");
|
||||
|
||||
sngisdn_set_flag(sngisdn_info, FLAG_LOCAL_ABORT);
|
||||
ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_HANGUP_COMPLETE);
|
||||
sngisdn_set_flag(sngisdn_info, FLAG_LOCAL_ABORT);
|
||||
ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_HANGUP_COMPLETE);
|
||||
|
||||
status = FTDM_BREAK;
|
||||
} else {
|
||||
ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_DIALING);
|
||||
status = FTDM_SUCCESS;
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
{
|
||||
/* the channel is already used...this can't be, end the request */
|
||||
ftdm_log_chan_msg(ftdmchan, FTDM_LOG_WARNING, "Outgoing call requested channel in already in use\n");
|
||||
status = FTDM_BREAK;
|
||||
} else {
|
||||
status = FTDM_SUCCESS;
|
||||
}
|
||||
break;
|
||||
} else {
|
||||
/* the channel is already used...this can't be, end the request */
|
||||
ftdm_log_chan(ftdmchan, FTDM_LOG_WARNING, "Outgoing call requested channel in already in use (%s)\n", ftdm_channel_state2str(ftdmchan->state));
|
||||
status = FTDM_BREAK;
|
||||
}
|
||||
|
||||
|
||||
return status;
|
||||
}
|
||||
static FIO_CHANNEL_GET_SIG_STATUS_FUNCTION(ftdm_sangoma_isdn_get_chan_sig_status)
|
||||
@@ -1090,7 +1099,7 @@ static FIO_CONFIGURE_SPAN_SIGNALING_FUNCTION(ftdm_sangoma_isdn_span_config)
|
||||
span->stop = ftdm_sangoma_isdn_stop;
|
||||
span->signal_type = FTDM_SIGTYPE_ISDN;
|
||||
span->outgoing_call = ftdm_sangoma_isdn_outgoing_call;
|
||||
span->send_msg = ftdm_sangoma_isdn_send_msg;
|
||||
span->indicate = ftdm_sangoma_isdn_indicate;
|
||||
span->channel_request = NULL;
|
||||
span->signal_cb = sig_cb;
|
||||
span->get_channel_sig_status = ftdm_sangoma_isdn_get_chan_sig_status;
|
||||
|
||||
@@ -80,6 +80,8 @@ typedef enum {
|
||||
FLAG_ACTIVATING = (1 << 10),
|
||||
/* Used when we receive an ALERT msg + inband tones ready */
|
||||
FLAG_MEDIA_READY = (1 << 11),
|
||||
/* Set when we already sent a Channel ID IE */
|
||||
FLAG_SENT_CHAN_ID = (1 << 12),
|
||||
} sngisdn_flag_t;
|
||||
|
||||
|
||||
@@ -179,6 +181,15 @@ typedef struct sngisdn_chan_data {
|
||||
uint8_t globalFlg;
|
||||
sngisdn_glare_data_t glare;
|
||||
ftdm_timer_id_t timers[SNGISDN_NUM_TIMERS];
|
||||
|
||||
/* variables saved here will be sent to the user application
|
||||
on next SIGEVENT_XXX */
|
||||
ftdm_hash_t* variables;
|
||||
|
||||
/* raw_data saved here will be sent to the user application
|
||||
on next SIGEVENT_XXX */
|
||||
void *raw_data;
|
||||
ftdm_size_t raw_data_len;
|
||||
} sngisdn_chan_data_t;
|
||||
|
||||
/* Span specific data */
|
||||
@@ -414,6 +425,12 @@ ftdm_status_t set_restart_ind_ie(ftdm_channel_t *ftdmchan, RstInd *rstInd);
|
||||
ftdm_status_t set_facility_ie(ftdm_channel_t *ftdmchan, FacilityStr *facilityStr);
|
||||
ftdm_status_t set_facility_ie_str(ftdm_channel_t *ftdmchan, uint8_t *data, uint8_t *data_len);
|
||||
|
||||
|
||||
ftdm_status_t sngisdn_add_var(sngisdn_chan_data_t *sngisdn_info, const char* var, const char* val);
|
||||
ftdm_status_t sngisdn_add_raw_data(sngisdn_chan_data_t *sngisdn_info, uint8_t* data, ftdm_size_t data_len);
|
||||
ftdm_status_t sngisdn_clear_data(sngisdn_chan_data_t *sngisdn_info);
|
||||
void sngisdn_send_signal(sngisdn_chan_data_t *sngisdn_info, ftdm_signal_event_t event_id);
|
||||
|
||||
uint8_t sngisdn_get_infoTranCap_from_user(ftdm_bearer_cap_t bearer_capability);
|
||||
uint8_t sngisdn_get_usrInfoLyr1Prot_from_user(ftdm_user_layer1_prot_t layer1_prot);
|
||||
ftdm_bearer_cap_t sngisdn_get_infoTranCap_from_stack(uint8_t bearer_capability);
|
||||
|
||||
@@ -160,8 +160,12 @@ void sngisdn_process_con_ind (sngisdn_event_data_t *sngisdn_event)
|
||||
}
|
||||
}
|
||||
|
||||
/* this should be in get_facility_ie function, fix this later */
|
||||
if (signal_data->facility == SNGISDN_OPT_TRUE && conEvnt->facilityStr.eh.pres) {
|
||||
#if 1
|
||||
/* this section will not be needed once asn decoding function with key-value pairs is implemented */
|
||||
if (signal_data->facility == SNGISDN_OPT_TRUE &&
|
||||
signal_data->facility_ie_decode != SNGISDN_OPT_FALSE &&
|
||||
conEvnt->facilityStr.eh.pres) {
|
||||
|
||||
/* Verify whether the Caller Name will come in a subsequent FACILITY message */
|
||||
uint16_t ret_val;
|
||||
char retrieved_str[255];
|
||||
@@ -187,6 +191,7 @@ void sngisdn_process_con_ind (sngisdn_event_data_t *sngisdn_event)
|
||||
strcpy(ftdmchan->caller_data.cid_name, retrieved_str);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if (signal_data->overlap_dial == SNGISDN_OPT_TRUE && !conEvnt->sndCmplt.eh.pres) {
|
||||
ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_COLLECT);
|
||||
@@ -829,7 +834,7 @@ void sngisdn_process_fac_ind (sngisdn_event_data_t *sngisdn_event)
|
||||
If there will be no information following, but current FACILITY IE contains a caller name, returns 0
|
||||
If there will be information following, returns 1
|
||||
*/
|
||||
|
||||
|
||||
if (sng_isdn_retrieve_facility_caller_name(&facEvnt->facElmt.facStr.val[2], facEvnt->facElmt.facStr.len, retrieved_str) == 0) {
|
||||
strcpy(ftdmchan->caller_data.cid_name, retrieved_str);
|
||||
} else {
|
||||
|
||||
@@ -156,8 +156,6 @@ void sngisdn_snd_proceed(ftdm_channel_t *ftdmchan, ftdm_sngisdn_progind_t prog_i
|
||||
set_prog_ind_ie(ftdmchan, &cnStEvnt.progInd, prog_ind);
|
||||
set_facility_ie(ftdmchan, &cnStEvnt.facilityStr);
|
||||
|
||||
ftdm_call_clear_data(&ftdmchan->caller_data);
|
||||
|
||||
ftdm_log_chan(ftdmchan, FTDM_LOG_INFO, "Sending PROCEED (suId:%d suInstId:%u spInstId:%u dchan:%d ces:%d)\n", signal_data->cc_id, sngisdn_info->suInstId, sngisdn_info->spInstId, signal_data->dchan_id, sngisdn_info->ces);
|
||||
|
||||
if(sng_isdn_con_status(signal_data->cc_id, sngisdn_info->suInstId, sngisdn_info->spInstId, &cnStEvnt, MI_CALLPROC, signal_data->dchan_id, sngisdn_info->ces)) {
|
||||
@@ -189,7 +187,6 @@ void sngisdn_snd_progress(ftdm_channel_t *ftdmchan, ftdm_sngisdn_progind_t prog_
|
||||
memset(&cnStEvnt, 0, sizeof(cnStEvnt));
|
||||
set_prog_ind_ie(ftdmchan, &cnStEvnt.progInd, prog_ind);
|
||||
set_facility_ie(ftdmchan, &cnStEvnt.facilityStr);
|
||||
ftdm_call_clear_data(&ftdmchan->caller_data);
|
||||
|
||||
ftdm_log_chan(ftdmchan, FTDM_LOG_INFO, "Sending PROGRESS (suId:%d suInstId:%u spInstId:%u dchan:%d ces:%d)\n", signal_data->cc_id, sngisdn_info->suInstId, sngisdn_info->spInstId, signal_data->dchan_id, sngisdn_info->ces);
|
||||
if(sng_isdn_con_status(signal_data->cc_id, sngisdn_info->suInstId, sngisdn_info->spInstId,&cnStEvnt, MI_PROGRESS, signal_data->dchan_id, sngisdn_info->ces)) {
|
||||
@@ -216,7 +213,6 @@ void sngisdn_snd_alert(ftdm_channel_t *ftdmchan, ftdm_sngisdn_progind_t prog_ind
|
||||
|
||||
set_prog_ind_ie(ftdmchan, &cnStEvnt.progInd, prog_ind);
|
||||
set_facility_ie(ftdmchan, &cnStEvnt.facilityStr);
|
||||
ftdm_call_clear_data(&ftdmchan->caller_data);
|
||||
|
||||
ftdm_log_chan(ftdmchan, FTDM_LOG_INFO, "Sending ALERT (suId:%d suInstId:%u spInstId:%u dchan:%d ces:%d)\n", signal_data->cc_id, sngisdn_info->suInstId, sngisdn_info->spInstId, signal_data->dchan_id, sngisdn_info->ces);
|
||||
|
||||
@@ -241,11 +237,10 @@ void sngisdn_snd_connect(ftdm_channel_t *ftdmchan)
|
||||
}
|
||||
|
||||
memset(&cnStEvnt, 0, sizeof(cnStEvnt));
|
||||
|
||||
|
||||
set_chan_id_ie(ftdmchan, &cnStEvnt.chanId);
|
||||
set_prog_ind_ie(ftdmchan, &cnStEvnt.progInd, prog_ind);
|
||||
set_facility_ie(ftdmchan, &cnStEvnt.facilityStr);
|
||||
ftdm_call_clear_data(&ftdmchan->caller_data);
|
||||
|
||||
ftdm_log_chan(ftdmchan, FTDM_LOG_INFO, "Sending CONNECT (suId:%d suInstId:%u spInstId:%u dchan:%d ces:%d)\n", signal_data->cc_id, sngisdn_info->suInstId, sngisdn_info->spInstId, signal_data->dchan_id, sngisdn_info->ces);
|
||||
if (sng_isdn_con_response(signal_data->cc_id, sngisdn_info->suInstId, sngisdn_info->spInstId, &cnStEvnt, signal_data->dchan_id, sngisdn_info->ces)) {
|
||||
@@ -272,14 +267,13 @@ void sngisdn_snd_fac_req(ftdm_channel_t *ftdmchan)
|
||||
/* No point in sending a FACILITY message if there is no Facility IE to transmit */
|
||||
return;
|
||||
}
|
||||
ftdm_call_clear_data(&ftdmchan->caller_data);
|
||||
|
||||
facEvnt.facElmt.eh.pres = PRSNT_NODEF;
|
||||
facEvnt.facElmt.facStr.pres = PRSNT_NODEF;
|
||||
facEvnt.facElmt.facStr.val[0] = 0x1C;
|
||||
facEvnt.facElmt.facStr.val[1] = (uint8_t)facEvnt.facElmt.facStr.len;
|
||||
facEvnt.facElmt.facStr.len +=2; /* Need to include the size of identifier + len */
|
||||
|
||||
|
||||
ftdm_log_chan(ftdmchan, FTDM_LOG_INFO, "Sending FACILITY (suId:%d suInstId:%u spInstId:%u dchan:%d ces:%d)\n", signal_data->cc_id, sngisdn_info->suInstId, sngisdn_info->spInstId, signal_data->dchan_id, sngisdn_info->ces);
|
||||
|
||||
if (sng_isdn_facility_request(signal_data->cc_id, sngisdn_info->suInstId, sngisdn_info->spInstId, &facEvnt, MI_FACIL, signal_data->dchan_id, sngisdn_info->ces)) {
|
||||
@@ -306,7 +300,7 @@ void sngisdn_snd_info_req(ftdm_channel_t *ftdmchan)
|
||||
//ftdm_log_chan_msg(ftdmchan, FTDM_LOG_INFO, "Sending INFO REQ\n");
|
||||
|
||||
|
||||
ftdm_call_clear_data(&ftdmchan->caller_data);
|
||||
|
||||
|
||||
ftdm_log_chan(ftdmchan, FTDM_LOG_INFO, "Sending INFO REQ (suId:%d dchan:%d ces:%d)\n", signal_data->cc_id, signal_data->dchan_id, sngisdn_info->ces);
|
||||
|
||||
@@ -327,8 +321,6 @@ void sngisdn_snd_status_enq(ftdm_channel_t *ftdmchan)
|
||||
//ftdm_log_chan_msg(ftdmchan, FTDM_LOG_INFO, "Sending STATUS ENQ\n");
|
||||
|
||||
memset(&staEvnt, 0, sizeof(StaEvnt));
|
||||
|
||||
ftdm_call_clear_data(&ftdmchan->caller_data);
|
||||
|
||||
ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Sending Status ENQ on suId:%d suInstId:%u spInstId:%d dchan:%d ces:%d\n", signal_data->cc_id, sngisdn_info->suInstId, sngisdn_info->spInstId, signal_data->dchan_id, sngisdn_info->ces);
|
||||
if (sng_isdn_status_request(signal_data->cc_id, sngisdn_info->suInstId, sngisdn_info->spInstId, &staEvnt, MI_STATENQ)) {
|
||||
@@ -367,8 +359,7 @@ void sngisdn_snd_disconnect(ftdm_channel_t *ftdmchan)
|
||||
discEvnt.causeDgn[0].recommend.pres = NOTPRSNT;
|
||||
discEvnt.causeDgn[0].dgnVal.pres = NOTPRSNT;
|
||||
|
||||
set_facility_ie(ftdmchan, &discEvnt.facilityStr);
|
||||
ftdm_call_clear_data(&ftdmchan->caller_data);
|
||||
set_facility_ie(ftdmchan, &discEvnt.facilityStr);
|
||||
|
||||
ftdm_log_chan(ftdmchan, FTDM_LOG_INFO, "Sending DISCONNECT (suId:%d suInstId:%u spInstId:%u)\n", signal_data->cc_id, sngisdn_info->suInstId, sngisdn_info->spInstId);
|
||||
if (sng_isdn_disc_request(signal_data->cc_id, sngisdn_info->suInstId, sngisdn_info->spInstId, &discEvnt)) {
|
||||
@@ -416,7 +407,6 @@ void sngisdn_snd_release(ftdm_channel_t *ftdmchan, uint8_t glare)
|
||||
}
|
||||
|
||||
set_facility_ie(ftdmchan, &relEvnt.facilityStr);
|
||||
ftdm_call_clear_data(&ftdmchan->caller_data);
|
||||
|
||||
ftdm_log_chan(ftdmchan, FTDM_LOG_INFO, "Sending RELEASE/RELEASE COMPLETE (suId:%d suInstId:%u spInstId:%u)\n", signal_data->cc_id, suInstId, spInstId);
|
||||
|
||||
|
||||
@@ -225,26 +225,26 @@ ftdm_status_t get_calling_num2(ftdm_channel_t *ftdmchan, CgPtyNmb *cgPtyNmb)
|
||||
}
|
||||
|
||||
if (cgPtyNmb->screenInd.pres == PRSNT_NODEF) {
|
||||
ftdm_call_add_var(caller_data, "isdn.cg_pty2.screen_ind", ftdm_screening2str(cgPtyNmb->screenInd.val));
|
||||
sngisdn_add_var((sngisdn_chan_data_t*)ftdmchan->call_data, "isdn.cg_pty2.screen_ind", ftdm_screening2str(cgPtyNmb->screenInd.val));
|
||||
}
|
||||
|
||||
if (cgPtyNmb->presInd0.pres == PRSNT_NODEF) {
|
||||
ftdm_call_add_var(caller_data, "isdn.cg_pty2.presentation_ind", ftdm_presentation2str(cgPtyNmb->presInd0.val));
|
||||
sngisdn_add_var((sngisdn_chan_data_t*)ftdmchan->call_data, "isdn.cg_pty2.presentation_ind", ftdm_presentation2str(cgPtyNmb->presInd0.val));
|
||||
}
|
||||
|
||||
if (cgPtyNmb->nmbPlanId.pres == PRSNT_NODEF) {
|
||||
ftdm_call_add_var(caller_data, "isdn.cg_pty2.npi", ftdm_npi2str(cgPtyNmb->nmbPlanId.val));
|
||||
sngisdn_add_var((sngisdn_chan_data_t*)ftdmchan->call_data, "isdn.cg_pty2.npi", ftdm_npi2str(cgPtyNmb->nmbPlanId.val));
|
||||
}
|
||||
|
||||
if (cgPtyNmb->typeNmb1.pres == PRSNT_NODEF) {
|
||||
ftdm_call_add_var(caller_data, "isdn.cg_pty2.ton", ftdm_ton2str(cgPtyNmb->typeNmb1.val));
|
||||
sngisdn_add_var((sngisdn_chan_data_t*)ftdmchan->call_data, "isdn.cg_pty2.ton", ftdm_ton2str(cgPtyNmb->typeNmb1.val));
|
||||
}
|
||||
|
||||
if (cgPtyNmb->nmbDigits.pres == PRSNT_NODEF) {
|
||||
char digits_string [32];
|
||||
memcpy(digits_string, (const char*)cgPtyNmb->nmbDigits.val, cgPtyNmb->nmbDigits.len);
|
||||
digits_string[cgPtyNmb->nmbDigits.len] = '\0';
|
||||
ftdm_call_add_var(caller_data, "isdn.cg_pty2.digits", digits_string);
|
||||
sngisdn_add_var((sngisdn_chan_data_t*)ftdmchan->call_data, "isdn.cg_pty2.digits", digits_string);
|
||||
}
|
||||
memcpy(&caller_data->ani, &caller_data->cid_num, sizeof(caller_data->ani));
|
||||
return FTDM_SUCCESS;
|
||||
@@ -253,6 +253,7 @@ ftdm_status_t get_calling_num2(ftdm_channel_t *ftdmchan, CgPtyNmb *cgPtyNmb)
|
||||
ftdm_status_t get_called_num(ftdm_channel_t *ftdmchan, CdPtyNmb *cdPtyNmb)
|
||||
{
|
||||
ftdm_caller_data_t *caller_data = &ftdmchan->caller_data;
|
||||
|
||||
if (cdPtyNmb->eh.pres != PRSNT_NODEF) {
|
||||
return FTDM_FAIL;
|
||||
}
|
||||
@@ -343,7 +344,7 @@ ftdm_status_t get_calling_subaddr(ftdm_channel_t *ftdmchan, CgPtySad *cgPtySad)
|
||||
|
||||
memcpy(subaddress, (char*)cgPtySad->sadInfo.val, cgPtySad->sadInfo.len);
|
||||
subaddress[cgPtySad->sadInfo.len] = '\0';
|
||||
ftdm_call_add_var(&ftdmchan->caller_data, "isdn.calling_subaddr", subaddress);
|
||||
sngisdn_add_var((sngisdn_chan_data_t*)ftdmchan->call_data, "isdn.calling_subaddr", subaddress);
|
||||
return FTDM_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -358,21 +359,19 @@ ftdm_status_t get_facility_ie(ftdm_channel_t *ftdmchan, FacilityStr *facilityStr
|
||||
|
||||
ftdm_status_t get_facility_ie_str(ftdm_channel_t *ftdmchan, uint8_t *data, uint8_t data_len)
|
||||
{
|
||||
ftdm_caller_data_t *caller_data = &ftdmchan->caller_data;
|
||||
sngisdn_span_data_t *signal_data = (sngisdn_span_data_t*) ftdmchan->span->signal_data;
|
||||
|
||||
if (signal_data->facility_ie_decode == SNGISDN_OPT_FALSE) {
|
||||
/* size of facilityStr->facilityStr.len is a uint8_t so no need to check
|
||||
for overflow here as facilityStr->facilityStr.len will always be smaller
|
||||
than sizeof(caller_data->raw_data) */
|
||||
/* Max size of Facility IE is 255 */
|
||||
uint8_t my_data [255];
|
||||
|
||||
memset(caller_data->raw_data, 0, sizeof(caller_data->raw_data));
|
||||
/* Always include Facility IE identifier + len so this can be used as a sanity check by the user */
|
||||
caller_data->raw_data[0] = SNGISDN_Q931_FACILITY_IE_ID;
|
||||
caller_data->raw_data[1] = data_len;
|
||||
|
||||
memcpy(&caller_data->raw_data[2], data, data_len);
|
||||
caller_data->raw_data_len = data_len+2;
|
||||
my_data[0] = SNGISDN_Q931_FACILITY_IE_ID;
|
||||
my_data[1] = data_len;
|
||||
memcpy(&my_data[2], data, data_len);
|
||||
|
||||
sngisdn_add_raw_data((sngisdn_chan_data_t*)ftdmchan->call_data, data, data_len+2);
|
||||
|
||||
ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Raw Facility IE copied available\n");
|
||||
} else {
|
||||
/* Call libsng_isdn to process facility IE's here */
|
||||
@@ -382,7 +381,7 @@ ftdm_status_t get_facility_ie_str(ftdm_channel_t *ftdmchan, uint8_t *data, uint8
|
||||
|
||||
ftdm_status_t get_prog_ind_ie(ftdm_channel_t *ftdmchan, ProgInd *progInd)
|
||||
{
|
||||
uint8_t val;
|
||||
uint8_t val;
|
||||
if (!progInd->eh.pres) {
|
||||
return FTDM_FAIL;
|
||||
}
|
||||
@@ -412,7 +411,7 @@ ftdm_status_t get_prog_ind_ie(ftdm_channel_t *ftdmchan, ProgInd *progInd)
|
||||
val = SNGISDN_PROGIND_DESCR_INVALID;
|
||||
break;
|
||||
}
|
||||
ftdm_call_add_var(&ftdmchan->caller_data, "isdn.prog_ind.descr", ftdm_sngisdn_progind_descr2str(val));
|
||||
sngisdn_add_var((sngisdn_chan_data_t*)ftdmchan->call_data, "isdn.prog_ind.descr", ftdm_sngisdn_progind_descr2str(val));
|
||||
}
|
||||
|
||||
if (progInd->location.pres) {
|
||||
@@ -443,7 +442,7 @@ ftdm_status_t get_prog_ind_ie(ftdm_channel_t *ftdmchan, ProgInd *progInd)
|
||||
val = SNGISDN_PROGIND_LOC_INVALID;
|
||||
break;
|
||||
}
|
||||
ftdm_call_add_var(&ftdmchan->caller_data, "isdn.prog_ind.loc", ftdm_sngisdn_progind_loc2str(val));
|
||||
sngisdn_add_var((sngisdn_chan_data_t*)ftdmchan->call_data, "isdn.prog_ind.loc", ftdm_sngisdn_progind_loc2str(val));
|
||||
}
|
||||
return FTDM_SUCCESS;
|
||||
}
|
||||
@@ -493,7 +492,7 @@ ftdm_status_t set_calling_num2(ftdm_channel_t *ftdmchan, CgPtyNmb *cgPtyNmb)
|
||||
uint8_t len,val;
|
||||
ftdm_caller_data_t *caller_data = &ftdmchan->caller_data;
|
||||
|
||||
string = ftdm_call_get_var(caller_data, "isdn.cg_pty2.digits");
|
||||
string = ftdm_usrmsg_get_var(ftdmchan->usrmsg, "isdn.cg_pty2.digits");
|
||||
if ((string == NULL) || !(*string)) {
|
||||
return FTDM_FAIL;
|
||||
}
|
||||
@@ -510,7 +509,7 @@ ftdm_status_t set_calling_num2(ftdm_channel_t *ftdmchan, CgPtyNmb *cgPtyNmb)
|
||||
cgPtyNmb->screenInd.pres = PRSNT_NODEF;
|
||||
|
||||
val = FTDM_SCREENING_INVALID;
|
||||
string = ftdm_call_get_var(caller_data, "isdn.cg_pty2.screening_ind");
|
||||
string = ftdm_usrmsg_get_var(ftdmchan->usrmsg, "isdn.cg_pty2.screening_ind");
|
||||
if ((string != NULL) && (*string)) {
|
||||
val = ftdm_str2ftdm_screening(string);
|
||||
}
|
||||
@@ -527,7 +526,7 @@ ftdm_status_t set_calling_num2(ftdm_channel_t *ftdmchan, CgPtyNmb *cgPtyNmb)
|
||||
cgPtyNmb->presInd0.pres = PRSNT_NODEF;
|
||||
|
||||
val = FTDM_PRES_INVALID;
|
||||
string = ftdm_call_get_var(caller_data, "isdn.cg_pty2.presentation_ind");
|
||||
string = ftdm_usrmsg_get_var(ftdmchan->usrmsg, "isdn.cg_pty2.presentation_ind");
|
||||
if ((string != NULL) && (*string)) {
|
||||
val = ftdm_str2ftdm_presentation(string);
|
||||
}
|
||||
@@ -542,7 +541,7 @@ ftdm_status_t set_calling_num2(ftdm_channel_t *ftdmchan, CgPtyNmb *cgPtyNmb)
|
||||
cgPtyNmb->nmbPlanId.pres = PRSNT_NODEF;
|
||||
|
||||
val = FTDM_NPI_INVALID;
|
||||
string = ftdm_call_get_var(caller_data, "isdn.cg_pty2.npi");
|
||||
string = ftdm_usrmsg_get_var(ftdmchan->usrmsg, "isdn.cg_pty2.npi");
|
||||
if ((string != NULL) && (*string)) {
|
||||
val = ftdm_str2ftdm_npi(string);
|
||||
}
|
||||
@@ -557,7 +556,7 @@ ftdm_status_t set_calling_num2(ftdm_channel_t *ftdmchan, CgPtyNmb *cgPtyNmb)
|
||||
|
||||
/* Type of Number */
|
||||
val = FTDM_TON_INVALID;
|
||||
string = ftdm_call_get_var(caller_data, "isdn.cg_pty2.ton");
|
||||
string = ftdm_usrmsg_get_var(ftdmchan->usrmsg, "isdn.cg_pty2.ton");
|
||||
if ((string != NULL) && (*string)) {
|
||||
val = ftdm_str2ftdm_ton(string);
|
||||
}
|
||||
@@ -691,7 +690,7 @@ ftdm_status_t set_calling_name(ftdm_channel_t *ftdmchan, ConEvnt *conEvnt)
|
||||
ftdm_status_t set_calling_subaddr(ftdm_channel_t *ftdmchan, CgPtySad *cgPtySad)
|
||||
{
|
||||
const char* clg_subaddr = NULL;
|
||||
clg_subaddr = ftdm_call_get_var(&ftdmchan->caller_data, "isdn.calling_subaddr");
|
||||
clg_subaddr = ftdm_usrmsg_get_var(ftdmchan->usrmsg, "isdn.calling_subaddr");
|
||||
if ((clg_subaddr != NULL) && (*clg_subaddr)) {
|
||||
unsigned len = strlen (clg_subaddr);
|
||||
cgPtySad->eh.pres = PRSNT_NODEF;
|
||||
@@ -721,14 +720,19 @@ ftdm_status_t set_facility_ie(ftdm_channel_t *ftdmchan, FacilityStr *facilityStr
|
||||
|
||||
ftdm_status_t set_facility_ie_str(ftdm_channel_t *ftdmchan, uint8_t *data, uint8_t *data_len)
|
||||
{
|
||||
int len;
|
||||
ftdm_caller_data_t *caller_data = &ftdmchan->caller_data;
|
||||
if (caller_data->raw_data_len > 0 && caller_data->raw_data[0] == SNGISDN_Q931_FACILITY_IE_ID) {
|
||||
len = caller_data->raw_data[1];
|
||||
memcpy(data, &caller_data->raw_data[2], len);
|
||||
*data_len = len;
|
||||
return FTDM_SUCCESS;
|
||||
}
|
||||
ftdm_size_t len;
|
||||
uint8_t *mydata;
|
||||
void *vdata;
|
||||
|
||||
if (ftdm_usrmsg_get_raw_data(ftdmchan->usrmsg, &vdata, &len) == FTDM_SUCCESS) {
|
||||
mydata = vdata;
|
||||
if (len > 2 && mydata[0] == SNGISDN_Q931_FACILITY_IE_ID) {
|
||||
len = mydata[1];
|
||||
memcpy(data, &mydata[2], len);
|
||||
*data_len = len;
|
||||
return FTDM_SUCCESS;
|
||||
}
|
||||
}
|
||||
return FTDM_FAIL;
|
||||
}
|
||||
|
||||
@@ -738,7 +742,7 @@ ftdm_status_t set_prog_ind_ie(ftdm_channel_t *ftdmchan, ProgInd *progInd, ftdm_s
|
||||
int descr = prog_ind.descr;
|
||||
int loc = prog_ind.loc;
|
||||
|
||||
str = ftdm_call_get_var(&ftdmchan->caller_data, "isdn.prog_ind.descr");
|
||||
str = ftdm_usrmsg_get_var(ftdmchan->usrmsg, "isdn.prog_ind.descr");
|
||||
if (str && *str) {
|
||||
/* User wants to override progress indicator */
|
||||
descr = ftdm_str2ftdm_sngisdn_progind_descr(str);
|
||||
@@ -749,7 +753,7 @@ ftdm_status_t set_prog_ind_ie(ftdm_channel_t *ftdmchan, ProgInd *progInd, ftdm_s
|
||||
return FTDM_SUCCESS;
|
||||
}
|
||||
|
||||
str = ftdm_call_get_var(&ftdmchan->caller_data, "isdn.prog_ind.loc");
|
||||
str = ftdm_usrmsg_get_var(ftdmchan->usrmsg, "isdn.prog_ind.loc");
|
||||
if (str && *str) {
|
||||
loc = ftdm_str2ftdm_sngisdn_progind_loc(str);
|
||||
}
|
||||
@@ -821,9 +825,17 @@ ftdm_status_t set_prog_ind_ie(ftdm_channel_t *ftdmchan, ProgInd *progInd, ftdm_s
|
||||
|
||||
ftdm_status_t set_chan_id_ie(ftdm_channel_t *ftdmchan, ChanId *chanId)
|
||||
{
|
||||
sngisdn_chan_data_t *sngisdn_info = (sngisdn_chan_data_t*)ftdmchan->call_data;
|
||||
if (!ftdmchan) {
|
||||
return FTDM_SUCCESS;
|
||||
}
|
||||
|
||||
if (ftdm_test_flag(sngisdn_info, FLAG_SENT_CHAN_ID)) {
|
||||
/* Indicate channel ID only in first response */
|
||||
return FTDM_SUCCESS;
|
||||
}
|
||||
ftdm_set_flag(sngisdn_info, FLAG_SENT_CHAN_ID);
|
||||
|
||||
chanId->eh.pres = PRSNT_NODEF;
|
||||
chanId->prefExc.pres = PRSNT_NODEF;
|
||||
chanId->prefExc.val = IN_PE_EXCLSVE;
|
||||
@@ -861,7 +873,7 @@ ftdm_status_t set_chan_id_ie(ftdm_channel_t *ftdmchan, ChanId *chanId)
|
||||
ftdm_status_t set_bear_cap_ie(ftdm_channel_t *ftdmchan, BearCap *bearCap)
|
||||
{
|
||||
sngisdn_span_data_t *signal_data = (sngisdn_span_data_t*) ftdmchan->span->signal_data;
|
||||
|
||||
|
||||
bearCap->eh.pres = PRSNT_NODEF;
|
||||
bearCap->infoTranCap.pres = PRSNT_NODEF;
|
||||
bearCap->infoTranCap.val = sngisdn_get_infoTranCap_from_user(ftdmchan->caller_data.bearer_capability);
|
||||
@@ -1194,6 +1206,74 @@ void sngisdn_print_spans(ftdm_stream_handle_t *stream)
|
||||
return;
|
||||
}
|
||||
|
||||
ftdm_status_t sngisdn_add_var(sngisdn_chan_data_t *sngisdn_info, const char* var, const char* val)
|
||||
{
|
||||
char *t_name = 0, *t_val = 0;
|
||||
if (!var || !val) {
|
||||
return FTDM_FAIL;
|
||||
}
|
||||
if (!sngisdn_info->variables) {
|
||||
/* initialize on first use */
|
||||
sngisdn_info->variables = create_hashtable(16, ftdm_hash_hashfromstring, ftdm_hash_equalkeys);
|
||||
ftdm_assert_return(sngisdn_info->variables, FTDM_FAIL, "Failed to create hash table\n");
|
||||
}
|
||||
t_name = ftdm_strdup(var);
|
||||
t_val = ftdm_strdup(val);
|
||||
hashtable_insert(sngisdn_info->variables, t_name, t_val, HASHTABLE_FLAG_FREE_KEY | HASHTABLE_FLAG_FREE_VALUE);
|
||||
return FTDM_SUCCESS;
|
||||
}
|
||||
|
||||
ftdm_status_t sngisdn_add_raw_data(sngisdn_chan_data_t *sngisdn_info, uint8_t* data, ftdm_size_t data_len)
|
||||
{
|
||||
ftdm_assert_return(!sngisdn_info->raw_data, FTDM_FAIL, "Overwriting existing raw data\n");
|
||||
|
||||
sngisdn_info->raw_data = ftdm_calloc(1, data_len);
|
||||
ftdm_assert_return(sngisdn_info->raw_data, FTDM_FAIL, "Failed to allocate raw data\n");
|
||||
|
||||
memcpy(sngisdn_info->raw_data, data, data_len);
|
||||
sngisdn_info->raw_data_len = data_len;
|
||||
return FTDM_SUCCESS;
|
||||
}
|
||||
|
||||
void sngisdn_send_signal(sngisdn_chan_data_t *sngisdn_info, ftdm_signal_event_t event_id)
|
||||
{
|
||||
ftdm_sigmsg_t sigev;
|
||||
ftdm_channel_t *ftdmchan = sngisdn_info->ftdmchan;
|
||||
|
||||
memset(&sigev, 0, sizeof(sigev));
|
||||
|
||||
sigev.chan_id = ftdmchan->chan_id;
|
||||
sigev.span_id = ftdmchan->span_id;
|
||||
sigev.channel = ftdmchan;
|
||||
sigev.event_id = event_id;
|
||||
|
||||
if (sngisdn_info->variables) {
|
||||
/*
|
||||
* variables now belongs to the ftdm core, and
|
||||
* will be cleared after sigev is processed by user. Set
|
||||
* local pointer to NULL so we do not attempt to
|
||||
* destroy it */
|
||||
sigev.variables = sngisdn_info->variables;
|
||||
sngisdn_info->variables = NULL;
|
||||
}
|
||||
|
||||
if (sngisdn_info->raw_data) {
|
||||
/*
|
||||
* raw_data now belongs to the ftdm core, and
|
||||
* will be cleared after sigev is processed by user. Set
|
||||
* local pointer to NULL so we do not attempt to
|
||||
* destroy it */
|
||||
|
||||
sigev.raw.data = sngisdn_info->raw_data;
|
||||
sigev.raw.len = sngisdn_info->raw_data_len;
|
||||
|
||||
sngisdn_info->raw_data = NULL;
|
||||
sngisdn_info->raw_data_len = 0;
|
||||
}
|
||||
ftdm_span_send_signal(ftdmchan->span, &sigev);
|
||||
}
|
||||
|
||||
|
||||
/* For Emacs:
|
||||
* Local Variables:
|
||||
* mode:c
|
||||
|
||||
@@ -139,7 +139,6 @@ void sngisdn_trace_raw_q921(sngisdn_span_data_t *signal_data, ftdm_trace_dir_t d
|
||||
memcpy(raw_data, data, data_len);
|
||||
sigev.raw.data = raw_data;
|
||||
sigev.raw.len = data_len;
|
||||
sigev.raw.autofree = 1;
|
||||
ftdm_span_send_signal(signal_data->ftdm_span, &sigev);
|
||||
}
|
||||
|
||||
@@ -241,6 +240,11 @@ void sngisdn_trace_raw_q931(sngisdn_span_data_t *signal_data, ftdm_trace_dir_t d
|
||||
sigev.span_id = ftdmchan->physical_span_id;
|
||||
sigev.chan_id = ftdmchan->physical_chan_id;
|
||||
sigev.channel = ftdmchan;
|
||||
} else {
|
||||
/* We could not map the channel, but at least set the span */
|
||||
if (signal_data->ftdm_span->channels[1]) {
|
||||
sigev.span_id = signal_data->ftdm_span->channels[1]->physical_span_id;
|
||||
}
|
||||
}
|
||||
sigev.event_id = FTDM_SIGEVENT_TRACE_RAW;
|
||||
|
||||
@@ -253,7 +257,6 @@ void sngisdn_trace_raw_q931(sngisdn_span_data_t *signal_data, ftdm_trace_dir_t d
|
||||
memcpy(raw_data, data, data_len);
|
||||
sigev.raw.data = raw_data;
|
||||
sigev.raw.len = data_len;
|
||||
sigev.raw.autofree = 1;
|
||||
ftdm_span_send_signal(signal_data->ftdm_span, &sigev);
|
||||
}
|
||||
}
|
||||
@@ -833,9 +836,10 @@ static ftdm_status_t sngisdn_get_frame_info(uint8_t *data, uint32_t data_len, ft
|
||||
//ftdm_log(FTDM_LOG_DEBUG, "Decoded IE:%s\n", get_code_2_str(ie_id, dcodQ931IEIDTable));
|
||||
}
|
||||
if (!bchan_no) {
|
||||
uint32_t tmp_len = 0;
|
||||
char tmp[1000];
|
||||
print_hex_dump(tmp, 0, data, 0, data_len);
|
||||
ftdm_log(FTDM_LOG_WARNING, "Failed to determine b-channel on SETUP message\n%s\n", tmp);
|
||||
print_hex_dump(tmp, &tmp_len, data, 0, data_len);
|
||||
ftdm_log(FTDM_LOG_DEBUG, "Failed to determine b-channel on SETUP message\n%s\n", tmp);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -83,8 +83,8 @@ static ftdm_status_t handle_tx_lpr(ftdm_stream_handle_t *stream, char *name);
|
||||
static ftdm_status_t handle_status_mtp3link(ftdm_stream_handle_t *stream, char *name);
|
||||
static ftdm_status_t handle_status_mtp2link(ftdm_stream_handle_t *stream, char *name);
|
||||
static ftdm_status_t handle_status_linkset(ftdm_stream_handle_t *stream, char *name);
|
||||
|
||||
static ftdm_status_t handle_status_relay(ftdm_stream_handle_t *stream, char *name);
|
||||
static ftdm_status_t handle_status_isup_ckt(ftdm_stream_handle_t *stream, char *id_name);
|
||||
|
||||
static ftdm_status_t extract_span_chan(char *argv[10], int pos, int *span, int *chan);
|
||||
static ftdm_status_t check_arg_count(int args, int min);
|
||||
@@ -149,6 +149,25 @@ ftdm_status_t ftdm_sngss7_handle_cli_cmd(ftdm_stream_handle_t *stream, const cha
|
||||
|
||||
handle_show_status(stream, span, chan, verbose);
|
||||
/******************************************************************/
|
||||
} else if (!strcasecmp(argv[c], "isup")) {
|
||||
/******************************************************************/
|
||||
if (check_arg_count(argc, 4)) goto handle_cli_error_argc;
|
||||
c++;
|
||||
|
||||
if (!strcasecmp(argv[c], "ckt")) {
|
||||
/**************************************************************/
|
||||
if (check_arg_count(argc, 5)) goto handle_cli_error_argc;
|
||||
c++;
|
||||
|
||||
handle_status_isup_ckt(stream, argv[c]);
|
||||
/**************************************************************/
|
||||
} else {
|
||||
/**************************************************************/
|
||||
stream->write_function(stream, "Unknown \"status isup\" command\n");
|
||||
goto handle_cli_error;
|
||||
/**************************************************************/
|
||||
}
|
||||
/******************************************************************/
|
||||
} else {
|
||||
/******************************************************************/
|
||||
stream->write_function(stream, "Unknown \"status\" command\n");
|
||||
@@ -1037,37 +1056,37 @@ static ftdm_status_t handle_show_blocks(ftdm_stream_handle_t *stream, int span,
|
||||
ftdmchan->physical_chan_id,
|
||||
ss7_info->circuit->cic);
|
||||
|
||||
if((sngss7_test_ckt_flag(ss7_info, FLAG_CKT_MN_BLOCK_TX)) || (sngss7_test_ckt_flag(ss7_info, FLAG_GRP_MN_BLOCK_TX))) {
|
||||
if((sngss7_test_ckt_blk_flag(ss7_info, FLAG_CKT_MN_BLOCK_TX)) || (sngss7_test_ckt_blk_flag(ss7_info, FLAG_GRP_MN_BLOCK_TX))) {
|
||||
stream->write_function(stream, "l_mn=Y|");
|
||||
}else {
|
||||
stream->write_function(stream, "l_mn=N|");
|
||||
}
|
||||
|
||||
if((sngss7_test_ckt_flag(ss7_info, FLAG_CKT_MN_BLOCK_RX)) || (sngss7_test_ckt_flag(ss7_info, FLAG_GRP_MN_BLOCK_RX))) {
|
||||
if((sngss7_test_ckt_blk_flag(ss7_info, FLAG_CKT_MN_BLOCK_RX)) || (sngss7_test_ckt_blk_flag(ss7_info, FLAG_GRP_MN_BLOCK_RX))) {
|
||||
stream->write_function(stream, "r_mn=Y|");
|
||||
}else {
|
||||
stream->write_function(stream, "r_mn=N|");
|
||||
}
|
||||
|
||||
if(sngss7_test_ckt_flag(ss7_info, FLAG_GRP_HW_BLOCK_TX)) {
|
||||
if(sngss7_test_ckt_blk_flag(ss7_info, FLAG_GRP_HW_BLOCK_TX)) {
|
||||
stream->write_function(stream, "l_hw=Y|");
|
||||
}else {
|
||||
stream->write_function(stream, "l_hw=N|");
|
||||
}
|
||||
|
||||
if(sngss7_test_ckt_flag(ss7_info, FLAG_GRP_HW_BLOCK_RX)) {
|
||||
if(sngss7_test_ckt_blk_flag(ss7_info, FLAG_GRP_HW_BLOCK_RX)) {
|
||||
stream->write_function(stream, "r_hw=Y|");
|
||||
}else {
|
||||
stream->write_function(stream, "r_hw=N|");
|
||||
}
|
||||
|
||||
if(sngss7_test_ckt_flag(ss7_info, FLAG_CKT_LC_BLOCK_RX)) {
|
||||
if(sngss7_test_ckt_blk_flag(ss7_info, FLAG_CKT_LC_BLOCK_RX)) {
|
||||
stream->write_function(stream, "l_mngmt=Y|");
|
||||
}else {
|
||||
stream->write_function(stream, "l_mngmt=N|");
|
||||
}
|
||||
|
||||
if(sngss7_test_ckt_flag(ss7_info, FLAG_CKT_UCIC_BLOCK)) {
|
||||
if(sngss7_test_ckt_blk_flag(ss7_info, FLAG_CKT_UCIC_BLOCK)) {
|
||||
stream->write_function(stream, "l_ucic=Y|");
|
||||
}else {
|
||||
stream->write_function(stream, "l_ucic=N|");
|
||||
@@ -1142,48 +1161,47 @@ static ftdm_status_t handle_show_status(ftdm_stream_handle_t *stream, int span,
|
||||
/* grab the signaling_status */
|
||||
ftdm_channel_get_sig_status(ftdmchan, &sigstatus);
|
||||
|
||||
stream->write_function(stream, "span=%2d|chan=%2d|cic=%4d|sig_status=%4s|state=%s|",
|
||||
stream->write_function(stream, "span=%2d|chan=%2d|cic=%4d|ckt=%4d|sig_status=%4s|state=%s|",
|
||||
ckt->span,
|
||||
ckt->chan,
|
||||
ckt->cic,
|
||||
ckt->id,
|
||||
ftdm_signaling_status2str(sigstatus),
|
||||
ftdm_channel_state2str(ftdmchan->state));
|
||||
|
||||
if ((sngss7_test_ckt_flag(ss7_info, FLAG_CKT_MN_BLOCK_TX)) ||
|
||||
(sngss7_test_ckt_flag(ss7_info, FLAG_GRP_MN_BLOCK_TX))) {
|
||||
if ((sngss7_test_ckt_blk_flag(ss7_info, FLAG_CKT_MN_BLOCK_TX)) ||
|
||||
(sngss7_test_ckt_blk_flag(ss7_info, FLAG_GRP_MN_BLOCK_TX))) {
|
||||
stream->write_function(stream, "l_mn=Y|");
|
||||
}else {
|
||||
stream->write_function(stream, "l_mn=N|");
|
||||
}
|
||||
|
||||
if ((sngss7_test_ckt_flag(ss7_info, FLAG_CKT_MN_BLOCK_RX)) ||
|
||||
(sngss7_test_ckt_flag(ss7_info, FLAG_GRP_MN_BLOCK_RX))) {
|
||||
if ((sngss7_test_ckt_blk_flag(ss7_info, FLAG_CKT_MN_BLOCK_RX)) ||
|
||||
(sngss7_test_ckt_blk_flag(ss7_info, FLAG_GRP_MN_BLOCK_RX))) {
|
||||
stream->write_function(stream, "r_mn=Y|");
|
||||
}else {
|
||||
stream->write_function(stream, "r_mn=N|");
|
||||
}
|
||||
|
||||
if (sngss7_test_ckt_flag(ss7_info, FLAG_GRP_HW_BLOCK_TX)) {
|
||||
if (sngss7_test_ckt_blk_flag(ss7_info, FLAG_GRP_HW_BLOCK_TX)) {
|
||||
stream->write_function(stream, "l_hw=Y|");
|
||||
}else {
|
||||
stream->write_function(stream, "l_hw=N|");
|
||||
}
|
||||
|
||||
if (sngss7_test_ckt_flag(ss7_info, FLAG_GRP_HW_BLOCK_RX)) {
|
||||
if (sngss7_test_ckt_blk_flag(ss7_info, FLAG_GRP_HW_BLOCK_RX)) {
|
||||
stream->write_function(stream, "r_hw=Y|");
|
||||
}else {
|
||||
stream->write_function(stream, "r_hw=N|");
|
||||
}
|
||||
|
||||
if (sngss7_test_ckt_flag(ss7_info, FLAG_RELAY_DOWN)) {
|
||||
stream->write_function(stream, "relay=Y|");
|
||||
stream->write_function(stream, "relay=Y");
|
||||
}else {
|
||||
stream->write_function(stream, "relay=N|");
|
||||
stream->write_function(stream, "relay=N");
|
||||
}
|
||||
}
|
||||
|
||||
stream->write_function(stream, "flags=0x%X",ss7_info->ckt_flags);
|
||||
|
||||
|
||||
stream->write_function(stream, "\n");
|
||||
} /* if ( hole, sig, voice) */
|
||||
} /* if ( span and chan) */
|
||||
@@ -1237,10 +1255,10 @@ static ftdm_status_t handle_tx_blo(ftdm_stream_handle_t *stream, int span, int c
|
||||
continue;
|
||||
} else {
|
||||
/* throw the ckt block flag */
|
||||
sngss7_set_ckt_flag(ss7_info, FLAG_CKT_MN_BLOCK_TX);
|
||||
sngss7_set_ckt_blk_flag(ss7_info, FLAG_CKT_MN_BLOCK_TX);
|
||||
|
||||
/* set the channel to suspended state */
|
||||
ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_SUSPENDED);
|
||||
ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_SUSPENDED);
|
||||
}
|
||||
|
||||
/* unlock the channel again before we exit */
|
||||
@@ -1303,13 +1321,13 @@ static ftdm_status_t handle_tx_ubl(ftdm_stream_handle_t *stream, int span, int c
|
||||
continue;
|
||||
} else {
|
||||
/* throw the ckt block flag */
|
||||
sngss7_set_ckt_flag(ss7_info, FLAG_CKT_MN_UNBLK_TX);
|
||||
sngss7_set_ckt_blk_flag(ss7_info, FLAG_CKT_MN_UNBLK_TX);
|
||||
|
||||
/* clear the block flag */
|
||||
sngss7_clear_ckt_flag(ss7_info, FLAG_CKT_MN_BLOCK_TX);
|
||||
sngss7_clear_ckt_blk_flag(ss7_info, FLAG_CKT_MN_BLOCK_TX);
|
||||
|
||||
/* set the channel to suspended state */
|
||||
ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_SUSPENDED);
|
||||
ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_SUSPENDED);
|
||||
}
|
||||
|
||||
/* unlock the channel again before we exit */
|
||||
@@ -1554,12 +1572,12 @@ static ftdm_status_t handle_tx_rsc(ftdm_stream_handle_t *stream, int span, int c
|
||||
/**************************************************************************/
|
||||
case FTDM_CHANNEL_STATE_RESTART:
|
||||
/* go to idle so that we can redo the restart state*/
|
||||
ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_IDLE);
|
||||
ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_IDLE);
|
||||
break;
|
||||
/**************************************************************************/
|
||||
default:
|
||||
/* set the state of the channel to restart...the rest is done by the chan monitor */
|
||||
ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_RESTART);
|
||||
ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_RESTART);
|
||||
break;
|
||||
/**************************************************************************/
|
||||
}
|
||||
@@ -1627,7 +1645,7 @@ static ftdm_status_t handle_tx_grs(ftdm_stream_handle_t *stream, int span, int c
|
||||
}
|
||||
|
||||
/* set the channel to suspended state */
|
||||
ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_RESTART);
|
||||
ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_RESTART);
|
||||
|
||||
}
|
||||
|
||||
@@ -1701,15 +1719,10 @@ static ftdm_status_t handle_tx_cgb(ftdm_stream_handle_t *stream, int span, int c
|
||||
ftdm_mutex_lock(ftdmchan->mutex);
|
||||
|
||||
/* throw the grp maint. block flag */
|
||||
sngss7_set_ckt_flag(sngss7_info, FLAG_GRP_MN_BLOCK_TX);
|
||||
sngss7_set_ckt_blk_flag(sngss7_info, FLAG_GRP_MN_BLOCK_TX);
|
||||
|
||||
/* bring the sig status down */
|
||||
sigev.chan_id = ftdmchan->chan_id;
|
||||
sigev.span_id = ftdmchan->span_id;
|
||||
sigev.channel = ftdmchan;
|
||||
sigev.event_id = FTDM_SIGEVENT_SIGSTATUS_CHANGED;
|
||||
sigev.ev_data.sigstatus.status = FTDM_SIG_STATE_DOWN;
|
||||
ftdm_span_send_signal(ftdmchan->span, &sigev);
|
||||
sngss7_set_sig_status(sngss7_info, FTDM_SIG_STATE_DOWN);
|
||||
|
||||
/* if this is the first channel in the range */
|
||||
if (ftdmchan->physical_chan_id == chan) {
|
||||
@@ -1801,15 +1814,10 @@ static ftdm_status_t handle_tx_cgu(ftdm_stream_handle_t *stream, int span, int c
|
||||
ftdm_mutex_lock(ftdmchan->mutex);
|
||||
|
||||
/* throw the grp maint. block flag */
|
||||
sngss7_clear_ckt_flag(sngss7_info, FLAG_GRP_MN_BLOCK_TX);
|
||||
sngss7_clear_ckt_blk_flag(sngss7_info, FLAG_GRP_MN_BLOCK_TX);
|
||||
|
||||
/* bring the sig status up */
|
||||
sigev.chan_id = ftdmchan->chan_id;
|
||||
sigev.span_id = ftdmchan->span_id;
|
||||
sigev.channel = ftdmchan;
|
||||
sigev.event_id = FTDM_SIGEVENT_SIGSTATUS_CHANGED;
|
||||
sigev.ev_data.sigstatus.status = FTDM_SIG_STATE_UP;
|
||||
ftdm_span_send_signal(ftdmchan->span, &sigev);
|
||||
sngss7_set_sig_status(sngss7_info, FTDM_SIG_STATE_UP);
|
||||
|
||||
/* if this is the first channel in the range */
|
||||
if (ftdmchan->physical_chan_id == chan) {
|
||||
@@ -2154,6 +2162,184 @@ success:
|
||||
return FTDM_SUCCESS;
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
static ftdm_status_t handle_status_isup_ckt(ftdm_stream_handle_t *stream, char *id_name)
|
||||
{
|
||||
sng_isup_ckt_t *ckt;
|
||||
sngss7_chan_data_t *ss7_info;
|
||||
ftdm_channel_t *ftdmchan;
|
||||
uint32_t id;
|
||||
uint8_t state = 0;
|
||||
uint8_t bits_ab = 0;
|
||||
uint8_t bits_cd = 0;
|
||||
uint8_t bits_ef = 0;
|
||||
|
||||
/* extract the integer version of the id (ckt) */
|
||||
id = atoi(id_name);
|
||||
|
||||
/* extract the global config circuit structure */
|
||||
ckt = &g_ftdm_sngss7_data.cfg.isupCkt[id];
|
||||
|
||||
/* confirm the ckt exists */
|
||||
if (ckt->id == 0) {
|
||||
stream->write_function(stream, "Requested ckt does not exist (%d)\n", id);
|
||||
return FTDM_FAIL;
|
||||
}
|
||||
|
||||
/* confirm the ckt is a voice channel */
|
||||
if (ckt->type != VOICE) {
|
||||
stream->write_function(stream, "Requested ckt is a sig link/hole and can not be queried (%d)\n", id);
|
||||
return FTDM_FAIL;
|
||||
}
|
||||
|
||||
/* extract the global structure */
|
||||
ss7_info = (sngss7_chan_data_t *)g_ftdm_sngss7_data.cfg.isupCkt[id].obj;
|
||||
ftdmchan = ss7_info->ftdmchan;
|
||||
|
||||
/* query the isup stack for the state of the ckt */
|
||||
if (ftmod_ss7_isup_ckt_sta(ckt->id, &state)) {
|
||||
stream->write_function(stream, "Failed to read isup ckt =%d status\n", id);
|
||||
return FTDM_FAIL;
|
||||
}
|
||||
|
||||
|
||||
stream->write_function(stream, "span=%2d|chan=%2d|cic=%4d|ckt=%4d|state=0x%02X|",
|
||||
ckt->span,
|
||||
ckt->chan,
|
||||
ckt->cic,
|
||||
ckt->id,
|
||||
state);
|
||||
|
||||
/* extract the bit sections */
|
||||
bits_ab = (state & (SNG_BIT_A + SNG_BIT_B)) >> 0;
|
||||
|
||||
bits_cd = (state & (SNG_BIT_C + SNG_BIT_D)) >> 2;
|
||||
|
||||
bits_ef = (state & (SNG_BIT_E + SNG_BIT_F)) >> 4;
|
||||
|
||||
/* check bits C and D */
|
||||
switch (bits_cd) {
|
||||
/**************************************************************************/
|
||||
case (0):
|
||||
/* ckt is either un-equipped or transient, check bits A and B */
|
||||
switch (bits_ab) {
|
||||
/**********************************************************************/
|
||||
case (0):
|
||||
/* bit a and bit are cleared, transient */
|
||||
stream->write_function(stream, "transient\n");
|
||||
goto success;
|
||||
break;
|
||||
/**********************************************************************/
|
||||
case (1):
|
||||
case (2):
|
||||
/* bit a or bit b are set, spare ... shouldn't happen */
|
||||
stream->write_function(stream, "spare\n");
|
||||
goto success;
|
||||
break;
|
||||
/**********************************************************************/
|
||||
case (3):
|
||||
/* bit a and bit b are set, unequipped */
|
||||
stream->write_function(stream, "unequipped\n");
|
||||
goto success;
|
||||
break;
|
||||
/**********************************************************************/
|
||||
default:
|
||||
stream->write_function(stream, "invalid values for bits A and B (%d)\n",
|
||||
bits_ab);
|
||||
goto success;
|
||||
break;
|
||||
/**********************************************************************/
|
||||
} /* switch (bits_ab) */
|
||||
|
||||
/* shouldn't get here but have a break for properness */
|
||||
break;
|
||||
/**************************************************************************/
|
||||
case (1):
|
||||
/* circuit incoming busy */
|
||||
stream->write_function(stream, "incoming busy");
|
||||
break;
|
||||
/**************************************************************************/
|
||||
case (2):
|
||||
/* circuit outgoing busy */
|
||||
stream->write_function(stream, "outgoing busy");
|
||||
break;
|
||||
/**************************************************************************/
|
||||
case (3):
|
||||
/* circuit idle */
|
||||
stream->write_function(stream, "idle");
|
||||
break;
|
||||
/**************************************************************************/
|
||||
default:
|
||||
/* invalid */
|
||||
stream->write_function(stream, "bits C and D are invalid (%d)!\n",
|
||||
bits_cd);
|
||||
goto success;
|
||||
/**************************************************************************/
|
||||
} /* switch (bits_cd) */
|
||||
|
||||
/* check the maintenance block status in bits A and B */
|
||||
switch (bits_ab) {
|
||||
/**************************************************************************/
|
||||
case (0):
|
||||
/* no maintenace block...do nothing */
|
||||
break;
|
||||
/**************************************************************************/
|
||||
case (1):
|
||||
/* locally blocked */
|
||||
stream->write_function(stream, "|l_mn");
|
||||
break;
|
||||
/**************************************************************************/
|
||||
case (2):
|
||||
/* remotely blocked */
|
||||
stream->write_function(stream, "|r_mn");
|
||||
break;
|
||||
/**************************************************************************/
|
||||
case (3):
|
||||
/* both locally and remotely blocked */
|
||||
stream->write_function(stream, "|l_mn|r_mn");
|
||||
break;
|
||||
/**************************************************************************/
|
||||
default:
|
||||
stream->write_function(stream, "bits A and B are invlaid (%d)!\n",
|
||||
bits_ab);
|
||||
goto success;
|
||||
/**************************************************************************/
|
||||
} /* switch (bits_ab) */
|
||||
|
||||
/* check the hardware block status in bits e and f */
|
||||
switch (bits_ef) {
|
||||
/**************************************************************************/
|
||||
case (0):
|
||||
/* no maintenace block...do nothing */
|
||||
break;
|
||||
/**************************************************************************/
|
||||
case (1):
|
||||
/* locally blocked */
|
||||
stream->write_function(stream, "|l_hw");
|
||||
break;
|
||||
/**************************************************************************/
|
||||
case (2):
|
||||
/* remotely blocked */
|
||||
stream->write_function(stream, "|r_hw");
|
||||
break;
|
||||
/**************************************************************************/
|
||||
case (3):
|
||||
/* both locally and remotely blocked */
|
||||
stream->write_function(stream, "|l_hw|r_hw");
|
||||
break;
|
||||
/**************************************************************************/
|
||||
default:
|
||||
stream->write_function(stream, "bits E and F are invlaid (%d)!\n",
|
||||
bits_ef);
|
||||
goto success;
|
||||
/**************************************************************************/
|
||||
} /* switch (bits_ef) */
|
||||
|
||||
success:
|
||||
stream->write_function(stream, "\n");
|
||||
return FTDM_SUCCESS;
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
static ftdm_status_t extract_span_chan(char *argv[10], int pos, int *span, int *chan)
|
||||
{
|
||||
|
||||
@@ -101,19 +101,17 @@ ftdm_status_t handle_con_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circ
|
||||
|
||||
if (sngss7_test_ckt_flag(sngss7_info, FLAG_GLARE)) {
|
||||
SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Rx IAM (glare)\n", sngss7_info->circuit->cic);
|
||||
} else {
|
||||
SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Rx IAM\n", sngss7_info->circuit->cic);
|
||||
}
|
||||
}
|
||||
|
||||
/* check if the circuit has a remote block */
|
||||
if ((sngss7_test_ckt_flag(sngss7_info, FLAG_CKT_MN_BLOCK_RX)) ||
|
||||
(sngss7_test_ckt_flag(sngss7_info, FLAG_GRP_HW_BLOCK_RX)) ||
|
||||
(sngss7_test_ckt_flag(sngss7_info, FLAG_GRP_MN_BLOCK_RX))) {
|
||||
if ((sngss7_test_ckt_blk_flag(sngss7_info, FLAG_CKT_MN_BLOCK_RX)) ||
|
||||
(sngss7_test_ckt_blk_flag(sngss7_info, FLAG_GRP_HW_BLOCK_RX)) ||
|
||||
(sngss7_test_ckt_blk_flag(sngss7_info, FLAG_GRP_MN_BLOCK_RX))) {
|
||||
|
||||
/* as per Q.764, 2.8.2.3 xiv ... remove the block from this channel */
|
||||
sngss7_clear_ckt_flag(sngss7_info, FLAG_CKT_MN_BLOCK_RX);
|
||||
sngss7_clear_ckt_flag(sngss7_info, FLAG_GRP_HW_BLOCK_RX);
|
||||
sngss7_clear_ckt_flag(sngss7_info, FLAG_GRP_MN_BLOCK_RX);
|
||||
sngss7_clear_ckt_blk_flag(sngss7_info, FLAG_CKT_MN_BLOCK_RX);
|
||||
sngss7_clear_ckt_blk_flag(sngss7_info, FLAG_GRP_HW_BLOCK_RX);
|
||||
sngss7_clear_ckt_blk_flag(sngss7_info, FLAG_GRP_MN_BLOCK_RX);
|
||||
|
||||
/* KONRAD FIX ME : check in case there is a ckt and grp block */
|
||||
}
|
||||
@@ -139,7 +137,7 @@ ftdm_status_t handle_con_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circ
|
||||
ftdmchan->caller_data.hangup_cause = 41;
|
||||
|
||||
/* move the state to CANCEL */
|
||||
ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_CANCEL);
|
||||
ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_CANCEL);
|
||||
|
||||
} else {
|
||||
|
||||
@@ -211,11 +209,10 @@ ftdm_status_t handle_con_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circ
|
||||
|
||||
/* add any special variables for the dialplan */
|
||||
sprintf(nadi, "%d", siConEvnt->cgPtyNum.natAddrInd.val);
|
||||
ftdm_call_add_var(&ftdmchan->caller_data, "ss7_clg_nadi", nadi);
|
||||
sngss7_add_var(sngss7_info, "ss7_clg_nadi", nadi);
|
||||
|
||||
sprintf(nadi, "%d", siConEvnt->cdPtyNum.natAddrInd.val);
|
||||
ftdm_call_add_var(&ftdmchan->caller_data, "ss7_cld_nadi", nadi);
|
||||
|
||||
sngss7_add_var(sngss7_info, "ss7_cld_nadi", nadi);
|
||||
|
||||
/* check if a COT test is requested */
|
||||
if ((siConEvnt->natConInd.eh.pres) &&
|
||||
@@ -228,12 +225,19 @@ ftdm_status_t handle_con_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circ
|
||||
ftdm_channel_command(ftdmchan, FTDM_COMMAND_ENABLE_LOOP, NULL);
|
||||
|
||||
/* move to in loop state */
|
||||
ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_IN_LOOP);
|
||||
ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_IN_LOOP);
|
||||
} else {
|
||||
/* set the state of the channel to collecting...the rest is done by the chan monitor */
|
||||
ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_COLLECT);
|
||||
ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_COLLECT);
|
||||
}
|
||||
|
||||
SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Rx IAM clg = \"%s\" (NADI=%d), cld = \"%s\" (NADI=%d)\n",
|
||||
sngss7_info->circuit->cic,
|
||||
ftdmchan->caller_data.cid_num.digits,
|
||||
siConEvnt->cgPtyNum.natAddrInd.val,
|
||||
ftdmchan->caller_data.dnis.digits,
|
||||
siConEvnt->cdPtyNum.natAddrInd.val);
|
||||
|
||||
} /* if (channel is usable */
|
||||
|
||||
break;
|
||||
@@ -264,7 +268,7 @@ handle_glare:
|
||||
sngss7_set_ckt_flag(sngss7_info, FLAG_REMOTE_REL);
|
||||
|
||||
/* move the state of the channel to Terminating to end the call */
|
||||
ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_TERMINATING);
|
||||
ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_TERMINATING);
|
||||
} /* if (!(sngss7_test_ckt_flag(sngss7_info, FLAG_GLARE))) */
|
||||
break;
|
||||
/**************************************************************************/
|
||||
@@ -275,7 +279,7 @@ handle_glare:
|
||||
sngss7_set_ckt_flag(sngss7_info, FLAG_RESET_TX);
|
||||
|
||||
/* move the state of the channel to RESTART to force a reset */
|
||||
ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_RESTART);
|
||||
ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_RESTART);
|
||||
|
||||
break;
|
||||
/**************************************************************************/
|
||||
@@ -324,14 +328,14 @@ ftdm_status_t handle_con_sta(uint32_t suInstId, uint32_t spInstId, uint32_t circ
|
||||
|
||||
if (siCnStEvnt->optBckCalInd.inbndInfoInd.val) {
|
||||
/* go to PROGRESS_MEDIA */
|
||||
ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_PROGRESS_MEDIA);
|
||||
ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_PROGRESS_MEDIA);
|
||||
} else {
|
||||
/* go to PROGRESS */
|
||||
ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_PROGRESS);
|
||||
ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_PROGRESS);
|
||||
} /* if (inband) */
|
||||
} else {
|
||||
/* go to PROGRESS_MEDIA */
|
||||
ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_PROGRESS_MEDIA);
|
||||
ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_PROGRESS_MEDIA);
|
||||
}
|
||||
|
||||
break;
|
||||
@@ -344,7 +348,7 @@ ftdm_status_t handle_con_sta(uint32_t suInstId, uint32_t spInstId, uint32_t circ
|
||||
sngss7_set_ckt_flag(sngss7_info, FLAG_RESET_TX);
|
||||
|
||||
/* go to RESTART */
|
||||
ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_RESTART);
|
||||
ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_RESTART);
|
||||
break;
|
||||
/**********************************************************************/
|
||||
} /* switch (ftdmchan->state) */
|
||||
@@ -398,7 +402,7 @@ ftdm_status_t handle_con_sta(uint32_t suInstId, uint32_t spInstId, uint32_t circ
|
||||
}
|
||||
|
||||
/* go to idle so that collect state is processed again */
|
||||
ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_IDLE);
|
||||
ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_IDLE);
|
||||
|
||||
break;
|
||||
/**********************************************************************/
|
||||
@@ -527,7 +531,7 @@ ftdm_status_t handle_con_cfm(uint32_t suInstId, uint32_t spInstId, uint32_t circ
|
||||
SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Rx ANM\n", sngss7_info->circuit->cic);
|
||||
|
||||
/* go to UP */
|
||||
ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_UP);
|
||||
ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_UP);
|
||||
|
||||
break;
|
||||
/**************************************************************************/
|
||||
@@ -536,7 +540,7 @@ ftdm_status_t handle_con_cfm(uint32_t suInstId, uint32_t spInstId, uint32_t circ
|
||||
SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Rx CON\n", sngss7_info->circuit->cic);
|
||||
|
||||
/* go to UP */
|
||||
ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_UP);
|
||||
ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_UP);
|
||||
|
||||
break;
|
||||
/**************************************************************************/
|
||||
@@ -548,7 +552,7 @@ ftdm_status_t handle_con_cfm(uint32_t suInstId, uint32_t spInstId, uint32_t circ
|
||||
sngss7_set_ckt_flag(sngss7_info, FLAG_GRP_RESET_TX);
|
||||
|
||||
/* go to RESTART */
|
||||
ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_RESTART);
|
||||
ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_RESTART);
|
||||
|
||||
break;
|
||||
/**************************************************************************/
|
||||
@@ -600,7 +604,7 @@ ftdm_status_t handle_rel_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circ
|
||||
sngss7_set_ckt_flag(sngss7_info, FLAG_REMOTE_REL);
|
||||
ftdm_channel_command(ftdmchan, FTDM_COMMAND_DISABLE_LOOP, NULL);
|
||||
/* move the state of the channel to CANCEL to end the call */
|
||||
ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_TERMINATING);
|
||||
ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_TERMINATING);
|
||||
|
||||
break;
|
||||
/**************************************************************************/
|
||||
@@ -621,7 +625,7 @@ ftdm_channel_command(ftdmchan, FTDM_COMMAND_DISABLE_LOOP, NULL);
|
||||
sngss7_set_ckt_flag(sngss7_info, FLAG_REMOTE_REL);
|
||||
|
||||
/* move the state of the channel to TERMINATING to end the call */
|
||||
ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_TERMINATING);
|
||||
ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_TERMINATING);
|
||||
|
||||
break;
|
||||
/**************************************************************************/
|
||||
@@ -634,7 +638,7 @@ ftdm_channel_command(ftdmchan, FTDM_COMMAND_DISABLE_LOOP, NULL);
|
||||
sngss7_set_ckt_flag(sngss7_info, FLAG_REMOTE_REL);
|
||||
|
||||
/* go to hangup complete to send the RLC */
|
||||
ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_HANGUP_COMPLETE);
|
||||
ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_HANGUP_COMPLETE);
|
||||
|
||||
/* save the call info for the RLC */
|
||||
sngss7_info->suInstId = get_unique_id();
|
||||
@@ -648,7 +652,7 @@ ftdm_channel_command(ftdmchan, FTDM_COMMAND_DISABLE_LOOP, NULL);
|
||||
sngss7_set_ckt_flag(sngss7_info, FLAG_RESET_RX);
|
||||
|
||||
/* set the state to RESTART */
|
||||
ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_RESTART);
|
||||
ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_RESTART);
|
||||
break;
|
||||
/**************************************************************************/
|
||||
} /* switch (ftdmchan->state) */
|
||||
@@ -687,7 +691,7 @@ ftdm_status_t handle_rel_cfm(uint32_t suInstId, uint32_t spInstId, uint32_t circ
|
||||
case FTDM_CHANNEL_STATE_HANGUP_COMPLETE:
|
||||
|
||||
/* go to DOWN */
|
||||
ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_DOWN);
|
||||
ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_DOWN);
|
||||
|
||||
break;
|
||||
/**************************************************************************/
|
||||
@@ -699,7 +703,7 @@ ftdm_status_t handle_rel_cfm(uint32_t suInstId, uint32_t spInstId, uint32_t circ
|
||||
/* KONRAD: should just stop the call...but a reset is easier for now (since it does hangup the call) */
|
||||
|
||||
/* go to RESTART */
|
||||
ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_RESTART);
|
||||
ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_RESTART);
|
||||
|
||||
break;
|
||||
/**************************************************************************/
|
||||
@@ -1152,7 +1156,7 @@ ftdm_status_t handle_reattempt(uint32_t suInstId, uint32_t spInstId, uint32_t ci
|
||||
sngss7_set_ckt_flag(sngss7_info, FLAG_REMOTE_REL);
|
||||
|
||||
/* move the state of the channel to Terminating to end the call */
|
||||
ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_TERMINATING);
|
||||
ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_TERMINATING);
|
||||
}
|
||||
|
||||
/* unlock the channel again before we exit */
|
||||
@@ -1201,6 +1205,9 @@ ftdm_status_t handle_pause(uint32_t suInstId, uint32_t spInstId, uint32_t circui
|
||||
SS7_DEBUG_CHAN(ftdmchan, "Rx PAUSE%s\n", "");
|
||||
/* set the pause flag on the channel */
|
||||
sngss7_set_ckt_flag(sngss7_info, FLAG_INFID_PAUSED);
|
||||
|
||||
/* clear the resume flag on the channel */
|
||||
sngss7_set_ckt_flag(sngss7_info, FLAG_INFID_RESUME);
|
||||
}
|
||||
|
||||
/* unlock the channel again before we exit */
|
||||
@@ -1308,7 +1315,7 @@ ftdm_status_t handle_cot_start(uint32_t suInstId, uint32_t spInstId, uint32_t ci
|
||||
ftdm_channel_command(ftdmchan, FTDM_COMMAND_ENABLE_LOOP, NULL);
|
||||
|
||||
/* switch to the IN_LOOP state */
|
||||
ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_IN_LOOP);
|
||||
ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_IN_LOOP);
|
||||
|
||||
/* unlock the channel again before we exit */
|
||||
ftdm_mutex_unlock(ftdmchan->mutex);
|
||||
@@ -1339,7 +1346,7 @@ ftdm_status_t handle_cot_stop(uint32_t suInstId, uint32_t spInstId, uint32_t cir
|
||||
ftdm_channel_command(ftdmchan, FTDM_COMMAND_DISABLE_LOOP, NULL);
|
||||
|
||||
/* exit out of the LOOP state to the last state */
|
||||
ftdm_set_state_locked(ftdmchan, ftdmchan->last_state);
|
||||
ftdm_set_state(ftdmchan, ftdmchan->last_state);
|
||||
|
||||
/* unlock the channel again before we exit */
|
||||
ftdm_mutex_unlock(ftdmchan->mutex);
|
||||
@@ -1373,13 +1380,13 @@ ftdm_status_t handle_cot(uint32_t suInstId, uint32_t spInstId, uint32_t circuit,
|
||||
ftdm_channel_command(ftdmchan, FTDM_COMMAND_DISABLE_LOOP, NULL);
|
||||
|
||||
/* exit out of the LOOP state and go to collect */
|
||||
ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_COLLECT);
|
||||
ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_COLLECT);
|
||||
|
||||
break;
|
||||
/**************************************************************************/
|
||||
default:
|
||||
/* exit out of the LOOP state to the last state */
|
||||
ftdm_set_state_locked(ftdmchan, ftdmchan->last_state);
|
||||
ftdm_set_state(ftdmchan, ftdmchan->last_state);
|
||||
|
||||
break;
|
||||
/**************************************************************************/
|
||||
@@ -1421,15 +1428,15 @@ ftdm_status_t handle_blo_req(uint32_t suInstId, uint32_t spInstId, uint32_t circ
|
||||
ftdm_mutex_lock(ftdmchan->mutex);
|
||||
|
||||
/* check if the circuit is already blocked or not */
|
||||
if (sngss7_test_ckt_flag(sngss7_info, FLAG_CKT_MN_BLOCK_RX)) {
|
||||
if (sngss7_test_ckt_blk_flag(sngss7_info, FLAG_CKT_MN_BLOCK_RX)) {
|
||||
SS7_WARN("Received BLO on circuit that is already blocked!\n");
|
||||
}
|
||||
|
||||
/* throw the ckt block flag */
|
||||
sngss7_set_ckt_flag(sngss7_info, FLAG_CKT_MN_BLOCK_RX);
|
||||
sngss7_set_ckt_blk_flag(sngss7_info, FLAG_CKT_MN_BLOCK_RX);
|
||||
|
||||
/* set the channel to suspended state */
|
||||
ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_SUSPENDED);
|
||||
ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_SUSPENDED);
|
||||
|
||||
/* unlock the channel again before we exit */
|
||||
ftdm_mutex_unlock(ftdmchan->mutex);
|
||||
@@ -1484,18 +1491,18 @@ ftdm_status_t handle_ubl_req(uint32_t suInstId, uint32_t spInstId, uint32_t circ
|
||||
ftdm_mutex_lock(ftdmchan->mutex);
|
||||
|
||||
/* check if the channel is blocked */
|
||||
if (!(sngss7_test_ckt_flag(sngss7_info, FLAG_CKT_MN_BLOCK_RX))) {
|
||||
if (!(sngss7_test_ckt_blk_flag(sngss7_info, FLAG_CKT_MN_BLOCK_RX))) {
|
||||
SS7_WARN("Received UBL on circuit that is not blocked!\n");
|
||||
}
|
||||
|
||||
/* throw the unblock flag */
|
||||
sngss7_set_ckt_flag(sngss7_info, FLAG_CKT_MN_UNBLK_RX);
|
||||
sngss7_set_ckt_blk_flag(sngss7_info, FLAG_CKT_MN_UNBLK_RX);
|
||||
|
||||
/* clear the block flag */
|
||||
sngss7_clear_ckt_flag(sngss7_info, FLAG_CKT_MN_BLOCK_RX);
|
||||
sngss7_clear_ckt_blk_flag(sngss7_info, FLAG_CKT_MN_BLOCK_RX);
|
||||
|
||||
/* set the channel to suspended state */
|
||||
ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_SUSPENDED);
|
||||
ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_SUSPENDED);
|
||||
|
||||
/* unlock the channel again before we exit */
|
||||
ftdm_mutex_unlock(ftdmchan->mutex);
|
||||
@@ -1557,14 +1564,14 @@ ftdm_status_t handle_rsc_req(uint32_t suInstId, uint32_t spInstId, uint32_t circ
|
||||
case FTDM_CHANNEL_STATE_RESTART:
|
||||
|
||||
/* go to idle so that we can redo the restart state*/
|
||||
ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_IDLE);
|
||||
ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_IDLE);
|
||||
|
||||
break;
|
||||
/**************************************************************************/
|
||||
default:
|
||||
|
||||
/* set the state of the channel to restart...the rest is done by the chan monitor */
|
||||
ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_RESTART);
|
||||
ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_RESTART);
|
||||
break;
|
||||
/**************************************************************************/
|
||||
}
|
||||
@@ -1602,14 +1609,14 @@ ftdm_status_t handle_local_rsc_req(uint32_t suInstId, uint32_t spInstId, uint32_
|
||||
case FTDM_CHANNEL_STATE_RESTART:
|
||||
|
||||
/* go to idle so that we can redo the restart state*/
|
||||
ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_IDLE);
|
||||
ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_IDLE);
|
||||
|
||||
break;
|
||||
/**************************************************************************/
|
||||
default:
|
||||
|
||||
/* set the state of the channel to restart...the rest is done by the chan monitor */
|
||||
ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_RESTART);
|
||||
ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_RESTART);
|
||||
break;
|
||||
/**************************************************************************/
|
||||
}
|
||||
@@ -1648,7 +1655,7 @@ ftdm_status_t handle_rsc_rsp(uint32_t suInstId, uint32_t spInstId, uint32_t circ
|
||||
sngss7_set_ckt_flag(sngss7_info, FLAG_RESET_TX_RSP);
|
||||
|
||||
/* go to DOWN */
|
||||
ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_DOWN);
|
||||
ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_DOWN);
|
||||
} else {
|
||||
SS7_ERROR("Received RSC-RLC but we're not waiting on a RSC-RLC on CIC #, dropping\n", sngss7_info->circuit->cic);
|
||||
}
|
||||
@@ -1670,7 +1677,7 @@ ftdm_status_t handle_rsc_rsp(uint32_t suInstId, uint32_t spInstId, uint32_t circ
|
||||
sngss7_set_ckt_flag(sngss7_info, FLAG_RESET_TX_RSP);
|
||||
|
||||
/* go to DOWN */
|
||||
/*ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_DOWN);*/
|
||||
/*ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_DOWN);*/
|
||||
|
||||
break;
|
||||
/**********************************************************************/
|
||||
@@ -1684,7 +1691,7 @@ ftdm_status_t handle_rsc_rsp(uint32_t suInstId, uint32_t spInstId, uint32_t circ
|
||||
ftdmchan->caller_data.hangup_cause = 98; /* Message not compatiable with call state */
|
||||
}
|
||||
|
||||
ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_TERMINATING);
|
||||
ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_TERMINATING);
|
||||
break;
|
||||
/**********************************************************************/
|
||||
}
|
||||
@@ -1795,15 +1802,15 @@ ftdm_status_t handle_local_blk(uint32_t suInstId, uint32_t spInstId, uint32_t ci
|
||||
ftdm_mutex_lock(ftdmchan->mutex);
|
||||
|
||||
/* check if the circuit is already blocked or not */
|
||||
if (sngss7_test_ckt_flag(sngss7_info, FLAG_CKT_LC_BLOCK_RX)) {
|
||||
if (sngss7_test_ckt_blk_flag(sngss7_info, FLAG_CKT_LC_BLOCK_RX)) {
|
||||
SS7_WARN("Received local BLO on circuit that is already blocked!\n");
|
||||
}
|
||||
|
||||
/* throw the ckt block flag */
|
||||
sngss7_set_ckt_flag(sngss7_info, FLAG_CKT_LC_BLOCK_RX);
|
||||
sngss7_set_ckt_blk_flag(sngss7_info, FLAG_CKT_LC_BLOCK_RX);
|
||||
|
||||
/* set the channel to suspended state */
|
||||
ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_SUSPENDED);
|
||||
ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_SUSPENDED);
|
||||
|
||||
/* unlock the channel again before we exit */
|
||||
ftdm_mutex_unlock(ftdmchan->mutex);
|
||||
@@ -1831,15 +1838,15 @@ ftdm_status_t handle_local_ubl(uint32_t suInstId, uint32_t spInstId, uint32_t ci
|
||||
ftdm_mutex_lock(ftdmchan->mutex);
|
||||
|
||||
/* check if the circuit is already blocked or not */
|
||||
if (sngss7_test_ckt_flag(sngss7_info, FLAG_CKT_LC_UNBLK_RX)) {
|
||||
if (sngss7_test_ckt_blk_flag(sngss7_info, FLAG_CKT_LC_UNBLK_RX)) {
|
||||
SS7_WARN("Received local UBL on circuit that is already unblocked!\n");
|
||||
}
|
||||
|
||||
/* throw the ckt block flag */
|
||||
sngss7_set_ckt_flag(sngss7_info, FLAG_CKT_LC_UNBLK_RX);
|
||||
sngss7_set_ckt_blk_flag(sngss7_info, FLAG_CKT_LC_UNBLK_RX);
|
||||
|
||||
/* set the channel to suspended state */
|
||||
ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_SUSPENDED);
|
||||
ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_SUSPENDED);
|
||||
|
||||
/* unlock the channel again before we exit */
|
||||
ftdm_mutex_unlock(ftdmchan->mutex);
|
||||
@@ -1878,10 +1885,10 @@ ftdm_status_t handle_ucic(uint32_t suInstId, uint32_t spInstId, uint32_t circuit
|
||||
ftdm_mutex_lock(ftdmchan->mutex);
|
||||
|
||||
/* throw the ckt block flag */
|
||||
sngss7_set_ckt_flag(sngss7_info, FLAG_CKT_UCIC_BLOCK);
|
||||
sngss7_set_ckt_blk_flag(sngss7_info, FLAG_CKT_UCIC_BLOCK);
|
||||
|
||||
/* set the channel to suspended state */
|
||||
ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_SUSPENDED);
|
||||
ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_SUSPENDED);
|
||||
|
||||
/* unlock the channel again before we exit */
|
||||
ftdm_mutex_unlock(ftdmchan->mutex);
|
||||
@@ -1904,9 +1911,7 @@ ftdm_status_t handle_cgb_req(uint32_t suInstId, uint32_t spInstId, uint32_t circ
|
||||
int byte = 0;
|
||||
int bit = 0;
|
||||
int x;
|
||||
ftdm_sigmsg_t sigev;
|
||||
|
||||
memset(&sigev, 0, sizeof (sigev));
|
||||
memset(&status[0], '\0', sizeof(status));
|
||||
|
||||
/* get the ftdmchan and ss7_chan_data from the circuit */
|
||||
@@ -1982,11 +1987,11 @@ ftdm_status_t handle_cgb_req(uint32_t suInstId, uint32_t spInstId, uint32_t circ
|
||||
switch (blockType) {
|
||||
/**********************************************************************/
|
||||
case 0: /* maintenance oriented */
|
||||
sngss7_set_ckt_flag(sngss7_info, FLAG_GRP_MN_BLOCK_RX);
|
||||
sngss7_set_ckt_blk_flag(sngss7_info, FLAG_GRP_MN_BLOCK_RX);
|
||||
break;
|
||||
/**********************************************************************/
|
||||
case 1: /* hardware failure oriented */
|
||||
sngss7_set_ckt_flag(sngss7_info, FLAG_GRP_HW_BLOCK_RX);
|
||||
sngss7_set_ckt_blk_flag(sngss7_info, FLAG_GRP_HW_BLOCK_RX);
|
||||
break;
|
||||
/**********************************************************************/
|
||||
case 2: /* reserved for national use */
|
||||
@@ -1998,14 +2003,8 @@ ftdm_status_t handle_cgb_req(uint32_t suInstId, uint32_t spInstId, uint32_t circ
|
||||
} /* switch (blockType) */
|
||||
}
|
||||
|
||||
sigev.chan_id = ftdmchan->chan_id;
|
||||
sigev.span_id = ftdmchan->span_id;
|
||||
sigev.channel = ftdmchan;
|
||||
|
||||
/* bring the sig status down */
|
||||
sigev.event_id = FTDM_SIGEVENT_SIGSTATUS_CHANGED;
|
||||
sigev.ev_data.sigstatus.status = FTDM_SIG_STATE_DOWN;
|
||||
ftdm_span_send_signal(ftdmchan->span, &sigev);
|
||||
sngss7_set_sig_status(sngss7_info, FTDM_SIG_STATE_DOWN);
|
||||
|
||||
/* unlock the channel again before we exit */
|
||||
ftdm_mutex_unlock(ftdmchan->mutex);
|
||||
@@ -2113,11 +2112,11 @@ ftdm_status_t handle_cgu_req(uint32_t suInstId, uint32_t spInstId, uint32_t circ
|
||||
switch (blockType) {
|
||||
/**********************************************************************/
|
||||
case 0: /* maintenance oriented */
|
||||
sngss7_clear_ckt_flag(sngss7_info, FLAG_GRP_MN_BLOCK_RX);
|
||||
sngss7_clear_ckt_blk_flag(sngss7_info, FLAG_GRP_MN_BLOCK_RX);
|
||||
break;
|
||||
/**********************************************************************/
|
||||
case 1: /* hardware failure oriented */
|
||||
sngss7_clear_ckt_flag(sngss7_info, FLAG_GRP_HW_BLOCK_RX);
|
||||
sngss7_clear_ckt_blk_flag(sngss7_info, FLAG_GRP_HW_BLOCK_RX);
|
||||
break;
|
||||
/**********************************************************************/
|
||||
case 2: /* reserved for national use */
|
||||
@@ -2134,9 +2133,7 @@ ftdm_status_t handle_cgu_req(uint32_t suInstId, uint32_t spInstId, uint32_t circ
|
||||
sigev.channel = ftdmchan;
|
||||
|
||||
/* bring the sig status down */
|
||||
sigev.event_id = FTDM_SIGEVENT_SIGSTATUS_CHANGED;
|
||||
sigev.ev_data.sigstatus.status = FTDM_SIG_STATE_UP;
|
||||
ftdm_span_send_signal(ftdmchan->span, &sigev);
|
||||
sngss7_set_sig_status(sngss7_info, FTDM_SIG_STATE_UP);
|
||||
|
||||
/* unlock the channel again before we exit */
|
||||
ftdm_mutex_unlock(ftdmchan->mutex);
|
||||
|
||||
@@ -492,21 +492,17 @@ static void ftdm_sangoma_ss7_process_stack_event (sngss7_event_data_t *sngss7_ev
|
||||
ftdm_status_t ftdm_sangoma_ss7_process_state_change (ftdm_channel_t * ftdmchan)
|
||||
{
|
||||
sngss7_chan_data_t *sngss7_info = ftdmchan->call_data;
|
||||
sng_isup_inf_t *isup_intf = NULL;
|
||||
sng_isup_inf_t *isup_intf = NULL;
|
||||
int state_flag = 1;
|
||||
int i = 0;
|
||||
ftdm_sigmsg_t sigev;
|
||||
|
||||
memset (&sigev, 0, sizeof (sigev));
|
||||
|
||||
sigev.chan_id = ftdmchan->chan_id;
|
||||
sigev.span_id = ftdmchan->span_id;
|
||||
sigev.channel = ftdmchan;
|
||||
|
||||
SS7_DEBUG_CHAN(ftdmchan, "ftmod_sangoma_ss7 processing state %s\n", ftdm_channel_state2str (ftdmchan->state));
|
||||
|
||||
#if 0
|
||||
/* clear the state change flag...since we might be setting a new state */
|
||||
ftdm_channel_complete_state(ftdmchan);
|
||||
|
||||
#endif
|
||||
|
||||
/*check what state we are supposed to be in */
|
||||
switch (ftdmchan->state) {
|
||||
/**************************************************************************/
|
||||
@@ -529,13 +525,15 @@ ftdm_status_t ftdm_sangoma_ss7_process_state_change (ftdm_channel_t * ftdmchan)
|
||||
ftdmchan->caller_data.dnis.digits[i-1] = '\0';
|
||||
|
||||
/*now go to the RING state */
|
||||
ftdm_set_state_locked (ftdmchan, FTDM_CHANNEL_STATE_RING);
|
||||
state_flag = 0;
|
||||
ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_RING);
|
||||
|
||||
} else if (i >= sngss7_info->circuit->min_digits) {
|
||||
SS7_DEBUG_CHAN(ftdmchan, "Received %d digits (min digits = %d)\n", i, sngss7_info->circuit->min_digits);
|
||||
|
||||
/*now go to the RING state */
|
||||
ftdm_set_state_locked (ftdmchan, FTDM_CHANNEL_STATE_RING);
|
||||
state_flag = 0;
|
||||
ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_RING);
|
||||
|
||||
} else {
|
||||
/* if we are coming from idle state then we have already been here once before */
|
||||
@@ -561,7 +559,8 @@ ftdm_status_t ftdm_sangoma_ss7_process_state_change (ftdm_channel_t * ftdmchan)
|
||||
sngss7_set_ckt_flag (sngss7_info, FLAG_LOCAL_REL);
|
||||
|
||||
/* end the call */
|
||||
ftdm_set_state_locked (ftdmchan, FTDM_CHANNEL_STATE_CANCEL);
|
||||
state_flag = 0;
|
||||
ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_CANCEL);
|
||||
} /* if (ftdm_sched_timer(sngss7_info->t35.sched, */
|
||||
} /* if (ftdmchan->last_state != FTDM_CHANNEL_STATE_IDLE) */
|
||||
} /* checking ST/#digits */
|
||||
@@ -587,8 +586,7 @@ ftdm_status_t ftdm_sangoma_ss7_process_state_change (ftdm_channel_t * ftdmchan)
|
||||
|
||||
|
||||
/* we have enough information to inform FTDM of the call */
|
||||
sigev.event_id = FTDM_SIGEVENT_START;
|
||||
ftdm_span_send_signal (ftdmchan->span, &sigev);
|
||||
sngss7_send_signal(sngss7_info, FTDM_SIGEVENT_START);
|
||||
|
||||
break;
|
||||
/**************************************************************************/
|
||||
@@ -618,11 +616,11 @@ ftdm_status_t ftdm_sangoma_ss7_process_state_change (ftdm_channel_t * ftdmchan)
|
||||
/*check if the channel is inbound or outbound */
|
||||
if (ftdm_test_flag (ftdmchan, FTDM_CHANNEL_OUTBOUND)) {
|
||||
/*OUTBOUND...so we were told by the line of this so noifiy the user */
|
||||
sigev.event_id = FTDM_SIGEVENT_PROGRESS;
|
||||
ftdm_span_send_signal (ftdmchan->span, &sigev);
|
||||
sngss7_send_signal(sngss7_info, FTDM_SIGEVENT_PROGRESS);
|
||||
|
||||
/* move to progress media */
|
||||
ftdm_set_state_locked (ftdmchan, FTDM_CHANNEL_STATE_PROGRESS_MEDIA);
|
||||
state_flag = 0;
|
||||
ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_PROGRESS_MEDIA);
|
||||
} else {
|
||||
/* inbound call so we need to send out ACM */
|
||||
ft_to_sngss7_acm(ftdmchan);
|
||||
@@ -639,8 +637,7 @@ ftdm_status_t ftdm_sangoma_ss7_process_state_change (ftdm_channel_t * ftdmchan)
|
||||
|
||||
if (ftdm_test_flag (ftdmchan, FTDM_CHANNEL_OUTBOUND)) {
|
||||
/* inform the user there is media avai */
|
||||
sigev.event_id = FTDM_SIGEVENT_PROGRESS_MEDIA;
|
||||
ftdm_span_send_signal (ftdmchan->span, &sigev);
|
||||
sngss7_send_signal(sngss7_info, FTDM_SIGEVENT_PROGRESS_MEDIA);
|
||||
}
|
||||
|
||||
|
||||
@@ -657,8 +654,7 @@ ftdm_status_t ftdm_sangoma_ss7_process_state_change (ftdm_channel_t * ftdmchan)
|
||||
/*check if the channel is inbound or outbound */
|
||||
if (ftdm_test_flag (ftdmchan, FTDM_CHANNEL_OUTBOUND)) {
|
||||
/*OUTBOUND...so we were told by the line that the other side answered */
|
||||
sigev.event_id = FTDM_SIGEVENT_UP;
|
||||
ftdm_span_send_signal(ftdmchan->span, &sigev);
|
||||
sngss7_send_signal(sngss7_info, FTDM_SIGEVENT_UP);
|
||||
} else {
|
||||
/*INBOUND...so FS told us it was going to answer...tell the stack */
|
||||
ft_to_sngss7_anm(ftdmchan);
|
||||
@@ -676,7 +672,8 @@ ftdm_status_t ftdm_sangoma_ss7_process_state_change (ftdm_channel_t * ftdmchan)
|
||||
SS7_ERROR_CHAN(ftdmchan,"Hanging up call before informing user%s\n", " ");
|
||||
|
||||
/*now go to the HANGUP complete state */
|
||||
ftdm_set_state_locked (ftdmchan, FTDM_CHANNEL_STATE_HANGUP);
|
||||
state_flag = 0;
|
||||
ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_HANGUP);
|
||||
|
||||
break;
|
||||
/**************************************************************************/
|
||||
@@ -691,8 +688,7 @@ ftdm_status_t ftdm_sangoma_ss7_process_state_change (ftdm_channel_t * ftdmchan)
|
||||
sngss7_set_ckt_flag (sngss7_info, FLAG_REMOTE_REL);
|
||||
|
||||
/*this state is set when the line is hanging up */
|
||||
sigev.event_id = FTDM_SIGEVENT_STOP;
|
||||
ftdm_span_send_signal (ftdmchan->span, &sigev);
|
||||
sngss7_send_signal(sngss7_info, FTDM_SIGEVENT_STOP);
|
||||
|
||||
break;
|
||||
/**************************************************************************/
|
||||
@@ -721,7 +717,8 @@ ftdm_status_t ftdm_sangoma_ss7_process_state_change (ftdm_channel_t * ftdmchan)
|
||||
}
|
||||
|
||||
/*now go to the HANGUP complete state */
|
||||
ftdm_set_state_locked (ftdmchan, FTDM_CHANNEL_STATE_HANGUP_COMPLETE);
|
||||
state_flag = 0;
|
||||
ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_HANGUP_COMPLETE);
|
||||
|
||||
break;
|
||||
|
||||
@@ -737,7 +734,8 @@ ftdm_status_t ftdm_sangoma_ss7_process_state_change (ftdm_channel_t * ftdmchan)
|
||||
/* check if this hangup is from a tx RSC */
|
||||
if (sngss7_test_ckt_flag (sngss7_info, FLAG_RESET_TX)) {
|
||||
/* go to RESTART State until RSCa is received */
|
||||
ftdm_set_state_locked (ftdmchan, FTDM_CHANNEL_STATE_RESTART);
|
||||
state_flag = 0;
|
||||
ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_RESTART);
|
||||
} else {
|
||||
/* if the hangup is from a rx RSC, rx GRS, or glare don't sent RLC */
|
||||
if (!(sngss7_test_ckt_flag(sngss7_info, FLAG_RESET_RX)) &&
|
||||
@@ -749,7 +747,8 @@ ftdm_status_t ftdm_sangoma_ss7_process_state_change (ftdm_channel_t * ftdmchan)
|
||||
}
|
||||
|
||||
/*now go to the DOWN state */
|
||||
ftdm_set_state_locked (ftdmchan, FTDM_CHANNEL_STATE_DOWN);
|
||||
state_flag = 0;
|
||||
ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_DOWN);
|
||||
}
|
||||
|
||||
SS7_DEBUG_CHAN(ftdmchan,"Completing remotely requested hangup!%s\n", "");
|
||||
@@ -758,15 +757,16 @@ ftdm_status_t ftdm_sangoma_ss7_process_state_change (ftdm_channel_t * ftdmchan)
|
||||
/* if this hang up is do to a rx RESET we need to sit here till the RSP arrives */
|
||||
if (sngss7_test_ckt_flag (sngss7_info, FLAG_RESET_TX_RSP)) {
|
||||
/* go to the down state as we have already received RSC-RLC */
|
||||
ftdm_set_state_locked (ftdmchan, FTDM_CHANNEL_STATE_DOWN);
|
||||
state_flag = 0;
|
||||
ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_DOWN);
|
||||
}
|
||||
|
||||
/* if it's a local release the user sends us to down */
|
||||
SS7_DEBUG_CHAN(ftdmchan,"Completing locally requested hangup!%s\n", "");
|
||||
} else if (sngss7_test_ckt_flag (sngss7_info, FLAG_GLARE)) {
|
||||
SS7_DEBUG_CHAN(ftdmchan,"Completing requested hangup due to glare!%s\n", "");
|
||||
|
||||
ftdm_set_state_locked (ftdmchan, FTDM_CHANNEL_STATE_DOWN);
|
||||
state_flag = 0;
|
||||
ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_DOWN);
|
||||
} else {
|
||||
SS7_DEBUG_CHAN(ftdmchan,"Completing requested hangup for unknown reason!%s\n", "");
|
||||
}
|
||||
@@ -836,28 +836,27 @@ ftdm_status_t ftdm_sangoma_ss7_process_state_change (ftdm_channel_t * ftdmchan)
|
||||
!(sngss7_test_ckt_flag (sngss7_info, FLAG_GRP_RESET_RX))) {
|
||||
|
||||
/* now check if there is an active block */
|
||||
if (!(sngss7_test_ckt_flag(sngss7_info, FLAG_CKT_LC_BLOCK_RX)) &&
|
||||
!(sngss7_test_ckt_flag(sngss7_info, FLAG_CKT_MN_BLOCK_RX)) &&
|
||||
!(sngss7_test_ckt_flag(sngss7_info, FLAG_CKT_MN_BLOCK_TX)) &&
|
||||
!(sngss7_test_ckt_flag(sngss7_info, FLAG_GRP_HW_BLOCK_RX)) &&
|
||||
!(sngss7_test_ckt_flag(sngss7_info, FLAG_GRP_HW_BLOCK_TX)) &&
|
||||
!(sngss7_test_ckt_flag(sngss7_info, FLAG_GRP_MN_BLOCK_RX)) &&
|
||||
!(sngss7_test_ckt_flag(sngss7_info, FLAG_GRP_MN_BLOCK_TX))) {
|
||||
if (!(sngss7_test_ckt_blk_flag(sngss7_info, FLAG_CKT_LC_BLOCK_RX)) &&
|
||||
!(sngss7_test_ckt_blk_flag(sngss7_info, FLAG_CKT_MN_BLOCK_RX)) &&
|
||||
!(sngss7_test_ckt_blk_flag(sngss7_info, FLAG_CKT_MN_BLOCK_TX)) &&
|
||||
!(sngss7_test_ckt_blk_flag(sngss7_info, FLAG_GRP_HW_BLOCK_RX)) &&
|
||||
!(sngss7_test_ckt_blk_flag(sngss7_info, FLAG_GRP_HW_BLOCK_TX)) &&
|
||||
!(sngss7_test_ckt_blk_flag(sngss7_info, FLAG_GRP_MN_BLOCK_RX)) &&
|
||||
!(sngss7_test_ckt_blk_flag(sngss7_info, FLAG_GRP_MN_BLOCK_TX))) {
|
||||
|
||||
/* check if the sig status is down, and bring it up if it isn't */
|
||||
if (!ftdm_test_flag (ftdmchan, FTDM_CHANNEL_SIG_UP)) {
|
||||
SS7_DEBUG_CHAN(ftdmchan,"All reset flags cleared %s\n", "");
|
||||
/* all flags are down so we can bring up the sig status */
|
||||
sigev.event_id = FTDM_SIGEVENT_SIGSTATUS_CHANGED;
|
||||
sigev.ev_data.sigstatus.status = FTDM_SIG_STATE_UP;
|
||||
ftdm_span_send_signal (ftdmchan->span, &sigev);
|
||||
sngss7_set_sig_status(sngss7_info, FTDM_SIG_STATE_UP);
|
||||
} /* if (!ftdm_test_flag (ftdmchan, FTDM_CHANNEL_SIG_UP)) */
|
||||
} /* if !blocked */
|
||||
} else {
|
||||
SS7_DEBUG_CHAN(ftdmchan,"Reset flags present (0x%X)\n", sngss7_info->ckt_flags);
|
||||
|
||||
/* there is still another reset pending so go back to reset*/
|
||||
ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_RESTART);
|
||||
state_flag = 0;
|
||||
ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_RESTART);
|
||||
}
|
||||
} /* if ((ftdmchan->last_state == FTDM_CHANNEL_STATE_RESTART) */
|
||||
|
||||
@@ -906,20 +905,21 @@ ftdm_status_t ftdm_sangoma_ss7_process_state_change (ftdm_channel_t * ftdmchan)
|
||||
/**************************************************************************/
|
||||
case FTDM_CHANNEL_STATE_RESTART: /* CICs needs a Reset */
|
||||
|
||||
if (sngss7_test_ckt_flag(sngss7_info, FLAG_CKT_UCIC_BLOCK)) {
|
||||
if ((sngss7_test_ckt_flag(sngss7_info, FLAG_RESET_RX)) ||
|
||||
(sngss7_test_ckt_flag(sngss7_info, FLAG_GRP_RESET_RX))) {
|
||||
if (sngss7_test_ckt_blk_flag(sngss7_info, FLAG_CKT_UCIC_BLOCK)) {
|
||||
if ((sngss7_test_ckt_blk_flag(sngss7_info, FLAG_RESET_RX)) ||
|
||||
(sngss7_test_ckt_blk_flag(sngss7_info, FLAG_GRP_RESET_RX))) {
|
||||
|
||||
SS7_DEBUG_CHAN(ftdmchan,"Incoming Reset request on CIC in UCIC block, removing UCIC block%s\n", "");
|
||||
|
||||
/* set the unblk flag */
|
||||
sngss7_set_ckt_flag(sngss7_info, FLAG_CKT_UCIC_UNBLK);
|
||||
sngss7_set_ckt_blk_flag(sngss7_info, FLAG_CKT_UCIC_UNBLK);
|
||||
|
||||
/* clear the block flag */
|
||||
sngss7_clear_ckt_flag(sngss7_info, FLAG_CKT_UCIC_BLOCK);
|
||||
sngss7_clear_ckt_blk_flag(sngss7_info, FLAG_CKT_UCIC_BLOCK);
|
||||
|
||||
/* process the flag */
|
||||
ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_SUSPENDED);
|
||||
state_flag = 0;
|
||||
ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_SUSPENDED);
|
||||
|
||||
/* break out of the processing for now */
|
||||
break;
|
||||
@@ -956,9 +956,7 @@ ftdm_status_t ftdm_sangoma_ss7_process_state_change (ftdm_channel_t * ftdmchan)
|
||||
|
||||
/* if the sig_status is up...bring it down */
|
||||
if (ftdm_test_flag (ftdmchan, FTDM_CHANNEL_SIG_UP)) {
|
||||
sigev.event_id = FTDM_SIGEVENT_SIGSTATUS_CHANGED;
|
||||
sigev.ev_data.sigstatus.status = FTDM_SIG_STATE_DOWN;
|
||||
ftdm_span_send_signal (ftdmchan->span, &sigev);
|
||||
sngss7_set_sig_status(sngss7_info, FTDM_SIG_STATE_DOWN);
|
||||
}
|
||||
|
||||
if (sngss7_test_ckt_flag (sngss7_info, FLAG_GRP_RESET_RX)) {
|
||||
@@ -972,13 +970,15 @@ ftdm_status_t ftdm_sangoma_ss7_process_state_change (ftdm_channel_t * ftdmchan)
|
||||
switch (ftdmchan->last_state){
|
||||
/******************************************************************/
|
||||
case (FTDM_CHANNEL_STATE_TERMINATING):
|
||||
ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_HANGUP);
|
||||
state_flag = 0;
|
||||
ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_HANGUP);
|
||||
break;
|
||||
/******************************************************************/
|
||||
case (FTDM_CHANNEL_STATE_HANGUP):
|
||||
case (FTDM_CHANNEL_STATE_HANGUP_COMPLETE):
|
||||
/* go back to the last state after taking care of the rest of the restart state */
|
||||
ftdm_set_state_locked (ftdmchan, ftdmchan->last_state);
|
||||
state_flag = 0;
|
||||
ftdm_set_state(ftdmchan, ftdmchan->last_state);
|
||||
break;
|
||||
/******************************************************************/
|
||||
case (FTDM_CHANNEL_STATE_IN_LOOP):
|
||||
@@ -986,7 +986,8 @@ ftdm_status_t ftdm_sangoma_ss7_process_state_change (ftdm_channel_t * ftdmchan)
|
||||
ftdm_channel_command(ftdmchan, FTDM_COMMAND_DISABLE_LOOP, NULL);
|
||||
|
||||
/* go to down */
|
||||
ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_DOWN);
|
||||
state_flag = 0;
|
||||
ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_DOWN);
|
||||
break;
|
||||
/******************************************************************/
|
||||
default:
|
||||
@@ -996,7 +997,8 @@ ftdm_status_t ftdm_sangoma_ss7_process_state_change (ftdm_channel_t * ftdmchan)
|
||||
/* change the state to terminatting, it will throw us back here
|
||||
* once the call is done
|
||||
*/
|
||||
ftdm_set_state_locked (ftdmchan, FTDM_CHANNEL_STATE_TERMINATING);
|
||||
state_flag = 0;
|
||||
ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_TERMINATING);
|
||||
break;
|
||||
/******************************************************************/
|
||||
} /* switch (ftdmchan->last_state) */
|
||||
@@ -1010,7 +1012,8 @@ ftdm_status_t ftdm_sangoma_ss7_process_state_change (ftdm_channel_t * ftdmchan)
|
||||
SS7_DEBUG_CHAN(ftdmchan, "Reset processed moving to DOWN (0x%X)\n", sngss7_info->ckt_flags);
|
||||
|
||||
/* go to a down state to clear the channel and send the response */
|
||||
ftdm_set_state_locked (ftdmchan, FTDM_CHANNEL_STATE_DOWN);
|
||||
state_flag = 0;
|
||||
ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_DOWN);
|
||||
} else {
|
||||
SS7_DEBUG_CHAN(ftdmchan, "Waiting on Reset Rsp/Grp Reset to move to DOWN (0x%X)\n", sngss7_info->ckt_flags);
|
||||
}
|
||||
@@ -1029,6 +1032,9 @@ ftdm_status_t ftdm_sangoma_ss7_process_state_change (ftdm_channel_t * ftdmchan)
|
||||
/* clear the RESUME flag */
|
||||
sngss7_clear_ckt_flag(sngss7_info, FLAG_INFID_RESUME);
|
||||
|
||||
/* clear the PAUSE flag */
|
||||
sngss7_clear_ckt_flag(sngss7_info, FLAG_INFID_PAUSED);
|
||||
|
||||
/* if there are any resets present */
|
||||
if ((sngss7_test_ckt_flag (sngss7_info, FLAG_RESET_TX)) ||
|
||||
(sngss7_test_ckt_flag (sngss7_info, FLAG_RESET_RX)) ||
|
||||
@@ -1040,9 +1046,7 @@ ftdm_status_t ftdm_sangoma_ss7_process_state_change (ftdm_channel_t * ftdmchan)
|
||||
} else {
|
||||
|
||||
/* bring the sig status back up */
|
||||
sigev.event_id = FTDM_SIGEVENT_SIGSTATUS_CHANGED;
|
||||
sigev.ev_data.sigstatus.status = FTDM_SIG_STATE_UP;
|
||||
ftdm_span_send_signal(ftdmchan->span, &sigev);
|
||||
sngss7_set_sig_status(sngss7_info, FTDM_SIG_STATE_UP);
|
||||
}
|
||||
|
||||
/* go back to the last state */
|
||||
@@ -1053,112 +1057,125 @@ ftdm_status_t ftdm_sangoma_ss7_process_state_change (ftdm_channel_t * ftdmchan)
|
||||
SS7_DEBUG_CHAN(ftdmchan, "Processing PAUSE%s\n", "");
|
||||
|
||||
/* bring the sig status down */
|
||||
sigev.event_id = FTDM_SIGEVENT_SIGSTATUS_CHANGED;
|
||||
sigev.ev_data.sigstatus.status = FTDM_SIG_STATE_DOWN;
|
||||
ftdm_span_send_signal(ftdmchan->span, &sigev);
|
||||
sngss7_set_sig_status(sngss7_info, FTDM_SIG_STATE_DOWN);
|
||||
|
||||
/* go back to the last state */
|
||||
goto suspend_goto_last;
|
||||
} /* if (sngss7_test_ckt_flag(sngss7_info, FLAG_INFID_PAUSED)) { */
|
||||
/**********************************************************************/
|
||||
if (sngss7_test_ckt_flag (sngss7_info, FLAG_CKT_MN_BLOCK_RX)) {
|
||||
if (sngss7_test_ckt_blk_flag(sngss7_info, FLAG_CKT_MN_BLOCK_RX) &&
|
||||
!sngss7_test_ckt_blk_flag(sngss7_info, FLAG_CKT_MN_BLOCK_RX_DN)) {
|
||||
SS7_DEBUG_CHAN(ftdmchan, "Processing CKT_MN_BLOCK_RX flag %s\n", "");
|
||||
|
||||
/* bring the sig status down */
|
||||
sigev.event_id = FTDM_SIGEVENT_SIGSTATUS_CHANGED;
|
||||
sigev.ev_data.sigstatus.status = FTDM_SIG_STATE_DOWN;
|
||||
ftdm_span_send_signal(ftdmchan->span, &sigev);
|
||||
sngss7_set_sig_status(sngss7_info, FTDM_SIG_STATE_DOWN);
|
||||
|
||||
/* send a BLA */
|
||||
ft_to_sngss7_bla (ftdmchan);
|
||||
|
||||
/* throw the done flag */
|
||||
sngss7_set_ckt_blk_flag(sngss7_info, FLAG_CKT_MN_BLOCK_RX_DN);
|
||||
|
||||
/* check the last state and return to it to allow the call to finish */
|
||||
goto suspend_goto_last;
|
||||
}
|
||||
|
||||
if (sngss7_test_ckt_flag (sngss7_info, FLAG_CKT_MN_UNBLK_RX)){
|
||||
if (sngss7_test_ckt_blk_flag (sngss7_info, FLAG_CKT_MN_UNBLK_RX) &&
|
||||
!sngss7_test_ckt_blk_flag (sngss7_info, FLAG_CKT_MN_UNBLK_RX_DN)){
|
||||
SS7_DEBUG_CHAN(ftdmchan, "Processing CKT_MN_UNBLK_RX flag %s\n", "");
|
||||
|
||||
/* clear the unblock flag */
|
||||
sngss7_clear_ckt_flag (sngss7_info, FLAG_CKT_MN_UNBLK_RX);
|
||||
sngss7_clear_ckt_blk_flag (sngss7_info, FLAG_CKT_MN_UNBLK_RX);
|
||||
|
||||
/* bring the sig status up */
|
||||
sigev.event_id = FTDM_SIGEVENT_SIGSTATUS_CHANGED;
|
||||
sigev.ev_data.sigstatus.status = FTDM_SIG_STATE_UP;
|
||||
ftdm_span_send_signal(ftdmchan->span, &sigev);
|
||||
sngss7_set_sig_status(sngss7_info, FTDM_SIG_STATE_UP);
|
||||
|
||||
/* send a uba */
|
||||
ft_to_sngss7_uba (ftdmchan);
|
||||
|
||||
/* throw the done flag */
|
||||
sngss7_set_ckt_blk_flag(sngss7_info, FLAG_CKT_MN_UNBLK_RX_DN);
|
||||
|
||||
/* check the last state and return to it to allow the call to finish */
|
||||
goto suspend_goto_last;
|
||||
}
|
||||
|
||||
/**********************************************************************/
|
||||
if (sngss7_test_ckt_flag (sngss7_info, FLAG_CKT_MN_BLOCK_TX)) {
|
||||
if (sngss7_test_ckt_blk_flag(sngss7_info, FLAG_CKT_MN_BLOCK_TX) &&
|
||||
!sngss7_test_ckt_blk_flag(sngss7_info, FLAG_CKT_MN_BLOCK_TX_DN)) {
|
||||
SS7_DEBUG_CHAN(ftdmchan, "Processing CKT_MN_BLOCK_TX flag %s\n", "");
|
||||
|
||||
/* bring the sig status down */
|
||||
sigev.event_id = FTDM_SIGEVENT_SIGSTATUS_CHANGED;
|
||||
sigev.ev_data.sigstatus.status = FTDM_SIG_STATE_DOWN;
|
||||
ftdm_span_send_signal(ftdmchan->span, &sigev);
|
||||
sngss7_set_sig_status(sngss7_info, FTDM_SIG_STATE_DOWN);
|
||||
|
||||
/* send a blo */
|
||||
ft_to_sngss7_blo (ftdmchan);
|
||||
|
||||
/* throw the done flag */
|
||||
sngss7_set_ckt_blk_flag(sngss7_info, FLAG_CKT_MN_BLOCK_TX_DN);
|
||||
|
||||
/* check the last state and return to it to allow the call to finish */
|
||||
goto suspend_goto_last;
|
||||
}
|
||||
|
||||
if (sngss7_test_ckt_flag (sngss7_info, FLAG_CKT_MN_UNBLK_TX)){
|
||||
if (sngss7_test_ckt_blk_flag (sngss7_info, FLAG_CKT_MN_UNBLK_TX) &&
|
||||
!sngss7_test_ckt_blk_flag (sngss7_info, FLAG_CKT_MN_UNBLK_TX_DN)){
|
||||
SS7_DEBUG_CHAN(ftdmchan, "Processing CKT_MN_UNBLK_TX flag %s\n", "");
|
||||
|
||||
/* clear the unblock flag */
|
||||
sngss7_clear_ckt_flag (sngss7_info, FLAG_CKT_MN_UNBLK_TX);
|
||||
sngss7_clear_ckt_blk_flag (sngss7_info, FLAG_CKT_MN_UNBLK_TX);
|
||||
|
||||
/* bring the sig status up */
|
||||
sigev.event_id = FTDM_SIGEVENT_SIGSTATUS_CHANGED;
|
||||
sigev.ev_data.sigstatus.status = FTDM_SIG_STATE_UP;
|
||||
ftdm_span_send_signal(ftdmchan->span, &sigev);
|
||||
sngss7_set_sig_status(sngss7_info, FTDM_SIG_STATE_UP);
|
||||
|
||||
/* send a ubl */
|
||||
ft_to_sngss7_ubl (ftdmchan);
|
||||
|
||||
/* throw the done flag */
|
||||
sngss7_set_ckt_blk_flag(sngss7_info, FLAG_CKT_MN_UNBLK_TX_DN);
|
||||
|
||||
/* check the last state and return to it to allow the call to finish */
|
||||
goto suspend_goto_last;
|
||||
}
|
||||
|
||||
/**********************************************************************/
|
||||
if (sngss7_test_ckt_flag (sngss7_info, FLAG_CKT_LC_BLOCK_RX)) {
|
||||
if (sngss7_test_ckt_blk_flag(sngss7_info, FLAG_CKT_LC_BLOCK_RX) &&
|
||||
!sngss7_test_ckt_blk_flag(sngss7_info, FLAG_CKT_LC_BLOCK_RX_DN)) {
|
||||
SS7_DEBUG_CHAN(ftdmchan, "Processing CKT_LC_BLOCK_RX flag %s\n", "");
|
||||
|
||||
/* send a BLA */
|
||||
/*ft_to_sngss7_bla(ftdmchan);*/
|
||||
|
||||
/* throw the done flag */
|
||||
sngss7_set_ckt_blk_flag(sngss7_info, FLAG_CKT_LC_BLOCK_RX_DN);
|
||||
|
||||
/* check the last state and return to it to allow the call to finish */
|
||||
goto suspend_goto_last;
|
||||
}
|
||||
|
||||
if (sngss7_test_ckt_flag (sngss7_info, FLAG_CKT_LC_UNBLK_RX)) {
|
||||
if (sngss7_test_ckt_blk_flag(sngss7_info, FLAG_CKT_LC_UNBLK_RX) &&
|
||||
!sngss7_test_ckt_blk_flag(sngss7_info, FLAG_CKT_LC_UNBLK_RX_DN)) {
|
||||
SS7_DEBUG_CHAN(ftdmchan, "Processing CKT_LC_UNBLK_RX flag %s\n", "");
|
||||
|
||||
/* clear the unblock flag */
|
||||
sngss7_clear_ckt_flag (sngss7_info, FLAG_CKT_MN_UNBLK_RX);
|
||||
sngss7_clear_ckt_blk_flag(sngss7_info, FLAG_CKT_MN_UNBLK_RX);
|
||||
|
||||
/* send a uba */
|
||||
/*ft_to_sngss7_uba(ftdmchan);*/
|
||||
|
||||
/* throw the done flag */
|
||||
sngss7_set_ckt_blk_flag(sngss7_info, FLAG_CKT_LC_UNBLK_RX_DN);
|
||||
|
||||
/* check the last state and return to it to allow the call to finish */
|
||||
goto suspend_goto_last;
|
||||
}
|
||||
/**********************************************************************/
|
||||
if (sngss7_test_ckt_flag (sngss7_info, FLAG_CKT_UCIC_BLOCK)) {
|
||||
if (sngss7_test_ckt_blk_flag (sngss7_info, FLAG_CKT_UCIC_BLOCK) &&
|
||||
!sngss7_test_ckt_blk_flag (sngss7_info, FLAG_CKT_UCIC_BLOCK_DN)) {
|
||||
SS7_DEBUG_CHAN(ftdmchan, "Processing CKT_UCIC_BLOCK flag %s\n", "");
|
||||
|
||||
/* bring the channel signaling status to down */
|
||||
sigev.event_id = FTDM_SIGEVENT_SIGSTATUS_CHANGED;
|
||||
sigev.ev_data.sigstatus.status = FTDM_SIG_STATE_DOWN;
|
||||
ftdm_span_send_signal (ftdmchan->span, &sigev);
|
||||
sngss7_set_sig_status(sngss7_info, FTDM_SIG_STATE_DOWN);
|
||||
|
||||
/* remove any reset flags */
|
||||
clear_rx_grs_flags(sngss7_info);
|
||||
@@ -1167,33 +1184,42 @@ ftdm_status_t ftdm_sangoma_ss7_process_state_change (ftdm_channel_t * ftdmchan)
|
||||
clear_tx_grs_data(sngss7_info);
|
||||
clear_rx_rsc_flags(sngss7_info);
|
||||
clear_tx_rsc_flags(sngss7_info);
|
||||
|
||||
/* throw the done flag */
|
||||
sngss7_set_ckt_blk_flag(sngss7_info, FLAG_CKT_UCIC_BLOCK_DN);
|
||||
|
||||
/* bring the channel down */
|
||||
goto suspend_goto_last;
|
||||
}
|
||||
|
||||
if (sngss7_test_ckt_flag (sngss7_info, FLAG_CKT_UCIC_UNBLK)) {
|
||||
if (sngss7_test_ckt_blk_flag (sngss7_info, FLAG_CKT_UCIC_UNBLK) &&
|
||||
!sngss7_test_ckt_blk_flag (sngss7_info, FLAG_CKT_UCIC_UNBLK_DN)) {
|
||||
SS7_DEBUG_CHAN(ftdmchan, "Processing CKT_UCIC_UNBLK flag %s\n", "");;
|
||||
|
||||
/* remove the UCIC block flag */
|
||||
sngss7_clear_ckt_flag(sngss7_info, FLAG_CKT_UCIC_BLOCK);
|
||||
sngss7_clear_ckt_blk_flag(sngss7_info, FLAG_CKT_UCIC_BLOCK);
|
||||
|
||||
/* remove the UCIC unblock flag */
|
||||
sngss7_clear_ckt_flag(sngss7_info, FLAG_CKT_UCIC_UNBLK);
|
||||
sngss7_clear_ckt_blk_flag(sngss7_info, FLAG_CKT_UCIC_UNBLK);
|
||||
|
||||
/* throw the channel into reset to sync states */
|
||||
sngss7_set_ckt_flag(sngss7_info, FLAG_RESET_TX);
|
||||
|
||||
/* throw the done flag */
|
||||
sngss7_set_ckt_blk_flag(sngss7_info, FLAG_CKT_UCIC_UNBLK_DN);
|
||||
|
||||
/* bring the channel into restart again */
|
||||
goto suspend_goto_restart;
|
||||
}
|
||||
|
||||
suspend_goto_last:
|
||||
ftdm_set_state_locked (ftdmchan, ftdmchan->last_state);
|
||||
state_flag = 0;
|
||||
ftdm_set_state(ftdmchan, ftdmchan->last_state);
|
||||
break;
|
||||
|
||||
suspend_goto_restart:
|
||||
ftdm_set_state_locked (ftdmchan, FTDM_CHANNEL_STATE_RESTART);
|
||||
state_flag = 0;
|
||||
ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_RESTART);
|
||||
break;
|
||||
|
||||
/**************************************************************************/
|
||||
@@ -1209,7 +1235,8 @@ suspend_goto_restart:
|
||||
break;
|
||||
/**************************************************************************/
|
||||
case FTDM_CHANNEL_STATE_IDLE:
|
||||
ftdm_set_state_locked(ftdmchan, ftdmchan->last_state);
|
||||
state_flag = 0;
|
||||
ftdm_set_state(ftdmchan, ftdmchan->last_state);
|
||||
break;
|
||||
/**************************************************************************/
|
||||
default:
|
||||
@@ -1219,7 +1246,12 @@ suspend_goto_restart:
|
||||
break;
|
||||
/**************************************************************************/
|
||||
}/*switch (ftdmchan->state) */
|
||||
|
||||
#if 1
|
||||
if (state_flag) {
|
||||
/* clear the state change flag...since we might be setting a new state */
|
||||
ftdm_channel_complete_state(ftdmchan);
|
||||
}
|
||||
#endif
|
||||
return FTDM_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -1228,17 +1260,7 @@ static FIO_CHANNEL_OUTGOING_CALL_FUNCTION(ftdm_sangoma_ss7_outgoing_call)
|
||||
{
|
||||
sngss7_chan_data_t *sngss7_info = ftdmchan->call_data;
|
||||
|
||||
/* lock the channel while we check whether it is availble */
|
||||
ftdm_mutex_lock (ftdmchan->mutex);
|
||||
|
||||
/* check if there is a pending state change, give it a bit to clear */
|
||||
if (check_for_state_change(ftdmchan)) {
|
||||
SS7_ERROR("Failed to wait for pending state change on CIC = %d\n", sngss7_info->circuit->cic);
|
||||
/* check if we need to die */
|
||||
SS7_ASSERT;
|
||||
/* end the request */
|
||||
goto outgoing_fail;
|
||||
};
|
||||
/* the core has this channel already locked so need to lock again */
|
||||
|
||||
/* check if the channel sig state is UP */
|
||||
if (!ftdm_test_flag(ftdmchan, FTDM_CHANNEL_SIG_UP)) {
|
||||
@@ -1247,9 +1269,9 @@ static FIO_CHANNEL_OUTGOING_CALL_FUNCTION(ftdm_sangoma_ss7_outgoing_call)
|
||||
}
|
||||
|
||||
/* check if there is a remote block */
|
||||
if ((sngss7_test_ckt_flag(sngss7_info, FLAG_CKT_MN_BLOCK_RX)) ||
|
||||
(sngss7_test_ckt_flag(sngss7_info, FLAG_GRP_HW_BLOCK_RX)) ||
|
||||
(sngss7_test_ckt_flag(sngss7_info, FLAG_GRP_MN_BLOCK_RX))) {
|
||||
if ((sngss7_test_ckt_blk_flag(sngss7_info, FLAG_CKT_MN_BLOCK_RX)) ||
|
||||
(sngss7_test_ckt_blk_flag(sngss7_info, FLAG_GRP_HW_BLOCK_RX)) ||
|
||||
(sngss7_test_ckt_blk_flag(sngss7_info, FLAG_GRP_MN_BLOCK_RX))) {
|
||||
|
||||
/* the channel is blocked...can't send any calls here */
|
||||
SS7_ERROR_CHAN(ftdmchan, "Requested channel is remotely blocked, re-hunt channel!%s\n", " ");
|
||||
@@ -1257,9 +1279,9 @@ static FIO_CHANNEL_OUTGOING_CALL_FUNCTION(ftdm_sangoma_ss7_outgoing_call)
|
||||
}
|
||||
|
||||
/* check if there is a local block */
|
||||
if ((sngss7_test_ckt_flag(sngss7_info, FLAG_CKT_MN_BLOCK_TX)) ||
|
||||
(sngss7_test_ckt_flag(sngss7_info, FLAG_GRP_HW_BLOCK_TX)) ||
|
||||
(sngss7_test_ckt_flag(sngss7_info, FLAG_GRP_MN_BLOCK_TX))) {
|
||||
if ((sngss7_test_ckt_blk_flag(sngss7_info, FLAG_CKT_MN_BLOCK_TX)) ||
|
||||
(sngss7_test_ckt_blk_flag(sngss7_info, FLAG_GRP_HW_BLOCK_TX)) ||
|
||||
(sngss7_test_ckt_blk_flag(sngss7_info, FLAG_GRP_MN_BLOCK_TX))) {
|
||||
|
||||
/* KONRAD FIX ME : we should check if this is a TEST call and allow it */
|
||||
|
||||
@@ -1272,11 +1294,7 @@ static FIO_CHANNEL_OUTGOING_CALL_FUNCTION(ftdm_sangoma_ss7_outgoing_call)
|
||||
switch (ftdmchan->state){
|
||||
/**************************************************************************/
|
||||
case FTDM_CHANNEL_STATE_DOWN:
|
||||
/* inform the monitor thread that we want to make a call */
|
||||
ftdm_set_state_locked (ftdmchan, FTDM_CHANNEL_STATE_DIALING);
|
||||
|
||||
/* unlock the channel */
|
||||
ftdm_mutex_unlock (ftdmchan->mutex);
|
||||
/* inform the monitor thread that we want to make a call by returning FTDM_SUCCESS */
|
||||
|
||||
goto outgoing_successful;
|
||||
break;
|
||||
@@ -1294,20 +1312,14 @@ static FIO_CHANNEL_OUTGOING_CALL_FUNCTION(ftdm_sangoma_ss7_outgoing_call)
|
||||
|
||||
outgoing_fail:
|
||||
SS7_DEBUG_CHAN(ftdmchan, "Call Request failed%s\n", " ");
|
||||
/* unlock the channel */
|
||||
ftdm_mutex_unlock (ftdmchan->mutex);
|
||||
return FTDM_FAIL;
|
||||
|
||||
outgoing_break:
|
||||
SS7_DEBUG_CHAN(ftdmchan, "Call Request re-hunt%s\n", " ");
|
||||
/* unlock the channel */
|
||||
ftdm_mutex_unlock (ftdmchan->mutex);
|
||||
return FTDM_BREAK;
|
||||
|
||||
outgoing_successful:
|
||||
SS7_DEBUG_CHAN(ftdmchan, "Call Request successful%s\n", " ");
|
||||
/* unlock the channel */
|
||||
ftdm_mutex_unlock (ftdmchan->mutex);
|
||||
return FTDM_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -1410,7 +1422,7 @@ static ftdm_status_t ftdm_sangoma_ss7_start(ftdm_span_t * span)
|
||||
sngss7_set_ckt_flag(sngss7_info, FLAG_RESET_TX);
|
||||
#endif
|
||||
/* throw the channel to suspend */
|
||||
ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_SUSPENDED);
|
||||
ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_SUSPENDED);
|
||||
|
||||
/* unlock the channel */
|
||||
ftdm_mutex_unlock(ftdmchan->mutex);
|
||||
|
||||
@@ -76,6 +76,17 @@ typedef enum {
|
||||
SNGSS7_SSP_STA_CFM_EVENT
|
||||
} sng_event_type_t;
|
||||
|
||||
typedef enum {
|
||||
SNG_BIT_A = (1 << 0),
|
||||
SNG_BIT_B = (1 << 1),
|
||||
SNG_BIT_C = (1 << 2),
|
||||
SNG_BIT_D = (1 << 3),
|
||||
SNG_BIT_E = (1 << 4),
|
||||
SNG_BIT_F = (1 << 5),
|
||||
SNG_BIT_G = (1 << 6),
|
||||
SNG_BIT_H = (1 << 7)
|
||||
} sng_bit_enums_t;
|
||||
|
||||
typedef enum {
|
||||
VOICE = 0,
|
||||
SIG,
|
||||
@@ -294,7 +305,6 @@ typedef struct sng_isup_intf {
|
||||
typedef struct sng_isup_ckt {
|
||||
uint32_t options;
|
||||
uint32_t flags;
|
||||
uint32_t ckt_flags;
|
||||
uint32_t procId;
|
||||
uint32_t id;
|
||||
uint32_t ccSpanId;
|
||||
@@ -431,6 +441,10 @@ typedef struct sngss7_chan_data {
|
||||
uint32_t spId;
|
||||
uint8_t globalFlg;
|
||||
uint32_t ckt_flags;
|
||||
uint32_t blk_flags;
|
||||
ftdm_hash_t* variables; /* send on next sigevent */
|
||||
ftdm_size_t raw_data_len;
|
||||
void *raw_data; /* send on next sigevent */
|
||||
sngss7_glare_data_t glare;
|
||||
sngss7_timer_data_t t35;
|
||||
}sngss7_chan_data_t;
|
||||
@@ -489,23 +503,41 @@ typedef enum {
|
||||
FLAG_GLARE = (1 << 13),
|
||||
FLAG_INFID_RESUME = (1 << 14),
|
||||
FLAG_INFID_PAUSED = (1 << 15),
|
||||
FLAG_CKT_UCIC_BLOCK = (1 << 16),
|
||||
FLAG_CKT_UCIC_UNBLK = (1 << 17),
|
||||
FLAG_CKT_LC_BLOCK_RX = (1 << 18),
|
||||
FLAG_CKT_LC_UNBLK_RX = (1 << 19),
|
||||
FLAG_CKT_MN_BLOCK_RX = (1 << 20),
|
||||
FLAG_CKT_MN_UNBLK_RX = (1 << 21),
|
||||
FLAG_CKT_MN_BLOCK_TX = (1 << 22),
|
||||
FLAG_CKT_MN_UNBLK_TX = (1 << 23),
|
||||
FLAG_GRP_HW_BLOCK_RX = (1 << 24),
|
||||
FLAG_GRP_HW_BLOCK_TX = (1 << 25),
|
||||
FLAG_GRP_MN_BLOCK_RX = (1 << 26),
|
||||
FLAG_GRP_MN_BLOCK_TX = (1 << 27),
|
||||
FLAG_GRP_HW_UNBLK_TX = (1 << 28),
|
||||
FLAG_GRP_MN_UNBLK_TX = (1 << 29),
|
||||
FLAG_RELAY_DOWN = (1 << 30)
|
||||
} sng_ckt_flag_t;
|
||||
|
||||
/* ckt blocking flags */
|
||||
typedef enum {
|
||||
FLAG_CKT_UCIC_BLOCK = (1 << 0),
|
||||
FLAG_CKT_UCIC_BLOCK_DN = (1 << 1),
|
||||
FLAG_CKT_UCIC_UNBLK = (1 << 2),
|
||||
FLAG_CKT_UCIC_UNBLK_DN = (1 << 3),
|
||||
FLAG_CKT_LC_BLOCK_RX = (1 << 4),
|
||||
FLAG_CKT_LC_BLOCK_RX_DN = (1 << 5),
|
||||
FLAG_CKT_LC_UNBLK_RX = (1 << 6),
|
||||
FLAG_CKT_LC_UNBLK_RX_DN = (1 << 7),
|
||||
FLAG_CKT_MN_BLOCK_RX = (1 << 8),
|
||||
FLAG_CKT_MN_BLOCK_RX_DN = (1 << 9),
|
||||
FLAG_CKT_MN_UNBLK_RX = (1 << 10),
|
||||
FLAG_CKT_MN_UNBLK_RX_DN = (1 << 11),
|
||||
FLAG_CKT_MN_BLOCK_TX = (1 << 12),
|
||||
FLAG_CKT_MN_BLOCK_TX_DN = (1 << 13),
|
||||
FLAG_CKT_MN_UNBLK_TX = (1 << 14),
|
||||
FLAG_CKT_MN_UNBLK_TX_DN = (1 << 15),
|
||||
FLAG_GRP_HW_BLOCK_RX = (1 << 16),
|
||||
FLAG_GRP_HW_BLOCK_RX_DN = (1 << 17),
|
||||
FLAG_GRP_HW_BLOCK_TX = (1 << 18),
|
||||
FLAG_GRP_HW_BLOCK_TX_DN = (1 << 19),
|
||||
FLAG_GRP_MN_BLOCK_RX = (1 << 20),
|
||||
FLAG_GRP_MN_BLOCK_RX_DN = (1 << 21),
|
||||
FLAG_GRP_MN_BLOCK_TX = (1 << 22),
|
||||
FLAG_GRP_MN_BLOCK_TX_DN = (1 << 23),
|
||||
FLAG_GRP_HW_UNBLK_TX = (1 << 24),
|
||||
FLAG_GRP_HW_UNBLK_TX_DN = (1 << 25),
|
||||
FLAG_GRP_MN_UNBLK_TX = (1 << 26),
|
||||
FLAG_GRP_MN_UNBLK_TX_DN = (1 << 27)
|
||||
} sng_ckt_block_flag_t;
|
||||
|
||||
/* valid for every cfg array except circuits */
|
||||
typedef enum {
|
||||
SNGSS7_CONFIGURED = (1 << 0),
|
||||
@@ -607,6 +639,7 @@ int ftmod_ss7_mtp3link_sta(uint32_t id, SnMngmt *cfm);
|
||||
int ftmod_ss7_mtplinkSet_sta(uint32_t id, SnMngmt *cfm);
|
||||
int ftmod_ss7_isup_intf_sta(uint32_t id, uint8_t *status);
|
||||
int ftmod_ss7_relay_status(uint32_t id, RyMngmt *cfm);
|
||||
int ftmod_ss7_isup_ckt_sta(uint32_t id, unsigned char *state);
|
||||
|
||||
|
||||
/* in ftmod_sangoma_ss7_out.c */
|
||||
@@ -724,6 +757,11 @@ int find_cic_cntrl_in_map(const char *cntrlType);
|
||||
|
||||
ftdm_status_t check_status_of_all_isup_intf(void);
|
||||
|
||||
void sngss7_send_signal(sngss7_chan_data_t *sngss7_info, ftdm_signal_event_t event_id);
|
||||
void sngss7_set_sig_status(sngss7_chan_data_t *sngss7_info, ftdm_signaling_status_t status);
|
||||
ftdm_status_t sngss7_add_var(sngss7_chan_data_t *ss7_info, const char* var, const char* val);
|
||||
ftdm_status_t sngss7_add_raw_data(sngss7_chan_data_t *sngss7_info, uint8_t* data, ftdm_size_t data_len);
|
||||
|
||||
/* in ftmod_sangoma_ss7_timers.c */
|
||||
void handle_isup_t35(void *userdata);
|
||||
/******************************************************************************/
|
||||
@@ -860,6 +898,10 @@ void handle_isup_t35(void *userdata);
|
||||
#define sngss7_clear_ckt_flag(obj, flag) ((obj)->ckt_flags &= ~(flag))
|
||||
#define sngss7_set_ckt_flag(obj, flag) ((obj)->ckt_flags |= (flag))
|
||||
|
||||
#define sngss7_test_ckt_blk_flag(obj, flag) ((obj)->blk_flags & flag)
|
||||
#define sngss7_clear_ckt_blk_flag(obj, flag) ((obj)->blk_flags &= ~(flag))
|
||||
#define sngss7_set_ckt_blk_flag(obj, flag) ((obj)->blk_flags |= (flag))
|
||||
|
||||
#define sngss7_test_options(obj, option) ((obj)->options & option)
|
||||
#define sngss7_clear_options(obj, option) ((obj)->options &= ~(option))
|
||||
#define sngss7_set_options(obj, option) ((obj)->options |= (option))
|
||||
|
||||
@@ -187,7 +187,7 @@ void ft_to_sngss7_iam (ftdm_channel_t * ftdmchan)
|
||||
copy_cgPtyNum_to_sngss7 (&ftdmchan->caller_data, &iam.cgPtyNum);
|
||||
|
||||
/* check if the user would like a custom NADI value for the calling Pty Num */
|
||||
clg_nadi = ftdm_call_get_var(&ftdmchan->caller_data, "ss7_clg_nadi");
|
||||
clg_nadi = ftdm_usrmsg_get_var(ftdmchan->usrmsg, "ss7_clg_nadi");
|
||||
if ((clg_nadi != NULL) && (*clg_nadi)) {
|
||||
SS7_DEBUG_CHAN(ftdmchan,"Found user supplied Calling NADI value \"%s\"\n", clg_nadi);
|
||||
iam.cgPtyNum.natAddrInd.val = atoi(clg_nadi);
|
||||
@@ -196,7 +196,7 @@ void ft_to_sngss7_iam (ftdm_channel_t * ftdmchan)
|
||||
SS7_DEBUG_CHAN(ftdmchan,"No user supplied NADI value found for CLG, using \"%d\"\n", iam.cgPtyNum.natAddrInd.val);
|
||||
}
|
||||
|
||||
cld_nadi = ftdm_call_get_var(&ftdmchan->caller_data, "ss7_cld_nadi");
|
||||
cld_nadi = ftdm_usrmsg_get_var(ftdmchan->usrmsg, "ss7_cld_nadi");
|
||||
if ((cld_nadi != NULL) && (*cld_nadi)) {
|
||||
SS7_DEBUG_CHAN(ftdmchan,"Found user supplied Called NADI value \"%s\"\n", cld_nadi);
|
||||
iam.cdPtyNum.natAddrInd.val = atoi(cld_nadi);
|
||||
@@ -206,7 +206,7 @@ void ft_to_sngss7_iam (ftdm_channel_t * ftdmchan)
|
||||
}
|
||||
|
||||
/* check if the user would like us to send a clg_sub-address */
|
||||
clg_subAddr = ftdm_call_get_var(&ftdmchan->caller_data, "ss7_clg_subaddr");
|
||||
clg_subAddr = ftdm_usrmsg_get_var(ftdmchan->usrmsg, "ss7_clg_subaddr");
|
||||
if ((clg_subAddr != NULL) && (*clg_subAddr)) {
|
||||
SS7_DEBUG_CHAN(ftdmchan,"Found user supplied Calling Sub-Address value \"%s\"\n", clg_subAddr);
|
||||
|
||||
@@ -245,7 +245,7 @@ void ft_to_sngss7_iam (ftdm_channel_t * ftdmchan)
|
||||
}
|
||||
|
||||
/* check if the user would like us to send a cld_sub-address */
|
||||
cld_subAddr = ftdm_call_get_var(&ftdmchan->caller_data, "ss7_cld_subaddr");
|
||||
cld_subAddr = ftdm_usrmsg_get_var(ftdmchan->usrmsg, "ss7_cld_subaddr");
|
||||
if ((cld_subAddr != NULL) && (*cld_subAddr)) {
|
||||
SS7_DEBUG_CHAN(ftdmchan,"Found user supplied Called Sub-Address value \"%s\"\n", cld_subAddr);
|
||||
|
||||
@@ -282,9 +282,6 @@ void ft_to_sngss7_iam (ftdm_channel_t * ftdmchan)
|
||||
} /* if (subAddrIE[0] != '0') */
|
||||
} /* if ((cld_subAddr != NULL) && (*cld_subAddr)) */
|
||||
|
||||
|
||||
|
||||
|
||||
sng_cc_con_request (sngss7_info->spId,
|
||||
sngss7_info->suInstId,
|
||||
sngss7_info->spInstId,
|
||||
@@ -299,7 +296,7 @@ void ft_to_sngss7_iam (ftdm_channel_t * ftdmchan)
|
||||
ftdmchan->caller_data.dnis.digits,
|
||||
iam.cdPtyNum.natAddrInd.val);
|
||||
|
||||
ftdm_call_clear_data(&ftdmchan->caller_data);
|
||||
|
||||
SS7_FUNC_TRACE_EXIT (__FUNCTION__);
|
||||
return;
|
||||
}
|
||||
@@ -379,7 +376,7 @@ void ft_to_sngss7_acm (ftdm_channel_t * ftdmchan)
|
||||
ADDRCMPLT);
|
||||
|
||||
SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Tx ACM\n", sngss7_info->circuit->cic);
|
||||
ftdm_call_clear_data(&ftdmchan->caller_data);
|
||||
|
||||
SS7_FUNC_TRACE_EXIT (__FUNCTION__);
|
||||
return;
|
||||
}
|
||||
@@ -403,7 +400,7 @@ void ft_to_sngss7_anm (ftdm_channel_t * ftdmchan)
|
||||
5);
|
||||
|
||||
SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Tx ANM\n", sngss7_info->circuit->cic);
|
||||
ftdm_call_clear_data(&ftdmchan->caller_data);
|
||||
|
||||
SS7_FUNC_TRACE_EXIT (__FUNCTION__);
|
||||
return;
|
||||
}
|
||||
@@ -438,7 +435,7 @@ void ft_to_sngss7_rel (ftdm_channel_t * ftdmchan)
|
||||
SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Tx REL cause=%d \n",
|
||||
sngss7_info->circuit->cic,
|
||||
ftdmchan->caller_data.hangup_cause );
|
||||
ftdm_call_clear_data(&ftdmchan->caller_data);
|
||||
|
||||
SS7_FUNC_TRACE_EXIT (__FUNCTION__);
|
||||
return;
|
||||
}
|
||||
@@ -461,7 +458,7 @@ void ft_to_sngss7_rlc (ftdm_channel_t * ftdmchan)
|
||||
&rlc);
|
||||
|
||||
SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Tx RLC\n", sngss7_info->circuit->cic);
|
||||
ftdm_call_clear_data(&ftdmchan->caller_data);
|
||||
|
||||
SS7_FUNC_TRACE_EXIT (__FUNCTION__);
|
||||
return;
|
||||
}
|
||||
@@ -482,7 +479,7 @@ void ft_to_sngss7_rsc (ftdm_channel_t * ftdmchan)
|
||||
NULL);
|
||||
|
||||
SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Tx RSC\n", sngss7_info->circuit->cic);
|
||||
ftdm_call_clear_data(&ftdmchan->caller_data);
|
||||
|
||||
SS7_FUNC_TRACE_EXIT (__FUNCTION__);
|
||||
return;
|
||||
}
|
||||
@@ -503,7 +500,7 @@ void ft_to_sngss7_rsca (ftdm_channel_t * ftdmchan)
|
||||
NULL);
|
||||
|
||||
SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Tx RSC-RLC\n", sngss7_info->circuit->cic);
|
||||
ftdm_call_clear_data(&ftdmchan->caller_data);
|
||||
|
||||
SS7_FUNC_TRACE_EXIT (__FUNCTION__);
|
||||
return;
|
||||
}
|
||||
@@ -524,7 +521,7 @@ void ft_to_sngss7_blo (ftdm_channel_t * ftdmchan)
|
||||
NULL);
|
||||
|
||||
SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Tx BLO\n", sngss7_info->circuit->cic);
|
||||
ftdm_call_clear_data(&ftdmchan->caller_data);
|
||||
|
||||
SS7_FUNC_TRACE_EXIT (__FUNCTION__);
|
||||
return;
|
||||
}
|
||||
@@ -545,7 +542,7 @@ void ft_to_sngss7_bla (ftdm_channel_t * ftdmchan)
|
||||
NULL);
|
||||
|
||||
SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Tx BLA\n", sngss7_info->circuit->cic);
|
||||
ftdm_call_clear_data(&ftdmchan->caller_data);
|
||||
|
||||
SS7_FUNC_TRACE_EXIT (__FUNCTION__);
|
||||
return;
|
||||
}
|
||||
@@ -567,7 +564,7 @@ ft_to_sngss7_ubl (ftdm_channel_t * ftdmchan)
|
||||
NULL);
|
||||
|
||||
SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Tx UBL\n", sngss7_info->circuit->cic);
|
||||
ftdm_call_clear_data(&ftdmchan->caller_data);
|
||||
|
||||
SS7_FUNC_TRACE_EXIT (__FUNCTION__);
|
||||
return;
|
||||
}
|
||||
@@ -588,7 +585,7 @@ void ft_to_sngss7_uba (ftdm_channel_t * ftdmchan)
|
||||
NULL);
|
||||
|
||||
SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Tx UBA\n", sngss7_info->circuit->cic);
|
||||
ftdm_call_clear_data(&ftdmchan->caller_data);
|
||||
|
||||
SS7_FUNC_TRACE_EXIT (__FUNCTION__);
|
||||
return;
|
||||
}
|
||||
@@ -609,7 +606,7 @@ void ft_to_sngss7_lpa (ftdm_channel_t * ftdmchan)
|
||||
NULL);
|
||||
|
||||
SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Tx LPA\n", sngss7_info->circuit->cic);
|
||||
ftdm_call_clear_data(&ftdmchan->caller_data);
|
||||
|
||||
SS7_FUNC_TRACE_EXIT (__FUNCTION__);
|
||||
return;
|
||||
}
|
||||
@@ -654,7 +651,7 @@ void ft_to_sngss7_gra (ftdm_channel_t * ftdmchan)
|
||||
sngss7_info->circuit->cic,
|
||||
(sngss7_info->circuit->cic + sngss7_span->rx_grs.range));
|
||||
|
||||
ftdm_call_clear_data(&ftdmchan->caller_data);
|
||||
|
||||
SS7_FUNC_TRACE_EXIT (__FUNCTION__);
|
||||
return;
|
||||
}
|
||||
@@ -688,7 +685,7 @@ void ft_to_sngss7_grs (ftdm_channel_t * ftdmchan)
|
||||
sngss7_info->circuit->cic,
|
||||
(sngss7_info->circuit->cic + sngss7_span->tx_grs.range));
|
||||
|
||||
ftdm_call_clear_data(&ftdmchan->caller_data);
|
||||
|
||||
SS7_FUNC_TRACE_EXIT (__FUNCTION__);
|
||||
return;
|
||||
}
|
||||
@@ -737,7 +734,7 @@ void ft_to_sngss7_cgba(ftdm_channel_t * ftdmchan)
|
||||
|
||||
/* clean out the saved data */
|
||||
memset(&sngss7_span->rx_cgb, 0x0, sizeof(sngss7_group_data_t));
|
||||
ftdm_call_clear_data(&ftdmchan->caller_data);
|
||||
|
||||
SS7_FUNC_TRACE_EXIT (__FUNCTION__);
|
||||
return;
|
||||
}
|
||||
@@ -787,7 +784,7 @@ void ft_to_sngss7_cgua(ftdm_channel_t * ftdmchan)
|
||||
/* clean out the saved data */
|
||||
memset(&sngss7_span->rx_cgu, 0x0, sizeof(sngss7_group_data_t));
|
||||
|
||||
ftdm_call_clear_data(&ftdmchan->caller_data);
|
||||
|
||||
SS7_FUNC_TRACE_EXIT (__FUNCTION__);
|
||||
return;
|
||||
}
|
||||
@@ -838,7 +835,7 @@ void ft_to_sngss7_cgb(ftdm_channel_t * ftdmchan)
|
||||
/* clean out the saved data */
|
||||
memset(&sngss7_span->tx_cgb, 0x0, sizeof(sngss7_group_data_t));
|
||||
|
||||
ftdm_call_clear_data(&ftdmchan->caller_data);
|
||||
|
||||
SS7_FUNC_TRACE_EXIT (__FUNCTION__);
|
||||
return;
|
||||
}
|
||||
@@ -889,7 +886,7 @@ void ft_to_sngss7_cgu(ftdm_channel_t * ftdmchan)
|
||||
/* clean out the saved data */
|
||||
memset(&sngss7_span->tx_cgu, 0x0, sizeof(sngss7_group_data_t));
|
||||
|
||||
ftdm_call_clear_data(&ftdmchan->caller_data);
|
||||
|
||||
SS7_FUNC_TRACE_EXIT (__FUNCTION__);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -207,7 +207,7 @@ ftdm_status_t enable_all_ckts_for_relay(void)
|
||||
SS7_DEBUG_CHAN(ftdmchan, "ISUP interface (%d) set to resume, resuming channel\n", sngIntf->id);
|
||||
/* throw the channel infId status flags to PAUSED ... they will be executed next process cycle */
|
||||
sngss7_set_ckt_flag(sngss7_info, FLAG_INFID_RESUME);
|
||||
sngss7_set_ckt_flag(sngss7_info, FLAG_INFID_PAUSED);
|
||||
sngss7_clear_ckt_flag(sngss7_info, FLAG_INFID_PAUSED);
|
||||
}
|
||||
} /* if (g_ftdm_sngss7_data.cfg.isupCkt[x].type == VOICE) */
|
||||
|
||||
|
||||
@@ -48,6 +48,7 @@ int ftmod_ss7_mtp3link_sta(uint32_t id, SnMngmt *cfm);
|
||||
int ftmod_ss7_mtplinkSet_sta(uint32_t id, SnMngmt *cfm);
|
||||
int ftmod_ss7_isup_intf_sta(uint32_t id, uint8_t *status);
|
||||
int ftmod_ss7_relay_status(uint32_t id, RyMngmt *cfm);
|
||||
int ftmod_ss7_isup_ckt_sta(uint32_t id, unsigned char *state);
|
||||
/******************************************************************************/
|
||||
|
||||
/* FUNCTIONS ******************************************************************/
|
||||
@@ -188,6 +189,43 @@ int ftmod_ss7_relay_status(uint32_t id, RyMngmt *cfm)
|
||||
return(sng_sta_relay(&pst, &sta, cfm));
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
int ftmod_ss7_isup_ckt_sta(uint32_t id, unsigned char *state)
|
||||
{
|
||||
SiMngmt sta;
|
||||
SiMngmt cfm;
|
||||
Pst pst;
|
||||
int ret;
|
||||
|
||||
memset(&sta, 0x0, sizeof(sta));
|
||||
|
||||
/* initalize the post structure */
|
||||
smPstInit(&pst);
|
||||
|
||||
/* insert the destination Entity */
|
||||
pst.dstEnt = ENTSI;
|
||||
|
||||
/* check the for the correct ProcId and make sure it goes to the right system */
|
||||
if (g_ftdm_sngss7_data.cfg.procId != 1) {
|
||||
pst.dstProcId = 1;
|
||||
}
|
||||
|
||||
/* request the status of an inftId */
|
||||
sta.hdr.entId.ent = ENTSI;
|
||||
sta.hdr.entId.inst = S_INST;
|
||||
sta.hdr.msgType = TSSTA;
|
||||
sta.hdr.elmId.elmnt = SI_STCIRGRP;
|
||||
|
||||
sta.t.ssta.elmntId.circuit = id;
|
||||
sta.t.ssta.param.cirgr.range = 1;
|
||||
|
||||
ret = sng_sta_isup(&pst, &sta, &cfm);
|
||||
|
||||
*state = cfm.t.ssta.cfm.s.cir.state[0];
|
||||
|
||||
return(ret);
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
/* For Emacs:
|
||||
* Local Variables:
|
||||
|
||||
@@ -83,6 +83,11 @@ int find_ssf_type_in_map(const char *ssfType);
|
||||
int find_cic_cntrl_in_map(const char *cntrlType);
|
||||
|
||||
ftdm_status_t check_status_of_all_isup_intf(void);
|
||||
|
||||
void sngss7_send_signal(sngss7_chan_data_t *sngss7_info, ftdm_signal_event_t event_id);
|
||||
void sngss7_set_sig_status(sngss7_chan_data_t *sngss7_info, ftdm_signaling_status_t status);
|
||||
ftdm_status_t sngss7_add_var(sngss7_chan_data_t *ss7_info, const char* var, const char* val);
|
||||
ftdm_status_t sngss7_add_raw_data(sngss7_chan_data_t *sngss7_info, uint8_t* data, ftdm_size_t data_len);
|
||||
/******************************************************************************/
|
||||
|
||||
/* FUNCTIONS ******************************************************************/
|
||||
@@ -560,14 +565,14 @@ ftdm_status_t check_if_rx_grs_started(ftdm_span_t *ftdmspan)
|
||||
case FTDM_CHANNEL_STATE_RESTART:
|
||||
|
||||
/* go to idle so that we can redo the restart state*/
|
||||
ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_IDLE);
|
||||
ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_IDLE);
|
||||
|
||||
break;
|
||||
/**************************************************************************/
|
||||
default:
|
||||
|
||||
/* set the state of the channel to restart...the rest is done by the chan monitor */
|
||||
ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_RESTART);
|
||||
ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_RESTART);
|
||||
break;
|
||||
/**************************************************************************/
|
||||
} /* switch (ftdmchan->state) */
|
||||
@@ -638,13 +643,13 @@ ftdm_status_t check_if_rx_grs_processed(ftdm_span_t *ftdmspan)
|
||||
sngss7_set_ckt_flag(sngss7_info, FLAG_GRP_RESET_RX_CMPLT);
|
||||
|
||||
/* move the channel to the down state */
|
||||
ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_DOWN);
|
||||
ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_DOWN);
|
||||
|
||||
/* update the status map if the ckt is in blocked state */
|
||||
if ((sngss7_test_ckt_flag(sngss7_info, FLAG_CKT_MN_BLOCK_RX)) ||
|
||||
(sngss7_test_ckt_flag(sngss7_info, FLAG_CKT_MN_BLOCK_TX)) ||
|
||||
(sngss7_test_ckt_flag(sngss7_info, FLAG_GRP_MN_BLOCK_RX)) ||
|
||||
(sngss7_test_ckt_flag(sngss7_info, FLAG_GRP_MN_BLOCK_RX))) {
|
||||
if ((sngss7_test_ckt_blk_flag(sngss7_info, FLAG_CKT_MN_BLOCK_RX)) ||
|
||||
(sngss7_test_ckt_blk_flag(sngss7_info, FLAG_CKT_MN_BLOCK_TX)) ||
|
||||
(sngss7_test_ckt_blk_flag(sngss7_info, FLAG_GRP_MN_BLOCK_RX)) ||
|
||||
(sngss7_test_ckt_blk_flag(sngss7_info, FLAG_GRP_MN_BLOCK_RX))) {
|
||||
|
||||
sngss7_span->rx_grs.status[byte] = (sngss7_span->rx_grs.status[byte] | (1 << bit));
|
||||
} /* if blocked */
|
||||
@@ -714,7 +719,7 @@ ftdm_status_t check_if_rx_gra_started(ftdm_span_t *ftdmspan)
|
||||
sngss7_set_ckt_flag(sngss7_info, FLAG_GRP_RESET_TX_RSP);
|
||||
|
||||
/* go to DOWN */
|
||||
ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_DOWN);
|
||||
ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_DOWN);
|
||||
|
||||
break;
|
||||
/**********************************************************************/
|
||||
@@ -743,7 +748,7 @@ ftdm_status_t check_if_rx_gra_started(ftdm_span_t *ftdmspan)
|
||||
}
|
||||
|
||||
/* go to terminating to hang up the call */
|
||||
ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_TERMINATING);
|
||||
ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_TERMINATING);
|
||||
break;
|
||||
/**********************************************************************/
|
||||
}
|
||||
@@ -795,7 +800,7 @@ ftdm_status_t check_for_res_sus_flag(ftdm_span_t *ftdmspan)
|
||||
|
||||
/* throw the channel into SUSPENDED to process the flag */
|
||||
/* after doing this once the sig status will be down */
|
||||
ftdm_set_state_locked (ftdmchan, FTDM_CHANNEL_STATE_SUSPENDED);
|
||||
ftdm_set_state (ftdmchan, FTDM_CHANNEL_STATE_SUSPENDED);
|
||||
}
|
||||
|
||||
/* if the RESUME flag is up go to SUSPENDED to process the flag */
|
||||
@@ -808,7 +813,7 @@ ftdm_status_t check_for_res_sus_flag(ftdm_span_t *ftdmspan)
|
||||
}
|
||||
|
||||
/* got SUSPENDED state to clear the flag */
|
||||
ftdm_set_state_locked (ftdmchan, FTDM_CHANNEL_STATE_SUSPENDED);
|
||||
ftdm_set_state (ftdmchan, FTDM_CHANNEL_STATE_SUSPENDED);
|
||||
}
|
||||
|
||||
/* unlock the channel */
|
||||
@@ -849,10 +854,10 @@ ftdm_status_t process_span_ucic(ftdm_span_t *ftdmspan)
|
||||
}
|
||||
|
||||
/* throw the ckt block flag */
|
||||
sngss7_set_ckt_flag(sngss7_info, FLAG_CKT_UCIC_BLOCK);
|
||||
sngss7_set_ckt_blk_flag(sngss7_info, FLAG_CKT_UCIC_BLOCK);
|
||||
|
||||
/* set the channel to suspended state */
|
||||
ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_SUSPENDED);
|
||||
ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_SUSPENDED);
|
||||
|
||||
/* unlock the channel again before we exit */
|
||||
ftdm_mutex_unlock(ftdmchan->mutex);
|
||||
@@ -1348,6 +1353,107 @@ ftdm_status_t check_status_of_all_isup_intf(void)
|
||||
return FTDM_SUCCESS;
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
ftdm_status_t sngss7_add_var(sngss7_chan_data_t *sngss7_info, const char* var, const char* val)
|
||||
{
|
||||
char *t_name = 0;
|
||||
char *t_val = 0;
|
||||
|
||||
/* confirm the user has sent us a value */
|
||||
if (!var || !val) {
|
||||
return FTDM_FAIL;
|
||||
}
|
||||
|
||||
if (!sngss7_info->variables) {
|
||||
/* initialize on first use */
|
||||
sngss7_info->variables = create_hashtable(16, ftdm_hash_hashfromstring, ftdm_hash_equalkeys);
|
||||
ftdm_assert_return(sngss7_info->variables, FTDM_FAIL, "Failed to create hash table\n");
|
||||
}
|
||||
|
||||
t_name = ftdm_strdup(var);
|
||||
t_val = ftdm_strdup(val);
|
||||
|
||||
hashtable_insert(sngss7_info->variables, t_name, t_val, HASHTABLE_FLAG_FREE_KEY | HASHTABLE_FLAG_FREE_VALUE);
|
||||
|
||||
return FTDM_SUCCESS;
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
ftdm_status_t sngss7_add_raw_data(sngss7_chan_data_t *sngss7_info, uint8_t* data, ftdm_size_t data_len)
|
||||
{
|
||||
ftdm_assert_return(!sngss7_info->raw_data, FTDM_FAIL, "Overwriting existing raw data\n");
|
||||
|
||||
sngss7_info->raw_data = ftdm_calloc(1, data_len);
|
||||
ftdm_assert_return(sngss7_info->raw_data, FTDM_FAIL, "Failed to allocate raw data\n");
|
||||
|
||||
memcpy(sngss7_info->raw_data, data, data_len);
|
||||
sngss7_info->raw_data_len = data_len;
|
||||
return FTDM_SUCCESS;
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
void sngss7_send_signal(sngss7_chan_data_t *sngss7_info, ftdm_signal_event_t event_id)
|
||||
{
|
||||
ftdm_sigmsg_t sigev;
|
||||
ftdm_channel_t *ftdmchan = sngss7_info->ftdmchan;
|
||||
|
||||
memset(&sigev, 0, sizeof(sigev));
|
||||
|
||||
sigev.chan_id = ftdmchan->chan_id;
|
||||
sigev.span_id = ftdmchan->span_id;
|
||||
sigev.channel = ftdmchan;
|
||||
sigev.event_id = event_id;
|
||||
|
||||
if (sngss7_info->variables) {
|
||||
/*
|
||||
* variables now belongs to the ftdm core, and
|
||||
* will be cleared after sigev is processed by user. Set
|
||||
* local pointer to NULL so we do not attempt to
|
||||
* destroy it */
|
||||
sigev.variables = sngss7_info->variables;
|
||||
sngss7_info->variables = NULL;
|
||||
}
|
||||
|
||||
if (sngss7_info->raw_data) {
|
||||
/*
|
||||
* raw_data now belongs to the ftdm core, and
|
||||
* will be cleared after sigev is processed by user. Set
|
||||
* local pointer to NULL so we do not attempt to
|
||||
* destroy it */
|
||||
|
||||
sigev.raw.data = sngss7_info->raw_data;
|
||||
sigev.raw.len = sngss7_info->raw_data_len;
|
||||
|
||||
sngss7_info->raw_data = NULL;
|
||||
sngss7_info->raw_data_len = 0;
|
||||
}
|
||||
ftdm_span_send_signal(ftdmchan->span, &sigev);
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
void sngss7_set_sig_status(sngss7_chan_data_t *sngss7_info, ftdm_signaling_status_t status)
|
||||
{
|
||||
ftdm_sigmsg_t sig;
|
||||
ftdm_channel_t *ftdmchan = sngss7_info->ftdmchan;
|
||||
|
||||
SS7_DEBUG_CHAN(ftdmchan, "Signalling link status changed to %s\n",
|
||||
ftdm_signaling_status2str(status));
|
||||
|
||||
memset(&sig, 0, sizeof(sig));
|
||||
|
||||
sig.chan_id = ftdmchan->chan_id;
|
||||
sig.span_id = ftdmchan->span_id;
|
||||
sig.channel = ftdmchan;
|
||||
sig.event_id = FTDM_SIGEVENT_SIGSTATUS_CHANGED;
|
||||
sig.ev_data.sigstatus.status = status;
|
||||
|
||||
if (ftdm_span_send_signal(ftdmchan->span, &sig) != FTDM_SUCCESS) {
|
||||
SS7_ERROR_CHAN(ftdmchan, "Failed to change channel status to %s\n",
|
||||
ftdm_signaling_status2str(status));
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
/* For Emacs:
|
||||
* Local Variables:
|
||||
|
||||
@@ -67,7 +67,7 @@ void handle_isup_t35(void *userdata)
|
||||
ftdmchan->caller_data.hangup_cause = 28;
|
||||
|
||||
/* end the call */
|
||||
ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_CANCEL);
|
||||
ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_CANCEL);
|
||||
|
||||
/*unlock*/
|
||||
ftdm_mutex_unlock(ftdmchan->mutex);
|
||||
|
||||
Reference in new issue
Block a user