Created
June 4, 2022 08:32
-
-
Save Aldaviva/bccd766099e2d7807da086feacf2c18a to your computer and use it in GitHub Desktop.
Cisco macros
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import xapi from 'xapi'; | |
const cameraBrightnessCheckboxWidgetId = "camera_brightness_checkbox"; | |
const brightnessModeConfiguration = xapi.Config.Cameras.Camera["1"].Brightness.Mode; | |
brightnessModeConfiguration.on(renderBrightnessCheckbox); | |
render(); | |
async function render(){ | |
return renderBrightnessCheckbox(await brightnessModeConfiguration.get()); | |
} | |
function renderBrightnessCheckbox(brightnessMode) { | |
const newValue = brightnessMode === "Auto" ? "on" : "off"; | |
console.debug("Setting camera brightness checkbox to "+newValue); | |
return xapi.Command.UserInterface.Extensions.Widget.SetValue({ | |
WidgetId: cameraBrightnessCheckboxWidgetId, | |
Value: newValue | |
}); | |
} | |
xapi.Event.UserInterface.Extensions.Widget.Action.on(event => { | |
if(event.WidgetId === cameraBrightnessCheckboxWidgetId && event.Type === "changed"){ | |
const newValue = event.Value === "on" ? "Auto" : "Manual"; | |
console.info("Setting camera brightness to "+newValue); | |
return brightnessModeConfiguration.set(newValue); | |
} | |
}); | |
// If other macros add or remove widgets (like Virgin Moon), Cisco will not preserve the UI state of our widgets, so re-render them. | |
xapi.Event.UserInterface.Extensions.Widget.LayoutUpdated.on(async () => await render()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<Extensions> | |
<Version>1.7</Version> | |
<Panel> | |
<PanelId>settings_panel</PanelId> | |
<Origin>local</Origin> | |
<Type>InCall</Type> | |
<Icon>Sliders</Icon> | |
<Color>#6F739E</Color> | |
<Name>Settings</Name> | |
<ActivityType>Custom</ActivityType> | |
<Page> | |
<Name>Settings</Name> | |
<Row> | |
<Name>Camera brightness</Name> | |
<Widget> | |
<WidgetId>widget_1</WidgetId> | |
<Name>Manual</Name> | |
<Type>Text</Type> | |
<Options>size=1;fontSize=small;align=right</Options> | |
</Widget> | |
<Widget> | |
<WidgetId>camera_brightness_checkbox</WidgetId> | |
<Type>ToggleButton</Type> | |
<Options>size=1</Options> | |
</Widget> | |
<Widget> | |
<WidgetId>widget_2</WidgetId> | |
<Name>Auto</Name> | |
<Type>Text</Type> | |
<Options>size=1;fontSize=small;align=left</Options> | |
</Widget> | |
</Row> | |
<PageId>settings_page</PageId> | |
<Options>hideRowNames=0</Options> | |
</Page> | |
</Panel> | |
</Extensions> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import xapi from 'xapi'; | |
/* Mute mics on macro start, unless a call is running */ | |
xapi.Status.Call.get().then(callStatus => { | |
if(callStatus.length === 0){ | |
muteMicrophones(); | |
} | |
}); | |
/* Mute mics when joining call */ | |
xapi.Status.Call.on(callStatus => { | |
if(callStatus.Status === "Dialling"){ | |
muteMicrophones(); | |
} | |
}); | |
/* Mute mics when leaving call */ | |
xapi.Event.CallDisconnect.on(muteMicrophones); | |
function muteMicrophones(){ | |
console.log("Muting microphones"); | |
return xapi.Command.Audio.Microphones.Mute(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import xapi from 'xapi'; | |
const endpointId = "612d8d9b4f0c6aaad9c67a26"; | |
const relayAccessToken = ""; | |
setTimeout(() => | |
xapi.Command.HttpClient.Patch({ | |
Url: "https://relay.bluejeans.com/api/endpoints/" + endpointId, | |
Header: [ | |
"X-Access-Token: " + relayAccessToken, | |
"Content-Type: application/json" | |
] | |
}, "{}") | |
.then(() => { | |
console.log("Requested calendar push from Relay"); | |
}) | |
.catch(error => { | |
console.error("Failed to trigger calendar push from Relay", error); | |
}) | |
, 30*1000); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment