Search in sources :

Example 1 with AbsoluteTimeStampImpl

use of org.mobicents.protocols.ss7.map.smstpdu.AbsoluteTimeStampImpl in project smscgateway by RestComm.

the class MtTest2 method Ucs2Test.

@Test(groups = { "Mt" })
public void Ucs2Test() throws Exception {
    // Long msgId = 15L;
    // String s1 = msgId.toString(10);
    // String sss2 = String.format("%010d", 15L);
    String s11 = "زمانیکه بررسی";
    Charset ucs2Charset = Charset.forName("UTF-16BE");
    Charset utf8 = Charset.forName("UTF-8");
    // ByteBuffer bb = ByteBuffer.wrap(textPart);
    // CharBuffer bf = ucs2Charset.decode(bb);
    // msg = bf.toString();
    ByteBuffer bb = utf8.encode(s11);
    byte[] buf = new byte[bb.limit()];
    bb.get(buf, 0, bb.limit());
    String s2 = new String(buf);
    UserDataImpl ud = new UserDataImpl(s2, new DataCodingSchemeImpl(8), null, null);
    AddressField originatingAddress = new AddressFieldImpl(TypeOfNumber.InternationalNumber, NumberingPlanIdentification.ISDNTelephoneNumberingPlan, "123456");
    ProtocolIdentifier pi = new ProtocolIdentifierImpl(0);
    AbsoluteTimeStamp serviceCentreTimeStamp = new AbsoluteTimeStampImpl(05, 3, 4, 5, 6, 7, 0);
    SmsDeliverTpduImpl smsDeliverTpduImpl = new SmsDeliverTpduImpl(false, false, false, true, originatingAddress, pi, serviceCentreTimeStamp, ud);
    SmsSignalInfoImpl SmsSignalInfoImpl = new SmsSignalInfoImpl(smsDeliverTpduImpl, null);
    int gg = 0;
    gg++;
}
Also used : AddressField(org.mobicents.protocols.ss7.map.api.smstpdu.AddressField) AbsoluteTimeStamp(org.mobicents.protocols.ss7.map.api.smstpdu.AbsoluteTimeStamp) AddressFieldImpl(org.mobicents.protocols.ss7.map.smstpdu.AddressFieldImpl) Charset(java.nio.charset.Charset) SmsSignalInfoImpl(org.mobicents.protocols.ss7.map.service.sms.SmsSignalInfoImpl) DataCodingSchemeImpl(org.mobicents.protocols.ss7.map.smstpdu.DataCodingSchemeImpl) ByteBuffer(java.nio.ByteBuffer) ProtocolIdentifierImpl(org.mobicents.protocols.ss7.map.smstpdu.ProtocolIdentifierImpl) AbsoluteTimeStampImpl(org.mobicents.protocols.ss7.map.smstpdu.AbsoluteTimeStampImpl) UserDataImpl(org.mobicents.protocols.ss7.map.smstpdu.UserDataImpl) ProtocolIdentifier(org.mobicents.protocols.ss7.map.api.smstpdu.ProtocolIdentifier) SmsDeliverTpduImpl(org.mobicents.protocols.ss7.map.smstpdu.SmsDeliverTpduImpl) Test(org.testng.annotations.Test)

Example 2 with AbsoluteTimeStampImpl

use of org.mobicents.protocols.ss7.map.smstpdu.AbsoluteTimeStampImpl in project smscgateway by RestComm.

the class MtTest2 method Ucs2Test3.

@Test(groups = { "Mt" })
public void Ucs2Test3() throws Exception {
    String s11 = "ura nus";
    byte[] buf = s11.getBytes();
    UserDataImpl ud = new UserDataImpl(s11, new DataCodingSchemeImpl(16), null, null);
    AddressField originatingAddress = new AddressFieldImpl(TypeOfNumber.InternationalNumber, NumberingPlanIdentification.ISDNTelephoneNumberingPlan, "123456");
    ProtocolIdentifier pi = new ProtocolIdentifierImpl(0);
    AbsoluteTimeStamp serviceCentreTimeStamp = new AbsoluteTimeStampImpl(05, 3, 4, 5, 6, 7, 0);
    SmsDeliverTpduImpl smsDeliverTpduImpl = new SmsDeliverTpduImpl(false, false, false, true, originatingAddress, pi, serviceCentreTimeStamp, ud);
    SmsSignalInfoImpl SmsSignalInfoImpl = new SmsSignalInfoImpl(smsDeliverTpduImpl, null);
    int gg = 0;
    gg++;
}
Also used : AddressField(org.mobicents.protocols.ss7.map.api.smstpdu.AddressField) AbsoluteTimeStamp(org.mobicents.protocols.ss7.map.api.smstpdu.AbsoluteTimeStamp) AddressFieldImpl(org.mobicents.protocols.ss7.map.smstpdu.AddressFieldImpl) SmsSignalInfoImpl(org.mobicents.protocols.ss7.map.service.sms.SmsSignalInfoImpl) DataCodingSchemeImpl(org.mobicents.protocols.ss7.map.smstpdu.DataCodingSchemeImpl) ProtocolIdentifierImpl(org.mobicents.protocols.ss7.map.smstpdu.ProtocolIdentifierImpl) AbsoluteTimeStampImpl(org.mobicents.protocols.ss7.map.smstpdu.AbsoluteTimeStampImpl) UserDataImpl(org.mobicents.protocols.ss7.map.smstpdu.UserDataImpl) ProtocolIdentifier(org.mobicents.protocols.ss7.map.api.smstpdu.ProtocolIdentifier) SmsDeliverTpduImpl(org.mobicents.protocols.ss7.map.smstpdu.SmsDeliverTpduImpl) Test(org.testng.annotations.Test)

Example 3 with AbsoluteTimeStampImpl

use of org.mobicents.protocols.ss7.map.smstpdu.AbsoluteTimeStampImpl in project smscgateway by RestComm.

the class MoSbbTest method testMo2_Gsm7.

@Test(groups = { "Mo" })
public void testMo2_Gsm7() throws Exception {
    if (!this.cassandraDbInited)
        return;
    // this.clearDatabase();
    // 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);
    // 3 hours: 1 for delay + 2 different timezone
    Date valDate = MessageUtil.addHours(new Date(), 3);
    int tzo = -valDate.getTimezoneOffset();
    AbsoluteTimeStamp absoluteFormatValue = new AbsoluteTimeStampImpl(valDate.getYear(), valDate.getMonth(), valDate.getDate(), valDate.getHours(), valDate.getMinutes(), valDate.getSeconds(), tzo / 15 + 4 * 2);
    // int year, int month, int day, int hour, int minute, int second, int timeZone
    ValidityPeriod validityPeriod = new ValidityPeriodImpl(absoluteFormatValue);
    DataCodingScheme dataCodingScheme = new DataCodingSchemeImpl(0);
    UserData userData = new UserDataImpl(new String("0123456789"), dataCodingScheme, null, null);
    // userData.encode();
    // String decodedMessage, DataCodingScheme dataCodingScheme, UserDataHeader decodedUserDataHeader, Charset gsm8Charset
    SmsTpdu tpdu = new SmsSubmitTpduImpl(true, true, false, 150, destinationAddress, protocolIdentifier, validityPeriod, userData);
    // boolean rejectDuplicates, boolean replyPathExists, boolean statusReportRequest, int messageReference,
    // AddressField destinationAddress, ProtocolIdentifier protocolIdentifier, ValidityPeriod validityPeriod, UserData userData
    // tpdu.encodeData();
    SmsSignalInfo sm_RP_UI = new SmsSignalInfoImpl(tpdu, null);
    ForwardShortMessageRequest event = new ForwardShortMessageRequestImpl(sm_RP_DA, sm_RP_OA, sm_RP_UI, false);
    // ActivityContextInterface aci = new SmppTransactionProxy(esme);
    // Date curDate = new Date();
    // this.fillSm(event, curDate, true);
    // event.setShortMessage(msg);
    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(), 0);
    assertNull(sms.getOrigEsmeName());
    assertNull(sms.getOrigSystemId());
    assertNull(sms.getServiceType());
    assertEquals(sms.getEsmClass() & 0xFF, 131);
    assertEquals(sms.getRegisteredDelivery(), 0);
    assertEquals(sms.getProtocolId(), 12);
    assertEquals(sms.getPriority(), 0);
    assertEquals(sms.getReplaceIfPresent(), 2);
    assertEquals(sms.getDefaultMsgId(), 0);
    assertEquals(sms.getTlvSet().getOptionalParameterCount(), 0);
    assertNull(sms.getScheduleDeliveryTime());
    assertDateEq(sms.getValidityPeriod(), MessageUtil.addHours(curDate, 1));
    assertEquals(sms.getDeliveryCount(), 0);
    // assertDateEq(smsSet.getDueDate(), new Date(curDate.getTime() + 1 * 60 * 1000));
    // assertEquals(new String(sms.getShortMessage()), "0123456789");
    assertEquals(sms.getShortMessageText(), "0123456789");
    assertNull(sms.getShortMessageBin());
}
Also used : DataCodingScheme(org.mobicents.protocols.ss7.map.api.smstpdu.DataCodingScheme) MAPServiceSmsProxy(org.mobicents.smsc.slee.resources.persistence.MAPServiceSmsProxy) ISDNAddressString(org.mobicents.protocols.ss7.map.api.primitives.ISDNAddressString) AddressString(org.mobicents.protocols.ss7.map.api.primitives.AddressString) UserData(org.mobicents.protocols.ss7.map.api.smstpdu.UserData) SmsTpdu(org.mobicents.protocols.ss7.map.api.smstpdu.SmsTpdu) ISDNAddressString(org.mobicents.protocols.ss7.map.api.primitives.ISDNAddressString) SmsSignalInfoImpl(org.mobicents.protocols.ss7.map.service.sms.SmsSignalInfoImpl) ISDNAddressString(org.mobicents.protocols.ss7.map.api.primitives.ISDNAddressString) AddressString(org.mobicents.protocols.ss7.map.api.primitives.AddressString) DataCodingSchemeImpl(org.mobicents.protocols.ss7.map.smstpdu.DataCodingSchemeImpl) ProtocolIdentifierImpl(org.mobicents.protocols.ss7.map.smstpdu.ProtocolIdentifierImpl) SmsSignalInfo(org.mobicents.protocols.ss7.map.api.service.sms.SmsSignalInfo) AbsoluteTimeStampImpl(org.mobicents.protocols.ss7.map.smstpdu.AbsoluteTimeStampImpl) UserDataImpl(org.mobicents.protocols.ss7.map.smstpdu.UserDataImpl) MAPProviderProxy(org.mobicents.smsc.slee.resources.persistence.MAPProviderProxy) ProtocolIdentifier(org.mobicents.protocols.ss7.map.api.smstpdu.ProtocolIdentifier) ISDNAddressStringImpl(org.mobicents.protocols.ss7.map.primitives.ISDNAddressStringImpl) AddressStringImpl(org.mobicents.protocols.ss7.map.primitives.AddressStringImpl) AddressField(org.mobicents.protocols.ss7.map.api.smstpdu.AddressField) AbsoluteTimeStamp(org.mobicents.protocols.ss7.map.api.smstpdu.AbsoluteTimeStamp) MoForwardShortMessageRequestImpl(org.mobicents.protocols.ss7.map.service.sms.MoForwardShortMessageRequestImpl) ForwardShortMessageRequestImpl(org.mobicents.protocols.ss7.map.service.sms.ForwardShortMessageRequestImpl) SM_RP_DAImpl(org.mobicents.protocols.ss7.map.service.sms.SM_RP_DAImpl) AddressFieldImpl(org.mobicents.protocols.ss7.map.smstpdu.AddressFieldImpl) ValidityPeriodImpl(org.mobicents.protocols.ss7.map.smstpdu.ValidityPeriodImpl) MoForwardShortMessageRequest(org.mobicents.protocols.ss7.map.api.service.sms.MoForwardShortMessageRequest) ForwardShortMessageRequest(org.mobicents.protocols.ss7.map.api.service.sms.ForwardShortMessageRequest) SM_RP_OAImpl(org.mobicents.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.mobicents.protocols.ss7.map.primitives.ISDNAddressStringImpl) Sms(org.mobicents.smsc.library.Sms) ValidityPeriod(org.mobicents.protocols.ss7.map.api.smstpdu.ValidityPeriod) SM_RP_DA(org.mobicents.protocols.ss7.map.api.service.sms.SM_RP_DA) MAPApplicationContext(org.mobicents.protocols.ss7.map.api.MAPApplicationContext) SmsSet(org.mobicents.smsc.library.SmsSet) SmsSubmitTpduImpl(org.mobicents.protocols.ss7.map.smstpdu.SmsSubmitTpduImpl) Test(org.testng.annotations.Test)

Aggregations

AbsoluteTimeStamp (org.mobicents.protocols.ss7.map.api.smstpdu.AbsoluteTimeStamp)3 AddressField (org.mobicents.protocols.ss7.map.api.smstpdu.AddressField)3 ProtocolIdentifier (org.mobicents.protocols.ss7.map.api.smstpdu.ProtocolIdentifier)3 SmsSignalInfoImpl (org.mobicents.protocols.ss7.map.service.sms.SmsSignalInfoImpl)3 AbsoluteTimeStampImpl (org.mobicents.protocols.ss7.map.smstpdu.AbsoluteTimeStampImpl)3 AddressFieldImpl (org.mobicents.protocols.ss7.map.smstpdu.AddressFieldImpl)3 DataCodingSchemeImpl (org.mobicents.protocols.ss7.map.smstpdu.DataCodingSchemeImpl)3 ProtocolIdentifierImpl (org.mobicents.protocols.ss7.map.smstpdu.ProtocolIdentifierImpl)3 UserDataImpl (org.mobicents.protocols.ss7.map.smstpdu.UserDataImpl)3 Test (org.testng.annotations.Test)3 SmsDeliverTpduImpl (org.mobicents.protocols.ss7.map.smstpdu.SmsDeliverTpduImpl)2 ByteBuffer (java.nio.ByteBuffer)1 Charset (java.nio.charset.Charset)1 Date (java.util.Date)1 MAPApplicationContext (org.mobicents.protocols.ss7.map.api.MAPApplicationContext)1 AddressString (org.mobicents.protocols.ss7.map.api.primitives.AddressString)1 ISDNAddressString (org.mobicents.protocols.ss7.map.api.primitives.ISDNAddressString)1 ForwardShortMessageRequest (org.mobicents.protocols.ss7.map.api.service.sms.ForwardShortMessageRequest)1 MoForwardShortMessageRequest (org.mobicents.protocols.ss7.map.api.service.sms.MoForwardShortMessageRequest)1 SM_RP_DA (org.mobicents.protocols.ss7.map.api.service.sms.SM_RP_DA)1