* Add twilio config to readme
* Modify wording of main menu.
* Modify wording of recording message
* Add account sid setting to readme
* Add the twilio account sid to config
* Add check for accountSid
* Update paw to send AccountSid
the values.
When running with `make run`, it'll pick up these values automatically.
the values.
When running with `make run`, it'll pick up these values automatically.
-If you're doing it the hard way, you'll have to source them.
+If you're doing it the hard way, you'll have to source them. You must
+set the `DEAD_DROP_ACCOUNT_SID` to match your account sid. This is so
+dead drop can filter out calls from other accounts.
+Get a twilio number, and on the configuration set the voice settings to
+"Webhooks/TwiML" and point the `A call comes in` hook to:
+the `/menus/main/` path of your dead drop installation. For example:
+`https://dead-drop.unlimited.piza/menus/main`. It must be accessible
+from the internet.
+
+You will also need your account sid. This is obtained from the "[Account
+Settings][account-settings]" area in the twilio dashboard.
[docker]: https://www.docker.com/
[hapi-style-guide]: https://hapijs.com/styleguide
[docker]: https://www.docker.com/
[hapi-style-guide]: https://hapijs.com/styleguide
+[account-settings]: https://www.twilio.com/console/account/settings
* @memberof DeadDrop
* @typedef {object} tConfiguration
* @property {number} [port=1988] the port where the app will listen on
* @memberof DeadDrop
* @typedef {object} tConfiguration
* @property {number} [port=1988] the port where the app will listen on
+ * @property {string} twilioAccountSid the twilio account sid used to authorize calls
* @property {DeadDrop.tRedisConfiguration} redis the configuration to
* connect to the redis server
*/
module.exports = internals.Config = {
port: Getenv.int('DEAD_DROP_PORT', 1988),
* @property {DeadDrop.tRedisConfiguration} redis the configuration to
* connect to the redis server
*/
module.exports = internals.Config = {
port: Getenv.int('DEAD_DROP_PORT', 1988),
+ twilioAccountSid: Getenv('DEAD_DROP_TWILIO_ACCOUNT_SID'),
/**
* Information required to connect to the redis server
/**
* Information required to connect to the redis server
DEAD_DROP_REDIS_HOST=location_of_redis_server
DEAD_DROP_REDIS_HOST=location_of_redis_server
+DEAD_DROP_TWILIO_ACCOUNT_SID=your_twilio_account_sid
internals.kRecordingMenuRoute = '/menus/recording';
internals.kRandomMessageRoute = '/recordings/0';
internals.kLeaveMessageRoute = '/recordings';
internals.kRecordingMenuRoute = '/menus/recording';
internals.kRandomMessageRoute = '/recordings/0';
internals.kLeaveMessageRoute = '/recordings';
-internals.kMenuMessage = 'Para dejar un mensaje, presiona 1. ' +
- 'Para escuchar un mensaje al azar, presiona 2. ' +
- 'Para escuchar un mensaje específico, presioan 3.'; // the message that will be shown
+internals.kMenuMessage = 'Marca 1 para grabar mensaje. ' +
+ 'Marca 2 para escuchar mensaje al azar. ' +
+ 'Marca 3 si conoces el número de mensaje'; // the message that will be shown
internals.kMenuInvalidResponseMessage = 'No entendí... Volviendo al menu principal.'; // invalid selection message
internals.kMenuOptions = {
leaveMessage: 1,
internals.kMenuInvalidResponseMessage = 'No entendí... Volviendo al menu principal.'; // invalid selection message
internals.kMenuOptions = {
leaveMessage: 1,
internals.kContentType = 'application/xml'; // The content type used to respond
internals.kLanguage = 'es-mx'; // the language to use
internals.kMaxMessageLength = 30; // max message length in seconds
internals.kContentType = 'application/xml'; // The content type used to respond
internals.kLanguage = 'es-mx'; // the language to use
internals.kMaxMessageLength = 30; // max message length in seconds
-internals.kIdDateFormat = 'YYMMDDHHmmssSSS'; // derive ids from current date. 15 digits.
internals.kRecordingsSet = 'recordings';
internals.kRecordingsSet = 'recordings';
-internals.kRecordMessage = 'Graba tu mensaje despues del bip. ' +
- 'Presiona cualquier tecla para finalizar tu mensaje. '; // the recording message
+internals.kRecordMessage = 'Graba tu mensaje despues del bip y ' +
+ 'presiona cualquier tecla para finalizar. '; // the recording message
internals.kConfirmationMessage = 'Gracias. Tu mensaje es el número: ';
internals.kNotFoundMessage = 'Mensaje no encontrado. Adiós!';
internals.kConfirmationMessage = 'Gracias. Tu mensaje es el número: ';
internals.kNotFoundMessage = 'Mensaje no encontrado. Adiós!';
this._app = Koa();
this._app.use(KoaBodyParser());
this._app = Koa();
this._app.use(KoaBodyParser());
+ this._app.use(function * (next) {
+
+ const accountSid = this.request.body.AccountSid || this.request.query.AccountSid;
+
+ if (accountSid === self.twilioAccountSid) {
+ yield next;
+ }
+ else {
+ this.throw('Unauthorized', 401);
+ }
+ });
+
this._initializeMainMenuRoutes();
this._initializeRecordingMenuRoutes();
this._initializeRecordingsRoutes();
this._initializeMainMenuRoutes();
this._initializeRecordingMenuRoutes();
this._initializeRecordingsRoutes();