public ActionResult Post(CallStatusCallback callStatusCallback) { PerCLScript script = new PerCLScript(); // Verify call is in the InProgress state if (callStatusCallback.getDialCallStatus == ECallStatus.InProgress) { // Create PerCL say script with US English as the language Say say = new Say(); say.setLanguage(ELanguage.EnglishUS); // Set prompt to record message say.setText("Hello. Please leave a message after the beep, then press one or hangup"); // Add PerCL say script to PerCL container script.Add(say); // Create PerCL record utterance script string messageDoneUrl = AppUrl + "/voice/MakeRecordMessageDone"; RecordUtterance recordUtterance = new RecordUtterance(messageDoneUrl); // Set indication that audible 'beep' should be used to signal start of recording recordUtterance.setPlayBeep(EBool.True); // Set indication that end of recording is touch tone key 0ne recordUtterance.setFinishOnKey(EFinishOnKey.One); // Add PerCL record utterance script to PerCL container script.Add(recordUtterance); } // Convert PerCL container to JSON and append to response return(Content(script.toJson(), "application/json")); }
[HttpPost] // POST /voice public ActionResult SelectColorCallAnswered(CallStatusCallback callStatusCallback) { // Create an empty PerCL script container PerCLScript script = new PerCLScript(); // Verify call is in the InProgress state if (callStatusCallback.getDialCallStatus == ECallStatus.InProgress) { // Create PerCL get speech script (see grammar file content below) string actionUrl = AppUrl + "/voice/SelectColorDone"; string grammarFile = AppUrl + "/grammars/FreeClimbColor.xml"; GetSpeech getSpeech = new GetSpeech(actionUrl, grammarFile); // Set location and type of grammar as well as the grammar rule getSpeech.setGrammarType(EGrammarType.Url); getSpeech.setGrammarRule("FreeClimbColor"); // Create PerCL say script with US English as the language Say say = new Say(); say.setLanguage(ELanguage.EnglishUS); // Set prompt for color selection say.setText("Please select a color. Select green, red or yellow."); // Add PerCL say script to PerCL get speech prompt list getSpeech.setPrompts(say); // Add PerCL get speech script to PerCL container script.Add(getSpeech); } // Convert PerCL container to JSON and append to response return(Content(script.toJson(), "application/json")); }
public ActionResult PlayRecordingCallStatus(CallStatusCallback callStatusCallback) { // Create an empty PerCL script container PerCLScript script = new PerCLScript(); return(Content(script.toJson(), "application/json")); }
public ActionResult InboundCall(CallStatusCallback callStatus) { PerCLScript script = new PerCLScript(); var conferenceActionUrl = AppUrl + "/voice/ConferenceCreated"; CreateConference cc = new CreateConference(conferenceActionUrl); script.Add(cc); return(Content(script.toJson(), "application/json")); }
[HttpPost("InboundCall")] //POST /voice/InboundCall public ActionResult InboundCall(CallStatusCallback callStatus) { PerCLScript script = new PerCLScript(); var getDigitsActionUrl = getAppUrl() + "/voice/GetDigitsDone"; GetDigits getDigits = new GetDigits(getDigitsActionUrl); getDigits.setMaxDigits(1); Say say = new Say(); say.setText("Hello. Welcome to the conferences tutorial, please enter your access code."); getDigits.setPrompts(say); script.Add(getDigits); return(Content(script.toJson(), "application/json")); }
[HttpPost("InboundCall")] // POST voice/InboundCall public ActionResult InboundCall(CallStatusCallback freeClimbRequest) { // Create an empty PerCL script container PerCLScript script = new PerCLScript(); // Verify inbund call is in proper state if (freeClimbRequest.getCallStatus == ECallStatus.Ringing) { // Create PerCL say script with US English as the language Say say = new Say(); say.setLanguage(ELanguage.EnglishUS); // Set greeting prompt say.setText("Hello"); // Add PerCL say script to PerCL container script.Add(say); // Create PerCL pause script with a 100 millisecond pause Pause pause = new Pause(100); // Add PerCL pause script to PerCL container script.Add(pause); // Create PerCL getdigits script string getDigitsUrl = AppUrl + "/voice/ColorSelectionDone"; GetDigits getDigits = new GetDigits(getDigitsUrl); // Set the max and min number of expected digits to 1 getDigits.setMaxDigits(1); getDigits.setMinDigits(1); // Set the DTMF buffer flush to false getDigits.setFlushBuffer(EBool.False); // Create PerCL say script with US English as the language say = new Say(); say.setLanguage(ELanguage.EnglishUS); // Set color selection menu prompt say.setText("Please select a color. Enter one for green, two for red or three for yellow."); // Add main selection menu prompt to the getdigits script getDigits.setPrompts(say); // Add PerCL getdigits script to PerCL container script.Add(getDigits); } // Convert PerCL container to JSON and append to response return(Content(script.toJson(), "application/json")); }
public string Post(CallStatusCallback request) { // Create a PerCl script PerCLScript helloScript = new PerCLScript(); // Create a Say Command Say sayHello = new Say(); sayHello.setText("Hello, FreeClimb!"); // Add the command helloScript.Add(sayHello); // Respond to FreeClimb with your script return(helloScript.toJson()); }
public void CreateAndVerifyCallStatusCallbackTest() { CallStatusCallback cs = CallStatusCallback.fromJson("{\"accountId\":\"AC736ca2078721a9a41fb47f07bf40d9e21cb304da\",\"callId\":\"CA7d00ca83adccbdf9d3f502176dbdd09fa5b886aa\",\"callStatus\":\"inProgress\",\"conferenceId\":null,\"dialCallStatus\":\"inProgress\",\"direction\":\"outboundAPI\",\"from\":\"+12248806205\",\"parentCallId\":null,\"queueId\":null,\"requestId\":\"RQ50e91227b8187317d84f5bab9a9460c4a2c4aeb2\",\"requestType\":\"outDialApiConnect\",\"to\":\"+18475978014\"}"); Assert.AreEqual(cs.getAccountId, "AC736ca2078721a9a41fb47f07bf40d9e21cb304da"); Assert.AreEqual(cs.getCallId, "CA7d00ca83adccbdf9d3f502176dbdd09fa5b886aa"); Assert.AreEqual(cs.getCallStatus, ECallStatus.InProgress); Assert.AreEqual(cs.getDialCallStatus, ECallStatus.InProgress); Assert.IsNull(cs.getConferenceId); Assert.AreEqual(cs.getDirection, EDirection.OutboundAPI); Assert.AreEqual(cs.getFrom, "+12248806205"); Assert.IsNull(cs.getParentCallId); Assert.IsNull(cs.getQueueId); Assert.AreEqual(cs.getRequestId, "RQ50e91227b8187317d84f5bab9a9460c4a2c4aeb2"); Assert.AreEqual(cs.getRequestType, ERequestType.OutDialApiConnect); Assert.AreEqual(cs.getTo, "+18475978014"); }
public ActionResult PlayRecordingCallAnswered(CallStatusCallback callStatusCallback) { // Create an empty PerCL script container PerCLScript script = new PerCLScript(); // Verify call is in the InProgress state if (callStatusCallback.getDialCallStatus == ECallStatus.InProgress) { // Create PerCL play script with US English as the language Play play = new Play(GetRecordingUrl()); // Add PerCL play script to PerCL container script.Add(play); } // Convert PerCL container to JSON and append to response return(Content(script.toJson(), "application/json")); }
public ActionResult InboundCall(CallStatusCallback freeClimbRequest) { // Create an empty PerCL script container PerCLScript script = new PerCLScript(); // Verify inbound call is in proper state if (freeClimbRequest.getCallStatus == ECallStatus.Ringing) { // Create PerCL say script with US English as the language Say say = new Say(); say.setLanguage(ELanguage.EnglishUS); // Set greeting prompt say.setText("Hello. Your call will be queued."); // Add PerCL say script to PerCL container script.Add(say); // Create PerCL pause script with a 100 millisecond pause script.Add(new Pause(100)); // Create queue options with an alias QueueOptions options = new QueueOptions(); options.setAlias("InboundCallQueue"); // Create FreeClimbClient object FreeClimbClient client = new FreeClimbClient(getFreeClimbAccountId(), getFreeClimbApiKeys()); // Create a queue with an alias Queue queue = client.getQueuesRequester.create(options); // Create PerCL say to enqueue the call into the newly created queue with an actionUrl Enqueue enqueue = new Enqueue(queue.getQueueId, getAppUrl() + "/voice/InboundCallAction"); // Add waitUrl enqueue.setWaitUrl(getAppUrl() + "/voice/InboundCallWait"); // Add PerCL enqueue script to PerCL container script.Add(enqueue); } // Convert PerCL container to JSON and append to response return(Content(script.toJson(), "application/json")); }
public ActionResult InboundCall(CallStatusCallback freeClimbRequest) { // Create an empty PerCL script container PerCLScript script = new PerCLScript(); // Verify inbound call is in proper state if (freeClimbRequest.getCallStatus == ECallStatus.Ringing) { // Create PerCL say script with US English as the language Say say = new Say(); say.setLanguage(ELanguage.EnglishUS); // Set prompt to record message say.setText("Hello. Thank you for invoking the accept incoming call tutorial."); // Add PerCL say script to PerCL container script.Add(say); // Create PerCL pause script with a duration of 100 milliseconds Pause pause = new Pause(100); // Add PerCL pause script to PerCL container script.Add(pause); // Create PerCL say script with US English as the language Say sayGoodbye = new Say(); sayGoodbye.setLanguage(ELanguage.EnglishUS); // Set prompt sayGoodbye.setText("Goodbye."); // Add PerCL say script to PerCL container script.Add(sayGoodbye); // Create PerCL hangup script Hangup hangup = new Hangup(); // Add PerCL hangup script to PerCL container script.Add(new Hangup()); } // Convert PerCL container to JSON and append to response return(Content(script.toJson(), "application/json")); }
internal static extern int GetAllCallStatus(IntPtr handle, CallStatusCallback cb, IntPtr userData);
public ActionResult OutboundCallConnected([FromQuery(Name = "conferenceId")] string conferenceId, CallStatusCallback request) { PerCLScript script = new PerCLScript(); if (request.getDialCallStatus != com.freeclimb.ECallStatus.InProgress) { terminateConference(conferenceId); return(Content(script.toJson(), "application/json")); } // note context of this callback is the new call (agent). Add them to conference script.Add(new AddToConference(conferenceId, request.getCallId)); return(Content(script.toJson(), "application/json")); }