File "D:\Python\Python37\lib\site-packages\asterisk\ami\event.py", line 89, in init
self.white_list = [white_list] if isinstance(white_list, (basestring, re._pattern_type)) else white_list
AttributeError: module 're' has no attribute '_pattern_type'
my code is :
!/usr/bin/python
-- coding:utf-8 --
from asterisk.ami import AMIClient
from asterisk.ami import SimpleAction
from asterisk.ami import AMIClientAdapter
from asterisk.ami import EventListener
with the demo , run it but response this error :
File "D:\Python\Python37\lib\site-packages\asterisk\ami\event.py", line 89, in init self.white_list = [white_list] if isinstance(white_list, (basestring, re._pattern_type)) else white_list AttributeError: module 're' has no attribute '_pattern_type'
my code is :
!/usr/bin/python
-- coding:utf-8 --
from asterisk.ami import AMIClient from asterisk.ami import SimpleAction from asterisk.ami import AMIClientAdapter from asterisk.ami import EventListener
def eventNotification(source,event): print("notify-send %s %s",event.name,str(event))
def callbackResponse(response): print("in the callback") print(response)
client = AMIClient(address='127.0.0.1',port=5038) client.login(username='manageTest',secret='managePassword1') client.add_event_listener(EventListener(on_event=eventNotification)) try: while True: time.sleep(10) except (KeyboardInterrupt, SystemExit): client.logoff()