Skip to content

Add Voice Feature

Latest
Compare
Choose a tag to compare
@lkloon123 lkloon123 released this 14 Nov 02:05
· 33 commits to master since this release
f28ca61

Example Usage:

use Mocean\Voice\Mc;
use Mocean\Voice\McBuilder;

$mcBuilder = mcBuilder::create()
    ->add(Mc::record())
    ->add(Mc::say('for english please press 1')) // tts
    ->add(Mc::collect('http://test.com/collect'))
    ->add(Mc::sleep(2000))
    ->add(Mc::dial('60123456789'))
    ->add(Mc::play('http://test.com/play'));

$mocean->voice()->call([
    'mocean-to' => '60123456789',
    'mocean-command' => $mcBuilder
]);

Hangup Example:

$mocean->voice()->hangup('xxx-xxx-xxx-xxx'); //call-uuid

Recording Exaple:

$recording = $mocean->voice()->recording('xxx-xxx-xxx-xxx'); //call-uuid

//save the file
file_put_contents($recording->getFilename(), $recording->getRecordingBuffer());