JBoss.orgCommunity Documentation
Mobile application part ( MAP ) is the protocol that is used to allow the GSM network nodes within the Network Switching Subsystem ( NSS ) to communicate with each other to provide services, such as roaming capability, text messaging ( SMS ), Unstructured Supplementary Service Data ( USSD ) and subscriber authentication. MAP provides an application layer on which to build the services that support a GSM network. This application layer provides a standardized set of services. MAP uses the services of the SS7 network, specifically the Signaling Connection Control Part ( SCCP ) and the Transaction Capabilities Application Part ( TCAP )
For better understanding of this chapter please read GSM 09.02.
The org.mobicents.protocols.ss7.map.api.MAPStack
interface defines the methods required to represent MAP Protocol Stack.
MAPStack exposes
org.mobicents.protocols.ss7.map.api.MAPProvider
that interacts directly with MAPStack. This interface
defines the methods that will be used by any registered MAP User application implementing the
org.mobicents.protocols.ss7.map.api.MAPDialogListener
and
org.mobicents.protocols.ss7.map.api.MAPServiceListener
interface to listen MAP messages and dialogue handling primitives. The class diagram looks like
JBoss Communications SS7 Stack MAP has implementation for USSD Message only. Any contribution to implement message specific to SMS or other are welcome. We will provide you all the help that you may need initially.
The org.mobicents.protocols.ss7.map.MAPStackImpl
is concrete implementation of
MAPStack
.
The MAP User application creates instance of
MAPStackImpl
passing the reference of
SccpProvider
and
new instance of
SccpAddress
representing address to which bind listener. This addess will be used to match against destination address in SCCP
messages.
SccpProvider sccpProvider = getSccpProvider(); //JNDI lookup of SCCP Stack and get Provider
SccpAddress localAddress createLocalAddress();
MAPStackImpl mapStack = new MAPStackImpl(sccpPprovider, localAddress);
...
private SccpAddress createLocalAddress()
{
int translationType = 0;
int subSystemNumber = 0;
GlobalTitle gt = GlobalTitle.getInstance(translationType,
NumberingPlan.ISDN_MOBILE, NatureOfAddress.NATIONAL, "1234");
SccpAddress localAddress = new SccpAddress(gt, 0);
return localAddress;
}
The reference to
SccpProvider
is received from
SccpStack
.
To get handle to
SccpStack
do the JNDI look-up passing the
JNDI name configured in SS7 service as explained in
Section 7.3, “Access Point”
The MAP User application should register the concrete implementation of
MAPDialogListener
and
MAPServiceListener
with
MAPProvider
to listen for incoming MAP Dialog and MAP Primitive messages.
public class MAPExample implements MAPDialogListener, MAPServiceListener {
.....
mapProvider = mapStack.getMAPProvider();
mapProvider.addMAPDialogListener(this);
mapProvider.addMAPServiceListener(this);
....
}
The MAP User Application leverages
MapServiceFactory
to create instance of
USSDString
and
AddressString
MapServiceFactory servFact = mapProvider.getMapServiceFactory();
USSDString ussdString = servFact.createUSSDString("*125*+31628839999#",
null);
AddressString msisdn = this.servFact.createAddressString(
AddressNature.international_number, NumberingPlan.ISDN,
"31628838002");
The MAP User Application leverages
MAPProvider
to create new
MAPDialog
and send USSD message
// First create Dialog
MAPDialog mapDialog = mapProvider.createNewDialog(
MAPApplicationContext.networkUnstructuredSsContextV2,
destAddress, destReference, origAddress, origReference);
byte ussdDataCodingScheme = 0x0f;
// USSD String: *125*+31628839999#
// The Charset is null, here we let system use default Charset (UTF-7 as
// explained in GSM 03.38. However if MAP User wants, it can set its own
// impl of Charset
USSDString ussdString = servFact.createUSSDString("*125*+31628839999#",
null);
AddressString msisdn = this.servFact.createAddressString(
AddressNature.international_number, NumberingPlan.ISDN,
"31628838002");
mapDialog.addProcessUnstructuredSSRequest(ussdDataCodingScheme,
ussdString, msisdn);
// This will initiate the TC-BEGIN with INVOKE component
mapDialog.send();
The complete example looks like
public class MAPExample implements MAPDialogListener, MAPServiceListener {
private MAPStack mapStack;
private MAPProvider mapProvider;
MapServiceFactory servFact;
SccpAddress destAddress = null;
// The address created by passing the AddressNature, NumberingPlan and
// actual address
AddressString destReference = servFact.createAddressString(
AddressNature.international_number, NumberingPlan.land_mobile,
"204208300008002");
SccpAddress origAddress = null;
AddressString origReference = servFact.createAddressString(
AddressNature.international_number, NumberingPlan.ISDN,
"31628968300");
MAPExample(SccpProvider sccpPprovider, SccpAddress address,
SccpAddress remoteAddress) {
origAddress = address;
destAddress = remoteAddress;
mapStack = new MAPStackImpl(sccpPprovider, origAddress);
mapProvider = mapStack.getMAPProvider();
servFact = mapProvider.getMapServiceFactory();
mapProvider.addMAPDialogListener(this);
mapProvider.addMAPServiceListener(this);
}
private static SccpProvider getSccpProvider() throws NamingException {
// no arg is ok, if we run in JBoss
InitialContext ctx = new InitialContext();
try {
String providerJndiName = "/mobicents/ss7/sccp";
return ((SccpStack) ctx.lookup(providerJndiName)).getSccpProvider();
} finally {
ctx.close();
}
}
private static SccpAddress createLocalAddress() {
GlobalTitle gt = GlobalTitle
.getInstance(
NatureOfAddress.NATIONAL.getValue(),
org.mobicents.protocols.ss7.indicator.NumberingPlan.ISDN_MOBILE,
NatureOfAddress.NATIONAL, "1234");
return new SccpAddress(gt, 0); // 0 is Sub-System number
}
private static SccpAddress createRemoteAddress() {
GlobalTitle gt = GlobalTitle
.getInstance(
NatureOfAddress.NATIONAL.getValue(),
org.mobicents.protocols.ss7.indicator.NumberingPlan.ISDN_MOBILE,
NatureOfAddress.NATIONAL, "1572582");
return new SccpAddress(gt, 0); // 0 is Sub-System number
}
public void run() throws Exception {
// First create Dialog
MAPDialog mapDialog = mapProvider.createNewDialog(
MAPApplicationContext.networkUnstructuredSsContextV2,
destAddress, destReference, origAddress, origReference);
// The dataCodingScheme is still byte, as I am not exactly getting how
// to encode/decode this.
byte ussdDataCodingScheme = 0x0f;
// USSD String: *125*+31628839999#
// The Charset is null, here we let system use default Charset (UTF-7 as
// explained in GSM 03.38. However if MAP User wants, it can set its own
// impl of Charset
USSDString ussdString = servFact.createUSSDString("*125*+31628839999#",
null);
AddressString msisdn = this.servFact.createAddressString(
AddressNature.international_number, NumberingPlan.ISDN,
"31628838002");
mapDialog.addProcessUnstructuredSSRequest(ussdDataCodingScheme,
ussdString, msisdn);
// This will initiate the TC-BEGIN with INVOKE component
mapDialog.send();
}
public void onMAPAcceptInfo(MAPAcceptInfo mapAccptInfo) {
// TODO Auto-generated method stub
}
public void onMAPCloseInfo(MAPCloseInfo mapCloseInfo) {
// TODO Auto-generated method stub
}
public void onMAPOpenInfo(MAPOpenInfo mapOpenInfo) {
// TODO Auto-generated method stub
}
public void onMAPProviderAbortInfo(MAPProviderAbortInfo mapProviderAbortInfo) {
// TODO Auto-generated method stub
}
public void onMAPRefuseInfo(MAPRefuseInfo mapRefuseInfo) {
// TODO Auto-generated method stub
}
public void onMAPUserAbortInfo(MAPUserAbortInfo mapUserAbortInfo) {
// TODO Auto-generated method stub
}
public void onProcessUnstructuredSSIndication(
ProcessUnstructuredSSIndication procUnstrInd) {
// TODO Auto-generated method stub
}
public void onUnstructuredSSIndication(UnstructuredSSIndication unstrInd) {
// TODO Auto-generated method stub
}
public static void main(String[] args) throws Exception {
SccpProvider sccpProvider = getSccpProvider(); // JNDI lookup of SCCP
SccpAddress localAddress = createLocalAddress();
SccpAddress remoteAddress = createRemoteAddress();
MAPExample example = new MAPExample(sccpProvider, localAddress,
remoteAddress);
example.run();
}
}