Skip to content

Commit

Permalink
TROPO-11931 (#42)
Browse files Browse the repository at this point in the history
CSharp Webapi library -Add sensitivity in record api
  • Loading branch information
frankmeten authored Aug 22, 2017
1 parent 5bec82e commit 9aa27e4
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 4 deletions.
3 changes: 2 additions & 1 deletion TropoCSharp/Tropo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -715,7 +715,7 @@ public void Record(int? attempts, bool? bargein, bool? beep, Choices choices, st
/// <param name="interdigitTimeout">How long does Tropo wait between key presses to determine the user is done with their input.</param>
/// <param name="voice">Specifies the default voice to be used when speaking text back to a user.</param>
/// <param name="promptLogSecurity">Controls whether Tropo logs the text to speech string used by the method.</param>
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;
Expand All @@ -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");
}
Expand Down
3 changes: 3 additions & 0 deletions TropoCSharp/TropoClasses.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
{
}
Expand Down
4 changes: 2 additions & 2 deletions TropoClassesTests/TropoClassesTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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""}}]}";
Expand Down Expand Up @@ -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));
}

Expand Down
3 changes: 2 additions & 1 deletion TropoSample/RecordWithTranscription.aspx.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit 9aa27e4

Please sign in to comment.