diff --git a/mediation-old/src/main/java/com/wso2telco/dep/mediator/impl/smsmessaging/SendSMSHandler.java b/mediation-old/src/main/java/com/wso2telco/dep/mediator/impl/smsmessaging/SendSMSHandler.java index f897be2..1407173 100644 --- a/mediation-old/src/main/java/com/wso2telco/dep/mediator/impl/smsmessaging/SendSMSHandler.java +++ b/mediation-old/src/main/java/com/wso2telco/dep/mediator/impl/smsmessaging/SendSMSHandler.java @@ -110,7 +110,7 @@ public class SendSMSHandler extends AbstractHandler{ public SendSMSHandler(SMSExecutor executor) throws InstantiationException, IllegalAccessException, ClassNotFoundException, ValidatorException{ super(); this.executor = executor; - occi = new OriginatingCountryCalculatorIDD(); + occi = new OriginatingCountryCalculatorIDD(true); responseHandler = new ResponseHandler(); smsMessagingService = new SMSMessagingService(); } diff --git a/mediation-old/src/main/java/com/wso2telco/dep/mediator/mediationrule/OriginatingCountryCalculatorIDD.java b/mediation-old/src/main/java/com/wso2telco/dep/mediator/mediationrule/OriginatingCountryCalculatorIDD.java index 6a91fd2..ead9e1d 100644 --- a/mediation-old/src/main/java/com/wso2telco/dep/mediator/mediationrule/OriginatingCountryCalculatorIDD.java +++ b/mediation-old/src/main/java/com/wso2telco/dep/mediator/mediationrule/OriginatingCountryCalculatorIDD.java @@ -81,6 +81,15 @@ public class OriginatingCountryCalculatorIDD extends OriginatingCountryCalculato public static String oparatorOnHeaderRegEx = null; public static String oparatorOnHeaderMCC = null; + private boolean ignoreMSISDNFormatValidation; + + public OriginatingCountryCalculatorIDD () { + + } + + public OriginatingCountryCalculatorIDD (boolean ignoreMSISDNFormatValidation) { + this.ignoreMSISDNFormatValidation = ignoreMSISDNFormatValidation; + } /* * (non-Javadoc) @@ -249,35 +258,43 @@ public OperatorEndpoint getOperatorEndpoint( //MSISDN could be in ARC/PCR format //if (phoneUtil.resourceInMsisdnFormat(searchDTO.getMSISDN())) { - MSISDN numberProto = null; - int countryCode = 0; - //Check MSIDN in typical format - try { - numberProto = phoneUtil.parse(searchDTO.getMSISDN()); - if (numberProto != null) { + if (!ignoreMSISDNFormatValidation) { + MSISDN numberProto = null; + int countryCode = 0; + //Check MSIDN in typical format + try { + numberProto = phoneUtil.parse(searchDTO.getMSISDN()); + if (numberProto != null) { + /** + * obtain the country code form the phone number object + */ + countryCode = numberProto.getCountryCode(); + } + /** - * obtain the country code form the phone number object + * if the country code within the header look up context , the + * operator taken from the header object + */ + if (countryLookUpOnHeader.contains(String.valueOf(countryCode))) { + operator = operatorCode; + } + /** + * build the MSISDN */ - countryCode = numberProto.getCountryCode(); - } - - /** - * if the country code within the header look up context , the - * operator taken from the header object - */ - if (countryLookUpOnHeader.contains(String.valueOf(countryCode))) { - operator = operatorCode; - } - /** - * build the MSISDN - */ - if (numberProto != null) { + if (numberProto != null) { - msisdn.append("+").append(numberProto.getCountryCode()) - .append(numberProto.getNationalNumber()); + msisdn.append("+").append(numberProto.getCountryCode()) + .append(numberProto.getNationalNumber()); + } + } catch (InvalidMSISDNException e) { + //number in either ARC/PCR format. number already validated from oneapi validation + //operator fetched from header + if (operatorCode != null) { + operator = operatorCode; + } } - } catch (InvalidMSISDNException e) { + } else { //number in either ARC/PCR format. number already validated from oneapi validation //operator fetched from header if (operatorCode != null) {