Search in sources :

Example 1 with PostImsiProcessorImpl

use of org.mobicents.smsc.mproc.impl.PostImsiProcessorImpl in project smscgateway by RestComm.

the class MProcManagement method applyMProcImsiRequest.

public MProcResult applyMProcImsiRequest(final MProcRuleRaProvider anMProcRuleRa, Sms sms, String imsi, String nnnDigits, int nnnNumberingPlan, int nnnAddressNature) {
    if (this.mprocs.size() == 0)
        return new MProcResult();
    FastList<MProcRule> cur = this.mprocs;
    PostImsiProcessorImpl pap = new PostImsiProcessorImpl(logger);
    MProcMessage message = new MProcMessageImpl(sms, ProcessingType.SS7_SRI, null);
    try {
        for (FastList.Node<MProcRule> n = cur.head(), end = cur.tail(); (n = n.getNext()) != end; ) {
            MProcRule rule = n.getValue();
            if (rule.isForPostImsiRequestState() && rule.matchesPostImsiRequest(message)) {
                if (logger.isDebugEnabled()) {
                    logger.debug("MRule matches at ImsiRequest phase to a message:\nrule: " + rule + "\nmessage: " + sms);
                }
                rule.onPostImsiRequest(anMProcRuleRa, pap, message);
            }
        }
    } catch (Throwable e) {
        logger.error("Exception when invoking rule.matches(message) or applyMProcImsiRequest(): " + e.getMessage(), e);
        return new MProcResult();
    }
    if (pap.isNeedDropMessages()) {
        MProcResult res = new MProcResult();
        res.setMessageDropped(true);
        return res;
    }
    if (pap.isNeedRerouteMessages()) {
        MProcResult res = new MProcResult();
        res.setMessageIsRerouted(true);
        res.setNewNetworkId(pap.getNewNetworkId());
        return res;
    }
    return new MProcResult();
}
Also used : MProcRule(org.mobicents.smsc.mproc.MProcRule) MProcResult(org.mobicents.smsc.mproc.impl.MProcResult) MProcMessageImpl(org.mobicents.smsc.mproc.impl.MProcMessageImpl) FastList(javolution.util.FastList) MProcMessage(org.mobicents.smsc.mproc.MProcMessage) PostImsiProcessorImpl(org.mobicents.smsc.mproc.impl.PostImsiProcessorImpl)

Aggregations

FastList (javolution.util.FastList)1 MProcMessage (org.mobicents.smsc.mproc.MProcMessage)1 MProcRule (org.mobicents.smsc.mproc.MProcRule)1 MProcMessageImpl (org.mobicents.smsc.mproc.impl.MProcMessageImpl)1 MProcResult (org.mobicents.smsc.mproc.impl.MProcResult)1 PostImsiProcessorImpl (org.mobicents.smsc.mproc.impl.PostImsiProcessorImpl)1