From e15d52bd80b29327617b52c7f382f3f4cb8f7228 Mon Sep 17 00:00:00 2001 From: Konrad Hammel Date: Wed, 1 Sep 2010 12:44:28 -0400 Subject: [PATCH] freetdm: ss7 - updated to allow TMR/bearer cap pass-through --- .../ftmod_sangoma_ss7_handle.c | 78 +++++++---- .../ftmod_sangoma_ss7/ftmod_sangoma_ss7_out.c | 130 +++++++++--------- 2 files changed, 117 insertions(+), 91 deletions(-) diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_handle.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_handle.c index d1f3a8b89c..a0bf95b09c 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_handle.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_handle.c @@ -41,7 +41,6 @@ /* GLOBALS ********************************************************************/ /******************************************************************************/ -/* PROTOTYPES *****************************************************************/ /* PROTOTYPES *****************************************************************/ ftdm_status_t handle_con_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, SiConEvnt *siConEvnt); ftdm_status_t handle_con_sta(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, SiCnStEvnt *siCnStEvnt, uint8_t evntType); @@ -140,43 +139,68 @@ ftdm_status_t handle_con_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circ } else { - /* fill in cid/ani number */ - if (siConEvnt->cgPtyNum.addrSig.pres) { - copy_tknStr_from_sngss7(siConEvnt->cgPtyNum.addrSig, - ftdmchan->caller_data.cid_num.digits, - siConEvnt->cgPtyNum.oddEven); + /* fill in calling party information */ + if (siConEvnt->cgPtyNum.eh.pres) { + if (siConEvnt->cgPtyNum.addrSig.pres) { + /* fill in cid_num */ + copy_tknStr_from_sngss7(siConEvnt->cgPtyNum.addrSig, + ftdmchan->caller_data.cid_num.digits, + siConEvnt->cgPtyNum.oddEven); - /* fill in cid Name */ - ftdm_set_string(ftdmchan->caller_data.cid_name, ftdmchan->caller_data.cid_num.digits); + /* fill in cid Name */ + ftdm_set_string(ftdmchan->caller_data.cid_name, ftdmchan->caller_data.cid_num.digits); - ftdm_set_string(ftdmchan->caller_data.ani.digits, ftdmchan->caller_data.cid_num.digits); + /* fill in ANI */ + ftdm_set_string(ftdmchan->caller_data.ani.digits, ftdmchan->caller_data.cid_num.digits); + } + if (siConEvnt->cgPtyNum.scrnInd.pres) { + /* fill in the screening indication value */ + ftdmchan->caller_data.screen = siConEvnt->cgPtyNum.scrnInd.val; + } + + if (siConEvnt->cgPtyNum.presRest.pres) { + /* fill in the presentation value */ + ftdmchan->caller_data.pres = siConEvnt->cgPtyNum.presRest.val; + } } else { - SS7_INFO("No Calling party (ANI) information in IAM!\n"); + SS7_INFO_CHAN(ftdmchan,"No Calling party (ANI) information in IAM!%s\n", " "); } - /* fill in dnis */ - if (siConEvnt->cdPtyNum.addrSig.pres) { - copy_tknStr_from_sngss7(siConEvnt->cdPtyNum.addrSig, - ftdmchan->caller_data.dnis.digits, - siConEvnt->cdPtyNum.oddEven); + /* fill in called party infomation */ + if (siConEvnt->cdPtyNum.eh.pres) { + if (siConEvnt->cdPtyNum.addrSig.pres) { + /* fill in the called number/dnis */ + copy_tknStr_from_sngss7(siConEvnt->cdPtyNum.addrSig, + ftdmchan->caller_data.dnis.digits, + siConEvnt->cdPtyNum.oddEven); + } + } else { + SS7_INFO_CHAN(ftdmchan,"No Called party (DNIS) information in IAM!%s\n", " "); + } + + /* fill in rdnis information*/ + if (siConEvnt->redirgNum.eh.pres) { + if (siConEvnt->redirgNum.addrSig.pres) { + /* fill in the rdnis digits */ + copy_tknStr_from_sngss7(siConEvnt->redirgNum.addrSig, + ftdmchan->caller_data.rdnis.digits, + siConEvnt->cgPtyNum.oddEven); + } } else { - SS7_INFO("No Called party (DNIS) information in IAM!\n"); + SS7_DEBUG_CHAN(ftdmchan,"No RDNIS party information in IAM!%s\n", " "); } - /* fill in rdnis */ - if (siConEvnt->redirgNum.addrSig.pres) { - copy_tknStr_from_sngss7(siConEvnt->redirgNum.addrSig, - ftdmchan->caller_data.rdnis.digits, - siConEvnt->cgPtyNum.oddEven); - } else { - SS7_INFO("No RDNIS party information in IAM!\n"); + /* fill in the TMR/bearer capability */ + if (siConEvnt->txMedReq.eh.pres) { + if (siConEvnt->txMedReq.trMedReq.pres) { + /* fill in the bearer type */ + ftdmchan->caller_data.bearer_capability = siConEvnt->txMedReq.trMedReq.val; + } + } else { + SS7_DEBUG_CHAN(ftdmchan,"No TMR/Bearer Cap information in IAM!%s\n", " "); } - /* fill in screening/presentation */ - ftdmchan->caller_data.screen = siConEvnt->cgPtyNum.scrnInd.val; - ftdmchan->caller_data.pres = siConEvnt->cgPtyNum.presRest.val; - /* 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); diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_out.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_out.c index 53d0f9d937..600a52910c 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_out.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_out.c @@ -64,70 +64,72 @@ void ft_to_sngss7_grs (ftdm_channel_t * ftdmchan); void ft_to_sngss7_iam (ftdm_channel_t * ftdmchan) { - SS7_FUNC_TRACE_ENTER (__FUNCTION__); - - sngss7_chan_data_t *sngss7_info = ftdmchan->call_data;; - SiConEvnt iam; - - sngss7_info->suInstId = get_unique_id (); - sngss7_info->spInstId = 0; - sngss7_info->spId = 1; - - memset (&iam, 0x0, sizeof (iam)); - - /* copy down the nature of connection indicators */ - iam.natConInd.eh.pres = PRSNT_NODEF; - iam.natConInd.satInd.pres = PRSNT_NODEF; - iam.natConInd.satInd.val = 0; - iam.natConInd.contChkInd.pres = PRSNT_NODEF; - iam.natConInd.contChkInd.val = 0x00; - iam.natConInd.echoCntrlDevInd.pres = PRSNT_NODEF; - iam.natConInd.echoCntrlDevInd.val = 0x01; - - /* copy down the forward call indicators */ - iam.fwdCallInd.eh.pres = PRSNT_NODEF; - iam.fwdCallInd.natIntCallInd.pres = PRSNT_NODEF; - iam.fwdCallInd.natIntCallInd.val = 0x00; - iam.fwdCallInd.end2EndMethInd.pres = PRSNT_NODEF; - iam.fwdCallInd.end2EndMethInd.val = 0x00; - iam.fwdCallInd.intInd.pres = PRSNT_NODEF; - iam.fwdCallInd.intInd.val = 0x01; - iam.fwdCallInd.end2EndInfoInd.pres = PRSNT_NODEF; - iam.fwdCallInd.end2EndInfoInd.val = 0x00; - iam.fwdCallInd.isdnUsrPrtInd.pres = PRSNT_NODEF; - iam.fwdCallInd.isdnUsrPrtInd.val = 0x01; - iam.fwdCallInd.isdnUsrPrtPrfInd.pres = PRSNT_NODEF; - iam.fwdCallInd.isdnUsrPrtPrfInd.val = 0x02; - iam.fwdCallInd.isdnAccInd.pres = PRSNT_NODEF; - iam.fwdCallInd.isdnAccInd.val = 0x01; - iam.fwdCallInd.sccpMethInd.pres = PRSNT_NODEF; - iam.fwdCallInd.sccpMethInd.val = 0x00; - - /* copy down the calling number information */ - iam.cgPtyCat.eh.pres = PRSNT_NODEF; - iam.cgPtyCat.cgPtyCat.pres = PRSNT_NODEF; - iam.cgPtyCat.cgPtyCat.val = 0x0a; - - /* copy down the transmission medium requirements */ - iam.txMedReq.eh.pres = PRSNT_NODEF; - iam.txMedReq.trMedReq.pres = PRSNT_NODEF; - iam.txMedReq.trMedReq.val = 0; /* SPEECH = 0, 3.1Khz = 3, 64k unres = 2 */ - - /* copy down the called number information */ - copy_cdPtyNum_to_sngss7 (&ftdmchan->caller_data, &iam.cdPtyNum); - - /* copy down the calling number information */ - copy_cgPtyNum_to_sngss7 (&ftdmchan->caller_data, &iam.cgPtyNum); - - sng_cc_con_request (sngss7_info->spId, - sngss7_info->suInstId, - sngss7_info->spInstId, - sngss7_info->circuit->id, &iam, 0); - - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Tx IAM\n"); - - SS7_FUNC_TRACE_EXIT (__FUNCTION__); - return; + SS7_FUNC_TRACE_ENTER (__FUNCTION__); + + sngss7_chan_data_t *sngss7_info = ftdmchan->call_data;; + SiConEvnt iam; + + sngss7_info->suInstId = get_unique_id (); + sngss7_info->spInstId = 0; + sngss7_info->spId = 1; + + memset (&iam, 0x0, sizeof (iam)); + + /* copy down the nature of connection indicators */ + iam.natConInd.eh.pres = PRSNT_NODEF; + iam.natConInd.satInd.pres = PRSNT_NODEF; + iam.natConInd.satInd.val = 0; /* no satellite circuit */ + iam.natConInd.contChkInd.pres = PRSNT_NODEF; + iam.natConInd.contChkInd.val = CONTCHK_NOTREQ; + iam.natConInd.echoCntrlDevInd.pres = PRSNT_NODEF; + iam.natConInd.echoCntrlDevInd.val = ECHOCDEV_INCL; + + /* copy down the forward call indicators */ + iam.fwdCallInd.eh.pres = PRSNT_NODEF; + iam.fwdCallInd.natIntCallInd.pres = PRSNT_NODEF; + iam.fwdCallInd.natIntCallInd.val = 0x00; + iam.fwdCallInd.end2EndMethInd.pres = PRSNT_NODEF; + iam.fwdCallInd.end2EndMethInd.val = E2EMTH_NOMETH; + iam.fwdCallInd.intInd.pres = PRSNT_NODEF; + iam.fwdCallInd.intInd.val = INTIND_NOINTW; + iam.fwdCallInd.end2EndInfoInd.pres = PRSNT_NODEF; + iam.fwdCallInd.end2EndInfoInd.val = E2EINF_NOINFO; + iam.fwdCallInd.isdnUsrPrtInd.pres = PRSNT_NODEF; + iam.fwdCallInd.isdnUsrPrtInd.val = ISUP_USED; + iam.fwdCallInd.isdnUsrPrtPrfInd.pres = PRSNT_NODEF; + iam.fwdCallInd.isdnUsrPrtPrfInd.val = PREF_REQAW; + iam.fwdCallInd.isdnAccInd.pres = PRSNT_NODEF; + iam.fwdCallInd.isdnAccInd.val = ISDNACC_ISDN; + iam.fwdCallInd.sccpMethInd.pres = PRSNT_NODEF; + iam.fwdCallInd.sccpMethInd.val = SCCPMTH_NOIND; + + /* copy down the calling number information */ + iam.cgPtyCat.eh.pres = PRSNT_NODEF; + iam.cgPtyCat.cgPtyCat.pres = PRSNT_NODEF; + iam.cgPtyCat.cgPtyCat.val = CAT_ORD; /* ordinary suscriber */ + + /* copy down the transmission medium requirements */ + iam.txMedReq.eh.pres = PRSNT_NODEF; + iam.txMedReq.trMedReq.pres = PRSNT_NODEF; + iam.txMedReq.trMedReq.val = ftdmchan->caller_data.bearer_capability; + + /* copy down the called number information */ + copy_cdPtyNum_to_sngss7 (&ftdmchan->caller_data, &iam.cdPtyNum); + + /* copy down the calling number information */ + copy_cgPtyNum_to_sngss7 (&ftdmchan->caller_data, &iam.cgPtyNum); + + sng_cc_con_request (sngss7_info->spId, + sngss7_info->suInstId, + sngss7_info->spInstId, + sngss7_info->circuit->id, + &iam, + 0); + + SS7_MSG_TRACE(ftdmchan, sngss7_info, "Tx IAM\n"); + + SS7_FUNC_TRACE_EXIT (__FUNCTION__); + return; } /******************************************************************************/