- requirements:
- Issabel
- python3
- install python3.9+
# for CentOS 8 / CentOS 7
sudo yum -y update
sudo yum install -y python36
- install project requirements:
pip3 install -r requirements
- install other system need packages:
yum install -y mpg123 # for play sound
- open file
/etc/asterisk/extensions.conf
- find
[macro-dial]
- before
exten => s,n(dial),AGI(dialparties.agi)
set follow commands
exten => s,n, Verbose(0, starting play.py script...)
exten => s,n,Answer()
;exten => s,n,Wait(2)
;exten => s,n,Echo()
exten => s,n(dial),AGI(play.py)
- then copy
play.py
file into/var/lib/asterisk/agi-bin/
directory - set permission with
chmod 777 /var/lib/asterisk/agi-bin/play.py
- run
./restart.sh
to apply changes
for enable asterisk debugging
asterisk -rx 'agi set debug on'
- create a .wav file
- convert it to .gsm file by using sox:
sox sound1.wav -r 8000 -c1 sound1.gsm lowpass 4000 compand 0.02,0.05 -60,-60,-30,-10,-20,-8,-5,-8,-2,-8 -8 -7 0.05
-
copy
sound1.gsm
to/var/lib/asterisk/sounds/en
-
now you can play it by
agi.stream_file('sound1')
on python script
- create a folder named
voices/mp3s
- copy mp3 files to
voices/mp3s
- copy
convert_mp3_to_gsm.sh
tovoices/
- run script