org.mobicents.protocols.ss7.map.api.MAPException Java Examples

The following examples show how to use org.mobicents.protocols.ss7.map.api.MAPException. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SS7Honeypot.java    From SigFW with GNU Affero General Public License v3.0 5 votes vote down vote up
private void initiateUSSD() throws MAPException {
    logger.debug("[[[[[[[[[[    initiateUSSD      ]]]]]]]]]]");

    //SccpAddress callingParty = this.sccpStack.getSccpProvider().getParameterFactory().createSccpAddress(RoutingIndicator.ROUTING_BASED_ON_GLOBAL_TITLE, null, 1, SSN);
    //SccpAddress calledParty = this.sccpStack.getSccpProvider().getParameterFactory().createSccpAddress(RoutingIndicator.ROUTING_BASED_ON_GLOBAL_TITLE, null, 2, SSN);
    
    GlobalTitle callingGT = this.sccpProvider.getParameterFactory().createGlobalTitle("111111111111", 0, org.mobicents.protocols.ss7.indicator.NumberingPlan.ISDN_TELEPHONY, null, NatureOfAddress.INTERNATIONAL);
    GlobalTitle calledGT = this.sccpProvider.getParameterFactory().createGlobalTitle("222222222222", 0, org.mobicents.protocols.ss7.indicator.NumberingPlan.ISDN_TELEPHONY, null, NatureOfAddress.INTERNATIONAL);
    
    SccpAddress callingParty = this.sccpStack.getSccpProvider().getParameterFactory().createSccpAddress(RoutingIndicator.ROUTING_BASED_ON_GLOBAL_TITLE, callingGT, SERVER_SPC, 8);
    SccpAddress calledParty = this.sccpStack.getSccpProvider().getParameterFactory().createSccpAddress(RoutingIndicator.ROUTING_BASED_ON_GLOBAL_TITLE, calledGT, CLIENT_SPC, 8);
        
    
    ISDNAddressString origReference = this.mapProvider.getMAPParameterFactory().createISDNAddressString(AddressNature.international_number, NumberingPlan.land_mobile, "11111111111");
    ISDNAddressString destReference = this.mapProvider.getMAPParameterFactory().createISDNAddressString(AddressNature.international_number, NumberingPlan.land_mobile, "111111111111111");
    
    // First create Dialog
    MAPDialogSupplementary mapDialog = this.mapProvider.getMAPServiceSupplementary().createNewDialog(
            MAPApplicationContext.getInstance(MAPApplicationContextName.networkUnstructuredSsContext,
                    MAPApplicationContextVersion.version2), callingParty, origReference, calledParty, destReference);

    CBSDataCodingSchemeImpl ussdDataCodingScheme = new CBSDataCodingSchemeImpl(0x0F);

    // USSD String: *111*+11111111111#
    // 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 = this.mapProvider.getMAPParameterFactory().createUSSDString("*111*+11111111111#", ussdDataCodingScheme, null);

    ISDNAddressString msisdn = this.mapProvider.getMAPParameterFactory().createISDNAddressString(
            AddressNature.international_number, NumberingPlan.ISDN, "11111111111");

    mapDialog.addProcessUnstructuredSSRequest(ussdDataCodingScheme, ussdString, null, msisdn);

    // This will initiate the TC-BEGIN with INVOKE component
    mapDialog.send();
}
 
Example #2
Source File: SS7Honeypot.java    From SigFW with GNU Affero General Public License v3.0 5 votes vote down vote up
@Override
public void onDialogDelimiter(MAPDialog mapDialog) {
    // This will initiate the TC-END with ReturnResultLast component
    try {
        mapDialog.send();
    } catch (MAPException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
    /*try {
        mapDialog.close(false);
    } catch (MAPException ex) {
        java.util.logging.Logger.getLogger(SS7Server.class.getName()).log(Level.SEVERE, null, ex);
    }*/
    
   /* USSDString ussdStrObj;
    try {
        ussdStrObj = this.mapProvider.getMAPParameterFactory().createUSSDString("Your balance is 500");
    
        CBSDataCodingScheme ussdDataCodingScheme = new CBSDataCodingSchemeImpl(0x0f);
        ((MAPDialogSupplementary) mapDialog).addProcessUnstructuredSSResponse(
                this.processUnstructuredSSRequestInvokeId, ussdDataCodingScheme, ussdStrObj);

        mapDialog.close(false);
    } catch (MAPException ex) {
        java.util.logging.Logger.getLogger(SS7Server.class.getName()).log(Level.SEVERE, null, ex);
    }*/
}
 
Example #3
Source File: SS7Honeypot.java    From SigFW with GNU Affero General Public License v3.0 5 votes vote down vote up
public void onSendRoutingInfoForSMRequest(SendRoutingInfoForSMRequest srfsmr) {
    logger.debug("[[[[[[[[[[    onSendRoutingInfoForSMRequest      ]]]]]]]]]]");
    
    try {
        
        MAPDialogSms curDialog = srfsmr.getMAPDialog();
        long invokeId = curDialog.getLocalDialogId();
        
        IMSI imsi = this.mapProvider.getMAPParameterFactory().createIMSI("123499900000001");
        
        /*ArrayList<MAPPrivateExtension> al = new ArrayList<MAPPrivateExtension>();
        al.add(this.mapProvider.getMAPParameterFactory().createMAPPrivateExtension(new long[] { 1, 2, 3, 4 }, new byte[] { 11, 12, 13, 14, 15 }));
        al.add(this.mapProvider.getMAPParameterFactory().createMAPPrivateExtension(new long[] { 1, 2, 3, 6 }, null));
        al.add(this.mapProvider.getMAPParameterFactory().createMAPPrivateExtension(new long[] { 1, 2, 3, 5 }, new byte[] { 21, 22, 23, 24, 25, 26 }));
        MAPExtensionContainer cnt = this.mapProvider.getMAPParameterFactory().createMAPExtensionContainer(al, new byte[] { 31, 32, 33 });
        */
        ISDNAddressString networkNodeNumber = this.mapProvider.getMAPParameterFactory().createISDNAddressString(AddressNature.international_number, NumberingPlan.ISDN, "11111111111");
        LocationInfoWithLMSI lwlms = this.mapProvider.getMAPParameterFactory().createLocationInfoWithLMSI(networkNodeNumber, null, null, false, null);
        
        // clamp InvokeID
        if (invokeId > 127) { invokeId = 127; }
        if (invokeId < -128) { invokeId = -128; }
        
        curDialog.addSendRoutingInfoForSMResponse(invokeId, imsi, lwlms, null /*cnt*/, Boolean.FALSE, null);

    } catch (MAPException e) {
        logger.error("Error while sending SendRoutingInfoForSMResponse ", e);
    }
    
}
 
Example #4
Source File: SS7Client.java    From SigFW with GNU Affero General Public License v3.0 5 votes vote down vote up
private void initiateUSSD() throws MAPException {

        //SccpAddress callingParty = this.sccpStack.getSccpProvider().getParameterFactory().createSccpAddress(RoutingIndicator.ROUTING_BASED_ON_GLOBAL_TITLE, null, 1, SSN);
        //SccpAddress calledParty = this.sccpStack.getSccpProvider().getParameterFactory().createSccpAddress(RoutingIndicator.ROUTING_BASED_ON_GLOBAL_TITLE, null, 2, SSN);
        
        GlobalTitle callingGT = this.sccpProvider.getParameterFactory().createGlobalTitle("111111111111", 0, org.mobicents.protocols.ss7.indicator.NumberingPlan.ISDN_TELEPHONY, null, NatureOfAddress.INTERNATIONAL);
        GlobalTitle calledGT = this.sccpProvider.getParameterFactory().createGlobalTitle("222222222222", 0, org.mobicents.protocols.ss7.indicator.NumberingPlan.ISDN_TELEPHONY, null, NatureOfAddress.INTERNATIONAL);
        
        SccpAddress callingParty = this.sccpStack.getSccpProvider().getParameterFactory().createSccpAddress(RoutingIndicator.ROUTING_BASED_ON_GLOBAL_TITLE, callingGT, CLIENT_SPC, 8);
        SccpAddress calledParty = this.sccpStack.getSccpProvider().getParameterFactory().createSccpAddress(RoutingIndicator.ROUTING_BASED_ON_GLOBAL_TITLE, calledGT, SERVER_SPC, 8);
            
        
        ISDNAddressString origReference = this.mapProvider.getMAPParameterFactory().createISDNAddressString(AddressNature.international_number, NumberingPlan.land_mobile, "11111111111");
        ISDNAddressString destReference = this.mapProvider.getMAPParameterFactory().createISDNAddressString(AddressNature.international_number, NumberingPlan.land_mobile, "111111111111111");
        
        // First create Dialog
        MAPDialogSupplementary mapDialog = this.mapProvider.getMAPServiceSupplementary().createNewDialog(
                MAPApplicationContext.getInstance(MAPApplicationContextName.networkUnstructuredSsContext,
                        MAPApplicationContextVersion.version2), callingParty, origReference, calledParty, destReference);

        CBSDataCodingSchemeImpl ussdDataCodingScheme = new CBSDataCodingSchemeImpl(0x0F);

        // USSD String: *111*+11111111111#
        // 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 = this.mapProvider.getMAPParameterFactory().createUSSDString("*111*+11111111111#", ussdDataCodingScheme, null);

        ISDNAddressString msisdn = this.mapProvider.getMAPParameterFactory().createISDNAddressString(
                AddressNature.international_number, NumberingPlan.ISDN, "11111111111");

        mapDialog.addProcessUnstructuredSSRequest(ussdDataCodingScheme, ussdString, null, msisdn);

        // This will initiate the TC-BEGIN with INVOKE component
        mapDialog.send();
    }
 
Example #5
Source File: SS7ClientLiveInput.java    From SigFW with GNU Affero General Public License v3.0 5 votes vote down vote up
private void initiateUSSD() throws MAPException {

        //SccpAddress callingParty = this.sccpStack.getSccpProvider().getParameterFactory().createSccpAddress(RoutingIndicator.ROUTING_BASED_ON_GLOBAL_TITLE, null, 1, SSN);
        //SccpAddress calledParty = this.sccpStack.getSccpProvider().getParameterFactory().createSccpAddress(RoutingIndicator.ROUTING_BASED_ON_GLOBAL_TITLE, null, 2, SSN);
        
        GlobalTitle callingGT = this.sccpProvider.getParameterFactory().createGlobalTitle("111111111111", 0, org.mobicents.protocols.ss7.indicator.NumberingPlan.ISDN_TELEPHONY, null, NatureOfAddress.INTERNATIONAL);
        GlobalTitle calledGT = this.sccpProvider.getParameterFactory().createGlobalTitle("222222222222", 0, org.mobicents.protocols.ss7.indicator.NumberingPlan.ISDN_TELEPHONY, null, NatureOfAddress.INTERNATIONAL);
        
        SccpAddress callingParty = this.sccpStack.getSccpProvider().getParameterFactory().createSccpAddress(RoutingIndicator.ROUTING_BASED_ON_GLOBAL_TITLE, callingGT, CLIENT_SPC, 8);
        SccpAddress calledParty = this.sccpStack.getSccpProvider().getParameterFactory().createSccpAddress(RoutingIndicator.ROUTING_BASED_ON_GLOBAL_TITLE, calledGT, SERVER_SPC, 8);
            
        
        ISDNAddressString origReference = this.mapProvider.getMAPParameterFactory().createISDNAddressString(AddressNature.international_number, NumberingPlan.land_mobile, "11111111111");
        ISDNAddressString destReference = this.mapProvider.getMAPParameterFactory().createISDNAddressString(AddressNature.international_number, NumberingPlan.land_mobile, "111111111111111");
        
        // First create Dialog
        MAPDialogSupplementary mapDialog = this.mapProvider.getMAPServiceSupplementary().createNewDialog(
                MAPApplicationContext.getInstance(MAPApplicationContextName.networkUnstructuredSsContext,
                        MAPApplicationContextVersion.version2), callingParty, origReference, calledParty, destReference);

        CBSDataCodingSchemeImpl ussdDataCodingScheme = new CBSDataCodingSchemeImpl(0x0F);

        // USSD String: *111*+11111111111#
        // 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 = this.mapProvider.getMAPParameterFactory().createUSSDString("*111*+11111111111#", ussdDataCodingScheme, null);

        ISDNAddressString msisdn = this.mapProvider.getMAPParameterFactory().createISDNAddressString(
                AddressNature.international_number, NumberingPlan.ISDN, "11111111111");

        mapDialog.addProcessUnstructuredSSRequest(ussdDataCodingScheme, ussdString, null, msisdn);

        // This will initiate the TC-BEGIN with INVOKE component
        mapDialog.send();
    }
 
Example #6
Source File: SS7Server.java    From SigFW with GNU Affero General Public License v3.0 5 votes vote down vote up
@Override
public void onDialogDelimiter(MAPDialog mapDialog) {
    // This will initiate the TC-END with ReturnResultLast component
    try {
        mapDialog.send();
    } catch (MAPException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
    /*try {
        mapDialog.close(false);
    } catch (MAPException ex) {
        java.util.logging.Logger.getLogger(SS7Server.class.getName()).log(Level.SEVERE, null, ex);
    }*/
    
   /* USSDString ussdStrObj;
    try {
        ussdStrObj = this.mapProvider.getMAPParameterFactory().createUSSDString("Your balance is 500");
    
        CBSDataCodingScheme ussdDataCodingScheme = new CBSDataCodingSchemeImpl(0x0f);
        ((MAPDialogSupplementary) mapDialog).addProcessUnstructuredSSResponse(
                this.processUnstructuredSSRequestInvokeId, ussdDataCodingScheme, ussdStrObj);

        mapDialog.close(false);
    } catch (MAPException ex) {
        java.util.logging.Logger.getLogger(SS7Server.class.getName()).log(Level.SEVERE, null, ex);
    }*/
}
 
Example #7
Source File: SS7Server.java    From SigFW with GNU Affero General Public License v3.0 5 votes vote down vote up
private void initiateUSSD() throws MAPException {
    logger.debug("[[[[[[[[[[    initiateUSSD      ]]]]]]]]]]");

    //SccpAddress callingParty = this.sccpStack.getSccpProvider().getParameterFactory().createSccpAddress(RoutingIndicator.ROUTING_BASED_ON_GLOBAL_TITLE, null, 1, SSN);
    //SccpAddress calledParty = this.sccpStack.getSccpProvider().getParameterFactory().createSccpAddress(RoutingIndicator.ROUTING_BASED_ON_GLOBAL_TITLE, null, 2, SSN);
    
    GlobalTitle callingGT = this.sccpProvider.getParameterFactory().createGlobalTitle("111111111111", 0, org.mobicents.protocols.ss7.indicator.NumberingPlan.ISDN_TELEPHONY, null, NatureOfAddress.INTERNATIONAL);
    GlobalTitle calledGT = this.sccpProvider.getParameterFactory().createGlobalTitle("222222222222", 0, org.mobicents.protocols.ss7.indicator.NumberingPlan.ISDN_TELEPHONY, null, NatureOfAddress.INTERNATIONAL);
    
    SccpAddress callingParty = this.sccpStack.getSccpProvider().getParameterFactory().createSccpAddress(RoutingIndicator.ROUTING_BASED_ON_GLOBAL_TITLE, callingGT, SERVER_SPC, 8);
    SccpAddress calledParty = this.sccpStack.getSccpProvider().getParameterFactory().createSccpAddress(RoutingIndicator.ROUTING_BASED_ON_GLOBAL_TITLE, calledGT, CLIENT_SPC, 8);
        
    
    ISDNAddressString origReference = this.mapProvider.getMAPParameterFactory().createISDNAddressString(AddressNature.international_number, NumberingPlan.land_mobile, "11111111111");
    ISDNAddressString destReference = this.mapProvider.getMAPParameterFactory().createISDNAddressString(AddressNature.international_number, NumberingPlan.land_mobile, "111111111111111");
    
    // First create Dialog
    MAPDialogSupplementary mapDialog = this.mapProvider.getMAPServiceSupplementary().createNewDialog(
            MAPApplicationContext.getInstance(MAPApplicationContextName.networkUnstructuredSsContext,
                    MAPApplicationContextVersion.version2), callingParty, origReference, calledParty, destReference);

    CBSDataCodingSchemeImpl ussdDataCodingScheme = new CBSDataCodingSchemeImpl(0x0F);

    // USSD String: *111*+11111111111#
    // 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 = this.mapProvider.getMAPParameterFactory().createUSSDString("*111*+11111111111#", ussdDataCodingScheme, null);

    ISDNAddressString msisdn = this.mapProvider.getMAPParameterFactory().createISDNAddressString(
            AddressNature.international_number, NumberingPlan.ISDN, "11111111111");

    mapDialog.addProcessUnstructuredSSRequest(ussdDataCodingScheme, ussdString, null, msisdn);

    // This will initiate the TC-BEGIN with INVOKE component
    mapDialog.send();
}
 
Example #8
Source File: ClientServer.java    From gmlc with GNU Affero General Public License v3.0 4 votes vote down vote up
@Override
  public void onSubscriberLocationReportRequest(SubscriberLocationReportRequest subscriberLocationReportRequest) {

    if (logger.isDebugEnabled()) {
      logger.debug(
          String.format("onSubscriberLocationReportRequest for DialogId=%d", subscriberLocationReportRequest.getMAPDialog().getLocalDialogId()));
    }
    if (logger.isInfoEnabled()) {
      logger.info(String.format("onSubscriberLocationReportRequest for DialogId=%d", subscriberLocationReportRequest.getMAPDialog().getLocalDialogId()));
    }

    try {
      long invokeId = subscriberLocationReportRequest.getInvokeId();
      MAPDialogLsm mapDialogLsm = subscriberLocationReportRequest.getMAPDialog();
      mapDialogLsm.setUserObject(invokeId);

      // Create Routing Information parameters for concerning MAP operation
      MAPParameterFactoryImpl mapFactory = new MAPParameterFactoryImpl();
      ISDNAddressString naEsrd = new ISDNAddressStringImpl(AddressNature.international_number,
          org.mobicents.protocols.ss7.map.api.primitives.NumberingPlan.ISDN, "5982123007");
      ISDNAddressString naEsrk = new ISDNAddressStringImpl(AddressNature.international_number,
          org.mobicents.protocols.ss7.map.api.primitives.NumberingPlan.ISDN, "5982123009");
/*
            long[] oid = {0, 0, 17, 773, 1, 1, 1};
            String pExtData = "1144";
            byte[] privateExtData = pExtData.getBytes();
            MAPPrivateExtension mapPrivateExtension = new MAPPrivateExtensionImpl(oid, privateExtData);
            ArrayList<MAPPrivateExtension> mapPrivateExtensions = new ArrayList<MAPPrivateExtension>();
            mapPrivateExtensions.add(mapPrivateExtension);
            String pcsExts = "1033";
            byte[] pcsExtensions = pcsExts.getBytes();
            MAPExtensionContainer mapExtensionContainer = new MAPExtensionContainerImpl(mapPrivateExtensions, pcsExtensions);
*/
      MAPExtensionContainer mapExtensionContainer = null;

      mapDialogLsm.addSubscriberLocationReportResponse(invokeId, naEsrd, naEsrk, mapExtensionContainer);

      // This will initiate the TC-BEGIN with INVOKE component
      mapDialogLsm.close(false);

    } catch (MAPException mapException) {
      logger.error("MAP Exception while processing onSubscriberLocationReportRequest ", mapException);
    } catch (Exception e) {
      logger.error("Exception while processing onSubscriberLocationReportRequest ", e);
    }

  }
 
Example #9
Source File: ClientServer.java    From gmlc with GNU Affero General Public License v3.0 4 votes vote down vote up
@Override
  public void onProvideSubscriberLocationRequest(ProvideSubscriberLocationRequest provideSubscriberLocationRequest) {

    if (logger.isDebugEnabled()) {
      logger.debug(
          String.format("onProvideSubscriberLocationRequest for DialogId=%d", provideSubscriberLocationRequest.getMAPDialog().getLocalDialogId()));
    }
    if (logger.isInfoEnabled()) {
      logger.info(String.format("onProvideSubscriberLocationRequest for DialogId=%d", provideSubscriberLocationRequest.getMAPDialog().getLocalDialogId()));
    }

    try {
      long invokeId = provideSubscriberLocationRequest.getInvokeId();
      MAPDialogLsm mapDialogLsm = provideSubscriberLocationRequest.getMAPDialog();
      mapDialogLsm.setUserObject(invokeId);

      // Create Routing Information parameters for concerning MAP operation
      MAPParameterFactoryImpl mapFactory = new MAPParameterFactoryImpl();
      ISDNAddressString mscNumber = new ISDNAddressStringImpl(AddressNature.international_number,
          org.mobicents.protocols.ss7.map.api.primitives.NumberingPlan.ISDN, "5982123007");
      ISDNAddressString sgsnNumber = new ISDNAddressStringImpl(AddressNature.international_number,
          org.mobicents.protocols.ss7.map.api.primitives.NumberingPlan.ISDN, "5982123009");
      String lmsiStr = "87654321";
      byte[] Lmsi = lmsiStr.getBytes();
      LMSI lmsi = mapFactory.createLMSI(Lmsi);
      byte[] eGeographicalInformation = new BigInteger("014321a10022337799", 16).toByteArray();
      ExtGeographicalInformation extGeographicalInformation = mapFactory.createExtGeographicalInformation(eGeographicalInformation);
      String posDataInfo = "5533ab01";
      byte[] posDataInformation = posDataInfo.getBytes();
      PositioningDataInformation positioningDataInformation = mapFactory.createPositioningDataInformation(posDataInformation);
      byte[] utranData = new BigInteger("43210987654321", 16).toByteArray();
      UtranPositioningDataInfo utranPositioningDataInfo = new UtranPositioningDataInfoImpl(utranData);
      Integer ageOfLocationEstimate = 1;
      byte[] addLocationEstimate = new BigInteger("5533a100223377", 16).toByteArray();
      AddGeographicalInformation additionalLocationEstimate = mapFactory.createAddGeographicalInformation(addLocationEstimate);
/*
            long[] oid = {0, 0, 17, 773, 1, 1, 1};
            String privExtData = "1144";
            byte[] privateExtData = privExtData.getBytes();
            MAPPrivateExtension mapPrivateExtension = new MAPPrivateExtensionImpl(oid, privateExtData);
            ArrayList<MAPPrivateExtension> mapPrivateExtensions = new ArrayList<MAPPrivateExtension>();
            mapPrivateExtensions.add(mapPrivateExtension);
            String pcsExts = "1033";
            byte[] pcsExtensions = pcsExts.getBytes();
            MAPExtensionContainer mapExtensionContainer = new MAPExtensionContainerImpl(mapPrivateExtensions, pcsExtensions);
*/
      MAPExtensionContainer mapExtensionContainer = null;
      Boolean deferredMTLRResponseIndicator = true;
      int mcc, mnc, lac, cellIdOrServiceAreaCode;
      mcc = 748;
      mnc = 1;
      lac = 23;
      cellIdOrServiceAreaCode = 369;
      CellGlobalIdOrServiceAreaIdFixedLength cellGlobalIdOrServiceAreaIdFixedLength = mapFactory
          .createCellGlobalIdOrServiceAreaIdFixedLength(mcc, mnc, lac, cellIdOrServiceAreaCode);
      CellGlobalIdOrServiceAreaIdOrLAI cellGlobalIdOrServiceAreaIdOrLAI = mapFactory
          .createCellGlobalIdOrServiceAreaIdOrLAI(cellGlobalIdOrServiceAreaIdFixedLength);
      Boolean saiPresent = true;
      AccuracyFulfilmentIndicator accuracyFulfilmentIndicator = AccuracyFulfilmentIndicator.getAccuracyFulfilmentIndicator(0);
      // AccuracyFulfilmentIndicator ::= ENUMERATED { requestedAccuracyFulfilled (0), requestedAccuracyNotFulfilled (1), ... }
      String velEstStr = "00000001";
      byte[] velEst = velEstStr.getBytes();
      VelocityEstimate velocityEstimate = mapFactory.createVelocityEstimate(velEst);
      Boolean moLrShortCircuitIndicator = true;
      byte[] gGanss = new BigInteger("666601019999", 16).toByteArray();
      GeranGANSSpositioningData geranGANSSpositioningData = new GeranGANSSpositioningDataImpl(gGanss);
      byte[] uGanss = new BigInteger("777701019898", 16).toByteArray();
      UtranGANSSpositioningData utranGANSSpositioningData = new UtranGANSSpositioningDataImpl(uGanss);
      ServingNodeAddress servingNodeAddress = mapFactory.createServingNodeAddressMscNumber(mscNumber);

      mapDialogLsm.addProvideSubscriberLocationResponse(invokeId, extGeographicalInformation, positioningDataInformation, utranPositioningDataInfo,
          ageOfLocationEstimate, additionalLocationEstimate, mapExtensionContainer, deferredMTLRResponseIndicator, cellGlobalIdOrServiceAreaIdOrLAI,
          saiPresent, accuracyFulfilmentIndicator, velocityEstimate, moLrShortCircuitIndicator, geranGANSSpositioningData, utranGANSSpositioningData,
          servingNodeAddress);
      // This will initiate the TC-BEGIN with INVOKE component
      mapDialogLsm.close(false);

    } catch (MAPException mapException) {
      logger.error("MAP Exception while processing onProvideSubscriberLocationRequest ", mapException);
    } catch (Exception e) {
      logger.error("Exception while processing onProvideSubscriberLocationRequest ", e);
    }

  }
 
Example #10
Source File: ClientServer.java    From gmlc with GNU Affero General Public License v3.0 4 votes vote down vote up
@Override
  public void onSendRoutingInfoForLCSRequest(SendRoutingInfoForLCSRequest sendRoutingInforForLCSRequest) {

    if (logger.isDebugEnabled()) {
      logger.debug(
          String.format("onSendRoutingInfoForLCSRequest for DialogId=%d", sendRoutingInforForLCSRequest.getMAPDialog().getLocalDialogId()));
    }
    if (logger.isInfoEnabled()) {
      logger.info(String.format("onAnyTimeInterrogationRequest for DialogId=%d", sendRoutingInforForLCSRequest.getMAPDialog().getLocalDialogId()));
    }

    try {
      long invokeId = sendRoutingInforForLCSRequest.getInvokeId();
      MAPDialogLsm mapDialogLsm = sendRoutingInforForLCSRequest.getMAPDialog();
      mapDialogLsm.setUserObject(invokeId);

      // Create Routing Information parameters for concerning MAP operation
      MAPParameterFactoryImpl mapFactory = new MAPParameterFactoryImpl();
      String mscAddress = "5982123007";
      String sgsnAddress = "5982123009";
      ISDNAddressString mscNumber = new ISDNAddressStringImpl(AddressNature.international_number,
          org.mobicents.protocols.ss7.map.api.primitives.NumberingPlan.ISDN, mscAddress);
      ISDNAddressString sgsnNumber = new ISDNAddressStringImpl(AddressNature.international_number,
          org.mobicents.protocols.ss7.map.api.primitives.NumberingPlan.ISDN, sgsnAddress);
      AdditionalNumber additionalNumber = new AdditionalNumberImpl(null, sgsnNumber);
      String lmsiStr = "12345678";
      byte[] Lmsi = lmsiStr.getBytes();
      LMSI lmsi = mapFactory.createLMSI(Lmsi);
      Boolean gprsNodeIndicator = false;
      boolean lcsCapabilitySetRelease98_99 = true;
      boolean lcsCapabilitySetRelease4 = true;
      boolean lcsCapabilitySetRelease5 = true;
      boolean lcsCapabilitySetRelease6 = true;
      boolean lcsCapabilitySetRelease7 = false;
      SupportedLCSCapabilitySets supportedLCSCapabilitySets = new SupportedLCSCapabilitySetsImpl(lcsCapabilitySetRelease98_99, lcsCapabilitySetRelease4,
          lcsCapabilitySetRelease5, lcsCapabilitySetRelease6, lcsCapabilitySetRelease7);
      lcsCapabilitySetRelease7 = true;
      SupportedLCSCapabilitySets additionalLCSCapabilitySets = new SupportedLCSCapabilitySetsImpl(lcsCapabilitySetRelease98_99, lcsCapabilitySetRelease4,
          lcsCapabilitySetRelease5, lcsCapabilitySetRelease6, lcsCapabilitySetRelease7);
      MAPExtensionContainer mapExtensionContainer = null;
      byte[] mmeNom = new BigInteger("00112233445566778899", 16).toByteArray();
      DiameterIdentity mmeName = new DiameterIdentityImpl(mmeNom);
      byte[] aaaSN = new BigInteger("0011223344556677889900", 16).toByteArray();
      DiameterIdentity aaaServerName = new DiameterIdentityImpl(aaaSN);
      ISDNAddressString isdnAdd = new ISDNAddressStringImpl(AddressNature.international_number,
          org.mobicents.protocols.ss7.map.api.primitives.NumberingPlan.ISDN, "59899077937");
      SubscriberIdentity msisdn = new SubscriberIdentityImpl(isdnAdd);
      byte[] visitedGmlcAddress = new BigInteger("112233445500", 16).toByteArray();
      GSNAddress vGmlcAddress = new GSNAddressImpl(visitedGmlcAddress);
      byte[] homeGmlcAddress = new BigInteger("11223344556677", 16).toByteArray();
      GSNAddress hGmlcAddress = new GSNAddressImpl(homeGmlcAddress);
      byte[] pivacyProfileRegisterAddress = new BigInteger("112233445566", 16).toByteArray();
      GSNAddress pprAddress = new GSNAddressImpl(pivacyProfileRegisterAddress);
      byte[] addVGmlcAddress = new BigInteger("5522334455", 16).toByteArray();
      GSNAddress additionalVGmlcAddress = new GSNAddressImpl(addVGmlcAddress);

      LCSLocationInfo lcsLocationInfo = mapFactory.createLCSLocationInfo(mscNumber, lmsi, mapExtensionContainer, gprsNodeIndicator,
          additionalNumber, supportedLCSCapabilitySets, additionalLCSCapabilitySets, mmeName, aaaServerName);
//            addSendRoutingInfoForLCSResponse(long invokeId, SubscriberIdentity targetMS, LCSLocationInfo lcsLocationInfo,
//                                             MAPExtensionContainer extensionContainer,
//                                            byte[] vgmlcAddress, byte[] hGmlcAddress, byte[] pprAddress, byte[] additionalVGmlcAddress)
      mapDialogLsm.addSendRoutingInfoForLCSResponse(invokeId, msisdn, lcsLocationInfo, mapExtensionContainer, vGmlcAddress, hGmlcAddress,
          pprAddress, additionalVGmlcAddress);
      // This will initiate the TC-BEGIN with INVOKE component
      mapDialogLsm.close(false);

    } catch (MAPException mapException) {
      logger.error("MAP Exception while processing onSendRoutingInfoForLCSRequest ", mapException);
    } catch (Exception e) {
      logger.error("Exception while processing onSendRoutingInfoForLCSRequest ", e);
    }
  }
 
Example #11
Source File: ClientServer.java    From gmlc with GNU Affero General Public License v3.0 4 votes vote down vote up
public void onAnyTimeInterrogationRequest(AnyTimeInterrogationRequest atiReq) {

    if (logger.isDebugEnabled()) {
      logger.debug(
          String.format("onAnyTimeInterrogationRequest for DialogId=%d", atiReq.getMAPDialog().getLocalDialogId()));
    }
    if (logger.isInfoEnabled()) {
      logger.info(String.format("onAnyTimeInterrogationRequest for DialogId=%d", atiReq.getMAPDialog().getLocalDialogId()));
    } /*else {
            logger.warn(String.format("onAnyTimeInterrogationRequest for DialogId=%d", atiReq.getMAPDialog().getLocalDialogId()));
        }*/

    try {
      long invokeId = atiReq.getInvokeId();
      MAPDialogMobility mapDialogMobility = atiReq.getMAPDialog();
      mapDialogMobility.setUserObject(invokeId);

      MAPParameterFactoryImpl mapFactory = new MAPParameterFactoryImpl();

      // Create Subscriber Information parameters including Location Information and Subscriber State
      // for concerning MAP operation
      int mcc, mnc, lac, cellIdOrServiceAreaCode;
      mcc = 748;
      mnc = 1;
      lac = 23;
      cellIdOrServiceAreaCode = 369;
      CellGlobalIdOrServiceAreaIdFixedLength cellGlobalIdOrServiceAreaIdFixedLength = mapFactory
          .createCellGlobalIdOrServiceAreaIdFixedLength(mcc, mnc, lac, cellIdOrServiceAreaCode);
      CellGlobalIdOrServiceAreaIdOrLAI cellGlobalIdOrServiceAreaIdOrLAI = mapFactory
          .createCellGlobalIdOrServiceAreaIdOrLAI(cellGlobalIdOrServiceAreaIdFixedLength);
      ISDNAddressString vlrNumber = new ISDNAddressStringImpl(AddressNature.international_number,
          org.mobicents.protocols.ss7.map.api.primitives.NumberingPlan.ISDN, "5982123007");
      ISDNAddressString mscNumber = new ISDNAddressStringImpl(AddressNature.international_number,
          org.mobicents.protocols.ss7.map.api.primitives.NumberingPlan.ISDN, "5982123007");
      Integer ageOfLocationInformation = 0; // ageOfLocationInformation
      GeographicalInformation geographicalInformation = null;
      LocationNumberMap locationNumber = null;
      MAPExtensionContainer mapExtensionContainer = null;
      LSAIdentity selectedLSAId = null;
      GeodeticInformation geodeticInformation = null;
      boolean currentLocationRetrieved = false;
      boolean saiPresent = false;
      LocationInformationEPS locationInformationEPS = null;
      UserCSGInformation userCSGInformation = null;
      LocationInformationGPRS locationInformationGPRS = null;
      PSSubscriberState psSubscriberState = null;
      IMEI imei = null;
      MSClassmark2 msClassmark2 = null;
      GPRSMSClass gprsMSClass = null;
      MNPInfoRes mnpInfoRes = null;
      SubscriberStateChoice subscriberStateChoice = SubscriberStateChoice.assumedIdle;
      // 0=assumedIdle, 1=camelBusy, 2=notProvidedFromVLR
      NotReachableReason notReachableReason = null;

      LocationInformation locationInformation = mapFactory.createLocationInformation(ageOfLocationInformation,
          geographicalInformation, vlrNumber, locationNumber, cellGlobalIdOrServiceAreaIdOrLAI, mapExtensionContainer,
          selectedLSAId, mscNumber, geodeticInformation, currentLocationRetrieved, saiPresent, locationInformationEPS,
          userCSGInformation);

      SubscriberState subscriberState = mapFactory.createSubscriberState(subscriberStateChoice, notReachableReason);

      SubscriberInfo subscriberInfo = mapFactory.createSubscriberInfo(locationInformation, subscriberState,
          mapExtensionContainer, locationInformationGPRS, psSubscriberState, imei, msClassmark2, gprsMSClass,
          mnpInfoRes);

      mapDialogMobility.addAnyTimeInterrogationResponse(invokeId, subscriberInfo, mapExtensionContainer);

      // This will initiate the TC-BEGIN with INVOKE component
      mapDialogMobility.close(false);

    } catch (MAPException mapException) {
      logger.error("MAP Exception while processing AnyTimeInterrogationRequest ", mapException);
    } catch (Exception e) {
      logger.error("Exception while processing AnyTimeInterrogationRequest ", e);
    }

  }
 
Example #12
Source File: Server.java    From gmlc with GNU Affero General Public License v3.0 4 votes vote down vote up
@Override
  public void onSubscriberLocationReportRequest(SubscriberLocationReportRequest subscriberLocationReportRequest) {

    if (logger.isDebugEnabled()) {
      logger.debug(
          String.format("onSubscriberLocationReportRequest for DialogId=%d", subscriberLocationReportRequest.getMAPDialog().getLocalDialogId()));
    }
    if (logger.isInfoEnabled()) {
      logger.info(String.format("onSubscriberLocationReportRequest for DialogId=%d", subscriberLocationReportRequest.getMAPDialog().getLocalDialogId()));
    }

    try {
      long invokeId = subscriberLocationReportRequest.getInvokeId();
      MAPDialogLsm mapDialogLsm = subscriberLocationReportRequest.getMAPDialog();
      mapDialogLsm.setUserObject(invokeId);

      // Create Routing Information parameters for concerning MAP operation
      MAPParameterFactoryImpl mapFactory = new MAPParameterFactoryImpl();
      ISDNAddressString naEsrd = new ISDNAddressStringImpl(AddressNature.international_number,
          org.mobicents.protocols.ss7.map.api.primitives.NumberingPlan.ISDN, "5982123007");
      ISDNAddressString naEsrk = new ISDNAddressStringImpl(AddressNature.international_number,
          org.mobicents.protocols.ss7.map.api.primitives.NumberingPlan.ISDN, "5982123009");
/*
            long[] oid = {0, 0, 17, 773, 1, 1, 1};
            String privExtData = "1144";
            byte[] privateExtData = privExtData.getBytes();
            MAPPrivateExtension mapPrivateExtension = new MAPPrivateExtensionImpl(oid, privateExtData);
            ArrayList<MAPPrivateExtension> mapPrivateExtensions = new ArrayList<MAPPrivateExtension>();
            mapPrivateExtensions.add(mapPrivateExtension);
            String pcsExtStr = "1033";
            byte[] pcsExtensions = pcsExtStr.getBytes();
            MAPExtensionContainer mapExtensionContainer = new MAPExtensionContainerImpl(mapPrivateExtensions, pcsExtensions);
*/
      MAPExtensionContainer mapExtensionContainer = null;

      mapDialogLsm.addSubscriberLocationReportResponse(invokeId, naEsrd, naEsrk, mapExtensionContainer);

      // This will initiate the TC-BEGIN with INVOKE component
      mapDialogLsm.close(false);

    } catch (MAPException mapException) {
      logger.error("MAP Exception while processing onSubscriberLocationReportRequest ", mapException);
    } catch (Exception e) {
      logger.error("Exception while processing onSubscriberLocationReportRequest ", e);
    }

  }
 
Example #13
Source File: Server.java    From gmlc with GNU Affero General Public License v3.0 4 votes vote down vote up
@Override
  public void onProvideSubscriberLocationRequest(ProvideSubscriberLocationRequest provideSubscriberLocationRequest) {

    if (logger.isDebugEnabled()) {
      logger.debug(
          String.format("onProvideSubscriberLocationRequest for DialogId=%d", provideSubscriberLocationRequest.getMAPDialog().getLocalDialogId()));
    }
    if (logger.isInfoEnabled()) {
      logger.info(String.format("onProvideSubscriberLocationRequest for DialogId=%d", provideSubscriberLocationRequest.getMAPDialog().getLocalDialogId()));
    }

    try {
      long invokeId = provideSubscriberLocationRequest.getInvokeId();
      MAPDialogLsm mapDialogLsm = provideSubscriberLocationRequest.getMAPDialog();
      mapDialogLsm.setUserObject(invokeId);

      // Create Routing Information parameters for concerning MAP operation
      MAPParameterFactoryImpl mapFactory = new MAPParameterFactoryImpl();
      ISDNAddressString mscNumber = new ISDNAddressStringImpl(AddressNature.international_number,
          org.mobicents.protocols.ss7.map.api.primitives.NumberingPlan.ISDN, "5982123007");
      ISDNAddressString sgsnNumber = new ISDNAddressStringImpl(AddressNature.international_number,
          org.mobicents.protocols.ss7.map.api.primitives.NumberingPlan.ISDN, "5982123009");
      String lmsiStr = "87654321";
      byte[] Lmsi = lmsiStr.getBytes();
      LMSI lmsi = mapFactory.createLMSI(Lmsi);
      byte[] eGeographicalInformation = new BigInteger("014321a10022337799", 16).toByteArray();
      ExtGeographicalInformation extGeographicalInformation = mapFactory.createExtGeographicalInformation(eGeographicalInformation);
      String posDataInfo = "55338901";
      byte[] posDataInformation = posDataInfo.getBytes();
      PositioningDataInformation positioningDataInformation = mapFactory.createPositioningDataInformation(posDataInformation);
      byte[] utranData = new BigInteger("43210987654321", 16).toByteArray();
      UtranPositioningDataInfo utranPositioningDataInfo = new UtranPositioningDataInfoImpl(utranData);
      Integer ageOfLocationEstimate = 1;
      byte[] addLocationEstimate = new BigInteger("5533a100223377", 16).toByteArray();
      AddGeographicalInformation additionalLocationEstimate = mapFactory.createAddGeographicalInformation(addLocationEstimate);
/*
            long[] oid = {0, 0, 17, 773, 1, 1, 1};
            String pExtData = "1144":
            byte[] privateExtData = pExtData.getBytes();
            MAPPrivateExtension mapPrivateExtension = new MAPPrivateExtensionImpl(oid, privateExtData);
            ArrayList<MAPPrivateExtension> mapPrivateExtensions = new ArrayList<MAPPrivateExtension>();
            mapPrivateExtensions.add(mapPrivateExtension);
            String pcsExt = "1033";
            byte[] pcsExtensions = pcsExt.getBytes();
            MAPExtensionContainer mapExtensionContainer = new MAPExtensionContainerImpl(mapPrivateExtensions, pcsExtensions);
*/
      MAPExtensionContainer mapExtensionContainer = null;
      Boolean deferredMTLRResponseIndicator = true;
      int mcc, mnc, lac, cellIdOrServiceAreaCode;
      mcc = 748;
      mnc = 1;
      lac = 23;
      cellIdOrServiceAreaCode = 369;
      CellGlobalIdOrServiceAreaIdFixedLength cellGlobalIdOrServiceAreaIdFixedLength = mapFactory
          .createCellGlobalIdOrServiceAreaIdFixedLength(mcc, mnc, lac, cellIdOrServiceAreaCode);
      CellGlobalIdOrServiceAreaIdOrLAI cellGlobalIdOrServiceAreaIdOrLAI = mapFactory
          .createCellGlobalIdOrServiceAreaIdOrLAI(cellGlobalIdOrServiceAreaIdFixedLength);
      Boolean saiPresent = true;
      AccuracyFulfilmentIndicator accuracyFulfilmentIndicator = AccuracyFulfilmentIndicator.getAccuracyFulfilmentIndicator(0);
      // AccuracyFulfilmentIndicator ::= ENUMERATED { requestedAccuracyFulfilled (0), requestedAccuracyNotFulfilled (1), ... }
      String velEstStr = "00000001";
      byte[] velEst = velEstStr.getBytes();
      VelocityEstimate velocityEstimate = mapFactory.createVelocityEstimate(velEst);
      Boolean moLrShortCircuitIndicator = true;
      byte[] gGanss = new BigInteger("666601019999", 16).toByteArray();
      GeranGANSSpositioningData geranGANSSpositioningData = new GeranGANSSpositioningDataImpl(gGanss);
      byte[] uGanss = new BigInteger("777701019898", 16).toByteArray();
      UtranGANSSpositioningData utranGANSSpositioningData = new UtranGANSSpositioningDataImpl(uGanss);
      ServingNodeAddress servingNodeAddress = mapFactory.createServingNodeAddressMscNumber(mscNumber);

      mapDialogLsm.addProvideSubscriberLocationResponse(invokeId, extGeographicalInformation, positioningDataInformation, utranPositioningDataInfo,
          ageOfLocationEstimate, additionalLocationEstimate, mapExtensionContainer, deferredMTLRResponseIndicator, cellGlobalIdOrServiceAreaIdOrLAI,
          saiPresent, accuracyFulfilmentIndicator, velocityEstimate, moLrShortCircuitIndicator, geranGANSSpositioningData, utranGANSSpositioningData,
          servingNodeAddress);
      // This will initiate the TC-BEGIN with INVOKE component
      mapDialogLsm.close(false);

    } catch (MAPException mapException) {
      logger.error("MAP Exception while processing onProvideSubscriberLocationRequest ", mapException);
    } catch (Exception e) {
      logger.error("Exception while processing onProvideSubscriberLocationRequest ", e);
    }

  }
 
Example #14
Source File: Server.java    From gmlc with GNU Affero General Public License v3.0 4 votes vote down vote up
@Override
  public void onSendRoutingInfoForLCSRequest(SendRoutingInfoForLCSRequest sendRoutingInforForLCSRequest) {

    if (logger.isDebugEnabled()) {
      logger.debug(
          String.format("onSendRoutingInfoForLCSRequest for DialogId=%d", sendRoutingInforForLCSRequest.getMAPDialog().getLocalDialogId()));
    }
    if (logger.isInfoEnabled()) {
      logger.info(String.format("onAnyTimeInterrogationRequest for DialogId=%d", sendRoutingInforForLCSRequest.getMAPDialog().getLocalDialogId()));
    }

    try {
      long invokeId = sendRoutingInforForLCSRequest.getInvokeId();
      MAPDialogLsm mapDialogLsm = sendRoutingInforForLCSRequest.getMAPDialog();
      mapDialogLsm.setUserObject(invokeId);

      // Create Routing Information parameters for concerning MAP operation
      MAPParameterFactoryImpl mapFactory = new MAPParameterFactoryImpl();
      String mscAddress = "5982123007";
      String sgsnAddress = "5982123009";
      ISDNAddressString mscNumber = new ISDNAddressStringImpl(AddressNature.international_number,
          org.mobicents.protocols.ss7.map.api.primitives.NumberingPlan.ISDN, mscAddress);
      ISDNAddressString sgsnNumber = new ISDNAddressStringImpl(AddressNature.international_number,
          org.mobicents.protocols.ss7.map.api.primitives.NumberingPlan.ISDN, sgsnAddress);
      AdditionalNumber additionalNumber = new AdditionalNumberImpl(null, sgsnNumber);
      String lmsiStr = "12345678";
      byte[] Lmsi = lmsiStr.getBytes();
      LMSI lmsi = mapFactory.createLMSI(Lmsi);
      Boolean gprsNodeIndicator = false;
      boolean lcsCapabilitySetRelease98_99 = true;
      boolean lcsCapabilitySetRelease4 = true;
      boolean lcsCapabilitySetRelease5 = true;
      boolean lcsCapabilitySetRelease6 = true;
      boolean lcsCapabilitySetRelease7 = false;
      SupportedLCSCapabilitySets supportedLCSCapabilitySets = new SupportedLCSCapabilitySetsImpl(lcsCapabilitySetRelease98_99, lcsCapabilitySetRelease4,
          lcsCapabilitySetRelease5, lcsCapabilitySetRelease6, lcsCapabilitySetRelease7);
      lcsCapabilitySetRelease7 = true;
      SupportedLCSCapabilitySets additionalLCSCapabilitySets = new SupportedLCSCapabilitySetsImpl(lcsCapabilitySetRelease98_99, lcsCapabilitySetRelease4,
          lcsCapabilitySetRelease5, lcsCapabilitySetRelease6, lcsCapabilitySetRelease7);
      MAPExtensionContainer mapExtensionContainer = null;
      byte[] mmeNom = new BigInteger("00112233445566778899", 16).toByteArray();
      DiameterIdentity mmeName = new DiameterIdentityImpl(mmeNom);
      byte[] aaaSN = new BigInteger("0011223344556677889900", 16).toByteArray();
      DiameterIdentity aaaServerName = new DiameterIdentityImpl(aaaSN);
      ISDNAddressString isdnAdd = new ISDNAddressStringImpl(AddressNature.international_number,
          org.mobicents.protocols.ss7.map.api.primitives.NumberingPlan.ISDN, "59899077937");
      SubscriberIdentity msisdn = new SubscriberIdentityImpl(isdnAdd);
      byte[] visitedGmlcAddress = new BigInteger("112233445500", 16).toByteArray();
      GSNAddress vGmlcAddress = new GSNAddressImpl(visitedGmlcAddress);
      byte[] homeGmlcAddress = new BigInteger("11223344556677", 16).toByteArray();
      GSNAddress hGmlcAddress = new GSNAddressImpl(homeGmlcAddress);
      byte[] pivacyProfileRegisterAddress = new BigInteger("112233445566", 16).toByteArray();
      GSNAddress pprAddress = new GSNAddressImpl(pivacyProfileRegisterAddress);
      byte[] addVGmlcAddress = new BigInteger("8122334455", 16).toByteArray();
      GSNAddress additionalVGmlcAddress = new GSNAddressImpl(addVGmlcAddress);

      LCSLocationInfo lcsLocationInfo = mapFactory.createLCSLocationInfo(mscNumber, lmsi, mapExtensionContainer, gprsNodeIndicator,
          additionalNumber, supportedLCSCapabilitySets, additionalLCSCapabilitySets, mmeName, aaaServerName);
//            addSendRoutingInfoForLCSResponse(long invokeId, SubscriberIdentity targetMS, LCSLocationInfo lcsLocationInfo,
//                                             MAPExtensionContainer extensionContainer,
//                                            byte[] vgmlcAddress, byte[] hGmlcAddress, byte[] pprAddress, byte[] additionalVGmlcAddress)
      mapDialogLsm.addSendRoutingInfoForLCSResponse(invokeId, msisdn, lcsLocationInfo, mapExtensionContainer, vGmlcAddress, hGmlcAddress,
          pprAddress, additionalVGmlcAddress);
      // This will initiate the TC-BEGIN with INVOKE component
      mapDialogLsm.close(false);

    } catch (MAPException mapException) {
      logger.error("MAP Exception while processing onSendRoutingInfoForLCSRequest ", mapException);
    } catch (Exception e) {
      logger.error("Exception while processing onSendRoutingInfoForLCSRequest ", e);
    }
  }
 
Example #15
Source File: Server.java    From gmlc with GNU Affero General Public License v3.0 4 votes vote down vote up
@Override
public void onAnyTimeInterrogationRequest(AnyTimeInterrogationRequest atiReq) {

  if (logger.isDebugEnabled()) {
    logger.debug(
        String.format("onAnyTimeInterrogationRequest for DialogId=%d", atiReq.getMAPDialog().getLocalDialogId()));
  }
  if (logger.isInfoEnabled()) {
    logger.info(String.format("onAnyTimeInterrogationRequest for DialogId=%d", atiReq.getMAPDialog().getLocalDialogId()));
  } /*else {
          logger.warn(String.format("onAnyTimeInterrogationRequest for DialogId=%d", atiReq.getMAPDialog().getLocalDialogId()));
      }*/

  try {
    long invokeId = atiReq.getInvokeId();
    MAPDialogMobility mapDialogMobility = atiReq.getMAPDialog();
    mapDialogMobility.setUserObject(invokeId);

    MAPParameterFactoryImpl mapFactory = new MAPParameterFactoryImpl();

    // Create Subscriber Information parameters including Location Information and Subscriber State
    // for concerning MAP operation
    int mcc, mnc, lac, cellIdOrServiceAreaCode;
    mcc = 748;
    mnc = 1;
    lac = 23;
    cellIdOrServiceAreaCode = 369;
    CellGlobalIdOrServiceAreaIdFixedLength cellGlobalIdOrServiceAreaIdFixedLength = mapFactory
        .createCellGlobalIdOrServiceAreaIdFixedLength(mcc, mnc, lac, cellIdOrServiceAreaCode);
    CellGlobalIdOrServiceAreaIdOrLAI cellGlobalIdOrServiceAreaIdOrLAI = mapFactory
        .createCellGlobalIdOrServiceAreaIdOrLAI(cellGlobalIdOrServiceAreaIdFixedLength);
    ISDNAddressString vlrNumber = new ISDNAddressStringImpl(AddressNature.international_number,
        org.mobicents.protocols.ss7.map.api.primitives.NumberingPlan.ISDN, "5982123007");
    ISDNAddressString mscNumber = new ISDNAddressStringImpl(AddressNature.international_number,
        org.mobicents.protocols.ss7.map.api.primitives.NumberingPlan.ISDN, "5982123007");
    Integer ageOfLocationInformation = 0; // ageOfLocationInformation
    GeographicalInformation geographicalInformation = null;
    LocationNumberMap locationNumber = null;
    MAPExtensionContainer mapExtensionContainer = null;
    LSAIdentity selectedLSAId = null;
    GeodeticInformation geodeticInformation = null;
    boolean currentLocationRetrieved = false;
    boolean saiPresent = false;
    LocationInformationEPS locationInformationEPS = null;
    UserCSGInformation userCSGInformation = null;
    LocationInformationGPRS locationInformationGPRS = null;
    PSSubscriberState psSubscriberState = null;
    IMEI imei = null;
    MSClassmark2 msClassmark2 = null;
    GPRSMSClass gprsMSClass = null;
    MNPInfoRes mnpInfoRes = null;
    SubscriberStateChoice subscriberStateChoice = SubscriberStateChoice.assumedIdle;
    // 0=assumedIdle, 1=camelBusy, 2=notProvidedFromVLR
    NotReachableReason notReachableReason = null;

    LocationInformation locationInformation = mapFactory.createLocationInformation(ageOfLocationInformation,
        geographicalInformation, vlrNumber, locationNumber, cellGlobalIdOrServiceAreaIdOrLAI, mapExtensionContainer,
        selectedLSAId, mscNumber, geodeticInformation, currentLocationRetrieved, saiPresent, locationInformationEPS,
        userCSGInformation);

    SubscriberState subscriberState = mapFactory.createSubscriberState(subscriberStateChoice, notReachableReason);

    SubscriberInfo subscriberInfo = mapFactory.createSubscriberInfo(locationInformation, subscriberState,
        mapExtensionContainer, locationInformationGPRS, psSubscriberState, imei, msClassmark2, gprsMSClass,
        mnpInfoRes);

    mapDialogMobility.addAnyTimeInterrogationResponse(invokeId, subscriberInfo, mapExtensionContainer);

    // This will initiate the TC-BEGIN with INVOKE component
    mapDialogMobility.close(false);

  } catch (MAPException mapException) {
    logger.error("MAP Exception while processing AnyTimeInterrogationRequest ", mapException);
  } catch (Exception e) {
    logger.error("Exception while processing AnyTimeInterrogationRequest ", e);
  }

}
 
Example #16
Source File: StoreActivity.java    From android-silent-ping-sms with GNU General Public License v3.0 4 votes vote down vote up
/**
 * Notes: PDU will always be SMS
 */
public ArrayList<String> parseSmsPDUs(String[] PDUs) {
    ArrayList<String> parsedPDUs = new ArrayList<>();
    int counter = 0;

    for (String PDU : PDUs) {
        if (PDU == null || PDU.isEmpty()) {
            continue;
        }

        StringBuilder sb = new StringBuilder();

        ApplicationPortAddressing16BitAddress smsPort = null;
        SmsTpduImpl smsTpdu = null;

        try {
            // PDU should always be SMS-DELIVER prefixed by SMSC info (SCA - Service Centre Address)
            byte[] pduWithSCA = pduHexToByteArray(PDU);
            // Cut off the SCA
            byte[] smsPdu = Arrays.copyOfRange(pduWithSCA, pduWithSCA[0] + 1, pduWithSCA.length);

            smsTpdu = SmsTpduImpl.createInstance(smsPdu, false, null);
            switch (smsTpdu.getSmsTpduType()) {
                case SMS_DELIVER:
                    ((SmsDeliverTpduImpl) smsTpdu).getUserData().decode();

                    // see https://github.com/RestComm/jss7/issues/275
                    byte[] dtr = ((SmsDeliverTpduImpl) smsTpdu).getUserData().getDecodedUserDataHeader().getAllData().get(5);
                    smsPort = new ApplicationPortAddressing16BitAddressImpl(dtr);
                    break;
            }
        } catch (MAPException | IllegalArgumentException | ArrayIndexOutOfBoundsException e) {
            // ignore the exceptions
            e.printStackTrace();
        }

        SmsMessage sms = SmsMessage.createFromPdu(pduHexToByteArray(PDU));
        //sb.append("Raw PDU (hex): ").append(PDU);
        sb.append("Date/Time: ").append(sdf.format(sms.getTimestampMillis()));
        sb.append("\nSMSC: ").append(formatNumber(sms.getServiceCenterAddress()));
        sb.append("\nFrom: ").append(formatNumber(sms.getOriginatingAddress()));
        sb.append("\nFrom (display): ").append(sms.getDisplayOriginatingAddress());
        sb.append("\nFrom port: ").append(smsPort == null ? "N/A" : smsPort.getOriginatorPort());
        sb.append("\nTo port: ").append(smsPort == null ? "N/A" : smsPort.getDestinationPort());
        sb.append("\nData (hex): ");

        for (byte b : sms.getUserData()) {
            sb.append(String.format("%02x", b));
        }

        if (smsTpdu != null) {
            sb.append("\n\nAll info\n\n").append(smsTpdu);
        }

        //sb.append("\nUser Data (ascii):");
        //sb.append(new String(sms.getUserData()));

        parsedPDUs.add(sb.toString());
        parsedPDUs.add(PDU);
        parsedPDUs.add("Message #" + counter);
        counter++;
    }

    Collections.reverse(parsedPDUs);
    return parsedPDUs;
}
 
Example #17
Source File: SendRoutingInfoForGPRS.java    From SigPloit with MIT License 4 votes vote down vote up
@Override
public MAPDialogPdpContextActivation createNewDialog(MAPApplicationContext mapApplicationContext, SccpAddress sccpAddress, AddressString addressString, SccpAddress sccpAddress1, AddressString addressString1) throws MAPException {
    return null;
}
 
Example #18
Source File: SendRoutingInfoForGPRS.java    From SigPloit with MIT License 4 votes vote down vote up
@Override
public MAPDialogPdpContextActivation createNewDialog(MAPApplicationContext mapApplicationContext, SccpAddress sccpAddress, AddressString addressString, SccpAddress sccpAddress1, AddressString addressString1, Long aLong) throws MAPException {
    return null;
}
 
Example #19
Source File: SriSMResp.java    From SigPloit with MIT License 4 votes vote down vote up
@Override
public void onSendRoutingInfoForSMRequest(SendRoutingInfoForSMRequest sendRoutingInfoForSMRequest) {
    try {
        long invokeId = sendRoutingInfoForSMRequest.getInvokeId();

 //Add the MSC number that is serving the user
        ISDNAddressString msc = this.mapProvider.getMAPParameterFactory().createISDNAddressString
            (AddressNature.international_number, NumberingPlan.ISDN,"201111111111");

 //Add the IMSI of the subscriber that is queried 
        IMSI imsi = this.mapProvider.getMAPParameterFactory().createIMSI("602031234567890");
        LMSI lmsi = this.mapProvider.getMAPParameterFactory().createLMSI(new byte[]{(byte)0x65,(byte)0x10,(byte)0xf2,(byte)0x29});
        LocationInfoWithLMSI Location = this.mapProvider.getMAPParameterFactory().createLocationInfoWithLMSI
            (msc, lmsi, null, false, null);

        GlobalTitle0100 GtHlr = this.sccpProvider.getParameterFactory().createGlobalTitle(
                "201179008244",0, org.mobicents.protocols.ss7.indicator.NumberingPlan.ISDN_TELEPHONY,null,
                NatureOfAddress.INTERNATIONAL);

        GlobalTitle0100 GtSMSC = this.sccpProvider.getParameterFactory().
                createGlobalTitle("441357924680",0,
                        org.mobicents.protocols.ss7.indicator.NumberingPlan.ISDN_TELEPHONY,null,NatureOfAddress.INTERNATIONAL);

        SccpAddress callingParty = this.sccpStack.getSccpProvider().getParameterFactory().
                createSccpAddress(RoutingIndicator.ROUTING_BASED_ON_GLOBAL_TITLE,GtHlr,SERVER_SPC,SSN_Server);
        SccpAddress calledParty = this.sccpStack.getSccpProvider().getParameterFactory()
                .createSccpAddress(RoutingIndicator.ROUTING_BASED_ON_GLOBAL_TITLE,GtSMSC,CLIENT_SPC,SSN_Client);

        /*MAPDialogSms dialogSms = this.mapProvider.getMAPServiceSms().createNewDialog
                (MAPApplicationContext.getInstance(MAPApplicationContextName.shortMsgGatewayContext,
                        MAPApplicationContextVersion.version3),callingParty,null,calledParty,null);*/
        MAPDialogSms dialogSms = sendRoutingInfoForSMRequest.getMAPDialog();

        dialogSms.setUserObject(invokeId);

        dialogSms.addSendRoutingInfoForSMResponse(invokeId,imsi,Location,null, false);
        dialogSms.send();

        logger.info("IMSI and MSC GT Address Sent.....");

    } catch (MAPException e) {
        e.printStackTrace();
    }
}
 
Example #20
Source File: SS7Honeypot.java    From SigFW with GNU Affero General Public License v3.0 4 votes vote down vote up
public void onProvideSubscriberInfoRequest(ProvideSubscriberInfoRequest psir) {
    logger.debug("[[[[[[[[[[    onProvideSubscriberInfoRequest      ]]]]]]]]]]");
    
    try {
        
        MAPDialogMobility curDialog = psir.getMAPDialog();
        long invokeId = curDialog.getLocalDialogId();
        
        ISDNAddressString vlrNumber = mapProvider.getMAPParameterFactory().createISDNAddressString(AddressNature.international_number, NumberingPlan.ISDN, "5555555666");
        LocationNumberMap locationNumber = null;
        LSAIdentity selectedLSAId = null;
        ISDNAddressString mscNumber = null;
        LocationInformationEPS locationInformationEPS = null;
        UserCSGInformation userCSGInformation = null;

        int mcc = HP_MCC;
        int mnc = HP_MNC;
        int lac = HP_LAC;
        int cellId = HP_CELLID;
        int ageOfLocationInformation = HP_AGE_OF_LOCATION;
        GeographicalInformation geographicalInformation = mapProvider.getMAPParameterFactory().createGeographicalInformation(HP_GEO_INFO_d, HP_GEO_INFO_d1, HP_GEO_INFO_d2);
        boolean saiPresent = false;
        GeodeticInformation geodeticInformation = null;
        boolean currentLocationRetrieved = false;
        
        CellGlobalIdOrServiceAreaIdFixedLength cellGlobalIdOrServiceAreaIdFixedLength = mapProvider.getMAPParameterFactory()
                .createCellGlobalIdOrServiceAreaIdFixedLength(mcc, mnc, lac, cellId);
        CellGlobalIdOrServiceAreaIdOrLAI cellGlobalIdOrServiceAreaIdOrLAI = mapProvider.getMAPParameterFactory().createCellGlobalIdOrServiceAreaIdOrLAI(
                cellGlobalIdOrServiceAreaIdFixedLength);
        LocationInformation li = mapProvider.getMAPParameterFactory().createLocationInformation(ageOfLocationInformation, geographicalInformation,
                vlrNumber, locationNumber, cellGlobalIdOrServiceAreaIdOrLAI, null, selectedLSAId, mscNumber, geodeticInformation,
                currentLocationRetrieved, saiPresent, locationInformationEPS, userCSGInformation);

        SubscriberState ss = this.mapProvider.getMAPParameterFactory().createSubscriberState(SubscriberStateChoice.netDetNotReachable, NotReachableReason.imsiDetached);
        
        SubscriberInfo si = this.mapProvider.getMAPParameterFactory().createSubscriberInfo(li, ss, null, null, null, null, null, null, null);
        
        // clamp InvokeID
        if (invokeId > 127) { invokeId = 127; }
        if (invokeId < -128) { invokeId = -128; }
        
        curDialog.addProvideSubscriberInfoResponse(invokeId, si, null);          
        
    } catch (MAPException e) {
        logger.error("Error while sending SendRoutingInfoForSMResponse ", e);
    }
}
 
Example #21
Source File: SS7Honeypot.java    From SigFW with GNU Affero General Public License v3.0 4 votes vote down vote up
public void onAnyTimeInterrogationRequest(AnyTimeInterrogationRequest atir) {
    logger.debug("[[[[[[[[[[    onAnyTimeInterrogationRequest      ]]]]]]]]]]");
    
    try {
        
        MAPDialogMobility curDialog = atir.getMAPDialog();
        long invokeId = curDialog.getLocalDialogId();
        
        ISDNAddressString vlrNumber = mapProvider.getMAPParameterFactory().createISDNAddressString(AddressNature.international_number, NumberingPlan.ISDN, HP_VLR_NUMBER);
        LocationNumberMap locationNumber = null;
        LSAIdentity selectedLSAId = null;
        ISDNAddressString mscNumber = null;
        LocationInformationEPS locationInformationEPS = null;
        UserCSGInformation userCSGInformation = null;

        int mcc = HP_MCC;
        int mnc = HP_MNC;
        int lac = HP_LAC;
        int cellId = HP_CELLID;
        int ageOfLocationInformation = HP_AGE_OF_LOCATION;
        GeographicalInformation geographicalInformation = mapProvider.getMAPParameterFactory().createGeographicalInformation(HP_GEO_INFO_d, HP_GEO_INFO_d1, HP_GEO_INFO_d2);
        boolean saiPresent = false;
        GeodeticInformation geodeticInformation = null;
        boolean currentLocationRetrieved = false;
        
        CellGlobalIdOrServiceAreaIdFixedLength cellGlobalIdOrServiceAreaIdFixedLength = mapProvider.getMAPParameterFactory()
                .createCellGlobalIdOrServiceAreaIdFixedLength(mcc, mnc, lac, cellId);
        CellGlobalIdOrServiceAreaIdOrLAI cellGlobalIdOrServiceAreaIdOrLAI = mapProvider.getMAPParameterFactory().createCellGlobalIdOrServiceAreaIdOrLAI(
                cellGlobalIdOrServiceAreaIdFixedLength);
        LocationInformation li = mapProvider.getMAPParameterFactory().createLocationInformation(ageOfLocationInformation, geographicalInformation,
                vlrNumber, locationNumber, cellGlobalIdOrServiceAreaIdOrLAI, null, selectedLSAId, mscNumber, geodeticInformation,
                currentLocationRetrieved, saiPresent, locationInformationEPS, userCSGInformation);

        SubscriberState ss = this.mapProvider.getMAPParameterFactory().createSubscriberState(SubscriberStateChoice.netDetNotReachable, NotReachableReason.imsiDetached);
        
        SubscriberInfo si = this.mapProvider.getMAPParameterFactory().createSubscriberInfo(li, ss, null, null, null, null, null, null, null);
        
        // clamp InvokeID
        if (invokeId > 127) { invokeId = 127; }
        if (invokeId < -128) { invokeId = -128; }
        
        curDialog.addAnyTimeInterrogationResponse(invokeId, si, null);          
        
    } catch (MAPException e) {
        logger.error("Error while sending SendRoutingInfoForSMResponse ", e);
    }
}
 
Example #22
Source File: SendRoutingInfoForGPRS.java    From SigPloit with MIT License 3 votes vote down vote up
@Override
public void onSendRoutingInfoForGprsRequest(SendRoutingInfoForGprsRequest sendRoutingInfoForGprsRequest) {
    try {
        long invokeId = sendRoutingInfoForGprsRequest.getInvokeId();

        //Add the GGSN IPv4 number that is serving the user
        byte[] ggsn_ipv4 = {(byte) 10,16,1,24};
        byte[] sgsn_ipv4 = {(byte) 10,10,10,10};

        GSNAddress ggsn_ip = this.mapProvider.getMAPParameterFactory().createGSNAddress(GSNAddressAddressType.IPv4,
               ggsn_ipv4 );

        GSNAddress sgsn_ip = this.mapProvider.getMAPParameterFactory().createGSNAddress(GSNAddressAddressType.IPv4,
                sgsn_ipv4);


        MAPDialogPdpContextActivation dialogPdpContextActivation = sendRoutingInfoForGprsRequest.getMAPDialog();

        dialogPdpContextActivation.setUserObject(invokeId);

        dialogPdpContextActivation.addSendRoutingInfoForGprsResponse(invokeId,sgsn_ip,null,null,null);
        dialogPdpContextActivation.send();

        logger.info("SGSN and GGSN IPs are sent Sent.....");

    } catch (MAPException e) {
        e.printStackTrace();
    }

}