use of org.restcomm.protocols.ss7.map.api.service.sms.ForwardShortMessageRequest in project smscgateway by RestComm.
the class MtSbb method onDialogDelimiter.
@Override
public void onDialogDelimiter(DialogDelimiter evt, ActivityContextInterface aci) {
super.onDialogDelimiter(evt, aci);
SmsSet smsSet = getSmsSet();
if (smsSet == null) {
logger.severe("MtSbb.onDialogDelimiter(): CMP smsSet is missed");
markDeliveringIsEnded(true);
return;
}
try {
if (this.getTcEmptySent() != 0) {
// Empty TC-BEGIN has been sent
// We are sending MtForwardSM
this.setTcEmptySent(0);
SmsSignalInfo[] segments = this.getSegments();
int messageSegmentNumber = this.getMessageSegmentNumber();
if (messageSegmentNumber >= 0 && segments != null && messageSegmentNumber < segments.length) {
SmsSignalInfo si = segments[messageSegmentNumber];
if (si != null) {
try {
MAPDialogSms mapDialogSms = (MAPDialogSms) evt.getMAPDialog();
SM_RP_DA sm_RP_DA = this.getSmRpDa();
SM_RP_OA sm_RP_OA = this.getSmRpOa();
boolean moreMessagesToSend = false;
if (messageSegmentNumber < segments.length - 1) {
moreMessagesToSend = true;
}
try {
if (this.getTotalUnsentMessageCount() > 1) {
moreMessagesToSend = true;
}
} catch (Throwable e) {
}
switch(mapDialogSms.getApplicationContext().getApplicationContextVersion()) {
case version3:
mapDialogSms.addMtForwardShortMessageRequest(sm_RP_DA, sm_RP_OA, si, moreMessagesToSend, null);
if (this.logger.isInfoEnabled()) {
this.logger.info("Sending: MtForwardShortMessageRequest: sm_RP_DA=" + sm_RP_DA + ", sm_RP_OA=" + sm_RP_OA + ", si=" + si + ", moreMessagesToSend=" + moreMessagesToSend);
}
break;
case version2:
case version1:
mapDialogSms.addForwardShortMessageRequest(sm_RP_DA, sm_RP_OA, si, moreMessagesToSend);
if (this.logger.isInfoEnabled()) {
this.logger.info("Sending: ForwardShortMessageRequest: sm_RP_DA=" + sm_RP_DA + ", sm_RP_OA=" + sm_RP_OA + ", si=" + si + ", moreMessagesToSend=" + moreMessagesToSend);
}
break;
default:
break;
}
mapDialogSms.send();
} catch (MAPException e) {
logger.severe("Error while trying to send MtForwardShortMessageRequest", e);
}
}
}
} else if (this.getResponseReceived() == 1) {
this.setResponseReceived(0);
this.handleSmsResponse((MAPDialogSms) evt.getMAPDialog(), true);
}
} catch (Throwable e1) {
String s = "Exception in MtSbb.onDialogDelimiter() 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.restcomm.protocols.ss7.map.api.service.sms.ForwardShortMessageRequest in project smscgateway by RestComm.
the class MAPListener method onForwardShortMessageRequest.
@Override
public void onForwardShortMessageRequest(ForwardShortMessageRequest event) {
if (logger.isInfoEnabled()) {
logger.info("Rx : onForwardShortMessageRequest=" + event);
}
// Lets first close the Dialog
MAPDialogSms mapDialogSms = event.getMAPDialog();
try {
if (this.currentMapMessageCount % 7 == 0) {
// Send back AbsentSubscriber for every 7th MtSMS
MAPErrorMessage mapErrorMessage = mAPErrorMessageFactory.createMAPErrorMessageAbsentSubscriberSM(AbsentSubscriberDiagnosticSM.IMSIDetached, null, null);
mapDialogSms.sendErrorComponent(event.getInvokeId(), mapErrorMessage);
// mapDialogSms.close(false);
} else {
mapDialogSms.addForwardShortMessageResponse(event.getInvokeId());
// mapDialogSms.close(false);
}
} catch (MAPException e) {
logger.error("Error while sending MAPErrorMessageAbsentSubscriberSM ", e);
}
mapDialogSms.setUserObject(true);
}
Aggregations