Skip to content

Instantly share code, notes, and snippets.

@lgaetz
Last active August 4, 2022 13:09
Show Gist options
  • Save lgaetz/fa550bc8f402df6edafea758da353315 to your computer and use it in GitHub Desktop.
Save lgaetz/fa550bc8f402df6edafea758da353315 to your computer and use it in GitHub Desktop.
#!/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