Identify Caller by Name


Now that you have successfully written your first Voice API, we will modify the code to make is more personalized we will include caller name in greeting.

For example: “Hello Bob”

In the code above we started off by creating an array $contact. In this array we have listed all the known contacts with their phone number and name. When the call comes inĀ  from parameter will be triggered and look in the $contact array to see if we have the phone number in our contacts. If the phone number is located in the contacts then the code will greet the caller with name (like Hello Bob) else it will treat the caller unknown and respond “Hello There”.

Key word used = Say
Say Reads the text and convert’s that to audio and play to the caller.

Wohooo!!!! You successfully completed the step and identified your caller by name!!!

Next: Collect Response

 

Share This