API Docs for:
Show:

plugin_rest_voicemail Class

Module: plugins_rest
Parent Module: com_voicemail_rest

REST plugin that provides voicemail functions through the following REST API:

GET requests

  1. voicemail/list/:type[?offset=n&limit=n]
  2. voicemail/listen/:id
  3. voicemail/download/:id
  4. voicemail/listen_custom_msg/:type
  5. voicemail/download_custom_msg/:type

voicemail/list/:type[?offset=n&limit=n]

Returns the list of all voicemail messages of the user. If type is specified returns only messages of the specified type. It supports pagination through offset and limit.

Example JSON response:

{
 "count": 39,
 "rows": [
   {
     "origtime": "1490350880",
     "duration": "14",
     "id": 961,
     "dir": "/var/spool/asterisk/voicemail/default/230/Old",
     "callerid": "\"UNIONTEL SRL\" <0521292626>",
     "mailboxuser": "302",
     "type": "old"
   },
   ...
 ]
}

voicemail/listen/:id

The user can listen the voice message of the user. The id must be the identifier of the voice message in the database.


voicemail/download/:id

The user can download the voice message of the user. The id must be the identifier of the voice message in the database. It returns the filename that can be downloaded getting it from /webrest/static/.


voicemail/listen_custom_msg/:type

The user can listen the custom voice message for the specified type. Returns a string with audio file content in base64 format or a 404 response status. The request must contains the following parameters:

  • type: ("unavail"|"busy"|"greet") the type of the custom message

Example JSON response:

"UklgRa..."

voicemail/download_custom_msg/:type

The user can download the custom voice message for the specified type. It returns the filename that can be downloaded getting it from /webrest/static/. The request must contains the following parameters:

  • type: ("unavail"|"busy"|"greet") the type of the custom message

Example JSON response:

{ "filename": "custom_msg_vm_201alessandro_busy.wav" }
{ "filename": "custom_msg_vm_201alessandro_unavail.wav" }
{ "filename": "custom_msg_vm_201alessandro_greet.wav" }


POST requests

  1. voicemail/delete
  2. voicemail/custom_msg

voicemail/delete

Delete the specified voicemail message. The request must contains the following parameters:

  • id: the voice message identifier of the database

Example JSON request parameters:

{ "id": "74" }

voicemail/custom_msg

Upload customized audio message to be listen when the user leave a message. The request must contains the following parameters:

  • type: ("unavail"|"busy"|"greet") when the customized audio message has to be listen. "unavail" is to customize message when the user is unavailable or when the voicemail unconditional call forward has been set, "busy" is when he is busy in a conversation and "greet" type is to customize only the name of the person of the voicemail and then the default message will be listen
  • audio: the audio message in base64 format. The original audio file must be wav, 8000Hz and 16 bit format mono

Example JSON request parameters:

{ "audio": "data:audio/wav;base64,1234..." }

DELETE requests

  1. voicemail/custom_msg

voicemail/custom_msg/:type

Delete the specified custom voicemail message. The request must contains the following parameters:

  • type: ("unavail"|"busy"|"greet") the type of the custom message

Example JSON request parameters:

{ "type": "unavail" }

Methods

customMsgDelete

(
  • req
  • res
  • next
)

Delete customized audio message of voicemail.

Parameters:

  • req Object

    The request object

  • res Object

    The response object

  • next Object

customMsgPost

(
  • req
  • res
  • next
)

Upload customized audio message to be listen when the user leave a message.

Parameters:

  • req Object

    The request object

  • res Object

    The response object

  • next Object

delete

(
  • req
  • res
  • next
)

Customize/delete the audio message for the voicemail of the user with the following REST API:

POST custom_msg
DELETE custom_msg/:type

Parameters:

  • req Object

    The client request

  • res Object

    The client response

  • next Function

    Function to run the next handler in the chain

delete

(
  • req
  • res
  • next
)

Delte the specified voicemail message of the user with the following REST API:

delete

Parameters:

  • req Object

    The client request

  • res Object

    The client response

  • next Function

    Function to run the next handler in the chain

download

(
  • req
  • res
  • next
)

Download the voice message of the user with the following REST API:

download

Parameters:

  • req Object

    The client request

  • res Object

    The client response

  • next Function

    Function to run the next handler in the chain

download_custom_msg

(
  • req
  • res
  • next
)

Download the custom voice message for the specified type of the user with the following REST API:

download_custom_msg

Parameters:

  • req Object

    The client request

  • res Object

    The client response

  • next Function

    Function to run the next handler in the chain

list

(
  • req
  • res
  • next
)

Gets the list of all voicemail messages of the user with the following REST API:

list

Parameters:

  • req Object

    The client request.

  • res Object

    The client response.

  • next Function

    Function to run the next handler in the chain.

listen

(
  • req
  • res
  • next
)

Listen the voicemail message of the user with the following REST API:

listen

Parameters:

  • req Object

    The client request

  • res Object

    The client response

  • next Function

    Function to run the next handler in the chain

listen

(
  • req
  • res
  • next
)

Listen the custom message of the voicemail of the user with the following REST API:

listen_custom_msg

Parameters:

  • req Object

    The client request

  • res Object

    The client response

  • next Function

    Function to run the next handler in the chain

new_counters

(
  • req
  • res
  • next
)

Gets the number of new voice messages of all voicemails with the following REST API:

new_counters

Parameters:

  • req Object

    The client request

  • res Object

    The client response

  • next Function

    Function to run the next handler in the chain

setCompAuthorization

(
  • comp
)
static

Sets the authorization architect component.

Parameters:

  • comp Object

    The architect authorization component

setCompStatic

(
  • comp
)

Set static http architecht component used by history functions.

Parameters:

  • comp Object

    The http static architect component.

setCompUser

(
  • comp
)
static

Set the user architect component.

Parameters:

  • comp Object

    The architect user component

setCompUtil

(
  • comp
)

Sets the utility architect component.

Parameters:

  • comp Object

    The utility architect component.

setCompVoicemail

(
  • cp
)

Set voicemail architect component used by voicemail functions.

Parameters:

  • cp Object

    The voicemail architect component.

setLogger

(
  • log
)
static

Set the logger to be used.

Parameters:

  • log Object

    The logger object. It must have at least three methods: info, warn and error as console object.

Properties

compAuthorization

Object private

The architect component to be used for authorization.

compStaticHttp

Object private

The http static module.

compUser

Object private

The architect component to be used for user.

compUtil

Object private

The utility architect component.

compVoicemail

Object private

The voicemail architect component used for voicemail functions.

get

Array

REST API to be requested using HTTP GET request.

Sub-properties:

  • list/:type[?offset=n&limit=n] String

    To get the list of all voicemail messages of the user

  • listen/:id String

    To listen the voicemail message of the user

  • download/:id String

    To download the voicemail message of the user

  • new_counters String

    To get the number of new voice messages of all voicemails

  • listen_custom_msg/:type String

    To listen the custom message for the voicemail

  • download_custom_msg/:type String

    To download the custom message for the voicemail

IDLOG

String private final

The module identifier used by the logger.

Default: [plugins_rest/voicemail]

logger

Object private

The logger. It must have at least three methods: info, warn and error.

Default: console

post

Array

REST API to be requested using HTTP POST request.

Sub-properties:

  • delete String

    To delete a voicemail messages of the user

  • custom_msg String

    To customize the audio message for the voicemail

post

Array

REST API to be requested using HTTP DEL request.

Sub-properties:

  • custom_msg String

    To delete a custom voicemail messages of the user