Working with incoming calls#
Depending on the integration needs, the work with incoming call notifications can be realized in several ways:
-
If you don't need to work with incoming calls, we recommend to do incomingCall notification resetting
- When working with the notification handler, delete unknown types of notifications by the
typeWebhook
field, so all unnecessary notifications will be removed from the queue. - When working via HTTP API, delete notifications using deleteNotification method.
- When working through Webhook Endpoint, give status code 200.
- When working with the notification handler, delete unknown types of notifications by the
-
If you need to receive only the fact of an incoming call, you can make a handler to receive the notification
typeWebhook
:incomingCall
and monitor the statusstatus
:offer
. All other statuses should be excluded from call processing. -
If you need to see only the result of the call and do not inform the operator about the incoming call, then you need to track and record in the chat all statuses except
offer
. You can also reduce the information on unanswered calls.For example:
- When receiving a notification (
typeWebhook
:incomingCall
+status
:offer
) - just reset the notification. -
If other statuses are received, record in the chat with the conversation partner:
pickUp
- "Answered call"
hungUp
- "Missed call"
missed
- "Missed call"
declined
- "Missed call"
- When receiving a notification (
-
If it is necessary to receive all call statuses, it is required to realize processing of all incomingCall type notifications. It is required to broadcast the call record to the chat when receiving a notification.
For example:
- Receive incoming call (
typeWebhook
:incomingCall
+status
:offer
) - record in the chatIncoming call
and inform the operator. -
Call termination (for reasons: operator answer, call drop, waiting time expiration) - receive a notification (
typeWebhook
:incomingCall
) and depending on the value of thestatus
field make a record in the chat:pickUp
- "Answered call"
hungUp
- "Dropped call" - the operator has dropped the call or the system has a setting or theDo Not Disturb
function is activated on the phone (hung up)
missed
- "Missed call" - the caller has ended the call
declined
- "Missed call" - caller did not wait for an answer
- Receive incoming call (
Getting the name of the caller's interlocutor
-
Get notification incomingCall about an incoming call, the from field contains the account number of the interlocutor.
-
Use the GetContactInfo method to determine the information about the caller.
-
Use the name or contactName fields from the GetContactInfo method to get the name of the caller.