Package sunlabs.brazil.asterisk
Class AsteriskHandler.AmiStringMap
java.lang.Object
java.util.Dictionary
sunlabs.brazil.util.StringMap
sunlabs.brazil.asterisk.AsteriskHandler.AmiStringMap
- Enclosing class:
- AsteriskHandler
This class is built on top of the StringMap class and
adds methods for reading Asterisk ManagerInterface replies.
AMI responses are either:
- Mime-style headers, followed by a blank line, or
- The header "Response: follows", followed by zero or more
additional headers, followed by one or more
lines of output, followed by the line:
--END COMMAND--Unfortunately, the first line of the following response can have a ":" in it, making it indistinguishable from another header [they should'a added a blank line after the last header]. We need to use some heuristics to figure out if it's a header or data. grumph!
XXX to do:
Any time data follows, the "ActionID" key (if present) will always
be the last key before the data starts. We could use that, or if
the data consists of what looks like headers, then just make them
headers, and don't stuff them into "data", which is sort-of what
happens now.
In the second case, all the response data is put in a header called:
data:
This is modelled after MimeHeaders.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncommandify
(String id) Turn an AmiMap into an asterisk command.static String
commandify
(StringMap map, String id) void
read
(HttpInputStream in)
-
Constructor Details
-
AmiStringMap
public AmiStringMap() -
AmiStringMap
-
-
Method Details
-
read
- Throws:
IOException
-
commandify
Turn an AmiMap into an asterisk command. Make sure the "Action" keyword exists and is first.- Returns:
- null if there wasn't a valid command
-
commandify
-