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.

  1. Install and launch a screen session: sudo yum install screen ; screen
    Note: The command above is for CentOS and Fedora. Replace yum with the package manager specific to your Linux distribution.
  2. Run the following command within the screen session:
    while true ; do echo -e "HTTP/1.1 200 OK\r\n" | nc -l 5555; done

    V‑Cloud retries requests to a callback until the callback returns success (HTTP code 200). The sample netcat callback server is listening on port 5555 and echoes that success code to netcat in a loop to ensure that it always returns a success code whenever V‑Cloud sends a request.

  3. Use Ctrl-A + C to create a new screen window and proceed to the next section to submit an audio sample for transcription. To view the results received by the sample callback server, use Ctrl-A + Ctrl-A to switch back to the screen window running netcat .

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.