use of org.mobicents.protocols.ss7.map.api.MAPException in project smscgateway by RestComm.
the class MoSbb method onDialogDelimiter.
public void onDialogDelimiter(DialogDelimiter evt, ActivityContextInterface aci) {
super.onDialogDelimiter(evt, aci);
if (this.getProcessingState() == MoProcessingState.OnlyRequestRecieved) {
this.setProcessingState(null);
if (this.logger.isFineEnabled())
this.logger.fine("MoSBB: onDialogDelimiter - sending empty TC-CONTINUE for " + evt);
evt.getMAPDialog();
MAPDialog dialog = evt.getMAPDialog();
try {
dialog.send();
} catch (MAPException e) {
logger.severe("Error while sending Continue", e);
}
}
}
use of org.mobicents.protocols.ss7.map.api.MAPException in project smscgateway by RestComm.
the class MoSbb method createSmsEvent.
private Sms createSmsEvent(SmsDeliverTpdu smsDeliverTpdu, TargetAddress ta, PersistenceRAInterface store, CorrelationIdValue civ, int networkId, String originatorSccpAddress) throws SmscProcessingException {
UserData userData = smsDeliverTpdu.getUserData();
try {
userData.decode();
} catch (MAPException e) {
throw new SmscProcessingException("MT MAPException when decoding user data", SmppConstants.STATUS_SYSERR, MAPErrorCode.unexpectedDataValue, SmscProcessingException.HTTP_ERROR_CODE_NOT_SET, null);
}
Sms sms = new Sms();
sms.setDbId(UUID.randomUUID());
sms.setOriginationType(OriginationType.SS7_HR);
AddressField callingPartyAddress = smsDeliverTpdu.getOriginatingAddress();
// checking parameters first
if (callingPartyAddress == null || callingPartyAddress.getAddressValue() == null || callingPartyAddress.getAddressValue().isEmpty()) {
throw new SmscProcessingException("Home routing: TPDU OriginatingAddress digits are absent", SmppConstants.STATUS_SYSERR, MAPErrorCode.unexpectedDataValue, SmscProcessingException.HTTP_ERROR_CODE_NOT_SET, null);
}
if (callingPartyAddress.getTypeOfNumber() == null) {
throw new SmscProcessingException("Home routing: TPDU OriginatingAddress TypeOfNumber is absent", SmppConstants.STATUS_SYSERR, MAPErrorCode.unexpectedDataValue, SmscProcessingException.HTTP_ERROR_CODE_NOT_SET, null);
}
if (callingPartyAddress.getNumberingPlanIdentification() == null) {
throw new SmscProcessingException("Home routing: TPDU OriginatingAddress NumberingPlanIdentification is absent", SmppConstants.STATUS_SYSERR, MAPErrorCode.unexpectedDataValue, SmscProcessingException.HTTP_ERROR_CODE_NOT_SET, null);
}
sms.setSourceAddr(callingPartyAddress.getAddressValue());
sms.setOriginatorSccpAddress(originatorSccpAddress);
if (callingPartyAddress.getTypeOfNumber() == TypeOfNumber.Alphanumeric) {
sms.setSourceAddrTon(TypeOfNumber.Alphanumeric.getCode());
sms.setSourceAddrNpi(NumberingPlanIdentification.Unknown.getCode());
} else {
sms.setSourceAddrTon(callingPartyAddress.getTypeOfNumber().getCode());
sms.setSourceAddrNpi(callingPartyAddress.getNumberingPlanIdentification().getCode());
}
sms.setOrigNetworkId(networkId);
sms.setSubmitDate(new Timestamp(System.currentTimeMillis()));
int messageingMode = (smscPropertiesManagement.getHrDefaultMessagingMode() & 0x03);
sms.setEsmClass(messageingMode | (smsDeliverTpdu.getUserDataHeaderIndicator() ? SmppConstants.ESM_CLASS_UDHI_MASK : 0) | (smsDeliverTpdu.getReplyPathExists() ? SmppConstants.ESM_CLASS_REPLY_PATH_MASK : 0));
sms.setProtocolId(smsDeliverTpdu.getProtocolIdentifier().getCode());
sms.setPriority(0);
// TODO: do we need somehow care with RegisteredDelivery ?
sms.setReplaceIfPresent(0);
// TODO: care with smsSubmitTpdu.getStatusReportRequest() parameter
// sending back SMS_STATUS_REPORT tpdu ?
DataCodingScheme dataCodingScheme = smsDeliverTpdu.getDataCodingScheme();
int dcs = dataCodingScheme.getCode();
String err = MessageUtil.checkDataCodingSchemeSupport(dcs);
if (err != null) {
throw new SmscProcessingException("Home routing: DataCoding scheme does not supported: " + dcs + " - " + err, SmppConstants.STATUS_SYSERR, MAPErrorCode.unexpectedDataValue, SmscProcessingException.HTTP_ERROR_CODE_NOT_SET, null);
}
sms.setDataCoding(dcs);
sms.setShortMessageText(userData.getDecodedMessage());
UserDataHeader udh = userData.getDecodedUserDataHeader();
if (udh != null) {
sms.setShortMessageBin(udh.getEncodedData());
}
// ValidityPeriod processing
MessageUtil.applyValidityPeriod(sms, null, false, smscPropertiesManagement.getMaxValidityPeriodHours(), smscPropertiesManagement.getDefaultValidityPeriodHours());
SmsSet smsSet;
smsSet = new SmsSet();
smsSet.setDestAddr(ta.getAddr());
smsSet.setDestAddrNpi(ta.getAddrNpi());
smsSet.setDestAddrTon(ta.getAddrTon());
smsSet.setNetworkId(networkId);
smsSet.setCorrelationId(civ.getCorrelationID());
smsSet.setImsi(civ.getImsi());
smsSet.setLocationInfoWithLMSI(civ.getLocationInfoWithLMSI());
smsSet.addSms(sms);
sms.setSmsSet(smsSet);
long messageId = store.c2_getNextMessageId();
SmscStatProvider.getInstance().setCurrentMessageId(messageId);
sms.setMessageId(messageId);
return sms;
}
use of org.mobicents.protocols.ss7.map.api.MAPException 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.mobicents.protocols.ss7.map.api.MAPException in project smscgateway by RestComm.
the class HrSriServerSbb method onSriHrByPass.
@Override
public void onSriHrByPass(CorrelationIdValue correlationIdValue) {
MAPDialogSms dlg = this.getActivity();
if (dlg == null) {
this.logger.severe("Home routing: can not get MAPDialog for sending SRI hrByPass Response");
return;
}
smscStatAggregator.updateMsgInHrSriHrByPass();
StringBuilder sb = new StringBuilder();
sb.append("Home routing: bypassing of Home routing: procedure: transaction: ");
sb.append(correlationIdValue);
if (this.logger.isInfoEnabled())
this.logger.info(sb.toString());
// sending original SRI response
try {
SendRoutingInfoForSMResponse sendRoutingInfoForSMResponse = correlationIdValue.getSendRoutingInfoForSMResponse();
this.doSendResponse(correlationIdValue, dlg, sendRoutingInfoForSMResponse.getIMSI().getData(), sendRoutingInfoForSMResponse.getLocationInfoWithLMSI());
} catch (MAPException e) {
if (dlg != null) {
dlg.release();
}
String reason = "Home routing: MAPException when sending SRI bypassing of Home routing: " + e.toString();
this.logger.severe(reason, e);
}
}
use of org.mobicents.protocols.ss7.map.api.MAPException in project smscgateway by RestComm.
the class MAPListener method onSendRoutingInfoForSMRequest.
@Override
public void onSendRoutingInfoForSMRequest(SendRoutingInfoForSMRequest event) {
if (logger.isInfoEnabled()) {
logger.info("Rx : SendRoutingInfoForSMRequestIndication=" + event);
}
IMSI imsi = new IMSIImpl("410035001692061");
ISDNAddressString nnn = new ISDNAddressStringImpl(AddressNature.international_number, NumberingPlan.ISDN, "923330052001");
LocationInfoWithLMSI li = new LocationInfoWithLMSIImpl(nnn, null, null, false, null);
MAPDialogSms mapDialogSms = event.getMAPDialog();
try {
mapDialogSms.addSendRoutingInfoForSMResponse(event.getInvokeId(), imsi, li, null, null, null);
// mapDialogSms.close(false);
} catch (MAPException e) {
e.printStackTrace();
}
mapDialogSms.setUserObject(true);
}
Aggregations