API Docs for: 2.6
Show:

proxy_logic_11 Class

Module: proxy_logic_11
Parent Module: ast_proxy

This is the asterisk proxy logic linked to version 11 of the asterisk server.

Item Index

Methods

Methods

addConversationToExten

(
  • exten
  • resp
  • chid
)
private

Add new conversation to the extension.

Parameters:

  • exten String

    The extension number

  • resp Object

    The channel list object received by the listChannels command plugin

  • chid String

    The channel identifier

addConversationToTrunk

(
  • trunk
  • resp
  • chid
)
private

Add new conversation to the trunk.

Parameters:

  • trunk String

    The trunk number

  • resp Object

    The channel list object received by the listChannels command plugin

  • chid String

    The channel identifier

addPrefix

(
  • num
)
String

Adds a prefix to the number only if it is not already present and if it is not an extension.

Parameters:

  • num String

    The number to call

Returns:

String:

The number to call

addQueueMemberLoggedIn

(
  • data
  • queueId
)
private

Add a member to the queue with logged status set to in.

Parameters:

  • data Object
    • member String

      The member identifier

    • paused Boolean

      The paused status of the member

    • name String

      The name of the member

    • type String

      The type of the member (dynamic, static, realtime)

    • callsTakenCount Number

      The number of the taken calls

    • lastCallTimestamp Number

      The timestamp of the last call received by the member

  • queueId String

    The queue identifier

addQueueMemberLoggedOut

(
  • memberId
  • queueId
)
private

Add a member to a queue with logged status set to out.

Parameters:

  • memberId String

    The queue member identifier

  • queueId String

    The queue identifier

attendedTransferConvCb

(
  • err
)
private

This is the callback of attendedTransfer command plugin.

Parameters:

  • err Object

    The error object of the operation

attendedTransferConversation

(
  • endpointType
  • endpointId
  • convid
  • to
  • cb
)

Attended transfer the conversation.

Parameters:

  • endpointType String

    The type of the endpoint (e.g. extension, queue, parking, trunk...)

  • endpointId String

    The endpoint identifier (e.g. the extension number)

  • convid String

    The conversation identifier

  • to String

    The destination number to redirect the conversation

  • cb Function

    The callback function

call

(
  • endpointType
  • endpointId
  • to
  • extenForContext
  • cb
)

Make a new call.

Parameters:

  • endpointType String

    The type of the endpoint (e.g. extension, queue, parking, trunk...)

  • endpointId String

    The endpoint identifier (e.g. the extension number)

  • to String

    The destination number

  • extenForContext String

    The extension to be used to get the "context" to make the new call

  • cb Function

    The callback function

callAndSendDTMFSequence

(
  • chanType
  • extension
  • sequence
  • callerid
  • fromExten
  • cb
)
private

Call and then send sequence of DTMF digits to the specified extension.

Parameters:

  • chanType String

    The technology of the channel (e.g. SIP, IAX, ...)

  • extension String

    The extension identifier

  • sequence String

    The sequence of DTMF tones

  • callerid String

    The caller identifier

  • fromExten String

    The extension identifier from which the command has to be sent

  • cb Function

    The callback function

callCb

(
  • error
)
private

This is the callback of the call command plugin.

Parameters:

  • error Object

    The error object of the operation

endMeetmeConf

(
  • confId
  • cb
)

Ends the entire meetme conference.

Parameters:

  • confId String

    The conference identifier

  • cb Function

    The callback function

evtAddMeetmeUserConf

(
  • data
)

A user extension has joined the meetme conference. So update info about the conference.

Parameters:

  • data Object

    The response object received from the event plugin meetmejoin.

    • name String

      The name of the user

    • userId String

      The user identifier in the conference

    • extenId String

      The extension identifier in the conference

    • confId String

      The conference identifier

evtConversationConnected

(
  • num1
  • num2
)

If the involved numbers are extensions, it updates their conversations.

Parameters:

  • num1 String

    One of the two connected numbers

  • num2 String

    The other of the two connected numbers

evtConversationDialing

(
  • data
)

If the involved numbers are extensions, it updates their conversations. If the called is an extension it emits a dialing event to him with caller identity.

Parameters:

  • data Object

    The data received from the dial event plugin

evtExtenDndChanged

(
  • exten
  • enabled
)
private

Updates the extension dnd status.

Parameters:

  • exten String

    The extension number

  • enabled Boolean

    True if the dnd is enabled

evtExtenStatusChanged

(
  • exten
  • statusCode
)
private

Updates the extension status and any other information except the channel list. To update the channel list it request all channels to analize through "listChannels" command plugin.

Parameters:

  • exten String

    The extension number

  • statusCode String

    The numeric status code as arrived from asterisk

evtExtenUnconditionalCfChanged

(
  • exten
  • enabled
  • [to]
)
private

Updates the extension unconditional call forward status.

Parameters:

  • exten String

    The extension number

  • enabled Boolean

    True if the call forward is enabled

  • [to] String optional

    The destination number of the call forward

evtExtenUnconditionalCfVmChanged

(
  • exten
  • enabled
  • [vm]
)
private

Updates the extension unconditional call forward to voicemail status.

Parameters:

  • exten String

    The extension number

  • enabled Boolean

    True if the call forward to voicemail is enabled

  • [vm] String optional

    The destination voicemail number of the call forward

evtHangupConversation

(
  • data
)

It's called when an Hangup event is raised from the asterisk. It is called from the hangup event plugin.

Parameters:

  • data Object

    The data received from hangup event plugin

evtMeetmeUserConfMute

(
  • data
)

The mute status of a meetme user conference has been changed. So update info about the conference.

Parameters:

  • data Object

    The response object received from the event plugin meetmemute.

evtNewCdr

(
  • data
)
private

New call detail records (cdr) has been logged into the call history. So it emits the EVT_NEW_CDR event.

Parameters:

  • data Object
    • source String

      The calling party’s caller ID number

    • channel String

      The calling party’s channel

    • endtime String

      The end time of the call

    • duration String

      The number of seconds between the start and end times for the call

    • amaflags String

      The Automatic Message Accounting (AMA) flag associated with this call. This may be one of the following: OMIT, BILLING, DOCUMENTATION, or Unknown

    • uniqueid String

      The unique ID for the src channel

    • callerid String

      The full caller ID, including the name, of the calling party

    • starttime String

      The start time of the call

    • answertime String

      The answered time of the call

    • destination String

      The destination extension for the call

    • disposition String

      An indication of what happened to the call. This may be NO ANSWER, FAILED, BUSY, ANSWERED, or UNKNOWN

    • lastapplication String

      The last dialplan application that was executed

    • billableseconds String

      The number of seconds between the answer and end times for the call

    • destinationcontext String

      The destination context for the call

    • destinationchannel String

      The called party’s channel

evtNewExternalCall

(
  • number
)

A new external call is received. So it retrieves the data about the caller. It gets the created caller notes for the specified number and the central and cti phonebook contacts. Then add the data into the callerIdentityData property to use it when Dialing events are received. This method is called by the plugins_event_11/userevent.js.

Parameters:

  • number String

    The caller number

evtNewQueueWaitingCaller

(
  • data
)

Adds a new waiting caller to a queue.

Parameters:

  • data Object

    The response object received from the event plugin join.

evtNewVoicemailMessage

(
  • data
)
private

New voice messages has been left. So it emits the EVT_NEW_VOICEMAIL event.

Parameters:

  • data Object
    • context String

      The context of the voicemail extension

    • countNew String

      The number of the new voicemail messages

    • countOld String

      The number of the old voicemail messages

    • voicemail String

      The voicemail identifier who received the voice message

evtQueueMemberAdded

(
  • data
)
private

An event about queue member added has been received from the asterisk.

Parameters:

  • data Object
    • type String

      The membership type (static or dynamic)

    • name String

      The name of the member

    • queueId String

      The queue identifier

    • member String

      The queue member identifier

    • paused Boolean

      True if the extension has been paused from the queue

    • lastCallTimestamp Number

      The timestamp of the last call received by the member

    • callsTakenCount Number

      The number of the taken calls

evtQueueMemberPausedChanged

(
  • queueId
  • memberId
  • paused
  • reason
)
private

Updates the queue member paused status and it start time.

Parameters:

  • queueId String

    The queue identifier

  • memberId String

    The queue member identifier

  • paused Boolean

    True if the extension has been paused from the queue

  • reason String

    True reason description of the pause

evtQueueMemberRemoved

(
  • data
)
private

An event about queue member removed has been received from the asterisk. So updates the queue member status.

Parameters:

  • data Object
    • queueId String

      The queue identifier

    • member String

      The queue member identifier

evtQueueMemberStatus

(
  • data
)
private

An event about queue member status has been received from the asterisk. It updates the data about the queue member.

Parameters:

  • data Object
    • type String

      The membership type (static or dynamic)

    • name String

      The name of the member

    • queueId String

      The queue identifier

    • member String

      The queue member identifier

    • paused Boolean

      True if the extension has been paused from the queue

    • lastCallTimestamp Number

      The timestamp of the last call received by the member

    • callsTakenCount Number

      The number of the taken calls

evtRemoveMeetmeConf

(
  • data
)

A meetme conference has been ended. So update info about the conference.

Parameters:

  • data Object

    The response object received from the event plugin meetmeend.

evtRemoveMeetmeUserConf

(
  • data
)

A user extension has left the meetme conference. So update info about the conference.

Parameters:

  • data Object

    The response object received from the event plugin meetmeleave.

evtRemoveQueueWaitingCaller

(
  • data
)

A queue waiting caller has left the queue. So update all queue waiting callers.

Parameters:

  • data Object

    The response object received from the event plugin leave.

evtRename

() private

An event about channel renaming has been received from the asterisk. It updates the waiting callers of all queues.

evtSpyStartConversation

(
  • data
)

If the involved spier is an extensions, it updates its conversations.

Parameters:

  • data Object

    The data received from the __ event plugin

evtUpdateVoicemailMessages

(
  • data
)
private

Something has appens in the voice messages of the voicemail, for example the listen of a new voice message from the phone. So it emits the EVT_UPDATE_VOICE_MESSAGES event.

Parameters:

  • data Object
    • context String

      The context of the voicemail extension

    • voicemail String

      The voicemail identifier who received the voice message

extenStatus

(
  • err
  • resp
)
private

Sets the extension status received.

Parameters:

  • err Object

    The received error object

  • resp Object

    The received response object

extIaxDetails

(
  • resp
)
private

Sets the details for the iax extension object.

Parameters:

  • resp Object

    The extension information object

extSipDetails

(
  • err
  • resp
)
private

Sets the details for the sip extension object.

Parameters:

  • err Object

    The error object

  • resp Object

    The extension information object

forceHangupConversation

(
  • endpointType
  • endpointId
  • convid
  • extForCtx
  • cb
)

Force hangup of the conversation.

Parameters:

  • endpointType String

    The type of the endpoint (e.g. extension, queue, parking, trunk...)

  • endpointId String

    The endpoint identifier (e.g. the extension number)

  • convid String

    The conversation identifier

  • extForCtx String

    The extension identifier used to get the context

  • cb Function

    The callback function

getBaseCallRecAudioPath

() String

Returns the base path of the call recording audio files.

Returns:

String:

The base path of the call recording audio files.

getConference

() Object

Returns a conference of the extension.

Returns:

Object:

The MeetmeConference object.

getEchoCallDestination

() String

Returns the destination number to compose to make a new echo call.

Returns:

String:

The destination number to compose to make a new echo call.

getExtenIdChannelConversation

(
  • exten
  • convid
)
String private

Return a channel identifier of the conversation of the specified extension. If the source channel is present it will returned its id, otherwise the destination channel id will be returned. It is useful for those operation in which the channel type is not important (e.g. the hangup operation).

Parameters:

  • exten String

    The extension number

  • convid String

    The conversation identifier

Returns:

String:

The channel identifier or undefined value if it's not present.

getExtenIdSourceChannelConversation

(
  • exten
  • convid
)
Object private

Return the identifier of the source channel of the conversation of the specified extension. If the source channel isn't present, undefined will be returned. It is useful for those operation in which the channel type is important. For example the start and stop record call must be executed on the same channel.

Parameters:

  • exten String

    The extension number

  • convid String

    The conversation identifier

Returns:

Object:

The identifier of the source channel or undefined value if it's not present.

getExtensionAgent

(
  • exten
)
String

Returns the extension user agent.

Parameters:

  • exten String

    The extension identifier

Returns:

String:

The extension user agent.

getExtensionIp

(
  • exten
)
String

Returns the IP address of the extension.

Parameters:

  • exten String

    The extension identifier

Returns:

String:

The IP address of the extension.

getExtensions

() Object

Return the extension list.

Returns:

Object:

The extensions object.

getExtensionsFromConversation

(
  • convid
  • exten
)
Array private

Returns the extensions involved in the specified conversation.

Parameters:

  • convid String

    The conversation identifier

  • exten String

    The extension identifier which has the conversation

Returns:

Array:

The extensions involved in the conversation.

getExtenSourceChannelConversation

(
  • exten
  • convid
)
Object private

Return the source channel of the conversation of the specified extension. If the source channel isn't present, undefined will be returned. It is useful for those operation in which the channel type is important. For example the start and stop record call must be executed on the same channel.

Parameters:

  • exten String

    The extension number

  • convid String

    The conversation identifier

Returns:

Object:

The source channel or undefined value if it's not present.

getJSONAgentsStats

(
  • day
  • callback
)
Object

Return the JSON representation of agent stats.

Parameters:

  • day String

    The day expressed in YYYYMMDD format

  • callback Function

    The callback function

Returns:

Object:

The JSON representation of agent stats.

getJSONExtension

(
  • exten
  • [privacyStrOutQueue]
  • [privacyStrInQueue]
)
Object

Returns the JSON representation of the extension. If some error occurs it returns an empty object.

Parameters:

  • exten String

    The extension identifier

  • [privacyStrOutQueue] String optional

    If it is specified, it obfuscates the number of all calls that does not pass through a queue

  • [privacyStrInQueue] String optional

    If it is specified, it obfuscates the number of all calls that pass through a queue

Returns:

Object:

The JSON representation of the extension.

getJSONExtensions

(
  • [privacyStrOutQueue]
  • [privacyStrInQueue]
)
Object

Returns the JSON representation of all the extensions. If some error occurs it returns an empty object.

Parameters:

  • [privacyStrOutQueue] String optional

    If it is specified, it obfuscates the number of all calls that does not pass through a queue

  • [privacyStrInQueue] String optional

    If it is specified, it obfuscates the number of all calls that pass through a queue

Returns:

Object:

The JSON representation of the all extensions.

getJSONParkings

(
  • [privacyStr]
)
Object

Returns the JSON representation of all parkings.

Parameters:

  • [privacyStr] String optional

    If it's specified, it hides the last digits of the phone number

Returns:

Object:

The JSON representation of all parkings.

getJSONQueues

(
  • [privacyStr]
)
Object

Returns the JSON representation of all queues.

Parameters:

  • [privacyStr] String optional

    If it's specified, it hides the last digits of the phone number

Returns:

Object:

The JSON representation of all queues.

getJSONQueuesQOS

(
  • day
  • callback
)
Object

Return the JSON representation of queues QOS.

Parameters:

  • day String

    The day expressed in YYYYMMDD format

  • callback Function

    The callback function

Returns:

Object:

The JSON representation of queues QOS.

getJSONQueuesStats

(
  • day
  • callback
)
Object

Return the JSON representation of extended queue statistics.

Parameters:

  • day String

    The day expressed in YYYYMMDD format

  • callback Function

    The callback function

Returns:

Object:

The JSON representation of extended queue statistics.

getJSONTrunks

(
  • [privacyStr]
)
Object

Returns the JSON representation of all trunks.

Parameters:

  • [privacyStr] String optional

    If it's specified, it hides the last digits of the phone number

Returns:

Object:

The JSON representation of all trunks.

getMeetmeConfCode

() Object static

Returns the code used to start a meetme conference.

Returns:

Object:

The code used to start a meetme conference.

getPrefix

() String static

Returns the prefix number used in all outgoing calls. It is not used with internal calls between extensions.

Returns:

String:

prefix The prefix number.

getQueueIdsOfExten

(
  • extenId
)
Object

Returns all the queue identifiers to which the specified extension belongs.

Parameters:

  • extenId String

    The extension identifier

Returns:

Object:

The queue identifier list as keys of an object.

getRecordFilename

(
  • exten
  • convid
  • now
)
String private

Returns the name of the audio file to record the conversation of the specified extension.

Parameters:

  • exten String

    The extension number

  • convid String

    The conversation identifier

  • now Object

    A date object

Returns:

String:

The name of the audio file or undefined value if it is not present.

getRecordFilepath

(
  • exten
  • convid
  • now
)
String private

Returns the path of the audio file to record the conversation of the specified extension.

Parameters:

  • exten String

    The extension number

  • convid String

    The conversation identifier

  • now Object

    A date object

Returns:

String:

The path of the audio file or undefined value if it is not present.

hangupChannel

(
  • endpointType
  • endpointId
  • ch
  • cb
)

Hangup the asterisk channel of the endpoint.

Parameters:

  • endpointType String

    The type of the endpoint (e.g. extension, queue, parking, trunk...)

  • endpointId String

    The endpoint identifier (e.g. the extension number)

  • ch String

    The channel identifier

  • cb Function

    The callback function

hangupConvCb

(
  • err
)
private

This is the callback of the hangup command plugin.

Parameters:

  • err Object

    The error object of the operation

hangupConversation

(
  • endpointType
  • endpointId
  • convid
  • cb
)

Hangup the conversation of the endpoint.

Parameters:

  • endpointType String

    The type of the endpoint (e.g. extension, queue, parking, trunk...)

  • endpointId String

    The endpoint identifier (e.g. the extension number)

  • convid String

    The conversation identifier

  • cb Function

    The callback function

hangupUserMeetmeConf

(
  • confId
  • extenId
  • cb
)

Hangup a user of a meetme conference.

Parameters:

  • confId String

    The meetme conference identifier

  • extenId String

    The extension indentifier into the conference

  • cb Function

    The callback function

iaxExtenStructValidation

(
  • err
  • resp
)
private

Validates all iax extensions of the structure ini file and initialize iax Extension objects.

Parameters:

  • err Object

    The error received from the command.

  • resp Array

    The response received from the command.

iaxTrunkStructValidation

(
  • err
  • resp
)
private

Validates all iax trunks of the structure ini file and initialize iax Trunk objects.

Parameters:

  • err Object

    The error received from the command

  • resp Array

    The response received from the command

initializeIaxExten

(
  • resp
)
private

Initialize all iax extensions as Extension object into the extensions property.

Parameters:

  • resp Object

    The response of the listIaxPeers command plugin.

initializeIaxTrunk

(
  • resp
)
private

Initialize all iax trunks as Trunk object into the trunks property.

Parameters:

  • resp Object

    The response of the listIaxPeers command plugin.

initializeParkings

() private

Initialize all parkings as Parking object into the parkings property.

initializeQueues

() private

Initialize all queues as Queue object into the queues property.

initializeSipExten

() private

Initialize all sip extensions as Extension object into the extensions property.

initializeSipTrunk

() private

Initialize all sip trunks as Trunk object into the trunks property.

initMeetmeConf

() private

Initializes all meetme conferences.

inoutDynQueues

(
  • endpointType
  • endpointId
  • cb
)

Alternates the logon and logout of the specified extension in all the queues for which it's a dynamic member.

Parameters:

  • endpointType String

    The type of the endpoint (e.g. extension, queue, parking, trunk...)

  • endpointId String

    The endpoint identifier (e.g. the extension number)

  • cb Function

    The callback function

isDynMemberLoggedInQueue

(
  • extenId
  • queueId
)
Boolean

Checks if the specified queue dynamic member is logged into the specified queue.

Parameters:

  • extenId String

    The extension identifier

  • queueId String

    The queue identifier

Returns:

Boolean:

True if the specified queue dynamic member is logged into the specified queue.

isExtenDynMemberQueue

(
  • extenId
  • queueId
)
Boolean

Checks if the specified extension is a dynamic member of the specified queue.

Parameters:

  • extenId String

    The extension identifier

  • queueId String

    The queue identifier

Returns:

Boolean:

True if the specified extension is a dynamic member of the specified queue.

isExtenInMeetmeConf

(
  • ownerExtenId
)
Boolean

Returns true if the extension is already into its meetme conference.

Parameters:

  • ownerExtenId String

    The extension owner of the conference

Returns:

Boolean:

True if the extension is already into its meetme conference.

isExtenWebrtc

(
  • extenId
)
Boolean

Checks if the specified extension is a WebRTC using websocket.

Parameters:

  • extenId String

    The extension identifier

Returns:

Boolean:

True if the specified extension is a WebRTC.

listIaxPeers

() private

Sets the details for all iax extension object.

listParkedChannels

(
  • err
  • resp
)
private

Store parked channels in memory and launch "listChannel" command plugin to get the number and the name of each parked channels.

Parameters:

  • err Object

    The error object received from the "listParkedChannels" command plugin

  • resp Object

    The reponse object received from the "listParkedChannels" command plugin

muteCb

(
  • error
)
private

This is the callback of the mute command plugin.

Parameters:

  • error Object

    The error object of the operation

muteConversation

(
  • endpointType
  • endpointId
  • convid
  • cb
)

Mute a call.

Parameters:

  • endpointType String

    The type of the endpoint (e.g. extension, queue, parking, trunk...)

  • endpointId String

    The endpoint identifier (e.g. the extension number)

  • convid String

    The conversation identifier to be muted

  • cb Function

    The callback function

muteRecordConversation

(
  • endpointType
  • endpointId
  • convid
  • cb
)

Mute the recording of the conversation.

Parameters:

  • endpointType String

    The type of the endpoint (e.g. extension, queue, parking, trunk...)

  • endpointId String

    The endpoint identifier (e.g. the extension number)

  • convid String

    The conversation identifier

  • cb Function

    The callback function

muteUserMeetmeConf

(
  • confId
  • userId
  • cb
)

Mute a user of a meetme conference.

Parameters:

  • confId String

    The meetme conference identifier

  • userId String

    The user indentifier into the conference

  • cb Function

    The callback function

muteUserMeetmeConfCb

(
  • error
)
private

This is the callback of the mute user of a meetme conference command plugin.

Parameters:

  • error Object

    The error object of the operation

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.

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.

parkConversation

(
  • endpointType
  • endpointId
  • convid
  • applicantId
  • cb
)

Park the conversation.

Parameters:

  • endpointType String

    The type of the endpoint (e.g. extension, queue, parking, trunk...)

  • endpointId String

    The endpoint identifier (e.g. the extension number)

  • convid String

    The conversation identifier

  • applicantId String

    The applicant identifier of the park operation (e.g. the extension number)

  • cb Function

    The callback function

parkStructValidation

(
  • err
  • resp
)
private

Validates all parkings of the structure ini file.

Parameters:

  • err Object

    The error received from the command.

  • resp Array

    The response received from the command.

pickupConversation

(
  • endpointType
  • endpointId
  • convid
  • destType
  • destId
  • extForCtx
  • cb
)

Pickup a conversation.

Parameters:

  • endpointType String

    The type of the endpoint (e.g. extension, queue, parking, trunk...)

  • endpointId String

    The endpoint identifier (e.g. the extension number)

  • convid String

    The conversation identifier

  • destType String

    The endpoint type that pickup the conversation

  • destId String

    The endpoint identifier that pickup the conversation

  • extForCtx String

    The extension identifier used to get the context

  • cb Function

    The callback function

pickupParking

(
  • parking
  • destType
  • destId
  • extForCtx
  • cb
)

Pickup a parked caller.

Parameters:

  • parking String

    The number of the parking

  • destType String

    The endpoint type that pickup the conversation

  • destId String

    The endpoint identifier that pickup the conversation

  • extForCtx String

    The extension identifier used to get the context

  • cb Function

    The callback function

queueDetails

(
  • err
  • resp
)
private

Sets the details for the queue object. The details include the members and the waiting callers.

Parameters:

  • err Object

    The error response object

  • resp Object

    The queue information object

queueDetailsUpdate

(
  • err
  • resp
)
private

Updates the details for the queue object.

Parameters:

  • err Object

    The error response object

  • resp Object

    The queue information object

queueMemberAdd

(
  • endpointType
  • endpointId
  • queueId
  • [paused]
  • [penalty]
  • cb
)

Adds the member to the queue.

Parameters:

  • endpointType String

    The type of the endpoint (e.g. extension, queue, parking, trunk...)

  • endpointId String

    The endpoint identifier (e.g. the extension number)

  • queueId String

    The queue identifier

  • [paused] String optional

    To pause or not the member initially

  • [penalty] Boolean optional

    A penalty (number) to apply to this member. Asterisk will distribute calls to members with higher penalties only after attempting to distribute calls to those with lower penalty

  • cb Function

    The callback function

queueMemberPauseUnpause

(
  • endpointType
  • endpointId
  • queueId
  • reason
  • paused
  • cb
)

Pause or unpause an extension from a specific queue or from all queues omitting the queueId parameter.

Parameters:

  • endpointType String

    The type of the endpoint (e.g. extension, queue, parking, trunk...)

  • endpointId String

    The endpoint identifier (e.g. the extension number)

  • queueId String

    The queue identifier

  • reason String

    The textual description of the reason. In the unpause case, simply it's ignored

  • paused Boolean

    If the extension must be paused or unpaused. If it's true the extension will be paused from the queue

  • cb Function

    The callback function

queueMemberRemove

(
  • endpointType
  • endpointId
  • queueId
  • cb
)

Removes the extension from a specific queue.

Parameters:

  • endpointType String

    The type of the endpoint (e.g. extension, queue, parking, trunk...)

  • endpointId String

    The endpoint identifier (e.g. the extension number)

  • queueId String

    The queue identifier

  • cb Function

    The callback function

queueStructValidation

(
  • err
  • resp
)
private

Validates all queues of the structure ini file.

Parameters:

  • err Object

    The error received from the command.

  • resp Array

    The response received from the command.

recordAudioFile

(
  • data
  • cb
)

Record an audio file.

Parameters:

  • data Object
    • exten String

      The extension to be used for recording

    • filepath String

      The path of the audio file to be stored

  • cb Function

    The callback function

redirectConvCb

(
  • err
)
private

This is the callback of the redirectChannel command plugin.

Parameters:

  • err Object

    The error object of the operation

redirectConversation

(
  • endpointType
  • endpointId
  • convid
  • to
  • extForCtx
  • cb
)

Redirect the conversation.

Parameters:

  • endpointType String

    The type of the endpoint (e.g. extension, queue, parking, trunk...)

  • endpointId String

    The endpoint identifier (e.g. the extension number)

  • convid String

    The conversation identifier

  • to String

    The destination number to redirect the conversation

  • extForCtx String

    The extension identifier used to get the context

  • cb Function

    The callback function

redirectParking

(
  • parking
  • to
  • extForCtx
  • cb
)

Redirect the parked call to the specified destination.

Parameters:

  • parking String

    The identifier of the parking

  • to String

    The destination number to redirect the parked call

  • extForCtx String

    The extension identifier used to get the context

  • cb Function

    The callback function

redirectWaitingCaller

(
  • waitingCallerId
  • queue
  • to
  • extForCtx
  • cb
)

Redirect the waiting caller from the queue to the specified destination.

Parameters:

  • waitingCallerId String

    The identifier of the waiting caller

  • queue String

    The identifier of the queue in which the caller waiting

  • to String

    The destination number to redirect the conversation

  • extForCtx String

    The extension identifier used to get the context

  • cb Function

    The callback function

sendDTMFSequence

(
  • extension
  • sequence
  • callerid
  • fromExten
  • cb
)
private

Sends the DTMF tones to the specified extension. If the extension as already busy in a conversation, or it's calling, then one channel already exists and then use it to play DTMF. Otherwise, if the extension is free, it calls the extension and then sends the DTMF digits.

Parameters:

  • extension String

    The extension identifier

  • sequence Boolean

    The DTMF digits to send to the extension

  • callerid String

    The caller identifier

  • fromExten String

    The extension identifier from which the command has to be sent

  • cb Function

    The callback function

sendDTMFSequenceToChannel

(
  • channel
  • sequence
  • cb
)
private

Play sequence of DTMF digits in the specified channel.

Parameters:

  • channel String

    The channel to play DTMF tones

  • sequence String

    The sequence of DTMF tones

  • cb Function

    The callback function

sendDtmfToConversation

(
  • endpointType
  • endpointId
  • convid
  • tone
  • cb
)

Sends the dtmf tone to the conversation destination.

Parameters:

  • endpointType String

    The type of the endpoint (e.g. extension)

  • endpointId String

    The endpoint identifier (e.g. the extension number)

  • convid String

    The conversation identifier

  • tone String

    The dtmf tone to send

  • cb Function

    The callback function

setAstCodes

(
  • codes
)
static

Sets the code numbers to be used.

Parameters:

  • codes Object

    The asterisk codes.

setCfStatus

(
  • err
  • resp
)
private

Set the call forward status of the extension.

Parameters:

  • err Object

    The error object of the cfGet command plugin.

  • resp Object

    The response object of the cfGet command plugin.

setCfVmStatus

(
  • err
  • resp
)
private

Sets the call forward to voicemail status of the extension.

Parameters:

  • err Object

    The error object of the cfVmGet command plugin.

  • resp Object

    The response object of the cfVmGet command plugin.

setCompCallerNote

(
  • comp
)

Sets the caller note architect component.

Parameters:

  • comp Object

    The caller note architect component.

setCompDbconn

(
  • comp
)

Sets the database architect component.

Parameters:

  • comp Object

    The database architect component.

setCompPhonebook

(
  • comp
)

Sets the phonebook architect component.

Parameters:

  • comp Object

    The phonebook architect component.

setDnd

(
  • exten
  • activate
  • cb
)

Enable/disable the do not disturb status of the endpoint. The used plugin command dndSet does not generate any asterisk events, so simulates it.

Parameters:

  • exten String

    The extension number

  • activate Boolean

    True if the dnd must be enabled

  • cb Function

    The callback function

setDndStatus

(
  • err
  • resp
)
private

Set the don't disturb status of the extension.

Parameters:

  • err Object

    The error object of the dndGet command plugin.

  • resp Object

    The response object of the dndGet command plugin.

setLogger

(
  • log
)
static

Sets 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.

setPrefix

(
  • prefix
)
static

Sets the prefix number to be used in all outgoing calls. It does not to be used with internal calls between extensions.

Parameters:

  • prefix String

    The prefix number.

setQueueData

(
  • q
  • resp
)
private

Sets the data for the queue object.

Parameters:

  • q String

    The queue name

  • resp Object

    The queue information object

setRecordStatusConversations

(
  • convid
  • value
)
private

Sets the recording status of all the conversations with the specified convid.

Parameters:

  • convid String

    The conversation identifier

  • value Boolean

    The value to be set

setRecordStatusMuteConversations

(
  • convid
)
private

Sets the recording status mute of all the conversations with the specified convid.

Parameters:

  • convid String

    The conversation identifier

setRemoteSitesPrefixes

(
  • obj
)
static

Sets the remote sites phone prefixes used to filter the meetme conference members.

Parameters:

  • obj Object

    The remote sites prefixes data.

setUnconditionalCf

(
  • exten
  • activate
  • [to]
  • cb
)

Enable/disable the unconditional call forward status of the endpoint. The used plugin command cfSet doesn't generate any asterisk events, so simulates it.

Parameters:

  • exten String

    The extension number

  • activate Boolean

    True if the call forward must be enabled

  • [to] String optional

    The destination number of the call forward to be set

  • cb Function

    The callback function

setUnconditionalCfVm

(
  • exten
  • activate
  • [to]
  • cb
)

Enable/disable the call forward to voicemail status of the endpoint. The used plugin command cfVmSet doesn't generate any asterisk events, so simulates it.

Parameters:

  • exten String

    The extension number

  • activate Boolean

    True if the call forward to voicemail must be enabled

  • [to] String optional

    The destination voicemail identifier of the call forward to be set

  • cb Function

    The callback function

sipExtenStructValidation

(
  • err
  • resp
)
private

Validates all sip extensions of the structure ini file and initialize sip Extension objects.

Parameters:

  • err Object

    The error received from the command

  • resp Array

    The response received from the command

sipTrunkStatus

(
  • err
  • resp
)
private

Sets the sip trunk status received.

Parameters:

  • err Object

    The received error object

  • resp Object

    The received response object

sipTrunkStructValidation

(
  • err
  • resp
)
private

Validates all sip trunks of the structure ini file and initialize sip Trunk objects.

Parameters:

  • err Object

    The error received from the command

  • resp Array

    The response received from the command

start

() static

It's called when the asterisk connection is fully booted.

startIntervalUpdateQueuesDetails

(
  • interval
)
private

Updates the data about all queues each interval of time.

Parameters:

  • interval Number

    The interval time to update the details of all the queues.

startMeetmeConference

(
  • convid
  • ownerExtenId
  • addExtenId
  • cb
)

Starts a meetme conference. Its behaviour change based on owner extension status of the conference.

Parameters:

  • convid String

    The conversation identifier of the owner to be added to the conference

  • ownerExtenId String

    The extension owner of the conference

  • addExtenId String

    The extension identifier to be added to the conference

  • cb Function

    The callback function

startRecordCallCb

(
  • convid
)
private

Sets the recording status of the conversations.

Parameters:

  • convid String

    The conversation identifier

startRecordConversation

(
  • endpointType
  • endpointId
  • convid
  • cb
)

Starts the recording of the conversation.

Parameters:

  • endpointType String

    The type of the endpoint (e.g. extension, queue, parking, trunk...)

  • endpointId String

    The endpoint identifier (e.g. the extension number)

  • convid String

    The conversation identifier

  • cb Function

    The callback function

startSpyListenConvCb

(
  • err
  • convid
)
private

This is the callback of the spy command plugin with only listening.

Parameters:

  • err Object

    The error object of the operation

  • convid String

    The conversation identifier

startSpyListenConversation

(
  • convid
  • endpointId
  • endpointType
  • destType
  • destId
  • cb
)

Start the spy of the conversation with only listening.

Parameters:

  • convid String

    The conversation identifier

  • endpointId String

    The endpoint identifier that has the conversation to spy

  • endpointType String

    The type of the endpoint that has the conversation to spy

  • destType String

    The endpoint type that spy the conversation

  • destId String

    The endpoint identifier that spy the conversation

  • cb Function

    The callback function

startSpySpeakConvCb

(
  • err
  • convid
)
private

This is the callback of the spy command plugin with speaking.

Parameters:

  • err Object

    The error object of the operation

  • convid String

    The conversation identifier

startSpySpeakConversation

(
  • convid
  • endpointId
  • endpointType
  • destType
  • destId
  • cb
)

Start the spy of the conversation with speaking.

Parameters:

  • convid String

    The conversation identifier

  • endpointId String

    The endpoint identifier that has the conversation to spy

  • endpointType String

    The type of the endpoint that has the conversation to spy

  • destType String

    The endpoint type that spy the conversation

  • destId String

    The endpoint identifier that spy the conversation

  • cb Function

    The callback function

stopRecordCallCb

(
  • err
  • convid
)
private

This is the callback of the stop record call command plugin. Reset the record status of the conversations.

Parameters:

  • err Object

    The error object of the operation

  • convid String

    The conversation identifier

stopRecordConversation

(
  • endpointType
  • endpointId
  • convid
  • cb
)

Stop the recording of the conversation.

Parameters:

  • endpointType String

    The type of the endpoint (e.g. extension, queue, parking, trunk...)

  • endpointId String

    The endpoint identifier (e.g. the extension number)

  • convid String

    The conversation identifier

  • cb Function

    The callback function

structValidation

() private

Validates the asterisk structure of ini file created by the perl script. Ini file items that aren't present in the asterisk, will be removed from struct property.

transferConversationToVoicemail

(
  • endpointType
  • endpointId
  • convid
  • voicemail
  • extForCtx
  • cb
)

Transfer the conversation to the voicemail.

Parameters:

  • endpointType String

    The type of the endpoint (e.g. extension, queue, parking, trunk...)

  • endpointId String

    The endpoint identifier (e.g. the extension number)

  • convid String

    The conversation identifier

  • voicemail String

    The destination voicemail number to transfer the conversation

  • extForCtx String

    The extension identifier used to get the context

  • cb Function

    The callback function

transferConvToVoicemailCb

(
  • err
)
private

This is the callback of transferToVoicemail command plugin.

Parameters:

  • err Object

    The error object of the operation

trunkSipDetails

(
  • err
  • resp
)
private

Sets the details for the sip trunk object.

Parameters:

  • err Object

    The error object

  • resp Object

    The trunk information object

unmuteConversation

(
  • endpointType
  • endpointId
  • convid
  • cb
)

Unmute a call.

Parameters:

  • endpointType String

    The type of the endpoint (e.g. extension, queue, parking, trunk...)

  • endpointId String

    The endpoint identifier (e.g. the extension number)

  • convid String

    The conversation identifier to be unmuted

  • cb Function

    The callback function

unmuteRecordConversation

(
  • endpointType
  • endpointId
  • convid
  • cb
)

Unmute the recording of the conversation.

Parameters:

  • endpointType String

    The type of the endpoint (e.g. extension, queue, parking, trunk...)

  • endpointId String

    The endpoint identifier (e.g. the extension number)

  • convid String

    The conversation identifier

  • cb Function

    The callback function

unmuteUserMeetmeConf

(
  • confId
  • userId
  • cb
)

Unmute a user of a meetme conference.

Parameters:

  • confId String

    The meetme conference identifier

  • userId String

    The user indentifier into the conference

  • cb Function

    The callback function

unmuteUserMeetmeConfCb

(
  • error
)
private

This is the callback of the unmute user of a meetme conference command plugin.

Parameters:

  • error Object

    The error object of the operation

updateConversationsForAllExten

(
  • err
  • resp
)
private

Updates the conversations for all extensions.

Parameters:

  • err Object

    The error object

  • resp Object

    The channel list as received by the listChannels command plugin.

updateConversationsForAllTrunk

(
  • err
  • resp
)
private

Updates the conversations for all trunks.

Parameters:

  • err Object

    The error object

  • resp Object

    The channel list as received by the listChannels command plugin.

updateExtenConversations

(
  • err
  • resp
  • exten
)
private

Update the conversations of the extension.

Parameters:

  • err Object

    The error object received by the listChannels command plugin

  • resp Object

    The object received by the listChannels command plugin

  • exten String

    The extension number

updateExtIaxDetails

(
  • err
  • resp
)
private

Update iax extension information and emit EVT_EXTEN_CHANGED event.

Parameters:

  • err Object

    The error object

  • resp Object

    The iax extension information object

updateExtSipDetails

(
  • err
  • resp
)
private

Update extension information and emit EVT_EXTEN_CHANGED event.

Parameters:

  • err Object

    The error object

  • resp Object

    The extension information object

updateMeetmeConf

(
  • err
  • data
)
private

Updates data about a single meetme conference.

Parameters:

  • err Object

    The error response object

  • data Object

    The meetme conference information object

updateMeetmeConferences

(
  • err
  • data
)
private

Updates data about all meetme conferences.

Parameters:

  • err Object

    The error response object

  • data Object

    The meetme conferences information object

updateParkedCallerForAllParkings

(
  • err
  • resp
)
private

Updates all parking lost with their relative parked calls, if they are present.

Parameters:

  • err Object

    The error object

  • resp Object

    The object received from the "listChannels" command plugin

updateParkedCallerOfOneParking

(
  • err
  • resp
  • parking
)
private

Update the parked caller of the specified parking.

Parameters:

  • err Object

    The error received from the listChannels command plugin

  • resp Object

    The response received from the listChannels command plugin

  • parking String

    The parking identifier

updateParkedChannelOfOneParking

(
  • err
  • resp
  • parking
)
private

Updates specified parking key of the parkedChannels property with the object received from listParkedChannels command plugin.

Parameters:

  • err Object

    The error object received from listParkedChannels command plugin

  • resp Object

    The response object received from listParkedChannels command plugin

  • parking String

    The parking identifier

updateQueueMemberLastPauseData

(
  • memberName
  • memberId
  • queueId
)
private

Sets the "last started pause" and the "last ended pause" data to the member.

Parameters:

  • memberName String

    The queue member name

  • memberId String

    The queue member identifier

  • queueId String

    The queue identifier

updateQueueWaitingCallers

(
  • err
  • resp
)
private

Updates waiting callers of the queue object.

Parameters:

  • err Object

    The error response object

  • resp Object

    The queue information object

updateTrunkConversations

(
  • err
  • resp
  • trunk
)
private

Update the conversations of the extension.

Parameters:

  • err Object

    The error object received by the listChannels command plugin

  • resp Object

    The object received by the listChannels command plugin

  • trunk String

    The trunk number

visit

(
  • ap
)

Store the asterisk proxy to visit.

Parameters:

  • ap Object

    The asterisk proxy module.

Properties

astCodes

Object private

The asterisk codes.

Default: {}

astProxy

Object private

The asterisk proxy.

BASE_CALL_REC_AUDIO_PATH

Object private

The default base path for the recording call audio file.

Default: "/var/spool/asterisk/monitor"

callerIdentityData

Object private

Contains the information about the caller. The key is the caller number and the value is the information object. The data are about the created caller notes and the phonebook contacts from the centralized and nethcti address book that match on the caller number. The information are retrieved when a UserEvent is received and are used when Dialing events occurs. This is because when a call is directed to a queue, only one UserEvent is emitted and many Dialing events for each members of the queue. So it executes only one query per call. Due to asynchronous nature of the query, it may happen that when Dialing event occurs the query is not completed. In this case the information of the caller are those returned by the asterisk event. In this manner we give more importance to the speed rather than to information completeness.

Default: {}

compCallerNote

Object private

The caller note component.

compDbconn

Object private

The database component.

compPhonebook

Object private

The phonebook component.

conferences

Object private

All mettme conferences. The key is the extension owner number and the value is the MeetmeConference object.

emitter

Object private

The event emitter.

EVT_EXTEN_CHANGED

String

The name of the extension changed event.

Default: "extenChanged"

EVT_EXTEN_DIALING

String

The name of the extension dialing event.

Default: "extenDialing"

EVT_MEETME_CONF_CHANGED

String

The name of the meetme conference changed event.

Default: "meetmeConfChanged"

EVT_MEETME_CONF_END

String

The name of the meetme conference end event.

Default: "meetmeConfEnd"

EVT_NEW_CDR

String

The name of the new call detail records (cdr) event.

Default: "newCdr"

EVT_NEW_VOICE_MESSAGE

String

The name of the new voicemail event.

Default: "newVoiceMessage"

EVT_PARKING_CHANGED

String

The name of the parking changed event.

Default: "parkingChanged"

EVT_QUEUE_CHANGED

String

The name of the queue changed event.

Default: "queueChanged"

EVT_QUEUE_MEMBER_CHANGED

String

The name of the queue member changed event.

Default: "queueMemberChanged"

EVT_TRUNK_CHANGED

String

The name of the trunk changed event.

Default: "trunkChanged"

EVT_UPDATE_VOICE_MESSAGES

String

The name of the update voice messages event.

Default: "updateVoiceMessages"

extensions

Object private

All extensions. The key is the extension number and the value is the Extension object.

IDLOG

String private final

The module identifier used by the logger.

Default: [proxy_logic_11]

INI_STRUCT

Object private

These are the key names used into the asterisk structure file created by the perl script.

INTERVAL_UPDATE_QUEUE_DETAILS

Number private final

The interval time to update the details of all the queues.

Default: 60000

logger

Object private

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

Default: console

parkedChannels

Object private

It is used to store the parked channels to be used in conjunction with "listChannels" command plugin to get the number and name of the parked channels. The key is the parking number and the value is an object with the parked channel information.

parkings

Object private

All parkings. The key is the parkings number and the value is the Parking object.

prefix

String private

The prefix number to be used in outgoing call. It is not used in internal calls between extensions.

Default: ""

queues

Object private

All queues. The key is the queue number and the value is the Queue object.

recordingConv

Object private

Store the recording information about conversations. The key is the conversation identifier and the value is an empty string. The presence of the key means that the conversation is recording, otherwise not. It's necessary because asterisk hasn't the recording information. So, when conversation list is refreshed, it is used to set recording status to a conversation.

remoteSitesPrefixes

Object private

The remote sites phone prefixes.

struct

Object private

It's the validated content of the asterisk structure ini file created by the perl script.

trunks

Object private

All trunks. The key is the trunk number and the value is the Trunk object.

Events

extenChanged

Fired when something changed in an extension.

Event Payload:

  • msg Object

    The extension object

extenDialing

Fired when an extension ringing.

Event Payload:

  • data Object

    The caller identity

meetmeConfChanged

Fired when something changed in a meetme conference.

Event Payload:

  • msg Object

    The conference object

meetmeConfEnd

Fired when something a meetme conference has been ended.

Event Payload:

  • id String

    The conference identifier

newCdr

Fired when new call detail records (cdr) has been logged into the call history.

Event Payload:

  • msg Object

    The call detail records.

newVoiceMessage

Fired when new voicemail message has been left.

Event Payload:

  • msg Object

    The data about the voicemail, with the number of new and old messages

parkingChanged

Fired when something changed in a parking.

Event Payload:

  • msg Object

    The parking object

queueChanged

Fired when something changed in a queue.

Event Payload:

  • msg Object

    The queue object

queueMemberChanged

Fired when something changed in an queue member.

Event Payload:

  • msg Object

    The queue member object

trunkChanged

Fired when something changed in a trunk.

Event Payload:

  • msg Object

    The trunk object

updateVoiceMessages

Something has appen in the voice messages of the voicemail, for example the listen of a new voice message from the phone.

Event Payload:

  • msg Object

    The data about the voicemail