Skip to content

Instantly share code, notes, and snippets.

@lgaetz
Last active Aug 4, 2022
Embed
What would you like to do?
#!/usr/bin/env php
<?php
/***** ***** ***** ***** ***** ***** ***** ***** ***** ***** ***** ***** ***** ***** *****
*
* Script: inroute-del.php
*
* Latest version: https://gist.github.com/lgaetz/fa550bc8f402df6edafea758da353315
*
* Usage: Run script on FreePBX system with no arguments to get a list of inbound routes by index.
* Run script with single index argument to delete an inbound route.
*
* License: GNU/GPL3+
*
* History:
* 2018-06-19 First commit by lgaetz
***** ***** ***** ***** ***** ***** ***** ***** ***** ***** ***** ***** ***** ***** *****/
include '/etc/freepbx.conf';
$FreePBX = FreePBX::Create();
$routes=$FreePBX->Core->getAllDIDs();
foreach($routes as $key => $route) {
print ($key." ".$route['cidnum']."/".$route['extension']."\n");
}
if (isset($argv[1])){
print("\nDeleting route index ".$argv[1]);
$delete=$FreePBX->Core->delDID($routes[$argv[1]]['extension'],$routes[$argv[1]]['cidnum']);
}
exit;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment