[Twisted-Python] Unhandled Deferred Error

Godson Gera godson.g at gmail.com
Mon Aug 30 03:30:10 MDT 2010


Hi

All the starpy API calls return a deferred object. Adding an errback is just
like adding errback to any other deferred.

df = agi.streamFile("somefile")
df.addCallback(yourcallback)
df.addErrback(yourerrback)

It is no different from a deferred so it supports all the methods that a
normal twisted deferred object supports.

http://twistedmatrix.com/documents/10.0.0/api/twisted.internet.defer.Deferred.html

-- 
Thanks & Regards,
Godson Gera
Starpy <http://blog.godson.in/2008/10/starpy-100a13-released-asterisk.html>
FreeSWITCH Consulting <http://godson.in/freeswitch-radius-integration>

On Mon, Aug 30, 2010 at 11:12 AM, shwetanka srivastava
<shwetanka at gmail.com>wrote:

> Hi
>
> Actually I'm playing the file but even before it is completed I'm
> connecting to another number and this is why Fastagi is sending an error.
> How can I add errBack() to it. Like if playing of file is interrupted it
> should notify somehow.
> Thanks
>
> Regards
> Shwetanka
>
>
> On Fri, Aug 27, 2010 at 9:21 PM, shwetanka srivastava <shwetanka at gmail.com
> > wrote:
>
>> Hi
>>
>> Thanks...
>> I do am playing an audio file. This error is shown in log file but
>> everything calling and conferencing is working absolutely fine. I'll post to
>> starpy mailing list also.
>>
>> Thanks again for the reply
>> Regards
>> Shwetanka
>>
>> On Fri, Aug 27, 2010 at 8:50 PM, Godson Gera <godson.g at gmail.com> wrote:
>>
>>> Hi,
>>>
>>> This error is obviously raised when the issued command is failed to
>>> execute at Asterisk end. However there could be variety of reasons for
>>> failure, one common cause is call is hungup on which the command is issued.
>>>
>>> By looking at the error it occurs that you might be trying to play some
>>> audio file on the call. So check if the file really exists and is in the
>>> format specified by Asterisk 8000Hz mono 16-bit . Looking at the Asterisk
>>> console while this occurs will also give you useful cues.
>>>
>>> As Paul mentioned this is really a starpy and Asterisk question, so
>>> posting queries like this on starpy mailing list will get better insights.
>>>
>>> --
>>> Thanks & Regards,
>>> Godson Gera
>>> Starpy<http://blog.godson.in/2008/10/starpy-100a13-released-asterisk.html>
>>>
>>> On Thu, Aug 26, 2010 at 2:13 PM, shwetanka srivastava <
>>> shwetanka at gmail.com> wrote:
>>>
>>>> Hi
>>>>
>>>> I'm using twisted api with starpy to make a conference call. After a
>>>> successful call this error is logged in my log file
>>>>
>>>> ERROR:twsited:Unhandled error in Deferred:
>>>> ERROR:twsited:Unhandled Error
>>>> Traceback (most recent call last):
>>>>   File "/usr/lib/python2.6/dist-packages/twisted/protocols/basic.py",
>>>> line 148, in dataReceived
>>>>     self.lineReceived(line)
>>>>   File "/usr/local/lib/python2.6/dist-packages/starpy/fastagi.py", line
>>>> 120, in lineReceived
>>>>     df.callback( line )
>>>>   File "/usr/lib/python2.6/dist-packages/twisted/internet/defer.py",
>>>> line 243, in callback
>>>>     self._startRunCallbacks(result)
>>>>   File "/usr/lib/python2.6/dist-packages/twisted/internet/defer.py",
>>>> line 312, in _startRunCallbacks
>>>>     self._runCallbacks()
>>>> --- <exception caught here> ---
>>>>   File "/usr/lib/python2.6/dist-packages/twisted/internet/defer.py",
>>>> line 328, in _runCallbacks
>>>>     self.result = callback(self.result, *args, **kw)
>>>>   File "/usr/local/lib/python2.6/dist-packages/starpy/fastagi.py", line
>>>> 145, in checkFailure
>>>>     raise error.AGICommandFailure( FAILURE_CODE, result )
>>>> starpy.error.AGICommandFailure: (-1, '-1 endpos=97440')
>>>>
>>>> Calls are perfectly ok. I tried to google about the error and found out
>>>> if I don't provide an errback() to a deferred object then this happens.
>>>> How do i find which deferred object is posing this problem and also
>>>> whether it affects the program execution because my program is working
>>>> absolutely fine.
>>>> --
>>>> Regards
>>>> Shwetanka
>>>>
>>>>
>>>> _______________________________________________
>>>> Twisted-Python mailing list
>>>> Twisted-Python at twistedmatrix.com
>>>> http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
>>>>
>>>>
>>>
>>>
>>>
>>> _______________________________________________
>>> Twisted-Python mailing list
>>> Twisted-Python at twistedmatrix.com
>>> http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
>>>
>>>
>>
>>
>> --
>> Regards
>> Shwetanka
>>
>>
>
>
> --
> Regards
> Shwetanka
>
>
> _______________________________________________
> Twisted-Python mailing list
> Twisted-Python at twistedmatrix.com
> http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: </pipermail/twisted-python/attachments/20100830/a8cc2ec2/attachment.html>


More information about the Twisted-Python mailing list