API Docs for:
Show:

Trunk Class

Module: astproxy

Abstraction of a trunk.

It can throw exceptions.

Constructor

Trunk

(
  • ext
  • chType
  • [maxCh]
)
Object

Parameters:

  • ext String

    The trunk identifier

  • chType String

    The channel type, e.g. sip, iax

  • [maxCh] String optional

    Maximum number of channels supported by the trunk

Returns:

Object:

The trunk 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.

getAllConversations

() Object

Return the conversation list.

Returns:

Object:

All conversations of the trunk.

getChanType

() String

Return the channel type.

Returns:

String:

The channel type

getConversation

(
  • convid
)
Object

Return the specified conversation.

Parameters:

  • convid String

    The conversation identifier

Returns:

Object:

The specified conversation.

getExten

() String

Return the trunk identifier.

Returns:

String:

The trunk identifier.

getIp

() String

Get the trunk ip address.

Returns:

String:

The ip address.

getName

() String

Return the trunk name.

Returns:

String:

The trunk name.

getPort

() String

Get the trunk ip port.

Returns:

String:

The ip port.

getStatus

() String

Get the trunk status.

Returns:

String:

The trunk status.

getUserContext

() String

Return the user context.

Returns:

String:

The user context.

isOnline

() Boolean

Check if the trunk is online.

Returns:

Boolean:

True if the truk is online, false otherwise.

removeAllConversations

()

Removes all conversations.

removeConversation

(
  • The
)

Removes the specified conversation.

Parameters:

  • The String

    conversation identifier

setIp

(
  • ipAddr
)

Set the trunk ip address.

Parameters:

  • ipAddr String

    The ip address

setName

(
  • extName
)

Set the trunk name.

Parameters:

  • extName String

    The trunk name

setPort

(
  • ipPort
)

Set the trunk 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

(
  • trunkStatus
)

Set the trunk status.

Parameters:

  • trunkStatus String

    The trunk status must be one of STATUS_ENUM property.

    It can throw exception.

setUserContext

(
  • ctx
)

Set the user context.

Parameters:

  • ctx String

    The user context

toJSON

(
  • [privacyStr]
)
Object

Returns the JSON representation of the object.

{
    "ip":           "192.168.5.163",
    "port":         "5062",
    "name":         "2001",
    "exten":        "200",
    "status":       "online",                       // the status can be: "busy", "online", "offline"
    "maxChannels":  4,                              // maximum number of channels supported by the trunk
    "sipuseragent": "Patton SN4638 5BIS",
    "conversations": { Conversation.toJSON() } // the keys is the conversation identifiers
}

Parameters:

  • [privacyStr] String optional

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

Returns:

Object:

The JSON representation of the object.

toString

() String

Return the readable string of the trunk.

Returns:

String:

The readable description of the trunk

Properties

chanType

String private

The channel type.

conversations

Object private

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

exten

String private

The trunk identifier.

ip

String private

The ip address of the trunk.

maxChannels

Number private

Maximum number of channels supported by the trunk.

name

String private

The trunk name.

port

String private

The port of the device.

sipuseragent

String private

The sip user agent.

status

String private

The trunk status.

STATUS_ENUM

Object private final

The trunk status enumeration.

Default: { BUSY: "busy", ONLINE: "online", OFFLINE: "offline" }

TRUNK_STATUS_ENUM

Object final

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

Default: Equal to the private property STATUS_ENUM

userContext

String private

The user context.