<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Jeremy Parent - AI Virtual Voice Experts with Google Dialogflow CX - CCAI - Nu Echo</title>
	<atom:link href="https://www.nuecho.com/author/jparent/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.nuecho.com/author/jparent/</link>
	<description>Nu Echo</description>
	<lastBuildDate>Mon, 20 Sep 2021 15:25:19 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>

<image>
	<url>https://www.nuecho.com/wp-content/uploads/2019/11/cropped-favicon-32x32.png</url>
	<title>Jeremy Parent - AI Virtual Voice Experts with Google Dialogflow CX - CCAI - Nu Echo</title>
	<link>https://www.nuecho.com/author/jparent/</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>Nexmo Audio Streaming Oumph: Call Recording Server for the Masses</title>
		<link>https://www.nuecho.com/nexmo-audio-streaming-oumph-call-recording-server-for-the-masses/#utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=nexmo-audio-streaming-oumph-call-recording-server-for-the-masses</link>
		
		<dc:creator><![CDATA[Jeremy Parent]]></dc:creator>
		<pubDate>Mon, 20 May 2019 21:58:51 +0000</pubDate>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[IVA]]></category>
		<guid isPermaLink="false">https://zux.zsm.mybluehost.me/?p=3467</guid>

					<description><![CDATA[<p>Nexmo Voice Application Creating a Nexmo application is not complicated, as there is not much to configure: you have to provide a phone number and two webhook URLs: one to return a Nexmo Call Control Object (NCCO) containing instructions and one to receive event data. Similarly, using your Nexmo app is simple: A call comes [&#8230;]</p>
<p>The post <a href="https://www.nuecho.com/nexmo-audio-streaming-oumph-call-recording-server-for-the-masses/">Nexmo Audio Streaming Oumph: Call Recording Server for the Masses</a> first appeared on <a href="https://www.nuecho.com">AI Virtual Voice Experts with Google Dialogflow CX - CCAI - Nu Echo</a>.</p>
<p>The post <a href="https://www.nuecho.com/nexmo-audio-streaming-oumph-call-recording-server-for-the-masses/">Nexmo Audio Streaming Oumph: Call Recording Server for the Masses</a> appeared first on <a href="https://www.nuecho.com">AI Virtual Voice Experts with Google Dialogflow CX - CCAI - Nu Echo</a>.</p>
]]></description>
										<content:encoded><![CDATA[<h2><span style="font-weight: 400;">Nexmo Voice Application</span></h2>
<p><span style="font-weight: 400;">Creating a </span><a target="_blank" href="https://developer.nexmo.com/concepts/guides/applications" rel="noopener"><span style="font-weight: 400;">Nexmo application </span></a><span style="font-weight: 400;">is not complicated, as there is not much to configure: you have to provide a phone number and two webhook URLs: one to return a </span><a target="_blank" href="https://developer.nexmo.com/voice/voice-api/ncco-reference" rel="noopener"><span style="font-weight: 400;">Nexmo Call Control Object (NCCO)</span></a><span style="font-weight: 400;"> containing instructions and one to receive event data. Similarly, using your Nexmo app is simple:</span></p>
<ol>
<li style="font-weight: 400;"><span style="font-weight: 400;">A call comes in through your application.</span></li>
<li style="font-weight: 400;"><span style="font-weight: 400;">The application asks for instructions at the provided web address.</span></li>
<li style="font-weight: 400;"><span style="font-weight: 400;">The application executes the instructions.</span></li>
</ol>
<p><span style="font-weight: 400;">This last step is when the call actually starts. Throughout this process, the Nexmo application sends event messages to the webhook containing information on the current state of the call.</span></p>
<p><span style="font-weight: 400;">To implement the new websocket feature only means giving the </span><a target="_blank" href="https://developer.nexmo.com/voice/voice-api/guides/websockets" rel="noopener"><span style="font-weight: 400;">NCCO instruction</span></a><span style="font-weight: 400;"> to connect via websocket with your web server’s address.</span></p>
<p><img decoding="async" class="aligncenter wp-image-3472 size-full" src="https://www.nuecho.com/wp-content/uploads/2019/05/Recording-Server-Infrastructure.jpg" alt="" width="948" height="394" srcset="https://www.nuecho.com/wp-content/uploads/2019/05/Recording-Server-Infrastructure.jpg 948w, https://www.nuecho.com/wp-content/uploads/2019/05/Recording-Server-Infrastructure-300x125.jpg 300w, https://www.nuecho.com/wp-content/uploads/2019/05/Recording-Server-Infrastructure-768x319.jpg 768w" sizes="(max-width: 948px) 100vw, 948px" /></p>
<h2><span style="font-weight: 400;">Providing Instructions with Google Cloud Functions (GCF)</span></h2>
<p><a target="_blank" href="https://cloud.google.com/functions/" rel="noopener"><span style="font-weight: 400;">GCF</span></a><span style="font-weight: 400;"> is a platform on which we can deploy a simple </span><a target="_blank" href="https://expressjs.com/" rel="noopener"><span style="font-weight: 400;">Express</span></a><span style="font-weight: 400;"> application to be used as a function which is called via HTTP. Its resources are small and its runtime mustn’t be long. We can easily answer Nexmo’s request with the call instructions thanks to GCF. On this platform, we can deploy a simple Node.js Express app with the sole purpose of providing an instruction set by returning a JSON object to each request. Two instructions fulfill our needs:</span></p>
<ol>
<li style="font-weight: 400;"><span style="font-weight: 400;">Instruct the caller to leave a message.</span></li>
<li style="font-weight: 400;"><span style="font-weight: 400;">Connect the call to the specified web address via a </span><a target="_blank" href="https://developer.nexmo.com/voice/voice-api/guides/websockets" rel="noopener"><span style="font-weight: 400;">websocket</span></a><span style="font-weight: 400;">.</span></li>
</ol>
<p><span style="font-weight: 400;">To instruct Nexmo on how to proceed, we must answer its request with a JSON object listing all the steps. The object must be in </span><a target="_blank" href="https://developer.nexmo.com/voice/voice-api/ncco-reference" rel="noopener"><span style="font-weight: 400;">NCCO</span></a><span style="font-weight: 400;"> format. In our example, this gives:</span></p>
<p><img decoding="async" class="aligncenter wp-image-3601 size-full" src="https://www.nuecho.com/wp-content/uploads/2019/05/1.png" alt="" width="998" height="399" srcset="https://www.nuecho.com/wp-content/uploads/2019/05/1.png 998w, https://www.nuecho.com/wp-content/uploads/2019/05/1-300x120.png 300w, https://www.nuecho.com/wp-content/uploads/2019/05/1-768x307.png 768w" sizes="(max-width: 998px) 100vw, 998px" /></p>
<p><span style="font-weight: 400;">The field </span><i><span style="font-weight: 400;">content-type </span></i><span style="font-weight: 400;">specifies the audio format to be in linear PCM at 16000 Hz.</span></p>
<h2><span style="font-weight: 400;">Recording Server on Google App Engine (GAE)</span></h2>
<p><span style="font-weight: 400;">Now for the more challenging part. Since Google Cloud Functions have a short execution time limit (around 5 seconds), it can’t be used to hold a connection for the length of a whole conversation. This is where </span><a target="_blank" href="https://cloud.google.com/appengine/" rel="noopener"><span style="font-weight: 400;">GAE</span></a><span style="font-weight: 400;"> comes in! Applications can be deployed on this platform with the possibility of holding a connection for longer periods of time.</span></p>
<p><span style="font-weight: 400;">To create a websocket application in Node.js, one could rely on librairies like </span><a target="_blank" href="https://socket.io/" rel="noopener"><span style="font-weight: 400;">Socket.IO</span></a><span style="font-weight: 400;"> or, as we did, use a combination of packages consisting of </span><a target="_blank" href="https://github.com/websockets/ws" rel="noopener"><span style="font-weight: 400;">ws</span></a><span style="font-weight: 400;">, </span><a target="_blank" href="https://github.com/HenningM/express-ws" rel="noopener"><span style="font-weight: 400;">express-ws</span></a><span style="font-weight: 400;"> and </span><a target="_blank" href="https://github.com/maxogden/websocket-stream#readme" rel="noopener"><span style="font-weight: 400;">websocket-stream</span></a><span style="font-weight: 400;">. With these, for every connection, a </span><a target="_blank" href="https://nodejs.org/api/stream.html#stream_class_stream_duplex" rel="noopener"><span style="font-weight: 400;">duplex stream</span></a><span style="font-weight: 400;"> object is created and can be piped anywhere. Our next step is to create an audio file from it.</span></p>
<p><span style="font-weight: 400;">As specified in the NCCO, the audio data is in PCM format with a sample rate of 16000 Hz. This is valid WAV audio. Using the </span><a target="_blank" href="https://github.com/TooTallNate/node-wav#readme" rel="noopener"><span style="font-weight: 400;">wav</span></a><span style="font-weight: 400;"> package, we can first wrap the PCM stream into a WAV container and then pipe the stream into a file writer, specify the audio format, define the output path and the job is done!</span></p>
<p><img decoding="async" class="aligncenter wp-image-3603 size-full" src="https://www.nuecho.com/wp-content/uploads/2019/05/2.png" alt="" width="803" height="811" srcset="https://www.nuecho.com/wp-content/uploads/2019/05/2.png 803w, https://www.nuecho.com/wp-content/uploads/2019/05/2-150x150.png 150w, https://www.nuecho.com/wp-content/uploads/2019/05/2-297x300.png 297w, https://www.nuecho.com/wp-content/uploads/2019/05/2-768x776.png 768w" sizes="(max-width: 803px) 100vw, 803px" /></p>
<h2><span style="font-weight: 400;">Saving files to Google Cloud Storage</span></h2>
<p><span style="font-weight: 400;">In GAE we can only use temporary folders for writing and reading files. This means that another resource is needed in order to store these audio files permanently. Using the Google Cloud Storage API, we are able to store files in the project’s storage space. And guess what? Uploading files via the API is as simple as following the example already laid for us in Google’s </span><a target="_blank" href="https://cloud.google.com/appengine/docs/flexible/nodejs/using-cloud-storage." rel="noopener"><span style="font-weight: 400;">documentation</span></a><span style="font-weight: 400;">.</span></p>
<p><img decoding="async" class="aligncenter wp-image-3605 size-full" src="https://www.nuecho.com/wp-content/uploads/2019/05/3.png" alt="" width="989" height="712" srcset="https://www.nuecho.com/wp-content/uploads/2019/05/3.png 989w, https://www.nuecho.com/wp-content/uploads/2019/05/3-300x216.png 300w, https://www.nuecho.com/wp-content/uploads/2019/05/3-768x553.png 768w" sizes="(max-width: 989px) 100vw, 989px" /></p>
<p><span style="font-weight: 400;">With this, we have our full recording server. A simple call will end up creating audio recordings in a Google Cloud Storage bucket in WAV format. Having successfully come up with a solution to stream audio from a live call to a web server, we can now think of any number of possible applications such as voicebots, transcribing caller speech in real-time, sentiment analysis or even passive voice biometrics. These can even be used in combination with the recording server. Voice interfaces such as this may be used everywhere in the future. The next step for this technology is to be used as one of the easiest ways of processing audio from a phone call into any kind of applications.</span></p><p>The post <a href="https://www.nuecho.com/nexmo-audio-streaming-oumph-call-recording-server-for-the-masses/">Nexmo Audio Streaming Oumph: Call Recording Server for the Masses</a> first appeared on <a href="https://www.nuecho.com">AI Virtual Voice Experts with Google Dialogflow CX - CCAI - Nu Echo</a>.</p><p>The post <a href="https://www.nuecho.com/nexmo-audio-streaming-oumph-call-recording-server-for-the-masses/">Nexmo Audio Streaming Oumph: Call Recording Server for the Masses</a> appeared first on <a href="https://www.nuecho.com">AI Virtual Voice Experts with Google Dialogflow CX - CCAI - Nu Echo</a>.</p>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
