Added config construction for audio conf in DDVC MOB bridge

This commit is contained in:
Heath Volmer
2018-09-25 14:36:38 -06:00
parent 101d1b5625
commit 78668e8abb
2 changed files with 59 additions and 14 deletions

View File

@@ -39,17 +39,10 @@ namespace PepperDash.Essentials.AppServer.Messengers
const uint BIsOffHook = 224; const uint BIsOffHook = 224;
const uint BDialHangupIsVisible = 251; const uint BDialHangupIsVisible = 251;
const uint BCallIsIncoming = 254; const uint BCallIsIncoming = 254;
const uint BSpeedDialIsVisible1 = 261;
const uint BSpeedDialIsVisible2 = 262;
const uint BSpeedDialIsVisible3 = 263;
const uint BSpeedDialIsVisible4 = 264;
const uint SCurrentDialString = 201; const uint SCurrentDialString = 201;
const uint SSpeedDialName1 = 241; const uint SHookState = 221;
const uint SSpeedDialName2 = 242;
const uint SSpeedDialName3 = 243;
const uint SSpeedDialName4 = 244;
/// <summary> /// <summary>
/// ///
@@ -68,6 +61,7 @@ namespace PepperDash.Essentials.AppServer.Messengers
/// </summary> /// </summary>
void SendFullStatus() void SendFullStatus()
{ {
this.PostStatusMessage(new this.PostStatusMessage(new
{ {
atc = new atc = new
@@ -93,6 +87,7 @@ namespace PepperDash.Essentials.AppServer.Messengers
EISC.SetBoolSigAction(BDialHangupIsVisible, b => send(new { dialHangupIsVisible = b })); EISC.SetBoolSigAction(BDialHangupIsVisible, b => send(new { dialHangupIsVisible = b }));
EISC.SetBoolSigAction(BCallIsIncoming, b => send(new { callIsIncoming = b })); EISC.SetBoolSigAction(BCallIsIncoming, b => send(new { callIsIncoming = b }));
EISC.SetStringSigAction(SCurrentDialString, s => send(new { currentDialString = s })); EISC.SetStringSigAction(SCurrentDialString, s => send(new { currentDialString = s }));
EISC.SetStringSigAction(SHookState, s => send(new { callStatus = s }));
// Add press and holds using helper // Add press and holds using helper
Action<string, uint> addPHAction = (s, u) => Action<string, uint> addPHAction = (s, u) =>
@@ -122,6 +117,10 @@ namespace PepperDash.Essentials.AppServer.Messengers
addAction("/speedDial4", BSpeedDial4); addAction("/speedDial4", BSpeedDial4);
AppServerController.AddAction(MessagePath + "/fullStatus", new Action(SendFullStatus)); AppServerController.AddAction(MessagePath + "/fullStatus", new Action(SendFullStatus));
// Dial on string
#warning Does this need to set the string and then dial?
AppServerController.AddAction(MessagePath + "/dial", new Action<string>(s => EISC.SetString(SCurrentDialString, s)));
} }
} }
} }

View File

@@ -61,14 +61,15 @@ namespace PepperDash.Essentials.Room.Cotija
/// 63 /// 63
/// </summary> /// </summary>
public const uint ShutdownStart = 63; public const uint ShutdownStart = 63;
/// <summary> /// <summary>
/// 72 /// 72
/// </summary> /// </summary>
public const uint SourceHasChanged = 72; public const uint SourceHasChanged = 72;
/// <summary> /// <summary>
/// 261 - The start of the range of speed dial visibles
/// </summary>
public const uint SpeedDialVisibleStartJoin = 261;
/// <summary>
/// 501 /// 501
/// </summary> /// </summary>
public const uint ConfigIsReady = 501; public const uint ConfigIsReady = 501;
@@ -94,6 +95,16 @@ namespace PepperDash.Essentials.Room.Cotija
/// </summary> /// </summary>
public const uint SelectedSourceKey = 71; public const uint SelectedSourceKey = 71;
/// <summary>
/// 241
/// </summary>
public const uint SpeedDialNameStartJoin = 241;
/// <summary>
/// 251
/// </summary>
public const uint SpeedDialNumberStartJoin = 251;
/// <summary> /// <summary>
/// 501 /// 501
/// </summary> /// </summary>
@@ -185,7 +196,7 @@ namespace PepperDash.Essentials.Room.Cotija
SetupFunctions(); SetupFunctions();
SetupFeedbacks(); SetupFeedbacks();
AtcMessenger = new Ddvc01AtcMessenger(EISC, "/atc"); AtcMessenger = new Ddvc01AtcMessenger(EISC, "/device/audioCodec");
AtcMessenger.RegisterWithAppServer(Parent); AtcMessenger.RegisterWithAppServer(Parent);
EISC.SigChange += EISC_SigChange; EISC.SigChange += EISC_SigChange;
@@ -467,6 +478,41 @@ namespace PepperDash.Essentials.Room.Cotija
co.SourceLists.Add("default", newSl); co.SourceLists.Add("default", newSl);
// build "audioCodec" config if we need
if (string.IsNullOrEmpty(rmProps.AudioCodecKey))
{
var acFavs = new List<PepperDash.Essentials.Devices.Common.Codec.CodecActiveCallItem>();
for (uint i = 0; i < 4; i++)
{
if (!EISC.GetBool(BoolJoin.SpeedDialVisibleStartJoin + i))
{
break;
}
acFavs.Add(new PepperDash.Essentials.Devices.Common.Codec.CodecActiveCallItem()
{
Name = EISC.GetString(StringJoin.SpeedDialNameStartJoin + i),
Number = EISC.GetString(StringJoin.SpeedDialNumberStartJoin + i),
Type = PepperDash.Essentials.Devices.Common.Codec.eCodecCallType.Audio
});
}
var acProps = new
{
favorites = acFavs
};
var acStr = "audioCodec";
var acConf = new DeviceConfig()
{
Group = acStr,
Key = acStr,
Name = acStr,
Type = acStr,
Properties = JToken.FromObject(acProps)
};
co.Devices.Add(acConf);
}
Debug.Console(0, this, "******* CONFIG FROM DDVC: \r{0}", JsonConvert.SerializeObject(ConfigReader.ConfigObject, Formatting.Indented)); Debug.Console(0, this, "******* CONFIG FROM DDVC: \r{0}", JsonConvert.SerializeObject(ConfigReader.ConfigObject, Formatting.Indented));
var handler = ConfigurationIsReady; var handler = ConfigurationIsReady;