Search in sources :

Example 16 with SendRoutingInfoForSMRequest

use of org.restcomm.protocols.ss7.map.api.service.sms.SendRoutingInfoForSMRequest 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 17 with SendRoutingInfoForSMRequest

use of org.restcomm.protocols.ss7.map.api.service.sms.SendRoutingInfoForSMRequest 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)

Example 18 with SendRoutingInfoForSMRequest

use of org.restcomm.protocols.ss7.map.api.service.sms.SendRoutingInfoForSMRequest in project smscgateway by RestComm.

the class HrSriServerSbb method onSendRoutingInfoForSMRequest.

/**
 * MAP SMS Events
 */
/**
 * Received SRI request. But this is error, we should never receive this
 * request
 *
 * @param evt
 * @param aci
 */
public void onSendRoutingInfoForSMRequest(SendRoutingInfoForSMRequest evt, ActivityContextInterface aci) {
    if (this.logger.isInfoEnabled()) {
        this.logger.info("Home routing: HrSriServerSbb: Received SEND_ROUTING_INFO_FOR_SM_REQUEST = " + evt + " Dialog=" + evt.getMAPDialog());
    }
    this.setInvokeId(evt.getInvokeId());
    MAPDialogSms dialog = evt.getMAPDialog();
    // we are changing here SSN in CallingPartyAddress of a SRI response to HLR SSN
    // because it is possible that this address has been updated inside SCCP routing procedure
    // when a message came to SMSC
    // TODO: check if it is a proper solution ?
    SccpAddress locAddr = dialog.getLocalAddress();
    SccpAddress locAddr2 = sccpParameterFact.createSccpAddress(locAddr.getAddressIndicator().getRoutingIndicator(), locAddr.getGlobalTitle(), locAddr.getSignalingPointCode(), smscPropertiesManagement.getHlrSsn());
    dialog.setLocalAddress(locAddr2);
    if (smscPropertiesManagement.getHrCharging() == MoChargingType.reject) {
        try {
            MAPErrorMessage errorMessage = this.mapProvider.getMAPErrorMessageFactory().createMAPErrorMessageFacilityNotSup(null, null, null);
            dialog.sendErrorComponent(evt.getInvokeId(), errorMessage);
            if (this.logger.isInfoEnabled()) {
                this.logger.info("Home routing: Sent ErrorComponent = " + errorMessage);
            }
            if (smscPropertiesManagement.isGenerateRejectionCdr()) {
                generateCDR(dialog.getNetworkId(), CdrGenerator.CDR_SUBMIT_FAILED_HR, errorMessage.toString(), true);
            }
            dialog.close(false);
            return;
        } catch (Throwable e) {
            logger.severe("Home routing: Error while sending Error message", e);
            return;
        }
    }
    setupSriRequest(evt.getMsisdn(), evt.getServiceCentreAddress(), dialog.getNetworkId(), dialog.getRemoteAddress());
}
Also used : SccpAddress(org.restcomm.protocols.ss7.sccp.parameter.SccpAddress) MAPDialogSms(org.restcomm.protocols.ss7.map.api.service.sms.MAPDialogSms) MAPErrorMessage(org.restcomm.protocols.ss7.map.api.errors.MAPErrorMessage)

Example 19 with SendRoutingInfoForSMRequest

use of org.restcomm.protocols.ss7.map.api.service.sms.SendRoutingInfoForSMRequest in project smscgateway by RestComm.

the class MAPListener method onSendRoutingInfoForSMRequest.

@Override
public void onSendRoutingInfoForSMRequest(SendRoutingInfoForSMRequest event) {
    if (logger.isInfoEnabled()) {
        logger.info("Rx : SendRoutingInfoForSMRequestIndication=" + event);
    }
    IMSI imsi = new IMSIImpl("410035001692061");
    ISDNAddressString nnn = new ISDNAddressStringImpl(AddressNature.international_number, NumberingPlan.ISDN, "923330052001");
    LocationInfoWithLMSI li = new LocationInfoWithLMSIImpl(nnn, null, null, false, null);
    MAPDialogSms mapDialogSms = event.getMAPDialog();
    try {
        mapDialogSms.addSendRoutingInfoForSMResponse(event.getInvokeId(), imsi, li, null, null, null);
    // mapDialogSms.close(false);
    } catch (MAPException e) {
        e.printStackTrace();
    }
    mapDialogSms.setUserObject(true);
}
Also used : LocationInfoWithLMSI(org.restcomm.protocols.ss7.map.api.service.sms.LocationInfoWithLMSI) ISDNAddressStringImpl(org.restcomm.protocols.ss7.map.primitives.ISDNAddressStringImpl) IMSIImpl(org.restcomm.protocols.ss7.map.primitives.IMSIImpl) MAPDialogSms(org.restcomm.protocols.ss7.map.api.service.sms.MAPDialogSms) MAPException(org.restcomm.protocols.ss7.map.api.MAPException) IMSI(org.restcomm.protocols.ss7.map.api.primitives.IMSI) ISDNAddressString(org.restcomm.protocols.ss7.map.api.primitives.ISDNAddressString) LocationInfoWithLMSIImpl(org.restcomm.protocols.ss7.map.service.sms.LocationInfoWithLMSIImpl)

Aggregations

ISDNAddressString (org.restcomm.protocols.ss7.map.api.primitives.ISDNAddressString)16 ISDNAddressStringImpl (org.restcomm.protocols.ss7.map.primitives.ISDNAddressStringImpl)16 ArrayList (java.util.ArrayList)15 SmscPropertiesManagement (org.mobicents.smsc.domain.SmscPropertiesManagement)15 SmsSet (org.mobicents.smsc.library.SmsSet)15 MAPDialogSmsProxy (org.mobicents.smsc.slee.resources.persistence.MAPDialogSmsProxy)15 MAPTestEvent (org.mobicents.smsc.slee.resources.persistence.MAPDialogSmsProxy.MAPTestEvent)15 MAPServiceSmsProxy (org.mobicents.smsc.slee.resources.persistence.MAPServiceSmsProxy)15 SmsSetEvent (org.mobicents.smsc.slee.services.smpp.server.events.SmsSetEvent)15 Test (org.testng.annotations.Test)15 UUID (java.util.UUID)14 Sms (org.mobicents.smsc.library.Sms)14 SmsProxy (org.mobicents.smsc.slee.resources.persistence.SmsProxy)14 MAPApplicationContextVersion (org.restcomm.protocols.ss7.map.api.MAPApplicationContextVersion)14 AddressString (org.restcomm.protocols.ss7.map.api.primitives.AddressString)14 IMSI (org.restcomm.protocols.ss7.map.api.primitives.IMSI)14 LocationInfoWithLMSI (org.restcomm.protocols.ss7.map.api.service.sms.LocationInfoWithLMSI)14 SendRoutingInfoForSMRequest (org.restcomm.protocols.ss7.map.api.service.sms.SendRoutingInfoForSMRequest)14 IMSIImpl (org.restcomm.protocols.ss7.map.primitives.IMSIImpl)14 LocationInfoWithLMSIImpl (org.restcomm.protocols.ss7.map.service.sms.LocationInfoWithLMSIImpl)14