Search in sources :

Example 1 with AlertServiceCentreRequest

use of org.restcomm.protocols.ss7.map.api.service.sms.AlertServiceCentreRequest in project smscgateway by RestComm.

the class AlertSbb method onAlertServiceCentreRequest.

public void onAlertServiceCentreRequest(AlertServiceCentreRequest evt, ActivityContextInterface aci) {
    if (this.logger.isFineEnabled()) {
        this.logger.fine("Received onAlertServiceCentreRequest= " + evt);
    }
    try {
        MAPDialogSms mapDialogSms = evt.getMAPDialog();
        MAPApplicationContext mapApplicationContext = mapDialogSms.getApplicationContext();
        if (mapApplicationContext.getApplicationContextVersion() == MAPApplicationContextVersion.version2) {
            // Send back response only for V2
            mapDialogSms.addAlertServiceCentreResponse(evt.getInvokeId());
            if (this.logger.isFineEnabled()) {
                this.logger.fine("Sending AlertServiceCentreResponse");
            }
            mapDialogSms.close(false);
        } else {
            mapDialogSms.release();
        }
        this.setupAlert(evt.getMsisdn(), evt.getServiceCentreAddress(), mapDialogSms.getNetworkId());
    } catch (MAPException e) {
        logger.severe("Exception while trying to send back AlertServiceCentreResponse", e);
    }
}
Also used : MAPDialogSms(org.restcomm.protocols.ss7.map.api.service.sms.MAPDialogSms) MAPException(org.restcomm.protocols.ss7.map.api.MAPException) MAPApplicationContext(org.restcomm.protocols.ss7.map.api.MAPApplicationContext)

Example 2 with AlertServiceCentreRequest

use of org.restcomm.protocols.ss7.map.api.service.sms.AlertServiceCentreRequest in project smscgateway by RestComm.

the class AlertTest method testAlert1_Gsm1.

@Test(groups = { "Alert" })
public void testAlert1_Gsm1() throws Exception {
    if (!this.cassandraDbInited)
        return;
    this.prepareDatabase();
    SmsSet smsSetX = SmsSetCache.getInstance().getProcessingSmsSet(procTargetId);
    assertNull(smsSetX);
    Sms smsX = this.pers.obtainLiveSms(procDueSlot, procTargetId, procId);
    assertEquals(smsX.getSmsSet().getInSystem(), 0);
    // boolean b1 = this.pers.checkSmsSetExists(ta1);
    // assertTrue(b1);
    // SmsSet smsSet = this.pers.obtainSmsSet(ta1);
    // assertEquals(smsSet.getInSystem(), 1);
    // assertEquals(smsSet.getDueDate(), farDate);
    Thread.sleep(1000);
    Date curDate = new Date();
    ISDNAddressString msisdn = new ISDNAddressStringImpl(AddressNature.international_number, NumberingPlan.ISDN, "5555");
    AddressString serviceCentreAddress = new AddressStringImpl(AddressNature.international_number, NumberingPlan.ISDN, "1111");
    AlertServiceCentreRequest evt = new AlertServiceCentreRequestImpl(msisdn, serviceCentreAddress);
    MAPProviderProxy proxy = new MAPProviderProxy();
    MAPApplicationContext appCntx = MAPApplicationContext.getInstance(MAPApplicationContextName.shortMsgAlertContext, MAPApplicationContextVersion.version2);
    MAPDialogSmsProxy dialog = new MAPDialogSmsProxy(new MAPServiceSmsProxy(proxy), appCntx, null, null);
    evt.setMAPDialog(dialog);
    this.sbb.onAlertServiceCentreRequest(evt, null);
    smsSetX = SmsSetCache.getInstance().getProcessingSmsSet(procTargetId);
    // assertNotNull(smsSetX);  TODO: this will work after alert is with direct Activities sending
    smsX = this.pers.obtainLiveSms(procDueSlot, procTargetId, procId);
// assertNull(smsX);
// b1 = this.pers.checkSmsSetExists(ta1);
// assertTrue(b1);
// smsSet = this.pers.obtainSmsSet(ta1);
// assertEquals(smsSet.getInSystem(), 1);
// this.testDateEq(smsSet.getDueDate(), curDate);
}
Also used : AlertServiceCentreRequestImpl(org.restcomm.protocols.ss7.map.service.sms.AlertServiceCentreRequestImpl) MAPServiceSmsProxy(org.mobicents.smsc.slee.resources.persistence.MAPServiceSmsProxy) 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) Date(java.util.Date) MAPDialogSmsProxy(org.mobicents.smsc.slee.resources.persistence.MAPDialogSmsProxy) ISDNAddressStringImpl(org.restcomm.protocols.ss7.map.primitives.ISDNAddressStringImpl) MAPProviderProxy(org.mobicents.smsc.slee.resources.persistence.MAPProviderProxy) Sms(org.mobicents.smsc.library.Sms) AlertServiceCentreRequest(org.restcomm.protocols.ss7.map.api.service.sms.AlertServiceCentreRequest) SmsSet(org.mobicents.smsc.library.SmsSet) MAPApplicationContext(org.restcomm.protocols.ss7.map.api.MAPApplicationContext) AddressStringImpl(org.restcomm.protocols.ss7.map.primitives.AddressStringImpl) ISDNAddressStringImpl(org.restcomm.protocols.ss7.map.primitives.ISDNAddressStringImpl) Test(org.testng.annotations.Test)

Aggregations

MAPApplicationContext (org.restcomm.protocols.ss7.map.api.MAPApplicationContext)2 Date (java.util.Date)1 Sms (org.mobicents.smsc.library.Sms)1 SmsSet (org.mobicents.smsc.library.SmsSet)1 MAPDialogSmsProxy (org.mobicents.smsc.slee.resources.persistence.MAPDialogSmsProxy)1 MAPProviderProxy (org.mobicents.smsc.slee.resources.persistence.MAPProviderProxy)1 MAPServiceSmsProxy (org.mobicents.smsc.slee.resources.persistence.MAPServiceSmsProxy)1 MAPException (org.restcomm.protocols.ss7.map.api.MAPException)1 AddressString (org.restcomm.protocols.ss7.map.api.primitives.AddressString)1 ISDNAddressString (org.restcomm.protocols.ss7.map.api.primitives.ISDNAddressString)1 AlertServiceCentreRequest (org.restcomm.protocols.ss7.map.api.service.sms.AlertServiceCentreRequest)1 MAPDialogSms (org.restcomm.protocols.ss7.map.api.service.sms.MAPDialogSms)1 AddressStringImpl (org.restcomm.protocols.ss7.map.primitives.AddressStringImpl)1 ISDNAddressStringImpl (org.restcomm.protocols.ss7.map.primitives.ISDNAddressStringImpl)1 AlertServiceCentreRequestImpl (org.restcomm.protocols.ss7.map.service.sms.AlertServiceCentreRequestImpl)1 Test (org.testng.annotations.Test)1