Skip to content

Commit

Permalink
update readme and enhence originatev1
Browse files Browse the repository at this point in the history
  • Loading branch information
root committed Apr 30, 2020
1 parent 9275779 commit 9d71b9b
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 10 deletions.
18 changes: 17 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ Potoo is a special bird that communicates with VoIP ecosystem and particularly w

The main objective of this project is to quickly (and perhaps badly) provide solutions to missing functionalities in a given ecosystem.

Its best documentation is its source code and Potoo may be verry insecure.
Its best documentation is its source code but some example could be found bellow.

Potoo may be verry insecure use it at your own risk !

## How to use potoo

Expand All @@ -16,3 +18,17 @@ Its best documentation is its source code and Potoo may be verry insecure.
5. `source venv/bin/activate`
6. `pip install -r requirements.txt`
7. `flask run`

## Some interfaces

### Visualise queue from asterisk cli
```
http://myhost:8001/queue?queue=myqueue
http://myhost:8001/queue_pretty?queue=myqueue # less information for less technical people
http://myhost:8001/queue
```
### Originate a call with a GET http
```
http://myhost:8001/originate/v1?dest_exten=1234&dest_context=my-dest-context&src_exten=777&src_context=my-src-context
http://myhost:8001/originate/v1?dest_exten=1234
```
5 changes: 4 additions & 1 deletion config.ini
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
[default]
network_whitelist = 192.168.50.76/32,192.168.50.22/32
network_whitelist = 192.168.0.0/16
default_tennant_context = thym-prod-key1991-internal
default_originate_context = xivo-callme
default_originate_number = 777
29 changes: 21 additions & 8 deletions potoo/routes/originatev1.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,30 @@
import configparser

from potoo import app
from potoo.utils import *

@app.route("/originate/v1")
def originatev1():

print(authorized_ip())
if authorized_ip():

dest_context = get_param('dest_context')
dest_exten = get_param('dest_exten')
src_exten = get_param('src_exten')
src_context = get_param('src_context')
config = get_config()

return '<pre>' + run_originate(dest_context,dest_exten,src_context,src_exten) \
+ '</pre> dest_exten: ' + dest_exten + '<br> dest_context: ' + dest_context \
+ '<br> src_exten: ' + src_exten + '<br> src_context: ' + src_context
src_context = config['default']['default_originate_context']
src_exten = config['default']['default_originate_number']
dest_context = config['default']['default_tennant_context']

try:
dest_exten = get_param('dest_exten')
dest_context = get_param('dest_context')
src_exten = get_param('src_exten')
src_context = get_param('src_context')
except:
pass

return '<pre>' + run_originate(dest_context,dest_exten,src_context,src_exten) \
+ '</pre> dest_exten: ' + dest_exten + '<br> dest_context: ' + dest_context \
+ '<br> src_exten: ' + src_exten + '<br> src_context: ' + src_context

else:
return '401'

0 comments on commit 9d71b9b

Please sign in to comment.