Skip to main content

Manager API

Введение

Для работы с интерфейсом событий существует несколько вариантов взаимодействия.

/arawman => Raw HTTP Manager Event Interface with Digest authentication
/rawman => Raw HTTP Manager Event Interface
/amxml => XML Manager Event Interface with Digest authentication
/mxml => XML Manager Event Interface

Документация описывает взаимодействие с интерфейсом событий через необработанные HTTP запросы. Аналогичная документация применима и к другим вариантам.

Авторизация

GET /rawman?action=login

Параметр Тип Обязательный Описание

username

String

Да Пользователь

secret

String

Да Пароль

Пример запроса: http://<ip>:8088/rawman?action=login&username=test&secret=test

Пример ответа:

Response: Success
Message: Authentication accepted

Проверка доступности

GET /rawman?action=ping

Пример ответа:

Response: Success
Ping: Pong
Timestamp: 1711272193.709205

Запрос статуса телефонной станции

GET /rawman?rawman?action=status

Параметр Тип Обязательный Описание
actionid String Нет Идентификатор запроса

channel

String

Нет Канал

variables

String

Нет Переменные

allvariables

Boolean

Нет Все переменные

Пример ответа:

Response: Success
EventList: start
Message: Channel status will follow

Event: Status
Privilege: Call
Channel: PJSIP/user
ChannelState: 6
ChannelStateDesc: Up
CallerIDNum: 110
CallerIDName: 
ConnectedLineNum: <unknown>
ConnectedLineName: <unknown>
Language: ru
AccountCode: 
Context: outgoing
Exten: 153
Priority: 3
Uniqueid: 1711273253.11
Linkedid: 1711273253.11
Type: PJSIP
DNID: 153
EffectiveConnectedLineNum: <unknown>
EffectiveConnectedLineName: <unknown>
TimeToHangup: 0
BridgeID: 
Application: Queue
Data: queue
Nativeformats: (alaw)
Readformat: alaw
Readtrans: 
Writeformat: slin
Writetrans: (slin@8000)->(alaw@8000)
Callgroup: 0
Pickupgroup: 0
Seconds: 21

Event: StatusComplete
EventList: Complete
ListItems: 1
Items: 1

Запрос создания звонка

GET /rawman?rawman?action=originate

Параметр Тип Обязательный Описание
actionid String Нет Идентификатор запроса

channel

String

Да Канал

exten

String

Да Расширение

context

String

Да Маршрутизация

priority

Integer

Да Приоритет

application

String

Нет Приложение

data

String

Да Данные приложение

timeout

Integer

Да Таймаут

callerid

String

Нет АОН

variable

String

Нет Переменные

account




earlymedia




async

Boolean

Нет Асинхронный ввод

codecs




channelid




otherchannelid




Пример запроса: http://<ip>:8088/rawman?action=originate&channel=PJSIP/user&context=outgoing&exten=100&priority=1&async=true

Список команд

GET /rawman?action=listcommands

Пример ответа:

Response: Success
AbsoluteTimeout: Set absolute timeout.  (Priv: system,call,all)
AGI: Add an AGI command to execute by Async AGI.  (Priv: agi,all)
AOCMessage: Generate an Advice of Charge message on a channel.  (Priv: aoc,all)
Atxfer: Attended transfer.  (Priv: call,all)
BlindTransfer: Blind transfer channel(s) to the given destination  (Priv: call,all)
Bridge: Bridge two channels already in the PBX.  (Priv: call,all)
BridgeDestroy: Destroy a bridge.  (Priv: <none>)
BridgeInfo: Get information about a bridge.  (Priv: <none>)
BridgeKick: Kick a channel from a bridge.  (Priv: <none>)
BridgeList: Get a list of bridges in the system.  (Priv: <none>)
BridgeTechnologyList: List available bridging technologies and their statuses.  (Priv: <none>)
BridgeTechnologySuspend: Suspend a bridging technology.  (Priv: <none>)
BridgeTechnologyUnsuspend: Unsuspend a bridging technology.  (Priv: <none>)
CancelAtxfer: Cancel an attended transfer.  (Priv: call,all)
Challenge: Generate Challenge for MD5 Auth.  (Priv: <none>)
Command: Execute Asterisk CLI Command.  (Priv: command,all)
ConfbridgeKick: Kick a Confbridge user.  (Priv: call,all)
ConfbridgeList: List participants in a conference.  (Priv: reporting,all)
ConfbridgeListRooms: List active conferences.  (Priv: reporting,all)
ConfbridgeLock: Lock a Confbridge conference.  (Priv: call,all)
ConfbridgeMute: Mute a Confbridge user.  (Priv: call,all)
ConfbridgeSetSingleVideoSrc: Set a conference user as the single video source
  distributed toall other participants.  (Priv: call,all)
ConfbridgeStartRecord: Start recording a Confbridge conference.  (Priv: system,all)
ConfbridgeStopRecord: Stop recording a Confbridge conference.  (Priv: system,all)
ConfbridgeUnlock: Unlock a Confbridge conference.  (Priv: call,all)
ConfbridgeUnmute: Unmute a Confbridge user.  (Priv: call,all)
CoreSettings: Show PBX core settings (version etc).  (Priv: system,reporting,all)
CoreShowChannelMap: List all channels connected to the specified channel.  (Priv: system,reporting,all)
CoreShowChannels: List currently active channels.  (Priv: system,reporting,all)
CoreStatus: Show PBX core status variables.  (Priv: system,reporting,all)
CreateConfig: Creates an empty file in the configuration directory.  (Priv: config,all)
DBDel: Delete DB entry.  (Priv: system,all)
DBDelTree: Delete DB Tree.  (Priv: system,all)
DBGet: Get DB Entry.  (Priv: system,reporting,all)
DBGetTree: Get DB entries, optionally at a particular family/key  (Priv: system,reporting,all)
DBPut: Put DB entry.  (Priv: system,all)
DialplanExtensionAdd: Add an extension to the dialplan  (Priv: system,all)
DialplanExtensionRemove: Remove an extension from the dialplan  (Priv: system,all)
Events: Control Event Flow.  (Priv: <none>)
ExtensionState: Check Extension Status.  (Priv: call,reporting,all)
ExtensionStateList: List the current known extension states.  (Priv: call,reporting,all)
FAXSession: Responds with a detailed description of a single FAX session  (Priv: call,all)
FAXSessions: Lists active FAX sessions  (Priv: call,all)
FAXStats: Responds with fax statistics  (Priv: reporting,all)
Filter: Dynamically add filters for the current manager session.  (Priv: system,all)
GetConfig: Retrieve configuration.  (Priv: system,config,all)
GetConfigJSON: Retrieve configuration (JSON format).  (Priv: system,config,all)
Getvar: Gets a channel variable or function value.  (Priv: call,reporting,all)
Hangup: Hangup channel.  (Priv: system,call,all)
ListCategories: List categories in configuration file.  (Priv: config,all)
ListCommands: List available manager commands.  (Priv: <none>)
LocalOptimizeAway: Optimize away a local channel when possible.  (Priv: system,call,all)
LoggerRotate: Reload and rotate the Asterisk logger.  (Priv: system,reporting,all)
Login: Login Manager.  (Priv: <none>)
Logoff: Logoff Manager.  (Priv: <none>)
MailboxCount: Check Mailbox Message Count.  (Priv: call,reporting,all)
MailboxStatus: Check mailbox.  (Priv: call,reporting,all)
MessageSend: Send an out of call message to an endpoint.  (Priv: message,all)
MixMonitor: Record a call and mix the audio during the recording.
  Use of StopMixMonitor is required to guarantee the audio file
  is available for processing during dialplan execution.  (Priv: system,all)
MixMonitorMute: Mute / unMute a Mixmonitor recording.  (Priv: system,call,all)
ModuleCheck: Check if module is loaded.  (Priv: system,all)
ModuleLoad: Module management.  (Priv: system,all)
Originate: Originate a call.  (Priv: originate,all)
Ping: Keepalive command.  (Priv: <none>)
PJSIPHangup: Hangup an incoming PJSIP channel with a SIP response code  (Priv: system,call,all)
PJSIPQualify: Qualify a chan_pjsip endpoint.  (Priv: system,reporting,all)
PJSIPRegister: Register an outbound registration.  (Priv: system,reporting,all)
PJSIPShowAors: Lists PJSIP AORs.  (Priv: system,all)
PJSIPShowAuths: Lists PJSIP Auths.  (Priv: system,all)
PJSIPShowContacts: Lists PJSIP Contacts.  (Priv: system,all)
PJSIPShowEndpoint: Detail listing of an endpoint and its objects.  (Priv: system,all)
PJSIPShowEndpoints: Lists PJSIP endpoints.  (Priv: system,all)
PJSIPShowRegistrationInboundContactStatuses: Lists ContactStatuses
  for PJSIP inbound registrations.  (Priv: system,all)
PJSIPShowRegistrationsInbound: Lists PJSIP inbound registrations.  (Priv: system,all)
PJSIPShowRegistrationsOutbound: Lists PJSIP outbound registrations.  (Priv: system,reporting,all)
PJSIPShowResourceLists: Displays settings for configured resource lists.  (Priv: system,all)
PJSIPShowSubscriptionsInbound: Lists subscriptions.  (Priv: system,all)
PJSIPShowSubscriptionsOutbound: Lists subscriptions.  (Priv: system,all)
PJSIPUnregister: Unregister an outbound registration.  (Priv: system,reporting,all)
PresenceState: Check Presence State  (Priv: call,reporting,all)
QueueAdd: Add interface to queue.  (Priv: agent,all)
QueueChangePriorityCaller: Change priority of a caller on queue.  (Priv: <none>)
QueueLog: Adds custom entry in queue_log.  (Priv: agent,all)
QueueMemberRingInUse: Set the ringinuse value for a queue member.  (Priv: agent,all)
QueuePause: Makes a queue member temporarily unavailable.  (Priv: agent,all)
QueuePenalty: Set the penalty for a queue member.  (Priv: agent,all)
QueueReload: Reload a queue, queues, or any sub-section of a queue or queues.  (Priv: <none>)
QueueRemove: Remove interface from queue.  (Priv: agent,all)
QueueReset: Reset queue statistics.  (Priv: <none>)
QueueRule: Queue Rules.  (Priv: <none>)
QueueStatus: Show queue status.  (Priv: <none>)
QueueSummary: Show queue summary.  (Priv: <none>)
QueueWithdrawCaller: Request to withdraw a caller from the queue back to the dialplan.  (Priv: <none>)
Redirect: Redirect (transfer) a call.  (Priv: call,all)
Reload: Send a reload event.  (Priv: system,config,all)
SendText: Sends a text message to channel. A content type
  can be optionally specified. If not set it is set to an empty
  string allowing a custom handler to default it as it sees fit.  (Priv: call,all)
Setvar: Sets a channel variable or function value.  (Priv: call,all)
ShowDialPlan: Show dialplan contexts and extensions  (Priv: config,reporting,all)
Status: List channel status.  (Priv: system,call,reporting,all)
StopMixMonitor: Stop recording a call through MixMonitor,
  and free the recording's file handle.  (Priv: system,call,all)
UpdateConfig: Update basic configuration.  (Priv: config,all)
UserEvent: Send an arbitrary event.  (Priv: user,all)
WaitEvent: Wait for an event to occur.  (Priv: <none>)

Описание команд

GET /rawman?action=command&command=manager show command waitevent

Пример ответа:

Response: Success
Message: Command output follows
Output: [Syntax]
Output: Action: WaitEvent
Output: [ActionID:] <value>
Output: Timeout: <value>
Output: 
Output: [Synopsis]
Output: Wait for an event to occur. 
Output: 
Output: [Description]
Output: This action will elicit a 'Success' response. Whenever a manager event is
Output: queued. Once WaitEvent has been called on an HTTP manager session, events will
Output: be generated and queued.
Output: 
Output: [Arguments]
Output: ActionID
Output:     ActionID for this transaction. Will be returned.
Output: Timeout
Output:     Maximum time (in seconds) to wait for events, '-1' means forever.
Output: 
Output: [See Also]
Output: Not available
Output: 
Output: [Privilege]
Output: <none>
Output: 
Output: [List Responses]
Output: None
Output: 
Output: [Final Response]
Output: None
Output: 
Output: