From 9aa27e4534c9541417ea439709fe9fe2e310e722 Mon Sep 17 00:00:00 2001 From: frank Date: Tue, 22 Aug 2017 11:26:58 +0800 Subject: [PATCH] TROPO-11931 (#42) CSharp Webapi library -Add sensitivity in record api --- TropoCSharp/Tropo.cs | 3 ++- TropoCSharp/TropoClasses.cs | 3 +++ TropoClassesTests/TropoClassesTests.cs | 4 ++-- TropoSample/RecordWithTranscription.aspx.cs | 3 ++- 4 files changed, 9 insertions(+), 4 deletions(-) diff --git a/TropoCSharp/Tropo.cs b/TropoCSharp/Tropo.cs index 2cab728..f3e6bf3 100644 --- a/TropoCSharp/Tropo.cs +++ b/TropoCSharp/Tropo.cs @@ -715,7 +715,7 @@ public void Record(int? attempts, bool? bargein, bool? beep, Choices choices, st /// How long does Tropo wait between key presses to determine the user is done with their input. /// Specifies the default voice to be used when speaking text back to a user. /// Controls whether Tropo logs the text to speech string used by the method. - public void Record(int? attempts, bool? asyncUpload, Array allowSignals, bool? bargein, bool? beep, Choices choices, Say say, string format, float? maxSilence, float? maxTime, string method, string name, bool? required, Transcription transcription, string url, string password, string username, float? timeout, int? interdigitTimeout, string voice, string promptLogSecurity) + public void Record(int? attempts, bool? asyncUpload, Array allowSignals, bool? bargein, bool? beep, Choices choices, Say say, string format, float? maxSilence, float? maxTime, string method, string name, bool? required, Transcription transcription, string url, string password, string username, float? timeout, int? interdigitTimeout, string voice, string promptLogSecurity, float? sensitivity) { Record record = new Record(); record.Attempts = attempts; @@ -739,6 +739,7 @@ public void Record(int? attempts, bool? asyncUpload, Array allowSignals, bool? b record.InterdigitTimeout = interdigitTimeout; record.Voice = voice; record.PromptLogSecurity = promptLogSecurity; + record.Sensitivity = sensitivity; Serialize(record, "record"); } diff --git a/TropoCSharp/TropoClasses.cs b/TropoCSharp/TropoClasses.cs index 2079d25..7fdfee4 100644 --- a/TropoCSharp/TropoClasses.cs +++ b/TropoCSharp/TropoClasses.cs @@ -461,6 +461,9 @@ public class Record : TropoBase [JsonProperty(PropertyName = "promptLogSecurity")] public string PromptLogSecurity { get; set; } + [JsonProperty(PropertyName = "sensitivity")] + public float? Sensitivity { get; set; } + public Record() { } diff --git a/TropoClassesTests/TropoClassesTests.cs b/TropoClassesTests/TropoClassesTests.cs index 4b7ef3f..75d069b 100644 --- a/TropoClassesTests/TropoClassesTests.cs +++ b/TropoClassesTests/TropoClassesTests.cs @@ -25,7 +25,7 @@ public class TropoClassesTests private string askJsonWithSayEvents = @"{""tropo"":[{ ""ask"":{""interdigitTimeout"":1,""name"":""foo"",""choices"":{""value"":""[5 DIGITS]""},""say"":[{""value"":""Are you still there?"",""event"":""timeout""},{""value"":""Please enter your 5 digit zip code.""}]}}]}"; private string recordJson = @"{""tropo"":[{ ""record"":{""choices"":{""value"":""[5 DIGITS]"",""terminator"":""#""},""format"":""audio/wav"",""method"":""POST"",""required"":true,""say"":{""value"":""Please say your account number""}}}]}"; private string recordJsonWithTranscription = @"{""tropo"":[{ ""record"":{""attempts"":1,""bargein"":false,""beep"":true,""choices"":{""value"":""[5 DIGITS]"",""terminator"":""#""},""format"":""audio/wav"",""maxSilence"":5.0,""maxTime"":30.0,""method"":""POST"",""required"":true,""say"":{""value"":""Please say your account number""},""timeout"":5.0,""password"":""foo"",""transcription"":{""id"":""foo"",""url"":""http://example.com/"",""emailFormat"":""encoded""},""username"":""bar"",""url"":""http://example.com/""}}]}"; - private string recordJsonAllOptions = @"{""tropo"":[{ ""record"":{""attempts"":1,""bargein"":false,""beep"":true,""choices"":{""value"":""[5 DIGITS]"",""terminator"":""#""},""format"":""audio/wav"",""interdigitTimeout"":5,""maxSilence"":10.0,""maxTime"":600.0,""method"":""POST"",""name"":""whname"",""required"":true,""say"":{""value"":""Please say your account number""},""timeout"":15.0,""transcription"":{""id"":""foo"",""url"":""http://example.com/"",""emailFormat"":""encoded""},""url"":""http://example.com/"",""asyncUpload"":true,""promptLogSecurity"":""none""}}]}"; + private string recordJsonAllOptions = @"{""tropo"":[{ ""record"":{""attempts"":1,""bargein"":false,""beep"":true,""choices"":{""value"":""[5 DIGITS]"",""terminator"":""#""},""format"":""audio/wav"",""interdigitTimeout"":5,""maxSilence"":10.0,""maxTime"":600.0,""method"":""POST"",""name"":""whname"",""required"":true,""say"":{""value"":""Please say your account number""},""timeout"":15.0,""transcription"":{""id"":""foo"",""url"":""http://example.com/"",""emailFormat"":""encoded""},""url"":""http://example.com/"",""asyncUpload"":true,""promptLogSecurity"":""none"",""sensitivity"":0.99}}]}"; private string callJson = @"{""tropo"":[{ ""call"":{""to"":[""3055195825"",""3054445567""]}}]}"; private string callJsonAllOptions = @"{""tropo"":[{ ""call"":{""to"":[""3055195825""],""from"":""3055551212"",""network"":""SMS"",""channel"":""TEXT"",""answerOnMedia"":false,""headers"":{""foo"":""bar"",""bling"":""baz""},""timeout"":10.0}}]}"; private string callJsonCallObject = @"{""tropo"":[{ ""call"":{""to"":[""3055195825""],""from"":""3055551212"",""network"":""SMS"",""channel"":""TEXT"",""answerOnMedia"":false,""headers"":{""foo"":""bar"",""bling"":""baz""},""timeout"":10.0,""machineDetection"":{""introduction"":""It is rather for us to be here dedicated to the great task remaining before us—that from these honored dead we take increased devotion to that cause for which they here gave the last full measure of devotion—that we here highly resolve that these dead shall not have died in vain—that this nation, under God, shall have a new birth of freedom, and that government of the people, by the people, for the people, shall not perish from the earth.""},""voice"":""voicefoo"",""callbackUrl"":""samplecallbackurl"",""label"":""appidIdAsLabel""}}]}"; @@ -382,7 +382,7 @@ public void testRecordAllOptions() Tropo tropo = new Tropo(); //tropo.Record(1, false, true, choices, AudioFormat.Wav, 5, 30, Method.Post, "foo", true, say, 5, transcription, "bar", "http://example.com/"); - tropo.Record(1, true, null, false, true, choices, say, AudioFormat.Wav, 10, 600, Method.Post, "whname", true, transcription, "http://example.com/", null, null, 15, 5, null, "none"); + tropo.Record(1, true, null, false, true, choices, say, AudioFormat.Wav, 10, 600, Method.Post, "whname", true, transcription, "http://example.com/", null, null, 15, 5, null, "none", 0.99f); Assert.AreEqual(this.recordJsonAllOptions, renderJSONToText(tropo)); } diff --git a/TropoSample/RecordWithTranscription.aspx.cs b/TropoSample/RecordWithTranscription.aspx.cs index ea43759..d7d47f8 100644 --- a/TropoSample/RecordWithTranscription.aspx.cs +++ b/TropoSample/RecordWithTranscription.aspx.cs @@ -35,7 +35,8 @@ protected void Page_Load(object sender, EventArgs e) tropo.Call("+8613466549249"); // Use the record() method to set up a recording. //tropo.Record(3, false, true, choices, AudioFormat.Wav, 10, 600, Method.Post, null, true, say, 15, trancription, null, "http://54.88.99.156:9080/FileUpload/uploadFile"); - tropo.Record(3, null, null, null, null, choices, say, AudioFormat.Wav, 10, 600, Method.Post, "whname", true, trancription, "http://54.88.99.156:9080/FileUpload/uploadFile", null, null, 15, 5, null, "none"); + tropo.Record(3, null, null, null, null, choices, say, AudioFormat.Wav, 10, 600, Method.Post, "whnnull20170721ame", true, trancription, "http://54.88.99.156:9080/FileUpload/uploadFile", null, null, 15, 5, null, "none",null); + tropo.Record(5, true, null, false, false, choices, say, AudioFormat.Wav, 5, 5, Method.Post, "gfdwefrg", true, trancription, "url", "passwor", "username", 15, 5, "vvvoi", "fd", 0.5f); tropo.On("continue", "TropoResult.aspx", new Say("This is a on say in record" )); // Hangup when finished. //tropo.Hangup();