use of org.restcomm.protocols.ss7.map.api.service.sms.MAPDialogSms in project smscgateway by RestComm.
the class MoSbb method processMoMessage.
private Sms processMoMessage(SM_RP_OA smRPOA, SM_RP_DA smRPDA, SmsSignalInfo smsSignalInfo, int networkId, String originatorSccpAddress, boolean isMoOperation, MAPDialogSms dialog, SmsMessage evt, long invokeId) throws SmscProcessingException {
// TODO: check if smRPDA contains local SMSC address and reject messages
// if not equal ???
Sms sms = null;
smsSignalInfo.setGsm8Charset(isoCharset);
ISDNAddressString callingPartyAddress = smRPOA.getMsisdn();
if (callingPartyAddress == null) {
throw new SmscProcessingException("MO callingPartyAddress is absent", SmppConstants.STATUS_SYSERR, MAPErrorCode.unexpectedDataValue, SmscProcessingException.HTTP_ERROR_CODE_NOT_SET, null);
}
SmsTpdu smsTpdu = null;
String origMoServiceCentreAddressDA = null;
if (smRPDA.getServiceCentreAddressDA() != null) {
origMoServiceCentreAddressDA = smRPDA.getServiceCentreAddressDA().getAddress();
}
try {
smsTpdu = smsSignalInfo.decodeTpdu(true);
switch(smsTpdu.getSmsTpduType()) {
case SMS_SUBMIT:
SmsSubmitTpdu smsSubmitTpdu = (SmsSubmitTpdu) smsTpdu;
if (this.logger.isInfoEnabled()) {
this.logger.info("Received SMS_SUBMIT = " + smsSubmitTpdu);
}
sms = this.handleSmsSubmitTpdu(smsSubmitTpdu, callingPartyAddress, networkId, originatorSccpAddress, isMoOperation, dialog, evt, invokeId, origMoServiceCentreAddressDA);
break;
case SMS_DELIVER_REPORT:
SmsDeliverReportTpdu smsDeliverReportTpdu = (SmsDeliverReportTpdu) smsTpdu;
if (this.logger.isInfoEnabled()) {
this.logger.info("Received SMS_DELIVER_REPORT = " + smsDeliverReportTpdu);
smscStatAggregator.updateMsgInFailedAll();
}
// callingPartyAddress);
break;
case SMS_COMMAND:
SmsCommandTpdu smsCommandTpdu = (SmsCommandTpdu) smsTpdu;
if (this.logger.isInfoEnabled()) {
this.logger.info("Received SMS_COMMAND = " + smsCommandTpdu);
smscStatAggregator.updateMsgInFailedAll();
}
// callingPartyAddress);
break;
// break;
default:
this.logger.severe("Received non SMS_SUBMIT or SMS_DELIVER_REPORT or SMS_COMMAND or SMS_DELIVER = " + smsTpdu);
smscStatAggregator.updateMsgInFailedAll();
break;
}
} catch (MAPException e1) {
logger.severe("Error while decoding SmsSignalInfo ", e1);
}
return sms;
}
use of org.restcomm.protocols.ss7.map.api.service.sms.MAPDialogSms in project smscgateway by RestComm.
the class MoSbb method handleSmsSubmitTpdu.
private Sms handleSmsSubmitTpdu(SmsSubmitTpdu smsSubmitTpdu, AddressString callingPartyAddress, int networkId, String originatorSccpAddress, boolean isMoOperation, MAPDialogSms dialog, SmsMessage evt, long invokeId, String origMoServiceCentreAddressDA) throws SmscProcessingException {
TargetAddress ta = createDestTargetAddress(smsSubmitTpdu.getDestinationAddress(), networkId);
Sms sms = this.createSmsEvent(smsSubmitTpdu, ta, persistence, callingPartyAddress, networkId, originatorSccpAddress);
sms.setOrigMoServiceCentreAddressDA(origMoServiceCentreAddressDA);
return sms;
// return this.processSms(sms, persistence, smscPropertiesManagement.getMoCharging(), isMoOperation, dialog, evt, invokeId);
}
use of org.restcomm.protocols.ss7.map.api.service.sms.MAPDialogSms in project smscgateway by RestComm.
the class MoSbb method handleSmsDeliverTpdu.
private Sms handleSmsDeliverTpdu(SmsDeliverTpdu smsDeliverTpdu, CorrelationIdValue civ, int networkId, String originatorSccpAddress, boolean isMoOperation, MAPDialogSms dialog, SmsMessage evt, long invokeId) throws SmscProcessingException {
TargetAddress ta = createDestTargetAddress(civ.getMsisdn(), networkId);
Sms sms = this.createSmsEvent(smsDeliverTpdu, ta, persistence, civ, networkId, originatorSccpAddress);
return sms;
// return this.processSms(sms, persistence, smscPropertiesManagement.getHrCharging(), isMoOperation, dialog, evt, invokeId);
}
use of org.restcomm.protocols.ss7.map.api.service.sms.MAPDialogSms 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.MAPDialogSms in project smscgateway by RestComm.
the class HrSriClientSbb method setupRoutingInfoForSMRequestIndication.
private MAPDialogSms setupRoutingInfoForSMRequestIndication(String destinationAddress, int ton, int npi, MAPApplicationContext mapApplicationContext, int networkId) throws MAPException {
// this.mapParameterFactory.creat
String hlrAddress = destinationAddress;
String hrHlrNumber = smscPropertiesManagement.getHrHlrNumber(networkId);
if (hrHlrNumber != null && hrHlrNumber.length() > 0) {
hlrAddress = hrHlrNumber;
}
SccpAddress destinationAddr = this.convertAddressFieldToSCCPAddress(hlrAddress, ton, npi);
MAPDialogSms mapDialogSms = this.mapProvider.getMAPServiceSms().createNewDialog(mapApplicationContext, this.getServiceCenterSccpAddress(networkId), null, destinationAddr, null);
mapDialogSms.setNetworkId(networkId);
ISDNAddressString isdn = this.getCalledPartyISDNAddressString(destinationAddress, ton, npi);
AddressString serviceCenterAddress = this.getServiceCenterAddressString(networkId);
boolean sm_RP_PRI = true;
mapDialogSms.addSendRoutingInfoForSMRequest(isdn, sm_RP_PRI, serviceCenterAddress, null, false, null, null, null, false, null, false, false, null, null);
if (this.logger.isInfoEnabled())
this.logger.info("Home routing: HrSriClientSbb: Sending: SendRoutingInfoForSMRequest: isdn=" + isdn + ", serviceCenterAddress=" + serviceCenterAddress + ", sm_RP_PRI=" + sm_RP_PRI);
return mapDialogSms;
}
Aggregations