Asterisk agi-command: Difference between revisions
(One intermediate revision by the same user not shown) | |||
Line 174: | Line 174: | ||
=== See also === | === See also === | ||
* https://wiki.asterisk.org/wiki/display/AST/Asterisk+15+AGICommand_exec | * https://wiki.asterisk.org/wiki/display/AST/Asterisk+15+AGICommand_exec | ||
* https://wiki.asterisk.org/wiki/display/AST/Asterisk+15+Application_AGI | |||
== get data == | |||
Prompts for DTMF on a channel. | |||
Stream the given file, and receive DTMF data. | |||
Returns the digits received from the channel at the other end. | |||
<pre> | |||
GET DATA FILE TIMEOUT MAXDIGITS | |||
</pre> | |||
* file | |||
* timeout | |||
* maxdigits | |||
=== See also === | |||
* https://wiki.asterisk.org/wiki/display/AST/Asterisk+15+AGICommand_get+data | |||
* https://wiki.asterisk.org/wiki/display/AST/Asterisk+15+Application_AGI | |||
== wait for digit == | |||
Waits for a digit to be pressed. | |||
Waits up to timeout milliseconds for channel to receive a DTMF digit. Return -1 on channel failure, 0 if no digit is received in the timeout, or the numerical value of the ascii of the digit if one is received. | |||
Use -1 for the timeout value if you desire the call to block indefinitely. | |||
<pre> | |||
WAIT FOR DIGIT TIMEOUT | |||
</pre> | |||
* timeout: Timeout(milliseconds) | |||
=== Example === | |||
<pre> | |||
Action: AGI | |||
Channel: PJSIP/agent-01-00000016 | |||
Command: wait for digit 3000000 | |||
CommandID: b76fd414-292e-49b4-aee1-2f3ec42ec4ae | |||
Response: Success | |||
Message: Added AGI command to queue | |||
Event: AGIExecStart | |||
Privilege: agi,all | |||
Channel: PJSIP/agent-01-00000016 | |||
ChannelState: 6 | |||
ChannelStateDesc: Up | |||
CallerIDNum: agent-01 | |||
CallerIDName: agent-01 | |||
ConnectedLineNum: <unknown> | |||
ConnectedLineName: <unknown> | |||
Language: en | |||
AccountCode: | |||
Context: sample-agi-async | |||
Exten: s | |||
Priority: 3 | |||
Uniqueid: 1516711147.41 | |||
Linkedid: 1516711147.41 | |||
CommandId: 329891398 | |||
Command: wait for digit 3000000 | |||
Event: DTMFBegin | |||
Privilege: dtmf,all | |||
Channel: PJSIP/agent-01-00000016 | |||
ChannelState: 6 | |||
ChannelStateDesc: Up | |||
CallerIDNum: agent-01 | |||
CallerIDName: agent-01 | |||
ConnectedLineNum: <unknown> | |||
ConnectedLineName: <unknown> | |||
Language: en | |||
AccountCode: | |||
Context: sample-agi-async | |||
Exten: s | |||
Priority: 3 | |||
Uniqueid: 1516711147.41 | |||
Linkedid: 1516711147.41 | |||
Digit: 1 | |||
Direction: Received | |||
Event: DTMFEnd | |||
Privilege: dtmf,all | |||
Channel: PJSIP/agent-01-00000016 | |||
ChannelState: 6 | |||
ChannelStateDesc: Up | |||
CallerIDNum: agent-01 | |||
CallerIDName: agent-01 | |||
ConnectedLineNum: <unknown> | |||
ConnectedLineName: <unknown> | |||
Language: en | |||
AccountCode: | |||
Context: sample-agi-async | |||
Exten: s | |||
Priority: 3 | |||
Uniqueid: 1516711147.41 | |||
Linkedid: 1516711147.41 | |||
Digit: 1 | |||
DurationMs: 200 | |||
Direction: Received | |||
Event: AsyncAGIExec | |||
Privilege: agi,all | |||
Channel: PJSIP/agent-01-00000016 | |||
ChannelState: 6 | |||
ChannelStateDesc: Up | |||
CallerIDNum: agent-01 | |||
CallerIDName: agent-01 | |||
ConnectedLineNum: <unknown> | |||
ConnectedLineName: <unknown> | |||
Language: en | |||
AccountCode: | |||
Context: sample-agi-async | |||
Exten: s | |||
Priority: 3 | |||
Uniqueid: 1516711147.41 | |||
Linkedid: 1516711147.41 | |||
CommandId: b76fd414-292e-49b4-aee1-2f3ec42ec4ae | |||
Result: 200%20result%3D49%0A | |||
</pre> | |||
=== See also === | |||
* https://wiki.asterisk.org/wiki/display/AST/Asterisk+15+AGICommand_wait+for+digit | |||
* https://wiki.asterisk.org/wiki/display/AST/Asterisk+15+Application_AGI | * https://wiki.asterisk.org/wiki/display/AST/Asterisk+15+Application_AGI | ||
[[category:Asterisk]] | [[category:Asterisk]] |
Latest revision as of 13:21, 23 January 2018
Overview
Asterisk AGI(Asterisk Gateway Interface) Command 내용 정리
ANSWER
Answer channel.
Answers channel if not already in answer state. Returns -1 on channel failure, or 0 if successful.
ANSWER
See also
- https://wiki.asterisk.org/wiki/display/AST/Asterisk+15+AGICommand_answer
- https://wiki.asterisk.org/wiki/display/AST/Asterisk+15+AGICommand_hangup
- https://wiki.asterisk.org/wiki/display/AST/Asterisk+15+Application_AGI
ASYNCAGI BREAK
Interrupts Async AGI.
Interrupts expected flow of Async AGI commands and returns control to previous source(typically, the PBX dialplan).
ASYNCAGI BREAK
See also
- https://wiki.asterisk.org/wiki/display/AST/Asterisk+15+AGICommand_asyncagi+break
- https://wiki.asterisk.org/wiki/display/AST/Asterisk+15+AGICommand_hangup
- https://wiki.asterisk.org/wiki/display/AST/Asterisk+15+Application_AGI
CHANNEL STATUS
Returns status of the connected channel.
Returns the status of the specified channelname. If no channel name is given then returns the status of the current channel.
CHANNEL STATUS CHANNELNAME
- CHANNELNAME: Channel name.
Return values
- 0: Channel is down and available.
- 1: Channel is down, but reserved.
- 2: Channel is off hook.
- 3: Digits (or equivalent) have been dialed.
- 4: Line is ringing.
- 5: Remote end is ringing.
- 6: Line is up.
- 7: Line is busy.
See also
- https://wiki.asterisk.org/wiki/display/AST/Asterisk+15+AGICommand_channel+status
- https://wiki.asterisk.org/wiki/display/AST/Asterisk+15+Application_AGI
CONTROL STREAM FILE
Sends audio file on channel and allows the listener to control the stream.
Send the given file, allowing playback to be controlled by the given digits, if any. Use double quotes for the digits if you wish none to be permitted. If offsetms is provided then the audio will seek to offsetms before play starts.
Returns 0 if playback completes without a digit being pressed, or the ASCII numerical value of the digit if one was pressed, or -1 on error or if the channel was disconnected. Returns the position where playback was terminated as endpos.
It sets the following channel variables upon completion.
- CPLAYBACKSTATUS: Contains the status of the attempt as a text string.
- SUCCESS
- USERSTOPPED
- REMOTESTOPPED
- ERROR
- CPLAYBACKOFFSET: Contains the offset in ms into the file where playback was at when it stopped. -1 is end of file.
- CPLAYBACKSTOPKEY: If the playback is stopped by the user, this variable contains the key that was pressed.
CONTROL STREAM FILE FILENAME ESCAPE_DIGITS SKIPMS FFCHAR REWCHR PAUSECHR OFFSETMS
- filename: The file extension must not be included in the filename.
- escape_digits
- skipms
- ffchar: Defaults to #
- rewchr: Defaults to *
- pausechr
- offsetms: Offset, in milliseconds, to start the audio playback.
See also
- https://wiki.asterisk.org/wiki/display/AST/Asterisk+15+AGICommand_control+stream+file
- https://wiki.asterisk.org/wiki/display/AST/Asterisk+15+AGICommand_get+option
- https://wiki.asterisk.org/wiki/display/AST/Asterisk+15+Application_AGI
DATABASE DEL
Removes database key/value.
Deletes an entry in the Asterisk database for a given family and key.
Returns 1 if successful, 0 otherwise.
DATABASE DEL FAMILY KEY
- family
- key
See also
- https://wiki.asterisk.org/wiki/display/AST/Asterisk+15+AGICommand_database+del
- https://wiki.asterisk.org/wiki/display/AST/Asterisk+15+AGICommand_database+get
- https://wiki.asterisk.org/wiki/display/AST/Asterisk+15+AGICommand_database+put
- https://wiki.asterisk.org/wiki/display/AST/Asterisk+15+AGICommand_database+deltree
- https://wiki.asterisk.org/wiki/display/AST/Asterisk+15+Application_AGI
DATABASE DELTREE
Removes database keytree/value
Deletes a family or specific keytree within a family in the Asterisk database.
Returns 1 if successful, 0 otherwise.
DATABASE DELTREE FAMILY KEYTREE
- family
- keytree
See also
- https://wiki.asterisk.org/wiki/display/AST/Asterisk+15+AGICommand_database+deltree
- https://wiki.asterisk.org/wiki/display/AST/Asterisk+15+AGICommand_database+get
- https://wiki.asterisk.org/wiki/display/AST/Asterisk+15+AGICommand_database+put
- https://wiki.asterisk.org/wiki/display/AST/Asterisk+15+AGICommand_database+del
- https://wiki.asterisk.org/wiki/display/AST/Asterisk+15+Application_AGI
DATABASE GET
Gets database value.
Retrieves an entry in the Asterisk database for a given family and key.
Returns 0 if key is not set. Returns 1 if key is sest and returns the variable in parenthesis.
DATABASE GET FAMILY KEY
- family
- key
See also
- https://wiki.asterisk.org/wiki/display/AST/Asterisk+15+AGICommand_database+get
- https://wiki.asterisk.org/wiki/display/AST/Asterisk+15+AGICommand_database+put
- https://wiki.asterisk.org/wiki/display/AST/Asterisk+15+AGICommand_database+del
- https://wiki.asterisk.org/wiki/display/AST/Asterisk+15+AGICommand_database+deltree
- https://wiki.asterisk.org/wiki/display/AST/Asterisk+15+Application_AGI
DATABASE PUT
Adds/updates database value.
Adds or updates an entry in the Asterisk database for a given family, key and value.
Returns 1 if successful, 0 otherwise.
DATABASE PUT FAMILY KEY VALUE
- family
- key
- value
See also
- https://wiki.asterisk.org/wiki/display/AST/Asterisk+15+AGICommand_database+put
- https://wiki.asterisk.org/wiki/display/AST/Asterisk+15+AGICommand_database+get
- https://wiki.asterisk.org/wiki/display/AST/Asterisk+15+AGICommand_database+del
- https://wiki.asterisk.org/wiki/display/AST/Asterisk+15+AGICommand_database+deltree
- https://wiki.asterisk.org/wiki/display/AST/Asterisk+15+Application_AGI
EXEC
Executes a given Application.
Executes application with given options.
Returns whatever the application returns, or -2 on failure to find application.
EXEC APPLICATION OPTIONS
- application
- options
See also
- https://wiki.asterisk.org/wiki/display/AST/Asterisk+15+AGICommand_exec
- https://wiki.asterisk.org/wiki/display/AST/Asterisk+15+Application_AGI
get data
Prompts for DTMF on a channel.
Stream the given file, and receive DTMF data.
Returns the digits received from the channel at the other end.
GET DATA FILE TIMEOUT MAXDIGITS
- file
- timeout
- maxdigits
See also
- https://wiki.asterisk.org/wiki/display/AST/Asterisk+15+AGICommand_get+data
- https://wiki.asterisk.org/wiki/display/AST/Asterisk+15+Application_AGI
wait for digit
Waits for a digit to be pressed.
Waits up to timeout milliseconds for channel to receive a DTMF digit. Return -1 on channel failure, 0 if no digit is received in the timeout, or the numerical value of the ascii of the digit if one is received.
Use -1 for the timeout value if you desire the call to block indefinitely.
WAIT FOR DIGIT TIMEOUT
- timeout: Timeout(milliseconds)
Example
Action: AGI Channel: PJSIP/agent-01-00000016 Command: wait for digit 3000000 CommandID: b76fd414-292e-49b4-aee1-2f3ec42ec4ae Response: Success Message: Added AGI command to queue Event: AGIExecStart Privilege: agi,all Channel: PJSIP/agent-01-00000016 ChannelState: 6 ChannelStateDesc: Up CallerIDNum: agent-01 CallerIDName: agent-01 ConnectedLineNum: <unknown> ConnectedLineName: <unknown> Language: en AccountCode: Context: sample-agi-async Exten: s Priority: 3 Uniqueid: 1516711147.41 Linkedid: 1516711147.41 CommandId: 329891398 Command: wait for digit 3000000 Event: DTMFBegin Privilege: dtmf,all Channel: PJSIP/agent-01-00000016 ChannelState: 6 ChannelStateDesc: Up CallerIDNum: agent-01 CallerIDName: agent-01 ConnectedLineNum: <unknown> ConnectedLineName: <unknown> Language: en AccountCode: Context: sample-agi-async Exten: s Priority: 3 Uniqueid: 1516711147.41 Linkedid: 1516711147.41 Digit: 1 Direction: Received Event: DTMFEnd Privilege: dtmf,all Channel: PJSIP/agent-01-00000016 ChannelState: 6 ChannelStateDesc: Up CallerIDNum: agent-01 CallerIDName: agent-01 ConnectedLineNum: <unknown> ConnectedLineName: <unknown> Language: en AccountCode: Context: sample-agi-async Exten: s Priority: 3 Uniqueid: 1516711147.41 Linkedid: 1516711147.41 Digit: 1 DurationMs: 200 Direction: Received Event: AsyncAGIExec Privilege: agi,all Channel: PJSIP/agent-01-00000016 ChannelState: 6 ChannelStateDesc: Up CallerIDNum: agent-01 CallerIDName: agent-01 ConnectedLineNum: <unknown> ConnectedLineName: <unknown> Language: en AccountCode: Context: sample-agi-async Exten: s Priority: 3 Uniqueid: 1516711147.41 Linkedid: 1516711147.41 CommandId: b76fd414-292e-49b4-aee1-2f3ec42ec4ae Result: 200%20result%3D49%0A