Great idea/strategy, thank you! Going to be c00l if I can get this working
regards, -- Chris "Jared Smith" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > On Thu, 2007-07-19 at 09:16 -0400, Chris Earle wrote: > > Trying to do what should be a basic info retrieval from my asterisk > > network -- get the list of IAXPeers and break down by IP, name, and Status > > etc. > > Unfortunately, this is one of those cases where the AMI output is the > same as the CLI output, which makes it difficult to parse. (Regular > expressions can help, but you obviously have an aversion to them, so > we'll use another method.) As long as your IAX peer names are shorter > than 16 characters, you can use a trick I've used for a while... first > get the list of iax2 peer names: > > Action: IAXPeers > ActionID: 987325918659161 > > ActionID: 987325918659161 > Name/Username Host Mask Port > Status > flibbertygibbit (Unspecified) (D) 255.255.255.255 0 > Unmonitored > demo/asterisk 216.207.245.47 (S) 255.255.255.255 4569 > Unmonitored > 2 iax2 peers [0 online, 0 offline, 2 unmonitored] > > and break on the first space or forward slash. Once I have an array of > IAX peer names, I use the Command action to run "iax2 show peer > <peername>" on each of the IAX peers, like this: > > Action: Command > Command: iax2 show peer flibbertygibbit > ActionID: 762315185916555 > > Response: Follows > Privilege: Command > ActionID: 762315185916555 > > > * Name : flibbertygibbit > Secret : <Not set> > Context : blah > Mailbox : > Dynamic : Yes > Callerid : "" <> > Expire : -1 > ACL : No > Addr->IP : (Unspecified) Port 0 > Defaddr->IP : 0.0.0.0 Port 4569 > Username : hullabaloo > Codecs : 0xe703 (g723|gsm|g729|speex|ilbc) > Codec Order : (none) > Status : Unmonitored > Qualify : every 60000ms when OK, every 10000ms when UNREACHABLE > (sample smoothing Off) > > --END COMMAND-- > > That output is obviously somewhat easier to parse, although it's not > perfect either. Hopefully the Asterisk development community will > eventually get around to rewriting much of the AMI actions to make their > output easier for programs to parse. > > -- > Jared Smith > Community Relations Manager > Digium, Inc. > > _______________________________________________ > --Bandwidth and Colocation Provided by http://www.api-digital.com-- > > asterisk-users mailing list > To UNSUBSCRIBE or update options visit: > http://lists.digium.com/mailman/listinfo/asterisk-users > _______________________________________________ --Bandwidth and Colocation Provided by http://www.api-digital.com-- asterisk-users mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users