Skip to content
Advertisement

Validate user when they try to call phone number with nexmo in laravel

i have customer service application using in app browser call using nexmo and laravel as framework. I have some users and each users have their list phone numbers in table and each row has contact action button to call. The target of phone number is put in button like this :

JavaScript

but user can do inspect element and edit those button then put another phone numbers they want. How can i prevent this cheat and alert user in example “You have not authorize to call this phone number.” when they do that action?

this my handler when .call-button is clicked:

JavaScript

Advertisement

Answer

There is no possible way for the Vonage (Nexmo) Voice API to validate whether your user should be able to call a phone number they have access to in your application. It sounds like you have provided users of your application the ability to initiate voice conversations with your Vonage API credentials. The validation logic for your users must rest in your application.

One solution you can consider is before initiating the new voice call, you can check against your database if the user has access or not. If they do not have access you can redirect them to another view in your application, and if they do have access you can initiate the call. Laravel has a entire suite of validation tooling that you may find helpful.

User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement