Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Updated using 4PSA automated script
Excerpt

This method allows adding new phone call events in particular contexts such as User, Organization or global.

Table of Contents
maxLevel3
excludeApps Using This, Quick Examples, Need Help?

Request/Response model

Overview

Use this request to add call events to an Extension.

If successful, the Service returns the Id of the newly created PhoneCallEvent, which is later used to query the status of the phone call event.

The request is made by an App that is registered to a User account.

To create a PhoneCallEvent, issue a HTTP POST request:

Panel
borderColor#DADADA
bgColor#FFFFFF
titleBGColor#F0F0F0
borderWidth1
titleModel
borderStyledashed
HTTP-Method       = "POST"
URI-Fragment      = "/uapi/extensions/" User-Id "/" Extension-Number "/phoneCallEvents/"
Query-Parameters  = null
Request-Payload   = PhoneCallEvent

Return-Object     = PhoneCallEvent
Panel
borderColor#DADADA
bgColor#FFFFFF
titleBGColor#F0F0F0
borderWidth1
titleExample
borderStyledashed
POST /uapi/extensions/@me/0003*210/phoneCallEvents HTTP/1.1
HOST uapi.voipnow.com
Content Type: application/json
Authorization: Bearer token

{
  "type": "0",
  "method": "0",
  "note": "My phone call event is awesome",
  "url": "http://myevent.com/SaveMyPhoneCallDetails",
  "status": "1"
}

Request

This section describes how to format the request to the service.

Anchor
urifragment
urifragment

URI fragment

The following parameters must be sent in the URI fragment.

NameTypeRequiredDescription

userId

User-Id

Yes

Id of the User which owns the Extension for which the event is added.
It can take one of the following values:
@me - refers to the authenticated User .
@viewer - also refers to the authenticated User .
@owner - refers to the User that owns the Extension used to make the phone call.
User-Id - refers to the unique identifier of the User.
Default: @me

extensionUAPI-Extension-NumberYesThe number of the Extension for which the event is added.
Allowed Extension types: Phone Terminal, Queue, Conference, and IVR.
Cannot be set to @self.

Response

Success

If successful, the request returns the Id of the newly created PhoneCallEvent and the following HTTP statuses:

HTTP CodeDescription
200The Id of the newly created PhoneCallEvent.
204There is no Id to be returned.

Failure

When it fails, the request returns the following error codes:

HTTP CodeCodeDescription
400pcet_type_invalidValue supplied in type parameter is missing or invalid. The parameter must be set to one of the following value: 0 for DialIn, 1 for DialOut and 2 for Hangup.
400pce_method_invalidValue supplied in method parameter is missing or invalid. The parameter must be set to one of the following value: 0 for GET or 1 for POST.
400pce_note_invalidValue supplied in note parameter is missing or invalid. It must be string and 1024 characters long.
400pce_url_invalidValue supplied in request URL parameter is missing or invalid. It must be a valid HTTP URL.
400pce_status_invalidValue supplied in status parameter is missing or invalid. The parameter must be set to one of the following value: 0 for enabled or 1 for disabled.
400extension_invalidValue supplied in the URI-Fragment as extension is invalid. The parameter must reference the number of an existing extension or cannot be set to @self.
400pce_access_deniedYou are not allowed to manage the phone call events.

Examples

Below you can find an example that will help you understand the request and the response.

This example creates a phone call event for the Extension 0003*210. The event is executed when a call is received and it makes a HTTP request to the script http://myevent.com/SaveMyPhoneCallDetails using the POST method.

The request is made by an App on behalf of a User.

Anchor
example
example

Code Block
titleHTTP Request
POST /uapi/extensions/@me/0003*210/phoneCallEvents HTTP/1.1
HOST uapi.voipnow.com
Content Type: application/json
Authorization: Bearer token

{
  "type": "0",
  "method": "0",
  "note": "My phone call event is awesome",
  "url": "http://myevent.com/SaveMyPhoneCallDetails",
  "status": "1"
 
}

Assuming that the request has been successful, the Service sends the following answer:

Code Block
titleHTTP Response
HTTP/1.1 201 Created
...
 
{
  "type": "0",
  "id":"NqeyDRqo4FtabmFj8gNWq3hsiGNYyq",
  "method":"0",
  "note":"My phone call event is awesome",
  "url":"http://myevent.com/SaveMyPhoneCallDetails",
  "status":"1",
  "modified":"2012-07-10T18:16:12+03:00",
  "links": {"self":"https://x.x.x.x/uapi/extensions/@me/0003*210/phoneCallEvents/MyPhoneCallEvent"}
}

Except where otherwise noted, content in this space is licensed under a Creative Commons Attribution 4.0 International.