Search in sources :

Example 1 with SmsStatusReportTpdu

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

the class MtTest3 method ReportTest.

@Test(groups = { "Mt" })
public void ReportTest() throws Exception {
    MtSbbProxy3 proxy = new MtSbbProxy3();
    Date submitDate = new Date(2015, 1, 2, 12, 30);
    Date deliveryDate = new Date(2015, 1, 2, 12, 40);
    Sms sms = new Sms();
    sms.setSourceAddr("111199990000");
    sms.setSourceAddrNpi(1);
    sms.setSourceAddrTon(1);
    sms.setShortMessageText("Hello 111");
    sms.setSubmitDate(submitDate);
    sms.setMoMessageRef(34);
    SmsSet smsSet = new SmsSet();
    smsSet.setDestAddr("888899990000");
    smsSet.setDestAddrNpi(1);
    smsSet.setDestAddrTon(1);
    smsSet.setNetworkId(0);
    smsSet.addSms(sms);
    SmsDeliveryReportData smsDeliveryReportData = new SmsDeliveryReportData();
    smsDeliveryReportData.setDeliveryDate(deliveryDate);
    smsDeliveryReportData.setStatusReportQualifier(StatusReportQualifier.SmsSubmitResult);
    smsDeliveryReportData.setStatusVal(64);
    SmsSignalInfo smsSignalInfo = proxy.createSignalInfoStatusReport(sms, true, smsDeliveryReportData);
    String s1 = smsSignalInfo.toString();
    assertNotNull(smsSignalInfo);
    SmsStatusReportTpdu si = (SmsStatusReportTpdu) smsSignalInfo.decodeTpdu(false);
    assertEquals(si.getDischargeTime().getMinute(), 40);
    assertEquals(si.getServiceCentreTimeStamp().getMinute(), 30);
    assertFalse(si.getForwardedOrSpawned());
    assertEquals(si.getMessageReference(), 34);
    assertTrue(si.getMoreMessagesToSend());
    // assertNull(si.getParameterIndicator());
    assertEquals(si.getProtocolIdentifier().getCode(), 0);
    assertEquals(si.getRecipientAddress().getAddressValue(), "888899990000");
    assertEquals(si.getRecipientAddress().getNumberingPlanIdentification(), NumberingPlanIdentification.ISDNTelephoneNumberingPlan);
    assertEquals(si.getRecipientAddress().getTypeOfNumber(), TypeOfNumber.InternationalNumber);
    assertEquals(si.getStatus().getCode(), Status.REMOTE_PROCEDURE_ERROR);
    assertEquals(si.getStatusReportQualifier(), StatusReportQualifier.SmsSubmitResult);
}
Also used : SmsSignalInfo(org.restcomm.protocols.ss7.map.api.service.sms.SmsSignalInfo) Sms(org.mobicents.smsc.library.Sms) SmsStatusReportTpdu(org.restcomm.protocols.ss7.map.api.smstpdu.SmsStatusReportTpdu) SmsDeliveryReportData(org.mobicents.smsc.library.SmsDeliveryReportData) ISDNAddressString(org.restcomm.protocols.ss7.map.api.primitives.ISDNAddressString) Date(java.util.Date) SmsSet(org.mobicents.smsc.library.SmsSet) Test(org.testng.annotations.Test)

Example 2 with SmsStatusReportTpdu

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

the class MtSbb method createSignalInfoStatusReport.

protected SmsSignalInfo createSignalInfoStatusReport(Sms sms, boolean moreMessagesToSend, SmsDeliveryReportData smsDeliveryReportData) throws MAPException {
    // TODO : TimeZone should be configurable
    Date submitDate = sms.getSubmitDate();
    AbsoluteTimeStamp submitTimeStamp = this.mapSmsTpduParameterFactory.createAbsoluteTimeStamp((submitDate.getYear() % 100), (submitDate.getMonth() + 1), submitDate.getDate(), submitDate.getHours(), submitDate.getMinutes(), submitDate.getSeconds(), -(submitDate.getTimezoneOffset() / 15));
    Date deliveryDate = smsDeliveryReportData.getDeliveryDate();
    AbsoluteTimeStamp deliveryTimeStamp = this.mapSmsTpduParameterFactory.createAbsoluteTimeStamp((deliveryDate.getYear() % 100), (deliveryDate.getMonth() + 1), deliveryDate.getDate(), deliveryDate.getHours(), deliveryDate.getMinutes(), deliveryDate.getSeconds(), -(deliveryDate.getTimezoneOffset() / 15));
    Status status = this.mapSmsTpduParameterFactory.createStatus(smsDeliveryReportData.getStatusVal());
    SmsStatusReportTpdu smsStatusReportTpdu = this.mapSmsTpduParameterFactory.createSmsStatusReportTpdu(moreMessagesToSend, false, smsDeliveryReportData.getStatusReportQualifier(), sms.getMoMessageRef(), this.getSmsTpduOriginatingAddress(sms.getSourceAddrTon(), sms.getSourceAddrNpi(), sms.getSourceAddr()), submitTimeStamp, deliveryTimeStamp, status, this.mapSmsTpduParameterFactory.createProtocolIdentifier(sms.getProtocolId()), null);
    SmsSignalInfo smsSignalInfo = this.mapParameterFactory.createSmsSignalInfo(smsStatusReportTpdu, isoCharset);
    return smsSignalInfo;
}
Also used : SmsSignalInfo(org.restcomm.protocols.ss7.map.api.service.sms.SmsSignalInfo) Date(java.util.Date)

Aggregations

Date (java.util.Date)2 SmsSignalInfo (org.restcomm.protocols.ss7.map.api.service.sms.SmsSignalInfo)2 Sms (org.mobicents.smsc.library.Sms)1 SmsDeliveryReportData (org.mobicents.smsc.library.SmsDeliveryReportData)1 SmsSet (org.mobicents.smsc.library.SmsSet)1 ISDNAddressString (org.restcomm.protocols.ss7.map.api.primitives.ISDNAddressString)1 SmsStatusReportTpdu (org.restcomm.protocols.ss7.map.api.smstpdu.SmsStatusReportTpdu)1 Test (org.testng.annotations.Test)1