Commit c849b8b7 authored by dasharatha.vamshi's avatar dasharatha.vamshi

agent-handoff new

parent f86cc0e1
...@@ -159,14 +159,31 @@ namespace IntermediatorBotSample.MessageRouting ...@@ -159,14 +159,31 @@ namespace IntermediatorBotSample.MessageRouting
connection.ConversationReference1, connection.ConversationReference1,
string.Format(Strings.NotifyOwnerConnected, string.Format(Strings.NotifyOwnerConnected,
GetNameOrId(connection.ConversationReference2))); GetNameOrId(connection.ConversationReference2)));
await _messageRouter.SendMessageAsync(
connection.ConversationReference1,
string.Format(Strings.NotifyOwnerConnected,
connection.ConversationReference2.Conversation.Id.ToString()));
var client = new RestSharp.RestClient("http://093a5be57653.ngrok.io/getLogs"); var client = new RestSharp.RestClient("http://093a5be57653.ngrok.io/getLogs");
client.Timeout = -1; client.Timeout = -1;
var request = new RestSharp.RestRequest(RestSharp.Method.POST); var request = new RestSharp.RestRequest(RestSharp.Method.POST);
request.AddHeader("Content-Type", "application/json"); request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\r\n \"conid\" : \"100\"\r\n}", RestSharp.ParameterType.RequestBody); string body2 = string.Format("\"conid\" : \"{0}\"", connection.ConversationReference2.Conversation.Id.ToString());
string body1 = "{\r\n " + body2 + "\r\n}";
Newtonsoft.Json.Linq.JObject json = Newtonsoft.Json.Linq.JObject.Parse(body1);
request.AddParameter("application/json", json, RestSharp.ParameterType.RequestBody);
RestSharp.IRestResponse response = client.Execute(request); RestSharp.IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content); Console.WriteLine(response.Content);
await _messageRouter.SendMessageAsync(connection.ConversationReference1, response.Content.ToString()); Newtonsoft.Json.Linq.JObject jObject = Newtonsoft.Json.Linq.JObject.Parse(response.Content);
var body = jObject["data"].ToString();
Newtonsoft.Json.Linq.JArray Jsondata = Newtonsoft.Json.Linq.JArray.Parse(body);
int length = Jsondata.Count;
for (int i = 0; i < length; i++)
{
await _messageRouter.SendMessageAsync(connection.ConversationReference1, Jsondata[i]["RowKey"].ToString());
}
//await _messageRouter.SendMessageAsync(connection.ConversationReference1, response.Content.ToString());
} }
if (connection.ConversationReference2 != null) if (connection.ConversationReference2 != null)
......
...@@ -90,7 +90,7 @@ namespace IntermediatorBotSample ...@@ -90,7 +90,7 @@ namespace IntermediatorBotSample
var tableClient = storageAccount.CreateCloudTableClient(); var tableClient = storageAccount.CreateCloudTableClient();
var logsTable = tableClient.GetTableReference("logs"); var logsTable = tableClient.GetTableReference("logs");
logsTable.CreateIfNotExistsAsync(); logsTable.CreateIfNotExistsAsync();
logsTable.ExecuteAsync(TableOperation.InsertOrReplace(new logEntity("100", message))); logsTable.ExecuteAsync(TableOperation.InsertOrReplace(new logEntity(conid, message)));
} }
/*public getLogs(string conid, string partitionKey) /*public getLogs(string conid, string partitionKey)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment