Answer the question
In order to leave comments, you need to log in
How to receive and process POST events/call by Mango Office API?
Maybe someone has come across integration with Mango Office via API before. To execute commands like /hangup (end a call) or recording/start (record a call), you need to know the call_id of the conversation. It can be obtained in the so-called "notification" about the call (/events/call), which is sent in the form of a POST request from Mango Office to the website address. But if you follow the link SiteAddress/events/call, then there will be just an empty page.
According to the Access.log, the incoming POST requests from Mango look like this:
81.88.80.133 - - [23/Jul/2020:13:34:43 +0300] "POST /events/call HTTP/1.1" 301 330 "-" "PHP -Curl-Class/3.5.5 (+ https://github.com/php-curl-class/php-curl-class ) PHP/7.0.26 curl/7.29.0" 2864 0:0
Answer the question
In order to leave comments, you need to log in
To process POST events/call and get a call_id from it, you need to:
1. In the API settings of your personal account, specify the address of the external system (your site) with the address of the folder for storing scripts-handlers for data received from Mango Office.
2. On the server, add the events folder to this folder, and the call folder to it
3. Add the handler script file to the /call folder. The required data will be in the JSON array coming in POST. The data will not be visible on the active page in the browser, so it must be logged, written to a database or file, or processed immediately.
4. In the /call folder, you need to place the .htaccess file with RewriteRule to the handler script file name, because Mango Office won't forward them to .../events/call
Enjoy
https://github.com/Sharoff45/mango-office-api
To receive data from an incoming POST request + signature verification
$data = MangoHelper::getMethodData();
Handlers and routing for receiving requests to a URL like https://external-system.com/vpbx/ api/v1/events/call of course you have to do it yourself.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question