right  Talk To Us!

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_on_digit" : 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):

    List<TelephonyAction> actions = new ArrayList<TelephonyAction>();
    Play playAction = Play.sayText("Hello, good evening and welcome.");
    actions.add(playAction);

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

    List<TelephonyAction> actions = new ArrayList<TelephonyAction>();
    Play playAction = Play.playFile("welcome.wav");
    playAction.setBargeInOnDigit(false);
    actions.add(playAction);

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

    List<TelephonyAction> actions = new ArrayList<TelephonyAction>();
    Record recordAction = new Record(new WebPageRequest("my_record_handler_page"));
    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.append(play_action)

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

    play_action = Play(file_to_play='welcome.wav')
    play_action.set_barge_in_on_digit(False)
    my_actions.append(play_action)

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

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

    $response->addAction(\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->setBargeInOnDigit(false);
    $response->addAction($play);

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

    $recAction = new \Aculab\TelephonyRestAPI\Record('my_record_handler_page');
    $recAction->setBargeInDigits('#*');
    $response->addAction($recAction);