API Docs for: 2.6
Show:

voicemail Class

Module: voicemail

Provides the voicemail functionalities.

Methods

deletedVoiceMessage

(
  • voicemail
)
private

It's the callback function called when a user has deleted a voicemail message.

Parameters:

  • voicemail String

    The voicemail identifier

deletedVoiceMessageCb

(
  • err
  • voicemail
  • results
)
private

It's the callback function called when get new voicemail messages from the database component, after a voicemail message has been deleted by a user.

Parameters:

  • err Object

    The error

  • voicemail String

    The voicemail identifier

  • results Object

    The results

deleteVoiceMessage

(
  • id
  • cb
)
private

Delete the specified voice message.

Parameters:

  • id String

    The voice message identifier in the database

  • cb Function

    The callback function

getAllVoiceMessagesByUser

(
  • username
  • cb
)

Gets the list of all voice messages of the user, new and old. If the user doesn't have the voicemail, it calls the callback with false value as a result.

Parameters:

  • username String

    The username

  • cb Function

    The callback function

getNewMessagesOfVoicemail

(
  • vm
  • cb
)

Gets the list of new messages of the specified voicemail.

Parameters:

  • vm String

    The voicemail identifier

  • cb Function

    The callback function

getNewVoiceMessageCountAllUsers

(
  • cb
)

Gets the number of new voice messages of all users.

Parameters:

  • cb Function

    The callback function

getNewVoiceMessagesByUser

(
  • username
  • cb
)

Gets the list of new voice messages of the user. If the user doesn't have the voicemail, it calls the callback with false value as a result.

Parameters:

  • username String

    The username

  • cb Function

    The callback function

getVmIdFromDbId

(
  • dbid
  • cb
)
private

Returns the voicemail identifier from the voice message identifier of the database.

Parameters:

  • dbid String

    The voice message identifier in the database

  • cb Function

    The callback function

listenedVoiceMessage

(
  • voicemail
)
private

It's the callback function called when a user has listened a voicemail message.

Parameters:

  • voicemail String

    The voicemail identifier

listenedVoiceMessageCb

(
  • err
  • voicemail
  • results
)
private

It's the callback function called when get new voicemail messages from the database component, after a voicemail message has been listened by a user.

Parameters:

  • err Object

    The error

  • voicemail String

    The voicemail identifier

  • results Object

    The results

listenVoiceMessage

(
  • id
  • cb
)
private

Listen the specified voice message.

Parameters:

  • id String

    The voice message identifier in the database

  • cb Function

    The callback function

newVoiceMessage

(
  • ev
)
private

New voicemail message has been left in a voicemail. It gets all the new voice messages of the voicemail and emits the EVT_NEW_VOICEMAIL event with all the new voice messages.

Parameters:

  • ev Object

    The event data

newVoiceMessageCb

(
  • err
  • voicemail
  • results
)
private

It's the callback function called when get new voicemail messages from the database component after a new voice message has been left in a voicemail.

Parameters:

  • err Object

    The error

  • voicemail String

    The voicemail identifier

  • results Object

    The results

on

(
  • type
  • cb
)
Object

Subscribe a callback function to a custom event fired by this object. It's the same of nodejs events.EventEmitter.on method.

Parameters:

  • type String

    The name of the event

  • cb Function

    The callback to execute in response to the event

Returns:

Object:

A subscription handle capable of detaching that subscription.

setAstProxy

(
  • ap
)

Set the asterisk proxy to be used by the module.

Parameters:

  • ap Object

setAstProxyListeners

() private

Sets the event listeners for the asterisk proxy component.

setCompUser

(
  • cu
)
static

Set the user architect component.

Parameters:

  • cu Object

    The architect user component

setDbconn

(
  • dbConnMod
)

Set the module to be used for database functionalities.

Parameters:

  • dbConnMod Object

    The dbconn module.

setDbconnListeners

() private

Sets the event listeners for the database 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.

start

()

Adds the listener to the asterisk proxy component.

updateVoiceMessages

(
  • ev
)
private

Something has changed in voice messages of a voicemail. It gets all the new voice messages of the voicemail and emits the EVT_UPDATE_NEW_VOICEMAIL event with all the new voice messages.

Parameters:

  • ev Object

    The event data

updateVoiceMessagesCb

(
  • err
  • voicemail
  • results
)
private

It's the callback function called when get new voicemail messages from the database component, after something has changed to a voice messages of a voicemail.

Parameters:

  • err Object

    The error

  • voicemail String

    The voicemail identifier

  • results Object

    The results

Properties

astProxy

Object private

The asterisk proxy.

compUser

Object private

The architect component to be used for user functions.

dbconn

Object private

The dbconn module.

emitter

Object private

The event emitter.

EVT_NEW_VOICE_MESSAGE

String

The name of the new voicemail event.

Default: "newVoiceMessage"

EVT_UPDATE_NEW_VOICE_MESSAGES

String

The name of event for the update of the new voice messages.

Default: "updateNewVoiceMessages"

IDLOG

String private final

The module identifier used by the logger.

Default: [voicemail]

logger

Object private

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

Default: console

Events

newVoiceMessage

Fired when a new voice message has been left in a voicemail.

Event Payload:

  • voicemails Object

    The list of all the new voice messages of the voicemail

updateNewVoiceMessages

Fired when a new voice message has been left in a voicemail, or a voice message has been listened or deleted.

Event Payload:

  • voicemails Object

    The list of all the new voice messages of the voicemail