Got home rather late from the Toronto Asterisk User's Group meeting, hanging out with Leigh, Simon and Shidan afterward at the restaurant and then the bubble tea place. Unfortunately, got home wired for sound because of all the sugar in the bubble tea (rather too much IMO), so I decided to take a crack at writing an AMI protocol for Twisted.
I know, I know, why another one? Don' t actually know :) .
I've gone with raising of errors (actually calling errbacks), rather than having the coder do error-checking for each response value. Seems more robust than the error-checking approach.
Code is about 330 lines, including minimal docstrings. There's some trivial usage examples/tests at the bottom of the file. I don't claim it's lovely, but then I wrote it in the middle of the night on a sugar high.
Oh, and before anyone points it out, yes, I should have done more generic programming in there, I wasn't intending to implement the whole API tonight, so I wasn't too worried about it, and by the time I realised I may as well go ahead with most of it as I was pretty close to done.
Anyway, the current draft is in the scripts archive. I'll likely be polishing things up over the next few days and likely doing something about the reactive part of the API (i.e. watching and collating events), but feel free to play and comment.
Pingbacks are closed.