use of org.mobicents.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("\nReceived 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("\nSending 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);
}
}
use of org.mobicents.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);
}
Aggregations