AMI(Asterisk Manager Interface)を使用すると、Asteriskのリアルタイムイベントを監視し、制御することができます。例えば、着信通知や通話のステータス変更などのイベントを受け取ることができます。
Asterisk Manager Interface (AMI) にアクセスするためには、以下の手順を実行します。
1)AMIの設定
/etc/asterisk/manager.conf
ファイルを編集して、AMIの設定を行います。
以下の設定を追加または編集します。
[general]
enabled = yes
port = 5038
bindaddr = 0.0.0.0
[admin]
secret = yourpassword
read = all
write = all
2)Asteriskの再起動
設定を反映させるために、Asteriskを再起動します。
sudo systemctl restart asterisk
3)AMIに接続
Telnetを使用してAMIに接続します。
telnet localhost 5038
4)ログイン
AMIにログインするために、以下のコマンドを入力します。
Action: Login
Username: admin
Secret: yourpassword
5)コマンドの実行
ログイン後、AMIコマンドを実行してAsteriskを管理します。例えば、現在のチャンネル情報を取得するには以下のコマンドを使用します。
Action: Command
Command: core show channels
6)ログオフ
作業が完了したら、AMIからログオフします。
Action: Logoff
これで、AMIにアクセスしてAsteriskを管理することができます。
CLIコマンド一覧
action:command
command:core show help
Response: Success
Message: Command output follows
Output: ! — Execute a shell command
Output: acl show — Show a named ACL or list all named ACLs
Output: ael reload — Reload AEL configuration
Output: ael set debug {read|tokens|macros|contexts|off} — Enable AEL debugging flags
Output: agi dump html — Dumps a list of AGI commands in HTML format
Output: agi exec — Add AGI command to a channel in Async AGI
Output: agi set debug [on|off] — Enable/Disable AGI debugging
Output: agi show commands [topic] — List AGI commands or specific help
Output: aoc set debug — enable cli debugging of AOC messages
Output: ari mkpasswd — Encrypts a password
Output: ari set debug — Enable/disable debugging of an ARI application
Output: ari show apps — List registered ARI applications
Output: ari show app — Display details of a registered ARI application
Output: ari show status — Show ARI settings
Output: ari show users — List ARI users
Output: ari show user — List single ARI user
Output: bridge kick — Kick a channel from a bridge
Output: bridge show all — List all bridges
Output: bridge show — Show information about a bridge
Output: bridge technology show — List registered bridge technologies
Output: bridge technology {suspend|unsuspend} — Suspend/unsuspend a bridge technology
Output: cc cancel [core|all] — Kill a CC transaction
Output: cc report status — Reports CC stats
Output: cdr set debug [on|off] — Enable debugging in the CDR engine
Output: cdr show active — Display active CDRs for channels
Output: cdr show pgsql status — Show connection status of the PostgreSQL CDR driver (cdr_pgsql)
Output: cdr show status — Display the CDR status
Output: cdr submit — Posts all pending batched CDR data
Output: cel show status — Display the CEL status
Output: channel originate — Originate a call
Output: channel redirect — Redirect a call
Output: channel request hangup — Request a hangup on a given channel
Output: cli check permissions — Try a permissions config for a user
Output: cli reload permissions — Reload CLI permissions config
Output: cli show permissions — Show CLI permissions
Output: confbridge kick — Kick participants out of conference bridges.
Output: confbridge list — List conference bridges and participants.
Output: confbridge lock — Lock a conference.
Output: confbridge mute — Mute participants.
Output: confbridge record start — Start recording a conference
Output: confbridge record stop — Stop recording a conference.
Output: confbridge show menu — Show a conference menu
Output: confbridge show menus — Show a list of conference menus
Output: confbridge show profile bridge — Show a conference bridge profile.
Output: confbridge show profile bridges — Show a list of conference bridge profiles.
Output: confbridge show profile user — Show a conference user profile.
Output: confbridge show profile users — Show a list of conference user profiles.
Output: confbridge unlock — Unlock a conference.
Output: confbridge unmute — Unmute participants.
Output: config list — Show all files that have loaded a configuration file
Output: config reload — Force a reload on modules using a particular configuration file
Output: config show help — Show configuration help for a module
Output: core abort shutdown — Cancel a running shutdown
Output: core clear profile — Clear profiling info
Output: core ping taskprocessor — Ping a named task processor
Output: core reload — Global reload
Output: core reset taskprocessor — Reset a named task processor’s stats
Output: core reset taskprocessors — Reset all task processors’ stats
Output: core restart gracefully — Restart Asterisk gracefully
Output: core restart now — Restart Asterisk immediately
Output: core restart when convenient — Restart Asterisk at empty call volume
Output: core set debug category — Enable/disable debugging categories
Output: core set debug channel — Enable/disable debugging on a channel
Output: core set debug — Set level of debug chattiness
Output: core set trace — Set level of trace chattiness
Output: core set verbose — Set level of verbose chattiness
Output: core show applications [like|describing] — Shows registered dialplan applications
Output: core show application — Describe a specific dialplan application
Output: core show calls [uptime] — Display information on calls
Output: core show channels [concise|verbose|count] — Display information on channels
Output: core show channel — Display information on a specific channel
Output: core show channeltypes — List available channel types
Output: core show channeltype — Give more details on that channel type
Output: core show codecs [audio|video|image|text] — Displays a list of registered codecs
Output: core show codec — Shows a specific codec
Output: core show config mappings — Display config mappings (file names to config engines)
Output: core show file formats — Displays file formats
Output: core show functions [like] — Shows registered dialplan functions
Output: core show function — Describe a specific dialplan function
Output: core show hanguphandlers all — Show hangup handlers of all channels
Output: core show hanguphandlers — Show hangup handlers of a specified channel
Output: core show help — Display help list, or specific help on a command
Output: core show hints — Show dialplan hints
Output: core show hint — Show dialplan hint
Output: core show image formats — Displays image formats
Output: core show license — Show the license(s) for this copy of Asterisk
Output: core show profile — Display profiling info
Output: core show settings — Show some core settings
Output: core show sounds — Shows available sounds
Output: core show sound — Shows details about a specific sound
Output: core show switches — Show alternative switches
Output: core show sysinfo — Show System Information
Output: core show taskprocessor alerted subsystems — List task processor subsystems in alert
Output: core show taskprocessors [like] — List instantiated task processors and statistics
Output: core show threads — Show running threads
Output: core show translation — Display translation matrix
Output: core show uptime [seconds] — Show uptime information
Output: core show version — Display version info
Output: core show warranty — Show the warranty (if any) for this copy of Asterisk
Output: core stop gracefully — Gracefully shut down Asterisk
Output: core stop now — Shut down Asterisk immediately
Output: core stop when convenient — Shut down Asterisk at empty call volume
Output: core waitfullybooted — Wait for Asterisk to be fully booted
Output: database del — Removes database key/value
Output: database deltree — Removes database keytree/values
Output: database get — Gets database value
Output: database put — Adds/updates database value
Output: database query — Run a user-specified query on the astdb
Output: database show — Shows database contents
Output: database showkey — Shows database contents
Output: devstate change — Change a custom device state
Output: devstate list — List currently known custom device states
Output: dialplan add extension — Add new extension into context
Output: dialplan add ignorepat — Add new ignore pattern
Output: dialplan add include — Include context in other context
Output: dialplan debug — Show fast extension pattern matching data structures
Output: dialplan locks show — List func_lock locks.
Output: dialplan reload — Reload extensions and *only* extensions
Output: dialplan remove context — Remove a specified context
Output: dialplan remove extension — Remove a specified extension
Output: dialplan remove ignorepat — Remove ignore pattern from context
Output: dialplan remove include — Remove a specified include from context
Output: dialplan set chanvar — Set a channel variable
Output: dialplan set extenpatternmatchnew false — Use the Old extension pattern matching algorithm.
Output: dialplan set extenpatternmatchnew true — Use the New extension pattern matching algorithm.
Output: dialplan set global — Set global dialplan variable
Output: dialplan show — Show dialplan
Output: dialplan show chanvar — Show channel variables
Output: dialplan show globals — Show global dialplan variables
Output: dnsmgr refresh — Performs an immediate refresh
Output: dnsmgr reload — Reloads the DNS manager configuration
Output: dnsmgr status — Display the DNS manager status
Output: fax set debug {on|off} — Enable/Disable FAX debugging on new FAX sessions
Output: fax show capabilities — Show the capabilities of the registered FAX technology modules
Output: fax show session — Show the status of the named FAX sessions
Output: fax show sessions — Show the current FAX sessions
Output: fax show settings — Show the global settings and defaults of both the FAX core and technology modules
Output: fax show stats — Summarize FAX session history
Output: fax show version — Show versions of FAX For Asterisk components
Output: features show — Lists configured features
Output: file convert — Convert audio file
Output: group show channels — Display active channels with group(s)
Output: http show status — Display HTTP server status
Output: iax2 provision — Provision an IAX device
Output: iax2 prune realtime — Prune a cached realtime lookup
Output: iax2 reload — Reload IAX configuration
Output: iax2 set debug {on|off|peer} — Enable/Disable IAX debugging
Output: iax2 set debug jb {on|off} — Enable/Disable IAX jitterbuffer debugging
Output: iax2 set debug trunk {on|off} — Enable/Disable IAX trunk debugging
Output: iax2 set mtu — Set the IAX systemwide trunking MTU
Output: iax2 show cache — Display IAX cached dialplan
Output: iax2 show callnumber usage — Show current entries in IP call number limit table
Output: iax2 show channels — List active IAX channels
Output: iax2 show firmware — List available IAX firmware
Output: iax2 show netstats — List active IAX channel netstats
Output: iax2 show peer — Show details on specific IAX peer
Output: iax2 show peers — List defined IAX peers
Output: iax2 show provisioning — Display iax provisioning
Output: iax2 show registry — Display IAX registration status
Output: iax2 show stats — Display IAX statistics
Output: iax2 show threads — Display IAX helper thread info
Output: iax2 show users [like] — List defined IAX users
Output: iax2 test losspct — Set IAX2 incoming frame loss percentage
Output: iax2 unregister — Unregister (force expiration) an IAX2 peer from the registry
Output: indication add — Add the given indication to the country
Output: indication remove — Remove the given indication from the country
Output: indication show — Display a list of all countries/indications
Output: keys init — Initialize RSA key passcodes
Output: keys show — Displays RSA key information
Output: local show channels — List status of local channels
Output: logger add channel — Adds a new logging channel
Output: logger mute — Toggle logging output to a console
Output: logger reload — Reopens the log files
Output: logger remove channel — Removes a logging channel
Output: logger rotate — Rotates and reopens the log files
Output: logger set level {DEBUG|TRACE|NOTICE|WARNING|ERROR|VERBOSE|DTMF} {on|off} — Enables/Disables a specific logging level for this console
Output: logger show channels — List configured log channels
Output: malloc trim — Return excess memory to the OS
Output: manager reload — Reload manager configurations
Output: manager set debug [on|off] — Show, enable, disable debugging of the manager code
Output: manager show command — Show a manager interface command
Output: manager show commands — List manager interface commands
Output: manager show connected — List connected manager interface users
Output: manager show eventq — List manager interface queued events
Output: manager show events — List manager interface events
Output: manager show event — Show a manager interface event
Output: manager show settings — Show manager global settings
Output: manager show users — List configured manager users
Output: manager show user — Display information on a specific manager user
Output: media cache create — Create an item in the media cache
Output: media cache delete — Remove an item from the media cache
Output: media cache refresh — Refresh an item in the media cache
Output: media cache show all — Show all items in the media cache
Output: media cache show — Show a single item in the media cache
Output: mixmonitor {start|stop|list} — Execute a MixMonitor command
Output: module load — Load a module by name
Output: module reload — Reload configuration for a module
Output: module show [like] — List modules and info
Output: module unload — Unload a module by name
Output: moh reload — Reload MusicOnHold
Output: moh show classes — List MusicOnHold classes
Output: moh show files — List MusicOnHold file-based classes
Output: moh unregister class — Unregister realtime MusicOnHold class
Output: no debug channel — Disable debugging on channel(s)
Output: odbc show — List ODBC DSN(s)
Output: opus show — Display Opus codec utilization.
Output: pjproject set log level {default|0|1|2|3|4|5|6} — Set the maximum active pjproject logging level
Output: pjproject show buildopts — Show the compiled config of the pjproject in use
Output: pjproject show log level — Show the maximum active pjproject logging level
Output: pjproject show log mappings — Show pjproject to Asterisk log mappings
Output: pjsip dump endpt — Dump the res_pjsip endpt internals
Output: pjsip export config_wizard primitives [to] — Export config wizard primitives
Output: pjsip list aors — List PJSIP Aors
Output: pjsip list auths — List PJSIP Auths
Output: pjsip list channels — List PJSIP Channels
Output: pjsip list ciphers — List available OpenSSL cipher names
Output: pjsip list contacts — List PJSIP Contacts
Output: pjsip list endpoints — List PJSIP Endpoints
Output: pjsip list identifies — List PJSIP Identifies
Output: pjsip list registrations — List PJSIP Registrations
Output: pjsip list subscriptions {inbound|outbound} [like] — List active inbound/outbound subscriptions
Output: pjsip list transports — List PJSIP Transports
Output: pjsip qualify — Send an OPTIONS request to a PJSIP endpoint
Output: pjsip reload qualify aor — Synchronize the PJSIP Aor qualify options
Output: pjsip reload qualify endpoint — Synchronize the qualify options for all Aors on the PJSIP endpoint
Output: pjsip send notify — Send a NOTIFY request to a SIP endpoint
Output: pjsip send register — Registers an outbound registration target
Output: pjsip send unregister — Unregisters outbound registration target
Output: pjsip set history {on|off|clear} — Enable/Disable PJSIP History
Output: pjsip set logger {on|off|host|add|verbose|pcap} — Enable/Disable PJSIP Logger Output
Output: pjsip show aors — Show PJSIP Aors
Output: pjsip show aor — Show PJSIP Aor
Output: pjsip show auths — Show PJSIP Auths
Output: pjsip show auth — Show PJSIP Auth
Output: pjsip show channels — Show PJSIP Channels
Output: pjsip show channel — Show PJSIP Channel
Output: pjsip show channelstats — Show PJSIP Channel Stats
Output: pjsip show contacts — Show PJSIP Contacts
Output: pjsip show contact — Show PJSIP Contact
Output: pjsip show endpoints — Show PJSIP Endpoints
Output: pjsip show endpoint — Show PJSIP Endpoint
Output: pjsip show history — Display PJSIP History
Output: pjsip show identifiers — List registered endpoint identifiers
Output: pjsip show identifies — Show PJSIP Identifies
Output: pjsip show identify — Show PJSIP Identify
Output: pjsip show qualify aor — Show the PJSIP Aor current qualify options
Output: pjsip show qualify endpoint — Show the current qualify options for all Aors on the PJSIP endpoint
Output: pjsip show registrations — Show PJSIP Registrations
Output: pjsip show registration — Show PJSIP Registration
Output: pjsip show scheduled_tasks — Show pjsip scheduled tasks
Output: pjsip show settings — Show global and system configuration options
Output: pjsip show subscription {inbound|outbound} — Show active subscription details
Output: pjsip show subscriptions {inbound|outbound} [like] — Show active inbound/outbound subscriptions
Output: pjsip show transports — Show PJSIP Transports
Output: pjsip show transport — Show PJSIP Transport
Output: pjsip show unidentified_requests — Show PJSIP Unidentified Requests
Output: pjsip show version — Show the version of pjproject in use
Output: presencestate change — Change a custom presence state
Output: presencestate list — List currently know custom presence states
Output: queue add member — Add a channel to a specified queue
Output: queue priority caller — Change priority caller on queue
Output: queue reload {parameters|members|rules|all} — Reload queues, members, queue rules, or parameters
Output: queue remove member — Removes a channel from a specified queue
Output: queue reset stats — Reset statistics for a queue
Output: queue set penalty — Set penalty for a channel of a specified queue
Output: queue set ringinuse — Set ringinuse for a channel of a specified queue
Output: queue show — Show status of a specified queue
Output: queue show rules — Show the rules defined in queuerules.conf
Output: queue {pause|unpause} member — Pause or unpause a queue member
Output: realtime destroy — Delete a row from a RealTime database
Output: realtime load — Used to print out RealTime variables.
Output: realtime mysql cache — Shows cached tables within the MySQL realtime driver
Output: realtime mysql status — Shows connection information for the MySQL RealTime driver
Output: realtime store — Store a new row into a RealTime database
Output: realtime update — Used to update RealTime variables.
Output: realtime update2 — Used to test the RealTime update2 method
Output: rtcp set debug {on|off|ip} — Enable/Disable RTCP debugging
Output: rtcp set stats {on|off} — Enable/Disable RTCP stats
Output: rtp set debug {on|off|ip} — Enable/Disable RTP debugging
Output: rtp show settings — Display RTP settings
Output: say load [new|old] — Set or show the say mode
Output: sip notify — Send a notify packet to a SIP peer
Output: sip prune realtime [peer|all] — Prune cached Realtime users/peers
Output: sip qualify peer — Send an OPTIONS packet to a peer
Output: sip reload — Reload SIP configuration
Output: sip set debug {on|off|ip|peer} — Enable/Disable SIP debugging
Output: sip set history {on|off} — Enable/Disable SIP history
Output: sip show {channels|subscriptions} — List active SIP channels or subscriptions
Output: sip show channelstats — List statistics for active SIP channels
Output: sip show channel — Show detailed SIP channel info
Output: sip show domains — List our local SIP domains
Output: sip show history — Show SIP dialog history
Output: sip show inuse [all] — List all inuse/limits
Output: sip show mwi — Show MWI subscriptions
Output: sip show objects — List all SIP object allocations
Output: sip show peers [like] — List defined SIP peers
Output: sip show peer — Show details on specific SIP peer
Output: sip show registry — List SIP registration status
Output: sip show sched — Present a report on the status of the scheduler queue
Output: sip show settings — Show SIP global settings
Output: sip show tcp — List TCP Connections
Output: sip show users [like] — List defined SIP users
Output: sip show user — Show details on specific SIP user
Output: sip unregister — Unregister (force expiration) a SIP peer from the registry
Output: sorcery memory cache dump — Dump all objects within a sorcery memory cache
Output: sorcery memory cache expire — Expire a specific object or ALL objects within a sorcery memory cache
Output: sorcery memory cache populate — Clear and populate the sorcery memory cache with objects from the backend
Output: sorcery memory cache show — Show sorcery memory cache information
Output: sorcery memory cache stale — Mark a specific object or ALL objects as stale within a sorcery memory cache
Output: stasis show topics — Show all topics
Output: stasis show topic — Show topic
Output: stir_shaken show certificate — Show stir/shaken certificate configuration by id
Output: stir_shaken show certificates — Show all stir/shaken certificate configurations
Output: stir_shaken show general — Show stir/shaken general configuration
Output: stir_shaken show store — Show stir/shaken store configuration by id
Output: stun set debug {on|off} — Enable/Disable STUN debugging
Output: timing test — Run a timing test
Output: udptl set debug {on|off|ip} — Enable/Disable UDPTL debugging
Output: udptl show config — Show UDPTL config options
Output: ulimit — Set or show process resource limits
Output: voicemail reload — Reload voicemail configuration
Output: voicemail show aliases — List mailbox aliases
Output: voicemail show users [for] — List defined voicemail boxes
Output: voicemail show zones — List zone message formats
Output: xmldoc dump — Dump the XML docs to the specified file