By using the Aculab site, you agree with our use of cookies.
right  Talk To Us!

Code Bites


  • Answer a call and use Text-to-speech (TTS) to say a message to the caller:

    CallState state = channel.Answer();
    if (state == CallState.Answered)
    {
    	channel.FilePlayer.Say("Hello. Thank you for calling.");
    }

    Play a media file, allowing the caller to press a key to interrupt:

    FilePlayerCause playCause = channel.FilePlayer.Play("welcome.wav", true);
    if (FilePlayerCause.BargeIn == playCause)
    {
    	this.Trace.TraceInfo("Playback was interrupted by a keypress");
    }

    Record a message from the caller, allowing the caller to press a key to end the recording:

    string recordFileName = "recordedMessages/MessageFrom" + channel.CallDetails.CallFrom + ".wav";
    channel.FileRecorder.Start(recordFileName, true);
    
    // Play a tone to signal that recording has started
    channel.DtmfPlayer.Play("0");
    
    channel.FileRecorder.WaitUntilFinished(60);