text stringlengths 0 152 |
|---|
This example shows these steps: |
1. Connect to the AMI over a TCP socket on port 5038. |
2. Log in using the Login action. |
3. Execute the Ping action. |
4. Log off using the Logoff action. |
Here’s how to do that using telnet: |
$ telnet localhost 5038 |
Trying 127.0.0.1... |
Connected to localhost. |
Escape character is '^]'. |
Asterisk Call Manager/4.0.3 |
You’ve connected, but it’s going to hang up on you unless you authenticate yourself. |
Paste the following into the telnet window: |
Action: Login |
Username: hello |
Secret: world |
Note there needs to be a blank line after the commands (press Enter after you paste |
everything if nothing happens). |
Response: Success |
Message: Authentication accepted |
OK, it likes us. Let’s run a simple command just to verify it’s really talking to us: |
Action: Ping |
Response: Success |
Ping: Pong |
So far, so good. We’ll just tidy up and log off now. |
302 |
| |
Chapter 17: Asterisk Manager Interface and Call Files |
Action: Logoff |
Response: Goodbye |
Message: Thanks for all the fish. |
Connection closed by foreign host. |
You have verified that AMI is accepting connections via a TCP connection. |
AMI over HTTP |
It is also possible to use the AMI over HTTP. We will perform the same actions as |
before, but over HTTP instead of the native TCP interface to the AMI. AMI over |
HTTP is covered in more detail in “AMI over HTTP” on page 308. |
Accounts used for connecting to the AMI over HTTP are the same |
accounts configured in /etc/asterisk/manager.conf. |
This example demonstrates how to access the AMI over HTTP, log in, execute the |
Ping action, and log off: |
$ curl "http://localhost:8088/rawman?action=login&username=hello&secret=world" \ |
-c /tmp/tempcookie |
Response: Success |
Message: Authentication accepted |
$ curl "http://localhost:8088/rawman?action=ping" -b /tmp/tempcookie |
Response: Success |
Ping: Pong |
Timestamp: 1538871944.474131 |
$ curl "http://localhost:8088/rawman?action=logoff" -b /tmp/tempcookie |
Response: Goodbye |
Message: Thanks for all the fish. |
The HTTP interface to AMI lets you integrate Asterisk call control into a web service. |
Configuration |
The section “AMI Quick Start” on page 301 showed a very basic set of configuration |
files to get you started. There are many ways you can fine-tune the configuration of |
the AMI. |
Configuration |
| |
303 |
manager.conf |
The main configuration file for the AMI is /etc/asterisk/manager.conf. The [general] |
section contains options that control the overall operation of the AMI. Any other sec‐ |
tions in the manager.conf file will define accounts for logging in and using the AMI. |
The sample file contains detailed explanations of the various parameters, and can be |
found in ~/src/asterisk-15<TAB>/configs/samples/manager.conf.sample. |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.