Skip to content

Instantly share code, notes, and snippets.

@psanders
Last active May 8, 2023 14:25
Show Gist options
  • Save psanders/11e862c13d6c4951db9ae41993b12d31 to your computer and use it in GitHub Desktop.
Save psanders/11e862c13d6c4951db9ae41993b12d31 to your computer and use it in GitHub Desktop.
API Draft for record and dial

Recording feature

This option works well for channel recording only.

See next section for recording of entire conversation

Use cases:

  • Get user input
  • Better control for privacy purposes

Proposed API change example:

const { VoiceServer } = require("@fonos/voice");
const voiceServer = new VoiceServer();

voiceServer.listen(async(req, res) => {
  await res.answer();
  const recordControl = await res.record({...});
  recordControl.pause() // Or stop, unpause, mute...
  ...
});

Dial / Transfer

I'm proposing changing the name of the verb, from transfer to dial.

Transfer gives the impression that you are passing the call from one Agent to another which is no true

Proposed API change example:

const { VoiceServer } = require("@fonos/voice");
const voiceServer = new VoiceServer();

voiceServer.listen(async(req, res) => {
  await res.answer();
  await res.say("transfering")
  const statusStream = await res.dial("17853178070")
  statusStream.on("progress", console.log)
  statusStream.on("answer", console.log)
  ...
});
@psanders
Copy link
Author

psanders commented Oct 7, 2021

Note for future me

Check this link for an alternative way of recording audio similar to mixmonitor:
https://community.asterisk.org/t/record-separated-channel-in-ari/73966

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment