Skip to content

Instantly share code, notes, and snippets.

View phm200's full-sized avatar

Peter Miller phm200

View GitHub Profile
@phm200
phm200 / RobinHood.cs
Created September 11, 2013 01:39
Fiddler Round Robin Load Balancing
public long numberOfRedirects = 1;
private string redirectHost = "192.168.100.57";
private int hostPort = 9999;
private string destinationOne = "192.168.100.57";
private int destOnePort = 8100;
private string destinationTwo = "192.168.100.57";
private int destTwoPort = 8101;
public void AutoTamperRequestBefore(Session oSession)
@phm200
phm200 / cloudformation-sample.template
Last active January 22, 2018 20:25
CloudFormation Sample Template
AWSTemplateFormatVersion: "2010-09-09"
Description: "CloudFormation sample template with Lambda function for OpenWeatherMap API"
Parameters:
# Parameters let users input custom values into template when creating a stack
OpenWeatherMapApiKey:
Type: "String"
Description: "The API key for your OpenWeatherMap account, i.e. 8b2b9..."
TriggerRateMinutes:
Type: "Number"
Description: "How often the Lambda functions are invoked to keep them warm"
@phm200
phm200 / streamsPR26.js
Created May 30, 2018 19:44
Streams PR #26
// Create the CCP iframe and append it to the container div.
var iframe = document.createElement('iframe');
iframe.src = params.ccpUrl;
iframe.style = "width: 100%; height: 100%";
iframe.allow = "microphone";
containerDiv.appendChild(iframe);
@phm200
phm200 / streamPR61-mutecontrol.js
Created May 30, 2018 19:47
Streams PR #61 - Mute Control
Agent.prototype.onMuteToggle = function(f) {
var bus = connect.core.getEventBus();
bus.subscribe(connect.AgentEvents.MUTE_TOGGLE, f);
};
Agent.prototype.mute = function() {
connect.core.getUpstream().sendUpstream(connect.EventType.BROADCAST,
{
event: connect.EventType.MUTE,
data: {mute: true}
@phm200
phm200 / streamPR61-softphonemute.js
Created May 30, 2018 19:48
Stream PR #61 - Softphone Mute
// Bind events for mute
var handleSoftPhoneMuteToggle = function() {
var bus = connect.core.getEventBus();
bus.subscribe(connect.EventType.MUTE, muteToggle);
};
// Make sure once we disconnected we get the mute state back to normal
var deleteLocalMediaStream = function(connectionId) {
delete localMediaStream[connectionId];
connect.core.getUpstream().sendUpstream(connect.EventType.BROADCAST, {
@phm200
phm200 / streamsPR64-softphoneManager1.js
Created May 30, 2018 19:52
Streams PR #64 - Softphone Manager 1
// SoftphoneManager code
connect.contact(function(contact) {
...
contact.onRefresh(function() {
...
session.remoteAudioElement = document.getElementById('remote-audio');
session.connect();
// new code
contact.session = session;
}
@phm200
phm200 / streamsPR64softphoneManager2.js
Created May 30, 2018 19:53
Streams PR #64 - Softphone Manager 2
connect.contact(function(contact) {
...
contact.onRefresh(function() {
...
session.remoteAudioElement = document.getElementById('remote-audio');
session.connect();
// new code
var bus = connect.core.getEventBus();
bus.trigger(contact.getEventName(connect.ContactEvents.SESSION), session);
}
@phm200
phm200 / streamsPR64appcode.js
Created May 30, 2018 19:54
Streams PR #64 - Application Code
// api.js
Contact.prototype.onSession = function(f) {
var bus = connect.core.getEventBus();
bus.subscribe(this.getEventName(connect.ContactEvents.SESSION), f);
};
...
// application code
function subscribeToContactEvents(contact) {
...
@phm200
phm200 / streamsTransfers.js
Created July 2, 2018 17:43
Transfers via Amazon Connect Streams API
var agent = new lily.Agent();
agent.getEndpoints(agent.getAllQueueARNs(), {
success: function(data){
console.log("valid_queue_phone_agent_endpoints", data.endpoints, "You can transfer the call to any of these endpoints");
},
failure:function(){
console.log("failed")
}
});
@phm200
phm200 / core-snippet.js
Created August 21, 2018 14:29
Streams API: PR 78 - Changes to terminate method
/**-------------------------------------------------------------------------
* Uninitialize Connect.
*/
connect.core.terminate = function() {
connect.core.client = new connect.NullClient();
connect.core.masterClient = new connect.NullClient();
var bus = connect.core.getEventBus();
if(bus) bus.unsubscribeAll();
connect.core.bus = new connect.EventBus();
connect.core.agentDataProvider = null;