Setting up a sample callback server
The following steps detail how to simulate a callback server by using the netcat
utility to listen on a specific port and display the information it receives. The netcat
utility is included in most Linux distributions and is available for Windows and Mac OS.
Submitting a sample file for text transcription
To download the sample audio file that is used in this chapter, right-click here and select Save link as from the pop-up menu that displays.
The following transcription request specifies the address of a callback server, the output format, and the audio file to transcribe:
curl -F callback=https://hostname:port/endpoint \
-F token=your-token-here \ -F output=text \
-F "file=@sample7.wav;type=audio/x-wav" \
https://vcloud.vocitec.com/transcribe
Thank you for calling Center point energy technical support. I understand you need to report a gas leak and I have your name please my name is Joe and I thank you Mr. Know what is your address or account number my address and then one Martin Houston, Texas is there. Anyone inside the house? I know everyone is out of the house. I notice the strange smell when I got home and I called you I am sending and gas technician to your home to fix the problem. Could you give me a good number to reach you at you can call 28195345 zero's. Thank you, please be safe and wait for the technician to arrive call us back if anything changes. Thank you, bye. Good bye and thank you for calling Center point energy.
POST / HTTP/1.1 Host: 73.174.3.131:5555 Accept-Encoding: identity Content-Length: 701 Content-Type: text/plain Thank you for calling Center point energy technical support. I understand you need to report a gas leak and I have your name please my name is Joe and I thank you Mr. Know what is your address or account number my address and then one Martin Houston, Texas is there. Anyone inside the house? I know everyone is out of the house. I notice the strange smell when I got home and I called you I am sending and gas technician to your home to fix the problem. Could you give me a good number to reach you at you can call 28195345 zero's. Thank you, please be safe and wait for the technician to arrive call us back if anything changes. Thank you, bye. Good bye and thank you for calling Center point energy.
Receiving transcription results
A successful call to the V‑Cloud API returns the transcript in the default (JSON) format or whichever format specified with the
output
parameter in the request to the
/transcribe
endpoint.
A callback server is generally used to collect output and forward it to some other application, process the transcript itself, or to preserve the output for subsequent use. Using the sample callback server that was introduced earlier, transcripts are written to the standard output for the shell in which you executed the
netcat
command. The following example shows the output that the
netcat
callback server displays when a transcription request completes:
The goal of a callback server is to enable another application to receive and directly interact with the transcripts produced by V‑Cloud. However, the sample
netcat
callback server used in this section is convenient for testing different transcription parameters. For example, the following results are returned to the callback server after submitting a
/transcribe
request using the same audio sample with the
diarize=true
parameter:
POST / HTTP/1.1
Content-Type: multipart/form-data;boundary=PX0PI61Stzs4xNw-G7SyqnxXPcstL3PEmbF
User-Agent: Java/1.7.0_161
Host: 73.174.3.131:5555
Accept: text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2
Connection: keep-alive
Content-Length: 1096
--PX0PI61Stzs4xNw-G7SyqnxXPcstL3PEmbF
Content-Disposition: form-data; name="requestid"
Content-Type: text/plain;charset=UTF-8
Content-Length: 36
9ca9674c-65b7-46a7-aa06-1ceaeae9d8af
--PX0PI61Stzs4xNw-G7SyqnxXPcstL3PEmbF
Content-Disposition: form-data; name="file"; filename="sample7.txt"
Content-Type: text/plain
Content-Length: 707
Thank you for calling Center point energy to technical support.
I understand you need to report a gas leak and I have your name please.
My name is John.
Thank you, Mr. Darrow.
What is your address or account number?
My address is and and Walmart in Houston Texas.
Is there anyone inside the house?
Know everyone is out of the house so I noticed the strange now when I
got home and I called you.
Hi, I'm sending a gas technician to your home to fix the problem.
Could you give me a good number to reach you at.
You can call 281-953-4507.
Thank you, please be safe and wait for the technician to arrive call us back if anything changes.
Thank you bye.
Good, bye and thank you for calling Center point energy.
--PX0PI61Stzs4xNw-G7SyqnxXPcstL3PEmbF--
Enabling
diarize
improved the identification of the different speakers on the call, even though the audio file is still in mono.