A class for performing SNMP V2 queries on Asterisk

see \OSS_SNMP\MIBS\Asterisk\https://wiki.asterisk.org/wiki/display/AST/Asterisk+MIB+Definitions
copyright Copyright (c) 2012, Open Source Solutions Limited, Dublin, Ireland
author Barry O'Donovan

 Methods

Returns the current number of active channels.

active() : int

Current number of active channels.

Returns

intThe current number of active channels.

Array of active calls on supported channels

activeCalls() : array

Number of active channels using the current technology.

Returns

arrayActive calls on supported channels

Number of channels currently in a bridged state.

bridged() : int

Number of channels currently in a bridged state.

Returns

intArray of active calls on supported channels

Active Channel Information: Whether or not ADSI is detected on CPE. (see constants)

chanADSI(bool $translate) : array

NB: SNMP exceptions are caught and in such cases null is returned as not all channels have all properties.

Whether or not ADSI is detected on CPE. (see constants)

Parameters

$translate

bool

If true, use the $CHANNEL_ADSIs array to return textual representation

Returns

arrayWhether or not ADSI is detected on CPE. (see constants)

Active Channel Information: AMA Flags. (See constants)

chanAMAFlags(bool $translate) : array

NB: SNMP exceptions are caught and in such cases null is returned as not all channels have all properties.

AMA Flags. (See constants)

Parameters

$translate

bool

If true, use the $CHANNEL_AMA_FLAGS array to return textual representation

Returns

arrayAMA Flags. (See constants)

Active Channel Information: Account Code for billing.

chanAccountCode() : array

NB: SNMP exceptions are caught and in such cases null is returned as not all channels have all properties.

Account Code for billing.

Returns

arrayAccount Code for billing.

Active Channel Information: Current application for the channel.

chanApp() : array

NB: SNMP exceptions are caught and in such cases null is returned as not all channels have all properties.

Current application for the channel.

Returns

arrayCurrent application for the channel.

Active Channel Information: Which channel this channel is currently bridged (in a conversation) with.

chanBridge() : array

NB: SNMP exceptions are caught and in such cases null is returned as not all channels have all properties.

Which channel this channel is currently bridged (in a conversation) with.

Returns

arrayWhich channel this channel is currently bridged (in a conversation) with.

Active Channel Information: Call Group.

chanCallGroup() : array

NB: SNMP exceptions are caught and in such cases null is returned as not all channels have all properties.

Call Group.

Returns

arrayCall Group.

Active Channel Information: ANI

chanCidANI() : array

NB: SNMP exceptions are caught and in such cases null is returned as not all channels have all properties.

ANI

Returns

arrayANI

Active Channel Information: ANI 2 (info digit).

chanCidANI2() : array

NB: SNMP exceptions are caught and in such cases null is returned as not all channels have all properties.

ANI 2 (info digit).

Returns

arrayANI 2 (info digit).

Active Channel Information: Dialled Number ID.

chanCidDNID() : array

NB: SNMP exceptions are caught and in such cases null is returned as not all channels have all properties.

Dialled Number ID.

Returns

arrayDialled Number ID.

Active Channel Information: Caller Name.

chanCidName() : array

NB: SNMP exceptions are caught and in such cases null is returned as not all channels have all properties.

Caller Name.

Returns

arrayCaller Name.

Active Channel Information: Caller Number.

chanCidNum() : array

NB: SNMP exceptions are caught and in such cases null is returned as not all channels have all properties.

Caller Number.

Returns

arrayCaller Number.

Active Channel Information: Number Presentation/Screening.

chanCidPresentation() : array

NB: SNMP exceptions are caught and in such cases null is returned as not all channels have all properties.

Number Presentation/Screening.

Returns

arrayNumber Presentation/Screening.

Active Channel Information: Redirected Dialled Number Service.

chanCidRDNIS() : array

NB: SNMP exceptions are caught and in such cases null is returned as not all channels have all properties.

Redirected Dialled Number Service.

Returns

arrayRedirected Dialled Number Service.

Active Channel Information: Transit Network Select.

chanCidTNS() : array

NB: SNMP exceptions are caught and in such cases null is returned as not all channels have all properties.

Transit Network Select.

Returns

arrayTransit Network Select.

Active Channel Information: Type of Number.

chanCidTON() : array

NB: SNMP exceptions are caught and in such cases null is returned as not all channels have all properties.

Type of Number.

Returns

arrayType of Number.

Active Channel Information: Current extension context.

chanContext() : array

NB: SNMP exceptions are caught and in such cases null is returned as not all channels have all properties.

Current extension context.

Returns

arrayCurrent extension context.

Active Channel Information: Arguments passed to the current application.

chanData() : array

NB: SNMP exceptions are caught and in such cases null is returned as not all channels have all properties.

Arguments passed to the current application.

Returns

arrayArguments passed to the current application.

Active Channel Information: Current extension.

chanExten() : array

NB: SNMP exceptions are caught and in such cases null is returned as not all channels have all properties.

Current extension.

Returns

arrayCurrent extension.

Active Channel Information: Flags set on this channel.

chanFlags() : array

Returns a HEX number - but I could not map it to the following from Asterisk docs:

BITS { wantsJitter(0), deferDTMF(1), writeInterrupt(2), blocking(3), zombie(4), exception(5), musicOnHold(6), spying(7), nativeBridge(8), autoIncrementingLoop(9) }

NB: SNMP exceptions are caught and in such cases null is returned as not all channels have all properties.

Flags set on this channel. (see constants)

Returns

arrayFlags set on this channel. (see constants)

Active Channel Information: Where to forward to if asked to dial on this interface.

chanForwardTo() : array

NB: SNMP exceptions are caught and in such cases null is returned as not all channels have all properties.

Where to forward to if asked to dial on this interface.

Returns

arrayWhere to forward to if asked to dial on this interface.

Active Channel Information: Why is the channel hung up. (see constants)

chanHangupCause(bool $translate) : array

NB: SNMP exceptions are caught and in such cases null is returned as not all channels have all properties.

Why is the channel hung up. (see constants)

Parameters

$translate

bool

If true, use the $CHANNEL_HANGUP_CAUSES array to return textual representation

Returns

arrayWhy is the channel hung up. (see constants)

Active Channel Information: Which language the current channel is configured to use -- used mainly for prompts.

chanLanguage() : array

NB: SNMP exceptions are caught and in such cases null is returned as not all channels have all properties.

Which language the current channel is configured to use -- used mainly for prompts.

Returns

arrayWhich language the current channel is configured to use -- used mainly for prompts.

Active Channel Information: Current macro context.

chanMacroContext() : array

NB: SNMP exceptions are caught and in such cases null is returned as not all channels have all properties.

Current macro context.

Returns

arrayCurrent macro context.

Active Channel Information: Current macro extension.

chanMacroExten() : array

NB: SNMP exceptions are caught and in such cases null is returned as not all channels have all properties.

Current macro extension.

Returns

arrayCurrent macro extension.

Active Channel Information: Current macro priority.

chanMacroPri() : array

NB: SNMP exceptions are caught and in such cases null is returned as not all channels have all properties.

Current macro priority.

Returns

arrayCurrent macro priority.

Active Channel Information: Channel masquerading for us.

chanMasq() : array

NB: SNMP exceptions are caught and in such cases null is returned as not all channels have all properties.

Channel masquerading for us.

Returns

arrayChannel masquerading for us.

Active Channel Information: Channel we are masquerading for.

chanMasqr() : array

NB: SNMP exceptions are caught and in such cases null is returned as not all channels have all properties.

Channel we are masquerading for.

Returns

arrayChannel we are masquerading for.

Active Channel Information: Music class to be used for Music on Hold for this channel.

chanMusicClass() : array

NB: SNMP exceptions are caught and in such cases null is returned as not all channels have all properties.

Music class to be used for Music on Hold for this channel.

Returns

arrayMusic class to be used for Music on Hold for this channel.

Active Channel Information: Transmission of voice data has been muted.

chanMuted() : array

NB: SNMP exceptions are caught and in such cases null is returned as not all channels have all properties.

Transmission of voice data has been muted.

Returns

arrayTransmission of voice data has been muted.

Active Channel Information: Name of the current channel.

chanName() : array

NB: SNMP exceptions are caught and in such cases null is returned as not all channels have all properties.

Name of the current channel.

Returns

arrayName of the current channel.

Active Channel Information: Pickup Group.

chanPickupGroup() : array

NB: SNMP exceptions are caught and in such cases null is returned as not all channels have all properties.

Pickup Group.

Returns

arrayPickup Group.

Active Channel Information: Current priority.

chanPri() : array

NB: SNMP exceptions are caught and in such cases null is returned as not all channels have all properties.

Current priority.

Returns

arrayCurrent priority.

Active Channel Information: Number of rings so far.

chanRings() : array

NB: SNMP exceptions are caught and in such cases null is returned as not all channels have all properties.

Number of rings so far.

Returns

arrayNumber of rings so far.

Active Channel Information: Channel state (see channel state constants).

chanState(bool $translate) : array

NB: SNMP exceptions are caught and in such cases null is returned as not all channels have all properties.

Channel state (see channel state constants).

Parameters

$translate

bool

If true, use the $CHANNEL_STATES array to return textual representation

Returns

arrayChannel state (see channel state constants).

Active Channel Information: Indication zone to use for channel.

chanToneZone() : array

NB: SNMP exceptions are caught and in such cases null is returned as not all channels have all properties.

Indication zone to use for channel.

Returns

arrayIndication zone to use for channel.

Active Channel Information: Transfer Capabilities for this channel. (see constants)

chanTransferCap(bool $translate) : array

NB: SNMP exceptions are caught and in such cases null is returned as not all channels have all properties.

Transfer Capabilities for this channel. (see constants)

Parameters

$translate

bool

If true, use the $CHANNEL_TRANSFER_CAPABILITIES array to return textual representation

Returns

arrayTransfer Capabilities for this channel. (see constants)

Active Channel Information: Underlying technology for the current channel.

chanType() : array

NB: SNMP exceptions are caught and in such cases null is returned as not all channels have all properties.

Underlying technology for the current channel.

Returns

arrayUnderlying technology for the current channel.

Active Channel Information: Unique Channel Identifier.

chanUniqueId() : array

NB: SNMP exceptions are caught and in such cases null is returned as not all channels have all properties.

Unique Channel Identifier.

Returns

arrayUnique Channel Identifier.

Active Channel Information: Channel Variables defined for this channel.

chanVariables() : array

Returns an array of arrays where the inner array is key/value pairs of channel variables for that channel: [varName] => [varValue]

NB: SNMP exceptions are caught and in such cases null is returned as not all channels have all properties.

Channel Variables defined for this channel.

Returns

arrayChannel Variables defined for this channel.

Active Channel Information: How long until this channel will be hung up.

chanWhenHangup() : array

NB: SNMP exceptions are caught and in such cases null is returned as not all channels have all properties.

How long until this channel will be hung up.

Returns

arrayHow long until this channel will be hung up.

Utility function to gather together all the details of individual channels into an array.

channelDetails(bool $translate, bool $useIndexes) : array

Essentially, this function calls all chanXXX() functions to return the details for individual channels gathered together. E.g.

Array
(
    ....
    [SIP/foobar-654-00000372] => Array
    (
        [chanName] => SIP/foobar-654-00000372
        [chanLanguage] => en
        [chanType] => SIP
        [chanMusicClass] => (null)
        ...
        [chanVariables] => Array
        (
            [DIALEDPEERNUMBER] => foobar-654
            [SIPCALLID] => 1be189fa6281ffc1108db32935f05016@192.168.7.7:5060
        )
        [chanFlags] => 1020
        [chanTransferCap] => speech
    )
    ....
)

The function returns an array of all channels. Unknown parameters within the channel are set to null.

An empty array is returned if there are no active channels.

Parameters

$translate

bool

Translate parameters when possible

$useIndexes

bool

Rather than indexing the outer array with the unique channel name, index with the SNMP table position

Returns

arrayAll the details of individual channels into an array.

Array of supported channel type descriptions

descriptions() : array

Description of the channel type (technology).

Returns

arraySupported channel type descriptions

Utility function to gather channel details together in an associative array.

details(bool $useIndex) : array

Returns an array of support channel types. For example:

Array
(
    ....
    [SIP] => Array
        (
            [name] => SIP
            [index] => 5
            [description] => Session Initiation Protocol (SIP)
            [hasDeviceState] => 1
            [hasProgressIndications] => 1
            [canTransfer] => 1
            [activeCalls] => 0
        )
    ....
)

If you chose to index by SNMP table entries, the above element would be indexed with 5 rather than SIP.

Parameters

$useIndex

bool

If true, the array is indexed using the SNMP table index rather than the unique channel type name

Returns

arrayChannel details as an associative array

Array of supported channel type device state capability

deviceStates() : array

Whether the current technology can hold device states.

Returns

arrayWhether the current technology can hold device states.

Array of supported channel type names

names() : array

Unique name of the technology we are describing.

Returns

arraySupported channel type names

Array of supported channel type progress indication capability

progressIndications() : array

Whether the current technology supports progress indication.

Returns

arrayWhether the current technology supports progress indication.

Returns the number of channel types (technologies) supported.

supported() : int

Number of channel types (technologies) supported.

Returns

intThe number of channel types (technologies) supported.

Array of supported channel type transfer capability

transfers() : array

Whether the current technology supports transfers, where Asterisk can get out from inbetween two bridged channels.

Returns

arrayWhether the current technology transfers

Utility function for `chanVariables()` to break the string returned by OID_ASTERISK_CHANNEL_VARIABLES into an array of key / value pairs

_chanVarsToArray(string $str) : Array

Parameters

$str

string

String containing channel variables (from chanVariables()

Returns

ArrayAn array of `[varName] => [varValue]` pairs for the channel

 Properties

 

$CHANNEL_ADSIs

$CHANNEL_ADSIs 

 

$CHANNEL_AMA_FLAGS

$CHANNEL_AMA_FLAGS 

 

$CHANNEL_HANGUP_CAUSES

$CHANNEL_HANGUP_CAUSES 

 

$CHANNEL_STATES

$CHANNEL_STATES 

 

$CHANNEL_TRANSFER_CAPABILITIES

$CHANNEL_TRANSFER_CAPABILITIES 

 Constants

 

CHANNEL_ADSI_AVAILABLE

CHANNEL_ADSI_AVAILABLE 

 

CHANNEL_ADSI_OFF_HOOK_ONLY

CHANNEL_ADSI_OFF_HOOK_ONLY 

 

CHANNEL_ADSI_UNAVAILABLE

CHANNEL_ADSI_UNAVAILABLE 

 

CHANNEL_ADSI_UNKNOWN

CHANNEL_ADSI_UNKNOWN 

 

CHANNEL_AMA_FLAG_BILLING

CHANNEL_AMA_FLAG_BILLING 

 

CHANNEL_AMA_FLAG_DEFAULT

CHANNEL_AMA_FLAG_DEFAULT 

 

CHANNEL_AMA_FLAG_DOCUMENTATION

CHANNEL_AMA_FLAG_DOCUMENTATION 

 

CHANNEL_AMA_FLAG_OMIT

CHANNEL_AMA_FLAG_OMIT 

 

CHANNEL_HANGUP_CAUSE_BUSY

CHANNEL_HANGUP_CAUSE_BUSY 

 

CHANNEL_HANGUP_CAUSE_CONGESTION

CHANNEL_HANGUP_CAUSE_CONGESTION 

 

CHANNEL_HANGUP_CAUSE_FAILURE

CHANNEL_HANGUP_CAUSE_FAILURE 

 

CHANNEL_HANGUP_CAUSE_NORMAL

CHANNEL_HANGUP_CAUSE_NORMAL 

 

CHANNEL_HANGUP_CAUSE_NOT_DEFINED

CHANNEL_HANGUP_CAUSE_NOT_DEFINED 

 

CHANNEL_HANGUP_CAUSE_NO_ANSWER

CHANNEL_HANGUP_CAUSE_NO_ANSWER 

 

CHANNEL_HANGUP_CAUSE_NO_SUCH_DRIVER

CHANNEL_HANGUP_CAUSE_NO_SUCH_DRIVER 

 

CHANNEL_HANGUP_CAUSE_UNREGISTERED

CHANNEL_HANGUP_CAUSE_UNREGISTERED 

 

CHANNEL_STATE_BUSY

CHANNEL_STATE_BUSY 

 

CHANNEL_STATE_DIALING

CHANNEL_STATE_DIALING 

 

CHANNEL_STATE_DIALING_OFF_HOOK

CHANNEL_STATE_DIALING_OFF_HOOK 

 

CHANNEL_STATE_DOWN

CHANNEL_STATE_DOWN 

 

CHANNEL_STATE_OFF_HOOK

CHANNEL_STATE_OFF_HOOK 

 

CHANNEL_STATE_PRE_RING

CHANNEL_STATE_PRE_RING 

 

CHANNEL_STATE_RESERVED

CHANNEL_STATE_RESERVED 

 

CHANNEL_STATE_RING

CHANNEL_STATE_RING 

 

CHANNEL_STATE_RINGING

CHANNEL_STATE_RINGING 

 

CHANNEL_STATE_UP

CHANNEL_STATE_UP 

 

CHANNEL_TRANSFER_CAPABILITY_AUDIO_3K

CHANNEL_TRANSFER_CAPABILITY_AUDIO_3K 

 

CHANNEL_TRANSFER_CAPABILITY_DIGITAL

CHANNEL_TRANSFER_CAPABILITY_DIGITAL 

 

CHANNEL_TRANSFER_CAPABILITY_DIGITAL_WITH_TONES

CHANNEL_TRANSFER_CAPABILITY_DIGITAL_WITH_TONES 

 

CHANNEL_TRANSFER_CAPABILITY_RESTRICTED_DIGITAL

CHANNEL_TRANSFER_CAPABILITY_RESTRICTED_DIGITAL 

 

CHANNEL_TRANSFER_CAPABILITY_SPEECH

CHANNEL_TRANSFER_CAPABILITY_SPEECH 

 

CHANNEL_TRANSFER_CAPABILITY_VIDEO

CHANNEL_TRANSFER_CAPABILITY_VIDEO 

 

OID_ASTERISK_CHANNELS_ACTIVE

OID_ASTERISK_CHANNELS_ACTIVE 

 

OID_ASTERISK_CHANNELS_BRIDGED

OID_ASTERISK_CHANNELS_BRIDGED 

 

OID_ASTERISK_CHANNELS_SUPPORTED

OID_ASTERISK_CHANNELS_SUPPORTED 

   

OID_ASTERISK_CHANNEL_ADSI

OID_ASTERISK_CHANNEL_ADSI 

 

OID_ASTERISK_CHANNEL_AMA_FLAGS

OID_ASTERISK_CHANNEL_AMA_FLAGS 

 

OID_ASTERISK_CHANNEL_APP

OID_ASTERISK_CHANNEL_APP 

 

OID_ASTERISK_CHANNEL_BRIDGE

OID_ASTERISK_CHANNEL_BRIDGE 

 

OID_ASTERISK_CHANNEL_CALL_GROUP

OID_ASTERISK_CHANNEL_CALL_GROUP 

 

OID_ASTERISK_CHANNEL_CID_ANI

OID_ASTERISK_CHANNEL_CID_ANI 

 

OID_ASTERISK_CHANNEL_CID_ANI2

OID_ASTERISK_CHANNEL_CID_ANI2 

 

OID_ASTERISK_CHANNEL_CID_DNID

OID_ASTERISK_CHANNEL_CID_DNID 

 

OID_ASTERISK_CHANNEL_CID_NAME

OID_ASTERISK_CHANNEL_CID_NAME 

 

OID_ASTERISK_CHANNEL_CID_NUM

OID_ASTERISK_CHANNEL_CID_NUM 

 

OID_ASTERISK_CHANNEL_CID_PRESENTATION

OID_ASTERISK_CHANNEL_CID_PRESENTATION 

 

OID_ASTERISK_CHANNEL_CID_RDNIS

OID_ASTERISK_CHANNEL_CID_RDNIS 

 

OID_ASTERISK_CHANNEL_CID_TNS

OID_ASTERISK_CHANNEL_CID_TNS 

 

OID_ASTERISK_CHANNEL_CID_TON

OID_ASTERISK_CHANNEL_CID_TON 

 

OID_ASTERISK_CHANNEL_CONTEXT

OID_ASTERISK_CHANNEL_CONTEXT 

 

OID_ASTERISK_CHANNEL_DATA

OID_ASTERISK_CHANNEL_DATA 

 

OID_ASTERISK_CHANNEL_EXTEN

OID_ASTERISK_CHANNEL_EXTEN 

 

OID_ASTERISK_CHANNEL_FLAGS

OID_ASTERISK_CHANNEL_FLAGS 

 

OID_ASTERISK_CHANNEL_FORWARD_TO

OID_ASTERISK_CHANNEL_FORWARD_TO 

 

OID_ASTERISK_CHANNEL_HANGUP_CAUSE

OID_ASTERISK_CHANNEL_HANGUP_CAUSE 

 

OID_ASTERISK_CHANNEL_LANGUAGE

OID_ASTERISK_CHANNEL_LANGUAGE 

 

OID_ASTERISK_CHANNEL_MACRO_CONTEXT

OID_ASTERISK_CHANNEL_MACRO_CONTEXT 

 

OID_ASTERISK_CHANNEL_MACRO_EXTEN

OID_ASTERISK_CHANNEL_MACRO_EXTEN 

 

OID_ASTERISK_CHANNEL_MACRO_PRI

OID_ASTERISK_CHANNEL_MACRO_PRI 

 

OID_ASTERISK_CHANNEL_MASQ

OID_ASTERISK_CHANNEL_MASQ 

 

OID_ASTERISK_CHANNEL_MASQR

OID_ASTERISK_CHANNEL_MASQR 

 

OID_ASTERISK_CHANNEL_MUSIC_CLASS

OID_ASTERISK_CHANNEL_MUSIC_CLASS 

 

OID_ASTERISK_CHANNEL_MUTED

OID_ASTERISK_CHANNEL_MUTED 

 

OID_ASTERISK_CHANNEL_NAME

OID_ASTERISK_CHANNEL_NAME 

 

OID_ASTERISK_CHANNEL_PICKUP_GROUP

OID_ASTERISK_CHANNEL_PICKUP_GROUP 

 

OID_ASTERISK_CHANNEL_PRI

OID_ASTERISK_CHANNEL_PRI 

 

OID_ASTERISK_CHANNEL_RINGS

OID_ASTERISK_CHANNEL_RINGS 

 

OID_ASTERISK_CHANNEL_STATE

OID_ASTERISK_CHANNEL_STATE 

 

OID_ASTERISK_CHANNEL_TONE_ZONE

OID_ASTERISK_CHANNEL_TONE_ZONE 

 

OID_ASTERISK_CHANNEL_TRANSFER_CAP

OID_ASTERISK_CHANNEL_TRANSFER_CAP 

 

OID_ASTERISK_CHANNEL_TYPE

OID_ASTERISK_CHANNEL_TYPE 

 

OID_ASTERISK_CHANNEL_TYPE_CHANNELS

OID_ASTERISK_CHANNEL_TYPE_CHANNELS 

 

OID_ASTERISK_CHANNEL_TYPE_DESCRIPTION

OID_ASTERISK_CHANNEL_TYPE_DESCRIPTION 

 

OID_ASTERISK_CHANNEL_TYPE_INDICATION

OID_ASTERISK_CHANNEL_TYPE_INDICATION 

 

OID_ASTERISK_CHANNEL_TYPE_NAME

OID_ASTERISK_CHANNEL_TYPE_NAME 

 

OID_ASTERISK_CHANNEL_TYPE_STATE

OID_ASTERISK_CHANNEL_TYPE_STATE 

 

OID_ASTERISK_CHANNEL_TYPE_TRANSFER

OID_ASTERISK_CHANNEL_TYPE_TRANSFER 

 

OID_ASTERISK_CHANNEL_UNQIUEID

OID_ASTERISK_CHANNEL_UNQIUEID 

 

OID_ASTERISK_CHANNEL_VARIABLES

OID_ASTERISK_CHANNEL_VARIABLES 

 

OID_ASTERISK_CHANNEL_WHEN_HANGUP

OID_ASTERISK_CHANNEL_WHEN_HANGUP