Skip to content

Instantly share code, notes, and snippets.

View jmadden's full-sized avatar
☘️

Jim Madden jmadden

☘️
View GitHub Profile
@jmadden
jmadden / CustomListeners.js
Last active March 11, 2021 18:49
Location plugin-dual-channel-recording/src/listeners/CustomListeners.js
import { Actions, Manager, TaskHelper } from '@twilio/flex-ui';
import { getCustomerParticipant, getMyParticipant } from '../helpers';
const manager = Manager.getInstance();
const startCallRecording = async (callSid, callbackParameters) => {
console.debug('Creating recording for call SID:', callSid);
const fetchUrl = `https://${process.env.REACT_APP_SERVERLESS_DOMAIN}/recording/create`;
@jmadden
jmadden / 1-start.js
Last active July 19, 2023 22:31
Voice mail system using Twilio Functions
exports.handler = function(context, event, callback) {
let twiml = new Twilio.twiml.VoiceResponse();
const OWNER = '+1##########'; //Your mobile number.
if(event.From == OWNER){
const gather = twiml.gather({
action:'/callOut'
});
gather.say("Please enter the phone number you'd like to call followed by the pound sign.");
@jmadden
jmadden / sequential_dialing.php
Last active April 6, 2022 03:02
Sequentially dial phone numbers using Twilio and Twilio's PHP helper library
<?php
// Require the bundled autoload file - the path may need to change
// based on where you downloaded and unzipped the SDK
require __DIR__ . '/twilio-php-master/Twilio/autoload.php';
// Use Twilio\TwiML to build TwiML instructions through PHP
use Twilio\Twiml;
// Instantiate a TwiML object.
$response = new Twiml();
@jmadden
jmadden / 1-outbound-call.php
Last active August 14, 2022 03:24
Twilio PHP Outbound Call and Gather Example
<?php
// Get the PHP helper library from https://twilio.com/docs/libraries/php
require_once '/path/to/vendor/autoload.php'; // Loads the library
use Twilio\Rest\Client;
// Your Account Sid and Auth Token from twilio.com/user/account
$sid = "YOU_ACCOUNT_SID";
$token = "YOUR_AUTH_TOKEN";
$client = new Client($sid, $token);
@jmadden
jmadden / forward_to_first_number.xml
Last active September 1, 2022 22:28
TwiML Incoming Calls - Forward call to numbers in order. Fire off VMail and send SMS on no answer
<?xml version="1.0" encoding="UTF-8"?>
<Response>
<!-- Forward to first number and if no answer, action URL points to second number to try -->
<Dial timeout="15" action="forward_to_second_number.xml">
<Number url="whisper_instructions.xml">+15554441212</Number>
</Dial>
</Response>
<?php
use Twilio\Twiml;
class TwimlWrap
{
/** @var TwilioTwiml */
protected $twiml;
public function __construct()
@jmadden
jmadden / record-status.php
Last active June 9, 2017 19:44
Send an SMS message through Twilio and record the message status to a log file using a Status Callback URL
<?php
$sid = $_REQUEST['MessageSid'];
$status = $_REQUEST['MessageStatus'];
$logfile = "status_callback_log.txt";
$log = fopen($logfile, 'a+');
fwrite($log, date('Y-m-d H:i:s')." SID = " . $sid . "\n");
fwrite($log, date('Y-m-d H:i:s')." Status = " . $status . "\n");
fwrite($log, "\n");
fclose($log);
<?php
// PHP Helper Library was dinstalled using Composer.
// Required if your envrionment does not handle autoloading
require __DIR__ . '/vendor/autoload.php';
// Use the REST API Client to make requests to the Twilio REST API
use Twilio\Rest\Client;
// Your Account SID and Auth Token from twilio.com/console
@jmadden
jmadden / heroku_notes.md
Last active August 29, 2015 14:03
#Heroku Notes – Configurations and commands through the Heroku Toolbelt

#Heroku Notes ######Configurations and commands through the Heroku Toolbelt

Setting Environment Variables

Variables can be set and accessed on Heroku Dynos. To review your Dyno's configuration type the following in your toolbelt.

$ heroku config

Folloing is an example of how your results may look:

Sizing with rem

CSS3 introduces a few new units, including the rem unit, which stands for "root em". If this hasn't put you to sleep yet, then let's look at how rem works.

The em unit is relative to the font-size of the parent, which causes the compounding issue. The rem unit is relative to the root—or the html—element. That means that we can define a single font size on the html element and define all rem units to be a percentage of that.

html { font-size: 62.5%; } 
body { font-size: 1.4rem; } /* =14px */
h1   { font-size: 2.4rem; } /* =24px */

I'm defining a base font-size of 62.5% to have the convenience of sizing rems in a way that is similar to using px.