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 / 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
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);
[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 / 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
;
; 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
#!/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
#!/usr/bin/php
<?php
// script requires a command - echo help and exit if arg1
if (!isset($argv[1])) {
echo "
*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
*
* Script: lgaetz-tctoggle.php
*