freetdm: ss7 - updates to outgoing IAM and ACM

This commit is contained in:
Konrad Hammel 2010-09-15 15:06:51 -04:00
parent 0ee84ea57b
commit 134b78c103
2 changed files with 116 additions and 122 deletions

View File

@ -103,11 +103,11 @@ void ft_to_sngss7_iam (ftdm_channel_t * ftdmchan)
iam.fwdCallInd.end2EndInfoInd.pres = PRSNT_NODEF; iam.fwdCallInd.end2EndInfoInd.pres = PRSNT_NODEF;
iam.fwdCallInd.end2EndInfoInd.val = E2EINF_NOINFO; iam.fwdCallInd.end2EndInfoInd.val = E2EINF_NOINFO;
iam.fwdCallInd.isdnUsrPrtInd.pres = PRSNT_NODEF; iam.fwdCallInd.isdnUsrPrtInd.pres = PRSNT_NODEF;
iam.fwdCallInd.isdnUsrPrtInd.val = ISUP_USED; iam.fwdCallInd.isdnUsrPrtInd.val = ISUP_NOTUSED;
iam.fwdCallInd.isdnUsrPrtPrfInd.pres = PRSNT_NODEF; iam.fwdCallInd.isdnUsrPrtPrfInd.pres = PRSNT_NODEF;
iam.fwdCallInd.isdnUsrPrtPrfInd.val = PREF_REQAW; iam.fwdCallInd.isdnUsrPrtPrfInd.val = PREF_PREFAW;
iam.fwdCallInd.isdnAccInd.pres = PRSNT_NODEF; iam.fwdCallInd.isdnAccInd.pres = PRSNT_NODEF;
iam.fwdCallInd.isdnAccInd.val = ISDNACC_ISDN; iam.fwdCallInd.isdnAccInd.val = ISDNACC_NONISDN;
iam.fwdCallInd.sccpMethInd.pres = PRSNT_NODEF; iam.fwdCallInd.sccpMethInd.pres = PRSNT_NODEF;
iam.fwdCallInd.sccpMethInd.val = SCCPMTH_NOIND; iam.fwdCallInd.sccpMethInd.val = SCCPMTH_NOIND;
@ -179,11 +179,12 @@ void ft_to_sngss7_iam (ftdm_channel_t * ftdmchan)
copy_cdPtyNum_to_sngss7 (&ftdmchan->caller_data, &iam.cdPtyNum); copy_cdPtyNum_to_sngss7 (&ftdmchan->caller_data, &iam.cdPtyNum);
/* copy down the calling number information */ /* copy down the calling number information */
copy_cgPtyNum_to_sngss7 (&ftdmchan->caller_data, &iam.cgPtyNum); copy_cgPtyNum_to_sngss7 (&ftdmchan->caller_data, &iam.cgPtyNum);
/* check if the user would like a custom NADI value for the calling Pty Num */ /* check if the user would like a custom NADI value for the calling Pty Num */
nadi = ftdm_channel_get_var(ftdmchan, "ss7_nadi"); nadi = ftdm_channel_get_var(ftdmchan, "ss7_nadi");
if ((nadi != NULL) && (nadi != "")) { if ((nadi != NULL) && (*nadi)) {
SS7_DEBUG_CHAN(ftdmchan,"Found user supplied NADI value \"%s\"\n", nadi); SS7_DEBUG_CHAN(ftdmchan,"Found user supplied NADI value \"%s\"\n", nadi);
iam.cgPtyNum.natAddrInd.val = atoi(nadi); iam.cgPtyNum.natAddrInd.val = atoi(nadi);
} else { } else {
@ -198,7 +199,9 @@ void ft_to_sngss7_iam (ftdm_channel_t * ftdmchan)
&iam, &iam,
0); 0);
SS7_MSG_TRACE(ftdmchan, sngss7_info, "Tx IAM\n"); SS7_INFO_CHAN(ftdmchan,"Tx IAM clg = \"%s\", cld = \"%s\"\n",
ftdmchan->caller_data.cid_num.digits,
ftdmchan->caller_data.dnis.digits);
SS7_FUNC_TRACE_EXIT (__FUNCTION__); SS7_FUNC_TRACE_EXIT (__FUNCTION__);
return; return;
@ -217,27 +220,27 @@ void ft_to_sngss7_acm (ftdm_channel_t * ftdmchan)
/* fill in the needed information for the ACM */ /* fill in the needed information for the ACM */
acm.bckCallInd.eh.pres = PRSNT_NODEF; acm.bckCallInd.eh.pres = PRSNT_NODEF;
acm.bckCallInd.chrgInd.pres = PRSNT_NODEF; acm.bckCallInd.chrgInd.pres = PRSNT_NODEF;
acm.bckCallInd.chrgInd.val = 0x00; acm.bckCallInd.chrgInd.val = CHRG_CHRG;
acm.bckCallInd.cadPtyStatInd.pres = PRSNT_NODEF; acm.bckCallInd.cadPtyStatInd.pres = PRSNT_NODEF;
acm.bckCallInd.cadPtyStatInd.val = 0x01; acm.bckCallInd.cadPtyStatInd.val = 0x01;
acm.bckCallInd.cadPtyCatInd.pres = PRSNT_NODEF; acm.bckCallInd.cadPtyCatInd.pres = PRSNT_NODEF;
acm.bckCallInd.cadPtyCatInd.val = 0x00; acm.bckCallInd.cadPtyCatInd.val = CADCAT_ORDSUBS;
acm.bckCallInd.end2EndMethInd.pres = PRSNT_NODEF; acm.bckCallInd.end2EndMethInd.pres = PRSNT_NODEF;
acm.bckCallInd.end2EndMethInd.val = 0x00; acm.bckCallInd.end2EndMethInd.val = E2EMTH_NOMETH;
acm.bckCallInd.intInd.pres = PRSNT_NODEF; acm.bckCallInd.intInd.pres = PRSNT_NODEF;
acm.bckCallInd.intInd.val = 0x00; acm.bckCallInd.intInd.val = INTIND_NOINTW;
acm.bckCallInd.end2EndInfoInd.pres = PRSNT_NODEF; acm.bckCallInd.end2EndInfoInd.pres = PRSNT_NODEF;
acm.bckCallInd.end2EndInfoInd.val = 0x00; acm.bckCallInd.end2EndInfoInd.val = E2EINF_NOINFO;
acm.bckCallInd.isdnUsrPrtInd.pres = PRSNT_NODEF; acm.bckCallInd.isdnUsrPrtInd.pres = PRSNT_NODEF;
acm.bckCallInd.isdnUsrPrtInd.val = 0x0; acm.bckCallInd.isdnUsrPrtInd.val = ISUP_USED;
acm.bckCallInd.holdInd.pres = PRSNT_NODEF; acm.bckCallInd.holdInd.pres = PRSNT_NODEF;
acm.bckCallInd.holdInd.val = 0x00; acm.bckCallInd.holdInd.val = HOLD_NOTREQD;
acm.bckCallInd.isdnAccInd.pres = PRSNT_NODEF; acm.bckCallInd.isdnAccInd.pres = PRSNT_NODEF;
acm.bckCallInd.isdnAccInd.val = 0x0; acm.bckCallInd.isdnAccInd.val = ISDNACC_NONISDN;
acm.bckCallInd.echoCtrlDevInd.pres = PRSNT_NODEF; acm.bckCallInd.echoCtrlDevInd.pres = PRSNT_NODEF;
acm.bckCallInd.echoCtrlDevInd.val = 0x1; /* ec device present */ acm.bckCallInd.echoCtrlDevInd.val = 0x1; /* ec device present */
acm.bckCallInd.sccpMethInd.pres = PRSNT_NODEF; acm.bckCallInd.sccpMethInd.pres = PRSNT_NODEF;
acm.bckCallInd.sccpMethInd.val = 0x00; acm.bckCallInd.sccpMethInd.val = SCCPMTH_NOIND;
/* send the ACM request to LibSngSS7 */ /* send the ACM request to LibSngSS7 */
sng_cc_con_status (1, sng_cc_con_status (1,

View File

@ -74,9 +74,10 @@ uint8_t copy_cgPtyNum_to_sngss7(ftdm_caller_data_t *ftdm, SiCgPtyNum *cgPtyNum)
int k; int k;
int j; int j;
int flag; int flag;
int odd;
char tmp[2]; char tmp[2];
unsigned char lower; uint8_t lower;
unsigned char upper; uint8_t upper;
/**************************************************************************/ /**************************************************************************/
cgPtyNum->eh.pres = PRSNT_NODEF; cgPtyNum->eh.pres = PRSNT_NODEF;
@ -106,81 +107,73 @@ uint8_t copy_cgPtyNum_to_sngss7(ftdm_caller_data_t *ftdm, SiCgPtyNum *cgPtyNum)
k = 0; k = 0;
j = 0; j = 0;
flag = 0; flag = 0;
odd = 0;
upper = 0x0;
lower = 0x0;
while (1) { while (1) {
/* grab a digit from the ftdm digits */
tmp[0] = ftdm->cid_num.digits[k]; tmp[0] = ftdm->cid_num.digits[k];
/* check if the digit is a number and that is not null */
while (!(isdigit(tmp[0])) && (tmp[0] != '\0')) {
/* move on to the next value */
k++;
tmp[0] = ftdm->cid_num.digits[k];
} /* while(!(isdigit(tmp))) */
/* check if tmp is null or a digit */
if (tmp[0] != '\0') { if (tmp[0] != '\0') {
if (isdigit(tmp[0])) { /* push it into the lower nibble */
lower = atoi(&tmp[0]); lower = atoi(&tmp[0]);
/* move to the next digit */
k++;
/* grab a digit from the ftdm digits */
tmp[0] = ftdm->cid_num.digits[k];
/* check if the digit is a number and that is not null */
while (!(isdigit(tmp[0])) && (tmp[0] != '\0')) {
k++; k++;
tmp[0] = ftdm->cid_num.digits[k]; tmp[0] = ftdm->cid_num.digits[k];
} else { } /* while(!(isdigit(tmp))) */
while (!(isdigit(tmp[0])) && (tmp[0] != '\0')) {
k++;
tmp[0] = ftdm->cid_num.digits[k];
} /* while(!(isdigit(tmp))) */
if (tmp[0] != '\0') { /* check if tmp is null or a digit */
lower = atoi(&tmp[0]); if (tmp[0] != '\0') {
k++; /* push the digit into the upper nibble */
tmp[0] = ftdm->cid_num.digits[k];
} else {
flag = 1;
lower = 0xf;
} /* if (tmp != '\0') */
} /* (isdigit(tmp)) */
} else {
flag = 1;
lower = 0xf;
} /* if (tmp != '\0') */
tmp[0] = ftdm->cid_num.digits[k];
if (tmp[0] != '\0') {
if (isdigit(tmp[0])) {
upper = (atoi(&tmp[0])) << 4; upper = (atoi(&tmp[0])) << 4;
} else { } else {
while (!(isdigit(tmp[0])) && (tmp[0] != '\0')) { /* there is no upper ... fill in 0 */
k++;
tmp[0] = ftdm->cid_num.digits[k];
} /* while(!(isdigit(tmp))) */
if (tmp[0] != '\0') {
upper = (atoi(&tmp[0])) << 4;
k++;
} else {
flag = 1;
upper = 0xf;
} /* if (tmp != '\0') */
} /* if (isdigit(tmp)) */
} else {
if (flag == 1) {
upper = 0x0; upper = 0x0;
} else { /* throw the odd flag */
odd = 1;
/* throw the end flag */
flag = 1; flag = 1;
upper = 0xf; } /* if (tmp != '\0') */
} /* if (flag == 1) */ } else {
} /* if (tmp != '\0') */ /* keep the odd flag down */
odd = 0;
/* throw the flag */
flag = 1;
}
/* push the digits into the trillium structure */
cgPtyNum->addrSig.val[j] = upper | lower; cgPtyNum->addrSig.val[j] = upper | lower;
/* increment the trillium pointer */
j++; j++;
if (flag) { /* if the flag is up we're through all the digits */
break; if (flag) break;
} else {
k++; /* move to the next digit */
} k++;
} /* while(1) */ } /* while(1) */
cgPtyNum->addrSig.len = j; cgPtyNum->addrSig.len = j;
/**************************************************************************/ /**************************************************************************/
cgPtyNum->oddEven.pres = PRSNT_NODEF; cgPtyNum->oddEven.pres = PRSNT_NODEF;
cgPtyNum->oddEven.val = odd;
cgPtyNum->oddEven.val = ((cgPtyNum->addrSig.val[j] >> 4) == 0x0 ) ? 0x01 : 0x00;
/**************************************************************************/ /**************************************************************************/
return 0; return 0;
} }
@ -198,9 +191,10 @@ uint8_t copy_cdPtyNum_to_sngss7(ftdm_caller_data_t *ftdm, SiCdPtyNum *cdPtyNum)
int k; int k;
int j; int j;
int flag; int flag;
int odd;
char tmp[2]; char tmp[2];
unsigned char lower; uint8_t lower;
unsigned char upper; uint8_t upper;
/**************************************************************************/ /**************************************************************************/
cdPtyNum->eh.pres = PRSNT_NODEF; cdPtyNum->eh.pres = PRSNT_NODEF;
@ -219,77 +213,74 @@ uint8_t copy_cdPtyNum_to_sngss7(ftdm_caller_data_t *ftdm, SiCdPtyNum *cdPtyNum)
/* atoi will search through memory starting from the pointer it is given until /* atoi will search through memory starting from the pointer it is given until
* it finds the \0...since tmp is on the stack it will start going through the * it finds the \0...since tmp is on the stack it will start going through the
* possibly causing corruption. Hard code a \0 to prevent this * possibly causing corruption. Hard code a \0 to prevent this
*/ */ /* dnis */
tmp[1] = '\0'; tmp[1] = '\0';
k = 0; k = 0;
j = 0; j = 0;
flag = 0; flag = 0;
odd = 0;
upper = 0x0;
lower = 0x0;
while (1) { while (1) {
/* grab a digit from the ftdm digits */
tmp[0] = ftdm->dnis.digits[k]; tmp[0] = ftdm->dnis.digits[k];
/* check if the digit is a number and that is not null */
while (!(isdigit(tmp[0])) && (tmp[0] != '\0')) {
/* move on to the next value */
k++;
tmp[0] = ftdm->dnis.digits[k];
} /* while(!(isdigit(tmp))) */
/* check if tmp is null or a digit */
if (tmp[0] != '\0') { if (tmp[0] != '\0') {
if (isdigit(tmp[0])) { /* push it into the lower nibble */
lower = atoi(&tmp[0]); lower = atoi(&tmp[0]);
/* move to the next digit */
k++;
/* grab a digit from the ftdm digits */
tmp[0] = ftdm->dnis.digits[k];
/* check if the digit is a number and that is not null */
while (!(isdigit(tmp[0])) && (tmp[0] != '\0')) {
k++; k++;
tmp[0] = ftdm->dnis.digits[k]; tmp[0] = ftdm->dnis.digits[k];
} else { } /* while(!(isdigit(tmp))) */
while (!(isdigit(tmp[0])) && (tmp[0] != '\0')) {
k++;
tmp[0] = ftdm->dnis.digits[k];
} /* while(!(isdigit(tmp))) */
if (tmp[0] != '\0') { /* check if tmp is null or a digit */
lower = atoi(&tmp[0]); if (tmp[0] != '\0') {
k++; /* push the digit into the upper nibble */
tmp[0] = ftdm->dnis.digits[k];
} else {
flag = 1;
lower = 0xf;
} /* if (tmp != '\0') */
} /* (isdigit(tmp)) */
} else {
flag = 1;
lower = 0xf;
} /* if (tmp != '\0') */
tmp[0] = ftdm->dnis.digits[k];
if (tmp[0] != '\0') {
if (isdigit(tmp[0])) {
upper = (atoi(&tmp[0])) << 4; upper = (atoi(&tmp[0])) << 4;
} else { } else {
while (!(isdigit(tmp[0])) && (tmp[0] != '\0')) { /* there is no upper ... fill in ST */
k++; upper = 0xF;
tmp[0] = ftdm->dnis.digits[k]; /* throw the odd flag */
} /* while(!(isdigit(tmp))) */ odd = 1;
/* throw the end flag */
if (tmp[0] != '\0') {
upper = (atoi(&tmp[0])) << 4;
k++;
} else {
flag = 1;
upper = 0xf;
} /* if (tmp != '\0') */
} /* if (isdigit(tmp)) */
} else {
if (flag == 1) {
upper = 0x0;
} else {
flag = 1; flag = 1;
upper = 0xf; } /* if (tmp != '\0') */
} /* if (flag == 1) */ } else {
} /* if (tmp != '\0') */ /* keep the odd flag down */
odd = 1;
/* need to add the ST */
lower = 0xF;
upper = 0x0;
/* throw the flag */
flag = 1;
}
/* push the digits into the trillium structure */
cdPtyNum->addrSig.val[j] = upper | lower; cdPtyNum->addrSig.val[j] = upper | lower;
/* increment the trillium pointer */
j++; j++;
if (flag) { /* if the flag is up we're through all the digits */
break; if (flag) break;
} else {
k++; /* move to the next digit */
} k++;
} /* while(1) */ } /* while(1) */
cdPtyNum->addrSig.len = j; cdPtyNum->addrSig.len = j;
@ -297,7 +288,7 @@ uint8_t copy_cdPtyNum_to_sngss7(ftdm_caller_data_t *ftdm, SiCdPtyNum *cdPtyNum)
/**************************************************************************/ /**************************************************************************/
cdPtyNum->oddEven.pres = PRSNT_NODEF; cdPtyNum->oddEven.pres = PRSNT_NODEF;
cdPtyNum->oddEven.val = ((cdPtyNum->addrSig.val[j] >> 4) == 0x0 ) ? 0x01 : 0x00; cdPtyNum->oddEven.val = odd;
/**************************************************************************/ /**************************************************************************/
return 0; return 0;