Skip to content

Instantly share code, notes, and snippets.

View lgaetz's full-sized avatar

Lorne Gaetz lgaetz

  • Nova Scotia, Canada
View GitHub Profile
@lgaetz
lgaetz / lgaetz bounce
Last active April 12, 2024 14:18
Feature code to seamlessly bounce an active bridged call between a user’s multiple devices
; FreePBX dialplan for a feature code that can be dialed from an idle device that will immediately bounce
; any active call from any of the the same user's extensions. Primary use case is when a user has multiple
; registered devices they can quickly move the active call between deskphone, to mobile client to desktop client.
;
; License: GNU GPL3+
; latest version: https://gist.github.com/lgaetz/4c14829c14eb0a739a216016d9f394b2
;
; version history 2024-03-22 First commit working
; 2024-03-24 Fix hint and change ext away from _.
@lgaetz
lgaetz / Targeted ChanSpy
Last active April 6, 2024 05:16
FreePBX Feature code prefix to allow spy/whisper/barge on the specified extension
; FreePBX Feature code prefix to allow spy/whisper/barge on
; the specified extension.
;
; Latest version:
; https://gist.github.com/lgaetz/78c4e114952e79596c1ed4123559d3d3
;
; Usage:
; Dialplan goes in the file:
; /etc/asterisk/extensions_custom.conf
; Dial local extension with 556 prefix to spy. While spying on
@lgaetz
lgaetz / DTMF 2 Trusted Zone
Last active March 28, 2024 15:33
DTMF to Firewall Trusted Zone
[from-internal-custom]
; Dialplan for a feature code to add ; an IP address to the FreePBX trusted zone
; Dial F-I-R-E-W-A-L-L from an internal extension and enter an IPv4 address using
; DTMF with * as the dot character.
;
; License: GNU GPL3+
; latest version: https://gist.github.com/lgaetz/8a043b7aa39484f622f0f7c138909558
;
; version history 2023-01-21 First commit working
#!/usr/bin/env php
<?php
if (!isset($argv[2])){
echo "
***** ***** ***** ***** ***** ***** ***** ***** ***** ***** ***** ***** ***** ***** *****
*
* Script: lgaetz-dnd.php
*
* Latest version: https://gist.github.com/lgaetz/b350b9fa9ac18730150b387a1525aa4e
*
#!/usr/bin/php
<?php
// script requires a command - echo help and exit if arg1 missing
if (!isset($argv[1])) {
echo "
*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
*
* Script: lgaetz-cftoggle.php
*
#!/usr/bin/php
<?php
/*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
*
* Script: lgaetz-cmcheck.php
*
* Latest version: https://gist.github.com/lgaetz/7cab1bc6b6266ba658d5dd90d2e919eb
*
* Usage: Asterisk AGI file to check number against a FreePBX Contact Manager group (or all CM groups)
@lgaetz
lgaetz / lgaetz-click2call.php
Created November 24, 2023 16:40
Local PHP script for originating a call from local extension to another number
<?php
*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
*
* Script: lgaetz-click2call.php
*
* Latest version: https://gist.github.com/lgaetz/6ff9aeff59de40df5755c52d85a65c9b
*
* Usage: Scipt to list/toggle/set FreePBX Call Flow Controls. Developed for FreePBX 16
*
[send-sip-response-code]
; Context to send a specific SIP response code and terminate the channel
; Create Custom Destination in FreePBX with a dial string of the format
; send-sip-response-code,404,1
; substitute the appropriate response code in place of the 404
; Reference: https://wiki.asterisk.org/wiki/display/AST/Hangup+Cause+Mappings
;
; latest version: https://gist.github.com/lgaetz/480582a1827cc98db1ee539c249f074b
;
; License GPL/2
#!/usr/bin/php -q
<?php
/*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
*
* Latest Version: https://gist.github.com/lgaetz/ce6ac96ca6de0e60177213ede50e7955
*
* Description:
*
* Script lgaetz-trunk-monitor.php is used in conjunction with the "Monitor Trunk Failures" field in FreePBX
; Latest version: https://gist.github.com/lgaetz/066c655867b4e679da21dbd1567b29bd
;
; Crude proof of concept of 2FA for a FreePBX extension
; Clients can register to the PBX, but are unable to dial until they successfully
; enter a random PIN sent via email.
; Once the PIN passes, the client IP is whitelisted and user can dial without
; restriction until the IP changes
;
; License: GNU GPL3+
;