Giter Site home page Giter Site logo

py-asterisk's Issues

python 3.7 support - 'async' is a reserved keyword in python 3.7

Hello,

Into your originate function, you used async keyword parameter which is used into data variable.

For that case I think _aysnc would be appropriate.

Actual Result :

ERROR! Unexpected Exception, this is probably a bug: invalid syntax

How to resolve :

def Originate(self, channel, context=None, extension=None, priority=None, application=None, data=None, timeout=None, caller_id=None, variable=None, account=None, async=None, early_media=None, codecs=None, channel_id=None, other_channel_id=None)

To

def Originate(self, channel, context=None, extension=None, priority=None, application=None, data=None, timeout=None, caller_id=None, variable=None, account=None, _async=None, early_media=None, codecs=None, channel_id=None, other_channel_id=None)

Do not forget to modify var 'data' :)

Asterisk Call Manager 2.8.0

Since update Asterisk 13.5 asterisk_click2dial connector reported a failure in py-Asterisk.

Here is the error message: banner incorrect; got 'Asterisk Call Manager/2.8.0\r\n', expe
cted one of ['Asterisk Call Manager/1.0\r\n', 'Asterisk Call Manager/1.1\r\n', 'Asterisk Call Manager/1.2\r\n', 'Asterisk Call Manager/1.3\r\n']

The banners need to be updated to support Asterisk 13.5 I think.

Thanks,

QueuePause action impossible to unpause

Hello,

You need to remove 'and 'true' or 'false'' like below to allow unpause action :

def QueuePause(self, queue, interface, paused):
     'Pause <interface> in <queue>.'

     id = self._write_action('QueuePause', {
         'Queue': queue,
         'Interface': interface,
         'Paused': paused 
     })

SSL support for astmanproxy

Hello,

does an ssl support will be provided in the future to connect throught a proxy such as astmanproxy ?

Thanks

Aurel

Command() fails with Asterisk 14.5

With py-Asterisk 0.5.14 and Asterisk 14.5.0:

root@xs ~ # python
Python 2.7.9 (default, Jun 29 2016, 13:08:31)
[GCC 4.9.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.

from Asterisk import Manager
m = Manager.Manager(('127.0.0.1', 5038), 'xivo_munin_user', 'xxxxxxx')
m.Command('sip reload')
Traceback (most recent call last):
File "", line 1, in
File "/usr/local/lib/python2.7/dist-packages/Asterisk/Manager.py", line 520, in Command
return self._translate_response(self.read_response(id))['Lines']
KeyError: 'Lines'

Note that the Command has been successfully executed with Asterisk (according to a tcpdump) ; the crash is just in the parsing of the answer.

If I modify /usr/local/lib/python2.7/dist-packages/Asterisk/Manager.py line 520 and remove ['Lines'] at the end, it works well:
20:58 root@xs ~ # python
Python 2.7.9 (default, Jun 29 2016, 13:08:31)
[GCC 4.9.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.

from Asterisk import Manager
m = Manager.Manager(('127.0.0.1', 5038), 'xivo_munin_user', 'xxxxxxxxxx')
m.Command('sip reload')
{u'Output': '', u'Message': u'Command output follows', u'Response': u'Success'}

SyntaxError: from future imports must occur at the beginning of the file

While trying to get a odoo module running that replies on py-asterisk.

It kept throwing an error, while debugging and discussing with module maker OCA/connector-telephony#50 (comment)

they recommended i invoke the import from python cli. Here is the output from python cli.

root@loc1:~# python
Python 2.7.6 (default, Mar 22 2014, 22:59:56)
[GCC 4.8.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.

from Asterisk import Manager
Traceback (most recent call last):
File "", line 1, in
File "/usr/local/lib/python2.7/dist-packages/Asterisk/Manager.py", line 8
from future import absolute_import
SyntaxError: from future imports must occur at the beginning of the file

Permission denied init issue

I am using this module through another extension and originally filed an issue for that project here:
OCA/connector-telephony#81 (comment)

Upon further investigation I found that it was actually in this file:
line 407 of /usr/local/lib/python2.7/dist-packages/Asterisk/Manager.py

The PermissionDenied function needs a parameter I believe.

action fail error

Hi,
I hope to help me ,
I use py-asterisk to connect odoo and Asterisk.
and i get this error.

py-Asterisk action failed: Originate failed

thank you

py-Asterisk not compatible with Asterisk 13

One of my users of the Odoo-Asterisk connector reported a failure in py-Asterisk because he uses Asterisk 13:

got 'Asterisk Call Manager/2.5.0\r\n', expected one of ['Asterisk Call Manager/1.0\r\n', 'Asterisk Call Manager/1.1\r\n', 'Asterisk Call Manager/1.2\r\n', 'Asterisk Call Manager/1.3\r\n']

So the banners need to be updated to support Asterisk 13.

trying to use your example to grab the caller ID

Hi,

I'm trying to play with your example and i get an error:

Traceback (most recent call last):
File "test.py", line 67, in
grab.register(pbx)
File "test.py", line 49, in register
some_pbx.events += events
NameError: global name 'events' is not defined

Are you sure your example is working ?

subscribe to end of a call

Hi,
I'm trying to use your API to trigger some action when a call is finish, like merge the monitored up/down called audio. I'have successfully implemented the callback on the NewState -> Up for incoming call but I can't make it work for end of call. Can you help me or provide me a example please ?
I tried with subscribing to event like Leave, hangup, parkedcall...
thanks a lot.

CLI.py - string with no pop method

The method execute_action takes a string for argv from command_line.
I've tried using .split without success.

-bash-4.1$ python py-asterisk command "ZapShowChannels"
Traceback (most recent call last):
File "py-asterisk", line 19, in
sys.exit(Asterisk.CLI.command_line(sys.argv))
File "/home/benp/staging/py-Asterisk-0.5.10/Asterisk/CLI.py", line 148, in command_line
execute_action('command', argv[2])
File "/home/benp/staging/py-Asterisk-0.5.10/Asterisk/CLI.py", line 84, in execute_action
method_name = argv.pop(0).lower()
AttributeError: 'str' object has no attribute 'pop'

OriginateResponse

Hello! I'm unable to catch event named by 'OriginateResponse'. Its fired when pbx.Originate method used with Asynk=True. Using logger i found that my asterisk send it but event not fired. I found why:
In _dispatch_packet(...) we first check 'Response' field and if it found we move it to response_buffer. And then we check 'Event' field with the same action. But here is OriginateResponse message:
{'Event': 'OriginateResponse', 'Privilege': 'call,all', 'ActionID': '1513434723.7291746', 'Response': 'Success', 'Channel': <Asterisk.Manager.BaseChannel referencing channel '...' of <Asterisk.Manager.Manager connected as ...>>, 'Context': 'from-internal', 'Exten': '...', 'Reason': '4', 'Uniqueid': '1513434723.253', 'CallerIDNum': '', 'CallerIDName': '...'}
As you can see it has Event field and Response field together. So it move to response buffer, but must go in event buffer. To fix it I move condition checks in _dispatch_packet(...) so Event field checks first. Here is code:

    def _dispatch_packet(self, packet):
        'Feed a single packet to an event handler.'

        if 'Event' in packet:
            self._translate_event(packet)
            self.log.debug('_dispatch_packet() passing event to on_Event.')
            self.on_Event(packet)

        elif 'Response' in packet:
            self.log.debug('_dispatch_packet() placed response in buffer.')
            self.response_buffer.append(packet)

        else:
            raise InternalError('Unknown packet type detected: %r' % (packet,))

I dont know maybe I break something else, but now I can see that event named OriginateResponse fired and catched properly.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.