-
-
Notifications
You must be signed in to change notification settings - Fork 6
Tools
Vitor Hugo edited this page Nov 9, 2024
·
4 revisions
Here we will list some methods that may be useful during the development of a Genesis project.
The Genesis CLI provides commands to run and manage your FreeSWITCH Event Socket applications. Below are the available commands and their usage.
genesis [OPTIONS] COMMAND [ARGS]...
Option | Description |
---|---|
--version | Show the version and exit. |
Run your ESL events consumer.
genesis consumer [OPTIONS] PATH
Option | Description | Default |
---|---|---|
--host TEXT | The host to connect on. | 127.0.0.1 |
--port INTEGER | The port to connect on. | 8021 |
--password TEXT | The password to authenticate on host. | ClueCon |
--app TEXT | Variable that contains the Consumer app in the imported module or package. | None |
--loglevel TEXT | The log level to use. | info |
genesis consumer /path/to/your/app --host 192.168.1.100 --port 8021 --password MySecretPassword --loglevel debug
Run your outbound services.
genesis outbound [OPTIONS] PATH
Option | Description | Default |
---|---|---|
--host TEXT | The host to serve on. | 127.0.0.1 |
--port INTEGER | The port to serve on. | 9000 |
--app TEXT | Variable that contains the Outbound app in the imported module or package. | None |
--loglevel TEXT | The log level to use. | info |
genesis outbound /path/to/your/app --host 192.168.1.100 --port 9000 --loglevel debug
When added to a function that will be used as a handler for FreeSwitch events, it ensures that this function will only process events that have the entered key and that have the value associated with that key.
Argument | Type | Required | Default |
---|---|---|---|
key | str | True | N/A |
value | str | False | N/A |
regex | bool | False | False |
@app.handle('sofia::register')
@filtrate('from-user')
def register(event):
domain = event['from-host']
username = event['from-user']
date = event['Event-Date-Local']
print(f'[{date}] {username}@{domain} - Registred.')
@app.handle('sofia::register')
@filtrate('from-user', '1000')
def register(event):
domain = event['from-host']
username = event['from-user']
date = event['Event-Date-Local']
print(f'[{date}] {username}@{domain} - Registred.')
@app.handle('sofia::register')
@filtrate('from-user', '^1[0-9]{3}$', regex=True)
def register(event):
domain = event['from-host']
username = event['from-user']
date = event['Event-Date-Local']
print(f'[{date}] {username}@{domain} - Registred.')