Showing posts with label raspbx. Show all posts
Showing posts with label raspbx. Show all posts

Monday, May 2, 2016

Raspbx and running scripts

Hi

I have worked with old asterisk version and it was really hard to work with but with little efford really great and customizable. Now i tried new project with RASPBX and i was surprised how easy it was to work with.

In this tutorial i will tell how to install raspbx and run scripts in raspbx

1. Download Raspbx (google it)
2. Download win32diskimager
3.Install win32diskimager
4.Unzip raspbx image
5. Run win32diskimager and install raspbx to memorycard (raspbx site says that 4gb card required, so i used 8gb just to sure)
6.Insert memory card to raspberry pi and start it
7.Log in
8. Default user is root and password raspberry
9. run command:sudo ip addr show
10. get the inet addr/ip addr
11. Use different computer to log in by opening browser and writing that address to browser
12.  FreePBX default user is admin and password is admin also
13. Log in to Freepbx
Asterisk may take 5-10 minutes to start
14.Download config edit module to freepbx from admin modules
14. or you can just download and upgrade all the modules
15. go to config edit module and to extensions_custom.conf add
[nameofdialplan]
exten=> 2000,1,Answer()
exten=> 2000,2,AGI(scriptname.php)

2000 is the extension that you wanna run script when calling
1,2 is the priority or order of actions you wanna perform
there should be scripts ready if you wanna test.

Example wakeupconfirm
[wakeup]
exten=> 2000,1,Answer()
exten=> 2000,2,AGI(wakeconfirm.php)

16. Go to custom destinations tab and make asterisk aware of new custom dialplan by adding
[wakeup],2000,1
description is just name so name it as you like it
17. Create extension for your phone/softphone and try it

Making your own scripts
1. run commands:cd /var/lib/asterisk/agi-bin
this is the path where asterisk will store the scripts
2. run command:nano scriptname.php
you can use other text editors but i use nano
3.write your script
4.run command:chmod 755 scriptname.php
this gives asterisk permission to run the script