Commit b0d005b7 authored by Karen McElroy's avatar Karen McElroy

Convert files to linux carriage returns.

parent e3fbfc6c
using System;
using System.Collections.Generic;
using System.Text;
using System;
using System.Collections.Generic;
using System.Text;
namespace PIKAHMPX2.SwitchBoardClient
{
class AccountService
{
private Gpnetd.Account.AccountClient accountClient;
public AccountService(Gpnetd.Account.AccountClient accountClient)
{
this.accountClient = accountClient;
}
public Dictionary<string, string> ListApps(string account_id)
{
var application_dict = new Dictionary<string, string>();
Gpnetd.AccountListApplicationsReq request = new Gpnetd.AccountListApplicationsReq { AccountId = account_id };
Gpnetd.AccountListApplicationsResp response = accountClient.ListApplications(request);
foreach (Gpnetd.ApplicationDetail app_detail in response.Applications)
{
application_dict.Add(app_detail.Name, app_detail.ApplicationId);
}
return application_dict;
}
public string GetApplicationToken(string account_id, string application_id)
{
Gpnetd.AccountGenerateApplicationTokenReq request = new Gpnetd.AccountGenerateApplicationTokenReq
{ AccountId = account_id, ApplicationId = application_id, HoursValid = 24 };
Gpnetd.AccountGenerateApplicationTokenResp response = accountClient.GenerateApplicationToken(request);
return response.Token;
}
}
}
{
class AccountService
{
private Gpnetd.Account.AccountClient accountClient;
public AccountService(Gpnetd.Account.AccountClient accountClient)
{
this.accountClient = accountClient;
}
public Dictionary<string, string> ListApps(string account_id)
{
var application_dict = new Dictionary<string, string>();
Gpnetd.AccountListApplicationsReq request = new Gpnetd.AccountListApplicationsReq { AccountId = account_id };
Gpnetd.AccountListApplicationsResp response = accountClient.ListApplications(request);
foreach (Gpnetd.ApplicationDetail app_detail in response.Applications)
{
application_dict.Add(app_detail.Name, app_detail.ApplicationId);
}
return application_dict;
}
public string GetApplicationToken(string account_id, string application_id)
{
Gpnetd.AccountGenerateApplicationTokenReq request = new Gpnetd.AccountGenerateApplicationTokenReq
{ AccountId = account_id, ApplicationId = application_id, HoursValid = 24 };
Gpnetd.AccountGenerateApplicationTokenResp response = accountClient.GenerateApplicationToken(request);
return response.Token;
}
}
}
......@@ -44,7 +44,6 @@ namespace PIKAHMPX2.SwitchBoardClient
public Dictionary<int, Program.Route> BuildRoutesDict(Program.Route[] routeList)
{
Console.WriteLine("Building Dict");
var routes = new Dictionary<int, Program.Route>();
int i = 1;
foreach(Program.Route route in routeList)
......
......@@ -35,10 +35,10 @@ namespace PIKAHMPX2.SwitchBoardClient
return true;
}
public void AcceptCall(uint callHandle)
{
Gpnetd.CallAcceptReq request = new Gpnetd.CallAcceptReq { CallHandle = callHandle };
callService.Accept(request);
public void AcceptCall(uint callHandle)
{
Gpnetd.CallAcceptReq request = new Gpnetd.CallAcceptReq { CallHandle = callHandle };
callService.Accept(request);
}
public void DropCall(uint callHandle, Gpnetd.CallCauseEnum cause)
......@@ -48,12 +48,12 @@ namespace PIKAHMPX2.SwitchBoardClient
callService.Drop(request, options);
}
public void CallTransferBlind(uint callHandle, string transferDest)
{
Gpnetd.CallInfo callInfo = GetInfo(callHandle);
Gpnetd.CallInfo newCallInfo = new Gpnetd.CallInfo { Src = callInfo.Dest, Dest = transferDest };
Gpnetd.CallTransferBlindReq request = new Gpnetd.CallTransferBlindReq { CallHandle = callHandle, Info = newCallInfo };
callService.TransferBlind(request);
public void CallTransferBlind(uint callHandle, string transferDest)
{
Gpnetd.CallInfo callInfo = GetInfo(callHandle);
Gpnetd.CallInfo newCallInfo = new Gpnetd.CallInfo { Src = callInfo.Dest, Dest = transferDest };
Gpnetd.CallTransferBlindReq request = new Gpnetd.CallTransferBlindReq { CallHandle = callHandle, Info = newCallInfo };
callService.TransferBlind(request);
}
}
}
\ No newline at end of file
......@@ -30,11 +30,9 @@ namespace PIKAHMPX2.SwitchBoardClient
{
var stringB = new StringBuilder();
Gpnetd.ChannelGetDigitsReq req = new Gpnetd.ChannelGetDigitsReq { ChannelHandle = handle, NumberOfDigits = digits, Creds = credentials };
Gpnetd.ChannelGetDigitsResp resp = channelClient.GetDigits(req);
byte[] bytes = resp.Buffer.ToByteArray();
Console.WriteLine("WriteBytes");
String str = System.Text.Encoding.ASCII.GetString(bytes);
Console.WriteLine(str);
Gpnetd.ChannelGetDigitsResp resp = channelClient.GetDigits(req);
byte[] bytes = resp.Buffer.ToByteArray();
String str = System.Text.Encoding.ASCII.GetString(bytes);
return str;
}
......
......@@ -159,12 +159,12 @@ namespace PIKAHMPX2.SwitchBoardClient
{
sb.DonePlay(channelHandle);
continue;
}
}
case (Gpnetd.EventTypeChannel.ChannelEventOneofCase.TermMaxDigits):
{
sb.MaxDigits(channelHandle);
continue;
{
sb.MaxDigits(channelHandle);
continue;
}
case (Gpnetd.EventTypeChannel.ChannelEventOneofCase.UnderflowPlay):
......
......@@ -47,13 +47,13 @@ namespace PIKAHMPX2.SwitchBoardClient
//set up SSL connection
var sslCredential = new SslCredentials(File.ReadAllText(config.certificate));
string serverAddress = config.ip;
if (config.connectUsingServername)
{
string ip = config.ip;
string port = ip.Split(':')[1];
serverAddress = config.serverName + ':' + port;
}
Grpc.Core.Channel gRpcChannel = new Channel(serverAddress, sslCredential);
if (config.connectUsingServername)
{
string ip = config.ip;
string port = ip.Split(':')[1];
serverAddress = config.serverName + ':' + port;
}
Grpc.Core.Channel gRpcChannel = new Channel(serverAddress, sslCredential);
string token = null;
string account_id = null;
......@@ -82,7 +82,7 @@ namespace PIKAHMPX2.SwitchBoardClient
var sslCredentialToken = new SslCredentials(File.ReadAllText(config.certificate));
// create channel credentials with TLS and authorization token
var channelCredentials = ChannelCredentials.Create(sslCredentialToken, CallCredentials.FromInterceptor(asyncAuthInterceptor));
var gRpcChan = new Grpc.Core.Channel(serverAddress, channelCredentials);
var gRpcChan = new Grpc.Core.Channel(serverAddress, channelCredentials);
accountService = new AccountService(new Gpnetd.Account.AccountClient(gRpcChan));
var account_apps = accountService.ListApps(account_id);
......
b281e2826ab0f14f6ad3e0265306bb2ddb9aaee2
29204b4f886db5a1935a0f72f19c6bae967ac2a0
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