<DIV>I was using the Asterisk::Manager perl module and had some troube with it</DIV>
<DIV>so I decided to make my own.&nbsp; I have a pretty good prototype after a few hours </DIV>
<DIV>(My main point about the protocol is at the bottom of this example.)</DIV>
<DIV>&nbsp;</DIV>
<DIV><A href="http://asterisk.650dialup.com">http://asterisk.650dialup.com</A>&nbsp;is where you can download it.</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>my $man&nbsp; = init Asterisk::AstMan ({<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -user =&gt; "asterisk",<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -secret =&gt; "1234",<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -host =&gt; "localhost"<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; });</DIV>
<DIV>&nbsp;</DIV>
<DIV>This auths you and logs you in </DIV>
<DIV>you can do usual stuff like </DIV>
<DIV>&nbsp;</DIV>
<DIV>print $man-&gt;command("show agents");<BR>print $man-&gt;command("show queues");<BR>print $man-&gt;command("show channels");</DIV>
<DIV>&nbsp;</DIV>
<DIV>The cool part is you can register a code ref to a certian Event </DIV>
<DIV>and then listen on the socket all day and the code registered to that certian event </DIV>
<DIV>will fire.</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>$newext = sub {<BR>&nbsp;&nbsp;# $ref will be a hash ref of all the parameters in the event</DIV>
<DIV>&nbsp; my $ref = shift;<BR>&nbsp; print "New Extension Event Detected\n\n";<BR>};<BR></DIV>
<DIV>$man-&gt;reg_event("Newexten",$newext);</DIV>
<DIV>$man-&gt;listen(); # a man who listens, won't your wife be jealous ;)</DIV>
<DIV>&nbsp;</DIV>
<DIV>Now the program will just sit there and listen to all the event data </DIV>
<DIV>and calls the function hooked into the Nexexten event whenever it sees it </DIV>
<DIV>the special event ALL can be used to&nbsp;match every undefined event </DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>Now my only problem is that&nbsp;while making this module I started wishing </DIV>
<DIV>that is was just a tiny bit more like maybe http or imap </DIV>
<DIV>&nbsp;</DIV>
<DIV>I dont wanna hack up the code and make my stuff propitary so I was wondering if anyone agrees It is close to being a cut and dry protocol it would be nice to have it uniform.</DIV>
<DIV>&nbsp;</DIV>
<DIV>1 issue&nbsp;I notice is that since you are getting a nonstop flow of events sometimes </DIV>
<DIV>when you send an Action &nbsp;you have to intercept some of those events </DIV>
<DIV>and I thought it may be nice to either format the req so you know which reply </DIV>
<DIV>is for you or to formally request the events to flow rather than have them come by default.</DIV>
<DIV>&nbsp;</DIV>
<DIV>I think you can reduce the user's rightst to stop the events but what i was </DIV>
<DIV>looking for was a common structure.</DIV>
<DIV>&nbsp;</DIV>
<DIV>My proposed example uses Content-Length so you know how much to read</DIV>
<DIV>off the socket but I guess&nbsp;using just &lt;lf&gt; in the data and &lt;cr&gt;&lt;lf&gt;&lt;cr&gt;&lt;lf&gt; as EOR works ok too for variable lengths &nbsp;&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>EXAMPLES... </DIV>
<DIV>&nbsp;</DIV>
<DIV>You send your own homeade ReplyID so you recognize your answer.</DIV>
<DIV>&nbsp;</DIV>
<DIV>Action: Queues</DIV>
<DIV>ReplyID: 1234</DIV>
<DIV>&nbsp;</DIV>
<DIV>so then it replies </DIV>
<DIV>&nbsp;</DIV>
<DIV>ReplyID: 1234</DIV>
<DIV>Content-Desc: Action</DIV>
<DIV>Content-Type: text/plain</DIV>
<DIV>Content-Length: 4031</DIV>
<DIV>&nbsp;</DIV>
<DIV>tech_support has 0 calls (max unlimited) in 'ringall' strategy<BR>&nbsp;&nbsp; Members:<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Agent/118 with penalty 1 has taken no calls yet<BR></DIV>
<DIV>...................... etc so on </DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>or</DIV>
<DIV>Action: Command</DIV>
<DIV>ReplyID: 888</DIV>
<DIV>Command: show channels</DIV>
<DIV>&nbsp;</DIV>
<DIV>..........</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>
<DIV>To start pouring on the events </DIV>
<DIV>&nbsp;</DIV></DIV>
<DIV>Action: EventFlow</DIV>
<DIV>&nbsp;</DIV>
<DIV>and you get nonstop flow of ..</DIV>
<DIV>&nbsp;</DIV>
<DIV>ReplyID: *</DIV>
<DIV>Content-Desc: Event</DIV>
<DIV>Content-Type: text/plain</DIV>
<DIV>Content-Length: 111</DIV>
<DIV>&nbsp;</DIV>
<DIV>Event: Newchannel<BR>Channel: Agent/112<BR>State: Up<BR>Callerid: *8015711666*1608*<BR>Uniqueid: 1066231464.36432kick ASS</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV><p><hr SIZE=1>
Do you Yahoo!?<br>
<a href="http://shopping.yahoo.com/?__yltc=s%3A150000443%2Cd%3A22708228%2Cslk%3Atext%2Csec%3Amail">The New Yahoo! Shopping</a> - with improved product search