chlog:freetdm: Support for SS7 - SPIROU TXA and ITX messages

This commit is contained in:
David Yat Sin 2011-04-29 16:23:18 -04:00
parent 65a324b8ba
commit 7e8c44a407
4 changed files with 115 additions and 7 deletions

View File

@ -480,6 +480,47 @@ ftdm_status_t handle_con_sta(uint32_t suInstId, uint32_t spInstId, uint32_t circ
case (SUBDIRNUM):
SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Rx SUB-DIR\n", sngss7_info->circuit->cic);
break;
#ifdef SANGOMA_SPIROU
case (CHARGE_ACK):
SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Rx TXA\n", sngss7_info->circuit->cic);
break;
case (CHARGE_UNIT):
{
uint32_t charging_unit = 0;
uint32_t msg_num = 0;
char val[3];
SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Rx ITX\n", sngss7_info->circuit->cic);
memset(val, '\0', sizeof(val));
if (siCnStEvnt->chargUnitNum.eh.pres == PRSNT_NODEF &&
siCnStEvnt->chargUnitNum.chargUnitNum.pres == PRSNT_NODEF) {
charging_unit = siCnStEvnt->chargUnitNum.chargUnitNum.val;
}
if (siCnStEvnt->msgNum.eh.pres == PRSNT_NODEF &&
siCnStEvnt->msgNum.msgNum.pres == PRSNT_NODEF) {
msg_num = siCnStEvnt->msgNum.msgNum.val;
}
ftdm_log_chan(ftdmchan, FTDM_LOG_INFO, "Charging Unit:%d Msg Num:%d\n", charging_unit, msg_num);
sprintf(val, "%d", charging_unit);
sngss7_add_var(sngss7_info, "ss7_itx_charge_unit", val);
sprintf(val, "%d", msg_num);
sngss7_add_var(sngss7_info, "ss7_itx_msg_num", val);
if (sngss7_info->circuit->itx_auto_reply) {
ftdm_log_chan_msg(ftdmchan, FTDM_LOG_INFO, "Auto-reply with TXA msg\n");
ft_to_sngss7_txa (ftdmchan);
}
}
break;
#endif
/**************************************************************************/
default:
SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Rx Unknown Msg\n", sngss7_info->circuit->cic);
@ -522,7 +563,7 @@ ftdm_status_t handle_con_cfm(uint32_t suInstId, uint32_t spInstId, uint32_t circ
/* go to UP */
ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_UP);
break;
/**************************************************************************/
case FTDM_CHANNEL_STATE_DIALING:

View File

@ -322,6 +322,7 @@ typedef struct sng_isup_ckt {
uint8_t rdnis_nadi;
uint32_t min_digits;
uint8_t itx_auto_reply;
void *obj;
uint16_t t3;
uint16_t t12;
@ -728,6 +729,9 @@ void ft_to_sngss7_cgba(ftdm_channel_t * ftdmchan);
void ft_to_sngss7_cgua(ftdm_channel_t * ftdmchan);
void ft_to_sngss7_cgb(ftdm_channel_t * ftdmchan);
void ft_to_sngss7_cgu(ftdm_channel_t * ftdmchan);
void ft_to_sngss7_itx (ftdm_channel_t * ftdmchan);
void ft_to_sngss7_txa (ftdm_channel_t * ftdmchan);
/* in ftmod_sangoma_ss7_in.c */
void sngss7_sta_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt);

View File

@ -187,7 +187,7 @@ void ft_to_sngss7_iam (ftdm_channel_t * ftdmchan)
/* check if the user would like a custom NADI value for the calling Pty Num */
clg_nadi = ftdm_usrmsg_get_var(ftdmchan->usrmsg, "ss7_clg_nadi");
if ((clg_nadi != NULL) && (*clg_nadi)) {
if (!ftdm_strlen_zero(clg_nadi)) {
SS7_DEBUG_CHAN(ftdmchan,"Found user supplied Calling NADI value \"%s\"\n", clg_nadi);
iam.cgPtyNum.natAddrInd.val = atoi(clg_nadi);
} else {
@ -196,7 +196,7 @@ void ft_to_sngss7_iam (ftdm_channel_t * ftdmchan)
}
cld_nadi = ftdm_usrmsg_get_var(ftdmchan->usrmsg, "ss7_cld_nadi");
if ((cld_nadi != NULL) && (*cld_nadi)) {
if (!ftdm_strlen_zero(cld_nadi)) {
SS7_DEBUG_CHAN(ftdmchan,"Found user supplied Called NADI value \"%s\"\n", cld_nadi);
iam.cdPtyNum.natAddrInd.val = atoi(cld_nadi);
} else {
@ -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_usrmsg_get_var(ftdmchan->usrmsg, "ss7_clg_subaddr");
if ((clg_subAddr != NULL) && (*clg_subAddr)) {
if (!ftdm_strlen_zero(clg_subAddr)) {
SS7_DEBUG_CHAN(ftdmchan,"Found user supplied Calling Sub-Address value \"%s\"\n", clg_subAddr);
/* clean out the subAddrIE */
@ -302,7 +302,6 @@ void ft_to_sngss7_iam (ftdm_channel_t * ftdmchan)
return;
}
/******************************************************************************/
void ft_to_sngss7_acm (ftdm_channel_t * ftdmchan)
{
SS7_FUNC_TRACE_ENTER (__FUNCTION__);
@ -382,7 +381,6 @@ void ft_to_sngss7_acm (ftdm_channel_t * ftdmchan)
return;
}
/******************************************************************************/
void ft_to_sngss7_anm (ftdm_channel_t * ftdmchan)
{
SS7_FUNC_TRACE_ENTER (__FUNCTION__);
@ -892,6 +890,67 @@ void ft_to_sngss7_cgu(ftdm_channel_t * ftdmchan)
return;
}
/* French SPIROU send Charge Unit */
/* No one calls this function yet, but it has been implemented to complement TXA messages */
void ft_to_sngss7_itx (ftdm_channel_t * ftdmchan)
{
const char* var = NULL;
SS7_FUNC_TRACE_ENTER (__FUNCTION__);
#ifndef SANGOMA_SPIROU
ftdm_log_chan_msg(ftdmchan, FTDM_LOG_CRIT, "ITX message not supported!, please update your libsng_ss7\n");
#else
sngss7_chan_data_t *sngss7_info = ftdmchan->call_data;
SiCnStEvnt itx;
memset (&itx, 0x0, sizeof (itx));
itx.msgNum.eh.pres = PRSNT_NODEF;
itx.msgNum.msgNum.pres = PRSNT_NODEF;
var = ftdm_usrmsg_get_var(ftdmchan->usrmsg, "ss7_itx_msg_num");
if (!ftdm_strlen_zero(var)) {
itx.msgNum.msgNum.val = atoi(var);
} else {
itx.msgNum.msgNum.val = 0x0;
}
itx.chargUnitNum.eh.pres = PRSNT_NODEF;
itx.chargUnitNum.chargUnitNum.pres = PRSNT_NODEF;
var = ftdm_usrmsg_get_var(ftdmchan->usrmsg, "ss7_itx_charge_unit");
if (!ftdm_strlen_zero(var)) {
itx.chargUnitNum.chargUnitNum.val = atoi(var);
} else {
itx.chargUnitNum.chargUnitNum.val = 0x0;
}
ftdm_log_chan(ftdmchan, FTDM_LOG_INFO, "ITX Charging Unit:%d Msg Num:%d\n", itx.chargUnitNum.chargUnitNum.val, itx.msgNum.msgNum.val);
sng_cc_con_status (1, sngss7_info->suInstId, sngss7_info->spInstId, sngss7_info->circuit->id, &itx, CHARGE_UNIT);
SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Tx ITX\n", sngss7_info->circuit->cic);
#endif
SS7_FUNC_TRACE_EXIT (__FUNCTION__);
return;
}
/* French SPIROU send Charging Acknowledgement */
void ft_to_sngss7_txa (ftdm_channel_t * ftdmchan)
{
#ifndef SANGOMA_SPIROU
SS7_FUNC_TRACE_ENTER (__FUNCTION__);
ftdm_log_chan_msg(ftdmchan, FTDM_LOG_CRIT, "TXA message not supported!, please update your libsng_ss7\n");
#else
SiCnStEvnt txa;
sngss7_chan_data_t *sngss7_info = ftdmchan->call_data;
SS7_FUNC_TRACE_ENTER (__FUNCTION__);
memset (&txa, 0x0, sizeof(txa));
sng_cc_con_status(1, sngss7_info->suInstId, sngss7_info->spInstId, sngss7_info->circuit->id, &txa, CHARGE_ACK);
SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Tx TXA\n", sngss7_info->circuit->cic);
#endif
SS7_FUNC_TRACE_EXIT (__FUNCTION__);
return;
}
/******************************************************************************/
/* For Emacs:

View File

@ -124,6 +124,7 @@ typedef struct sng_ccSpan
uint32_t cld_nadi;
uint32_t rdnis_nadi;
uint32_t min_digits;
uint32_t itx_auto_reply;
uint32_t t3;
uint32_t t12;
uint32_t t13;
@ -1892,7 +1893,9 @@ static int ftmod_ss7_parse_cc_span(ftdm_conf_node_t *cc_span)
sng_ccSpan.typeCntrl = sng_cic_cntrl_type_map[ret].tril_type;
SS7_DEBUG("Found an ccSpan typeCntrl = %s\n", sng_cic_cntrl_type_map[ret].sng_type);
}
/**********************************************************************/
} else if (!strcasecmp(parm->var, "itx_auto_reply")) {
sng_ccSpan.itx_auto_reply = ftdm_true(parm->val);
SS7_DEBUG("Found itx_auto_reply %d\n", sng_ccSpan.itx_auto_reply);
} else if (!strcasecmp(parm->var, "cicbase")) {
/**********************************************************************/
sng_ccSpan.cicbase = atoi(parm->val);
@ -2913,6 +2916,7 @@ static int ftmod_ss7_fill_in_ccSpan(sng_ccSpan_t *ccSpan)
g_ftdm_sngss7_data.cfg.isupCkt[x].options = ccSpan->options;
g_ftdm_sngss7_data.cfg.isupCkt[x].switchType = ccSpan->switchType;
g_ftdm_sngss7_data.cfg.isupCkt[x].min_digits = ccSpan->min_digits;
g_ftdm_sngss7_data.cfg.isupCkt[x].itx_auto_reply = ccSpan->itx_auto_reply;
if (ccSpan->t3 == 0) {
g_ftdm_sngss7_data.cfg.isupCkt[x].t3 = 1200;