Fix for caller ID not received properly on BRI
This commit is contained in:
parent
b814dc17ce
commit
7433a1e578
|
@ -376,16 +376,18 @@ void sngisdn_rcv_cc_ind(CcMngmt *status);
|
|||
void sngisdn_rcv_sng_log(uint8_t level, char *fmt,...);
|
||||
void sngisdn_rcv_sng_assert(char *message);
|
||||
|
||||
ftdm_status_t cpy_calling_num_from_stack(ftdm_caller_data_t *ftdm, CgPtyNmb *cgPtyNmb);
|
||||
ftdm_status_t cpy_called_num_from_stack(ftdm_caller_data_t *ftdm, CdPtyNmb *cdPtyNmb);
|
||||
ftdm_status_t cpy_redir_num_from_stack(ftdm_caller_data_t *ftdm, RedirNmb *redirNmb);
|
||||
ftdm_status_t cpy_calling_name_from_stack(ftdm_caller_data_t *ftdm, Display *display);
|
||||
ftdm_status_t cpy_facility_ie_from_stack(ftdm_caller_data_t *ftdm, uint8_t *data, uint32_t data_len);
|
||||
ftdm_status_t get_calling_num(ftdm_caller_data_t *ftdm, CgPtyNmb *cgPtyNmb);
|
||||
ftdm_status_t get_called_num(ftdm_caller_data_t *ftdm, CdPtyNmb *cdPtyNmb);
|
||||
ftdm_status_t get_redir_num(ftdm_caller_data_t *ftdm, RedirNmb *redirNmb);
|
||||
ftdm_status_t get_calling_name_from_display(ftdm_caller_data_t *ftdm, Display *display);
|
||||
ftdm_status_t get_calling_name_from_usr_usr(ftdm_caller_data_t *ftdm, UsrUsr *usrUsr);
|
||||
ftdm_status_t get_facility_ie(ftdm_caller_data_t *ftdm, uint8_t *data, uint32_t data_len);
|
||||
|
||||
ftdm_status_t cpy_calling_num_from_user(CgPtyNmb *cgPtyNmb, ftdm_caller_data_t *ftdm);
|
||||
ftdm_status_t cpy_called_num_from_user(CdPtyNmb *cdPtyNmb, ftdm_caller_data_t *ftdm);
|
||||
ftdm_status_t cpy_redir_num_from_user(RedirNmb *redirNmb, ftdm_caller_data_t *ftdm);
|
||||
ftdm_status_t cpy_calling_name_from_user(ConEvnt *conEvnt, ftdm_channel_t *ftdmchan);
|
||||
ftdm_status_t set_calling_num(CgPtyNmb *cgPtyNmb, ftdm_caller_data_t *ftdm);
|
||||
ftdm_status_t set_called_num(CdPtyNmb *cdPtyNmb, ftdm_caller_data_t *ftdm);
|
||||
ftdm_status_t set_redir_num(RedirNmb *redirNmb, ftdm_caller_data_t *ftdm);
|
||||
ftdm_status_t set_calling_name(ConEvnt *conEvnt, ftdm_channel_t *ftdmchan);
|
||||
ftdm_status_t set_facility_ie(ftdm_channel_t *ftdmchan, FacilityStr *facilityStr);
|
||||
|
||||
uint8_t sngisdn_get_infoTranCap_from_stack(ftdm_bearer_cap_t bearer_capability);
|
||||
uint8_t sngisdn_get_usrInfoLyr1Prot_from_stack(ftdm_user_layer1_prot_t layer1_prot);
|
||||
|
|
|
@ -127,10 +127,14 @@ void sngisdn_process_con_ind (sngisdn_event_data_t *sngisdn_event)
|
|||
ftdm_channel_add_var(ftdmchan, "isdn_specific_var", "1");
|
||||
#endif
|
||||
/* Fill in call information */
|
||||
cpy_calling_num_from_stack(&ftdmchan->caller_data, &conEvnt->cgPtyNmb);
|
||||
cpy_called_num_from_stack(&ftdmchan->caller_data, &conEvnt->cdPtyNmb);
|
||||
cpy_calling_name_from_stack(&ftdmchan->caller_data, &conEvnt->display);
|
||||
cpy_redir_num_from_stack(&ftdmchan->caller_data, &conEvnt->redirNmb);
|
||||
get_calling_num(&ftdmchan->caller_data, &conEvnt->cgPtyNmb);
|
||||
get_called_num(&ftdmchan->caller_data, &conEvnt->cdPtyNmb);
|
||||
get_redir_num(&ftdmchan->caller_data, &conEvnt->redirNmb);
|
||||
|
||||
if (get_calling_name_from_display(&ftdmchan->caller_data, &conEvnt->display) != FTDM_SUCCESS) {
|
||||
get_calling_name_from_usr_usr(&ftdmchan->caller_data, &conEvnt->usrUsr);
|
||||
}
|
||||
|
||||
ftdm_log_chan(sngisdn_info->ftdmchan, FTDM_LOG_INFO, "Incoming call: Called No:[%s] Calling No:[%s]\n", ftdmchan->caller_data.dnis.digits, ftdmchan->caller_data.cid_num.digits);
|
||||
|
||||
if (conEvnt->bearCap[0].eh.pres) {
|
||||
|
@ -147,7 +151,7 @@ void sngisdn_process_con_ind (sngisdn_event_data_t *sngisdn_event)
|
|||
|
||||
if (conEvnt->facilityStr.eh.pres) {
|
||||
if (signal_data->facility_ie_decode == SNGISDN_OPT_FALSE) {
|
||||
cpy_facility_ie_from_stack(&ftdmchan->caller_data, conEvnt->facilityStr.facilityStr.val, conEvnt->facilityStr.facilityStr.len);
|
||||
get_facility_ie(&ftdmchan->caller_data, conEvnt->facilityStr.facilityStr.val, conEvnt->facilityStr.facilityStr.len);
|
||||
} else if (signal_data->facility == SNGISDN_OPT_TRUE) {
|
||||
/* Verify whether the Caller Name will come in a subsequent FACILITY message */
|
||||
uint16_t ret_val;
|
||||
|
@ -413,7 +417,7 @@ void sngisdn_process_cnst_ind (sngisdn_event_data_t *sngisdn_event)
|
|||
ftdm_size_t min_digits = ((sngisdn_span_data_t*)ftdmchan->span->signal_data)->min_digits;
|
||||
ftdm_size_t num_digits;
|
||||
|
||||
cpy_called_num_from_stack(&ftdmchan->caller_data, &cnStEvnt->cdPtyNmb);
|
||||
get_called_num(&ftdmchan->caller_data, &cnStEvnt->cdPtyNmb);
|
||||
num_digits = strlen(ftdmchan->caller_data.dnis.digits);
|
||||
|
||||
if (cnStEvnt->sndCmplt.eh.pres || num_digits >= min_digits) {
|
||||
|
@ -472,7 +476,7 @@ void sngisdn_process_disc_ind (sngisdn_event_data_t *sngisdn_event)
|
|||
case FTDM_CHANNEL_STATE_UP:
|
||||
if (discEvnt->facilityStr.eh.pres) {
|
||||
if (signal_data->facility_ie_decode == SNGISDN_OPT_FALSE) {
|
||||
cpy_facility_ie_from_stack(&ftdmchan->caller_data, discEvnt->facilityStr.facilityStr.val, discEvnt->facilityStr.facilityStr.len);
|
||||
get_facility_ie(&ftdmchan->caller_data, discEvnt->facilityStr.facilityStr.val, discEvnt->facilityStr.facilityStr.len);
|
||||
} else {
|
||||
/* Call libsng_isdn facility decode function and copy variables here */
|
||||
}
|
||||
|
@ -569,7 +573,7 @@ void sngisdn_process_rel_ind (sngisdn_event_data_t *sngisdn_event)
|
|||
|
||||
if (relEvnt->facilityStr.eh.pres) {
|
||||
if (signal_data->facility_ie_decode == SNGISDN_OPT_FALSE) {
|
||||
cpy_facility_ie_from_stack(&ftdmchan->caller_data, relEvnt->facilityStr.facilityStr.val, relEvnt->facilityStr.facilityStr.len);
|
||||
get_facility_ie(&ftdmchan->caller_data, relEvnt->facilityStr.facilityStr.val, relEvnt->facilityStr.facilityStr.len);
|
||||
} else {
|
||||
/* Call libsng_isdn facility decode function and copy variables here */
|
||||
}
|
||||
|
@ -785,7 +789,7 @@ void sngisdn_process_fac_ind (sngisdn_event_data_t *sngisdn_event)
|
|||
ftdm_sigmsg_t sigev;
|
||||
if (facEvnt->facElmt.facStr.pres) {
|
||||
if (signal_data->facility_ie_decode == SNGISDN_OPT_FALSE) {
|
||||
cpy_facility_ie_from_stack(&ftdmchan->caller_data, &facEvnt->facElmt.facStr.val[2], facEvnt->facElmt.facStr.len);
|
||||
get_facility_ie(&ftdmchan->caller_data, &facEvnt->facElmt.facStr.val[2], facEvnt->facElmt.facStr.len);
|
||||
} else {
|
||||
/* Call libsng_isdn facility decode function and copy variables here */
|
||||
}
|
||||
|
|
|
@ -35,7 +35,6 @@
|
|||
#include "ftmod_sangoma_isdn.h"
|
||||
|
||||
static void sngisdn_set_prog_desc(ProgInd *progInd, ftdm_sngisdn_progind_t prod_ind);
|
||||
static void sngisdn_set_facilityStr(ftdm_channel_t *ftdmchan, FacilityStr *facilityStr);
|
||||
|
||||
void sngisdn_snd_setup(ftdm_channel_t *ftdmchan)
|
||||
{
|
||||
|
@ -136,12 +135,11 @@ void sngisdn_snd_setup(ftdm_channel_t *ftdmchan)
|
|||
}
|
||||
ftdm_log_chan(sngisdn_info->ftdmchan, FTDM_LOG_INFO, "Outgoing call: Called No:[%s] Calling No:[%s]\n", ftdmchan->caller_data.dnis.digits, ftdmchan->caller_data.cid_num.digits);
|
||||
|
||||
cpy_called_num_from_user(&conEvnt.cdPtyNmb, &ftdmchan->caller_data);
|
||||
cpy_calling_num_from_user(&conEvnt.cgPtyNmb, &ftdmchan->caller_data);
|
||||
cpy_redir_num_from_user(&conEvnt.redirNmb, &ftdmchan->caller_data);
|
||||
cpy_calling_name_from_user(&conEvnt, ftdmchan);
|
||||
|
||||
sngisdn_set_facilityStr(ftdmchan, &conEvnt.facilityStr);
|
||||
set_called_num(&conEvnt.cdPtyNmb, &ftdmchan->caller_data);
|
||||
set_calling_num(&conEvnt.cgPtyNmb, &ftdmchan->caller_data);
|
||||
set_redir_num(&conEvnt.redirNmb, &ftdmchan->caller_data);
|
||||
set_calling_name(&conEvnt, ftdmchan);
|
||||
set_facility_ie(ftdmchan, &conEvnt.facilityStr);
|
||||
|
||||
ftdm_log_chan(ftdmchan, FTDM_LOG_INFO, "Sending SETUP (suId:%d suInstId:%u spInstId:%u dchan:%d ces:%d)\n", signal_data->cc_id, sngisdn_info->suInstId, sngisdn_info->spInstId, signal_data->dchan_id, sngisdn_info->ces);
|
||||
|
||||
|
@ -558,7 +556,8 @@ void sngisdn_snd_disconnect(ftdm_channel_t *ftdmchan)
|
|||
discEvnt.causeDgn[0].recommend.pres = NOTPRSNT;
|
||||
discEvnt.causeDgn[0].dgnVal.pres = NOTPRSNT;
|
||||
|
||||
sngisdn_set_facilityStr(ftdmchan, &discEvnt.facilityStr);
|
||||
set_facility_ie(ftdmchan, &discEvnt.facilityStr);
|
||||
|
||||
|
||||
ftdm_log_chan(ftdmchan, FTDM_LOG_INFO, "Sending DISCONNECT (suId:%d suInstId:%u spInstId:%u)\n", signal_data->cc_id, sngisdn_info->suInstId, sngisdn_info->spInstId);
|
||||
if (sng_isdn_disc_request(signal_data->cc_id, sngisdn_info->suInstId, sngisdn_info->spInstId, &discEvnt)) {
|
||||
|
@ -604,7 +603,7 @@ void sngisdn_snd_release(ftdm_channel_t *ftdmchan, uint8_t glare)
|
|||
spInstId = sngisdn_info->spInstId;
|
||||
}
|
||||
|
||||
sngisdn_set_facilityStr(ftdmchan, &relEvnt.facilityStr);
|
||||
set_facility_ie(ftdmchan, &relEvnt.facilityStr);
|
||||
|
||||
ftdm_log_chan(ftdmchan, FTDM_LOG_INFO, "Sending RELEASE/RELEASE COMPLETE (suId:%d suInstId:%u spInstId:%u)\n", signal_data->cc_id, suInstId, spInstId);
|
||||
|
||||
|
@ -647,19 +646,6 @@ static void sngisdn_set_prog_desc(ProgInd *progInd, ftdm_sngisdn_progind_t prog_
|
|||
return;
|
||||
}
|
||||
|
||||
static void sngisdn_set_facilityStr(ftdm_channel_t *ftdmchan, FacilityStr *facilityStr)
|
||||
{
|
||||
const char *facility_str = NULL;
|
||||
|
||||
facility_str = ftdm_channel_get_var(ftdmchan, "isdn.facility.val");
|
||||
if (facility_str) {
|
||||
facilityStr->eh.pres = PRSNT_NODEF;
|
||||
facilityStr->facilityStr.len = strlen(facility_str);
|
||||
memcpy(facilityStr->facilityStr.val, facility_str, facilityStr->facilityStr.len);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
/* We received an incoming frame on the d-channel, send data to the stack */
|
||||
void sngisdn_snd_data(ftdm_channel_t *dchan, uint8_t *data, ftdm_size_t len)
|
||||
{
|
||||
|
|
|
@ -147,76 +147,79 @@ ftdm_status_t sngisdn_set_avail_rate(ftdm_span_t *span, sngisdn_avail_t avail)
|
|||
return FTDM_SUCCESS;
|
||||
}
|
||||
|
||||
ftdm_status_t cpy_calling_num_from_stack(ftdm_caller_data_t *ftdm, CgPtyNmb *cgPtyNmb)
|
||||
ftdm_status_t get_calling_num(ftdm_caller_data_t *caller_data, CgPtyNmb *cgPtyNmb)
|
||||
{
|
||||
if (cgPtyNmb->eh.pres != PRSNT_NODEF) {
|
||||
return FTDM_FAIL;
|
||||
}
|
||||
|
||||
if (cgPtyNmb->screenInd.pres == PRSNT_NODEF) {
|
||||
ftdm->screen = cgPtyNmb->screenInd.val;
|
||||
caller_data->screen = cgPtyNmb->screenInd.val;
|
||||
}
|
||||
|
||||
if (cgPtyNmb->presInd0.pres == PRSNT_NODEF) {
|
||||
ftdm->pres = cgPtyNmb->presInd0.val;
|
||||
caller_data->pres = cgPtyNmb->presInd0.val;
|
||||
}
|
||||
|
||||
if (cgPtyNmb->nmbPlanId.pres == PRSNT_NODEF) {
|
||||
ftdm->cid_num.plan = cgPtyNmb->nmbPlanId.val;
|
||||
caller_data->cid_num.plan = cgPtyNmb->nmbPlanId.val;
|
||||
}
|
||||
|
||||
if (cgPtyNmb->typeNmb1.pres == PRSNT_NODEF) {
|
||||
ftdm->cid_num.type = cgPtyNmb->typeNmb1.val;
|
||||
caller_data->cid_num.type = cgPtyNmb->typeNmb1.val;
|
||||
}
|
||||
|
||||
if (cgPtyNmb->nmbDigits.pres == PRSNT_NODEF) {
|
||||
ftdm_copy_string(ftdm->cid_num.digits, (const char*)cgPtyNmb->nmbDigits.val, cgPtyNmb->nmbDigits.len+1);
|
||||
ftdm_copy_string(caller_data->cid_num.digits, (const char*)cgPtyNmb->nmbDigits.val, cgPtyNmb->nmbDigits.len+1);
|
||||
}
|
||||
memcpy(&caller_data->ani, &caller_data->cid_num, sizeof(caller_data->ani));
|
||||
return FTDM_SUCCESS;
|
||||
}
|
||||
|
||||
ftdm_status_t cpy_called_num_from_stack(ftdm_caller_data_t *ftdm, CdPtyNmb *cdPtyNmb)
|
||||
ftdm_status_t get_called_num(ftdm_caller_data_t *caller_data, CdPtyNmb *cdPtyNmb)
|
||||
{
|
||||
if (cdPtyNmb->eh.pres != PRSNT_NODEF) {
|
||||
return FTDM_FAIL;
|
||||
}
|
||||
|
||||
if (cdPtyNmb->nmbPlanId.pres == PRSNT_NODEF) {
|
||||
ftdm->dnis.plan = cdPtyNmb->nmbPlanId.val;
|
||||
caller_data->dnis.plan = cdPtyNmb->nmbPlanId.val;
|
||||
}
|
||||
|
||||
if (cdPtyNmb->typeNmb0.pres == PRSNT_NODEF) {
|
||||
ftdm->dnis.type = cdPtyNmb->typeNmb0.val;
|
||||
caller_data->dnis.type = cdPtyNmb->typeNmb0.val;
|
||||
}
|
||||
|
||||
if (cdPtyNmb->nmbDigits.pres == PRSNT_NODEF) {
|
||||
unsigned i = strlen(ftdm->dnis.digits);
|
||||
/* In overlap receive mode, append the new digits to the existing dnis */
|
||||
unsigned i = strlen(caller_data->dnis.digits);
|
||||
|
||||
ftdm_copy_string(&ftdm->dnis.digits[i], (const char*)cdPtyNmb->nmbDigits.val, cdPtyNmb->nmbDigits.len+1);
|
||||
ftdm_copy_string(&caller_data->dnis.digits[i], (const char*)cdPtyNmb->nmbDigits.val, cdPtyNmb->nmbDigits.len+1);
|
||||
}
|
||||
return FTDM_SUCCESS;
|
||||
}
|
||||
|
||||
ftdm_status_t cpy_redir_num_from_stack(ftdm_caller_data_t *ftdm, RedirNmb *redirNmb)
|
||||
ftdm_status_t get_redir_num(ftdm_caller_data_t *caller_data, RedirNmb *redirNmb)
|
||||
{
|
||||
if (redirNmb->eh.pres != PRSNT_NODEF) {
|
||||
return FTDM_FAIL;
|
||||
}
|
||||
|
||||
if (redirNmb->nmbPlanId.pres == PRSNT_NODEF) {
|
||||
ftdm->rdnis.plan = redirNmb->nmbPlanId.val;
|
||||
caller_data->rdnis.plan = redirNmb->nmbPlanId.val;
|
||||
}
|
||||
|
||||
if (redirNmb->typeNmb.pres == PRSNT_NODEF) {
|
||||
ftdm->rdnis.type = redirNmb->typeNmb.val;
|
||||
caller_data->rdnis.type = redirNmb->typeNmb.val;
|
||||
}
|
||||
|
||||
if (redirNmb->nmbDigits.pres == PRSNT_NODEF) {
|
||||
ftdm_copy_string(ftdm->rdnis.digits, (const char*)redirNmb->nmbDigits.val, redirNmb->nmbDigits.len+1);
|
||||
ftdm_copy_string(caller_data->rdnis.digits, (const char*)redirNmb->nmbDigits.val, redirNmb->nmbDigits.len+1);
|
||||
}
|
||||
return FTDM_SUCCESS;
|
||||
}
|
||||
|
||||
ftdm_status_t cpy_calling_name_from_stack(ftdm_caller_data_t *ftdm, Display *display)
|
||||
ftdm_status_t get_calling_name_from_display(ftdm_caller_data_t *caller_data, Display *display)
|
||||
{
|
||||
if (display->eh.pres != PRSNT_NODEF) {
|
||||
return FTDM_FAIL;
|
||||
|
@ -225,11 +228,29 @@ ftdm_status_t cpy_calling_name_from_stack(ftdm_caller_data_t *ftdm, Display *dis
|
|||
return FTDM_FAIL;
|
||||
}
|
||||
|
||||
ftdm_copy_string(ftdm->cid_name, (const char*)display->dispInfo.val, display->dispInfo.len+1);
|
||||
ftdm_copy_string(caller_data->cid_name, (const char*)display->dispInfo.val, display->dispInfo.len+1);
|
||||
return FTDM_SUCCESS;
|
||||
}
|
||||
|
||||
ftdm_status_t cpy_facility_ie_from_stack(ftdm_caller_data_t *caller_data, uint8_t *data, uint32_t data_len)
|
||||
ftdm_status_t get_calling_name_from_usr_usr(ftdm_caller_data_t *caller_data, UsrUsr *usrUsr)
|
||||
{
|
||||
if (usrUsr->eh.pres != PRSNT_NODEF) {
|
||||
return FTDM_FAIL;
|
||||
}
|
||||
|
||||
if (usrUsr->protocolDisc.val != PD_IA5) {
|
||||
return FTDM_FAIL;
|
||||
}
|
||||
|
||||
if (usrUsr->usrInfo.pres != PRSNT_NODEF) {
|
||||
return FTDM_FAIL;
|
||||
}
|
||||
|
||||
ftdm_copy_string(caller_data->cid_name, (const char*)usrUsr->usrInfo.val, usrUsr->usrInfo.len+1);
|
||||
return FTDM_SUCCESS;
|
||||
}
|
||||
|
||||
ftdm_status_t get_facility_ie(ftdm_caller_data_t *caller_data, uint8_t *data, uint32_t data_len)
|
||||
{
|
||||
if (data_len > sizeof(caller_data->raw_data)-2) {
|
||||
ftdm_log(FTDM_LOG_CRIT, "Length of Facility IE exceeds maximum length\n");
|
||||
|
@ -247,67 +268,67 @@ ftdm_status_t cpy_facility_ie_from_stack(ftdm_caller_data_t *caller_data, uint8_
|
|||
return FTDM_SUCCESS;
|
||||
}
|
||||
|
||||
ftdm_status_t cpy_calling_num_from_user(CgPtyNmb *cgPtyNmb, ftdm_caller_data_t *ftdm)
|
||||
ftdm_status_t set_calling_num(CgPtyNmb *cgPtyNmb, ftdm_caller_data_t *caller_data)
|
||||
{
|
||||
uint8_t len = strlen(ftdm->cid_num.digits);
|
||||
uint8_t len = strlen(caller_data->cid_num.digits);
|
||||
if (!len) {
|
||||
return FTDM_SUCCESS;
|
||||
}
|
||||
cgPtyNmb->eh.pres = PRSNT_NODEF;
|
||||
|
||||
cgPtyNmb->screenInd.pres = PRSNT_NODEF;
|
||||
cgPtyNmb->screenInd.val = ftdm->screen;
|
||||
cgPtyNmb->screenInd.val = caller_data->screen;
|
||||
|
||||
cgPtyNmb->presInd0.pres = PRSNT_NODEF;
|
||||
cgPtyNmb->presInd0.val = ftdm->pres;
|
||||
|
||||
cgPtyNmb->presInd0.val = caller_data->pres;
|
||||
|
||||
cgPtyNmb->nmbPlanId.pres = PRSNT_NODEF;
|
||||
cgPtyNmb->nmbPlanId.val = ftdm->cid_num.plan;
|
||||
cgPtyNmb->nmbPlanId.val = caller_data->cid_num.plan;
|
||||
|
||||
cgPtyNmb->typeNmb1.pres = PRSNT_NODEF;
|
||||
cgPtyNmb->typeNmb1.val = ftdm->cid_num.type;
|
||||
cgPtyNmb->typeNmb1.val = caller_data->cid_num.type;
|
||||
|
||||
cgPtyNmb->nmbDigits.pres = PRSNT_NODEF;
|
||||
cgPtyNmb->nmbDigits.len = len;
|
||||
|
||||
memcpy(cgPtyNmb->nmbDigits.val, ftdm->cid_num.digits, len);
|
||||
memcpy(cgPtyNmb->nmbDigits.val, caller_data->cid_num.digits, len);
|
||||
|
||||
return FTDM_SUCCESS;
|
||||
}
|
||||
|
||||
ftdm_status_t cpy_called_num_from_user(CdPtyNmb *cdPtyNmb, ftdm_caller_data_t *ftdm)
|
||||
ftdm_status_t set_called_num(CdPtyNmb *cdPtyNmb, ftdm_caller_data_t *caller_data)
|
||||
{
|
||||
uint8_t len = strlen(ftdm->dnis.digits);
|
||||
uint8_t len = strlen(caller_data->dnis.digits);
|
||||
if (!len) {
|
||||
return FTDM_SUCCESS;
|
||||
}
|
||||
cdPtyNmb->eh.pres = PRSNT_NODEF;
|
||||
|
||||
cdPtyNmb->nmbPlanId.pres = PRSNT_NODEF;
|
||||
if (ftdm->dnis.plan == FTDM_NPI_INVALID) {
|
||||
if (caller_data->dnis.plan == FTDM_NPI_INVALID) {
|
||||
cdPtyNmb->nmbPlanId.val = FTDM_NPI_UNKNOWN;
|
||||
} else {
|
||||
cdPtyNmb->nmbPlanId.val = ftdm->dnis.plan;
|
||||
cdPtyNmb->nmbPlanId.val = caller_data->dnis.plan;
|
||||
}
|
||||
|
||||
cdPtyNmb->typeNmb0.pres = PRSNT_NODEF;
|
||||
if (ftdm->dnis.type == FTDM_TON_INVALID) {
|
||||
if (caller_data->dnis.type == FTDM_TON_INVALID) {
|
||||
cdPtyNmb->typeNmb0.val = FTDM_TON_UNKNOWN;
|
||||
} else {
|
||||
cdPtyNmb->typeNmb0.val = ftdm->dnis.type;
|
||||
cdPtyNmb->typeNmb0.val = caller_data->dnis.type;
|
||||
}
|
||||
|
||||
cdPtyNmb->nmbDigits.pres = PRSNT_NODEF;
|
||||
cdPtyNmb->nmbDigits.len = len;
|
||||
|
||||
|
||||
memcpy(cdPtyNmb->nmbDigits.val, ftdm->dnis.digits, len);
|
||||
memcpy(cdPtyNmb->nmbDigits.val, caller_data->dnis.digits, len);
|
||||
return FTDM_SUCCESS;
|
||||
}
|
||||
|
||||
ftdm_status_t cpy_redir_num_from_user(RedirNmb *redirNmb, ftdm_caller_data_t *ftdm)
|
||||
ftdm_status_t set_redir_num(RedirNmb *redirNmb, ftdm_caller_data_t *caller_data)
|
||||
{
|
||||
uint8_t len = strlen(ftdm->rdnis.digits);
|
||||
uint8_t len = strlen(caller_data->rdnis.digits);
|
||||
if (!len) {
|
||||
return FTDM_SUCCESS;
|
||||
}
|
||||
|
@ -315,36 +336,36 @@ ftdm_status_t cpy_redir_num_from_user(RedirNmb *redirNmb, ftdm_caller_data_t *ft
|
|||
redirNmb->eh.pres = PRSNT_NODEF;
|
||||
|
||||
redirNmb->nmbPlanId.pres = PRSNT_NODEF;
|
||||
if (ftdm->rdnis.plan == FTDM_NPI_INVALID) {
|
||||
if (caller_data->rdnis.plan == FTDM_NPI_INVALID) {
|
||||
redirNmb->nmbPlanId.val = FTDM_NPI_UNKNOWN;
|
||||
} else {
|
||||
redirNmb->nmbPlanId.val = ftdm->rdnis.plan;
|
||||
redirNmb->nmbPlanId.val = caller_data->rdnis.plan;
|
||||
}
|
||||
|
||||
redirNmb->typeNmb.pres = PRSNT_NODEF;
|
||||
if (ftdm->rdnis.type == FTDM_TON_INVALID) {
|
||||
if (caller_data->rdnis.type == FTDM_TON_INVALID) {
|
||||
redirNmb->typeNmb.val = FTDM_TON_UNKNOWN;
|
||||
} else {
|
||||
redirNmb->typeNmb.val = ftdm->rdnis.type;
|
||||
redirNmb->typeNmb.val = caller_data->rdnis.type;
|
||||
}
|
||||
|
||||
redirNmb->nmbDigits.pres = PRSNT_NODEF;
|
||||
redirNmb->nmbDigits.len = len;
|
||||
|
||||
memcpy(redirNmb->nmbDigits.val, ftdm->rdnis.digits, len);
|
||||
memcpy(redirNmb->nmbDigits.val, caller_data->rdnis.digits, len);
|
||||
|
||||
return FTDM_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
ftdm_status_t cpy_calling_name_from_user(ConEvnt *conEvnt, ftdm_channel_t *ftdmchan)
|
||||
ftdm_status_t set_calling_name(ConEvnt *conEvnt, ftdm_channel_t *ftdmchan)
|
||||
{
|
||||
uint8_t len;
|
||||
ftdm_caller_data_t *ftdm = &ftdmchan->caller_data;
|
||||
ftdm_caller_data_t *caller_data = &ftdmchan->caller_data;
|
||||
/* sngisdn_chan_data_t *sngisdn_info = ftdmchan->call_data; */
|
||||
sngisdn_span_data_t *signal_data = (sngisdn_span_data_t*) ftdmchan->span->signal_data;
|
||||
|
||||
len = strlen(ftdm->cid_name);
|
||||
len = strlen(caller_data->cid_name);
|
||||
if (!len) {
|
||||
return FTDM_SUCCESS;
|
||||
}
|
||||
|
@ -359,7 +380,7 @@ ftdm_status_t cpy_calling_name_from_user(ConEvnt *conEvnt, ftdm_channel_t *ftdmc
|
|||
conEvnt->usrUsr.usrInfo.len = len;
|
||||
/* in sangoma_brid we used to send usr-usr info as <cid_name>!<calling_number>,
|
||||
change to previous style if current one does not work */
|
||||
memcpy(conEvnt->usrUsr.usrInfo.val, ftdm->cid_name, len);
|
||||
memcpy(conEvnt->usrUsr.usrInfo.val, caller_data->cid_name, len);
|
||||
} else {
|
||||
switch (signal_data->switchtype) {
|
||||
case SNGISDN_SWITCH_NI2:
|
||||
|
@ -377,7 +398,7 @@ ftdm_status_t cpy_calling_name_from_user(ConEvnt *conEvnt, ftdm_channel_t *ftdmc
|
|||
conEvnt->display.eh.pres = PRSNT_NODEF;
|
||||
conEvnt->display.dispInfo.pres = PRSNT_NODEF;
|
||||
conEvnt->display.dispInfo.len = len;
|
||||
memcpy(conEvnt->display.dispInfo.val, ftdm->cid_name, len);
|
||||
memcpy(conEvnt->display.dispInfo.val, caller_data->cid_name, len);
|
||||
break;
|
||||
case SNGISDN_SWITCH_QSIG:
|
||||
/* It seems like QSIG does not support Caller ID Name */
|
||||
|
@ -390,6 +411,20 @@ ftdm_status_t cpy_calling_name_from_user(ConEvnt *conEvnt, ftdm_channel_t *ftdmc
|
|||
return FTDM_SUCCESS;
|
||||
}
|
||||
|
||||
ftdm_status_t set_facility_ie(ftdm_channel_t *ftdmchan, FacilityStr *facilityStr)
|
||||
{
|
||||
const char *facility_str = NULL;
|
||||
|
||||
facility_str = ftdm_channel_get_var(ftdmchan, "isdn.facility.val");
|
||||
if (facility_str) {
|
||||
facilityStr->eh.pres = PRSNT_NODEF;
|
||||
facilityStr->facilityStr.len = strlen(facility_str);
|
||||
memcpy(facilityStr->facilityStr.val, facility_str, facilityStr->facilityStr.len);
|
||||
return FTDM_SUCCESS;
|
||||
}
|
||||
return FTDM_FAIL;
|
||||
}
|
||||
|
||||
void sngisdn_t3_timeout(void* p_sngisdn_info)
|
||||
{
|
||||
sngisdn_chan_data_t *sngisdn_info = (sngisdn_chan_data_t*)p_sngisdn_info;
|
||||
|
|
|
@ -285,7 +285,7 @@ typedef enum {
|
|||
|
||||
/*! \brief Signaling messages sent by the stacks */
|
||||
typedef enum {
|
||||
FTDM_SIGEVENT_START, /*!< Incoming call (ie: incoming SETUP msg or Ring) */
|
||||
FTDM_SIGEVENT_START,/*!< Incoming call (ie: incoming SETUP msg or Ring) */
|
||||
FTDM_SIGEVENT_STOP, /*!< Hangup */
|
||||
FTDM_SIGEVENT_RELEASED, /*!< Channel is completely released and available */
|
||||
FTDM_SIGEVENT_UP, /*!< Outgoing call has been answered */
|
||||
|
@ -300,12 +300,12 @@ typedef enum {
|
|||
FTDM_SIGEVENT_RESTART, /*!< Restart has been requested. Typically you hangup your call resources here */
|
||||
FTDM_SIGEVENT_SIGSTATUS_CHANGED, /*!< Signaling protocol status changed (ie: D-chan up), see new status in raw_data ftdm_sigmsg_t member */
|
||||
FTDM_SIGEVENT_COLLISION, /*!< Outgoing call was dropped because an incoming call arrived at the same time */
|
||||
FTDM_SIGEVENT_MSG, /* !< We received an in-call msg */
|
||||
FTDM_SIGEVENT_MSG, /*!< We received an in-call msg */
|
||||
FTDM_SIGEVENT_INVALID
|
||||
} ftdm_signal_event_t;
|
||||
#define SIGNAL_STRINGS "START", "STOP", "RELEASED", "UP", "FLASH", "PROCEED", "PROGRESS", \
|
||||
"PROGRESS_MEDIA", "ALARM_TRAP", "ALARM_CLEAR", \
|
||||
"COLLECTED_DIGIT", "ADD_CALL", "RESTART", "SIGSTATUS_CHANGED", "COLLISION", "INVALID"
|
||||
"COLLECTED_DIGIT", "ADD_CALL", "RESTART", "SIGSTATUS_CHANGED", "COLLISION", "MSG", "INVALID"
|
||||
|
||||
/*! \brief Move from string to ftdm_signal_event_t and viceversa */
|
||||
FTDM_STR2ENUM_P(ftdm_str2ftdm_signal_event, ftdm_signal_event2str, ftdm_signal_event_t)
|
||||
|
|
Loading…
Reference in New Issue