Asterisk CLI

提供: VoIP-Info.jp
2024年8月19日 (月) 06:22時点におけるTakahashi (トーク | 投稿記録)による版 (コマンド解説)
(差分) ← 古い版 | 最新版 (差分) | 新しい版 → (差分)
移動先: 案内検索

Asterisk Command Line Interface
Asteriskの基本となる管理インタフェース。

CLIの起動と終了

Asteriskをバックグラウンドで起動している場合には

asterisk -vvvcr

のようにして接続する。
終了するにはCLIプロンプトで

*CLI> quit

ヘルプ

? で、その階層で使用できるコマンドの一覧が、helpでコマンドとその説明が表示される。
例えばpjsipコマンドなら

*CLI> pjsip show ?
aor                    aors                   auth                   auths
channel                channels               channelstats           contact
contacts               endpoint               endpoints              history
identifiers            identifies             identify               qualify
registration           registrations          scheduled_tasks        settings
subscription           subscriptions          transport              transport-monitors
transports             unidentified_requests  version

上記のように表示される。?それ自体はエコーバックされない。

コマンドの概念

Asterisk 20系でトップのコマンドは以下の例のようになっている。

*CLI>
!              acl            aeap           ael            agi            aoc
ari            bridge         cc             cdr            cel            channel
cli            confbridge     config         core           dahdi          database
devstate       dialplan       dnsmgr         fax            features       file
group          http           indication     keys           local          logger
malloc         manager        media          minivm         mixmonitor     module
moh            no             parking        pjproject      pjsip          presencestate
pri            realtime       rtcp           rtp            say            sorcery
stasis         stun           timing         transcoder     udptl          ulimit
voicemail      xmldoc

基本的に、トップのコマンドは「モジュール」の名称(機能)である。ただし、一部のコマンドに関してはモジュールに依存しておらず、Asterisk本体に組み込み。PBXコア部分の機能はcoreで始まるコマンドになる。
このコマンドはAsterisk 1.2まではきれいにモジュールに分けられていなかったのだが、1.4系から整理が始まり、1.6系ではモジュール単位に分割がかなり進んだ。つまり、コマンドはモジュールに依存しているので、トップで使えるコマンドの数は読み込んでいるモジュールの数に依存する。例えばSIPチャネルを使用していない場合(chan_sipを読み込んでいない場合)には、sip コマンドは現れない。上記の例でもchan_sipは読み込まれておらず、sipコマンドは表示されないがpjsipコマンドは表示されている。