System information
This is the method that was used in the quick-start example, as seen in “AMI over
HTTP” on page 459. The second authentication option is HTTP digest authentica-
tion.
*
The next three sections discuss each of the AMI over HTTP encoding options.
To indicate that HTTP digest authentication should be used, prefix the encoding type
with an a.
Once successfully authenticated, Asterisk will provide a cookie that identifies the au-
thenticated session. Here is an example response to the Login action that includes a
session cookie from Asterisk:
$ curl -v "http://localhost:8088/rawman?action=login&username=hello&secret=world"
* About to connect() to localhost port 8088 (#0)
* Trying 127.0.0.1... connected
* Connected to localhost (127.0.0.1) port 8088 (#0)
> GET /rawman?action=login&username=hello&secret=worlda HTTP/1.1
> User-Agent: curl/7.19.7 (x86_64-pc-linux-gnu) libcurl/7.19.7
OpenSSL/0.9.8k zlib/1.2.3.3 libidn/1.15
> Host: localhost:8088
> Accept: */*
>
< HTTP/1.1 200 OK
< Server: Asterisk/1.8.0-beta4
< Date: Tue, 07 Sep 2010 11:51:28 GMT
< Connection: close
< Cache-Control: no-cache, no-store
< Content-Length: 55
< Content-type: text/plain
< Cache-Control: no-cache;
< Set-Cookie: mansession_id="0e929e60"; Version=1; Max-Age=60
< Pragma: SuppressEvents
<
Response: Success
Message: Authentication accepted
* Closing connection #0
/rawman encoding
The rawman encoding type is what has been used in all the AMI over HTTP examples
in this chapter so far. The responses received from requests using rawman are formatted
in the exact same way that they would be if the requests were sent over a direct TCP
connection to the AMI.
* At the time of writing, there is a problem with HTTP digest authentication that prevents it from working
properly. Issue 18598 in the Asterisk project issue tracker has been opened for this problem. Hopefully it will
be fixed by the time you read this.
468 | Chapter 20: Asterisk Manager Interface (AMI)