Search in sources :

Example 6 with AddressString

use of org.mobicents.protocols.ss7.map.api.primitives.AddressString in project smscgateway by RestComm.

the class MoSbbTest method testMo4_Gsm8.

@Test(groups = { "Mo" })
public void testMo4_Gsm8() throws Exception {
    if (!this.cassandraDbInited)
        return;
    // SmppSessionsProxy smppServerSessions = new SmppSessionsProxy();
    // this.sbb.setSmppServerSessions(smppServerSessions);
    AddressString serviceCentreAddressDA = new AddressStringImpl(AddressNature.international_number, NumberingPlan.ISDN, "1111");
    SM_RP_DA sm_RP_DA = new SM_RP_DAImpl(serviceCentreAddressDA);
    ISDNAddressString msisdn = new ISDNAddressStringImpl(AddressNature.international_number, NumberingPlan.ISDN, "4444");
    SM_RP_OAImpl sm_RP_OA = new SM_RP_OAImpl();
    sm_RP_OA.setMsisdn(msisdn);
    AddressField destinationAddress = new AddressFieldImpl(TypeOfNumber.InternationalNumber, NumberingPlanIdentification.ISDNTelephoneNumberingPlan, "5555");
    ProtocolIdentifier protocolIdentifier = new ProtocolIdentifierImpl(12);
    DataCodingScheme dataCodingScheme = new DataCodingSchemeImpl(4);
    UserDataHeader decodedUserDataHeader = new UserDataHeaderImpl();
    UserDataHeaderElement informationElement = new ConcatenatedShortMessagesIdentifierImpl(false, 55, 3, 1);
    decodedUserDataHeader.addInformationElement(informationElement);
    UserData userData = new UserDataImpl("abc 01234567890", dataCodingScheme, decodedUserDataHeader, isoCharset);
    SmsTpdu tpdu = new SmsSubmitTpduImpl(false, false, false, 150, destinationAddress, protocolIdentifier, null, userData);
    // isoCharset
    SmsSignalInfo sm_RP_UI_0 = new SmsSignalInfoImpl(tpdu, null);
    ForwardShortMessageRequestImpl event0 = new ForwardShortMessageRequestImpl(sm_RP_DA, sm_RP_OA, sm_RP_UI_0, false);
    AsnOutputStream aos = new AsnOutputStream();
    event0.encodeAll(aos);
    ForwardShortMessageRequestImpl event = new ForwardShortMessageRequestImpl();
    AsnInputStream ais = new AsnInputStream(aos.toByteArray());
    ais.readTag();
    event.decodeAll(ais);
    long dueSlot = this.pers.c2_getDueSlotForTime(new Date());
    PreparedStatementCollection psc = this.pers.getStatementCollection(new Date());
    int b1 = this.pers.checkSmsExists(dueSlot, ta1.getTargetId());
    long b2 = this.pers.c2_getDueSlotForTargetId(psc, ta1.getTargetId());
    assertEquals(b1, 0);
    assertEquals(b2, 0L);
    MAPProviderProxy proxy = new MAPProviderProxy();
    MAPDialogSmsProxy dialog = new MAPDialogSmsProxy(new MAPServiceSmsProxy(proxy), null, null, null);
    event.setMAPDialog(dialog);
    Date curDate = new Date();
    MAPApplicationContext act = MAPApplicationContext.getInstance(MAPApplicationContextName.shortMsgMORelayContext, MAPApplicationContextVersion.version2);
    dialog.setApplicationContext(act);
    this.sbb.onForwardShortMessageRequest(event, null);
    b2 = this.pers.c2_getDueSlotForTargetId(psc, ta1.getTargetId());
    dueSlot = b2;
    b1 = this.pers.checkSmsExists(dueSlot, ta1.getTargetId());
    assertEquals(b1, 1);
    assertEquals(b2, dueSlot);
    assertEquals(dialog.getResponseCount(), 1);
    assertEquals(dialog.getErrorList().size(), 0);
    SmsSet smsSet = this.pers.c2_getRecordListForTargeId(dueSlot, ta1.getTargetId());
    assertEquals(smsSet.getDestAddr(), "5555");
    assertEquals(smsSet.getDestAddrTon(), SmppConstants.TON_INTERNATIONAL);
    assertEquals(smsSet.getDestAddrNpi(), SmppConstants.NPI_E164);
    assertEquals(smsSet.getInSystem(), 0);
    assertEquals(smsSet.getDueDelay(), 0);
    assertNull(smsSet.getStatus());
    assertFalse(smsSet.isAlertingSupported());
    Sms sms = smsSet.getSms(0);
    assertNotNull(sms);
    assertEquals(sms.getSourceAddr(), "4444");
    assertEquals(sms.getSourceAddrTon(), SmppConstants.TON_INTERNATIONAL);
    assertEquals(sms.getSourceAddrNpi(), SmppConstants.NPI_E164);
    assertEquals(sms.getMessageId(), DBOperations.MESSAGE_ID_LAG + 1);
    assertEquals(sms.getMoMessageRef(), 150);
    assertEquals(sms.getDataCoding(), 4);
    assertNull(sms.getOrigEsmeName());
    assertNull(sms.getOrigSystemId());
    assertNull(sms.getServiceType());
    assertEquals(sms.getEsmClass() & 0xFF, 67);
    assertEquals(sms.getRegisteredDelivery(), 0);
    assertEquals(sms.getProtocolId(), 12);
    assertEquals(sms.getPriority(), 0);
    assertEquals(sms.getReplaceIfPresent(), 0);
    assertEquals(sms.getDefaultMsgId(), 0);
    assertEquals(sms.getTlvSet().getOptionalParameterCount(), 0);
    assertNull(sms.getScheduleDeliveryTime());
    assertDateEq(sms.getValidityPeriod(), MessageUtil.addHours(curDate, 24 * 3));
    assertEquals(sms.getDeliveryCount(), 0);
    assertEquals(sms.getShortMessageText(), "abc 01234567890");
    assertEquals(sms.getShortMessageBin(), decodedUserDataHeader.getEncodedData());
}
Also used : DataCodingScheme(org.restcomm.protocols.ss7.map.api.smstpdu.DataCodingScheme) UserDataHeaderImpl(org.restcomm.protocols.ss7.map.smstpdu.UserDataHeaderImpl) AsnInputStream(org.mobicents.protocols.asn.AsnInputStream) MAPServiceSmsProxy(org.mobicents.smsc.slee.resources.persistence.MAPServiceSmsProxy) ISDNAddressString(org.restcomm.protocols.ss7.map.api.primitives.ISDNAddressString) AddressString(org.restcomm.protocols.ss7.map.api.primitives.AddressString) UserData(org.restcomm.protocols.ss7.map.api.smstpdu.UserData) SmsTpdu(org.restcomm.protocols.ss7.map.api.smstpdu.SmsTpdu) ISDNAddressString(org.restcomm.protocols.ss7.map.api.primitives.ISDNAddressString) SmsSignalInfoImpl(org.restcomm.protocols.ss7.map.service.sms.SmsSignalInfoImpl) DataCodingSchemeImpl(org.restcomm.protocols.ss7.map.smstpdu.DataCodingSchemeImpl) ProtocolIdentifierImpl(org.restcomm.protocols.ss7.map.smstpdu.ProtocolIdentifierImpl) SmsSignalInfo(org.restcomm.protocols.ss7.map.api.service.sms.SmsSignalInfo) UserDataHeaderElement(org.restcomm.protocols.ss7.map.api.smstpdu.UserDataHeaderElement) UserDataImpl(org.restcomm.protocols.ss7.map.smstpdu.UserDataImpl) MAPProviderProxy(org.mobicents.smsc.slee.resources.persistence.MAPProviderProxy) ProtocolIdentifier(org.restcomm.protocols.ss7.map.api.smstpdu.ProtocolIdentifier) UserDataHeader(org.restcomm.protocols.ss7.map.api.smstpdu.UserDataHeader) ISDNAddressStringImpl(org.restcomm.protocols.ss7.map.primitives.ISDNAddressStringImpl) AddressStringImpl(org.restcomm.protocols.ss7.map.primitives.AddressStringImpl) AddressField(org.restcomm.protocols.ss7.map.api.smstpdu.AddressField) ConcatenatedShortMessagesIdentifierImpl(org.restcomm.protocols.ss7.map.smstpdu.ConcatenatedShortMessagesIdentifierImpl) ForwardShortMessageRequestImpl(org.restcomm.protocols.ss7.map.service.sms.ForwardShortMessageRequestImpl) MoForwardShortMessageRequestImpl(org.restcomm.protocols.ss7.map.service.sms.MoForwardShortMessageRequestImpl) SM_RP_DAImpl(org.restcomm.protocols.ss7.map.service.sms.SM_RP_DAImpl) AddressFieldImpl(org.restcomm.protocols.ss7.map.smstpdu.AddressFieldImpl) SM_RP_OAImpl(org.restcomm.protocols.ss7.map.service.sms.SM_RP_OAImpl) Date(java.util.Date) PreparedStatementCollection(org.mobicents.smsc.cassandra.PreparedStatementCollection) MAPDialogSmsProxy(org.mobicents.smsc.slee.resources.persistence.MAPDialogSmsProxy) ISDNAddressStringImpl(org.restcomm.protocols.ss7.map.primitives.ISDNAddressStringImpl) AsnOutputStream(org.mobicents.protocols.asn.AsnOutputStream) Sms(org.mobicents.smsc.library.Sms) SM_RP_DA(org.restcomm.protocols.ss7.map.api.service.sms.SM_RP_DA) MAPApplicationContext(org.restcomm.protocols.ss7.map.api.MAPApplicationContext) SmsSet(org.mobicents.smsc.library.SmsSet) SmsSubmitTpduImpl(org.restcomm.protocols.ss7.map.smstpdu.SmsSubmitTpduImpl) Test(org.testng.annotations.Test)

Example 7 with AddressString

use of org.mobicents.protocols.ss7.map.api.primitives.AddressString in project smscgateway by RestComm.

the class MtTest method SuccessDeliveryUsimTest.

/**
 * MAP V3, 1 message, 1 segment, USim message
 */
@Test(groups = { "Mt" })
public void SuccessDeliveryUsimTest() throws Exception {
    if (!this.cassandraDbInited)
        return;
    MAPServiceSmsProxy serviceSri = (MAPServiceSmsProxy) this.sriSbb.mapProvider.getMAPServiceSms();
    MAPServiceSmsProxy serviceMt = (MAPServiceSmsProxy) this.mtSbb.mapProvider.getMAPServiceSms();
    MAPServiceSmsProxy serviceRsds = (MAPServiceSmsProxy) this.rsdsSbb.mapProvider.getMAPServiceSms();
    SmscPropertiesManagement smscPropertiesManagement = SmscPropertiesManagement.getInstance();
    MProcManagement.getInstance("Test");
    ArrayList<SmsDef> lst = new ArrayList<SmsDef>();
    SmsDef sd1 = new SmsDef();
    sd1.dataCodingScheme = 246;
    sd1.esmClass = 0x43;
    sd1.msg = "012345012345";
    sd1.msgUdh = new byte[] { 2, 112, 0 };
    lst.add(sd1);
    SmsSet smsSet = prepareDatabase(lst);
    // SmsSet smsSetX = SmsSetCache.getInstance().getProcessingSmsSet(smsSet.getTargetId());
    // assertNotNull(smsSetX);
    // Sms smsX = this.pers.obtainLiveSms(procDueSlot, procTargetId, procId[0]);
    // assertEquals(smsX.getSmsSet().getInSystem(), 0);
    // initial onSms message
    SmsSetEvent event = new SmsSetEvent();
    event.setSmsSet(smsSet);
    this.sriSbb.onSms(event, null, null);
    MAPDialogSmsProxy dlg = serviceSri.getLastMAPDialogSms();
    // MAPApplicationContextVersion acv =  dlg.getApplicationContext().getApplicationContextVersion();
    // assertEquals(acv, MAPApplicationContextVersion.version3);
    // assertNull(serviceMt.getLastMAPDialogSms());
    // ArrayList<MAPTestEvent> lstEvt = dlg.getEventList();
    // assertEquals(lstEvt.size(), 2);
    // assertEquals(dlg.getLocalAddress().getGlobalTitle().getDigits(), smscPropertiesManagement.getServiceCenterGt());
    // assertEquals(((GlobalTitle0100) dlg.getLocalAddress().getGlobalTitle()).getNumberingPlan(), org.restcomm.protocols.ss7.indicator.NumberingPlan.ISDN_TELEPHONY);
    // assertEquals(((GlobalTitle0100) dlg.getLocalAddress().getGlobalTitle()).getNatureOfAddress(), NatureOfAddress.INTERNATIONAL);
    // assertEquals(dlg.getRemoteAddress().getGlobalTitle().getDigits(), msdnDig);
    // assertEquals(((GlobalTitle0100) dlg.getRemoteAddress().getGlobalTitle()).getNumberingPlan(), org.restcomm.protocols.ss7.indicator.NumberingPlan.ISDN_TELEPHONY);
    // assertEquals(((GlobalTitle0100) dlg.getRemoteAddress().getGlobalTitle()).getNatureOfAddress(), NatureOfAddress.INTERNATIONAL);
    // 
    // MAPTestEvent evt = lstEvt.get(0);
    // assertEquals(evt.testEventType, MAPTestEventType.componentAdded);
    // SendRoutingInfoForSMRequest sriReq = (SendRoutingInfoForSMRequest) evt.event;
    // assertEquals(sriReq.getMsisdn().getAddress(), msdnDig);
    // assertEquals(sriReq.getMsisdn().getAddressNature(), AddressNature.international_number);
    // assertEquals(sriReq.getMsisdn().getNumberingPlan(), org.restcomm.protocols.ss7.map.api.primitives.NumberingPlan.ISDN);
    // assertEquals(sriReq.getServiceCentreAddress().getAddress(), smscPropertiesManagement.getServiceCenterGt());
    // assertEquals(sriReq.getServiceCentreAddress().getAddressNature(), AddressNature.international_number);
    // assertEquals(sriReq.getServiceCentreAddress().getNumberingPlan(), org.restcomm.protocols.ss7.map.api.primitives.NumberingPlan.ISDN);
    // assertTrue(sriReq.getSm_RP_PRI());
    // evt = lstEvt.get(1);
    // assertEquals(evt.testEventType, MAPTestEventType.send);
    // smsSetX = SmsSetCache.getInstance().getProcessingSmsSet(smsSet.getTargetId());
    // assertNotNull(smsSetX);
    // smsX = this.pers.obtainLiveSms(procDueSlot, procTargetId, procId[0]);
    // assertEquals(smsX.getSmsSet().getInSystem(), 0);
    // SRI response
    IMSI imsi = new IMSIImpl(imsiDig);
    ISDNAddressString networkNodeNumber = new ISDNAddressStringImpl(AddressNature.international_number, org.restcomm.protocols.ss7.map.api.primitives.NumberingPlan.ISDN, nnnDig);
    LocationInfoWithLMSI locationInfoWithLMSI = new LocationInfoWithLMSIImpl(networkNodeNumber, null, null, false, null);
    SendRoutingInfoForSMResponse evt1 = new SendRoutingInfoForSMResponseImpl(imsi, locationInfoWithLMSI, null, null, null);
    evt1.setMAPDialog(dlg);
    this.sriSbb.onSendRoutingInfoForSMResponse(evt1, null);
    this.sriSbb.onDialogDelimiter(null, null);
    dlg = serviceMt.getLastMAPDialogSms();
    // acv =  dlg.getApplicationContext().getApplicationContextVersion();
    // assertEquals(acv, MAPApplicationContextVersion.version3);
    // 
    // lstEvt = dlg.getEventList();
    // assertEquals(lstEvt.size(), 2);
    dlg = serviceMt.getLastMAPDialogSms();
    ArrayList<MAPTestEvent> lstEvt = dlg.getEventList();
    assertEquals(lstEvt.size(), 2);
    MAPTestEvent evt = lstEvt.get(0);
    assertEquals(evt.testEventType, MAPTestEventType.componentAdded);
    MtForwardShortMessageRequestImpl mtFsmReq = (MtForwardShortMessageRequestImpl) evt.event;
    assertFalse(mtFsmReq.getMoreMessagesToSend());
    SM_RP_DA sm_RP_DA = mtFsmReq.getSM_RP_DA();
    IMSI daImsi = sm_RP_DA.getIMSI();
    assertEquals(daImsi.getData(), imsiDig);
    SM_RP_OA sm_RP_OA = mtFsmReq.getSM_RP_OA();
    AddressString scas = sm_RP_OA.getServiceCentreAddressOA();
    assertEquals(scas.getAddress(), smscPropertiesManagement.getServiceCenterGt());
    assertEquals(scas.getAddressNature(), AddressNature.international_number);
    assertEquals(scas.getNumberingPlan(), org.restcomm.protocols.ss7.map.api.primitives.NumberingPlan.ISDN);
    SmsSignalInfo ssi = mtFsmReq.getSM_RP_UI();
    SmsDeliverTpdu tpdu = (SmsDeliverTpdu) ssi.decodeTpdu(false);
// assertEquals(tpdu.getDataCodingScheme().getCode(), 16);
// assertFalse(tpdu.getForwardedOrSpawned());
// assertFalse(tpdu.getMoreMessagesToSend());
// assertEquals(tpdu.getOriginatingAddress().getAddressValue(), origDig);
// assertEquals(tpdu.getOriginatingAddress().getNumberingPlanIdentification(), NumberingPlanIdentification.ISDNTelephoneNumberingPlan);
// assertEquals(tpdu.getOriginatingAddress().getTypeOfNumber(), TypeOfNumber.InternationalNumber);
// assertEquals(tpdu.getProtocolIdentifier().getCode(), 7);
// assertFalse(tpdu.getReplyPathExists());
// assertEquals(tpdu.getServiceCentreTimeStamp().getDay(), curDate.getDate());
// int mon1 = tpdu.getServiceCentreTimeStamp().getMonth();
// int mon2 = curDate.getMonth() + 1;
// assertEquals(mon1, mon2);
// assertEquals(tpdu.getSmsTpduType(), SmsTpduType.SMS_DELIVER);
// assertFalse(tpdu.getStatusReportIndication());
// assertFalse(tpdu.getUserDataHeaderIndicator());
// UserData ud = tpdu.getUserData();
// ud.decode();
// assertNull(ud.getDecodedUserDataHeader());
// String msg1 = ud.getDecodedMessage();
// assertEquals(msg1, msgShort);
// 
// //        evt = lstEvt.get(1);
// //        assertEquals(evt.testEventType, MAPTestEventType.send);
// //        smsSetX = SmsSetCache.getInstance().getProcessingSmsSet(smsSet.getTargetId());
// //        assertNotNull(smsSetX);
// //        smsX = this.pers.obtainLiveSms(procDueSlot, procTargetId, procId[0]);
// //        assertEquals(smsX.getSmsSet().getInSystem(), 0);
// //
// //        UUID smsId = smsSet.getSms(0).getDbId();
// //        SmsProxy smsx2 = this.pers.obtainArchiveSms(procDueSlot, smsSet.getDestAddr(), smsId);
// //        assertNull(smsx2);
// 
// // Mt response
// MtForwardShortMessageResponseImpl evt2 = new MtForwardShortMessageResponseImpl(null, null);
// evt2.setMAPDialog(dlg);
// DialogAccept daevt = new DialogAccept(dlg, null);
// this.mtSbb.onDialogAccept(daevt, null);
// this.mtSbb.onMtForwardShortMessageResponse(evt2, null);
// DialogClose dcl = new DialogClose(dlg);
// this.mtSbb.onDialogClose(dcl, null);
// //        smsSetX = SmsSetCache.getInstance().getProcessingSmsSet(smsSet.getTargetId());
// //        assertNull(smsSetX);
// //        smsX = this.pers.obtainLiveSms(procDueSlot, procTargetId, procId[0]);
// //        assertNull(smsX);
// 
// //        dlg = serviceSri.getLastMAPDialogSms();
// //        lstEvt = dlg.getEventList();
// //        assertEquals(lstEvt.size(), 2);
// //
// //        dlg = serviceMt.getLastMAPDialogSms();
// //        lstEvt = dlg.getEventList();
// //        assertEquals(lstEvt.size(), 2);
// //
// //        int b1 = this.pers.checkSmsExists(procDueSlot, smsSet.getTargetId());
// //        smsx2 = this.pers.obtainArchiveSms(procDueSlot, smsSet.getDestAddr(), smsId);
// //        assertNotNull(smsx2);
// //
// //        dlg = serviceRsds.getLastMAPDialogSms();
// //        assertNull(dlg);
}
Also used : SmsDeliverTpdu(org.restcomm.protocols.ss7.map.api.smstpdu.SmsDeliverTpdu) LocationInfoWithLMSI(org.restcomm.protocols.ss7.map.api.service.sms.LocationInfoWithLMSI) MAPServiceSmsProxy(org.mobicents.smsc.slee.resources.persistence.MAPServiceSmsProxy) SmsSetEvent(org.mobicents.smsc.slee.services.smpp.server.events.SmsSetEvent) ISDNAddressString(org.restcomm.protocols.ss7.map.api.primitives.ISDNAddressString) AddressString(org.restcomm.protocols.ss7.map.api.primitives.AddressString) IMSIImpl(org.restcomm.protocols.ss7.map.primitives.IMSIImpl) ArrayList(java.util.ArrayList) ISDNAddressString(org.restcomm.protocols.ss7.map.api.primitives.ISDNAddressString) SM_RP_OA(org.restcomm.protocols.ss7.map.api.service.sms.SM_RP_OA) LocationInfoWithLMSIImpl(org.restcomm.protocols.ss7.map.service.sms.LocationInfoWithLMSIImpl) MAPTestEvent(org.mobicents.smsc.slee.resources.persistence.MAPDialogSmsProxy.MAPTestEvent) SendRoutingInfoForSMResponse(org.restcomm.protocols.ss7.map.api.service.sms.SendRoutingInfoForSMResponse) SendRoutingInfoForSMResponseImpl(org.restcomm.protocols.ss7.map.service.sms.SendRoutingInfoForSMResponseImpl) MAPDialogSmsProxy(org.mobicents.smsc.slee.resources.persistence.MAPDialogSmsProxy) SmsSignalInfo(org.restcomm.protocols.ss7.map.api.service.sms.SmsSignalInfo) ISDNAddressStringImpl(org.restcomm.protocols.ss7.map.primitives.ISDNAddressStringImpl) SmscPropertiesManagement(org.mobicents.smsc.domain.SmscPropertiesManagement) IMSI(org.restcomm.protocols.ss7.map.api.primitives.IMSI) MtForwardShortMessageRequestImpl(org.restcomm.protocols.ss7.map.service.sms.MtForwardShortMessageRequestImpl) SmsSet(org.mobicents.smsc.library.SmsSet) SM_RP_DA(org.restcomm.protocols.ss7.map.api.service.sms.SM_RP_DA) Test(org.testng.annotations.Test)

Example 8 with AddressString

use of org.mobicents.protocols.ss7.map.api.primitives.AddressString in project smscgateway by RestComm.

the class HrSriServerSbb method setupSriRequest.

private void setupSriRequest(ISDNAddressString msisdn, AddressString serviceCentreAddress, int networkId, SccpAddress originatorSccpAddress) {
    smscStatAggregator.updateMsgInHrSriReq();
    HrSriClientSbbLocalObject hrSriClientSbbLocalObject = this.getHrSriClientSbbLocalObject();
    if (hrSriClientSbbLocalObject != null) {
        String sca = msisdn.getAddress();
        NextCorrelationIdResult correlationIDRes = homeRoutingManagement.getNextCorrelationId(sca);
        if (correlationIDRes.getSmscAddress() != null && !correlationIDRes.getSmscAddress().equals(""))
            this.setSmscAddressForCountryCode(correlationIDRes.getSmscAddress());
        String correlationID = correlationIDRes.getCorrelationId();
        CorrelationIdValue correlationIdValue = new CorrelationIdValue(correlationID, msisdn, serviceCentreAddress, networkId, originatorSccpAddress);
        boolean sriBypass = smscPropertiesManagement.getHrSriBypass(networkId);
        if (sriBypass) {
            // bypass of SRI request to a local HLR - just sending of a response
            onSriSuccess(correlationIdValue, true);
        } else {
            // sending SRI request to a local HLR
            hrSriClientSbbLocalObject.setupSriRequest(correlationIdValue);
        }
        if (this.logger.isFineEnabled()) {
            StringBuilder sb = new StringBuilder();
            sb.append("Home routing: Created correlationId=");
            sb.append(correlationID);
            sb.append(" for received ServiceCentedAddress=");
            sb.append(sca);
            sb.append(" sriBypass: ");
            sb.append(sriBypass);
            this.logger.fine(sb.toString());
        }
    }
}
Also used : NextCorrelationIdResult(org.mobicents.smsc.domain.NextCorrelationIdResult) ISDNAddressString(org.restcomm.protocols.ss7.map.api.primitives.ISDNAddressString) AddressString(org.restcomm.protocols.ss7.map.api.primitives.AddressString)

Example 9 with AddressString

use of org.mobicents.protocols.ss7.map.api.primitives.AddressString in project smscgateway by RestComm.

the class MtSbb method setupMtForwardShortMessageRequest.

// *********
// Main service methods
public void setupMtForwardShortMessageRequest(ISDNAddressString networkNode, String imsiData, LMSI lmsi, int networkId) {
    if (this.logger.isFineEnabled()) {
        this.logger.fine("mperforming setupMtForwardShortMessageRequest ISDNAddressString= " + networkNode);
    }
    SmsSet smsSet = getSmsSet();
    if (smsSet == null) {
        markDeliveringIsEnded(true);
        logger.severe("MtSbb.setupMtForwardShortMessageRequest(): CMP smsSet is missed");
        return;
    }
    Sms sms0 = smsSet.getSms(0);
    Integer mtRemoteSccpTt = sms0.getMtRemoteSccpTt();
    SccpAddress networkNodeSccpAddress = this.getMSCSccpAddress(networkNode, mtRemoteSccpTt);
    IMSI imsi = this.mapParameterFactory.createIMSI(imsiData);
    SM_RP_DA sm_RP_DA = this.mapParameterFactory.createSM_RP_DA(imsi);
    AddressString scAddress = this.getServiceCenterAddressString(networkId);
    SM_RP_OA sm_RP_OA = this.mapParameterFactory.createSM_RP_OA_ServiceCentreAddressOA(scAddress);
    if (sms0 != null) {
        // we only set it for first sms in the list
        sms0.setMtServiceCenterAddress(scAddress.getAddress());
    }
    this.setNnn(networkNode);
    this.setNetworkNode(networkNodeSccpAddress);
    this.setSmRpDa(sm_RP_DA);
    this.setSmRpOa(sm_RP_OA);
    // Set cache with MAP version
    MAPApplicationContextVersion mapApplicationContextVersion = mapVersionCache.getMAPApplicationContextVersion(networkNode.getAddress());
    if (mapApplicationContextVersion == null) {
        mapApplicationContextVersion = MAPApplicationContextVersion.getInstance(smscPropertiesManagement.getMaxMapVersion());
    } else {
        this.setNegotiatedMapVersionUsing(true);
    }
    this.setMAPVersionTested(mapApplicationContextVersion);
    // dropaftersri mproc rules
    try {
        if (this.getTotalUnsentMessageCount() > 0) {
            ArrayList<Sms> lstPermFailured = new ArrayList<Sms>();
            ArrayList<Sms> lstRerouted = new ArrayList<Sms>();
            ArrayList<Integer> lstNewNetworkId = new ArrayList<Integer>();
            TargetAddress lock = persistence.obtainSynchroObject(new TargetAddress(smsSet));
            try {
                synchronized (lock) {
                    this.applyMprocRulesOnImsiResponse(smsSet, lstPermFailured, lstRerouted, lstNewNetworkId, networkNode, imsiData);
                    this.onImsiDrop(smsSet, lstPermFailured, lstRerouted, lstNewNetworkId, networkNode, imsiData);
                }
            } finally {
                persistence.releaseSynchroObject(lock);
            }
        }
    } catch (Throwable e) {
    }
    if (this.getTotalUnsentMessageCount() == 0) {
        setupReportSMDeliveryStatusRequestSuccess(smsSet, true);
        smsSet.setStatus(ErrorCode.SUCCESS);
        this.markDeliveringIsEnded(true);
    } else {
        try {
            this.sendMtSms(this.getMtFoSMSMAPApplicationContext(mapApplicationContextVersion), MessageProcessingState.firstMessageSending, null, smsSet.getNetworkId());
        } catch (SmscProcessingException e) {
            String reason = "SmscPocessingException when invoking sendMtSms() from setupMtForwardShortMessageRequest()-firstMessageSending: " + e.toString();
            this.logger.severe(reason, e);
            ErrorCode smStatus = ErrorCode.SC_SYSTEM_ERROR;
            try {
                smStatus = ErrorCode.fromInt(e.getSmppErrorCode());
            } catch (IllegalArgumentException e1) {
            }
            this.onDeliveryError(smsSet, ErrorAction.permanentFailure, smStatus, reason, true, null, false, ProcessingType.SS7_MT);
        } catch (Throwable e) {
            String reason = "Exception when invoking sendMtSms() from setupMtForwardShortMessageRequest()-firstMessageSending: " + e.toString();
            this.logger.severe(reason, e);
            ErrorCode smStatus = ErrorCode.SC_SYSTEM_ERROR;
            this.onDeliveryError(smsSet, ErrorAction.permanentFailure, smStatus, reason, true, null, false, ProcessingType.SS7_MT);
        }
    }
}
Also used : SccpAddress(org.restcomm.protocols.ss7.sccp.parameter.SccpAddress) ISDNAddressString(org.restcomm.protocols.ss7.map.api.primitives.ISDNAddressString) AddressString(org.restcomm.protocols.ss7.map.api.primitives.AddressString) SmscProcessingException(org.mobicents.smsc.library.SmscProcessingException) ArrayList(java.util.ArrayList) SM_RP_OA(org.restcomm.protocols.ss7.map.api.service.sms.SM_RP_OA) TargetAddress(org.mobicents.smsc.library.TargetAddress) ISDNAddressString(org.restcomm.protocols.ss7.map.api.primitives.ISDNAddressString) AddressString(org.restcomm.protocols.ss7.map.api.primitives.AddressString) MAPApplicationContextVersion(org.restcomm.protocols.ss7.map.api.MAPApplicationContextVersion) MAPDialogSms(org.restcomm.protocols.ss7.map.api.service.sms.MAPDialogSms) MAPErrorMessageSubscriberBusyForMtSms(org.restcomm.protocols.ss7.map.api.errors.MAPErrorMessageSubscriberBusyForMtSms) Sms(org.mobicents.smsc.library.Sms) IMSI(org.restcomm.protocols.ss7.map.api.primitives.IMSI) ErrorCode(org.mobicents.smsc.library.ErrorCode) MAPErrorCode(org.restcomm.protocols.ss7.map.api.errors.MAPErrorCode) SmsSet(org.mobicents.smsc.library.SmsSet) SM_RP_DA(org.restcomm.protocols.ss7.map.api.service.sms.SM_RP_DA)

Example 10 with AddressString

use of org.mobicents.protocols.ss7.map.api.primitives.AddressString in project smscgateway by RestComm.

the class SriSbb method setupRoutingInfoForSMRequestIndication.

private MAPDialogSms setupRoutingInfoForSMRequestIndication(String destinationAddress, int ton, int npi, MAPApplicationContext mapApplicationContext, int networkId, String newMtLocalSccpGt, Integer newMtRemoteSccpTt) throws MAPException {
    // this.mapParameterFactory.creat
    String hlrAddress = destinationAddress;
    String hrHlrNumber = smscPropertiesManagement.getHrHlrNumber(networkId);
    if (hrHlrNumber != null && hrHlrNumber.length() > 0) {
        hlrAddress = hrHlrNumber;
    }
    SccpAddress destinationAddr = this.convertAddressFieldToSCCPAddress(hlrAddress, ton, npi, newMtRemoteSccpTt);
    SccpAddress originSccpAddress;
    if (newMtLocalSccpGt != null) {
        originSccpAddress = this.getServiceCenterSccpAddress(newMtLocalSccpGt, networkId);
    } else {
        originSccpAddress = this.getServiceCenterSccpAddress(networkId);
    }
    MAPDialogSms mapDialogSms = this.mapProvider.getMAPServiceSms().createNewDialog(mapApplicationContext, originSccpAddress, null, destinationAddr, null);
    mapDialogSms.setNetworkId(networkId);
    ISDNAddressString isdn = this.getCalledPartyISDNAddressString(destinationAddress, ton, npi);
    AddressString serviceCenterAddress = this.getServiceCenterAddressString(networkId);
    boolean sm_RP_PRI = true;
    mapDialogSms.addSendRoutingInfoForSMRequest(isdn, sm_RP_PRI, serviceCenterAddress, null, false, null, null, null, false, null, false, false, null, null);
    if (this.logger.isInfoEnabled())
        this.logger.info("Sending: SendRoutingInfoForSMRequest: isdn=" + isdn + ", serviceCenterAddress=" + serviceCenterAddress + ", sm_RP_PRI=" + sm_RP_PRI);
    return mapDialogSms;
}
Also used : SccpAddress(org.restcomm.protocols.ss7.sccp.parameter.SccpAddress) ISDNAddressString(org.restcomm.protocols.ss7.map.api.primitives.ISDNAddressString) AddressString(org.restcomm.protocols.ss7.map.api.primitives.AddressString) MAPDialogSms(org.restcomm.protocols.ss7.map.api.service.sms.MAPDialogSms) ISDNAddressString(org.restcomm.protocols.ss7.map.api.primitives.ISDNAddressString) ISDNAddressString(org.restcomm.protocols.ss7.map.api.primitives.ISDNAddressString) AddressString(org.restcomm.protocols.ss7.map.api.primitives.AddressString)

Aggregations

AddressString (org.restcomm.protocols.ss7.map.api.primitives.AddressString)25 ISDNAddressString (org.restcomm.protocols.ss7.map.api.primitives.ISDNAddressString)25 SmsSet (org.mobicents.smsc.library.SmsSet)20 Test (org.testng.annotations.Test)20 Sms (org.mobicents.smsc.library.Sms)19 ISDNAddressStringImpl (org.restcomm.protocols.ss7.map.primitives.ISDNAddressStringImpl)19 MAPDialogSmsProxy (org.mobicents.smsc.slee.resources.persistence.MAPDialogSmsProxy)18 MAPServiceSmsProxy (org.mobicents.smsc.slee.resources.persistence.MAPServiceSmsProxy)18 SM_RP_DA (org.restcomm.protocols.ss7.map.api.service.sms.SM_RP_DA)18 SmsSignalInfo (org.restcomm.protocols.ss7.map.api.service.sms.SmsSignalInfo)17 UserData (org.restcomm.protocols.ss7.map.api.smstpdu.UserData)17 ArrayList (java.util.ArrayList)14 SmscPropertiesManagement (org.mobicents.smsc.domain.SmscPropertiesManagement)13 IMSI (org.restcomm.protocols.ss7.map.api.primitives.IMSI)13 LocationInfoWithLMSI (org.restcomm.protocols.ss7.map.api.service.sms.LocationInfoWithLMSI)13 SM_RP_OA (org.restcomm.protocols.ss7.map.api.service.sms.SM_RP_OA)13 MAPTestEvent (org.mobicents.smsc.slee.resources.persistence.MAPDialogSmsProxy.MAPTestEvent)12 SmsSetEvent (org.mobicents.smsc.slee.services.smpp.server.events.SmsSetEvent)12 MAPApplicationContextVersion (org.restcomm.protocols.ss7.map.api.MAPApplicationContextVersion)12 SendRoutingInfoForSMResponse (org.restcomm.protocols.ss7.map.api.service.sms.SendRoutingInfoForSMResponse)12