npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

node-red-contrib-twilio-ivr

v0.0.3

Published

Node-RED nodes for Twilio IVR development

Downloads

36

Readme

node-red-contrib-twilio-ivr

npm

This library of Node-RED nodes enables you to build a powerful and flexible Interactive Voice Response (IVR) telephone system with Twilio and Node-RED. This README assumes you have experience with Twilio and Node-RED, but there is a much more comprehensive article here which gives a detailed description of how it all works.

A Twilio Node-RED IVR is essentially a web server that returns TwiML markup to Twilio. This is the basic architecture of the system:

Twilio architecture

The nodes in this library create the TwiML markup for Twilio to present to the caller. You will also need to create a Node-RED flow for the Twilio IVR Core which handles incoming requests and properly routes the call based on the caller's input. The Universal Router is the HTTP endpoint /router. In your Twilio account, you will need to configure your phone number to invoke the HTTP endpoints defined in the IVR Core flow.

Twilio phone setup

TwiML Nodes

These nodes can be assembled together to create TwiML response documents. Many correspond directly to TwiML tags, but the 'menu' node is more complex and creates the TwiML content for a whole menu.

node | description ---- | ----------- twiml-begin | begin the TwiML response -- handled by IVR Core flow twiml-end | end the TwiML response -- handled by IVR Core flow gather-begin | begin a TwiML Gather operation which gets input from the caller gather-end | end TwiML Gather operation say | say a phrase play | play an audio file record | record the caller dial | dial out to another phone number menu | speak an IVR menu to the caller set-route | set the next route to invoke after this route executes pause | pause for a specified number of seconds redirect | redirect Twilio to a URL -- only used by IVR Core flow hangup | hang up and end the Twilio call random-switch | choose an output path randomly

Installation and Setup

Install Node-RED nodes

Run the following command in your Node-RED user directory typically ~/.node-red

npm install node-red-contrib-twilio-ivr

Twilio IVR Core Flow

Create a Node-RED flow called Twilio IVR Core with the following contents:

[{"id":"8ab1082a.cd5f18","type":"http in","z":"e1c92446.8eb838","name":"/error","url":"/error","method":"post","swaggerDoc":"","x":102,"y":430,"wires":[["f03e604e.f677a","8aa3265f.ee1348"]]},{"id":"f03e604e.f677a","type":"debug","z":"e1c92446.8eb838","name":"Error","active":true,"console":"false","complete":"true","x":237,"y":501,"wires":[]},{"id":"1574496a.015917","type":"http in","z":"e1c92446.8eb838","name":"/status","url":"/status","method":"post","swaggerDoc":"","x":107,"y":744,"wires":[["7059efa9.48bf2","9c0132f.00a77d"]]},{"id":"7059efa9.48bf2","type":"debug","z":"e1c92446.8eb838","name":"Status","active":true,"console":"false","complete":"true","x":236,"y":799,"wires":[]},{"id":"e712f6a.c90e308","type":"say","z":"e1c92446.8eb838","name":"","phrase":"An error occurred","voice":"man","x":402.5,"y":430,"wires":[["24aad9b3.331e96"]]},{"id":"9c0132f.00a77d","type":"function","z":"e1c92446.8eb838","name":"destroy session","func":"if (msg.payload.CallStatus == 'completed') {\n    var sessions = global.get(\"sessions\");\n    if (sessions) {\n        node.log(\"destroying session for \" + msg.payload.From);\n        delete sessions[msg.payload.CallSid];\n    }\n}\nreturn msg;","outputs":1,"noerr":0,"x":297,"y":744,"wires":[["15e44a56.bf4b86"]]},{"id":"33a11367.19ab9c","type":"http response","z":"e1c92446.8eb838","name":"empty response","x":679.5,"y":744,"wires":[]},{"id":"15e44a56.bf4b86","type":"function","z":"e1c92446.8eb838","name":"set status code","func":"msg.statusCode = 204;\nreturn msg;","outputs":1,"noerr":0,"x":492.5,"y":744,"wires":[["33a11367.19ab9c"]]},{"id":"2504037.2cea3fc","type":"comment","z":"e1c92446.8eb838","name":"invoked by Twilio on call completion","info":"","x":198.5,"y":700,"wires":[]},{"id":"c49ff22e.9143b","type":"twiml-end","z":"e1c92446.8eb838","name":"","x":921,"y":430,"wires":[["7fed097b.707cb8"]]},{"id":"7fed097b.707cb8","type":"http response","z":"e1c92446.8eb838","name":"return to Twilio","x":1096,"y":430,"wires":[]},{"id":"8aa3265f.ee1348","type":"twiml-begin","z":"e1c92446.8eb838","name":"","x":254,"y":430,"wires":[["e712f6a.c90e308"]]},{"id":"24aad9b3.331e96","type":"function","z":"e1c92446.8eb838","name":"process error","func":"var sessions = global.get(\"sessions\");\nif (sessions) {\n    msg.session = sessions[msg.payload.CallSid];\n}\nvar errorRoute;\nif ((msg.session) && (msg.session.currentRoute)) {\n    errorRoute = msg.session.currentRoute;\n} else {\n    errorRoute = '/router';\n}\nnode.error('Error processing route: ' + errorRoute);\n// Arrange for call to redirect to router and follow /begin route.\nif (msg.session) {\n    msg.session.nextRoute = \"/begin\";\n}\nmsg.topic = msg.baseUrl + '/router';\n\nreturn msg;","outputs":1,"noerr":0,"x":549.5,"y":430,"wires":[["bf68d1a4.83fe2"]]},{"id":"5ae6b177.c4e85","type":"http in","z":"e1c92446.8eb838","name":"/router","url":"/router","method":"post","swaggerDoc":"","x":96,"y":108,"wires":[["66085aec.f638c4","b045d18.d08123"]]},{"id":"4c7e21e6.2f203","type":"function","z":"e1c92446.8eb838","name":"process input","func":"msg.session = global.get(\"sessions\")[msg.payload.CallSid];\n\t\t\t\nvar digits = msg.payload.Digits;\n\n// If a key was pressed and a menu defined\nif (digits) {\n  var numDigits = digits.length;\n  node.log('digits= \\\"' + digits + '\\\"');\n  \n  // For convenience, save digits as space-separated string for speech.\n  msg.payload.digitSpeech = \" \";\n  for(var i=0;i<numDigits;i++) {\n    msg.payload.digitSpeech += msg.payload.Digits[i] + \" \";\n  }\n\n  \n  if ((numDigits == 1) && (msg.session.menuMap)) {\n    // If a key was pressed and a menu defined\n    delete msg.session.selectedItem;\n    if (digits == '*') digits = 'star';\n    if (digits == '#') digits = 'pound';\n    msg.session.selectedItem = msg.session.menuMap[digits];\n    var menuItem = msg.session.selectedItem;\n    if (menuItem) {\n      msg.route = menuItem.route;\n      node.log('menu selection --> ' + msg.route);\n    }\n  }\n} else {\n  if (msg.payload.SpeechResult) {\n    var speech = msg.payload.SpeechResult;\n    node.error(speech);\n    speech = speech.toLowerCase();\n    msg.session.selectedItem = msg.session.menuMap[speech];\n    var menuItem = msg.session.selectedItem;\n    if (menuItem) {\n      msg.route = menuItem.route;\n      node.log('menu selection --> ' + msg.route);\n    }\n  } \n}\nif (!msg.route) {\n  // route not specified by a menu selection or speech\n  if (msg.session.nextRoute) {\n    msg.route = msg.session.nextRoute;\n    node.log('using nextRoute --> ' + msg.route);\n    delete msg.session.nextRoute;\n  } else {\n    node.log('could not determine route!');\n  }\n}\nmsg.session.currentRoute = msg.route;\nreturn msg;\n\n","outputs":"1","noerr":0,"x":610.5,"y":109,"wires":[["7d754201.27f0dc"]]},{"id":"7927d7a6.3c71d8","type":"comment","z":"e1c92446.8eb838","name":"Universal Router","info":"","x":126.5,"y":47,"wires":[]},{"id":"5ed7599d.3d7d48","type":"http response","z":"e1c92446.8eb838","name":"return to Twilio","x":3104,"y":92,"wires":[]},{"id":"dfd94a08.db0788","type":"http request","z":"e1c92446.8eb838","name":"invoke route","method":"POST","ret":"txt","url":"{{{baseUrl}}}{{{route}}}","tls":"67cad65a.96bda8","x":1629.5,"y":103,"wires":[["e24c692a.1c9f78"]]},{"id":"7d754201.27f0dc","type":"twiml-begin","z":"e1c92446.8eb838","name":"","x":794,"y":109,"wires":[["6b0d483c.c749c8"]]},{"id":"ebaef1e.8617d1","type":"twiml-end","z":"e1c92446.8eb838","name":"","x":2871,"y":93,"wires":[["5ed7599d.3d7d48","c1f39b77.902418"]]},{"id":"6b0d483c.c749c8","type":"switch","z":"e1c92446.8eb838","name":"valid route?","property":"route","propertyType":"msg","rules":[{"t":"nnull"},{"t":"else"}],"checkall":"true","outputs":2,"x":959.5,"y":109,"wires":[["dfd94a08.db0788"],["bb870d5b.6825"]],"inputLabels":["route url"],"outputLabels":["yes","no"]},{"id":"690fba1b.53c684","type":"function","z":"e1c92446.8eb838","name":"route to previous route","func":"msg.route = msg.session.lastRoute;\nnode.log(\"routing to lastRoute: \" + msg.session.lastRoute);\nreturn msg;","outputs":1,"noerr":0,"x":1356,"y":137,"wires":[["dfd94a08.db0788"]]},{"id":"aa83165e.a75d58","type":"json","z":"e1c92446.8eb838","name":"","pretty":false,"x":1975,"y":97,"wires":[["f300ea87.a6d4f8"]]},{"id":"e24c692a.1c9f78","type":"switch","z":"e1c92446.8eb838","name":"error check","property":"statusCode","propertyType":"msg","rules":[{"t":"eq","v":"200","vt":"num"},{"t":"else"}],"checkall":"true","outputs":2,"x":1811.5,"y":103,"wires":[["aa83165e.a75d58"],["7fb5874b.1ad3e8"]]},{"id":"7fb5874b.1ad3e8","type":"function","z":"e1c92446.8eb838","name":"log error","func":"node.error(\"HTTP status code = \" + msg.statusCode + \" when invoking route \" + msg.route);\nmsg.payload = \"\";\nreturn msg;","outputs":1,"noerr":0,"x":2508.5,"y":168,"wires":[["ebaef1e.8617d1"]]},{"id":"b045d18.d08123","type":"function","z":"e1c92446.8eb838","name":"get session","func":"if (!global.get(\"sessions\")) {\n    // no global set of sessions yet.\n    global.set(\"sessions\", {});\n} else {\n    // try to find session for caller\n    msg.session = global.get(\"sessions\")[msg.payload.CallSid];\n}\nif (!msg.session) {\n    // no session for this call yet\n    var protocol = \"http://\";\n    if (msg.req.connection.encrypted === true) {\n        protocol = \"https://\";\n    }\n    msg.session = {\n        callStart: new Date(),\n        baseUrl: protocol + msg.req.headers.host\n    };\n    global.get(\"sessions\")[msg.payload.CallSid] = msg.session;\n    node.log(\"creating session for \" + msg.payload.From);\n    //node.log(JSON.stringify(global.get(\"sessions\")[msg.payload.CallSid]));\n\n    msg.session.nextRoute = \"/begin\";\n    msg.session.newCall = true;\n}\n\nreturn msg;","outputs":1,"noerr":0,"x":252,"y":109,"wires":[["f4df48e7.73b348"]]},{"id":"bb870d5b.6825","type":"say","z":"e1c92446.8eb838","name":"invalid choice","phrase":"invalid option","voice":"man","x":1149.5,"y":137,"wires":[["690fba1b.53c684"]]},{"id":"3cd410d6.cbe4a","type":"comment","z":"e1c92446.8eb838","name":"invoked by Twilio on error","info":"","x":162,"y":369,"wires":[]},{"id":"66085aec.f638c4","type":"debug","z":"e1c92446.8eb838","name":"","active":true,"console":"false","complete":"true","x":227.5,"y":163,"wires":[]},{"id":"50ef5672.049eb8","type":"function","z":"e1c92446.8eb838","name":"set next route","func":"// Use redirect to have Twilio come back to the router.\nmsg.topic = msg.baseUrl + '/router';\n  \nif (!msg.session.nextRoute) {\n  // if a route did not request Gather input\n  // and did not specify a next route, go back\n  // to the last route.\n  msg.session.nextRoute = msg.session.lastRoute;\n}\n\nreturn msg;","outputs":1,"noerr":0,"x":2369,"y":118,"wires":[["98131f3e.fa3c3"]]},{"id":"bf68d1a4.83fe2","type":"redirect","z":"e1c92446.8eb838","name":"redirect to /router","method":"POST","url":"","x":737.5,"y":430,"wires":[["c49ff22e.9143b"]]},{"id":"f300ea87.a6d4f8","type":"switch","z":"e1c92446.8eb838","name":"input requested?","property":"payload.twiml","propertyType":"msg","rules":[{"t":"cont","v":"<Gather","vt":"str"},{"t":"else"}],"checkall":"true","outputs":2,"x":2155.5,"y":97,"wires":[["ebaef1e.8617d1"],["50ef5672.049eb8"]],"outputLabels":["yes","no"]},{"id":"98131f3e.fa3c3","type":"redirect","z":"e1c92446.8eb838","name":"tell Twilio to invoke /router","method":"POST","url":"","x":2578,"y":118,"wires":[["ebaef1e.8617d1"]]},{"id":"c1f39b77.902418","type":"debug","z":"e1c92446.8eb838","name":"","active":false,"console":"false","complete":"true","x":3052.5,"y":145,"wires":[]},{"id":"9c274f23.595cc","type":"http in","z":"e1c92446.8eb838","name":"/recording-callback","url":"/recording-callback","method":"post","upload":false,"swaggerDoc":"","x":144,"y":577,"wires":[["d176cff2.0d2ca","3ac7caa3.9398c6"]]},{"id":"d176cff2.0d2ca","type":"function","z":"e1c92446.8eb838","name":"set recording status","func":"// try to find session for caller\nmsg.session = global.get(\"sessions\")[msg.payload.CallSid];\nmsg.session.recordingStatus = msg.payload.RecordingStatus;\nnode.log('/recording-callback: ' + msg.payload.RecordingUrl + ' : ' + msg.payload.RecordingStatus);\n\nreturn msg;","outputs":1,"noerr":0,"x":370,"y":577,"wires":[["58131b3f.1d0e04"]]},{"id":"58131b3f.1d0e04","type":"http response","z":"e1c92446.8eb838","name":"return to Twilio","x":573,"y":577,"wires":[]},{"id":"3ac7caa3.9398c6","type":"debug","z":"e1c92446.8eb838","name":"recording status","active":true,"console":"false","complete":"true","x":360,"y":629,"wires":[]},{"id":"f4df48e7.73b348","type":"function","z":"e1c92446.8eb838","name":"blacklist check","func":"// array of blacklisted phone numbers\nvar blacklist = [\n    '+15558675309'\n];\n\nif (blacklist.includes(msg.payload.From)) {\n    msg.route = \"/blacklisted\";\n    node.log(\"blacklisted number: \" + msg.payload.From);\n}\nreturn msg;\n","outputs":"1","noerr":0,"x":423.5,"y":109,"wires":[["4c7e21e6.2f203"]],"outputLabels":["no"]},{"id":"691728df.215598","type":"http in","z":"e1c92446.8eb838","name":"/blacklisted","url":"/blacklisted","method":"post","upload":false,"swaggerDoc":"","x":118,"y":262,"wires":[["595f04c3.ce663c"]]},{"id":"595f04c3.ce663c","type":"say","z":"e1c92446.8eb838","name":"blacklisted","phrase":"the number you are calling from is blacklisted","voice":"man","x":295,"y":262,"wires":[["1188dcce.e2e913"]]},{"id":"1188dcce.e2e913","type":"hangup","z":"e1c92446.8eb838","name":"","x":461,"y":262,"wires":[["992d7646.6811a8"]]},{"id":"992d7646.6811a8","type":"http response","z":"e1c92446.8eb838","name":"return to router","statusCode":"","headers":{},"x":628.5,"y":262,"wires":[]},{"id":"67cad65a.96bda8","type":"tls-config","z":"","name":"","cert":"","key":"","ca":"","certname":"","keyname":"","caname":"","verifyservercert":false}]

In the HTTP request node called "invoke route", update the configuration to fit your server's security configuration. That is, whether TLS/SSL is used, and the your Node-RED HTTP node username/password credentials. In your TLS/SSL configuration, you may need to uncheck the checkbox "verify server certificate".

Twilio phone setup

Example IVR

The example IVR "Customer Service Hell" demonstrates many features. Here is a huge image of this huge Node-RED flow

If you want to try the example Customer Service Hell IVR, create a Node-RED flow and import this content:

[{"id":"8779f776.e25658","type":"http in","z":"fc738cdd.8039e","name":"/main-menu","url":"/main-menu","method":"post","upload":false,"swaggerDoc":"","x":132,"y":150,"wires":[["8eacf45c.a2a8b8"]]},{"id":"946a1250.1d9bb","type":"http in","z":"fc738cdd.8039e","name":"/account","url":"/account","method":"post","upload":false,"swaggerDoc":"","x":127,"y":698,"wires":[["9d4969fa.a9e4e8"]]},{"id":"5f4bdb0d.28e234","type":"menu","z":"fc738cdd.8039e","name":"main menu","sayName":true,"voice":"man","baseurl":"629d4f71.9056f","items":[{"key":"1","prependFor":false,"content":"to access your account","op":"say","action":"press","speech":"","route":"/account"},{"key":"2","prependFor":true,"content":"customer support","op":"say","action":"press","speech":"","route":"/support"},{"key":"3","prependFor":false,"content":"to place an order","op":"say","action":"press","speech":"","route":"/place-order"},{"key":"0","prependFor":false,"content":"to speak to an agent","op":"say","action":"press","speech":"","route":"/agent"},{"key":"star","prependFor":false,"content":"to end this call","op":"say","action":"press","speech":"","route":"/end"}],"x":472,"y":150,"wires":[["6722a9e4.dda9e8"]]},{"id":"e33afdc5.2786","type":"http response","z":"fc738cdd.8039e","name":"return to router","statusCode":"","headers":{},"x":808.5,"y":150,"wires":[]},{"id":"c55d7071.6859","type":"http response","z":"fc738cdd.8039e","name":"return to router","statusCode":"","headers":{},"x":1569.5,"y":697,"wires":[]},{"id":"f7a38fe1.9c64f","type":"http in","z":"fc738cdd.8039e","name":"/loading-dock","url":"/loading-dock","method":"post","upload":false,"swaggerDoc":"","x":152.5,"y":1854,"wires":[["3a7fbca3.db2e34"]]},{"id":"c81d8122.1d739","type":"http response","z":"fc738cdd.8039e","name":"return to router","statusCode":"","headers":{},"x":1685.5,"y":1851,"wires":[]},{"id":"6722a9e4.dda9e8","type":"gather-end","z":"fc738cdd.8039e","name":"","x":635,"y":150,"wires":[["e33afdc5.2786"]]},{"id":"9d4969fa.a9e4e8","type":"gather-begin","z":"fc738cdd.8039e","name":"","action":"/router","input":"dtmf speech","timeout":"5","numDigits":"8","speechHints":"I don't know it.","speechTimeout":"1","x":305,"y":698,"wires":[["c5929e64.a720c"]]},{"id":"bc21f0eb.e8d14","type":"gather-end","z":"fc738cdd.8039e","name":"","x":1208,"y":698,"wires":[["21a57666.03ee5a"]]},{"id":"ac751fdc.902d4","type":"http in","z":"fc738cdd.8039e","name":"/end","url":"/end","method":"post","swaggerDoc":"","x":131.5,"y":1913,"wires":[["13f240ef.1d8bbf"]]},{"id":"13f240ef.1d8bbf","type":"play","z":"fc738cdd.8039e","baseurl":"629d4f71.9056f","name":"goodbye","url":"goodbye.mp3","x":272,"y":1913,"wires":[["d14d19c4.187e68"]]},{"id":"293e3f86.de514","type":"hangup","z":"fc738cdd.8039e","name":"","x":550,"y":1913,"wires":[["23616421.0b2bbc"]]},{"id":"23616421.0b2bbc","type":"http response","z":"fc738cdd.8039e","name":"return to router","statusCode":"","headers":{},"x":717.5,"y":1913,"wires":[]},{"id":"d14d19c4.187e68","type":"pause","z":"fc738cdd.8039e","name":"","seconds":"1","x":413,"y":1913,"wires":[["293e3f86.de514"]]},{"id":"c911d549.eb4f28","type":"http in","z":"fc738cdd.8039e","name":"/begin","url":"/begin","method":"post","upload":false,"swaggerDoc":"","x":110.5,"y":62,"wires":[["5c26ad60.70e794"]]},{"id":"d3273012.e1723","type":"http in","z":"fc738cdd.8039e","name":"/support","url":"/support","method":"post","upload":false,"swaggerDoc":"","x":136.5,"y":1107,"wires":[["29ecd411.807b7c"]]},{"id":"5f58c078.8d9ae","type":"http response","z":"fc738cdd.8039e","name":"return to router","statusCode":"","headers":{},"x":1412.5,"y":1108,"wires":[]},{"id":"5c26ad60.70e794","type":"switch","z":"fc738cdd.8039e","name":"new call?","property":"payload.CallStatus","propertyType":"msg","rules":[{"t":"eq","v":"ringing","vt":"str"},{"t":"else"}],"checkall":"true","outputs":2,"x":264,"y":62,"wires":[["78405ae1.2e25d4"],["8eacf45c.a2a8b8"]],"outputLabels":["yes","no"]},{"id":"7a445aa.0b523a4","type":"http in","z":"fc738cdd.8039e","name":"/place-order","url":"/place-order","method":"post","upload":false,"swaggerDoc":"","x":134.5,"y":249,"wires":[["4fb7be16.db4d5"]]},{"id":"a1f69a26.410c68","type":"http response","z":"fc738cdd.8039e","name":"return to router","statusCode":"","headers":{},"x":1003.5,"y":249,"wires":[]},{"id":"4fb7be16.db4d5","type":"gather-begin","z":"fc738cdd.8039e","name":"","action":"/router","input":"dtmf","timeout":"5","numDigits":"6","speechHints":"","speechTimeout":"","x":297,"y":249,"wires":[["c0da5a3b.75bbf8"]]},{"id":"aa2f644.006ef98","type":"gather-end","z":"fc738cdd.8039e","name":"","x":632,"y":249,"wires":[["a4cec866.601288"]]},{"id":"a4cec866.601288","type":"set-route","z":"fc738cdd.8039e","name":"","route":"/confirm-item","x":816,"y":249,"wires":[["a1f69a26.410c68"]]},{"id":"223d9907.4bbd86","type":"http in","z":"fc738cdd.8039e","name":"/confirm-item","url":"/confirm-item","method":"post","upload":false,"swaggerDoc":"","x":132.5,"y":355,"wires":[["ac0b36a4.084bd8"]]},{"id":"9c357a38.ba6368","type":"function","z":"fc738cdd.8039e","name":"repeat item","func":"if (msg.payload.Digits) {\n    msg.payload.say = msg.payload.digitSpeech;\n} \n\nreturn msg;","outputs":1,"noerr":0,"x":630,"y":355,"wires":[["ac7526a3.058e48"]]},{"id":"b5a7f57e.359ad8","type":"pause","z":"fc738cdd.8039e","name":"1s","seconds":"1","x":1466,"y":362,"wires":[["97cd9be3.8b1fd8"]]},{"id":"ac0b36a4.084bd8","type":"gather-begin","z":"fc738cdd.8039e","name":"","action":"/router","input":"dtmf","timeout":"5","numDigits":"1","speechHints":"yes, no","speechTimeout":"auto","x":297.5,"y":355,"wires":[["268480f4.95c38"]]},{"id":"23294461.e860cc","type":"gather-end","z":"fc738cdd.8039e","name":"","x":1783,"y":362,"wires":[["3bf0ab96.63d344"]]},{"id":"3bf0ab96.63d344","type":"http response","z":"fc738cdd.8039e","name":"return to router","statusCode":"","headers":{},"x":1976.5,"y":362,"wires":[]},{"id":"e9167f6c.8215a","type":"http in","z":"fc738cdd.8039e","name":"/submit-order","url":"/submit-order","method":"post","upload":false,"swaggerDoc":"","x":133.5,"y":486,"wires":[["19422fdf.3e146"]]},{"id":"e5dab480.ddfc88","type":"pause","z":"fc738cdd.8039e","name":"1s","seconds":"1","x":454.5,"y":485,"wires":[["9c413104.3d134"]]},{"id":"834e8d02.b971f","type":"set-route","z":"fc738cdd.8039e","name":"/main-menu","route":"/main-menu","x":1059.5,"y":485,"wires":[["ae19c1d8.f2f93"]]},{"id":"ae19c1d8.f2f93","type":"http response","z":"fc738cdd.8039e","name":"return to router","statusCode":"","headers":{},"x":1249.5,"y":485,"wires":[]},{"id":"4defcd3f.19eae4","type":"random-switch","z":"fc738cdd.8039e","name":"random item","outputs":"5","x":986,"y":356,"wires":[["7b1dc221.721f2c"],["35558f19.70243"],["4f3e3831.8a6d38"],["d18466c8.f883d8"],["fcbf6c46.5e321"]]},{"id":"ac7526a3.058e48","type":"say","z":"fc738cdd.8039e","name":"say item","phrase":"","voice":"man","x":787,"y":355,"wires":[["4defcd3f.19eae4"]]},{"id":"e55360cb.616c3","type":"say","z":"fc738cdd.8039e","name":"say price","phrase":"","voice":"man","x":899.5,"y":485,"wires":[["834e8d02.b971f"]]},{"id":"428d6bf5.5bc344","type":"function","z":"fc738cdd.8039e","name":"random price","func":"var n = (300 + (Math.random() * 1000)).toFixed(2);\nmsg.payload.say =  '$' + n.toString().replace(/\\B(?=(\\d{3})+(?!\\d))/g, \",\");\nreturn msg;","outputs":1,"noerr":0,"x":745.5,"y":485,"wires":[["e55360cb.616c3"]]},{"id":"d76fc30e.fb7a","type":"say","z":"fc738cdd.8039e","name":"eight","phrase":"8","voice":"man","x":651,"y":698,"wires":[["5f1aaf25.0b341"]]},{"id":"c5929e64.a720c","type":"play","z":"fc738cdd.8039e","baseurl":"629d4f71.9056f","name":"please enter your","url":"pleaseenteryour.mp3","x":491.5,"y":698,"wires":[["d76fc30e.fb7a"]]},{"id":"5f1aaf25.0b341","type":"play","z":"fc738cdd.8039e","baseurl":"629d4f71.9056f","name":"digit account #","url":"digitaccountnumber.mp3","x":809,"y":698,"wires":[["dd46656b.bc0ff8"]]},{"id":"dd46656b.bc0ff8","type":"play","z":"fc738cdd.8039e","baseurl":"629d4f71.9056f","name":"if you don't know...","url":"ifyoudontknowit.mp3","x":1010,"y":698,"wires":[["bc21f0eb.e8d14"]]},{"id":"cca1d361.7c395","type":"http in","z":"fc738cdd.8039e","name":"/find-account","url":"/find-account","method":"post","upload":false,"swaggerDoc":"","x":139.5,"y":782,"wires":[["2b4a784b.5d9798"]]},{"id":"21a57666.03ee5a","type":"set-route","z":"fc738cdd.8039e","name":"/find-account","route":"/find-account","x":1385.5,"y":697,"wires":[["c55d7071.6859"]]},{"id":"2b4a784b.5d9798","type":"switch","z":"fc738cdd.8039e","name":"know?","property":"payload.SpeechResult","propertyType":"msg","rules":[{"t":"regex","v":".*don't know.*","vt":"str","case":true},{"t":"else"}],"checkall":"true","outputs":2,"x":316.5,"y":782,"wires":[["7c9c8f8b.dd246"],["c01079b.491f888"]],"outputLabels":["yes",""]},{"id":"a25e632c.2a4d3","type":"gather-begin","z":"fc738cdd.8039e","name":"","action":"/router","input":"dtmf","timeout":"5","numDigits":"4","speechHints":"","speechTimeout":"auto","x":668,"y":810,"wires":[["c81579eb.b360d8"]]},{"id":"c81579eb.b360d8","type":"say","z":"fc738cdd.8039e","name":"enter PIN","phrase":"Please enter your 4 digit PIN","voice":"man","x":822,"y":810,"wires":[["7efeb0bf.ffcf8"]]},{"id":"7efeb0bf.ffcf8","type":"gather-end","z":"fc738cdd.8039e","name":"","x":995,"y":810,"wires":[["a4d8b6f.a666748"]]},{"id":"a4d8b6f.a666748","type":"set-route","z":"fc738cdd.8039e","name":"/check-pin","route":"/check-pin","x":1170.5,"y":810,"wires":[["767ea022.aa203"]]},{"id":"767ea022.aa203","type":"http response","z":"fc738cdd.8039e","name":"return to router","statusCode":"","headers":{},"x":1351.5,"y":810,"wires":[]},{"id":"d8159746.49fd28","type":"function","z":"fc738cdd.8039e","name":"transpose digits","func":"// transpose the 2nd and 3rd digits and read it back to the caller.\nmsg.payload.say = \"You entered \";\nmsg.payload.say += msg.payload.Digits[0];\nmsg.payload.say += \" \";\nmsg.payload.say += msg.payload.Digits[2];\nmsg.payload.say += \" \";\nmsg.payload.say += msg.payload.Digits[1];\nmsg.payload.say += \" \";\nmsg.payload.say += msg.payload.Digits[3];\nmsg.payload.say += \" \";\n\n\nreturn msg;","outputs":1,"noerr":0,"x":631.5,"y":899,"wires":[["ef09bc13.d9884"]]},{"id":"fd4efb23.e0a718","type":"http in","z":"fc738cdd.8039e","name":"/check-pin","url":"/check-pin","method":"post","upload":false,"swaggerDoc":"","x":133.5,"y":900,"wires":[["1241609a.7ce56f"]]},{"id":"ef09bc13.d9884","type":"say","z":"fc738cdd.8039e","name":"","phrase":"","voice":"man","x":786,"y":899,"wires":[["62261081.d8096"]]},{"id":"51860340.894dcc","type":"gather-begin","z":"fc738cdd.8039e","name":"","action":"/router","input":"dtmf","timeout":"5","numDigits":"1","speechHints":"","speechTimeout":"auto","x":456.5,"y":899,"wires":[["d8159746.49fd28"]]},{"id":"fd00596d.ed9308","type":"menu","z":"fc738cdd.8039e","name":"","sayName":false,"voice":"man","baseurl":"629d4f71.9056f","items":[{"key":"1","prependFor":false,"content":"to try again","op":"say","action":"press","speech":"","route":"/find-account"},{"key":"9","prependFor":true,"content":"main menu","op":"say","action":"press","speech":"","route":"/main-menu"},{"key":"0","prependFor":false,"content":"to speak to an agent","op":"say","action":"press","speech":"","route":"/agent"}],"x":1203,"y":899,"wires":[["bc7db0ca.5c49e"]]},{"id":"15bf591d.020af7","type":"gather-end","z":"fc738cdd.8039e","name":"","x":1961,"y":893,"wires":[["56885f80.5dc97"]]},{"id":"56885f80.5dc97","type":"http response","z":"fc738cdd.8039e","name":"return to router","statusCode":"","headers":{},"x":2141.5,"y":893,"wires":[]},{"id":"2e7fa7da.5efc08","type":"http in","z":"fc738cdd.8039e","name":"/shock-monkey","url":"/shock-monkey","method":"post","upload":false,"swaggerDoc":"","x":157.5,"y":1485,"wires":[["57b6ab1.42b9454"]]},{"id":"8a920b54.c38a88","type":"play","z":"fc738cdd.8039e","baseurl":"629d4f71.9056f","name":"shock monkey","url":"shock-monkey.mp3","x":494,"y":1484,"wires":[["7beccb61.71a144"]]},{"id":"bc7db0ca.5c49e","type":"function","z":"fc738cdd.8039e","name":"count failures","func":"msg.session = global.get(\"sessions\")[msg.payload.CallSid];\nif (!msg.session.pinfailures) {\n    msg.session.pinfailures = 1;\n} else {\n    msg.session.pinfailures++;\n}\n\n\nreturn msg;","outputs":1,"noerr":0,"x":1359.5,"y":899,"wires":[["9cd44b2a.0cad78"]]},{"id":"9cd44b2a.0cad78","type":"switch","z":"fc738cdd.8039e","name":"multiple failures?","property":"session.pinfailures","propertyType":"msg","rules":[{"t":"lt","v":"2","vt":"num"},{"t":"else"}],"checkall":"true","outputs":2,"x":1552.5,"y":898,"wires":[["15bf591d.020af7"],["e7247ffb.db8fd"]],"outputLabels":["no","yes"]},{"id":"e7247ffb.db8fd","type":"menu","z":"fc738cdd.8039e","name":"add shock monkey choice","sayName":false,"voice":"man","baseurl":"629d4f71.9056f","items":[{"key":"star","prependFor":false,"content":"toshockthemonkey.mp3","op":"play","action":"press","speech":"","route":"/shock-monkey"}],"x":1773,"y":946,"wires":[["15bf591d.020af7"]]},{"id":"3226cb96.b68554","type":"http response","z":"fc738cdd.8039e","name":"return to router","statusCode":"","headers":{},"x":877.5,"y":1484,"wires":[]},{"id":"7beccb61.71a144","type":"set-route","z":"fc738cdd.8039e","name":"/find-account","route":"/find-account","x":683,"y":1484,"wires":[["3226cb96.b68554"]]},{"id":"57b6ab1.42b9454","type":"play","z":"fc738cdd.8039e","baseurl":"629d4f71.9056f","name":"ring","url":"ring.mp3","x":324,"y":1484,"wires":[["8a920b54.c38a88"]]},{"id":"3a7fbca3.db2e34","type":"play","z":"fc738cdd.8039e","baseurl":"629d4f71.9056f","name":"ring","url":"ring.mp3","x":300,"y":1854,"wires":[["ad97bb10.545878"]]},{"id":"4d095534.fe449c","type":"play","z":"fc738cdd.8039e","baseurl":"629d4f71.9056f","name":"ring","url":"ring.mp3","x":563,"y":1853,"wires":[["89d73cba.26426"]]},{"id":"ad97bb10.545878","type":"pause","z":"fc738cdd.8039e","name":"2s","seconds":"2","x":427.5,"y":1853,"wires":[["4d095534.fe449c"]]},{"id":"8eacf45c.a2a8b8","type":"gather-begin","z":"fc738cdd.8039e","name":"","action":"/router","input":"dtmf speech","timeout":"5","numDigits":"1","speechHints":"","speechTimeout":"auto","x":310,"y":150,"wires":[["5f4bdb0d.28e234"]]},{"id":"b0e19a9f.6f6508","type":"play","z":"fc738cdd.8039e","baseurl":"629d4f71.9056f","name":"incorrect","url":"imsorrythatsincorrect.mp3","x":1065,"y":899,"wires":[["fd00596d.ed9308"]]},{"id":"c0da5a3b.75bbf8","type":"play","z":"fc738cdd.8039e","baseurl":"629d4f71.9056f","name":"enter #","url":"pleaseentercatalognumber.mp3","x":460.5,"y":249,"wires":[["aa2f644.006ef98"]]},{"id":"7b1dc221.721f2c","type":"play","z":"fc738cdd.8039e","baseurl":"629d4f71.9056f","name":"avocado roaster","url":"product_avocadoroaster.mp3","x":1241,"y":269,"wires":[["b5a7f57e.359ad8"]]},{"id":"35558f19.70243","type":"play","z":"fc738cdd.8039e","baseurl":"629d4f71.9056f","name":"watermelon press","url":"product_watermelonpress.mp3","x":1251,"y":307,"wires":[["b5a7f57e.359ad8"]]},{"id":"4f3e3831.8a6d38","type":"play","z":"fc738cdd.8039e","baseurl":"629d4f71.9056f","name":"garlic filter","url":"product_garlicfilter.mp3","x":1231,"y":344,"wires":[["b5a7f57e.359ad8"]]},{"id":"d18466c8.f883d8","type":"play","z":"fc738cdd.8039e","baseurl":"629d4f71.9056f","name":"ham stretcher","url":"product_hamstretcher.mp3","x":1242,"y":383,"wires":[["b5a7f57e.359ad8"]]},{"id":"fcbf6c46.5e321","type":"play","z":"fc738cdd.8039e","baseurl":"629d4f71.9056f","name":"waffle sprayer","url":"product_wafflesprayer.mp3","x":1243,"y":424,"wires":[["b5a7f57e.359ad8"]]},{"id":"19422fdf.3e146","type":"play","z":"fc738cdd.8039e","baseurl":"629d4f71.9056f","name":"thank you","url":"thankyouforyourorder.mp3","x":304,"y":486,"wires":[["e5dab480.ddfc88"]]},{"id":"9c413104.3d134","type":"play","z":"fc738cdd.8039e","baseurl":"629d4f71.9056f","name":"billed","url":"youwillbebilled.mp3","x":582,"y":485,"wires":[["428d6bf5.5bc344"]]},{"id":"7c9c8f8b.dd246","type":"play","z":"fc738cdd.8039e","baseurl":"629d4f71.9056f","name":"why?","url":"whydontyouknowit.mp3","x":484,"y":765,"wires":[["9d4969fa.a9e4e8"]]},{"id":"c01079b.491f888","type":"play","z":"fc738cdd.8039e","baseurl":"629d4f71.9056f","name":"found","url":"okwefoundyouraccount.mp3","x":485,"y":807,"wires":[["a25e632c.2a4d3"]]},{"id":"9c34699a.4b51d8","type":"play","z":"fc738cdd.8039e","baseurl":"629d4f71.9056f","name":"enter ticket #","url":"pleaseentersupportticketnumber.mp3","x":716,"y":1108,"wires":[["261c806d.e823f"]]},{"id":"7fe7e89.793e618","type":"gather-begin","z":"fc738cdd.8039e","name":"","action":"/router","input":"dtmf","timeout":"5","numDigits":"10","speechHints":"","speechTimeout":"auto","x":550,"y":1107,"wires":[["9c34699a.4b51d8"]]},{"id":"a0962bb.b1520d8","type":"gather-end","z":"fc738cdd.8039e","name":"","x":1048,"y":1108,"wires":[["ac67a0c7.2e4b1"]]},{"id":"ac67a0c7.2e4b1","type":"set-route","z":"fc738cdd.8039e","name":"/find-ticket","route":"/find-ticket","x":1220.5,"y":1108,"wires":[["5f58c078.8d9ae"]]},{"id":"440cfb39.241824","type":"http in","z":"fc738cdd.8039e","name":"/find-ticket","url":"/find-ticket","method":"post","upload":false,"swaggerDoc":"","x":137.5,"y":1194,"wires":[["301f8d32.71d192"]]},{"id":"b81724b5.e4ffc8","type":"play","z":"fc738cdd.8039e","baseurl":"629d4f71.9056f","name":"lookup","url":"lookup.mp3","x":497,"y":1194,"wires":[["6e76ce22.7a8ba"]]},{"id":"6e76ce22.7a8ba","type":"play","z":"fc738cdd.8039e","baseurl":"629d4f71.9056f","name":"typing","url":"typing.mp3","x":616,"y":1194,"wires":[["4c07ff4b.941c4"]]},{"id":"4c07ff4b.941c4","type":"function","z":"fc738cdd.8039e","name":"ticket found?","func":"msg.session = global.get(\"sessions\")[msg.payload.CallSid];\nif (msg.session.tickets) {\n    // match session ticket with digits\n    var digits = msg.payload.Digits;\n    var ticket = msg.session.tickets[digits];\n    node.log(JSON.stringify(ticket));\n    if (ticket) {\n        msg.payload.say = 'ticket number ' + msg.payload.digitSpeech;\n        if (ticket.recordingUrl) {\n            msg.payload.play = ticket.recordingUrl;\n        }\n        return [msg, null];\n    } else {\n        return [null, msg];\n    }\n} else {\n    return [null, msg];\n}\n\n\nreturn msg;","outputs":"2","noerr":0,"x":759.5,"y":1193,"wires":[["e3c24c82.9305e"],["11fec288.da678d"]]},{"id":"1241609a.7ce56f","type":"function","z":"fc738cdd.8039e","name":"4 digits?","func":"if ((msg.payload.Digits) && (msg.payload.Digits.length == 4)) {\n    return [null, msg];\n} else {\n    return [msg, null];\n}","outputs":"2","noerr":0,"x":283,"y":900,"wires":[["a25e632c.2a4d3"],["51860340.894dcc"]],"outputLabels":["no","yes"]},{"id":"6f13dc55.3a6a64","type":"http response","z":"fc738cdd.8039e","name":"return to router","statusCode":"","headers":{},"x":2555.5,"y":1264,"wires":[]},{"id":"11fec288.da678d","type":"say","z":"fc738cdd.8039e","name":"invalid","phrase":"invalid ticket number","voice":"man","x":956,"y":1223,"wires":[["69e66c4c.9e2d34"]]},{"id":"e3c24c82.9305e","type":"say","z":"fc738cdd.8039e","name":"say ticket #","phrase":"","voice":"man","x":935,"y":1187,"wires":[["f0f344a8.3f5318"]]},{"id":"87b3d096.5663","type":"menu","z":"fc738cdd.8039e","name":"ticket menu","sayName":false,"voice":"man","baseurl":"629d4f71.9056f","items":[{"key":"1","prependFor":false,"content":"to try again","op":"say","action":"press","speech":"","route":"/support"},{"key":"2","prependFor":false,"content":"to create a support ticket","op":"say","action":"press","speech":"","route":"/create-ticket"},{"key":"3","prependFor":false,"content":"to speak to an agent","op":"say","action":"press","speech":"","route":"/agent"},{"key":"4","prependFor":false,"content":"to transfer to the loading dock","op":"say","action":"press","speech":"","route":"/loading-dock"},{"key":"9","prependFor":false,"content":"to return to the main menu","op":"say","action":"press","speech":"","route":"/main-menu"}],"x":1556,"y":1266,"wires":[["ca08ce2f.4a0cc"]]},{"id":"69e66c4c.9e2d34","type":"gather-begin","z":"fc738cdd.8039e","name":"","action":"/router","input":"dtmf","timeout":"5","numDigits":"1","speechHints":"","speechTimeout":"auto","x":1390,"y":1266,"wires":[["87b3d096.5663"]]},{"id":"ca08ce2f.4a0cc","type":"gather-end","z":"fc738cdd.8039e","name":"","x":1721.5,"y":1266,"wires":[["6f13dc55.3a6a64"]]},{"id":"cdeb6ae2.6782f8","type":"http in","z":"fc738cdd.8039e","name":"/create-ticket","url":"/create-ticket","method":"post","upload":false,"swaggerDoc":"","x":146.5,"y":1316,"wires":[["f7894efc.330ab"]]},{"id":"44a2b73c.8fa278","type":"record","z":"fc738cdd.8039e","name":"record problem","action":"","maxLength":"5","timeout":"5","beep":true,"recordingStatusCallback":"","finishOnKey":"#","x":557,"y":1316,"wires":[["c79ec381.816fb"]]},{"id":"f7894efc.330ab","type":"say","z":"fc738cdd.8039e","name":"describe problem","phrase":"ok, describe your problem","voice":"man","x":337,"y":1316,"wires":[["44a2b73c.8fa278"]]},{"id":"816f1e65.97dc1","type":"http in","z":"fc738cdd.8039e","name":"/provide-ticket","url":"/provide-ticket","method":"post","upload":false,"swaggerDoc":"","x":157.5,"y":1389,"wires":[["baeb3da4.78d8d"]]},{"id":"c79ec381.816fb","type":"set-route","z":"fc738cdd.8039e","name":"/provide-ticket","route":"/provide-ticket","x":766.5,"y":1316,"wires":[["a1bc9640.fadd78"]]},{"id":"a1bc9640.fadd78","type":"http response","z":"fc738cdd.8039e","name":"return to router","statusCode":"","headers":{},"x":980.5,"y":1316,"wires":[]},{"id":"23efdd8b.3e2802","type":"function","z":"fc738cdd.8039e","name":"recording info","func":"msg.session = global.get(\"sessions\")[msg.payload.CallSid];\nnode.log('recording url = ' + msg.payload.RecordingUrl);\nnode.log('recording status = ' + msg.session.recordingStatus);\nmsg.payload.play = msg.payload.RecordingUrl;\nreturn msg;","outputs":1,"noerr":0,"x":588,"y":1389,"wires":[["26022913.1f2ad6"]]},{"id":"baeb3da4.78d8d","type":"say","z":"fc738cdd.8039e","name":"Ok, I think you said","phrase":"Ok, I think you said","voice":"man","x":372,"y":1389,"wires":[["23efdd8b.3e2802"]]},{"id":"26022913.1f2ad6","type":"play","z":"fc738cdd.8039e","baseurl":"","name":"repeat problem","url":"","x":809,"y":1389,"wires":[["bcb6f41b.91bbe8"]]},{"id":"106ddb25.7fd5e5","type":"set-route","z":"fc738cdd.8039e","name":"/support","route":"/support","x":1351.5,"y":1388,"wires":[["a48a5640.f63618"]]},{"id":"bcb6f41b.91bbe8","type":"function","z":"fc738cdd.8039e","name":"generate ticket #","func":"// generate support ticket number\nmsg.session = global.get(\"sessions\")[msg.payload.CallSid];\nif (!msg.session.tickets) {\n    msg.session.tickets = {};\n}\nvar ticketNum = \"\";\nvar ticketLength = 4;\nfor(var i=0;i<ticketLength;i++) {\n    ticketNum += Math.floor((Math.random() * 10));\n}\nmsg.session.tickets[ticketNum] = {\n    recordingUrl: msg.payload.RecordingUrl\n}\nnode.log(JSON.stringify(msg.session.tickets[ticketNum]));\nmsg.payload.say = \"Your ticket number is\";\nfor(var i=0;i<ticketLength;i++) {\n    msg.payload.say += \" \";\n    msg.payload.say += ticketNum.charAt(i);\n}\nnode.log(\"ticket number = \" + ticketNum);\nreturn msg;","outputs":1,"noerr":0,"x":1021.5,"y":1389,"wires":[["44016bcd.6fcc64"]]},{"id":"44016bcd.6fcc64","type":"say","z":"fc738cdd.8039e","name":"","phrase":"","voice":"man","x":1205,"y":1389,"wires":[["106ddb25.7fd5e5"]]},{"id":"a48a5640.f63618","type":"http response","z":"fc738cdd.8039e","name":"return to router","statusCode":"","headers":{},"x":1524.5,"y":1389,"wires":[]},{"id":"29ecd411.807b7c","type":"play","z":"fc738cdd.8039e","baseurl":"629d4f71.9056f","name":"ring","url":"ring.mp3","x":276.5,"y":1107,"wires":[["48b0660d.e9cbe8"]]},{"id":"48b0660d.e9cbe8","type":"say","z":"fc738cdd.8039e","name":"","phrase":"customer support","voice":"man","x":400,"y":1107,"wires":[["7fe7e89.793e618"]]},{"id":"f0f344a8.3f5318","type":"play","z":"fc738cdd.8039e","baseurl":"","name":"play recording","url":"","x":1114.5,"y":1187,"wires":[["5ca3331.14e7fcc"]]},{"id":"97cd9be3.8b1fd8","type":"menu","z":"fc738cdd.8039e","name":"correct?","sayName":false,"voice":"man","baseurl":"629d4f71.9056f","items":[{"key":"1","prependFor":false,"content":"if this is correct","op":"say","action":"press","speech":"","route":"/submit-order"},{"key":"2","prependFor":false,"content":"if not","op":"say","action":"press","speech":"","route":"/place-order"}],"x":1620,"y":362,"wires":[["23294461.e860cc"]]},{"id":"62261081.d8096","type":"pause","z":"fc738cdd.8039e","name":"1s","seconds":"1","x":918,"y":899,"wires":[["b0e19a9f.6f6508"]]},{"id":"268480f4.95c38","type":"play","z":"fc738cdd.8039e","baseurl":"629d4f71.9056f","name":"item","url":"item.mp3","x":461,"y":355,"wires":[["9c357a38.ba6368"]]},{"id":"9aa844f5.fc9828","type":"play","z":"fc738cdd.8039e","baseurl":"629d4f71.9056f","name":"please hold","url":"pleasehold.mp3","x":1415,"y":1187,"wires":[["91ac9caf.66c5d"]]},{"id":"5ca3331.14e7fcc","type":"pause","z":"fc738cdd.8039e","name":"1s","seconds":"1","x":1271,"y":1187,"wires":[["9aa844f5.fc9828"]]},{"id":"2ef97c7b.436ec4","type":"play","z":"fc738cdd.8039e","baseurl":"629d4f71.9056f","name":"I'm sorry","url":"imsorry.mp3","x":1897,"y":1187,"wires":[["902b6ab5.895c18"]]},{"id":"902b6ab5.895c18","type":"say","z":"fc738cdd.8039e","name":"unable","phrase":"We were unable to reproduce your problem. Closing ticket ","voice":"man","x":2043,"y":1187,"wires":[["93198b7.edb0978"]]},{"id":"93198b7.edb0978","type":"function","z":"fc738cdd.8039e","name":"delete ticket","func":"var digits = msg.payload.Digits;\nvar digitString = \"\";\nfor(var i=0;i<digits.length;i++) {\n    digitString += digits[i];\n}\ndelete msg.session.tickets[digitString];\n    \n\n\nreturn msg;","outputs":"1","noerr":0,"x":2199.5,"y":1187,"wires":[["c4781b5a.02d578"]]},{"id":"c4781b5a.02d578","type":"set-route","z":"fc738cdd.8039e","name":"/support","route":"/support","x":2358,"y":1187,"wires":[["6f13dc55.3a6a64"]]},{"id":"a2d7dd3e.a1f1f","type":"play","z":"fc738cdd.8039e","baseurl":"629d4f71.9056f","name":"hold 1","url":"holdmusicclip1.mp3","x":1754,"y":1131,"wires":[["2ef97c7b.436ec4"]]},{"id":"91ac9caf.66c5d","type":"random-switch","z":"fc738cdd.8039e","name":"random music","outputs":"3","x":1589,"y":1186,"wires":[["a2d7dd3e.a1f1f"],["be6dcca6.dcab8"],["dffa47a1.b109c8"]]},{"id":"be6dcca6.dcab8","type":"play","z":"fc738cdd.8039e","baseurl":"629d4f71.9056f","name":"hold 2","url":"holdmusicclip2.mp3","x":1754.5,"y":1164,"wires":[["2ef97c7b.436ec4"]]},{"id":"dffa47a1.b109c8","type":"play","z":"fc738cdd.8039e","baseurl":"629d4f71.9056f","name":"hold 3","url":"holdmusicclip3.mp3","x":1754.5,"y":1199,"wires":[["2ef97c7b.436ec4"]]},{"id":"261c806d.e823f","type":"play","z":"fc738cdd.8039e","baseurl":"629d4f71.9056f","name":"new ticket","url":"tocreateanewticket.mp3","x":880,"y":1108,"wires":[["a0962bb.b1520d8"]]},{"id":"cc8b1706.5108e8","type":"http in","z":"fc738cdd.8039e","name":"/agent","url":"/agent","method":"post","upload":false,"swaggerDoc":"","x":128.5,"y":1571,"wires":[["8f7cf5a.5baa208"]]},{"id":"74d2b5a0.db1dfc","type":"random-switch","z":"fc738cdd.8039e","name":"","outputs":"3","x":616.5,"y":1571,"wires":[["5006fa56.728964"],["a3750e6c.2024c"],["1edca9d4.d7e1f6"]]},{"id":"5006fa56.728964","type":"play","z":"fc738cdd.8039e","baseurl":"629d4f71.9056f","name":"","url":"allrepsbusy.mp3","x":787,"y":1536,"wires":[["ebb5d85c.876578"]]},{"id":"a3750e6c.2024c","type":"play","z":"fc738cdd.8039e","baseurl":"629d4f71.9056f","name":"","url":"allrepsbusyannoyingcallers.mp3","x":786.5,"y":1571,"wires":[["ebb5d85c.876578"]]},{"id":"1edca9d4.d7e1f6","type":"play","z":"fc738cdd.8039e","baseurl":"629d4f71.9056f","name":"","url":"allagentsbusyorsmokebreak.mp3","x":786.5,"y":1606,"wires":[["ebb5d85c.876578"]]},{"id":"d493c0c6.6c93c","type":"play","z":"fc738cdd.8039e","baseurl":"629d4f71.9056f","name":"ring","url":"ring.mp3","x":448.5,"y":1571,"wires":[["74d2b5a0.db1dfc"]]},{"id":"8f7cf5a.5baa208","type":"play","z":"fc738cdd.8039e","baseurl":"629d4f71.9056f","name":"please hold while...","url":"pleaseholdwhilewetransferyourcall.mp3","x":292.5,"y":1571,"wires":[["d493c0c6.6c93c"]]},{"id":"ec276a6a.135b88","type":"http in","z":"fc738cdd.8039e","name":"/nightmare-hold","url":"/nightmare-hold","method":"post","upload":false,"swaggerDoc":"","x":157.5,"y":1735,"wires":[["5799a43.506545c"]]},{"id":"5799a43.506545c","type":"play","z":"fc738cdd.8039e","baseurl":"629d4f71.9056f","name":"please hold","url":"pleasehold.mp3","x":345.5,"y":1735,"wires":[["c6a7d69c.cded58"]]},{"id":"ebb5d85c.876578","type":"set-route","z":"fc738cdd.8039e","name":"/nightmare-hold","route":"/nightmare-hold","x":963,"y":1571,"wires":[["d3166883.2116b8"]]},{"id":"d3166883.2116b8","type":"http response","z":"fc738cdd.8039e","name":"return to router","statusCode":"","headers":{},"x":1169.5,"y":1571,"wires":[]},{"id":"8816d7c0.509208","type":"play","z":"fc738cdd.8039e","baseurl":"629d4f71.9056f","name":"music message","url":"holdmusicmessage8.mp3","x":689,"y":1735,"wires":[["ae5b1501.325418"]]},{"id":"9bb43455.81ab78","type":"play","z":"fc738cdd.8039e","baseurl":"629d4f71.9056f","name":"click2","url":"click2.mp3","x":1039,"y":1736,"wires":[["bafd743c.bdcad8"]]},{"id":"9c62b2ea.72983","type":"play","z":"fc738cdd.8039e","baseurl":"629d4f71.9056f","name":"music","url":"holdmusic2.mp3","x":1666,"y":1737,"wires":[["c3bdf04c.8ba82"]]},{"id":"d96fcfbe.cb85b","type":"http response","z":"fc738cdd.8039e","name":"return to router","statusCode":"","headers":{},"x":2916.5,"y":1717,"wires":[]},{"id":"36e6bc12.50cfb4","type":"set-route","z":"fc738cdd.8039e","name":"/nightmare-hold","route":"/nightmare-hold","x":2665.5,"y":1704,"wires":[["d96fcfbe.cb85b"]]},{"id":"88c4b6da.a0ca68","type":"random-switch","z":"fc738cdd.8039e","name":"random","outputs":"5","x":2430.5,"y":1737,"wires":[["4aea33e2.b939ac"],["36e6bc12.50cfb4"],["36e6bc12.50cfb4"],["199ed46a.ee212c"],["885197b3.ffe108"]]},{"id":"885197b3.ffe108","type":"set-route","z":"fc738cdd.8039e","name":"/main-menu","route":"/main-menu","x":2656.5,"y":1782,"wires":[["d96fcfbe.cb85b"]]},{"id":"c6a7d69c.cded58","type":"random-switch","z":"fc738cdd.8039e","name":"random","outputs":"3","x":501.5,"y":1735,"wires":[["c0ac63e7.e5597"],["8816d7c0.509208"],["922f6a77.e99208"]]},{"id":"922f6a77.e99208","type":"play","z":"fc738cdd.8039e","baseurl":"629d4f71.9056f","name":"music message","url":"holdmusicmessage9.mp3","x":689.5,"y":1776,"wires":[["ae5b1501.325418"]]},{"id":"c0ac63e7.e5597","type":"play","z":"fc738cdd.8039e","baseurl":"629d4f71.9056f","name":"music message","url":"holdmusicmessage7.mp3","x":690.5,"y":1693,"wires":[["ae5b1501.325418"]]},{"id":"ae5b1501.325418","type":"random-switch","z":"fc738cdd.8039e","name":"random","outputs":"3","x":889.5,"y":1736,"wires":[["3387be8d.913ec2"],["9bb43455.81ab78"],["9196c4b7.5a5ad8"]]},{"id":"3387be8d.913ec2","type":"play","z":"fc738cdd.8039e","baseurl":"629d4f71.9056f","name":"click","url":"click.mp3","x":1038.5,"y":1700,"wires":[["bafd743c.bdcad8"]]},{"id":"9196c4b7.5a5ad8","type":"play","z":"fc738cdd.8039e","baseurl":"629d4f71.9056f","name":"ring","url":"ring.mp3","x":1038.5,"y":1772,"wires":[["14f5f7aa.5de048"]]},{"id":"27807bb1.609994","type":"random-switch","z":"fc738cdd.8039e","name":"random","outputs":"3","x":1499.5,"y":1741,"wires":[["391e03b7.c4c0dc"],["9c62b2ea.72983"],["197bdccc.0e9153"]]},{"id":"391e03b7.c4c0dc","type":"play","z":"fc738cdd.8039e","baseurl":"629d4f71.9056f","name":"music","url":"holdmusic1.mp3","x":1665.5,"y":1698,"wires":[["c3bdf04c.8ba82"]]},{"id":"197bdccc.0e9153","type":"play","z":"fc738cdd.8039e","baseurl":"629d4f71.9056f","name":"music","url":"holdmusic3.mp3","x":1665.5,"y":1775,"wires":[["c3bdf04c.8ba82"]]},{"id":"199ed46a.ee212c","type":"set-route","z":"fc738cdd.8039e","name":"/loading-dock","route":"/loading-dock","x":2665.5,"y":1743,"wires":[["d96fcfbe.cb85b"]]},{"id":"b78ba962.bfc5a8","type":"random-switch","z":"fc738cdd.8039e","name":"random","outputs":"6","x":2077.5,"y":1736,"wires":[["88c4b6da.a0ca68"],["88c4b6da.a0ca68"],["88c4b6da.a0ca68"],["4466e18e.12624"],["e68c52b4.734f5"],["e171917c.e1f76"]]},{"id":"4466e18e.12624","type":"play","z":"fc738cdd.8039e","baseurl":"629d4f71.9056f","name":"busy signal","url":"busysignal.mp3","x":2266,"y":1767,"wires":[["88c4b6da.a0ca68"]]},{"id":"e68c52b4.734f5","type":"play","z":"fc738cdd.8039e","baseurl":"629d4f71.9056f","name":"dial tone","url":"dialtone.mp3","x":2258.5,"y":1811,"wires":[["88c4b6da.a0ca68"]]},{"id":"e171917c.e1f76","type":"play","z":"fc738cdd.8039e","baseurl":"629d4f71.9056f","name":"off hook","url":"offhook.mp3","x":2254.5,"y":1853,"wires":[["88c4b6da.a0ca68"]]},{"id":"d089e2d1.5da38","type":"set-route","z":"fc738cdd.8039e","name":"/main-menu","route":"/main-menu","x":1500.5,"y":1851,"wires":[["c81d8122.1d739"]]},{"id":"4aea33e2.b939ac","type":"set-route","z":"fc738cdd.8039e","name":"/agent","route":"/agent","x":2634.5,"y":1663,"wires":[["d96fcfbe.cb85b"]]},{"id":"bafd743c.bdcad8","type":"pause","z":"fc738cdd.8039e","name":"3s","seconds":"3","x":1351,"y":1741,"wires":[["27807bb1.609994"]]},{"id":"14f5f7aa.5de048","type":"play","z":"fc738cdd.8039e","baseurl":"629d4f71.9056f","name":"click","url":"click.mp3","x":1162.5,"y":1772,"wires":[["bafd743c.bdcad8"]]},{"id":"f870d445.3f49f8","type":"pause","z":"fc738cdd.8039e","name":"4s","seconds":"4","x":1943.5,"y":1736,"wires":[["b78ba962.bfc5a8"]]},{"id":"c3bdf04c.8ba82","type":"play","z":"fc738cdd.8039e","baseurl":"629d4f71.9056f","name":"click2","url":"click2.mp3","x":1821.5,"y":1737,"wires":[["f870d445.3f49f8"]]},{"id":"301f8d32.71d192","type":"function","z":"fc738cdd.8039e","name":"new ticket?","func":"if (!msg.payload.Digits) {\n    return [null, msg];\n} else {\n    return [msg, null];\n}\n","outputs":"2","noerr":0,"x":314.5,"y":1194,"wires":[["b81724b5.e4ffc8"],["f7894efc.330ab"]]},{"id":"89d73cba.26426","type":"function","z":"fc738cdd.8039e","name":"count visits","func":"msg.session = global.get(\"sessions\")[msg.payload.CallSid];\nif (!msg.session.loadingdockvisits) {\n    msg.session.loadingdockvisits = 1;\n} else {\n    msg.session.loadingdockvisits++;\n}\n\n\nreturn msg;","outputs":1,"noerr":0,"x":713.5,"y":1853,"wires":[["f6c9950c.b84808"]]},{"id":"f6c9950c.b84808","type":"switch","z":"fc738cdd.8039e","name":"first time?","property":"session.loadingdockvisits","propertyType":"msg","rules":[{"t":"lt","v":"2","vt":"num"},{"t":"else"}],"checkall":"true","outputs":2,"x":870.5,"y":1853,"wires":[["d5a2f8da.beef58"],["ecfa4a.1300f5b8"]],"outputLabels":["no","yes"]},{"id":"d5a2f8da.beef58","type":"play","z":"fc738cdd.8039e","baseurl":"629d4f71.9056f","name":"loading dock 1","url":"loadingdock1.mp3","x":1062.5,"y":1834,"wires":[["b5f469cb.bf4508"]]},{"id":"ecfa4a.1300f5b8","type":"play","z":"fc738cdd.8039e","baseurl":"629d4f71.9056f","name":"loading dock 2","url":"loadingdock2.mp3","x":1062.5,"y":1876,"wires":[["b5f469cb.bf4508"]]},{"id":"92c2134c.a2a9f","type":"play","z":"fc738cdd.8039e","baseurl":"629d4f71.9056f","name":"ring","url":"ring.mp3","x":1355.5,"y":1852,"wires":[["d089e2d1.5da38"]]},{"id":"b5f469cb.bf4508","type":"play","z":"fc738cdd.8039e","baseurl":"629d4f71.9056f","name":"click","url":"click.mp3","x":1235.5,"y":1852,"wires":[["92c2134c.a2a9f"]]},{"id":"78405ae1.2e25d4","type":"play","z":"fc738cdd.8039e","baseurl":"629d4f71.9056f","name":"welcome","url":"welcome.mp3","x":433.5,"y":61,"wires":[["8eacf45c.a2a8b8"]]},{"id":"629d4f71.9056f","type":"audio-baseurl","z":"","name":"","url":""}]

Audio Files

Download the audio file bundle and host on a web server or in an AWS S3 bucket.

IVR nodes of type "menu" and "play" have a configuration item for the audio file base URL. Set this to the URL where your audio files are hosted.