API Docs for:
Show:

Extension Class

Module: astproxy

Abstraction of an extension.

It can throw exceptions.

Constructor

Extension

(
  • ext
  • chType
)
Object

Parameters:

  • ext String

    The extension number

  • chType String

    The channel type, e.g. sip, iax

Returns:

Object:

The extension object.

Methods

addConversation

(
  • conv
)

Sets the conversation. If it already exists it will be overwritten.

Parameters:

  • conv Object

    The conversation object.

conversationCount

() Number

Return the conversation number.

Returns:

Number:

The conversation number.

disableCf

()

Disable the call forward status.

disableCfb

()

Disable the call forward busy status.

disableCfbVm

()

Disable the call forward on busy to voicemail status.

disableCfu

()

Disable the call forward on unavailble status.

disableCfuVm

()

Disable the call forward on unavailable to voicemail status.

disableCfVm

()

Disable the call forward to voicemail status.

getAllConversations

() Object

Return the conversation list.

Returns:

Object:

All conversations of the extension.

getCCCounterByQueue

(
  • qid
)
Number

Return the number of connected conversation through the specified queue.

Parameters:

  • qid String

    The queue identifier

Returns:

Number:

The number of conversation through the queue.

getCf

() String

Get the call forward status.

Returns:

String:

The number of the call forward. Returns an empty string if it is disabled.

getCfb

() String

Get the call forward busy status.

Returns:

String:

The number of the call forward busy. Returns an empty string if it is disabled.

getCfbVm

() String

Get the call forward on busy to voicemail status.

Returns:

String:

The voicemail number of the call forward on busy to voicemail. Returns an empty string if it is disabled.

getCfu

() String

Get the call forward on unavailable status.

Returns:

String:

The number of the call forward on unavailable. Returns an empty string if it is disabled.

getCfuVm

() String

Get the call forward on unavailable to voicemail status.

Returns:

String:

The voicemail number of the call forward on unavailable to voicemail. Returns an empty string if it is disabled.

getCfVm

() String

Get the call forward to voicemail status.

Returns:

String:

The voicemail number of the call forward to voicemail. Returns an empty string if it is disabled.

getChanType

() String

Return the channel type.

Returns:

String:

The channel type

getContext

() String

Returns the extension context.

Returns:

String:

The extension context

getConversation

(
  • convid
)
Object

Return the specified conversation.

Parameters:

  • convid String

    The conversation identifier

Returns:

Object:

The specified conversation.

getDnd

() Boolean

Get the don't disturb status.

Returns:

Boolean:

The don't disturb status. True if it's activated, false otherwise.

getExten

() String

Return the extension number.

Returns:

String:

The extension number

getIp

() String

Get the extension ip address.

Returns:

String:

The ip address.

getName

() String

Return the extension name.

Returns:

String:

The extension name.

getPort

() String

Get the extension ip port.

Returns:

String:

The ip port.

getStatus

() String

Get the extension status.

Returns:

String:

The extension status.

getUserAgent

() String

Get the extension user agent.

Returns:

String:

The user agent.

isOnline

() Boolean

Check if the extension is online.

Returns:

Boolean:

True if the extension is online, false otherwise.

removeAllConversations

()

Removes all conversations.

removeConversation

(
  • The
)

Removes the specified conversation.

Parameters:

  • The String

    conversation identifier

setCf

(
  • value
)

Set the call forward number.

Parameters:

  • value String

    The number to set the call forward

setCfb

(
  • value
)

Set the call forward busy number.

Parameters:

  • value String

    The number to set the call forward busy

setCfbVm

(
  • value
)

Set the call forward on busy to voicemail.

Parameters:

  • value String

    The destination voicemail number to set the call forward on busy to voicemail.

setCfu

(
  • value
)

Set the call forward on unavailable number.

Parameters:

  • value String

    The number to set the call forward on unavailable

setCfuVm

(
  • value
)

Set the call forward on unavailable to voicemail.

Parameters:

  • value String

    The destination voicemail number to set the call forward on unavailable to voicemail.

setCfVm

(
  • value
)

Set the call forward to voicemail.

Parameters:

  • value String

    The destination voicemail number to set the call forward to voicemail.

setContext

(
  • ctx
)

Set the extension context.

Parameters:

  • ctx String

    The context

setDnd

(
  • value
)

Set the don't disturb status.

Parameters:

  • value Boolean

    The status of the don't disturb. True if it's activated, false otherwise.

setIp

(
  • ipAddr
)

Set the extension ip address.

Parameters:

  • ipAddr String

    The ip address

setName

(
  • extName
)

Set the extension name.

Parameters:

  • extName String

    The extension name

setPort

(
  • ipPort
)

Set the extension ip port.

Parameters:

  • ipPort String

    The ip port

setSipUserAgent

(
  • ua
)

Set the extension sip user agent.

Parameters:

  • ua String

    The extension sip user agent

setStatus

(
  • extStatus
)

Set the extension status.

Parameters:

  • extStatus String

    The extension status must be one of STATUS_ENUM property.

    It can throw exception.

setUseWebsocket

(
  • value
)

Sets if the extension uses websocket.

Parameters:

  • value Boolean

    True if the extension uses websocket

toJSON

(
  • [privacyStrOutQueue]
  • [privacyStrInQueue]
)
Object

Returns the JSON representation of the object.

{
    ip:           "192.168.5.163",
    cf:           "221",                          // the call forward status. If it's disabled, it is an empty string
    cfb:          "221",                          // the call forward on busy status. If it's disabled, it is an empty string
    cfu:          "221",                          // the call forward on unavailable status. If it's disabled, it is an empty string
    dnd:          false,                          // it's true if the don't disturb is active
    cfVm:         "",                             // the call forward to voicemail status. If it's disabled, it is an empty string
    cfbVm:        "",                             // the call forward on busy to voicemail status. If it's disabled, it is an empty string
    cfuVm:        "",                             // the call forward on unavailable to voicemail status. If it's disabled, it is an empty string
    port:         "5062",
    name:         "Alessandro",
    exten:        "214",
    status:       "online",                       // the status can be: "dnd", "busy", "online", "onhold", "offline", "ringing", "busy_ringing"
    context:      "from-internal",                // the context
    useWebsocket: false,                          // if the extension use websocket
    sipuseragent: "Twinkle/1.4.2",
    conversations: { Conversation.toJSON() } // the keys is the conversation identifiers
}

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

toString

() String

Return the readable string of the extension.

Returns:

String:

The readable description of the extension

usingWebsocket

() Boolean

Returns true if the extension uses websocket.

Returns:

Boolean:

True if the extension uses websocket.

Properties

cf

String private

The call forward status.

cfb

String private

The call forward busy status.

cfbVm

String private

The call forward on busy to voicemail status.

cfu

String private

The call forward unavailable status.

cfuVm

String private

The call forward on unavailable to voicemail status.

cfVm

String private

The call forward to voicemail status.

chanType

String private

The channel type.

context

String private

The extension context.

conversations

Object private

The user conversations. The key is the conversation identifier and the value is the conversation object.

Default: {}

dnd

Boolean private

The don't disturb status.

EXT_STATUS_ENUM

Object final

The Extension status enumeration. It's the same of private STATUS_ENUM.

Default: Equal to the private property STATUS_ENUM

exten

String private

The Extension number.

ip

String private

The ip address of the device.

name

String private

The Extension name.

port

String private

The port of the device.

sipuseragent

String private

The sip user agent.

status

String private

The Extension status.

STATUS_ENUM

Object private final

The Extension status enumeration.

Default: { DND: "dnd", // Busy BUSY: "busy", // In Use ONLINE: "online", // Idle ONHOLD: "onhold", OFFLINE: "offline", // Unavailable RINGING: "ringing", // Ringing BUSY_RINGING: "busy_ringing" // In Use & Ringin }

useWebsocket

Boolean private

True if the extension uses websocket.