freetdm: fixing glare
- adding configuration of glare handling rule - fixed cic status remains COLLECTING
This commit is contained in:
parent
7b3a3d86b9
commit
a46c03ef65
|
@ -33,6 +33,7 @@
|
|||
* Contributors:
|
||||
*
|
||||
* Ricardo Barroetaveña <rbarroetavena@anura.com.ar>
|
||||
* James Zhang <jzhang@sangoma.com>
|
||||
*
|
||||
*/
|
||||
|
||||
|
@ -96,7 +97,7 @@ ftdm_status_t handle_con_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circ
|
|||
sngss7_chan_data_t *sngss7_info = NULL;
|
||||
ftdm_channel_t *ftdmchan = NULL;
|
||||
char var[FTDM_DIGITS_LIMIT];
|
||||
|
||||
|
||||
memset(var, '\0', sizeof(var));
|
||||
|
||||
ftdm_running_return(FTDM_FAIL);
|
||||
|
@ -199,7 +200,6 @@ ftdm_status_t handle_con_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circ
|
|||
} else {
|
||||
SS7_INFO_CHAN(ftdmchan,"No Called party (DNIS) information in IAM!%s\n", " ");
|
||||
}
|
||||
|
||||
copy_redirgNum_from_sngss7(ftdmchan, &siConEvnt->redirgNum);
|
||||
copy_redirgInfo_from_sngss7(ftdmchan, &siConEvnt->redirInfo);
|
||||
copy_genNmb_from_sngss7(ftdmchan, &siConEvnt->genNmb);
|
||||
|
|
|
@ -35,6 +35,7 @@
|
|||
*
|
||||
* Moises Silva <moy@sangoma.com>
|
||||
* David Yat Sin <dyatsin@sangoma.com>
|
||||
* James Zhang <jzhang@sangoma.com>
|
||||
*
|
||||
*/
|
||||
|
||||
|
@ -1086,14 +1087,12 @@ ftdm_status_t ftdm_sangoma_ss7_process_state_change (ftdm_channel_t *ftdmchan)
|
|||
/*now go to the RING state */
|
||||
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 */
|
||||
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 */
|
||||
if (ftdmchan->last_state != FTDM_CHANNEL_STATE_IDLE) {
|
||||
|
@ -1101,7 +1100,7 @@ ftdm_status_t ftdm_sangoma_ss7_process_state_change (ftdm_channel_t *ftdmchan)
|
|||
i,
|
||||
sngss7_info->circuit->min_digits,
|
||||
ftdmchan->caller_data.dnis.digits);
|
||||
|
||||
|
||||
/* start ISUP t35 */
|
||||
if (ftdm_sched_timer (sngss7_info->t35.sched,
|
||||
"t35",
|
||||
|
@ -1530,20 +1529,47 @@ ftdm_status_t ftdm_sangoma_ss7_process_state_change (ftdm_channel_t *ftdmchan)
|
|||
|
||||
/* check if there is a glared call that needs to be processed */
|
||||
if (sngss7_test_ckt_flag(sngss7_info, FLAG_GLARE)) {
|
||||
|
||||
/* clear the glare flag */
|
||||
sngss7_clear_ckt_flag (sngss7_info, FLAG_GLARE);
|
||||
|
||||
/* check if we have an IAM stored...if we don't have one just exit */
|
||||
if (sngss7_info->glare.circuit != 0) {
|
||||
/* send the saved call back in to us */
|
||||
handle_con_ind (0,
|
||||
sngss7_info->glare.spInstId,
|
||||
sngss7_info->glare.circuit,
|
||||
&sngss7_info->glare.iam);
|
||||
int bHandle=0;
|
||||
switch (g_ftdm_sngss7_data.cfg.glareResolution) {
|
||||
case SNGSS7_GLARE_DOWN:
|
||||
SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Giving control to the other side, handling copied IAM from glare. \n", sngss7_info->circuit->cic);
|
||||
bHandle = 1;
|
||||
break;
|
||||
|
||||
case SNGSS7_GLARE_PC:
|
||||
SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Trying to handle IAM copied from glare. \n", sngss7_info->circuit->cic);
|
||||
SS7_INFO_CHAN(ftdmchan,"[CIC:%d]My PC = %d, incoming PC = %d. \n", sngss7_info->circuit->cic,
|
||||
g_ftdm_sngss7_data.cfg.isupIntf[sngss7_info->circuit->infId].spc,
|
||||
g_ftdm_sngss7_data.cfg.isupIntf[sngss7_info->circuit->infId].dpc );
|
||||
|
||||
if( g_ftdm_sngss7_data.cfg.isupIntf[sngss7_info->circuit->infId].spc > g_ftdm_sngss7_data.cfg.isupIntf[sngss7_info->circuit->infId].dpc )
|
||||
{
|
||||
if ((sngss7_info->circuit->cic % 2) == 1 ) {
|
||||
bHandle = 1;
|
||||
}
|
||||
} else {
|
||||
if( (sngss7_info->circuit->cic % 2) == 0 ) {
|
||||
bHandle = 1;
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
default: /* if configured as SNGSS7_GLARE_CONTROL, always abandon incoming glared IAM. */
|
||||
bHandle = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
if (!bHandle) {
|
||||
SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Handling glare IAM. \n", sngss7_info->circuit->cic);
|
||||
handle_con_ind (0, sngss7_info->glare.spInstId, sngss7_info->glare.circuit, &sngss7_info->glare.iam);
|
||||
}
|
||||
|
||||
/* clear the glare info */
|
||||
memset(&sngss7_info->glare, 0x0, sizeof(sngss7_glare_data_t));
|
||||
state_flag = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -29,6 +29,12 @@
|
|||
* 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.
|
||||
*
|
||||
*
|
||||
* Contributors:
|
||||
*
|
||||
* James Zhang <jzhang@sangoma.com>
|
||||
*
|
||||
*/
|
||||
/******************************************************************************/
|
||||
#ifndef __FTMOD_SNG_SS7_H__
|
||||
|
@ -195,6 +201,21 @@ typedef struct sng_mtp2_link {
|
|||
uint32_t t7;
|
||||
} sng_mtp2_link_t;
|
||||
|
||||
/* defining glare handling methods:
|
||||
SNGSS7_GLARE_PC:
|
||||
higher PointCode controls even number CIC
|
||||
lower PointCode controls odd number CIC
|
||||
SNGSS7_GLARE_DOWN:
|
||||
always give control to the other side
|
||||
SNGSS7_GLARE_CONTROL:
|
||||
always trying to control
|
||||
*/
|
||||
typedef enum {
|
||||
SNGSS7_GLARE_PC = 0,
|
||||
SNGSS7_GLARE_DOWN,
|
||||
SNGSS7_GLARE_CONTROL
|
||||
} sng_glare_resolution;
|
||||
|
||||
typedef struct sng_mtp3_link {
|
||||
char name[MAX_NAME_LEN];
|
||||
uint32_t flags;
|
||||
|
@ -444,6 +465,7 @@ typedef struct sng_ss7_cfg {
|
|||
sng_isup_ckt_t isupCkt[10000]; /* KONRAD - only need 2000 ( and 0-1000 aren't used) since other servers are registerd else where */
|
||||
sng_nsap_t nsap[MAX_NSAPS+1];
|
||||
sng_isap_t isap[MAX_ISAPS+1];
|
||||
sng_glare_resolution glareResolution;
|
||||
} sng_ss7_cfg_t;
|
||||
|
||||
typedef struct ftdm_sngss7_data {
|
||||
|
|
|
@ -29,6 +29,12 @@
|
|||
* 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.
|
||||
*
|
||||
*
|
||||
* Contributors:
|
||||
*
|
||||
* James Zhang <jzhang@sangoma.com>
|
||||
*
|
||||
*/
|
||||
|
||||
/* INCLUDE ********************************************************************/
|
||||
|
@ -191,6 +197,7 @@ static int ftmod_ss7_fill_in_self_route(int spc, int linkType, int switchType, i
|
|||
static int ftmod_ss7_fill_in_circuits(sng_span_t *sngSpan);
|
||||
|
||||
static int ftmod_ss7_next_timeslot(char *ch_map, sng_timeslot_t *timeslot);
|
||||
static void ftmod_ss7_set_glare_resolution (const char *method);
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
|
@ -451,6 +458,26 @@ static int ftmod_ss7_parse_sng_isup(ftdm_conf_node_t *sng_isup)
|
|||
return FTDM_SUCCESS;
|
||||
}
|
||||
|
||||
static void ftmod_ss7_set_glare_resolution (const char *method)
|
||||
{
|
||||
sng_glare_resolution iMethod=SNGSS7_GLARE_PC;
|
||||
if (!method || (strlen (method) <=0) ) {
|
||||
SS7_ERROR( "Wrong glare resolution parameter, using default. \n" );
|
||||
} else {
|
||||
if (!strcasecmp( method, "PointCode")) {
|
||||
iMethod = SNGSS7_GLARE_PC;
|
||||
} else if (!strcasecmp( method, "Down")) {
|
||||
iMethod = SNGSS7_GLARE_DOWN;
|
||||
} else if (!strcasecmp( method, "Control")) {
|
||||
iMethod = SNGSS7_GLARE_CONTROL;
|
||||
} else {
|
||||
SS7_ERROR( "Wrong glare resolution parameter, using default. \n" );
|
||||
iMethod = SNGSS7_GLARE_PC;
|
||||
}
|
||||
}
|
||||
g_ftdm_sngss7_data.cfg.glareResolution = iMethod;
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
static int ftmod_ss7_parse_sng_gen(ftdm_conf_node_t *sng_gen)
|
||||
{
|
||||
|
@ -463,28 +490,27 @@ static int ftmod_ss7_parse_sng_gen(ftdm_conf_node_t *sng_gen)
|
|||
|
||||
/* extract all the information from the parameters */
|
||||
for (i = 0; i < num_parms; i++) {
|
||||
/**************************************************************************/
|
||||
|
||||
if (!strcasecmp(parm->var, "procId")) {
|
||||
/**********************************************************************/
|
||||
g_ftdm_sngss7_data.cfg.procId = atoi(parm->val);
|
||||
SS7_DEBUG("Found a procId = %d\n", g_ftdm_sngss7_data.cfg.procId);
|
||||
/**********************************************************************/
|
||||
} else if (!strcasecmp(parm->var, "license")) {
|
||||
/**********************************************************************/
|
||||
}
|
||||
else if (!strcasecmp(parm->var, "license")) {
|
||||
ftdm_set_string(g_ftdm_sngss7_data.cfg.license, parm->val);
|
||||
snprintf(g_ftdm_sngss7_data.cfg.signature, sizeof(g_ftdm_sngss7_data.cfg.signature), "%s.sig", parm->val);
|
||||
SS7_DEBUG("Found license file = %s\n", g_ftdm_sngss7_data.cfg.license);
|
||||
SS7_DEBUG("Found signature file = %s\n", g_ftdm_sngss7_data.cfg.signature);
|
||||
/**********************************************************************/
|
||||
} else if (!strcasecmp(parm->var, "transparent_iam_max_size")) {
|
||||
}
|
||||
else if (!strcasecmp(parm->var, "transparent_iam_max_size")) {
|
||||
g_ftdm_sngss7_data.cfg.transparent_iam_max_size = atoi(parm->val);
|
||||
SS7_DEBUG("Found a transparent_iam max size = %d\n", g_ftdm_sngss7_data.cfg.transparent_iam_max_size);
|
||||
} else {
|
||||
/**********************************************************************/
|
||||
}
|
||||
else if (!strcasecmp(parm->var, "glare-reso")) {
|
||||
ftmod_ss7_set_glare_resolution (parm->val);
|
||||
SS7_DEBUG("Found glare resolution configuration = %d %s\n", g_ftdm_sngss7_data.cfg.glareResolution, parm->val );
|
||||
}
|
||||
else {
|
||||
SS7_ERROR("Found an invalid parameter \"%s\"!\n", parm->val);
|
||||
return FTDM_FAIL;
|
||||
/**********************************************************************/
|
||||
}
|
||||
|
||||
/* move to the next parmeter */
|
||||
|
|
Loading…
Reference in New Issue