Loading...
Searching...
No Matches
VoiceMail plugin documentation

This is a plugin implementing a very simple VoiceMail service for Janus, specifically recording Opus streams. This means that it replies by providing in the SDP only support for Opus, and disabling video. When a peer contacts the plugin, the plugin starts recording the audio frames it receives and, after 10 seconds, it shuts the PeerConnection down and returns an URL to the recorded file.

Since an URL is returned, the plugin allows you to configure where the recordings whould be stored (e.g., a folder in your web server, writable by the plugin) and the base path to use when returning URLs (e.g., /my/recordings/ or http://www.example.com/my/recordings).

By default the plugin saves the recordings in the `html` folder of this project, meaning that it can work out of the box with the VoiceMail demo we provide in the same folder.

# VoiceMail API

The VoiceMail API supports just two requests, `record` and `stop` and they're both asynchronous, which means all responses (successes and errors) will be delivered as events with the same transaction.

`record` will instruct the plugin to start recording, while `stop` will make the recording stop before the 10 seconds have passed. Never send a JSEP offer with any of these requests: it's always the VoiceMail plugin that originates a JSEP offer, in response to a `record` request, which means your application will only have to send a JSEP answer when that happens.

The `record` request has to be formatted as follows:

    {
            "request" : "record"
    }

A successful request will result in an `starting` status event:

    {
            "voicemail" : "event",
            "status": "starting"
    }

which will be followed by a `started` as soon as the associated PeerConnection has been made available to the plugin:

    {
            "voicemail" : "event",
            "status": "started"
    }

An error instead would provide both an error code and a more verbose description of the cause of the issue:

    {
            "voicemail" : "event",
            "error_code" : <numeric ID, check Macros below>,
            "error" : "<error description as a string>"
    }

The `stop` request instead has to be formatted as follows:

    {
            "request" : "stop"
    }

If the plugin detects a loss of the associated PeerConnection, whether as a result of a `stop` request or because the 10 seconds passed, a `done` status notification is triggered to inform the application the recording session is over, together with the path to the recording file itself:

    {
            "voicemail" : "event",
            "status" : "done",
            "recording : "<path to the .opus file>"
    }