Created
March 5, 2025 11:10
-
-
Save krotesk/76b74c72e5ba934c005a444f5d03b269 to your computer and use it in GitHub Desktop.
extension-add.php
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env php | |
<?php | |
/*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** | |
* Скрипт для быстрого создания экстена | |
* Требуется как минимум 1 аргумент - номер, второй аргумент может служить именем (описанием) | |
* 2025-03-05 | |
*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***/ | |
if (!isset($argv[1])){ | |
echo "u need 1 arg"; | |
exit; | |
} | |
$settings=array(); | |
if (!isset($argv[2])){ | |
$settings["name"] = $argv[1]; | |
} else { | |
$settings["name"] = $argv[2]; | |
} | |
$settings["max_contacts"] = 2; | |
include '/etc/freepbx.conf'; | |
$FreePBX = FreePBX::Create(); | |
$device=$FreePBX->Core->getDevice($argv[1]); | |
$user=$FreePBX->Core->getUser($argv[1]); | |
if($device["user"]){ | |
echo 'device exist '.$device["user"]; | |
exit; | |
} | |
if($user["name"]){ | |
echo 'user exist '.$user["name"]; | |
exit; | |
} | |
$FreePBX->Core->processQuickCreate("pjsip", $argv[1], $settings); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment