Class AsteriskHandler.AmiStringMap

  • Enclosing class:
    AsteriskHandler

    public static class AsteriskHandler.AmiStringMap
    extends StringMap
    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.