Service name
Asterisk.WhoYouGonnaCall
Description
Simple call logging / call listen service. It will listen for call completed messages from the broker and store call data in selected datastore. Upon storing it will retrieve recorded call data from asterisk server and store it locally (with optional format conversion and encryption). Also, service has its own simple web frontend application for searching / listening of the calls.
Requirements
- oauth server (mandatory): users are authenticated using external oauth server
- encryption certificate (optional, if not configured, call recording will be stored as-is)
- external message data repository service (Tekelija.Masstransit.MessageDataRepository). This service is used for exchange of the call recordings between global and local instances
- accessible asterisk server
- rabbit message broker
- database backend (mssql, sqlite, mysql or mongodb)
Configuration
Module config
{
"WhoYouGonnaCall": {
"Database": null,
"ConnectionString": null,
"ConvertAudio": false,
"Type": "Local",
"Origin": null,
"MessageRepositoryUri": null,
"RetentionHoursListen": 48,
"RetentionHoursSearch": 4320,
"Storage": {
"Root": null,
"CertificatePath": null,
"CertificatePassword": null
},
"Frontend": {
"DefaultLanguage": "sl",
"Title": null,
}
}
}
Name | Type | Default | Description |
---|---|---|---|
Database | string | null | Database type: mssql, mysql, sqlite or mongodb |
ConnectionString | string | null | Choosen database connection string |
ConvertAudio | bool | false | Try to convert audio recordings from wav to mp3 |
Type | string | Local | Is call manager type local for asterisk or global (Local/Global, case sensitive) |
Origin | string | host name | Origin of the call, may have some sense for global call data collection setup |
MessageRepositoryUri | string | host name | Origin of the call, may have some sense for global call data collection setup |
RetentionHoursListen | int | 48 | Allow listening for configured number of hours. 0 means no limit |
SearchHoursListen | int | 48 | Allow searching for configured number of hours. 0 means no limit |
Storage | StorageConfig | Call recordings storage settings | |
Frontend | FrontendConfig | Frontend app settings |
Storage config
{
"Storage": {
"Root": null,
"CertificatePath": null,
"CertificatePassword": null
}
}
Name | Type | Default | Description |
---|---|---|---|
Root | string | ./storage | Storage folder |
CertificatePath | string | null | Encryption certificate (.pfx) file path |
CertificatePassword | string | null | Encryption certificate password (if any) |
If CertificatePath
is null, audio recordings will be stored as-is. If certificate path is set it will be used for file encryption / decryption
Frontend config
{
"Frontend": {
"DefaultLanguage": null,
"Title": null
}
}
Name | Type | Default | Description |
---|---|---|---|
DefaultLanguage | string | sl | Default language used in frontend application |
Title | string | Asterisk call manager | Default frontend application title |
Message bus config
{
"MessageBus": {
"Url": "rabbitmq://localhost",
"Username": null,
"Password": null,
"Endpoint": "<endpoint-name>"
}
}
Parameters:
Name | Type | Default | Description |
---|---|---|---|
Url | string | null | RabbitMQ url (rabbitmq://…) |
Username | string | null | RabbitMQ username |
Password | string | null | RabbitMQ user password |
Endpoint | string | null | RabbitMQ endpoint |
Asterisk config
{
"Asterisk": {
"url": "asterisk.",
"port": 8089,
"username": "username",
"password": "password",
"secure": true
}
}
Name | Type | Default | Description |
---|---|---|---|
Url | string | null | Asterisk address |
Port | int | null | Asterisk port |
Username | string | null | Asterisk auth username |
Password | string | null | Asterisk auth password |
Secure | bool | false | Use TLS |
Frontend config
{
"Frontend": {
"DefaultLanguage": "sl",
"Title": "Asterisk call manager"
}
}
Name | Type | Default | Description |
---|---|---|---|
DefaultLanguage | string | sl | Default frontend language |
Title | string | “Asterisk call manager” | Frontend app title |
Authorization config
{
"AuthServer": {
"Issuer": null,
"ClientId": null,
"ClientSecret": null,
"Audience": null
}
}
Parameters:
Name | Type | Default | Description |
---|---|---|---|
Issuer | string | null | OAuth server url |
ClientId | string | null | OAuth backend application client id |
ClientSecret | string | null | OAuth backend application secret |
Audience | string[] | null | Default audience |
Installation
Let’s say (for example) that we have following prerequisites:
- asterisk server, listening at
http://asterisk.host.com
on port 8089 with TLS configured and username & passwordusername
andpassword
, respectfully. Asterisk server is configured to publish messages on rabbit mq broker atrabbitmq://some.rabbit.host
- authenticatomatic oauth server, listening at
http://oauth.site
- we will not use encryption and we’ll use sqlite as database backend
First, we need to create and setup authenticatomatic applications, roles and scopes. Create two authenticatomatic scopes
-
scope 1:
- name: asterisk_calls:read
- display name: asterisk_call:read
- description: Read asterisk calls (this description is free to change)
- resources: asterisk_call_manager
-
scope 2:
- name: asterisk_calls:listen
- display name: asterisk_call:listen
- description: Listen asterisk calls (this description is free to change)
- resources: asterisk_call_manager
-
application 1 (application that will be used for machine to machine authorization)
- name: Asterisk calls manager machine access application
- client id: asterisk_calls
- client type: confidential
- client secret: 1234567, for example (generate new guid for this setting)
- endpoints permissions: token
- scopes permissions: asterisk_calls:read and asterisk_calls:listen
- grant type permissions: client credentials and refresh token
- response type permissions: token
-
application 2 (application that frontend will use to authorize users)
- name: Asterisk call manager webapp
- client id: asterisk-call-manager-webapp
- client type: public
- consent type: implicit
- endpoint permissions: authorization, logout, revocation, token
- scopes permissions: address, email, profile, roles, asterisk_calls:read
- grant type permissions: authorization code, refresh token
- response type permissions: code
- post login redirect uri: http://somehost:5113 (or where service has been installed)
- post logout redirect uri: http://somehost:5113 (or where service has been installed)
-
role 1:
- name: asterisk_calls:read
-
role 2:
- name: asterisk_calls:listen
Now comes the settings: let’s configure oauth settings first:
{
"AuthServer": {
"Issuer": "http://oauth.site",
"ClientId": "asterisk_calls",
"ClientSecret": "1234567",
"Audience": [
"asterisk_call_manager"
]
}
}
As you may see client id / client secrets are those configured for machine-to-machine communication (or, in this case, communication of the service backend and oauth server). The “other” application is used in service frontend webapp, and those client id / scopes et al are hard coded, so that is why is important for that application to be configured exactly as described.