- PVSM.RU - https://www.pvsm.ru -
An online chatbot is a recent trend on the market. But how to interact with the clients that are offline? A significant percentage of people prefer to interact over the phone. And the business needs either a large staff of operators or a voice communication automating solution. We are offering a solution to reduce workload and costs (and will barely affect your developers’ busyness).
How to rapidly and easily program any voice menu, auto-informant, robot-secretary with an attached client database?
Spoiler alert: everything is done by implementing webhooks and we are using PHP example.
What and why?
For instance, you have a delivery service or an online store with its own logistics in place. Some customers are calling to see what’s with their packages and that can be easily automated. The same goes for cab geolocation, some data collection, or any individual information that can be reported to the client without wasting human power.
It can be easily automated, we’ll provide an example below. Oh, and it can be done completely for free.
Why not your own asterisk?
Of course, it can all be done with Asterisk, but aside from the developer, you will also need an administrator, who is also familiar with voice communication security (as they frequently get hacked).
So we will discuss the simplest way to solve the task – with webhooks.
List of methods
You will only need two new methods for the job, but each of them provides you with a lot of possibilities, and most importantly – unlimited cycles. With the help of these cycles, you can get a multilevel voice menu and an informant for any subject.
Main methods:
The detailed method description is available to copy-paste in API description [1].
For NOTIFY_START and NOTIFY_IVR requests you can change scenarios during the call by responding with one of the options:
So, a client calls and hears the greeting, then dials a certain number (for example, a tracking code), we send a notification with the entered digits, the script checks with the database and sends the response to us. The response can contain a voice file id or a standard voice reply.
We have a standard number playing system, so you don’t have to record a response ahead; meaning, the appropriate notification is chosen from the database and is played as a number by a robot. Or you can create up to a hundred default voice messages and use them to reply to clients (e.g. “Your delivery is at the warehouse”, “You can receive your package every day between 9 a.m. and 10 p.m.).
The implementation minimum
For the responder to answer you need the minimum of a phone number and a PBX. You should also upload or enter the possible responses.
Set up
PHP example
To demonstrate different options, we have created 4 examples of IVR performance on PHP.
The first three examples are available on GitHub [4]. There you have all the required elements, you just need to insert the files with the filling (that have to be to prior uploaded to or read in PBX).
Task 4: the caller hears the greeting and is asked to enter the identification number, after entering the system tells the balance, says goodbye using a popular phrase from the list and ends the call.
Here’s an example of code for the described task.
PHP code
$request = new Request();
$notify = self::getEvent([AbstractNotify::EVENT_START, AbstractNotify::EVENT_IVR]);
if (!$notify) {
return;
}
switch ($notify->event){
case AbstractNotify::EVENT_START:
$request
->setIvrPlay(self::INFO_FILE_ID)
->setWaitDtmf(TIMEOUT , ATTEMPTS, MAXDIGITS, DTMF_NAME, DEFAULT_BEHAVIOUR);
break;
case AbstractNotify::EVENT_IVR:
if (!empty($notify->wait_dtmf->digits)) {
$balance = getBalance($notify->wait_dtmf->digits);
$request->setIvrSayNumber($balance, 'en');
} elseif (!empty($notify->ivr_saynumber)) {
$request->setIvrSayPopular(POPULAR_PHRASE_NUM, 'en');
} else {
$request->setHangup();
}
}
$request->send();
We looking to further expand our method features and collecting feedback in the comments below. We also have other webhook methods and API available, you can see the full list on the website [5].
Автор: elena_zz
Источник [6]
Сайт-источник PVSM.RU: https://www.pvsm.ru
Путь до страницы источника: https://www.pvsm.ru/php-2/336413
Ссылки в тексте:
[1] API description: https://zadarma.com/en/support/api/#webhook
[2] Free PBX: https://zadarma.com/en/services/pbx/
[3] numbers: https://zadarma.com/en/tariffs/numbers/
[4] GitHub: https://github.com/zadarma/user-api-v1/blob/master/examples/webhook.php
[5] on the website: https://zadarma.com/en/support/api/
[6] Источник: https://habr.com/ru/post/474178/?utm_campaign=474178&utm_source=habrahabr&utm_medium=rss
Нажмите здесь для печати.