Search in sources :

Example 1 with NationalLanguageIdentifier

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

Example 2 with NationalLanguageIdentifier

use of org.restcomm.protocols.ss7.map.api.datacoding.NationalLanguageIdentifier in project smscgateway by RestComm.

the class MessageUtil method getNationalLanguageIdentifierUdh.

public static UserDataHeader getNationalLanguageIdentifierUdh(int nationalLanguageLockingShift, int nationalLanguageSingleShift) {
    UserDataHeader udh = null;
    if (nationalLanguageSingleShift > 0 || nationalLanguageLockingShift > 0) {
        udh = new UserDataHeaderImpl();
        if (nationalLanguageSingleShift > 0) {
            NationalLanguageIdentifier nli = NationalLanguageIdentifier.getInstance(nationalLanguageSingleShift);
            NationalLanguageSingleShiftIdentifier informationElement = new NationalLanguageSingleShiftIdentifierImpl(nli);
            udh.addInformationElement(informationElement);
        }
        if (nationalLanguageLockingShift > 0) {
            NationalLanguageIdentifier nli = NationalLanguageIdentifier.getInstance(nationalLanguageLockingShift);
            NationalLanguageLockingShiftIdentifier informationElement = new NationalLanguageLockingShiftIdentifierImpl(nli);
            udh.addInformationElement(informationElement);
        }
    }
    return udh;
}
Also used : UserDataHeaderImpl(org.restcomm.protocols.ss7.map.smstpdu.UserDataHeaderImpl) NationalLanguageSingleShiftIdentifier(org.restcomm.protocols.ss7.map.api.smstpdu.NationalLanguageSingleShiftIdentifier) NationalLanguageSingleShiftIdentifierImpl(org.restcomm.protocols.ss7.map.smstpdu.NationalLanguageSingleShiftIdentifierImpl) NationalLanguageLockingShiftIdentifierImpl(org.restcomm.protocols.ss7.map.smstpdu.NationalLanguageLockingShiftIdentifierImpl) NationalLanguageLockingShiftIdentifier(org.restcomm.protocols.ss7.map.api.smstpdu.NationalLanguageLockingShiftIdentifier) UserDataHeader(org.restcomm.protocols.ss7.map.api.smstpdu.UserDataHeader) NationalLanguageIdentifier(org.restcomm.protocols.ss7.map.api.datacoding.NationalLanguageIdentifier)

Aggregations

NationalLanguageIdentifier (org.restcomm.protocols.ss7.map.api.datacoding.NationalLanguageIdentifier)2 Date (java.util.Date)1 SmsSignalInfo (org.restcomm.protocols.ss7.map.api.service.sms.SmsSignalInfo)1 NationalLanguageLockingShiftIdentifier (org.restcomm.protocols.ss7.map.api.smstpdu.NationalLanguageLockingShiftIdentifier)1 NationalLanguageSingleShiftIdentifier (org.restcomm.protocols.ss7.map.api.smstpdu.NationalLanguageSingleShiftIdentifier)1 UserDataHeader (org.restcomm.protocols.ss7.map.api.smstpdu.UserDataHeader)1 NationalLanguageLockingShiftIdentifierImpl (org.restcomm.protocols.ss7.map.smstpdu.NationalLanguageLockingShiftIdentifierImpl)1 NationalLanguageSingleShiftIdentifierImpl (org.restcomm.protocols.ss7.map.smstpdu.NationalLanguageSingleShiftIdentifierImpl)1 UserDataHeaderImpl (org.restcomm.protocols.ss7.map.smstpdu.UserDataHeaderImpl)1