I’m trying to get the py-ari library working on my Centos 7 development VM. It seems to have installed correctly and the test application runs and registers to Asterisk(on another VM), but when I dial the extension to enter the application I get the message:
No handlers could be found for logger "ari.client"
printed in the Linux CLI where the python script is running.
Python version is 2.7.5
Asterisk version is 13.8.2
Python script:
> import ari
> client = ari.connect('http://10.1.40.162:8088/', 'asterisk', 'asterisk')
> def on_dtmf(channel, event):
> digit = event['digit']
> if digit == '#':
> channel.play(media='sound:goodbye')
> channel.continueInDialplan()
> elif digit == '*':
> channel.play(media='sound:asterisk-friend')
> else:
> channel.play(media='sound:digits/%s' % digit)
> def on_start(channel, event):
> channel.on_event('ChannelDtmfReceived', on_dtmf)
> channel.answer()
> channel.play(media='sound:hello-world')
> client.on_channel_event('StasisStart', on_start)
> client.run(apps="hello")
Extensions.conf:
> [ari]
> switch => Realtime
> [operators]
> switch => Realtime
> include => ari
> include => iax-trunk
> [iax-trunk]
> exten => _7XXX,1,Dial(IAX2/avm/${EXTEN})
> exten => _6XXX,1,Dial(IAX2/avm/${EXTEN})
> [iax]
> include => operators
> include => ari
The following row is in the extensions table in the Realtime database:
id context exten priority app appdata
1001 ari 1001 1 Stasis hello
The following is printed in the Asterisk CLI when the application is started and a call is placed:
Creating Stasis app 'hello'
== WebSocket connection from '10.1.40.167:55395' for protocol '' accepted using version '13'
Activating Stasis app 'hello'
-- Accepting AUTHENTICATED call from 10.1.40.166:4569:
-- > requested format = alaw,
-- > requested prefs = (alaw|ulaw|siren14|siren7|g722|slin16|slin|g726|g726aal2|adpcm|gsm|ilbc|speex|lpc10|g729|g723),
-- > actual format = ulaw,
-- > host prefs = (ulaw|alaw|siren14|siren7|g722|slin16|slin|g726|g726aal2|adpcm|gsm|ilbc|speex|lpc10|g729|g723),
-- > priority = mine
-- Executing [1001@iax:1] Stasis("IAX2/avm-9887", "hello")
-- Hungup 'IAX2/avm-9887'
Let me know if more information is needed.
Thanks,
Tommy