アスタリスク管理インターフェース(AMI)、パート2

先日公開された説明の最初の部分の続きで、アスタリスクのオープンソースPBXインターフェイスの作業が2番目の部分を公開します。 このパートでは、このインターフェイスを使用してPBXとやり取りする例をいくつか示します。接続と承認から始まり、呼び出しと構成ファイルの編集で終わります。



記事の完全版が作成され、ここで修正されます: asteriskpbx.ru/wiki/manager-interface-doc



AMIに接続する



AMIに接続するには、telnetプログラムを使用できます。 これはシステムグリーティングがどのように見えるかです:



$ telnet 127.0.0.1 5038

Trying 127.0.0.1...

Connected to localhost.

Escape character is '^]'.

Asterisk Call Manager/1.1









次に入力します:



Action: login

Username: admin

Secret: passwd1234









2回入力します。これはCRLFを入力するのと同じです。次のような回答が表示されます(応答パッケージ)



Response: Success

Message: Authentication accepted







これにより、AMIインターフェイスに正常にログインしたことがわかります。 AMIへのログインに成功すると、アスタリスクコンソールに次のように表示されます(1.4):



asterisk*CLI>

== Parsing '/etc/asterisk/manager.conf': Found

== Manager 'admin' logged on from 127.0.0.1







1.6では、AMIに接続するたびにディスクから構成を読み取る必要がなくなります。 これらはプログラムの開始時に1回読み取られ、再起動時に再読み取りできます(コマンドは上記のとおりです)。



Asteriskコンソールから現在AMIインターフェイスに接続しているすべてのユーザーを確認できます。



*CLI> manager show connected







パスワードを変更して「manager reload」コマンドを実行しても、すでに確立されているAMIセッションの権限には影響しません。 これは、ファイルでパスワードまたはアクセス権が変更された場合、これらの変更がサーバーで既に動作しているクライアントに影響を与えないことを意味します



アスタリスクによって生成されたイベントが必要ない場合(多くの場合、コンソールでアスタリスクの回答を読みにくくします)、認証手順中に渡されるパラメーターに別のレコードを含めることができます



Events: off







このエントリは、確立された接続内でサーバー側からのイベントパケットの送信を防ぎます



AMI接続セッションを終了するには、以下を完了する必要があります。



Action: logoff







その後、画面にtelnetセッションが表示されます。



Response: Goodbye

Message: Thanks for all the fish.







AMIセッションの終了時に、Asteriskのコンソールで次を確認できます。



asterisk*CLI>

== Manager 'admin' logged off from 127.0.0.1







注当然、AMIインターフェースは、管理者がtelnetクライアントなどを使用して手動でAsteriskサーバーに接続することを目的としていません。 ここでは、この例は、パッケージ、アクション、イベント、および応答の交換操作の機能と可視性のデモとしてのみ示されています。 ただし、このアプローチは、チームのアクションのトレーニングとデバッグには役立ちます。



注コンソールに入力することにより、AMI Asterisk CLI管理インターフェイスに関連するすべてのコマンドを表示できます。



asterisk *CLI> help manager







AMIでの承認のためのパスワード





AMIインターフェイスに接続するときに送信されるパスワードはクリアテキストで送信されることを理解することが重要です。 これは、アスタリスクサービスの動作に対する脅威になる可能性があります。 送信されたパスワードを隠すには、md5アルゴリズムを使用します。 md5アルゴリズムを使用しても、上記のセキュリティ要件が削除されることはありません。 プライベートネットワークでもリモート接続を使用する場合は、要求/応答とmd5アルゴリズムを使用することをお勧めします。その原理は、HTTPおよびSIPプロトコルの同様の認証に非常に似ています。 これを行うには、最初にチャレンジアクション(リクエスト)を呼び出します。これにより、リクエストマーカーが提供されます。

Action: Challenge

AuthType: md5



Response: Success

Challenge: 84041345









その後、受信した要求のマーカーを取得し、最後に暗号化されていないパスワードを追加し、md5アルゴリズムを使用して結果の文字列のチェックサムを計算できます。 結果は、平文で秘密を渡す必要なく登録に使用できます。 次のようになります。



Action: login

AuthType: MD5

Username: admin

Key: qwf32r23p98yvdspa9h4o4woaewv7







ここで、Keyは結果の量です。



md5入力アルゴリズムは、任意の長さの文字を受け入れ、アルゴリズムの入力に送信された128ビットの指紋またはメッセージプロファイル(メッセージダイジェスト)を出力します。 仮に、同じメッセージプロファイルを持つメッセージまたはメッセージによって生成された2つのメッセージには、特定のメッセージプロファイルがあると考えられています。



メッセージダイジェスト-特別なアルゴリズムを使用して長いメッセージから形成された、固定長の短いデジタル文字列。 md5アルゴリズムは、大きなファイルをRSAなどの公開キー暗号システムを使用して公開キーまたは秘密キーを使用して暗号化する前に安全な方法で「圧縮」する必要があるデジタル署名アプリケーション向けに設計されています。 デジタル署名-送信者の識別とメッセージが署名後に変更されていないことを保証するメッセージの検証を提供する一意の電子識別子であるデジタル署名。



アクションパッケージ



アスタリスクがアクションパケットを送信する時点で、適切な実行のために追加のキーを提供する必要があります。たとえば、コール番号などを決定する必要があります。 さらに、アスタリスク番号計画にログインして、いくつかのパラメーターをチャネル変数に渡すこともできます。 この場合、キー転送プロセスは次のようになります。



Action: <key 1>: <value 1>

<key 2>: <value 2>

.......



, AMI ( Manager' ):



Action: Originate

Channel: SIP/2401

Context: incoming

Exten: 2401

Priority: 1

Callerid: 2401

Variable: ANSWER=1

Variable: _ACC=2







, SIP 2401 . Enter, SIP-. :



Action: Originate

Channel: SIP/2401

Context: incoming

Exten: 2401

Priority: 1

Callerid: 2401

Variable: ANSWER=1

Variable: _ACC=2



Event: Newchannel

Privilege: call,all

Channel: SIP/2401-09a1f418

State: Down

CallerIDNum: CallerIDName: Uniqueid: 1237301090.1



Event: Newcallerid

Privilege: call,all

Channel: SIP/2401-09a1f418

CallerID: 2401

CallerIDName: Uniqueid: 1237301090.1

CID-CallingPres: 0 (Presentation Allowed, Not Screened)



Event: Newstate

Privilege: call,all

Channel: SIP/2401-09a1f418

State: Ringing

CallerID: 2401

CallerIDName: Uniqueid: 1237301090.1



Event: Hangup

Privilege: call,all

Channel: SIP/2401-09a1f418

Uniqueid: 1237301090.1

Cause: 19

Cause-txt: User alerting, no answer



, , CLI ;



asterisk*CLI> manager show eventq







:



Usecount: 1

Category: 2

Event:

Event: Hangup

Privilege: call,all

Channel: SIP/2401-09a1f418

Uniqueid: 1237301603.2

Cause: 21

Cause-txt:







, Originate, AMI. AMI, CLI :



asterisk *CLI> manager show command [_]









read write



read write manager.conf AMI. , AMI manager.conf read write «command», , — privilege:command. , , AMI , :



asterisk*CLI> manager show command Command

Action: Command

Synopsis: Execute Asterisk CLI Command

Privilege: command,all

Description: Run a CLI command.

Variables: (Names marked with * are required)

*Command: Asterisk CLI command to run

ActionID: Optional Action id for message matching.







(Synopsis) , . Privilege , manager.conf , AMI. Variables , . — *Command, ( ), ActionID — .



, manager.conf AMI — (access list). , (events) (actions), . read/write. Read , AMI.



Write , AMI , . read/write, :



system — , , SIP ; call — , , ; log — Logging information, , ; verbose - Verbose information, , ; command — CLI ; agent — , (queue); user — , , UserEvent. , , AGI, AMI ; config - ; dtmf - DTMF ( ); reporting - ; cdr - cdr_manager ( , ); dialplan - NewExten VarSet ( ); originate - ( ).

, AMI . , 1.4 1.6 AMI , - (flow control) , . AMI , AMI .

AMI. ActionID. AMI ¶



AMI , . :



asterisk *CLI> manager show command GetConfig









sip.conf :



Action: GetConfig

Filename: sip.conf

ActionID: 435430239485234







:



Response: Success

ActionID: 435430239485234

Category-000000: general

Line-000000-000000: context=incoming

Line-000000-000001: language=ru

Line-000000-000002: allowguest=yes

Line-000000-000003: bindport=5060

Line-000000-000004: bindaddr=0.0.0.0

Line-000000-000005: dtmfmode=info

Line-000000-000006: disallow=all

Line-000000-000007: allow=alaw

Line-000000-000008: allow=ulaw

Line-000000-000009: allow=gsm

Line-000000-000010: nat=never

Line-000000-000011: canreinvite=no

Category-000001: 2401

Line-000001-000000: type=friend

Line-000001-000001: host=dynamic

Line-000001-000002: username=2401

Line-000001-000003: secret=2401

Line-000001-000004: callerid=2401

Line-000001-000005: context=incoming









Action , , Response ActionID. AMI, ActionID «» , , , (Action-), , Response-. , Response- , AMI. , Action-, Action Response. , AMI .



sip.conf, AMI :



Action: Command

Command: sip reload

ActionID: 230432984582







AMI:



Response: Follows

Privilege: Command

ActionID: 230432984582

--END COMMAND--



Event: ChannelReload

Privilege: system,all

Channel: SIP

ReloadReason: CLIRELOAD (Channel module reload by CLI command)

Registry_Count: 0

Peer_Count: 2

User_Count: 2







AMI . UpdateConfig. , 2402 sip.conf. UpdateConfig :



asterisk*CLI> manager show command UpdateConfig

Action: UpdateConfig

Synopsis: Update basic configuration

Privilege: config,all

Description: A 'UpdateConfig' action will modify, create, or delete

configuration elements in Asterisk configuration files.

Variables (X's represent 6 digit number beginning with 000000):

SrcFilename: Configuration filename to read(eg foo.conf)

DstFilename: Configuration filename to write(eg foo.conf)

Reload: Whether or not a reload should take place (or name of specific module)

Action-XXXXXX: Action to Take (NewCat,RenameCat,DelCat,Update,Delete,Append)

Cat-XXXXXX: Category to operate on

Var-XXXXXX: Variable to work on

Value-XXXXXX: Value to work on

Match-XXXXXX: Extra match required to match line







, . , :



SrcFilename: UpdateConfig, ; DstFilename: , ; Reload: , , , , ; Action-XXXXX: , , . : NewCat, RenameCat, DelCat, Update, Delete Append; Cat-XXXXX: , ; Var-XXXXX: , ; Value-XXXXX: , ; Match-XXXXX: , , , ; ActionID: , , .

: config, all.








Action: <key 1>: <value 1>

<key 2>: <value 2>

.......



, AMI ( Manager' ):



Action: Originate

Channel: SIP/2401

Context: incoming

Exten: 2401

Priority: 1

Callerid: 2401

Variable: ANSWER=1

Variable: _ACC=2







, SIP 2401 . Enter, SIP-. :



Action: Originate

Channel: SIP/2401

Context: incoming

Exten: 2401

Priority: 1

Callerid: 2401

Variable: ANSWER=1

Variable: _ACC=2



Event: Newchannel

Privilege: call,all

Channel: SIP/2401-09a1f418

State: Down

CallerIDNum: CallerIDName: Uniqueid: 1237301090.1



Event: Newcallerid

Privilege: call,all

Channel: SIP/2401-09a1f418

CallerID: 2401

CallerIDName: Uniqueid: 1237301090.1

CID-CallingPres: 0 (Presentation Allowed, Not Screened)



Event: Newstate

Privilege: call,all

Channel: SIP/2401-09a1f418

State: Ringing

CallerID: 2401

CallerIDName: Uniqueid: 1237301090.1



Event: Hangup

Privilege: call,all

Channel: SIP/2401-09a1f418

Uniqueid: 1237301090.1

Cause: 19

Cause-txt: User alerting, no answer



, , CLI ;



asterisk*CLI> manager show eventq







:



Usecount: 1

Category: 2

Event:

Event: Hangup

Privilege: call,all

Channel: SIP/2401-09a1f418

Uniqueid: 1237301603.2

Cause: 21

Cause-txt:







, Originate, AMI. AMI, CLI :



asterisk *CLI> manager show command [_]









read write



read write manager.conf AMI. , AMI manager.conf read write «command», , — privilege:command. , , AMI , :



asterisk*CLI> manager show command Command

Action: Command

Synopsis: Execute Asterisk CLI Command

Privilege: command,all

Description: Run a CLI command.

Variables: (Names marked with * are required)

*Command: Asterisk CLI command to run

ActionID: Optional Action id for message matching.







(Synopsis) , . Privilege , manager.conf , AMI. Variables , . — *Command, ( ), ActionID — .



, manager.conf AMI — (access list). , (events) (actions), . read/write. Read , AMI.



Write , AMI , . read/write, :



system — , , SIP ; call — , , ; log — Logging information, , ; verbose - Verbose information, , ; command — CLI ; agent — , (queue); user — , , UserEvent. , , AGI, AMI ; config - ; dtmf - DTMF ( ); reporting - ; cdr - cdr_manager ( , ); dialplan - NewExten VarSet ( ); originate - ( ).

, AMI . , 1.4 1.6 AMI , - (flow control) , . AMI , AMI .

AMI. ActionID. AMI ¶



AMI , . :



asterisk *CLI> manager show command GetConfig









sip.conf :



Action: GetConfig

Filename: sip.conf

ActionID: 435430239485234







:



Response: Success

ActionID: 435430239485234

Category-000000: general

Line-000000-000000: context=incoming

Line-000000-000001: language=ru

Line-000000-000002: allowguest=yes

Line-000000-000003: bindport=5060

Line-000000-000004: bindaddr=0.0.0.0

Line-000000-000005: dtmfmode=info

Line-000000-000006: disallow=all

Line-000000-000007: allow=alaw

Line-000000-000008: allow=ulaw

Line-000000-000009: allow=gsm

Line-000000-000010: nat=never

Line-000000-000011: canreinvite=no

Category-000001: 2401

Line-000001-000000: type=friend

Line-000001-000001: host=dynamic

Line-000001-000002: username=2401

Line-000001-000003: secret=2401

Line-000001-000004: callerid=2401

Line-000001-000005: context=incoming









Action , , Response ActionID. AMI, ActionID «» , , , (Action-), , Response-. , Response- , AMI. , Action-, Action Response. , AMI .



sip.conf, AMI :



Action: Command

Command: sip reload

ActionID: 230432984582







AMI:



Response: Follows

Privilege: Command

ActionID: 230432984582

--END COMMAND--



Event: ChannelReload

Privilege: system,all

Channel: SIP

ReloadReason: CLIRELOAD (Channel module reload by CLI command)

Registry_Count: 0

Peer_Count: 2

User_Count: 2







AMI . UpdateConfig. , 2402 sip.conf. UpdateConfig :



asterisk*CLI> manager show command UpdateConfig

Action: UpdateConfig

Synopsis: Update basic configuration

Privilege: config,all

Description: A 'UpdateConfig' action will modify, create, or delete

configuration elements in Asterisk configuration files.

Variables (X's represent 6 digit number beginning with 000000):

SrcFilename: Configuration filename to read(eg foo.conf)

DstFilename: Configuration filename to write(eg foo.conf)

Reload: Whether or not a reload should take place (or name of specific module)

Action-XXXXXX: Action to Take (NewCat,RenameCat,DelCat,Update,Delete,Append)

Cat-XXXXXX: Category to operate on

Var-XXXXXX: Variable to work on

Value-XXXXXX: Value to work on

Match-XXXXXX: Extra match required to match line







, . , :



SrcFilename: UpdateConfig, ; DstFilename: , ; Reload: , , , , ; Action-XXXXX: , , . : NewCat, RenameCat, DelCat, Update, Delete Append; Cat-XXXXX: , ; Var-XXXXX: , ; Value-XXXXX: , ; Match-XXXXX: , , , ; ActionID: , , .

: config, all.








Action: <key 1>: <value 1>

<key 2>: <value 2>

.......



, AMI ( Manager' ):



Action: Originate

Channel: SIP/2401

Context: incoming

Exten: 2401

Priority: 1

Callerid: 2401

Variable: ANSWER=1

Variable: _ACC=2







, SIP 2401 . Enter, SIP-. :



Action: Originate

Channel: SIP/2401

Context: incoming

Exten: 2401

Priority: 1

Callerid: 2401

Variable: ANSWER=1

Variable: _ACC=2



Event: Newchannel

Privilege: call,all

Channel: SIP/2401-09a1f418

State: Down

CallerIDNum: CallerIDName: Uniqueid: 1237301090.1



Event: Newcallerid

Privilege: call,all

Channel: SIP/2401-09a1f418

CallerID: 2401

CallerIDName: Uniqueid: 1237301090.1

CID-CallingPres: 0 (Presentation Allowed, Not Screened)



Event: Newstate

Privilege: call,all

Channel: SIP/2401-09a1f418

State: Ringing

CallerID: 2401

CallerIDName: Uniqueid: 1237301090.1



Event: Hangup

Privilege: call,all

Channel: SIP/2401-09a1f418

Uniqueid: 1237301090.1

Cause: 19

Cause-txt: User alerting, no answer



, , CLI ;



asterisk*CLI> manager show eventq







:



Usecount: 1

Category: 2

Event:

Event: Hangup

Privilege: call,all

Channel: SIP/2401-09a1f418

Uniqueid: 1237301603.2

Cause: 21

Cause-txt:







, Originate, AMI. AMI, CLI :



asterisk *CLI> manager show command [_]









read write



read write manager.conf AMI. , AMI manager.conf read write «command», , — privilege:command. , , AMI , :



asterisk*CLI> manager show command Command

Action: Command

Synopsis: Execute Asterisk CLI Command

Privilege: command,all

Description: Run a CLI command.

Variables: (Names marked with * are required)

*Command: Asterisk CLI command to run

ActionID: Optional Action id for message matching.







(Synopsis) , . Privilege , manager.conf , AMI. Variables , . — *Command, ( ), ActionID — .



, manager.conf AMI — (access list). , (events) (actions), . read/write. Read , AMI.



Write , AMI , . read/write, :



system — , , SIP ; call — , , ; log — Logging information, , ; verbose - Verbose information, , ; command — CLI ; agent — , (queue); user — , , UserEvent. , , AGI, AMI ; config - ; dtmf - DTMF ( ); reporting - ; cdr - cdr_manager ( , ); dialplan - NewExten VarSet ( ); originate - ( ).

, AMI . , 1.4 1.6 AMI , - (flow control) , . AMI , AMI .

AMI. ActionID. AMI ¶



AMI , . :



asterisk *CLI> manager show command GetConfig









sip.conf :



Action: GetConfig

Filename: sip.conf

ActionID: 435430239485234







:



Response: Success

ActionID: 435430239485234

Category-000000: general

Line-000000-000000: context=incoming

Line-000000-000001: language=ru

Line-000000-000002: allowguest=yes

Line-000000-000003: bindport=5060

Line-000000-000004: bindaddr=0.0.0.0

Line-000000-000005: dtmfmode=info

Line-000000-000006: disallow=all

Line-000000-000007: allow=alaw

Line-000000-000008: allow=ulaw

Line-000000-000009: allow=gsm

Line-000000-000010: nat=never

Line-000000-000011: canreinvite=no

Category-000001: 2401

Line-000001-000000: type=friend

Line-000001-000001: host=dynamic

Line-000001-000002: username=2401

Line-000001-000003: secret=2401

Line-000001-000004: callerid=2401

Line-000001-000005: context=incoming









Action , , Response ActionID. AMI, ActionID «» , , , (Action-), , Response-. , Response- , AMI. , Action-, Action Response. , AMI .



sip.conf, AMI :



Action: Command

Command: sip reload

ActionID: 230432984582







AMI:



Response: Follows

Privilege: Command

ActionID: 230432984582

--END COMMAND--



Event: ChannelReload

Privilege: system,all

Channel: SIP

ReloadReason: CLIRELOAD (Channel module reload by CLI command)

Registry_Count: 0

Peer_Count: 2

User_Count: 2







AMI . UpdateConfig. , 2402 sip.conf. UpdateConfig :



asterisk*CLI> manager show command UpdateConfig

Action: UpdateConfig

Synopsis: Update basic configuration

Privilege: config,all

Description: A 'UpdateConfig' action will modify, create, or delete

configuration elements in Asterisk configuration files.

Variables (X's represent 6 digit number beginning with 000000):

SrcFilename: Configuration filename to read(eg foo.conf)

DstFilename: Configuration filename to write(eg foo.conf)

Reload: Whether or not a reload should take place (or name of specific module)

Action-XXXXXX: Action to Take (NewCat,RenameCat,DelCat,Update,Delete,Append)

Cat-XXXXXX: Category to operate on

Var-XXXXXX: Variable to work on

Value-XXXXXX: Value to work on

Match-XXXXXX: Extra match required to match line







, . , :



SrcFilename: UpdateConfig, ; DstFilename: , ; Reload: , , , , ; Action-XXXXX: , , . : NewCat, RenameCat, DelCat, Update, Delete Append; Cat-XXXXX: , ; Var-XXXXX: , ; Value-XXXXX: , ; Match-XXXXX: , , , ; ActionID: , , .

: config, all.








Action: <key 1>: <value 1>

<key 2>: <value 2>

.......



, AMI ( Manager' ):



Action: Originate

Channel: SIP/2401

Context: incoming

Exten: 2401

Priority: 1

Callerid: 2401

Variable: ANSWER=1

Variable: _ACC=2







, SIP 2401 . Enter, SIP-. :



Action: Originate

Channel: SIP/2401

Context: incoming

Exten: 2401

Priority: 1

Callerid: 2401

Variable: ANSWER=1

Variable: _ACC=2



Event: Newchannel

Privilege: call,all

Channel: SIP/2401-09a1f418

State: Down

CallerIDNum: CallerIDName: Uniqueid: 1237301090.1



Event: Newcallerid

Privilege: call,all

Channel: SIP/2401-09a1f418

CallerID: 2401

CallerIDName: Uniqueid: 1237301090.1

CID-CallingPres: 0 (Presentation Allowed, Not Screened)



Event: Newstate

Privilege: call,all

Channel: SIP/2401-09a1f418

State: Ringing

CallerID: 2401

CallerIDName: Uniqueid: 1237301090.1



Event: Hangup

Privilege: call,all

Channel: SIP/2401-09a1f418

Uniqueid: 1237301090.1

Cause: 19

Cause-txt: User alerting, no answer



, , CLI ;



asterisk*CLI> manager show eventq







:



Usecount: 1

Category: 2

Event:

Event: Hangup

Privilege: call,all

Channel: SIP/2401-09a1f418

Uniqueid: 1237301603.2

Cause: 21

Cause-txt:







, Originate, AMI. AMI, CLI :



asterisk *CLI> manager show command [_]









read write



read write manager.conf AMI. , AMI manager.conf read write «command», , — privilege:command. , , AMI , :



asterisk*CLI> manager show command Command

Action: Command

Synopsis: Execute Asterisk CLI Command

Privilege: command,all

Description: Run a CLI command.

Variables: (Names marked with * are required)

*Command: Asterisk CLI command to run

ActionID: Optional Action id for message matching.







(Synopsis) , . Privilege , manager.conf , AMI. Variables , . — *Command, ( ), ActionID — .



, manager.conf AMI — (access list). , (events) (actions), . read/write. Read , AMI.



Write , AMI , . read/write, :



system — , , SIP ; call — , , ; log — Logging information, , ; verbose - Verbose information, , ; command — CLI ; agent — , (queue); user — , , UserEvent. , , AGI, AMI ; config - ; dtmf - DTMF ( ); reporting - ; cdr - cdr_manager ( , ); dialplan - NewExten VarSet ( ); originate - ( ).

, AMI . , 1.4 1.6 AMI , - (flow control) , . AMI , AMI .

AMI. ActionID. AMI ¶



AMI , . :



asterisk *CLI> manager show command GetConfig









sip.conf :



Action: GetConfig

Filename: sip.conf

ActionID: 435430239485234







:



Response: Success

ActionID: 435430239485234

Category-000000: general

Line-000000-000000: context=incoming

Line-000000-000001: language=ru

Line-000000-000002: allowguest=yes

Line-000000-000003: bindport=5060

Line-000000-000004: bindaddr=0.0.0.0

Line-000000-000005: dtmfmode=info

Line-000000-000006: disallow=all

Line-000000-000007: allow=alaw

Line-000000-000008: allow=ulaw

Line-000000-000009: allow=gsm

Line-000000-000010: nat=never

Line-000000-000011: canreinvite=no

Category-000001: 2401

Line-000001-000000: type=friend

Line-000001-000001: host=dynamic

Line-000001-000002: username=2401

Line-000001-000003: secret=2401

Line-000001-000004: callerid=2401

Line-000001-000005: context=incoming









Action , , Response ActionID. AMI, ActionID «» , , , (Action-), , Response-. , Response- , AMI. , Action-, Action Response. , AMI .



sip.conf, AMI :



Action: Command

Command: sip reload

ActionID: 230432984582







AMI:



Response: Follows

Privilege: Command

ActionID: 230432984582

--END COMMAND--



Event: ChannelReload

Privilege: system,all

Channel: SIP

ReloadReason: CLIRELOAD (Channel module reload by CLI command)

Registry_Count: 0

Peer_Count: 2

User_Count: 2







AMI . UpdateConfig. , 2402 sip.conf. UpdateConfig :



asterisk*CLI> manager show command UpdateConfig

Action: UpdateConfig

Synopsis: Update basic configuration

Privilege: config,all

Description: A 'UpdateConfig' action will modify, create, or delete

configuration elements in Asterisk configuration files.

Variables (X's represent 6 digit number beginning with 000000):

SrcFilename: Configuration filename to read(eg foo.conf)

DstFilename: Configuration filename to write(eg foo.conf)

Reload: Whether or not a reload should take place (or name of specific module)

Action-XXXXXX: Action to Take (NewCat,RenameCat,DelCat,Update,Delete,Append)

Cat-XXXXXX: Category to operate on

Var-XXXXXX: Variable to work on

Value-XXXXXX: Value to work on

Match-XXXXXX: Extra match required to match line







, . , :



SrcFilename: UpdateConfig, ; DstFilename: , ; Reload: , , , , ; Action-XXXXX: , , . : NewCat, RenameCat, DelCat, Update, Delete Append; Cat-XXXXX: , ; Var-XXXXX: , ; Value-XXXXX: , ; Match-XXXXX: , , , ; ActionID: , , .

: config, all.








Action: <key 1>: <value 1>

<key 2>: <value 2>

.......



, AMI ( Manager' ):



Action: Originate

Channel: SIP/2401

Context: incoming

Exten: 2401

Priority: 1

Callerid: 2401

Variable: ANSWER=1

Variable: _ACC=2







, SIP 2401 . Enter, SIP-. :



Action: Originate

Channel: SIP/2401

Context: incoming

Exten: 2401

Priority: 1

Callerid: 2401

Variable: ANSWER=1

Variable: _ACC=2



Event: Newchannel

Privilege: call,all

Channel: SIP/2401-09a1f418

State: Down

CallerIDNum: CallerIDName: Uniqueid: 1237301090.1



Event: Newcallerid

Privilege: call,all

Channel: SIP/2401-09a1f418

CallerID: 2401

CallerIDName: Uniqueid: 1237301090.1

CID-CallingPres: 0 (Presentation Allowed, Not Screened)



Event: Newstate

Privilege: call,all

Channel: SIP/2401-09a1f418

State: Ringing

CallerID: 2401

CallerIDName: Uniqueid: 1237301090.1



Event: Hangup

Privilege: call,all

Channel: SIP/2401-09a1f418

Uniqueid: 1237301090.1

Cause: 19

Cause-txt: User alerting, no answer



, , CLI ;



asterisk*CLI> manager show eventq







:



Usecount: 1

Category: 2

Event:

Event: Hangup

Privilege: call,all

Channel: SIP/2401-09a1f418

Uniqueid: 1237301603.2

Cause: 21

Cause-txt:







, Originate, AMI. AMI, CLI :



asterisk *CLI> manager show command [_]









read write



read write manager.conf AMI. , AMI manager.conf read write «command», , — privilege:command. , , AMI , :



asterisk*CLI> manager show command Command

Action: Command

Synopsis: Execute Asterisk CLI Command

Privilege: command,all

Description: Run a CLI command.

Variables: (Names marked with * are required)

*Command: Asterisk CLI command to run

ActionID: Optional Action id for message matching.







(Synopsis) , . Privilege , manager.conf , AMI. Variables , . — *Command, ( ), ActionID — .



, manager.conf AMI — (access list). , (events) (actions), . read/write. Read , AMI.



Write , AMI , . read/write, :



system — , , SIP ; call — , , ; log — Logging information, , ; verbose - Verbose information, , ; command — CLI ; agent — , (queue); user — , , UserEvent. , , AGI, AMI ; config - ; dtmf - DTMF ( ); reporting - ; cdr - cdr_manager ( , ); dialplan - NewExten VarSet ( ); originate - ( ).

, AMI . , 1.4 1.6 AMI , - (flow control) , . AMI , AMI .

AMI. ActionID. AMI ¶



AMI , . :



asterisk *CLI> manager show command GetConfig









sip.conf :



Action: GetConfig

Filename: sip.conf

ActionID: 435430239485234







:



Response: Success

ActionID: 435430239485234

Category-000000: general

Line-000000-000000: context=incoming

Line-000000-000001: language=ru

Line-000000-000002: allowguest=yes

Line-000000-000003: bindport=5060

Line-000000-000004: bindaddr=0.0.0.0

Line-000000-000005: dtmfmode=info

Line-000000-000006: disallow=all

Line-000000-000007: allow=alaw

Line-000000-000008: allow=ulaw

Line-000000-000009: allow=gsm

Line-000000-000010: nat=never

Line-000000-000011: canreinvite=no

Category-000001: 2401

Line-000001-000000: type=friend

Line-000001-000001: host=dynamic

Line-000001-000002: username=2401

Line-000001-000003: secret=2401

Line-000001-000004: callerid=2401

Line-000001-000005: context=incoming









Action , , Response ActionID. AMI, ActionID «» , , , (Action-), , Response-. , Response- , AMI. , Action-, Action Response. , AMI .



sip.conf, AMI :



Action: Command

Command: sip reload

ActionID: 230432984582







AMI:



Response: Follows

Privilege: Command

ActionID: 230432984582

--END COMMAND--



Event: ChannelReload

Privilege: system,all

Channel: SIP

ReloadReason: CLIRELOAD (Channel module reload by CLI command)

Registry_Count: 0

Peer_Count: 2

User_Count: 2







AMI . UpdateConfig. , 2402 sip.conf. UpdateConfig :



asterisk*CLI> manager show command UpdateConfig

Action: UpdateConfig

Synopsis: Update basic configuration

Privilege: config,all

Description: A 'UpdateConfig' action will modify, create, or delete

configuration elements in Asterisk configuration files.

Variables (X's represent 6 digit number beginning with 000000):

SrcFilename: Configuration filename to read(eg foo.conf)

DstFilename: Configuration filename to write(eg foo.conf)

Reload: Whether or not a reload should take place (or name of specific module)

Action-XXXXXX: Action to Take (NewCat,RenameCat,DelCat,Update,Delete,Append)

Cat-XXXXXX: Category to operate on

Var-XXXXXX: Variable to work on

Value-XXXXXX: Value to work on

Match-XXXXXX: Extra match required to match line







, . , :



SrcFilename: UpdateConfig, ; DstFilename: , ; Reload: , , , , ; Action-XXXXX: , , . : NewCat, RenameCat, DelCat, Update, Delete Append; Cat-XXXXX: , ; Var-XXXXX: , ; Value-XXXXX: , ; Match-XXXXX: , , , ; ActionID: , , .

: config, all.











All Articles