Skip to content

Commit

Permalink
Merge branch 'dev' of https://github.com/fonoster/fonos into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
psanders committed Aug 20, 2021
2 parents 7da27e8 + adf7527 commit d242cc6
Show file tree
Hide file tree
Showing 70 changed files with 28,286 additions and 12,814 deletions.
1 change: 1 addition & 0 deletions env_example
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,4 @@ LOGS_DRIVER_PORT=24224
LOG_OPT_TAG_PREFIX=alpha
APISERVER_ENDPOINT=localhost:50051
PUBLIC_URL=http://localhost:50051
IGNORE_E164_VALIDATION=true
94 changes: 47 additions & 47 deletions etc/rbac.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,64 +3,64 @@
"name": "USER",
"description": "Regular access",
"access": [
"/fonos.auth.v1alpha1.Auth/GetRole",
"/fonos.storage.v1alpha1.Storage/UploadObject",
"/fonos.storage.v1alpha1.Storage/GetObjectURL",
"/fonos.providers.v1alpha1.Providers/ListProviders",
"/fonos.providers.v1alpha1.Providers/CreateProvider",
"/fonos.providers.v1alpha1.Providers/GetProvider",
"/fonos.providers.v1alpha1.Providers/UpdateProvider",
"/fonos.providers.v1alpha1.Providers/DeleteProvider",
"/fonos.numbers.v1alpha1.Numbers/ListNumbers",
"/fonos.numbers.v1alpha1.Numbers/CreateNumber",
"/fonos.numbers.v1alpha1.Numbers/GetIngressInfo",
"/fonos.numbers.v1alpha1.Numbers/GetNumber",
"/fonos.numbers.v1alpha1.Numbers/UpdateNumber",
"/fonos.numbers.v1alpha1.Numbers/DeleteNumber",
"/fonos.domains.v1alpha1.Domains/ListDomains",
"/fonos.domains.v1alpha1.Domains/CreateDomain",
"/fonos.domains.v1alpha1.Domains/GetDomain",
"/fonos.domains.v1alpha1.Domains/UpdateDomain",
"/fonos.domains.v1alpha1.Domains/DeleteDomain",
"/fonos.callmanager.v1alpha1.CallManager/Call",
"/fonos.appmanager.v1alpha1.AppManager/ListApps",
"/fonos.appmanager.v1alpha1.AppManager/GetApp",
"/fonos.appmanager.v1alpha1.AppManager/CreateApp",
"/fonos.appmanager.v1alpha1.AppManager/UpdateApp",
"/fonos.appmanager.v1alpha1.AppManager/DeleteApp",
"/fonos.agents.v1alpha1.Agents/ListAgents",
"/fonos.agents.v1alpha1.Agents/CreateAgent",
"/fonos.agents.v1alpha1.Agents/GetAgent",
"/fonos.agents.v1alpha1.Agents/UpdateAgent",
"/fonos.agents.v1alpha1.Agents/DeleteAgent",
"/fonos.funcs.v1alpha1.Funcs/ListFuncs",
"/fonos.funcs.v1alpha1.Funcs/GetFunc",
"/fonos.funcs.v1alpha1.Funcs/DeployFunc",
"/fonos.funcs.v1alpha1.Funcs/DeleteFunc",
"/fonos.funcs.v1alpha1.Funcs/GetFuncLogs",
"/fonos.secrets.v1alpha1.Secrets/CreateSecret",
"/fonos.secrets.v1alpha1.Secrets/ListSecretsId",
"/fonos.secrets.v1alpha1.Secrets/DeleteSecret",
"/fonos.auth.v1alpha1.Auth/ValidateToken"
"/fonos.auth.v1beta1.Auth/GetRole",
"/fonos.storage.v1beta1.Storage/UploadObject",
"/fonos.storage.v1beta1.Storage/GetObjectURL",
"/fonos.providers.v1beta1.Providers/ListProviders",
"/fonos.providers.v1beta1.Providers/CreateProvider",
"/fonos.providers.v1beta1.Providers/GetProvider",
"/fonos.providers.v1beta1.Providers/UpdateProvider",
"/fonos.providers.v1beta1.Providers/DeleteProvider",
"/fonos.numbers.v1beta1.Numbers/ListNumbers",
"/fonos.numbers.v1beta1.Numbers/CreateNumber",
"/fonos.numbers.v1beta1.Numbers/GetIngressInfo",
"/fonos.numbers.v1beta1.Numbers/GetNumber",
"/fonos.numbers.v1beta1.Numbers/UpdateNumber",
"/fonos.numbers.v1beta1.Numbers/DeleteNumber",
"/fonos.domains.v1beta1.Domains/ListDomains",
"/fonos.domains.v1beta1.Domains/CreateDomain",
"/fonos.domains.v1beta1.Domains/GetDomain",
"/fonos.domains.v1beta1.Domains/UpdateDomain",
"/fonos.domains.v1beta1.Domains/DeleteDomain",
"/fonos.callmanager.v1beta1.CallManager/Call",
"/fonos.appmanager.v1beta1.AppManager/ListApps",
"/fonos.appmanager.v1beta1.AppManager/GetApp",
"/fonos.appmanager.v1beta1.AppManager/CreateApp",
"/fonos.appmanager.v1beta1.AppManager/UpdateApp",
"/fonos.appmanager.v1beta1.AppManager/DeleteApp",
"/fonos.agents.v1beta1.Agents/ListAgents",
"/fonos.agents.v1beta1.Agents/CreateAgent",
"/fonos.agents.v1beta1.Agents/GetAgent",
"/fonos.agents.v1beta1.Agents/UpdateAgent",
"/fonos.agents.v1beta1.Agents/DeleteAgent",
"/fonos.funcs.v1beta1.Funcs/ListFuncs",
"/fonos.funcs.v1beta1.Funcs/GetFunc",
"/fonos.funcs.v1beta1.Funcs/DeployFunc",
"/fonos.funcs.v1beta1.Funcs/DeleteFunc",
"/fonos.funcs.v1beta1.Funcs/GetFuncLogs",
"/fonos.secrets.v1beta1.Secrets/CreateSecret",
"/fonos.secrets.v1beta1.Secrets/ListSecretsId",
"/fonos.secrets.v1beta1.Secrets/DeleteSecret",
"/fonos.auth.v1beta1.Auth/ValidateToken"
]
},
{
"name": "FUNCTION",
"description": "This role is limited only to calling",
"access": [
"/fonos.callmanager.v1alpha1.CallManager/Call",
"/fonos.secrets.v1alpha1.Secrets/GetSecret",
"/fonos.auth.v1alpha1.Auth/ValidateToken"
"/fonos.callmanager.v1beta1.CallManager/Call",
"/fonos.secrets.v1beta1.Secrets/GetSecret",
"/fonos.auth.v1beta1.Auth/ValidateToken"
]
},
{
"name": "SERVICE",
"description": "This role is able to obtain ingress information and create short-live token",
"access": [
"/fonos.numbers.v1alpha1.Numbers/GetIngressInfo",
"/fonos.auth.v1alpha1.Auth/CreateToken",
"/fonos.auth.v1alpha1.Auth/CreateNoAccessToken",
"/fonos.auth.v1alpha1.Auth/ValidateToken"
"/fonos.numbers.v1beta1.Numbers/GetIngressInfo",
"/fonos.auth.v1beta1.Auth/CreateToken",
"/fonos.auth.v1beta1.Auth/CreateNoAccessToken",
"/fonos.auth.v1beta1.Auth/ValidateToken"
]
},
{
Expand All @@ -71,6 +71,6 @@
{
"name": "ADMIN",
"description": "Can perform administrative task",
"access": ["/fonos.auth.v1alpha1.Auth/CreateToken"]
"access": ["/fonos.auth.v1beta1.Auth/CreateToken"]
}
]
1 change: 1 addition & 0 deletions examples/dialog/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Reminders - Programmable Voice Application
**This example is outdated from the new Fonos Voice API.**

This example shows the use of the third-party dependencies with Fonos Programmable Voice features to build an application for reminders. It uses Google Text-to-Speech for the synthesis, Google Speech-to-Text for speech transcription, and DialogFlow as the operation's brain.

Expand Down
24 changes: 21 additions & 3 deletions examples/dialog/src/config.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,37 @@
/*
* Copyright (C) 2021 by Fonoster Inc (https://fonoster.com)
* http://github.com/fonoster/fonos
*
* This file is part of Project Fonos
*
* Licensed under the MIT License (the "License");
* you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* https://opensource.org/licenses/MIT
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
const GoogleTTS = require("@fonos/googletts").default;
const GoogleASR = require("@fonos/googleasr").default;
const Talk = require("./talk");
const { join } = require("path");
const {join} = require("path");
const PROJECT_ID = "clever-tube-275321";

// You need to have a set of Google credentials for this to work
function getCredentials() {
return {
PROJECT_ID,
keyFilename: join(__dirname, `../google_credentials.json`)
keyFilename: join(__dirname, "../google_credentials.json")
};
}

function listen(chan, asr) {
const result = chan.record({ silenceSeconds: 1, beep: false });
const result = chan.record({silenceSeconds: 1, beep: false});
return asr.transcribeSync(result.recordingUri);
}

Expand Down
22 changes: 20 additions & 2 deletions examples/dialog/src/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,22 @@
const { listen, talk, tts, asr } = require("./config");
/*
* Copyright (C) 2021 by Fonoster Inc (https://fonoster.com)
* http://github.com/fonoster/fonos
*
* This file is part of Project Fonos
*
* Licensed under the MIT License (the "License");
* you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* https://opensource.org/licenses/MIT
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
const {listen, talk, tts, asr} = require("./config");

module.exports = (chan) => {
// Setting up Google TTS
Expand Down Expand Up @@ -36,7 +54,7 @@ module.exports = (chan) => {
// Lets try again!
noSpeechCount = 0;
// There was no input
chan.say(`Sorry, I didn't quite get that. Can you say again?`);
chan.say("Sorry, I didn't quite get that. Can you say again?");
}
}
};
18 changes: 18 additions & 0 deletions examples/dialog/src/talk.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,21 @@
/*
* Copyright (C) 2021 by Fonoster Inc (https://fonoster.com)
* http://github.com/fonoster/fonos
*
* This file is part of Project Fonos
*
* Licensed under the MIT License (the "License");
* you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* https://opensource.org/licenses/MIT
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
const dialogflow = require("@google-cloud/dialogflow");
const uuid = require("uuid");

Expand Down
23 changes: 22 additions & 1 deletion examples/hello-monkeys/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,25 @@
/*
* Copyright (C) 2021 by Fonoster Inc (https://fonoster.com)
* http://github.com/fonoster/fonos
*
* This file is part of Project Fonos
*
* Licensed under the MIT License (the "License");
* you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* https://opensource.org/licenses/MIT
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* The simplest Voice Application you can build in Fonos
*/
module.exports = (chan) => chan.play("tt-monkeys");
const {VoiceServer} = require("@fonos/voice");
voiceServer.listen((req, res) => {
res.play("sound:tt-monkeys");
});
Loading

0 comments on commit d242cc6

Please sign in to comment.