mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-08-31 19:08:29 +00:00
feat: add Dial method with password support and implement ICodecCallControlsMessenger for call control messaging
This commit is contained in:
parent
8748157362
commit
b945ecb470
7 changed files with 57 additions and 8 deletions
|
|
@ -14,12 +14,12 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||
/// <summary>
|
||||
/// Provides a messaging bridge for devices implementing <see cref="ICodecCallControls"/>
|
||||
/// </summary>
|
||||
public class ICallControlsMessenger : MessengerBase
|
||||
public class ICodecCallControlsMessenger : MessengerBase
|
||||
{
|
||||
private readonly ICodecCallControls _callControls;
|
||||
|
||||
/// Initializes a new instance of the <see cref="ICallControlsMessenger"/> class.
|
||||
public ICallControlsMessenger(string key, string messagePath, EssentialsDevice device)
|
||||
/// Initializes a new instance of the <see cref="CodecCallControlsMessenger"/> class.
|
||||
public ICodecCallControlsMessenger(string key, string messagePath, EssentialsDevice device)
|
||||
: base(key, messagePath, device)
|
||||
{
|
||||
_callControls = device as ICodecCallControls ?? throw new ArgumentNullException(nameof(device));
|
||||
|
|
@ -38,6 +38,12 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||
AddAction("/dialMeeting", (id, content) =>
|
||||
_callControls.Dial(content.ToObject<Meeting>()));
|
||||
|
||||
AddAction("/dialNumber", (id, content) =>
|
||||
{
|
||||
var message = content.ToObject<ICallControlsDialMeetingMessage>();
|
||||
_callControls.Dial(message.Number, message.Password);
|
||||
});
|
||||
|
||||
AddAction("/endCallById", (id, content) =>
|
||||
{
|
||||
var s = content.ToObject<MobileControlSimpleContent<string>>();
|
||||
|
|
@ -113,4 +119,13 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||
public List<CodecActiveCallItem> Calls { get; set; }
|
||||
|
||||
}
|
||||
|
||||
public class ICallControlsDialMeetingMessage
|
||||
{
|
||||
[JsonProperty("number", Required = Required.Always)]
|
||||
public string Number { get; set; }
|
||||
|
||||
[JsonProperty("password", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public string Password { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
@ -143,7 +143,7 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||
HasDirectory = true,
|
||||
HasDirectorySearch = true,
|
||||
DirectorySelectedFolderName = _directory.CurrentDirectoryResult?.CurrentDirectoryResults?.Count > 0 ? _directory.CurrentDirectoryResult.CurrentDirectoryResults[0].Name : null,
|
||||
DirectorySelectedFolderIsNotRoot = _directory.CurrentDirectorResultIsNotDirectoryRoot?.BoolValue
|
||||
DirectorySelectedFolderIsNotRoot = _directory.CurrentDirectoryResultIsNotDirectoryRoot?.BoolValue
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ public class IHasScheduleAwarenessMessenger : MessengerBase
|
|||
|
||||
protected override void RegisterActions()
|
||||
{
|
||||
AddAction("/schedule/fullStatus", (id, content) => SendFullScheduleObject());
|
||||
AddAction("/schedule/fullStatus", (id, content) => SendFullScheduleObject(id));
|
||||
}
|
||||
|
||||
private void CodecSchedule_MeetingEventChange(object sender, MeetingEventArgs e)
|
||||
|
|
@ -45,13 +45,13 @@ public class IHasScheduleAwarenessMessenger : MessengerBase
|
|||
/// <summary>
|
||||
/// Helper method to send the full schedule data
|
||||
/// </summary>
|
||||
private void SendFullScheduleObject()
|
||||
private void SendFullScheduleObject(string id = null)
|
||||
{
|
||||
PostStatusMessage(new FullScheduleMessage
|
||||
{
|
||||
Meetings = ScheduleSource.CodecSchedule.Meetings,
|
||||
MeetingWarningMinutes = ScheduleSource.CodecSchedule.MeetingWarningMinutes
|
||||
});
|
||||
}, id);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue