A recorded version of this workshop is available on YouTube.
Preparations
- Create a 46elks account.
- Text your first name to +46766865445 to get an account on the production server.
Be patient!
Be patient with yourself and others. We'll help each other out!
What we're doing today
- Access production server
- Setup Flask
- Setup Answering machine
Set up your project
-
Login to the production server.
Changeusername
to your own username on the server.$ ssh username@64.225.108.133
-
Setup virtualenv
$ python3 -m venv venv $ . venv/bin/activate $ pip install flask requests
-
Setup the Flask project
$ vim app.py
-
Run your Flask app.
Replaceyour_port_num
with your own port number$ FLASK_APP=app.py flask run --host 0.0.0.0 --port your_port_num
-
Visit your Flask app
Replaceyour_port_num
with your own port numberhttp://64.225.108.133:your_port_num/
-
Add a 2nd route
-
Visit your new route
Replaceyour_port_num
with your own port numberhttp://64.225.108.133:your_port_num/hello
Setup your virtual phone number
- Log in to your 46elks account.
- Click numbers.
You should automatically get a phone number when creating your 46elks account throught the registration link on this page.
If you don't have a virtual phone number write in the chat and an elk will help you out! - Click edit next to your virtual number.
- Click edit next to
voice_start
to edit the URL, and set it tohttp://64.225.108.133:your_port_number/incoming-calls
- Click save changes.
Test your app
Ask someone to call your virtual number and the call should be connected to your regular phone.
Forward incoming phone calls
Remove your previous code in app.py
and add the following code:
On row 11, replace port 5000
with your own port number.
Set up your answering machine
-
Create a folder
$ mkdir recorded-voice-messages
-
Remove your previous code in
app.py
and add the following code:On row 11, replace port
5000
with your own port number. Add a route to forward all calls
-
Only forward calls during daytime
-
Add an answering machine that lets the caller leave a message
Resources
Audio
- http://64.225.108.133/audio/open_answering_machine.mp3
- http://64.225.108.133/audio/closed_answering_machine.mp3
Full code