Search in sources :

Example 36 with ISDNAddressString

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

the class SmsSetCacheTest method testSmppShellExecutor.

@Test(groups = { "SmsSet" })
public void testSmppShellExecutor() throws Exception {
    int correlationIdLiveTime = 2;
    int sriResponseLiveTime = 3;
    int deliveredMsgLiveTime = 3;
    SmsSetCache.start(correlationIdLiveTime, sriResponseLiveTime, deliveredMsgLiveTime);
    SmsSetCache ssc = SmsSetCache.getInstance();
    String remoteMessageId = "0000100001";
    String destId = "esme_33";
    Long messageId = 3000031L;
    String correlationID = "000000000011111";
    ISDNAddressString msisdn = new ISDNAddressStringImpl(AddressNature.international_number, NumberingPlan.ISDN, "11111111");
    AddressString serviceCentreAddress = new AddressStringImpl(AddressNature.international_number, NumberingPlan.ISDN, "22222222");
    CorrelationIdValue elem = new CorrelationIdValue(correlationID, msisdn, serviceCentreAddress, 0, null);
    ssc.putCorrelationIdCacheElement(elem, correlationIdLiveTime);
    Sms sms = new Sms();
    long mId = 222L;
    sms.setMessageId(mId);
    sms.setShortMessageText("textxxx");
    ssc.putDeliveredMsgValue(sms, deliveredMsgLiveTime);
    ssc.putDeliveredRemoteMsgIdValue(remoteMessageId, destId, messageId, deliveredMsgLiveTime);
    String targetID = "22222_1_1_2";
    LocationInfoWithLMSI locationInfoWithLMSI = null;
    SriResponseValue srv = new SriResponseValue(targetID, 2, "22222", 1, 1, locationInfoWithLMSI, "0000011111000000");
    ssc.putSriResponseValue(srv, sriResponseLiveTime);
    Thread.sleep(2500);
    CorrelationIdValue v1 = ssc.getCorrelationIdCacheElement(correlationID);
    assertNotNull(v1);
    SriResponseValue vv1 = ssc.getSriResponseValue(targetID);
    assertNotNull(vv1);
    Sms sms2 = ssc.getDeliveredMsgValue(mId);
    assertNotNull(sms2);
    Long msgId2 = ssc.getDeliveredRemoteMsgIdValue(remoteMessageId, destId);
    assertEquals((long) msgId2, (long) messageId);
    Thread.sleep(2500);
    CorrelationIdValue v2 = ssc.getCorrelationIdCacheElement(correlationID);
    assertNull(v2);
    SriResponseValue vv2 = ssc.getSriResponseValue(targetID);
    assertNotNull(vv2);
    sms2 = ssc.getDeliveredMsgValue(mId);
    assertNotNull(sms2);
    msgId2 = ssc.getDeliveredRemoteMsgIdValue(remoteMessageId, destId);
    assertEquals((long) msgId2, (long) messageId);
    Thread.sleep(2000);
    CorrelationIdValue v3 = ssc.getCorrelationIdCacheElement(correlationID);
    assertNull(v3);
    SriResponseValue vv3 = ssc.getSriResponseValue(targetID);
    assertNull(vv3);
    sms2 = ssc.getDeliveredMsgValue(mId);
    assertNull(sms2);
    msgId2 = ssc.getDeliveredRemoteMsgIdValue(remoteMessageId, destId);
    assertNull(msgId2);
    SmsSetCache.stop();
}
Also used : LocationInfoWithLMSI(org.restcomm.protocols.ss7.map.api.service.sms.LocationInfoWithLMSI) 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) ISDNAddressString(org.restcomm.protocols.ss7.map.api.primitives.ISDNAddressString) AddressString(org.restcomm.protocols.ss7.map.api.primitives.AddressString) ISDNAddressStringImpl(org.restcomm.protocols.ss7.map.primitives.ISDNAddressStringImpl) AddressStringImpl(org.restcomm.protocols.ss7.map.primitives.AddressStringImpl) ISDNAddressStringImpl(org.restcomm.protocols.ss7.map.primitives.ISDNAddressStringImpl) Test(org.testng.annotations.Test)

Example 37 with ISDNAddressString

use of org.restcomm.protocols.ss7.map.api.primitives.ISDNAddressString 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)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