From c55ac6c9009d114030562ef9f2d32bb721e3e618 Mon Sep 17 00:00:00 2001 From: Moises Silva Date: Thu, 19 Jul 2012 16:55:13 -0400 Subject: [PATCH] freetdm: OPENZAP-187 --resolve Add ability to set called party subaddress --- .../ftmod_sangoma_isdn/ftmod_sangoma_isdn.h | 1 + .../ftmod_sangoma_isdn_stack_out.c | 1 + .../ftmod_sangoma_isdn_support.c | 20 +++++++++++++++++++ 3 files changed, 22 insertions(+) diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.h b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.h index 92054b8869..51cb0b02fd 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.h +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.h @@ -507,6 +507,7 @@ ftdm_status_t set_called_num(ftdm_channel_t *ftdmchan, CdPtyNmb *cdPtyNmb); ftdm_status_t set_redir_num(ftdm_channel_t *ftdmchan, RedirNmb *redirNmb); ftdm_status_t set_calling_name(ftdm_channel_t *ftdmchan, ConEvnt *conEvnt); ftdm_status_t set_calling_subaddr(ftdm_channel_t *ftdmchan, CgPtySad *cgPtySad); +ftdm_status_t set_called_subaddr(ftdm_channel_t *ftdmchan, CdPtySad *cdPtySad); ftdm_status_t set_prog_ind_ie(ftdm_channel_t *ftdmchan, ProgInd *progInd, ftdm_sngisdn_progind_t prog_ind); ftdm_status_t set_bear_cap_ie(ftdm_channel_t *ftdmchan, BearCap *bearCap); ftdm_status_t set_network_specific_fac(ftdm_channel_t *ftdmchan, NetFac *netFac); diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_out.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_out.c index f528333634..f705d717ab 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_out.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_out.c @@ -67,6 +67,7 @@ void sngisdn_snd_setup(ftdm_channel_t *ftdmchan) set_calling_num(ftdmchan, &conEvnt.cgPtyNmb); set_calling_num2(ftdmchan, &conEvnt.cgPtyNmb2); set_calling_subaddr(ftdmchan, &conEvnt.cgPtySad); + set_called_subaddr(ftdmchan, &conEvnt.cdPtySad); set_redir_num(ftdmchan, &conEvnt.redirNmb); set_calling_name(ftdmchan, &conEvnt); set_network_specific_fac(ftdmchan, &conEvnt.netFac[0]); diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_support.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_support.c index df7e7b1667..0606f79643 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_support.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_support.c @@ -847,6 +847,26 @@ ftdm_status_t set_calling_subaddr(ftdm_channel_t *ftdmchan, CgPtySad *cgPtySad) return FTDM_SUCCESS; } +ftdm_status_t set_called_subaddr(ftdm_channel_t *ftdmchan, CdPtySad *cdPtySad) +{ + const char* cld_subaddr = NULL; + cld_subaddr = ftdm_usrmsg_get_var(ftdmchan->usrmsg, "isdn.called_subaddr"); + if (!ftdm_strlen_zero(cld_subaddr)) { + unsigned len = strlen (cld_subaddr); + cdPtySad->eh.pres = PRSNT_NODEF; + cdPtySad->typeSad.pres = 1; + cdPtySad->typeSad.val = 0; /* NSAP */ + cdPtySad->oddEvenInd.pres = 1; + cdPtySad->oddEvenInd.val = 0; + + ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Sending Called Party Subaddress:%s\n", cld_subaddr); + cdPtySad->sadInfo.pres = 1; + cdPtySad->sadInfo.len = len; + memcpy(cdPtySad->sadInfo.val, cld_subaddr, len); + } + return FTDM_SUCCESS; +} + ftdm_status_t set_facility_ie(ftdm_channel_t *ftdmchan, FacilityStr *facilityStr) { ftdm_status_t status;