ss7: adding ss7_iam_fwd_ind_hex as x-header and channel variables in hex format.
Read the forward call indicator IE and print it into channel variable ss7_iam_fwd_ind_hex. If this variable exists, put it in the x-header. This implementation takes bits of A, CB, D, E, F, HG, I from the hex value. Bits of KJ, L, P-M are not taken and set to 0. The hex value is H-A-P-I, H is the highest bit to A, and next is P-I. I is the lowest bit in the whole field, and H is the highest bit in the whole field. Refer to Q.763 chapter 3.23.
This commit is contained in:
parent
2f5ac62433
commit
607da0f56c
|
@ -1874,6 +1874,11 @@ ftdm_status_t ftdm_channel_from_event(ftdm_sigmsg_t *sigmsg, switch_core_session
|
|||
switch_channel_set_variable_printf(channel, "sip_h_X-FreeTDM-RDNIS-Plan", "%d", channel_caller_data->rdnis.plan);
|
||||
switch_channel_set_variable_printf(channel, "sip_h_X-FreeTDM-CPC", "%s", ftdm_calling_party_category2str(channel_caller_data->cpc));
|
||||
|
||||
var_value = ftdm_sigmsg_get_var(sigmsg, "ss7_iam_fwd_ind_hex");
|
||||
if (!ftdm_strlen_zero(var_value)) {
|
||||
switch_channel_set_variable_printf(channel, "sip_h_X-FreeTDM-IAM-FWD-IND-HEX", "%s", var_value);
|
||||
}
|
||||
|
||||
var_value = ftdm_sigmsg_get_var(sigmsg, "ss7_access_transport_urlenc");
|
||||
if (!ftdm_strlen_zero(var_value)) {
|
||||
switch_channel_set_variable_printf(channel, "sip_h_X-FreeTDM-Access-Transport-URLENC", "%s", var_value);
|
||||
|
|
|
@ -221,6 +221,7 @@ 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_fwdCallInd_hex_from_sngss7(ftdmchan, &siConEvnt->fwdCallInd);
|
||||
copy_access_transport_from_sngss7(ftdmchan, &siConEvnt->accTrnspt);
|
||||
copy_ocn_from_sngss7(ftdmchan, &siConEvnt->origCdNum);
|
||||
copy_redirgNum_from_sngss7(ftdmchan, &siConEvnt->redirgNum);
|
||||
|
|
|
@ -926,6 +926,7 @@ ftdm_status_t copy_cgPtyCat_to_sngss7(ftdm_channel_t *ftdmchan, SiCgPtyCat *cgPt
|
|||
ftdm_status_t copy_cgPtyCat_from_sngss7(ftdm_channel_t *ftdmchan, SiCgPtyCat *cgPtyCat);
|
||||
ftdm_status_t copy_accTrnspt_to_sngss7(ftdm_channel_t *ftdmchan, SiAccTrnspt *accTrnspt);
|
||||
ftdm_status_t copy_natConInd_to_sngss7(ftdm_channel_t *ftdmchan, SiNatConInd *natConInd);
|
||||
ftdm_status_t copy_fwdCallInd_hex_from_sngss7(ftdm_channel_t *ftdmchan, SiFwdCallInd *fwdCallInd);
|
||||
ftdm_status_t copy_fwdCallInd_to_sngss7(ftdm_channel_t *ftdmchan, SiFwdCallInd *fwdCallInd);
|
||||
ftdm_status_t copy_txMedReq_to_sngss7(ftdm_channel_t *ftdmchan, SiTxMedReq *txMedReq);
|
||||
ftdm_status_t copy_usrServInfoA_to_sngss7(ftdm_channel_t *ftdmchan, SiUsrServInfo *usrServInfoA);
|
||||
|
|
|
@ -88,7 +88,7 @@ FTDM_STR2ENUM(ftmod_ss7_blk_state2flag, ftmod_ss7_blk_flag2str, sng_ckt_block_fl
|
|||
static uint8_t get_trillium_val(ftdm2trillium_t *vals, uint8_t ftdm_val, uint8_t default_val);
|
||||
static uint8_t get_ftdm_val(ftdm2trillium_t *vals, uint8_t trillium_val, uint8_t default_val);
|
||||
ftdm_status_t four_char_to_hex(const char* in, uint16_t* out) ;
|
||||
|
||||
ftdm_status_t hex_to_four_char(uint16_t in, char* out);
|
||||
|
||||
/* Maps generic FreeTDM CPC codes to SS7 CPC codes */
|
||||
ftdm2trillium_t cpc_codes[] = {
|
||||
|
@ -976,6 +976,54 @@ ftdm_status_t four_char_to_hex(const char* in, uint16_t* out)
|
|||
return FTDM_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
ftdm_status_t hex_to_four_char(uint16_t in, char* out)
|
||||
{
|
||||
char val=0;
|
||||
int mask = 0xf;
|
||||
int i=0;
|
||||
if (!out) {
|
||||
return FTDM_SUCCESS;
|
||||
}
|
||||
|
||||
for (i=3; i>=0; i--) {
|
||||
val = (in & (mask<<(4*i))) >> (4*i);
|
||||
sprintf (out+(3-i), "%x", val);
|
||||
}
|
||||
|
||||
return FTDM_SUCCESS;
|
||||
}
|
||||
|
||||
ftdm_status_t copy_fwdCallInd_hex_from_sngss7(ftdm_channel_t *ftdmchan, SiFwdCallInd *fwdCallInd)
|
||||
{
|
||||
char val[5];
|
||||
uint16_t val_hex = 0;
|
||||
sngss7_chan_data_t *sngss7_info = ftdmchan->call_data;
|
||||
|
||||
memset (val, 0, 5*sizeof(char));
|
||||
if (fwdCallInd->eh.pres != PRSNT_NODEF ) {
|
||||
ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "No forward call indicator IE available\n");
|
||||
return FTDM_SUCCESS;
|
||||
}
|
||||
|
||||
val_hex |= fwdCallInd->natIntCallInd.val << 8;
|
||||
val_hex |= (fwdCallInd->end2EndMethInd.val & 0x1) << 9;
|
||||
val_hex |= ((fwdCallInd->end2EndMethInd.val & 0x2)>>1) << 10;
|
||||
val_hex |= fwdCallInd->intInd.val << 11;
|
||||
val_hex |= fwdCallInd->end2EndInfoInd.val << 12;
|
||||
val_hex |= fwdCallInd->isdnUsrPrtInd.val << 13;
|
||||
val_hex |= (fwdCallInd->isdnUsrPrtPrfInd.val & 0x1) << 14;
|
||||
val_hex |= ((fwdCallInd->isdnUsrPrtPrfInd.val & 0x2)>>1) << 15;
|
||||
|
||||
val_hex |= fwdCallInd->isdnAccInd.val;
|
||||
hex_to_four_char(val_hex, val) ;
|
||||
|
||||
sngss7_add_var(sngss7_info, "ss7_iam_fwd_ind_hex", val);
|
||||
ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Forwad Call Indicator Hex: 0x%s\n", val);
|
||||
|
||||
return FTDM_SUCCESS;
|
||||
}
|
||||
|
||||
ftdm_status_t copy_fwdCallInd_to_sngss7(ftdm_channel_t *ftdmchan, SiFwdCallInd *fwdCallInd)
|
||||
{
|
||||
const char *val = NULL;
|
||||
|
@ -1000,9 +1048,9 @@ ftdm_status_t copy_fwdCallInd_to_sngss7(ftdm_channel_t *ftdmchan, SiFwdCallInd *
|
|||
SS7_ERROR ("Wrong value set in iam_fwd_ind_HEX variable. Please correct the error. Setting to default values.\n" );
|
||||
} else {
|
||||
fwdCallInd->natIntCallInd.val = (val_hex & 0x100)>>8;
|
||||
fwdCallInd->end2EndMethInd.val = (val_hex & 0x600)>>9;
|
||||
fwdCallInd->end2EndMethInd.val = (val_hex & 0x600)>>9;
|
||||
fwdCallInd->intInd.val = (val_hex & 0x800)>>11;
|
||||
fwdCallInd->end2EndInfoInd.val = (val_hex & 0x1000)>>12;
|
||||
fwdCallInd->end2EndInfoInd.val = (val_hex & 0x1000)>>12;
|
||||
fwdCallInd->isdnUsrPrtInd.val = (val_hex & 0x2000)>>13;
|
||||
fwdCallInd->isdnUsrPrtPrfInd.val = (val_hex & 0xC000)>>14;
|
||||
fwdCallInd->isdnUsrPrtPrfInd.val = (fwdCallInd->isdnUsrPrtPrfInd.val==0x03)?0x0:fwdCallInd->isdnUsrPrtPrfInd.val;
|
||||
|
|
Loading…
Reference in New Issue