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-voicemail.php
Last active August 3, 2021 22:06
php script to use freepbx methods to get/set voicemail params
<?php
/***** ***** ***** ***** ***** ***** ***** ***** ***** ***** ***** ***** ***** ***** *****
*
* Script: lgaetz-voicemial.php
*
* FreePBX script to work with device presence states
*
* Latest version: https://gist.github.com/lgaetz/2f0a19e79f968f9aa832dd7ec74d57dd
*
; Name: lgaetz-boomerang
;
; Latest version: https://gist.github.com/lgaetz/e7dbbcd6004559c5b467a146a8b14cfc
;
; Description: this dialplan Stores the most recent local extension number to speak with the referenced CallerID Number
; To direct an inbound call based on the last extension they last spoke to, do astdb query on the key/family
; boomerang/${CALLERID(number):-10}
; if set, will give most recent local exten. Something like dynamic routes could be used to branch call flow
; based on the returned result
#!/usr/bin/env php
<?php
/***** ***** ***** ***** ***** ***** ***** ***** ***** ***** ***** ***** ***** ***** *****
*
* Script: lg-presence.php
*
* FreePBX script to work with freepbx user presence states
*
* Latest version: https://gist.github.com/lgaetz/6b528901e6746391369b79b371bdd71f
@lgaetz
lgaetz / smsdialplan.txt
Last active February 25, 2021 17:03
Dialplan to send SMS using Voip Innovations APIDAZE
[send-sms-apidaze]
; latest version https://gist.github.com/lgaetz/57ffc5bbdd154081894138e983c1f4be
;
; In the APIDAZE API portal create a Dev App of type SMS and associate a DID with that APP
; get the secret and key for your app, and set them as variables
; Created by lgaetz, GNU/GPL3+
;
; Create a Custom Destination with Return enabled and with the following target:
; send-sms-apidaze,s,1(${CALLERID(number)},What are you doing Dave?)
;
#!/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
@lgaetz
lgaetz / dring config
Last active May 9, 2020 16:29
FreePBX manual config for POTS dring
FreePBX basic config for Asterisk/DAHDI to enable Distinctive Ring Detection for incoming calls on POTS lines with
multiple DIDs. Once usedistinctiveringdetection has been enabled, you can get the dring values from the Asterisk
console/full log when you make an inbound call
compiled from various sources by lgaetz c. 2009
license: GPL2
[root@asterisk]# cat /etc/asterisk/chan_dahdi_channels_custom.conf
usedistinctiveringdetection=yes
#!/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
#!/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
[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
@lgaetz
lgaetz / ariendpoints.php
Last active June 30, 2025 13:41 — forked from jfinstrom/ariendpoints.php
Dump endpoints with ARI and FreePBX
#!/usr/bin/env php
<?php
//test edit
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');