Search in sources :

Example 21 with MAPException

use of org.mobicents.protocols.ss7.map.api.MAPException in project smscgateway by RestComm.

the class MAPListener method onMoForwardShortMessageRequest.

@Override
public void onMoForwardShortMessageRequest(MoForwardShortMessageRequest request) {
    if (logger.isDebugEnabled()) {
        logger.debug("Rx : MoForwardShortMessageRequestIndication=" + request);
    }
    MAPDialogSms dialog = request.getMAPDialog();
    try {
        // TODO Should we add PENDING SMS TPDU here itself?
        dialog.addMoForwardShortMessageResponse(request.getInvokeId(), null, null);
    // dialog.close(false);
    } catch (MAPException e) {
        logger.error("Error while sending MoForwardShortMessageResponse ", e);
    }
    dialog.setUserObject(true);
    try {
        SmsSignalInfo smsSignalInfo = request.getSM_RP_UI();
        SmsTpdu smsTpdu = smsSignalInfo.decodeTpdu(true);
        if (smsTpdu.getSmsTpduType() != SmsTpduType.SMS_SUBMIT) {
            // TODO : Error, we should always receive SMS_SUBMIT for
            // MoForwardShortMessageRequestIndication
            logger.error("Rx : MoForwardShortMessageRequestIndication, but SmsTpduType is not SMS_SUBMIT. SmsTpdu=" + smsTpdu);
            return;
        }
        SmsSubmitTpdu smsSubmitTpdu = (SmsSubmitTpdu) smsTpdu;
        AddressField destinationAddress = smsSubmitTpdu.getDestinationAddress();
    // TODO Normalize
    } catch (MAPException e1) {
        logger.error("Error while decoding SmsSignalInfo ", e1);
    }
}
Also used : AddressField(org.restcomm.protocols.ss7.map.api.smstpdu.AddressField) SmsSignalInfo(org.restcomm.protocols.ss7.map.api.service.sms.SmsSignalInfo) MAPDialogSms(org.restcomm.protocols.ss7.map.api.service.sms.MAPDialogSms) MAPException(org.restcomm.protocols.ss7.map.api.MAPException) SmsTpdu(org.restcomm.protocols.ss7.map.api.smstpdu.SmsTpdu) SmsSubmitTpdu(org.restcomm.protocols.ss7.map.api.smstpdu.SmsSubmitTpdu)

Example 22 with MAPException

use of org.mobicents.protocols.ss7.map.api.MAPException in project smscgateway by RestComm.

the class MAPListener method onReportSMDeliveryStatusRequest.

@Override
public void onReportSMDeliveryStatusRequest(ReportSMDeliveryStatusRequest event) {
    if (logger.isInfoEnabled()) {
        logger.info("Rx : ReportSMDeliveryStatusRequest=" + event);
    }
    MAPDialogSms dialog = event.getMAPDialog();
    try {
        dialog.addReportSMDeliveryStatusResponse(event.getInvokeId(), event.getMsisdn(), null);
    // dialog.close(false);
    } catch (MAPException e) {
        e.printStackTrace();
    }
    dialog.setUserObject(true);
}
Also used : MAPDialogSms(org.restcomm.protocols.ss7.map.api.service.sms.MAPDialogSms) MAPException(org.restcomm.protocols.ss7.map.api.MAPException)

Example 23 with MAPException

use of org.mobicents.protocols.ss7.map.api.MAPException 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);
}
Also used : MAPDialogSms(org.restcomm.protocols.ss7.map.api.service.sms.MAPDialogSms) MAPException(org.restcomm.protocols.ss7.map.api.MAPException) MAPErrorMessage(org.restcomm.protocols.ss7.map.api.errors.MAPErrorMessage)

Aggregations

MAPException (org.restcomm.protocols.ss7.map.api.MAPException)22 MAPDialogSms (org.restcomm.protocols.ss7.map.api.service.sms.MAPDialogSms)19 ISDNAddressString (org.restcomm.protocols.ss7.map.api.primitives.ISDNAddressString)14 AddressString (org.restcomm.protocols.ss7.map.api.primitives.AddressString)12 ActivityContextInterface (javax.slee.ActivityContextInterface)4 Sms (org.mobicents.smsc.library.Sms)4 SmsSet (org.mobicents.smsc.library.SmsSet)4 SmsSignalInfo (org.restcomm.protocols.ss7.map.api.service.sms.SmsSignalInfo)4 MAPErrorMessage (org.restcomm.protocols.ss7.map.api.errors.MAPErrorMessage)3 MAPErrorMessageSubscriberBusyForMtSms (org.restcomm.protocols.ss7.map.api.errors.MAPErrorMessageSubscriberBusyForMtSms)3 SM_RP_DA (org.restcomm.protocols.ss7.map.api.service.sms.SM_RP_DA)3 SmsTpdu (org.restcomm.protocols.ss7.map.api.smstpdu.SmsTpdu)3 UserData (org.restcomm.protocols.ss7.map.api.smstpdu.UserData)3 Timestamp (java.sql.Timestamp)2 ArrayList (java.util.ArrayList)2 Date (java.util.Date)2 SmscProcessingException (org.mobicents.smsc.library.SmscProcessingException)2 TargetAddress (org.mobicents.smsc.library.TargetAddress)2 MAPErrorMessageSMDeliveryFailure (org.restcomm.protocols.ss7.map.api.errors.MAPErrorMessageSMDeliveryFailure)2 IMSI (org.restcomm.protocols.ss7.map.api.primitives.IMSI)2