04-05-2017 01:45 AM
Dear experts,
Do we have any possibility to change the phone number variable before send it to SMS gateway?
For example, we have to ask end users to input their phone number in format 8XXXXXXXXXX, but our SMS provider expects from us phone number in format 7XXXXXXXXXX.
So we have to change the first number in the phone number variable '8' -> '7' or just cut out '8' and add '7' into the POST configuration of the SMS provider.
Please give advice
Solved! Go to Solution.
04-06-2017 05:20 AM
Could you please try this one?
<script>
$('[id="ui_self_reg_submit_button"]').on('click', function(evt){
cisco.ise.validation.setPhoneRegex();
cisco.ise.validation.setPhoneNumberMessage();
var phoneInput = $('#guestUser\\.fieldValues\\.ui_phone_number');
var phoneNumber = phoneInput.val();
var regPhone = new RegExp(/^8[0-9]{10}$/)
if (regPhone.test(phoneNumber)) {
var regexped = phoneNumber.replace(/^8/, '7');
phoneInput.val(regexped);
}else {
cisco.ise.validation.setPhoneRegex(/^8[0-9]{10}$/);
cisco.ise.validation.setPhoneNumberMessage("Please provide your phone number in format 8XXXXXXXXXX");
}
});
</script>
04-05-2017 05:15 AM
Why is this required, can you explain why you require one way and SMS provider wants another?
Is it that your reports need the 8?
If the rewrite was done on the page using JavaScript i think this would defeat the purpose as the logs would show a 7
Seems to me this rewrite would have to happen on backend after the number is registered on ise but before sent to provider
If that's the case you will need to open an enhancement through the tac
04-05-2017 05:35 AM
Russian international country code is +7 , our provider expects from us the format '7XXXXXXXXXX' of the phone number.
However, inside the country the format 8XXXXXXXXXX is commonly used to make calls and for most of users it's not comfortable to input their phone in 7XXXXXXXXXX format.
We want to create a handy portal and fit provider's API.
It doesn't really matter which format will be in our reports.
04-05-2017 05:39 AM
Ok it sounds like if the user entered the 8 and then we replace with a 7 somehow but hide to the user then this will work
I guess you don't care about any other type numbers
04-05-2017 05:52 AM
Yeah, we only care about prefix 8
04-06-2017 02:05 AM
Hi Dmitry,
Is that script works for you?
You have to insert that script for Registration page with phone number.
I tested on "Self-registration portal" for Self registered page" and it works fine.
<script>
(function(){
jQuery(document).ready(function() {
setTimeout(function(){
cisco.ise.validation.setPhoneRegex(/^8[0-9]{10}$/);
cisco.ise.validation.setPhoneNumberMessage("Please provide your phone number in format 8XXXXXXXXXX");
}, 100);
});
})();
</script>
Thanks
04-06-2017 02:11 AM
Hi Serhii,
Yes, this script works fine.
But we have to verify and then change the number from 8XXXXXXXXXX->7XXXXXXXXXX.
How can we make this change after submitting the form?
04-06-2017 05:20 AM
Could you please try this one?
<script>
$('[id="ui_self_reg_submit_button"]').on('click', function(evt){
cisco.ise.validation.setPhoneRegex();
cisco.ise.validation.setPhoneNumberMessage();
var phoneInput = $('#guestUser\\.fieldValues\\.ui_phone_number');
var phoneNumber = phoneInput.val();
var regPhone = new RegExp(/^8[0-9]{10}$/)
if (regPhone.test(phoneNumber)) {
var regexped = phoneNumber.replace(/^8/, '7');
phoneInput.val(regexped);
}else {
cisco.ise.validation.setPhoneRegex(/^8[0-9]{10}$/);
cisco.ise.validation.setPhoneNumberMessage("Please provide your phone number in format 8XXXXXXXXXX");
}
});
</script>
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide