Skip to content

Instantly share code, notes, and snippets.

View lgaetz's full-sized avatar

Lorne Gaetz lgaetz

  • Nova Scotia, Canada
View GitHub Profile
#!/usr/bin/php
<?php
/*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
*
* Script: lgaetz-usermandel.php
*
* Latest version: https://gist.github.com/lgaetz/a6cc6139aefcb711a9de2f634690ceb6
*
* Usage: Scipt to delete a FreePBX User Management user. Developed for FreePBX 14
#!/usr/bin/php
<?php
// script requires a command - echo help and exit if arg1
if (!isset($argv[1])) {
echo "
*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
*
* Script: lgaetz-tctoggle.php
*
#!/usr/bin/php
<?php
/*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
*
* Script: check-cust-id.php
*
* Latest version: https://gist.github.com/lgaetz/73984457008c3769f0af4c7d668d16c3
*
* Usage: Check provided arg1 against a csv file (arg2) and set channel var (arg3) to true|false
; Feature code prefix to allow FreePBX user to set and unset a dobro-callflow
; it works similarly to a Call Flow Conrol, except the phone user sets the
; destination number when enabling
;
; Latest version:
; https://gist.github.com/lgaetz/543da144d051a353ca0fab93b7f34cf2
;
; Usage:
; Dialplan below goes in the file
; /etc/asterisk/extensions_custom.conf
@lgaetz
lgaetz / el_cid.conf
Last active July 1, 2019 15:43
lgaetz-el_cid
; FreePBX user dialplan for setting the outgoing Caller ID dynamically on a per-call basis to match
; the NANP area code of the destination number
;
; Latest version:
; https://gist.github.com/lgaetz/2b3d67a30f86a827121b004ec2f3024a
;
; Usage:
; Content below goes in /etc/asterisk/extensions_custom.conf
;
[outbound-call-notification]
; Use with FreePBX Custom Trunk, with a dial string set to:
; local/$OUTNUM$@outbound-call-notification
; Structure outbound routes to use this trunk ahead of conventional trunks or without any other trunks.
; Email notice will be generated on all outbound calls. Use for restricted
; routes, calls to high tariff destinations, etc.
;
; latest version: https://gist.github.com/lgaetz/eae01c3fe9209608abb2bd0410cb294c
;
; license: GNU/GPL2
@lgaetz
lgaetz / ariendpoints.php
Created October 8, 2019 20:04 — forked from jfinstrom/ariendpoints.php
Dump endpoints with ARI and FreePBX
#!/usr/bin/env php
<?php
if((@include '/etc/freepbx.conf') === false){
echo "Failed to include configuration\r\n";
return;
}
$ariuser = \FreePBX::Config()->get('FPBX_ARI_USER');
$aripass = \FreePBX::Config()->get('FPBX_ARI_PASSWORD');
$ari = new Pest('http://localhost:8088/ari');
$ari->setupAuth($ariuser,$aripass);
[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
/**** **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** ****
* lgaetz-hinterland.php
* PHP script to monitor devstate change of FreePBX extensions in real time
*
* latest version: https://gist.github.com/lgaetz/64ad83952a2a629204222e48fc01bb51
*
* Usage: download the script to the PBX, make it executable and run it
#!/usr/bin/php -q
<?php
if (!isset($argv[2])){
echo "
***** ***** ***** ***** ***** ***** ***** ***** ***** ***** ***** ***** ***** ***** *****
*
* Script: lgaetz-pay-it-fwd.php
* sets,unsets,toggles and lists Unconditional Call Fwd setting for provided extension
*
* Latest version: https://gist.github.com/lgaetz/64212eceab5e2c8381b586ba14df4fcf