Skip to content

Commit

Permalink
Improvement/tropo 12563 start recording (#45)
Browse files Browse the repository at this point in the history
Update webAPI SDK to support multiple upload urls in startCallRecording API for C#
  • Loading branch information
frankmeten authored Dec 25, 2017
1 parent b2696ed commit 8d36604
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 6 deletions.
8 changes: 4 additions & 4 deletions TropoCSharp/Tropo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1058,7 +1058,7 @@ public void Say(IEnumerable<String> says)
/// <param name="url">This is the destination URL to send the recording.</param>
/// <param name="username">This identifies the FTP account username.</param>
/// <param name="password">This identifies the FTP account password.</param>
public void StartRecording(string format, string method, string url, string username, string password)
public void StartRecording(string format, string method, object url, string username, string password)
{
StartRecording startRecording = new StartRecording();
startRecording.Format = format;
Expand All @@ -1082,7 +1082,7 @@ public void StartRecording(string format, string method, string url, string user
/// <param name="transcriptionID">The value that's included with your transcription when it's sent to your URL. This allows you to keep track of transcriptions; accepts a string..</param>
/// <param name="transcriptionEmailFormat">The format of the email. Setting it as "encoded" will include a chunk of JSON in the email body or you can set it as "omit" to send as a human-readable message. It defaults to "omit", so unless you want JSON, this can be left out.</param>
/// <param name="transcriptionOutURI">The address this transcription will be POSTed to; use a mailto: url to have the transcription emailed.</param>
public void StartRecording(string format, string method, string url, string username, string password, string transcriptionID, string transcriptionEmailFormat, string transcriptionOutURI)
public void StartRecording(string format, string method, object url, string username, string password, string transcriptionID, string transcriptionEmailFormat, string transcriptionOutURI)
{
StartRecording startRecording = new StartRecording();
startRecording.Format = format;
Expand Down Expand Up @@ -1111,7 +1111,7 @@ public void StartRecording(string format, string method, string url, string user
/// <param name="transcriptionEmailFormat">The format of the email. Setting it as "encoded" will include a chunk of JSON in the email body or you can set it as "omit" to send as a human-readable message. It defaults to "omit", so unless you want JSON, this can be left out.</param>
/// <param name="transcriptionLanguage">transcription languages.</param>
/// <param name="transcriptionOutURI">The address this transcription will be POSTed to; use a mailto: url to have the transcription emailed.</param>
public void StartRecording(bool? asyncUpload, string format, string method, string url, string username, string password, string transcriptionID, string transcriptionEmailFormat, string transcriptionLanguage, string transcriptionOutURI)
public void StartRecording(bool? asyncUpload, string format, string method, object url, string username, string password, string transcriptionID, string transcriptionEmailFormat, string transcriptionLanguage, string transcriptionOutURI)
{
StartRecording startRecording = new StartRecording();
startRecording.AsyncUpload = asyncUpload;
Expand Down Expand Up @@ -1142,7 +1142,7 @@ public void StartRecording(bool? asyncUpload, string format, string method, stri
/// <param name="transcriptionID">The value that's included with your transcription when it's sent to your URL. This allows you to keep track of transcriptions; accepts a string..</param>
/// <param name="transcriptionEmailFormat">The format of the email. Setting it as "encoded" will include a chunk of JSON in the email body or you can set it as "omit" to send as a human-readable message. It defaults to "omit", so unless you want JSON, this can be left out.</param>
/// <param name="transcriptionOutURI">The address this transcription will be POSTed to; use a mailto: url to have the transcription emailed.</param>
public void StartRecording(bool? asyncUpload, string format, string method, string url, string username, string password, string transcriptionID, string transcriptionEmailFormat, string transcriptionOutURI)
public void StartRecording(bool? asyncUpload, string format, string method, object url, string username, string password, string transcriptionID, string transcriptionEmailFormat, string transcriptionOutURI)
{
StartRecording startRecording = new StartRecording();
startRecording.AsyncUpload = asyncUpload;
Expand Down
2 changes: 1 addition & 1 deletion TropoCSharp/TropoClasses.cs
Original file line number Diff line number Diff line change
Expand Up @@ -616,7 +616,7 @@ public class StartRecording : TropoBase
public string Method { get; set; }

[JsonProperty(PropertyName = "url")]
public string Url { get; set; }
public object Url { get; set; }

[JsonProperty(PropertyName = "username")]
public string Username { get; set; }
Expand Down
42 changes: 41 additions & 1 deletion TropoSample/StartRecordingTest.aspx.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using System.Collections.Generic;
using System.Web.UI;
using TropoCSharp.Structs;
using TropoCSharp.Tropo;
Expand All @@ -24,8 +25,47 @@ protected void Page_Load(object sender, EventArgs e)

StartRecording startRecording = new StartRecording();
startRecording.AsyncUpload = true;


RecordUrlTuple RecordUrlTuple1 = new RecordUrlTuple()
{
Url = "http://fakeurl.one.com",
Username = "user1",
Password = "password1",
Method = "POST"
};

RecordUrlTuple RecordUrlTuple2 = new RecordUrlTuple()
{
Url = "http://192.168.26.88:8080/FileUpload/uploadFile",
Username = "user2",
Password = "fakepass",
Method = "POST"

};

RecordUrlTuple RecordUrlTuple3 = new RecordUrlTuple()
{
Url = "http://fakeurl.three.com",
Password = "password3",
Method = "PUT"

};

RecordUrlTuple RecordUrlTuple4 = new RecordUrlTuple()
{
Url = "http://fakeurl.four.com",
Password = "password3",
Method = "put"

};

IEnumerable<RecordUrlTuple> recordingURL = new RecordUrlTuple[] { RecordUrlTuple1, RecordUrlTuple2, RecordUrlTuple3, RecordUrlTuple4 };


//tropo.StartRecording(false, AudioFormat.Wav, Method.Post, "http://192.168.26.88:8080/FileUpload/uploadFile", "", "", "", "plain", "");
tropo.StartRecording(false, AudioFormat.Wav, Method.Post, "http://192.168.26.88:8080/FileUpload/uploadFile", "", "", "", "plain", "en-usa", "");
//tropo.StartRecording(false, AudioFormat.Wav, Method.Post, "/FileUpload/url/uploadFile", "", "", "", "plain", "en-usa", "/FileUpload/transcrition/uploadFile");
tropo.StartRecording(false, AudioFormat.Wav, Method.Post, recordingURL, "", "", "", "plain", "en-usa", "/FileUpload/transcrition/uploadFile");

//Say say2 = new Say("Fourscore and seven years ago our fathers brought forth, on this continent, a new nation, conceived in liberty, and dedicated to the proposition that all men are created equal. Now we are engaged in a great civil war, testing whether that nation, or any nation so conceived, and so dedicated, can long endure. We are met on a great battle-field of that war. We have come to dedicate a portion of that field, as a final resting-place for those who here gave their lives, that that nation might live. It is altogether fitting and proper that we should do this. But, in a larger sense, we cannot dedicate, we cannot consecrate—we cannot hallow—this ground. The brave men, living and dead, who struggled here, have consecrated it far above our poor power to add or detract. The world will little note, nor long remember what we say here, but it can never forget what they did here. It is for us the living, rather, to be dedicated here to the unfinished work which they who fought here have thus far so nobly advanced. 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.");
Say say2 = new Say("I love beijing, hi tropo new version");
Expand Down

0 comments on commit 8d36604

Please sign in to comment.