mirror of
https://github.com/jambonz/jambonz-api-server.git
synced 2026-11-08 20:43:46 +00:00
when provisioning a new account on hosted system, automatically add hello-world and dial-time apps
This commit is contained in:
1 parent
f66814fff2
commit
0589328f24
2 files changed
+63
No files matched your search
@@ -20,6 +20,13 @@ values (?, ?, ?, ?, ?, 0, 'local', ?)`;
|
||||
const insertAccountSql = `INSERT into accounts
|
||||
(account_sid, service_provider_sid, name, is_active, webhook_secret, trial_end_date)
|
||||
values (?, ?, ?, ?, ?, CURDATE() + INTERVAL 21 DAY)`;
|
||||
const insertWebookSql = `INSERT INTO webhooks (webhook_sid, url, method)
|
||||
VALUES (?, ?, ?)`;
|
||||
const insertApplicationSql = `INSERT INTO applications
|
||||
(application_sid, account_sid, name, call_hook_sid, call_status_hook_sid,
|
||||
speech_synthesis_vendor, speech_synthesis_language, speech_synthesis_voice,
|
||||
speech_recognizer_vendor, speech_recognizer_language)
|
||||
VALUES (?,?,?,?,?,?,?,?,?,?)`;
|
||||
const queryRootDomainSql = `SELECT root_domain
|
||||
FROM service_providers
|
||||
WHERE service_providers.service_provider_sid = ?`;
|
||||
@@ -281,6 +288,22 @@ router.post('/', async(req, res) => {
|
||||
userProfile.provider_userid);
|
||||
}
|
||||
|
||||
/* add hello-world and dial-time as starter applications */
|
||||
const callStatusSid = uuid();
|
||||
const helloWordSid = uuid();
|
||||
const dialTimeSid = uuid();
|
||||
|
||||
/* 3 webhooks */
|
||||
await promisePool.execute(insertWebookSql, [callStatusSid, 'https://public-apps.jambonz.us/call-status', 'POST']);
|
||||
await promisePool.execute(insertWebookSql, [helloWordSid, 'https://public-apps.jambonz.us/hello-world', 'POST']);
|
||||
await promisePool.execute(insertWebookSql, [dialTimeSid, 'https://public-apps.jambonz.us/dial-time', 'POST']);
|
||||
|
||||
/* 2 applications */
|
||||
await promisePool.execute(insertApplicationSql, [uuid(), userProfile.account_sid, 'hello world',
|
||||
helloWordSid, callStatusSid, 'google', 'en-US', 'en-US-Wavenet-C', 'google', 'en-US']);
|
||||
await promisePool.execute(insertApplicationSql, [uuid(), userProfile.account_sid, 'dial time clock',
|
||||
dialTimeSid, callStatusSid, 'google', 'en-US', 'en-US-Wavenet-C', 'google', 'en-US']);
|
||||
|
||||
Object.assign(userProfile, {
|
||||
pristine: true,
|
||||
is_active: req.body.provider !== 'local',
|
||||
|
||||
Reference in new issue
Block a user