Search in sources :

Example 31 with ISDNAddressString

use of org.restcomm.protocols.ss7.map.api.primitives.ISDNAddressString in project smscgateway by RestComm.

the class MtTest method SuccessError4Test.

/**
 * MAP V3, Mt error no memory -> RSDS
 */
@Test(groups = { "Mt" })
public void SuccessError4Test() 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();
    lst.add(sd1);
    SmsSet smsSet = prepareDatabase(lst);
    Sms sms1 = smsSet.getSms(0);
    UUID smsId = sms1.getDbId();
    SmsProxy smsx1 = this.pers.obtainArchiveSms(procDueSlot, smsSet.getDestAddr(), smsId);
    assertNull(smsx1);
    SmsSet smsSetX = SmsSetCache.getInstance().getProcessingSmsSet(procTargetId);
    assertNotNull(smsSetX);
    Sms smsX = this.pers.obtainLiveSms(procDueSlot, procTargetId, procId[0]);
    assertEquals(smsX.getSmsSet().getInSystem(), 0);
    assertEquals(SmsSetCache.getInstance().getProcessingSmsSetSize(), 1);
    assertNull(smsSet.getStatus());
    assertEquals(smsSet.getInSystem(), 0);
    assertNull(smsSet.getInSystemDate());
    assertEquals(smsSet.getDueDelay(), 0);
    assertNull(smsSet.getDueDate());
    assertFalse(smsSet.isAlertingSupported());
    // 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);
    ArrayList<MAPTestEvent> lstEvt = dlg.getEventList();
    assertEquals(lstEvt.size(), 2);
    assertNull(serviceMt.getLastMAPDialogSms());
    lstEvt = dlg.getEventList();
    assertEquals(lstEvt.size(), 2);
    assertEquals(dlg.getLocalAddress().getGlobalTitle().getDigits(), smscPropertiesManagement.getServiceCenterGt());
    assertEquals(dlg.getRemoteAddress().getGlobalTitle().getDigits(), msdnDig);
    MAPTestEvent evt = lstEvt.get(0);
    assertEquals(evt.testEventType, MAPTestEventType.componentAdded);
    SendRoutingInfoForSMRequest sriReq = (SendRoutingInfoForSMRequest) evt.event;
    assertEquals(sriReq.getMsisdn().getAddress(), msdnDig);
    assertEquals(sriReq.getServiceCentreAddress().getAddress(), smscPropertiesManagement.getServiceCenterGt());
    evt = lstEvt.get(1);
    assertEquals(evt.testEventType, MAPTestEventType.send);
    assertNull(serviceRsds.getLastMAPDialogSms());
    // 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);
    smsx1 = this.pers.obtainArchiveSms(procDueSlot, smsSet.getDestAddr(), smsId);
    assertNull(smsx1);
    smsSetX = SmsSetCache.getInstance().getProcessingSmsSet(procTargetId);
    assertNotNull(smsSetX);
    smsX = this.pers.obtainLiveSms(procDueSlot, procTargetId, procId[0]);
    assertEquals(smsX.getSmsSet().getInSystem(), 0);
    assertEquals(SmsSetCache.getInstance().getProcessingSmsSetSize(), 1);
    dlg = serviceMt.getLastMAPDialogSms();
    lstEvt = dlg.getEventList();
    assertEquals(lstEvt.size(), 2);
    // MT response - error
    MAPErrorMessage mapErrorMessage = new MAPErrorMessageSMDeliveryFailureImpl(3, SMEnumeratedDeliveryFailureCause.memoryCapacityExceeded, null, null);
    ErrorComponent evt2 = new ErrorComponent(dlg, 0L, mapErrorMessage);
    this.mtSbb.onErrorComponent(evt2, null);
    this.mtSbb.onDialogDelimiter(null, null);
    PreparedStatementCollection[] pscc = this.pers.c2_getPscList();
    long l1 = 0;
    for (PreparedStatementCollection psc : pscc) {
        l1 = this.pers.c2_getDueSlotForTargetId(psc, procTargetId);
        if (l1 != 0)
            break;
    }
    smsx1 = this.pers.obtainArchiveSms(l1, smsSet.getDestAddr(), smsId);
    assertNull(smsx1);
    smsSetX = SmsSetCache.getInstance().getProcessingSmsSet(procTargetId);
    assertNull(smsSetX);
    smsX = this.pers.obtainLiveSms(l1, procTargetId, procId[0]);
    assertEquals(smsX.getSmsSet().getInSystem(), 0);
    assertEquals(SmsSetCache.getInstance().getProcessingSmsSetSize(), 0);
    assertEquals(smsSet.getStatus(), ErrorCode.MESSAGE_QUEUE_FULL);
    // assertEquals(smsSet.getInSystem(), 1);
    // this.testDateEq(smsSet.getInSystemDate(), curDate);
    assertEquals(smsSet.getDueDelay(), SmscPropertiesManagement.getInstance().getSecondDueDelay());
    this.testDateEq(new Date(new Date().getTime() + SmscPropertiesManagement.getInstance().getSecondDueDelay() * 1000), smsSet.getDueDate());
    assertFalse(smsSet.isAlertingSupported());
    SmsSet smsSet2 = smsX.getSmsSet();
    assertEquals(smsSet2.getStatus(), ErrorCode.MESSAGE_QUEUE_FULL);
    // assertEquals(smsSet2.getInSystem(), 1);
    // this.testDateEq(smsSet2.getInSystemDate(), curDate);
    assertEquals(smsSet2.getDueDelay(), SmscPropertiesManagement.getInstance().getSecondDueDelay());
    // this.testDateEq(new Date(new Date().getTime() + SmscPropertiesManagement.getInstance().getSecondDueDelay() * 1000), smsSet2.getDueDate());
    assertFalse(smsSet2.isAlertingSupported());
    dlg = serviceRsds.getLastMAPDialogSms();
    acv = dlg.getApplicationContext().getApplicationContextVersion();
    assertEquals(acv, MAPApplicationContextVersion.version3);
    assertEquals(dlg.getLocalAddress().getGlobalTitle().getDigits(), smscPropertiesManagement.getServiceCenterGt());
    assertEquals(dlg.getRemoteAddress().getGlobalTitle().getDigits(), msdnDig);
    lstEvt = dlg.getEventList();
    assertEquals(lstEvt.size(), 2);
    evt = lstEvt.get(0);
    assertEquals(evt.testEventType, MAPTestEventType.componentAdded);
    ReportSMDeliveryStatusRequestImpl rsdsReq = (ReportSMDeliveryStatusRequestImpl) evt.event;
    assertEquals(rsdsReq.getServiceCentreAddress().getAddress(), smscPropertiesManagement.getServiceCenterGt());
    assertEquals(rsdsReq.getMsisdn().getAddress(), msdnDig);
    assertEquals(rsdsReq.getSMDeliveryOutcome(), SMDeliveryOutcome.memoryCapacityExceeded);
    evt = lstEvt.get(1);
    assertEquals(evt.testEventType, MAPTestEventType.send);
    // rsds response 2
    ReportSMDeliveryStatusResponseImpl evt7 = new ReportSMDeliveryStatusResponseImpl(2, null, null);
    evt7.setMAPDialog(dlg);
    this.rsdsSbb.onReportSMDeliveryStatusResponse(evt7, null);
    DialogClose dcl = new DialogClose(dlg);
    this.rsdsSbb.onDialogClose(dcl, null);
// assertTrue(smsSet.isAlertingSupported());
}
Also used : SendRoutingInfoForSMRequest(org.restcomm.protocols.ss7.map.api.service.sms.SendRoutingInfoForSMRequest) 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) ReportSMDeliveryStatusResponseImpl(org.restcomm.protocols.ss7.map.service.sms.ReportSMDeliveryStatusResponseImpl) IMSIImpl(org.restcomm.protocols.ss7.map.primitives.IMSIImpl) ArrayList(java.util.ArrayList) ISDNAddressString(org.restcomm.protocols.ss7.map.api.primitives.ISDNAddressString) SendRoutingInfoForSMResponse(org.restcomm.protocols.ss7.map.api.service.sms.SendRoutingInfoForSMResponse) MAPApplicationContextVersion(org.restcomm.protocols.ss7.map.api.MAPApplicationContextVersion) SendRoutingInfoForSMResponseImpl(org.restcomm.protocols.ss7.map.service.sms.SendRoutingInfoForSMResponseImpl) SmsProxy(org.mobicents.smsc.slee.resources.persistence.SmsProxy) MAPServiceSmsProxy(org.mobicents.smsc.slee.resources.persistence.MAPServiceSmsProxy) MAPDialogSmsProxy(org.mobicents.smsc.slee.resources.persistence.MAPDialogSmsProxy) IMSI(org.restcomm.protocols.ss7.map.api.primitives.IMSI) UUID(java.util.UUID) LocationInfoWithLMSIImpl(org.restcomm.protocols.ss7.map.service.sms.LocationInfoWithLMSIImpl) MAPTestEvent(org.mobicents.smsc.slee.resources.persistence.MAPDialogSmsProxy.MAPTestEvent) PreparedStatementCollection(org.mobicents.smsc.cassandra.PreparedStatementCollection) Date(java.util.Date) ErrorComponent(org.restcomm.slee.resource.map.events.ErrorComponent) MAPDialogSmsProxy(org.mobicents.smsc.slee.resources.persistence.MAPDialogSmsProxy) ISDNAddressStringImpl(org.restcomm.protocols.ss7.map.primitives.ISDNAddressStringImpl) DialogClose(org.restcomm.slee.resource.map.events.DialogClose) SmscPropertiesManagement(org.mobicents.smsc.domain.SmscPropertiesManagement) Sms(org.mobicents.smsc.library.Sms) MAPErrorMessageSMDeliveryFailureImpl(org.restcomm.protocols.ss7.map.errors.MAPErrorMessageSMDeliveryFailureImpl) ReportSMDeliveryStatusRequestImpl(org.restcomm.protocols.ss7.map.service.sms.ReportSMDeliveryStatusRequestImpl) SmsSet(org.mobicents.smsc.library.SmsSet) MAPErrorMessage(org.restcomm.protocols.ss7.map.api.errors.MAPErrorMessage) Test(org.testng.annotations.Test)

Example 32 with ISDNAddressString

use of org.restcomm.protocols.ss7.map.api.primitives.ISDNAddressString in project smscgateway by RestComm.

the class MAPDialogSmsProxy method addReportSMDeliveryStatusRequest.

@Override
public Long addReportSMDeliveryStatusRequest(ISDNAddressString msisdn, AddressString serviceCentreAddress, SMDeliveryOutcome sMDeliveryOutcome, Integer absentSubscriberDiagnosticSM, MAPExtensionContainer extensionContainer, boolean gprsSupportIndicator, boolean deliveryOutcomeIndicator, SMDeliveryOutcome additionalSMDeliveryOutcome, Integer additionalAbsentSubscriberDiagnosticSM) throws MAPException {
    ReportSMDeliveryStatusRequestImpl msg = new ReportSMDeliveryStatusRequestImpl(this.getApplicationContext().getApplicationContextVersion().getVersion(), msisdn, serviceCentreAddress, sMDeliveryOutcome, absentSubscriberDiagnosticSM, extensionContainer, gprsSupportIndicator, deliveryOutcomeIndicator, additionalSMDeliveryOutcome, additionalAbsentSubscriberDiagnosticSM);
    this.eventList.add(new MAPTestEvent(MAPTestEventType.componentAdded, msg));
    return 0L;
}
Also used : ReportSMDeliveryStatusRequestImpl(org.restcomm.protocols.ss7.map.service.sms.ReportSMDeliveryStatusRequestImpl)

Example 33 with ISDNAddressString

use of org.restcomm.protocols.ss7.map.api.primitives.ISDNAddressString in project smscgateway by RestComm.

the class MAPDialogSmsProxy method addSendRoutingInfoForSMRequest.

@Override
public Long addSendRoutingInfoForSMRequest(ISDNAddressString msisdn, boolean sm_RP_PRI, AddressString serviceCentreAddress, MAPExtensionContainer extensionContainer, boolean gprsSupportIndicator, SM_RP_MTI sM_RP_MTI, SM_RP_SMEA sM_RP_SMEA, SMDeliveryNotIntended smDeliveryNotIntended, boolean ipSmGwGuidanceIndicator, IMSI imsi, boolean t4TriggerIndicator, boolean singleAttemptDelivery, TeleserviceCode teleservice, CorrelationID correlationID) throws MAPException {
    SendRoutingInfoForSMRequestImpl msg = new SendRoutingInfoForSMRequestImpl(msisdn, sm_RP_PRI, serviceCentreAddress, extensionContainer, gprsSupportIndicator, sM_RP_MTI, sM_RP_SMEA, smDeliveryNotIntended, singleAttemptDelivery, imsi, singleAttemptDelivery, singleAttemptDelivery, teleservice, correlationID);
    this.eventList.add(new MAPTestEvent(MAPTestEventType.componentAdded, msg));
    return 0L;
}
Also used : SendRoutingInfoForSMRequestImpl(org.restcomm.protocols.ss7.map.service.sms.SendRoutingInfoForSMRequestImpl)

Example 34 with ISDNAddressString

use of org.restcomm.protocols.ss7.map.api.primitives.ISDNAddressString in project smscgateway by RestComm.

the class AlertTest method testAlert1_Gsm1.

@Test(groups = { "Alert" })
public void testAlert1_Gsm1() throws Exception {
    if (!this.cassandraDbInited)
        return;
    this.prepareDatabase();
    SmsSet smsSetX = SmsSetCache.getInstance().getProcessingSmsSet(procTargetId);
    assertNull(smsSetX);
    Sms smsX = this.pers.obtainLiveSms(procDueSlot, procTargetId, procId);
    assertEquals(smsX.getSmsSet().getInSystem(), 0);
    // boolean b1 = this.pers.checkSmsSetExists(ta1);
    // assertTrue(b1);
    // SmsSet smsSet = this.pers.obtainSmsSet(ta1);
    // assertEquals(smsSet.getInSystem(), 1);
    // assertEquals(smsSet.getDueDate(), farDate);
    Thread.sleep(1000);
    Date curDate = new Date();
    ISDNAddressString msisdn = new ISDNAddressStringImpl(AddressNature.international_number, NumberingPlan.ISDN, "5555");
    AddressString serviceCentreAddress = new AddressStringImpl(AddressNature.international_number, NumberingPlan.ISDN, "1111");
    AlertServiceCentreRequest evt = new AlertServiceCentreRequestImpl(msisdn, serviceCentreAddress);
    MAPProviderProxy proxy = new MAPProviderProxy();
    MAPApplicationContext appCntx = MAPApplicationContext.getInstance(MAPApplicationContextName.shortMsgAlertContext, MAPApplicationContextVersion.version2);
    MAPDialogSmsProxy dialog = new MAPDialogSmsProxy(new MAPServiceSmsProxy(proxy), appCntx, null, null);
    evt.setMAPDialog(dialog);
    this.sbb.onAlertServiceCentreRequest(evt, null);
    smsSetX = SmsSetCache.getInstance().getProcessingSmsSet(procTargetId);
    // assertNotNull(smsSetX);  TODO: this will work after alert is with direct Activities sending
    smsX = this.pers.obtainLiveSms(procDueSlot, procTargetId, procId);
// assertNull(smsX);
// b1 = this.pers.checkSmsSetExists(ta1);
// assertTrue(b1);
// smsSet = this.pers.obtainSmsSet(ta1);
// assertEquals(smsSet.getInSystem(), 1);
// this.testDateEq(smsSet.getDueDate(), curDate);
}
Also used : AlertServiceCentreRequestImpl(org.restcomm.protocols.ss7.map.service.sms.AlertServiceCentreRequestImpl) 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) ISDNAddressString(org.restcomm.protocols.ss7.map.api.primitives.ISDNAddressString) Date(java.util.Date) MAPDialogSmsProxy(org.mobicents.smsc.slee.resources.persistence.MAPDialogSmsProxy) ISDNAddressStringImpl(org.restcomm.protocols.ss7.map.primitives.ISDNAddressStringImpl) MAPProviderProxy(org.mobicents.smsc.slee.resources.persistence.MAPProviderProxy) Sms(org.mobicents.smsc.library.Sms) AlertServiceCentreRequest(org.restcomm.protocols.ss7.map.api.service.sms.AlertServiceCentreRequest) SmsSet(org.mobicents.smsc.library.SmsSet) MAPApplicationContext(org.restcomm.protocols.ss7.map.api.MAPApplicationContext) AddressStringImpl(org.restcomm.protocols.ss7.map.primitives.AddressStringImpl) ISDNAddressStringImpl(org.restcomm.protocols.ss7.map.primitives.ISDNAddressStringImpl) Test(org.testng.annotations.Test)

Example 35 with ISDNAddressString

use of org.restcomm.protocols.ss7.map.api.primitives.ISDNAddressString in project smscgateway by RestComm.

the class HrSriClientSbb method setupRoutingInfoForSMRequestIndication.

private MAPDialogSms setupRoutingInfoForSMRequestIndication(String destinationAddress, int ton, int npi, MAPApplicationContext mapApplicationContext, int networkId) 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);
    MAPDialogSms mapDialogSms = this.mapProvider.getMAPServiceSms().createNewDialog(mapApplicationContext, this.getServiceCenterSccpAddress(networkId), 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("Home routing: HrSriClientSbb: 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

ISDNAddressString (org.restcomm.protocols.ss7.map.api.primitives.ISDNAddressString)33 AddressString (org.restcomm.protocols.ss7.map.api.primitives.AddressString)26 SmsSet (org.mobicents.smsc.library.SmsSet)25 Sms (org.mobicents.smsc.library.Sms)24 ISDNAddressStringImpl (org.restcomm.protocols.ss7.map.primitives.ISDNAddressStringImpl)24 Test (org.testng.annotations.Test)24 MAPDialogSmsProxy (org.mobicents.smsc.slee.resources.persistence.MAPDialogSmsProxy)22 MAPServiceSmsProxy (org.mobicents.smsc.slee.resources.persistence.MAPServiceSmsProxy)22 ArrayList (java.util.ArrayList)19 LocationInfoWithLMSI (org.restcomm.protocols.ss7.map.api.service.sms.LocationInfoWithLMSI)19 SM_RP_DA (org.restcomm.protocols.ss7.map.api.service.sms.SM_RP_DA)19 IMSI (org.restcomm.protocols.ss7.map.api.primitives.IMSI)18 SmsSignalInfo (org.restcomm.protocols.ss7.map.api.service.sms.SmsSignalInfo)18 SmscPropertiesManagement (org.mobicents.smsc.domain.SmscPropertiesManagement)17 IMSIImpl (org.restcomm.protocols.ss7.map.primitives.IMSIImpl)17 LocationInfoWithLMSIImpl (org.restcomm.protocols.ss7.map.service.sms.LocationInfoWithLMSIImpl)17 SmsSetEvent (org.mobicents.smsc.slee.services.smpp.server.events.SmsSetEvent)16 SendRoutingInfoForSMResponse (org.restcomm.protocols.ss7.map.api.service.sms.SendRoutingInfoForSMResponse)16 UserData (org.restcomm.protocols.ss7.map.api.smstpdu.UserData)16 SendRoutingInfoForSMResponseImpl (org.restcomm.protocols.ss7.map.service.sms.SendRoutingInfoForSMResponseImpl)16