Re: [Asterisk-java-users] Error Handling with FastAGI
Brought to you by:
srt
From: Martin S. <ma...@be...> - 2008-07-10 15:59:45
|
Hi Aaron, Good question. It appears that Asterisk Java's AgiConnectionHandler will set the AGISTATUS channel variable under the following conditions: 1. If the mapping strategy can't find the specified script to execute, AGISTATUS=NOT_FOUND 2. If the script throws an AgiException or class/subclass of Exception, AGISTATUS=FAILED 3. If the script completes without throwing any exception, AGISTATUS=SUCCESS Keep in mind that if the channel, say, disconnects entirely (you pull an ethernet plug), Asterisk-Java won't be able to set anything. Most of my scripts are data-driven, in that they look things up or compute information that Asterisk can't, usually related to permissions. Most of my error cases simply have Asterisk play the same sound file as if the user failed the check. If I were doing something more elaborate, I'd almost certainly catch more than just checked exceptions, log them, and wrap them in an AgiException, since I would want a null pointer error to be handled gracefully too. Cheers, Martin Smith, Systems Developer ma...@be... Bureau of Economic and Business Research University of Florida (352) 392-0171 Ext. 221 > -----Original Message----- > From: ast...@li... > [mailto:ast...@li...] On > Behalf Of Aaron Evans > Sent: Thursday, July 10, 2008 10:49 AM > To: ast...@li... > Subject: [Asterisk-java-users] Error Handling with FastAGI > > With asterisk 1.4 and above, there is a channel variable AGISTATUS > that can be set to SUCCESS or FAILURE to indicate whether the AGI > execution was successful. > > In asterisk-java, there is an AgiException class that can be thrown > from the service method of an AgiScript implementation. > > Question: If I throw an AgiException, does the server handle setting > the AGISTATUS variable? > > Or should I gracefully handle all exceptions and execution errors and > set the channel variable myself? > > What do most people do? > > Thanks in advance for your suggestions... > > -------------------------------------------------------------- > ----------- > Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW! > Studies have shown that voting for your favorite open source project, > along with a healthy diet, reduces your potential for chronic lameness > and boredom. Vote Now at http://www.sourceforge.net/community/cca08 > _______________________________________________ > Asterisk-java-users mailing list > Ast...@li... > https://lists.sourceforge.net/lists/listinfo/asterisk-java-users > |