use of org.mobicents.smsc.library.SmsSet in project smscgateway by RestComm.
the class AlertTest method createEmptySmsSet.
private SmsSet createEmptySmsSet(TargetAddress ta) {
SmsSet smsSet = new SmsSet();
smsSet.setDestAddr(ta1.getAddr());
smsSet.setDestAddrNpi(ta1.getAddrNpi());
smsSet.setDestAddrTon(ta1.getAddrTon());
smsSet.setType(SmType.SMS_FOR_SS7);
return smsSet;
}
use of org.mobicents.smsc.library.SmsSet 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);
}
use of org.mobicents.smsc.library.SmsSet in project smscgateway by RestComm.
the class SriSbb method onSms.
// *********
// initial event
public void onSms(SmsSetEvent event, ActivityContextInterface aci, EventContext eventContext) {
SmsSet smsSet = event.getSmsSet();
this.addInitialMessageSet(smsSet);
try {
if (this.logger.isFineEnabled()) {
this.logger.fine("\nReceived Submit SMS. event= " + event + "this=" + this);
}
smscStatAggregator.updateMsgOutTryAll();
smscStatAggregator.updateMsgOutTrySs7();
if (smsSet.getDestAddrTon() == SmppConstants.TON_ALPHANUMERIC) {
// bad TON at the destination address: alphanumerical is not supported
this.onDeliveryError(smsSet, ErrorAction.permanentFailure, ErrorCode.BAD_TYPE_OF_NUMBER, "TON \"alhpanumerical\" is not supported for as a destination address", true, null, false, ProcessingType.SS7_SRI);
return;
}
if (smsSet.getDestAddrTon() != SmppConstants.TON_UNKNOWN && smsSet.getDestAddrTon() != SmppConstants.TON_INTERNATIONAL && smsSet.getDestAddrTon() != SmppConstants.TON_NATIONAL && smsSet.getDestAddrTon() != SmppConstants.TON_SUBSCRIBER) {
// we support only following TON for a dest address
this.onDeliveryError(smsSet, ErrorAction.permanentFailure, ErrorCode.BAD_TYPE_OF_NUMBER, "TON " + smsSet.getDestAddrTon() + " is not supported for as a destination address", true, null, false, ProcessingType.SS7_SRI);
return;
}
if (smsSet.getDestAddrNpi() != SmppConstants.NPI_UNKNOWN && smsSet.getDestAddrNpi() != SmppConstants.NPI_E164 && smsSet.getDestAddrNpi() != SmppConstants.NPI_X121 && smsSet.getDestAddrNpi() != SmppConstants.NPI_TELEX && smsSet.getDestAddrNpi() != SmppConstants.NPI_LAND_MOBILE) {
// we support only following TON for a dest address
this.onDeliveryError(smsSet, ErrorAction.permanentFailure, ErrorCode.BAD_NPI, "NPI " + smsSet.getDestAddrNpi() + " is not supported for as a destination address", true, null, false, ProcessingType.SS7_SRI);
return;
}
Sms sms = this.obtainNextMessage(ProcessingType.SS7_SRI);
if (sms == null) {
// this means that no messages with good ScheduleDeliveryTime or
// no messages at all we have to reschedule
this.markDeliveringIsEnded(true);
return;
}
// checking for correlationId - may be we do not need SRI
String correlationID = smsSet.getCorrelationId();
CorrelationIdValue civ = null;
if (correlationID != null) {
civ = SmsSetCache.getInstance().getCorrelationIdCacheElement(correlationID);
if (this.logger.isFineEnabled()) {
this.logger.fine("HomeRouting: correlationID=" + correlationID + ", found CorrelationIdValue=" + civ);
}
}
if (civ != null && civ.getLocationInfoWithLMSI() != null && civ.getImsi() != null) {
// preloaded routing info is found - skip SRI request
MWStatus mwStatus = civ.getMwStatus();
if (mwStatus != null) {
InformServiceCenterContainer informServiceCenterContainer = new InformServiceCenterContainer();
informServiceCenterContainer.setMwStatus(mwStatus);
this.setInformServiceCenterContainer(informServiceCenterContainer);
}
this.setSriMapVersion(civ.getSriMapVersion());
this.executeForwardSM(smsSet, civ.getLocationInfoWithLMSI(), civ.getImsi(), smsSet.getNetworkId());
return;
}
// checking for cached - may be we do not need SRI
String targetID = smsSet.getTargetId();
SriResponseValue srv = null;
srv = SmsSetCache.getInstance().getSriResponseValue(targetID);
if (this.logger.isFineEnabled()) {
this.logger.fine("SRI requesting: targetID=" + targetID + ", found cached SriResponseValue=" + srv);
}
if (srv != null) {
// preloaded routing info is found - skip SRI request
this.setSriMapVersion(3);
this.executeForwardSM(smsSet, srv.getLocationInfoWithLMSI(), srv.getImsi(), smsSet.getNetworkId());
return;
}
// no preloaded routing info
this.sendSRI(smsSet, smsSet.getDestAddr(), smsSet.getDestAddrTon(), smsSet.getDestAddrNpi(), this.getSRIMAPApplicationContext(this.maxMAPApplicationContextVersion));
} catch (Throwable e1) {
String s = "Exception in SriSbb.onSms when fetching records and issuing events: " + e1.getMessage();
logger.severe(s, e1);
markDeliveringIsEnded(true);
// this.onDeliveryError(smsSet, ErrorAction.temporaryFailure, ErrorCode.SC_SYSTEM_ERROR, s, true, null, false);
}
}
use of org.mobicents.smsc.library.SmsSet in project smscgateway by RestComm.
the class SriSbb method onDialogTimeout.
@Override
public void onDialogTimeout(DialogTimeout evt, ActivityContextInterface aci) {
try {
super.onDialogTimeout(evt, aci);
SmsSet smsSet = getSmsSet();
if (smsSet == null) {
logger.severe("SriSbb.onDialogTimeout(): CMP smsSet is missed");
markDeliveringIsEnded(true);
return;
}
this.onDeliveryError(smsSet, ErrorAction.temporaryFailure, ErrorCode.HLR_REJECT_AFTER_ROUTING_INFO, "onDialogTimeout after SRI Request", true, null, false, ProcessingType.SS7_SRI);
} catch (Throwable e1) {
logger.severe("Exception in SriSbb.onDialogTimeout() when fetching records and issuing events: " + e1.getMessage(), e1);
markDeliveringIsEnded(true);
}
}
use of org.mobicents.smsc.library.SmsSet in project smscgateway by RestComm.
the class RxSipServerSbb method onTRANSACTION_TIMEOUT.
public void onTRANSACTION_TIMEOUT(javax.sip.TimeoutEvent event, ActivityContextInterface aci) {
this.logger.warning("onTRANSACTION_TIMEOUT " + event);
SmsSet smsSet = getSmsSet();
if (smsSet == null) {
logger.severe("RxSipServerSbb.onTRANSACTION_TIMEOUT(): CMP smsSet is missed");
markDeliveringIsEnded(true);
return;
}
this.onDeliveryError(smsSet, ErrorAction.temporaryFailure, ErrorCode.SC_SYSTEM_ERROR, "SIP Exception TRANSACTION_TIMEOUT received.");
}
Aggregations