Search in sources :

Example 6 with AbsoluteTimeStamp

use of org.restcomm.protocols.ss7.map.api.smstpdu.AbsoluteTimeStamp in project smscgateway by RestComm.

the class MtSbb method createSignalInfo.

protected SmsSignalInfo createSignalInfo(Sms sms, String msg, byte[] udhData, boolean moreMessagesToSend, int messageReferenceNumber, int messageSegmentCount, int messageSegmentNumber, DataCodingScheme dataCodingScheme, int nationalLanguageLockingShift, int nationalLanguageSingleShift, int sourceAddrTon, int sourceAddrNpi) throws MAPException {
    UserDataHeader userDataHeader;
    if (udhData != null) {
        userDataHeader = this.mapSmsTpduParameterFactory.createUserDataHeader(udhData);
    } else {
        userDataHeader = this.mapSmsTpduParameterFactory.createUserDataHeader();
        if (messageSegmentCount > 1) {
            UserDataHeaderElement concatenatedShortMessagesIdentifier = this.mapSmsTpduParameterFactory.createConcatenatedShortMessagesIdentifier(messageReferenceNumber > 255, messageReferenceNumber, messageSegmentCount, messageSegmentNumber);
            userDataHeader.addInformationElement(concatenatedShortMessagesIdentifier);
        }
        if (nationalLanguageLockingShift > 0) {
            NationalLanguageIdentifier nationalLanguageIdentifier = NationalLanguageIdentifier.getInstance(nationalLanguageLockingShift);
            if (nationalLanguageIdentifier != null) {
                UserDataHeaderElement nationalLanguageLockingShiftEl = this.mapSmsTpduParameterFactory.createNationalLanguageLockingShiftIdentifier(nationalLanguageIdentifier);
                userDataHeader.addInformationElement(nationalLanguageLockingShiftEl);
            }
        }
        if (nationalLanguageSingleShift > 0) {
            NationalLanguageIdentifier nationalLanguageIdentifier = NationalLanguageIdentifier.getInstance(nationalLanguageSingleShift);
            if (nationalLanguageIdentifier != null) {
                UserDataHeaderElement nationalLanguageSingleShiftEl = this.mapSmsTpduParameterFactory.createNationalLanguageSingleShiftIdentifier(nationalLanguageIdentifier);
                userDataHeader.addInformationElement(nationalLanguageSingleShiftEl);
            }
        }
    }
    UserData ud = this.mapSmsTpduParameterFactory.createUserData(msg, dataCodingScheme, userDataHeader, isoCharset);
    Date submitDate = sms.getSubmitDate();
    // TODO : TimeZone should be configurable
    AbsoluteTimeStamp serviceCentreTimeStamp = this.mapSmsTpduParameterFactory.createAbsoluteTimeStamp((submitDate.getYear() % 100), (submitDate.getMonth() + 1), submitDate.getDate(), submitDate.getHours(), submitDate.getMinutes(), submitDate.getSeconds(), -(submitDate.getTimezoneOffset() / 15));
    SmsDeliverTpdu smsDeliverTpdu = this.mapSmsTpduParameterFactory.createSmsDeliverTpdu(moreMessagesToSend, false, ((sms.getEsmClass() & SmppConstants.ESM_CLASS_REPLY_PATH_MASK) != 0), false, this.getSmsTpduOriginatingAddress(sourceAddrTon, sourceAddrNpi, sms.getSourceAddr()), this.mapSmsTpduParameterFactory.createProtocolIdentifier(sms.getProtocolId()), serviceCentreTimeStamp, ud);
    SmsSignalInfo smsSignalInfo = this.mapParameterFactory.createSmsSignalInfo(smsDeliverTpdu, isoCharset);
    return smsSignalInfo;
}
Also used : SmsSignalInfo(org.restcomm.protocols.ss7.map.api.service.sms.SmsSignalInfo) Date(java.util.Date) NationalLanguageIdentifier(org.restcomm.protocols.ss7.map.api.datacoding.NationalLanguageIdentifier)

Aggregations

Date (java.util.Date)4 AbsoluteTimeStamp (org.restcomm.protocols.ss7.map.api.smstpdu.AbsoluteTimeStamp)4 SmsSignalInfo (org.restcomm.protocols.ss7.map.api.service.sms.SmsSignalInfo)3 AddressField (org.restcomm.protocols.ss7.map.api.smstpdu.AddressField)3 ProtocolIdentifier (org.restcomm.protocols.ss7.map.api.smstpdu.ProtocolIdentifier)3 SmsSignalInfoImpl (org.restcomm.protocols.ss7.map.service.sms.SmsSignalInfoImpl)3 AbsoluteTimeStampImpl (org.restcomm.protocols.ss7.map.smstpdu.AbsoluteTimeStampImpl)3 AddressFieldImpl (org.restcomm.protocols.ss7.map.smstpdu.AddressFieldImpl)3 DataCodingSchemeImpl (org.restcomm.protocols.ss7.map.smstpdu.DataCodingSchemeImpl)3 ProtocolIdentifierImpl (org.restcomm.protocols.ss7.map.smstpdu.ProtocolIdentifierImpl)3 UserDataImpl (org.restcomm.protocols.ss7.map.smstpdu.UserDataImpl)3 AddressString (org.restcomm.protocols.ss7.map.api.primitives.AddressString)2 ISDNAddressString (org.restcomm.protocols.ss7.map.api.primitives.ISDNAddressString)2 DataCodingScheme (org.restcomm.protocols.ss7.map.api.smstpdu.DataCodingScheme)2 UserData (org.restcomm.protocols.ss7.map.api.smstpdu.UserData)2 ValidityPeriod (org.restcomm.protocols.ss7.map.api.smstpdu.ValidityPeriod)2 SmsDeliverTpduImpl (org.restcomm.protocols.ss7.map.smstpdu.SmsDeliverTpduImpl)2 Test (org.testng.annotations.Test)2 ByteBuffer (java.nio.ByteBuffer)1 Charset (java.nio.charset.Charset)1