AMI buffering event output?

Home » Asterisk Users » AMI buffering event output?
Asterisk Users 4 Comments


I’m seeing weird behavior with AMI where no events are output until
some input is detected (can be an empty line), at which time all the
buffered output is spewed out at once.

I am maintaining multiple Asterisk installations, and with one
installation I have run into a weird buffering problem with AMI.
The version is in this particular case, which I am running at
multiple locations, all without this problem. Additionally I have
tried version and, and the problem is consistent
across these versions.

manager.conf is identical across all these installations.

The problem presents with a php script that opens a socket directly to
AMI, a telnet client from the local machine to the AMI, but not when I
telnet from the machine to a remote machine running AMI.

Does anyone have any input as to what I can try?

Best regards,

4 thoughts on - AMI buffering event output?

  • We use Python and StarPy extensively for the TestSuite with no buffering

  • Are you 100% sure it’s happening when you use telnet on the local machine?

    Are you passing two carriage returns after logging in?

  • Hi Matt,

    Yes, passing two carriage returns. I login successfully. Here’s
    example output (with my comments in [])

    Connected to localhost.
    Escape character is ‘^]’.
    Asterisk Call Manager/1.1
    action: login
    username: phpagi
    secret: supersecretpassword
    events: on

    Response: Success
    Message: Authentication accepted

    [No output after this point until I pass carriage return]

    [Now I press carriage return and two events appear, along with an
    error message for missing action]

    Event: PeerStatus
    Privilege: system,all
    ChannelType: SIP
    Peer: SIP/2170
    PeerStatus: Unregistered
    Cause: Expired

    Event: ExtensionStatus
    Privilege: call,all
    Exten: 2170
    Context: default
    Hint: SIP/2170
    Status: 4

    Response: Error
    Message: Missing action in request

  • It seems somewhat impossible that you would be getting different results
    from different hosts. Are you using the same login?

    What if you use the external IP rather than