Changed the way addressing parameters are configured and given to SCCP and TCAP. Added possibility to add addressing parameters from call.route.

git-svn-id: http://voip.null.ro/svn/yate@4625 acf43c95-373e-0410-b603-e72c3f656dc1
This commit is contained in:
oana 2011-09-20 11:55:58 +00:00
parent 25b9940056
commit 1ef288b469
3 changed files with 105 additions and 58 deletions

View File

@ -91,33 +91,12 @@ tcap=
[sccp_addr]
; this section configures the list of parameters to be given to SCCP and MTP3 as an address
; all parameters prefixed by "sccp." will be copied and given to SCCP to build the address
; NOTE! All needed parameters must be configured as nothing (except the ones mentioned below) are assumed as default
; route_on_gt: boolean: Enable building of SCCP CalledPartyAddress based on Global Title. Defaults to true.
;route_on_gt=true
; gt.translation_type: integer: Translation type for Global Title
; defaults to 11, which, according to ATIS 1000112.2005 is Number Portability Translation Type
;gt.translation_type=11
; gt.numplan: string: Numbering plan for Global Title
; Permitted values:
; {"notused", LNPClient::NPNotUsed},
; {"isdn", LNPClient::NPISDN},
; {"telephony", LNPClient::NPTelephony},
; {"data", LNPClient::NPData},
; {"telex", LNPClient::NPTelex},
; {"maritimemobile", LNPClient::NPMaritimeMobile},
; {"landmobile", LNPClient::NPLandMobile},
; {"private", LNPClient::NPPrivate},
;gt.numplan=isdn
; remote_ssn : integer: Remote SSN of the LNP application.
; NOTE: This parameter is used only when route_on_gt is false)
;remote_SSN=
; remote_pointcode: string: Remote pointcode of the LNP application to be interrogated
; The format is network-cluster-member or number
; NOTE: This parameter is used only if route_on_gt is false
; remote_pointcode: string: Remote pointcode of the LNP application to be interrogated.
; The format is network-cluster-member or number.
;remote_pointcode=
;Type of pointcode: string
@ -130,6 +109,62 @@ tcap=
; Japan5 5-bit SLS
;pointcodetype=
; check_addr: bool: indication for TCAP level if to alter the SCCP address with local information
; Defaults to false
;check_addr=false
; sccp.CalledPartyAddress.route: string: Routing Indicator for SCCP Called Party Address
; Values allowed :
; gt - for Global Title Translation
; ssn - routing by SubSystem Number (SSN)
;sccp.CalledPartyAddress.route=
; sccp.CalledPartyAddress.ssn: integer: Subsystem Number of the called party
;sccp.CalledPartyAddress.ssn=
; sccp.CalledPartyAddress.pointcode: integer: Pointcode of the called party
; NOTE! This must be given in integer form
;sccp.CalledPartyAddress.pointcode=
; sccp.CalledPartyAddress.gt.np: string: Numbering plan for Global Title in Called Party Address
; Permitted values:
; {"notused", LNPClient::NPNotUsed},
; {"isdn", LNPClient::NPISDN},
; {"telephony", LNPClient::NPTelephony},
; {"data", LNPClient::NPData},
; {"telex", LNPClient::NPTelex},
; {"maritimemobile", LNPClient::NPMaritimeMobile},
; {"landmobile", LNPClient::NPLandMobile},
; {"private", LNPClient::NPPrivate},
; NOTE! According to GR-533-Core, this mustn't be set
;sccp.CalledPartyAddress.gt.np=
; sccp.CalledPartyAddress.gt.enconding: string: Encoding type for Called Party Address GT
; NOTE! According to GR-533-Core, this mustn't be set
; Allowed values: bcd
;sccp.CalledPartyAddress.gt.encoding : integer GT encoding scheme
; sccp.CalledPartyAddress.gt.tt: integer: Global Title translation type for Called Party Address
; NOTE! If sccp.CalledPartyAddress.route is set to 'gt', and this is not set, will default to 11,
; which, according to ATIS 1000112.2005 is Number Portability Translation Type
;sccp.CalledPartyAddress.gt.tt=11
; sccp.CallingPartyAddress.route: string: Routing Indicator for SCCP Calling Party Address
; Values allowed :
; ssn - routing by SubSystem Number (SSN)
;sccp.CallingPartyAddress.route=
; sccp.CallingPartyAddress.ssn: bool/integer: Subsystem Number of the calling party
; If set to boolean value,TCAP will complete the value if set to true
;sccp.CallingPartyAddress.ssn=
; sccp.CallingPartyAddress.pointcode: bool/integer: Pointcode of the calling party
; If set to boolean value, SCCP will complete the value if set to true
;sccp.CalledPartyAddress.pointcode=
; sccp.MessageReturn: boolean / integer: True to return message on error
;sccp.MessageReturn=
[announcements]
; This section allows configuration of messages to be played when the a network management request was received from the LNP database

View File

@ -103,8 +103,10 @@ struct PrimitiveMapping {
static bool s_extendedDbg = false;
static bool s_printMsgs = false;
static const String s_checkAddr = "tcap.checkAddress";
static const char* s_callingPA = "CallingPartyAddress";
static const char* s_callingSSN = "CallingPartyAddress.ssn";
static const char* s_callingRoute = "CallingPartyAddress.route";
static const char* s_calledPA = "CalledPartyAddress";
static const char* s_calledPC = "CalledPartyAddress.pointcode";
static const char* s_calledSSN = "CalledPartyAddress.ssn";
@ -307,18 +309,19 @@ bool SS7TCAP::initialize(const NamedList* config)
bool SS7TCAP::sendData(DataBlock& data, NamedList& params)
{
String dpc = params.getValue(s_calledPC,"");
if (dpc.null())
params.addParam(s_calledPC,String(m_defaultRemotePC.pack(m_remoteTypePC)));
int ssn = params.getIntValue(s_calledSSN,-1);
if (ssn < 0)
params.setParam(s_calledSSN,String(m_defaultRemoteSSN));
if (params.getBoolValue("tcap.checkAddress",true)) {
if (params.getBoolValue(s_callingSSN))
params.setParam(s_callingSSN,String(m_SSN));
if (params.getBoolValue(s_checkAddr,true)) {
String dpc = params.getValue(s_calledPC,"");
if (dpc.null())
params.addParam(s_calledPC,String(m_defaultRemotePC.pack(m_remoteTypePC)));
int ssn = params.getIntValue(s_calledSSN,-1);
if (ssn < 0)
params.setParam(s_calledSSN,String(m_defaultRemoteSSN));
ssn = params.getIntValue(s_callingSSN,-1);
if (ssn < 0) {
params.setParam(s_callingSSN,String(m_SSN));
params.setParam("CallingPartyAddress.route","ssn");
params.setParam(s_callingRoute,"ssn");
}
}
#ifdef DEBUG

View File

@ -285,7 +285,6 @@ static Configuration s_cfg;
static SS7PointCode s_remotePC;
static SS7PointCode::Type s_remotePCType;
static unsigned int s_remoteSSN;
static bool s_copyBack = true;
static String s_lnpPrefix = "lnp";
@ -427,11 +426,13 @@ static const String s_remPC = "RemotePC";
static const String s_cpdSSN = "CalledPartyAddress.ssn";
static const String s_cpdGT = "CalledPartyAddress.gt";
static const String s_cpdTT = "CalledPartyAddress.gt.tt";
static const String s_cpdNP = "CalledPartyAddress.gt.np";
static const String s_cpdEnc = "CalledPartyAddress.gt.encoding";
static const String s_cpdRoute = "CalledPartyAddress.route";
static const String s_checkAddr = "tcap.checkAddress";
static const String s_lnpCfg = "lnp";
static const String s_sccpCfg = "sccp_addr";
static const String s_sccpPrefix = "sccp.";
static const String s_tcapPrefix = "tcap";
static const String s_opCode = ".operationCode";
static const String s_localID = ".localCID";
static const String s_remoteID = ".remoteCID";
@ -495,6 +496,12 @@ static void copyLNPParams(NamedList* dest, NamedList* src, String paramsToCopy)
dest->setParam(s_lnpPrefix + s_lata,lata);
dest->setParam(s_lnpPrefix + s_cicExp,(cicExpansion ? "1" : "0"));
dest->setParam(s_lnpPrefix + s_stationType,origStation);
if (src->getBoolValue("copyparams",false)) {
dest->copySubParams(*src,s_sccpPrefix);
dest->copyParam(*src,s_tcapPrefix,'.');
dest->copyParam(*src,s_lnpPrefix,'.');
}
}
// Get a space separated word from a buffer. msgUnescape() it if requested
@ -611,7 +618,7 @@ bool LNPClient::tcapIndication(NamedList& params)
SS7TCAPError error = decodeParameters(params,payload);
if (error.error() != SS7TCAPError::NoError && query) {
// build error
DDebug(this,DebugAll,"Detected error=%s while decoding parameters [%p]",error.errorName().c_str(),this);
Debug(this,DebugAll,"Detected error=%s while decoding parameters [%p]",error.errorName().c_str(),this);
query->setPrimitive(SS7TCAP::TC_Invoke);
query->setProblemData(payload);
tcapRequest(SS7TCAP::TC_Unidirectional,query);
@ -823,6 +830,7 @@ bool LNPClient::tcapRequest(SS7TCAP::TCAPUserTransActions primitive, LNPQuery* c
// encode parameters
String hexPayload;
NamedList* sect = 0;
switch (primitive) {
case SS7TCAP::TC_Unidirectional:
if (code->primitive() == SS7TCAP::TC_Invoke) {
@ -842,32 +850,35 @@ bool LNPClient::tcapRequest(SS7TCAP::TCAPUserTransActions primitive, LNPQuery* c
params.setParam(s_remPC,String(code->dbPointCode()));
params.setParam(s_cpdSSN,String(code->dbSSN()));
params.setParam(s_checkAddr,String::boolText(false));
params.setParam(s_cpdRoute,"ssn");
break;
case SS7TCAP::TC_Begin:
case SS7TCAP::TC_QueryWithPerm:
if (code->primitive() != SS7TCAP::TC_Invoke)
return false;
__plugin.lock();
copyLNPParams(&params,code->parameters(),"");
encodeParameters(ProvideInstructionsStart,params,hexPayload);
params.setParam(s_tcapLocalCID,code->toString());
params.setParam(s_opCodeType,"national");
params.setParam(s_tcapOpCode,String(ProvideInstructionsStart));
params.setParam(s_compTimeout,String(s_cfg.getIntValue(s_lnpCfg,"timeout",3000) / 1000 + 1));
// complete sccp data, read from configure
if (s_cfg.getBoolValue("sccp_addr","route_on_gt",true)) {
const String& called = code->calledNumber();
//params.setParam("CalledPartyAddress.route","gt");
params.setParam(s_cpdGT,called);
params.setParam(s_cpdTT,s_cfg.getValue("sccp_addr","gt.translation_type","11")); // defaults to 11, which,
// according to ATIS 1000112.2005 is Number Portability Translation Type
params.setParam(s_cpdNP,s_cfg.getValue("sccp_addr","gt.numplan","isdn"));
params.setParam(s_cpdEnc,(called.length() % 2 ? "bcd-odd" : "bcd-even"));
sect = s_cfg.getSection(s_sccpCfg);
if (!sect) {
Debug(this,DebugInfo,"Section [sccp_addr] is missing, query abort");
return false;
}
else {
params.setParam(s_remPC,String(s_remotePC.pack(s_remotePCType)));
params.setParam(s_cpdSSN,String(s_remoteSSN));
params.copySubParams(*sect,s_sccpPrefix);
if (String("gt") == params.getValue(s_cpdRoute,"gt")) {
params.setParam(s_cpdGT,code->calledNumber());
// Translation Type defaults to 11, which,
// according to ATIS 1000112.2005 is Number Portability Translation Type
if (TelEngine::null(params.getParam(s_cpdTT)))
params.setParam(s_cpdTT,String(11));
}
params.setParam(s_remPC,String(s_remotePC.pack(s_remotePCType)));
params.setParam(s_checkAddr,String::boolText(sect->getBoolValue("check_addr",false)));
copyLNPParams(&params,code->parameters(),"");
encodeParameters(ProvideInstructionsStart,params,hexPayload);
__plugin.unlock();
break;
case SS7TCAP::TC_Response:
@ -1520,13 +1531,11 @@ void SS7LNPDriver::initialize()
s_lnpPrefix = s_cfg.getValue("general","prefix","lnp");
s_playAnnounce = s_cfg.getBoolValue("general","play_announcements",false);
s_remoteSSN = s_cfg.getIntValue("sccp_addr",YSTRING("remote_SSN"),0);
const char* code = s_cfg.getValue("sccp_addr",YSTRING("remote_pointcode"));
s_remotePCType = SS7PointCode::lookup(s_cfg.getValue("sccp_addr",YSTRING("pointcodetype"),""));
const char* code = s_cfg.getValue(s_sccpCfg,YSTRING("remote_pointcode"));
s_remotePCType = SS7PointCode::lookup(s_cfg.getValue(s_sccpCfg,YSTRING("pointcodetype"),""));
if (!(s_remotePC.assign(code,s_remotePCType) && s_remotePC.pack(s_remotePCType))) {
int codeInt = s_cfg.getIntValue("sccp_addr",YSTRING("remote_pointcode"));
if (!s_cfg.getBoolValue("sccp_addr","route_on_gt",true) && !s_remotePC.unpack(s_remotePCType,codeInt))
int codeInt = s_cfg.getIntValue(s_sccpCfg,YSTRING("remote_pointcode"));
if (!s_remotePC.unpack(s_remotePCType,codeInt))
Debug(this,DebugMild,"SS7LNPDriver::initialize() [%p] - Invalid remote_pointcode=%s value configured",
this,code);
}