Skip to content

Instantly share code, notes, and snippets.

View jfinstrom's full-sized avatar
💭
making stuff

James Finstrom jfinstrom

💭
making stuff
View GitHub Profile
@jfinstrom
jfinstrom / queues_to_csv.php
Created January 26, 2024 18:00
Dump freepbx queues to csv
<?php
/**
* Copyright (c) 2024 James Finstrom
*
* See the full license at: https://opensource.org/licenses/BSD-3-Clause
*/
// Set OUTPUT PATH HERE
$csvFilePath = "output.csv";
@jfinstrom
jfinstrom / check_pjsip.sh
Created January 25, 2024 17:53
Nagios pjsip monitor example
#!/bin/bash
# Copyright (c) James Finstrom. All rights reserved.
# This script is licensed under the 3-Clause BSD License.
# See the full license text at: https://opensource.org/licenses/BSD-3-Clause
# Nagios exit codes
OK=0
WARNING=1
CRITICAL=2
@jfinstrom
jfinstrom / FreePBX16_Debian11_Asterisk16.MD
Last active February 29, 2024 11:15
How to Install FreePBX 16 on Debian 11 with Asterisk 16

FreePBX Documentation: How to Install FreePBX 16 on Debian 11 with Asterisk 16

Attribution: This was originally published at https://wiki.freepbx.org which has since been removed

READ FIRST

Manual installations of FreePBX are considered an EXPERTS ONLY exercise. This method provides the CORE functionality of FreePBX. Non-commercial modules may not function as expected. Certain modules and features may require additional software.

COMMERCIAL MODULES CANNOT BE INSTALLED ON THIS OS

Specifications

@jfinstrom
jfinstrom / asteriskcheck.php
Created November 8, 2023 19:51
This script checks if asterisk is running by a specific user and has not reset since last run.
<?php
/**
* Copyright 2023 James Finstrom
* File: asteriskcheck
*
* Description: This PHP file contains the functionality for checking if asterisk is
* running by a specific user and has not reset since last run.
*
* Author: James Finstrom
*
@jfinstrom
jfinstrom / GenerateUsermanPasswordHash.php
Created January 25, 2023 19:41
Generate a password hash for manual update of a FreePBX Userman user
#!/usr/bin/env php
# Copyright (c) 2023 James Finstrom. All rights reserved.
# This work is licensed under the terms of the MIT license.
# For a copy, see <https://opensource.org/licenses/MIT>.
# Usage: ./GenerateUsermanPasswordHash.php Passw0rdString
#
<?php
if(empty($argv[1]){
echo "You must provide a string to hash" . PHP_EOL
return 1;
@jfinstrom
jfinstrom / pwupdate.php
Created January 19, 2022 00:39
Update all sip passwords
#!/usr/bin/env php
<?php
/**
Copyright (C) 2022 James Finstrom <[email protected]>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
@jfinstrom
jfinstrom / genHtpasswd.php
Created June 4, 2021 23:25
Generate a htpasswd file from FreePBX userman group.
#!/usr/bin/env php
<?php
// (c) 2021 James Finstrom
// This code is licensed under MIT license
include '/etc/freepbx.conf';
$gid = 1;
$freepbx = FreePBX::Create();
$group = $freepbx
@jfinstrom
jfinstrom / freepbx.vscode-snippits
Created May 26, 2021 04:00
Snippits for FreePBX in vscode
{
// (c)2021 James Finstrom
// License: Attribution-ShareAlike 4.0 International (CC BY-SA 4.0)
"FreePBX Text Input":{
"scope": "php,html",
"prefix": "f-texti",
"body": [
"<!--${1:LABEL}-->",
"<div class=\"element-container\">",
@jfinstrom
jfinstrom / costOfFree.md
Last active May 26, 2021 00:31
The cost of free.

Open Source Software

The cost of free.

Who am I?

I am a Sr. Software engineer and a former core developer for the FreePBX project. I have been involved in open source software as a user and developer since 2005. I have been in computers since I was a child with my introduction to computers on a IBM XT.

Disclaimers

@jfinstrom
jfinstrom / Restore.php
Created December 14, 2020 21:34
Digium Phones Restore
<?php
namespace FreePBX\modules\Digium_phones;
use FreePBX\modules\Backup as Base;
class Restore Extends Base\RestoreBase{
public function runRestore(){
$configs = $this->getConfigs();
$this->importTables($configs['tables']);
}
public function processLegacy($pdo, $data, $tables, $unknownTables){