REST API Code Bites


  • Use Text-to-speech (TTS) to say a message to the caller (answers the call implicitly):

    "play" :
    {
    	"play_list" :
    	[
    		{   "text_to_say" : "Hello, good evening and welcome."  }
    	]
    }				

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

    "play" :
    {
    	"play_list" :
    	[
    		{   "file_to_play" : "welcome.wav"  }
    	],
    	"barge_in" : false
    }				

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

    "record" :
    {
    	"barge_in_digits" : "#*",
    	"next_page" : 
    	{
    		"url" : "my_record_handler_page"
    	}
    }				
  • Use Text-to-speech (TTS) to say a message to the caller (answers the call implicitly):

    actions.Add(Play.SayText("Hello, good evening and welcome."));

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

    Play playAction = Play.PlayFile("welcome.wav");
    playAction.BargeIn = false;
    actions.Add(playAction);

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

    Record recordAction = new Record(new WebPageRequest("MyRecordHandlerPage.aspx"));
    recordAction.BargeInDigits = "#*";
    actions.Add(recordAction);
  • Use Text-to-speech (TTS) to say a message to the caller (answers the call implicitly):

    actions.Add(Play.SayText("Hello, good evening and welcome."))

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

    Dim playAction As Play = Play.PlayFile("welcome.wav")
    playAction.BargeIn = False
    actions.Add(playAction)

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

    Dim recordAction As Record = New Record(New WebPageRequest("MyRecordHandlerPage.aspx"))
    recordAction.BargeInDigits = "#*"
    actions.Add(recordAction)
  • Use Text-to-speech (TTS) to say a message to the caller (answers the call implicitly):

    actions.add(Play.sayText("Hello, good evening and welcome."));

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

    Play playAction = Play.playFile("welcome.wav");
    playAction.setBargeIn(false);
    actions.add(playAction);

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

    Record recordAction = new Record(new WebPageRequest("myRecordHandlerPage"));
    recordAction.setBargeInDigits("#*");
    actions.add(recordAction);
  • Use Text-to-speech (TTS) to say a message to the caller (answers the call implicitly):

    play_action = Play(text_to_say='Hello, good evening and welcome.')
    my_actions.add(play_action)

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

    play_action = Play(file_to_play='welcome.wav', barge_in=False)
    my_actions.add(play_action)

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

    my_actions.add(Record(barge_in_digits="#*", next_page=WebPage(url='my_record_handler_page')))
  • Use Text-to-speech (TTS) to say a message to the caller (answers the call implicitly):

    $actions->add(Aculab\TelephonyRestAPI\Play::sayText('Hello, good evening and welcome.'));

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

    $play = new Aculab\TelephonyRestAPI\Play();
    $play->addFile('welcome.wav');
    $play->setBargeIn(false);
    $actions->add($play);

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

    $recopt = array(
    	'barge_in_digits' => '*#'
    );
    $recAction = new Aculab\TelephonyRestAPI\Record($recopt);
    $recAction->setNextPage('my_record_handler_page');
    $actions->add($recAction);