Re: [PEPr] +1 for Networking::AsteriskManager
| From: | Doug Bromley | Date: | Sat, 10 May 2008 09:03:57 +0000 |
| Subject: | Re: [PEPr] +1 for Networking::AsteriskManager | ||
| References: | 1 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-50056@lists.php.net to get a copy of this message | ||
Hi Till and PEAR
This is all great feedback - thank you!
I really appreciate it.
I've been working on what you've stated below and can give the following updates:
* Exception Class - Created and being used.
* Exception constants being used in class too. E.g. AUTHFAIL, NOSOCKET, etc.
* Fixed the auto_connect==false bug.
* connect() now returns true on connection.
* The socket check code has all been wrapped into a single static method. If there isn't a socket an exception is raised.
* fputs changed to fwrite.
* I've put many of the fwrite calls into their own method as suggested and now checked for falseness - exception thrown of type COMMERROR if it fails (returns false).
* Done the same with stream_get_contents.
* Taken out unnecessary else statements.
About the roadmap. Its mainly in my head at the moment - but I'm going to put this into a document and publish it on the Google Project site ASAP.
I plan on implementing the full Asterisk Manager interface. My priorities were on sorting ParkedCalls, Redirect, SetVar and Events initially. I'll move onto Zap commands afterwards.
I was going to hold off branching into seperate classes for a little while as I may well be implementing some of the AGI too - someone on the Project site has shown an interest in contributing some of the code for that - could be some great possibilities there.
Do all of the above updates meet the conditional requirements Till? If there's anything else I need to complete please let me know.
As always I'm very interested in your comments!
Have a great weekend everyone.
Doug.
P.S. I shall be giving an update on Philippes suggestions in a seperate email.
Till Klampaeckel wrote:
Till Klampaeckel (http://pear.php.net/user/till) has voted +1 on the proposal for Networking::AsteriskManager. Proposal information: http://pear.php.net/pepr/pepr-proposal-show.php?id=543 Vote information: http://pear.php.net/pepr/pepr-vote-show.php?id=543&handle=till This vote is conditional. The condition is: * create your own exception class (extending PEAR_Exception) * use a code when you throw an exception, e.g. implement codes through class constants and e.g. use self::ERR_NO_SOCKET. this allows people to check what kind of exception they received. * if i supply auto_connect = false, it would still call connect() (from __construct()) * connect() doesn't return anything (doc problem) * wrap your "if (!$this->_socket)" into a method and also check if it's a resource (not just if it's not false) * instead of fputs(), you should use fwrite() (imho) * fputs/fwrite can return false, shouldn't that be checked? * stream_get_contents can also return false (Maybe wrap those calls into their own method and throw an exception if it doesn't work for some reason.) * simplify your if/else (most time the else is not necessary) * unless PEAR_Exception implements toString(), you will have to do echo $e->getMessage() in your example Last but not least, I'd like to see more of the API supported (this can be done on the way to 1.0-stable), regardless - what's your own plan/roadmap for this? One last suggestion/question - I wonder if it would make sense to subclass e.g. create Net_AsteriskManager_Queue, Net_AsteriskManager_Sip, *_Zap, *_Monitor, *_Mailbox, etc.. This would maybe help organize the feature-set, otherwise you end up with a couple dozen methods in Net_AsteriskManager.-- Essential Systems Ltd. 137 Golden Cross Lane Catshill Bromsgrove B61 7DY Tel: 0845 867 9002 DiD: 01527 557288 Fax: 01527 557271 Mob: 07943 233397