Steven Critchfield
2004-Sep-17 06:58 UTC
[Asterisk-Users] AGI Python Clear or Channel Failure?
On Fri, 2004-09-17 at 09:01, Martyn Russell wrote:> Is there any way to know if the return code (-1) is a clear or channel > failure?Does it matter. If you receive a -1 you know the line is no longer available and no other commands will be accepted. So all that is left for your app is to clean itself up and exit. -- Steven Critchfield <critch@basesys.com>
Martyn Russell
2004-Sep-17 07:01 UTC
[Asterisk-Users] AGI Python Clear or Channel Failure?
Hi All, When I call the stream_file function all goes well if the user doesn't clear the call. But if I do clear the call (on the handset for example), I get the following exception: -- Channel 0/31, span 1 got hangup RESULT_LINE: 200 result=-1 endpos=28000 == Spawn extension (default, 600006, 1) exited non-zero on 'Zap/31-1' RESULT_DICT: {'result': ('-1', ''), 'endpos': ('28000', '')} Traceback (most recent call last): File "/var/lib/asterisk/agi-bin/clickdial.py", line 450, in ? d = agi.stream_file("bt_clickdial_welcome", "0123456789"); File "/var/lib/asterisk/agi-bin/clickdial.py", line 179, in stream_file -- Hungup 'Zap/31-1' raise AGIException('Channel falure on channel %s' % self.env.get('agi_channel','UNKNOWN')) __main__.AGIException: Channel falure on channel Zap/31-1 This is easily managed by using exception handling, AND I can look for the return code (which for all the functions I am using returns) -1 to know if it was a channel failure or hang up. From the output (above), Asterisk knows the call has hung up, I assume it does anyway because of the line: -- Hungup 'Zap/31-1' Is there any way to know if the return code (-1) is a clear or channel failure? Thanks, -- Regards, Martyn