freepbx / api Goto Github PK
View Code? Open in Web Editor NEWLicense: GNU General Public License v3.0
License: GNU General Public License v3.0
FreePBX 17
Unable to get token.
And a simple RestAPI request returns and error 500.
No way to use APIs on 17.
FreePBX 17 version updated.
{
"error": {
"type": "TypeError",
"message": "Slim\\App::__construct(): Argument #1 ($responseFactory) must be of type Psr\\Http\\Message\\ResponseFactoryInterface, array given, called in \/var\/www\/html\/admin\/modules\/api\/Rest\/Api.php on line 49",
"code": 0,
"file": "\/var\/www\/html\/admin\/libraries\/Composer\/vendor\/slim\/slim\/Slim\/App.php",
"line": 47
}
}
FreePBX 16
When an extension is created the VM secret is set in the "users" table, but if you use fetchAllExtensions or fetchExtension, the password is empty for the others extensions and not for the new extensions created with API.
That means, you need to synchronize all VM secret to the "users" table. Otherwise, the admin could not know the VM Secret throught fetchAllExtensions or fetchExtension
However, fetchVoiceMail works fine. VM secret is present.
BTW, I wondered if password is a good name. Indeed, there is much name discribing passwords.
Password for extension
Password for User Manager.
Password for VM.
As the VM password is named : password, it will make sens to rename it as vm-password. just for avoid to get confuse.
The most important for now is, to sync the vm-password into the "users" table on the key password or getting data from voicemail.conf.
I know the fact to parse the file, voicemail.conf is not the best way and it's not faster. The idea will be to put voicemails data into a table looks good though.
framework: 16.0.40.7
api: 16.0.13
MariaDB [asterisk]> select extension, password from users;
+-----------+----------+
| extension | password |
+-----------+----------+
| 1000 | |
| 1001 | |
| 1002 | |
| 1003 | |
| 101 | |
| 102 | |
| 103 | |
| 104 | |
| 106 | |
| 107 | |
| 108 | |
| 110 | |
| 111 | |
| 112 | |
| 114 | |
| 9919988 | |
| 200 | |
| 201 | |
| 113 | |
| 105 | |
| 122 | |
| 121 | |
| 123 | |
| 100 | |
| 109 | |
| 120 | |
| 1020 | test |
| 1021 | |
+-----------+----------+
28 rows in set (0.00 sec)
[root@freepbx ~]# more /etc/asterisk/voicemail.conf | grep test
1020=test,Room 20,[email protected],,attach=no|saycid=no|envelope=no|delete=no
Here we can expect to see any vm-password in the password key. But a single password is recorded. The one created throught API.
Additionally, the field allows all alphabetic characters. Need to filter it with a regex accepting 0-9 and empty (no vm secret)
FreePBX 16
Clicking on visualizer, the feature to select read, write an item for scope works fine.
However, if you filter something on Search on the top of right of table, the list is correctly updated but if you click on any check box selecting what you want, nothing is changed. The Check box is not selected and you cannot unselect anything.
But if you change the keyword to search, the check box is updated and you can unselect it. But the issue is comming again.
Just try to reproduce this issue putting something in the Search field.
framework: 16.0.40.7
api: 16.0.13
No response
FreePBX 16
When an API is created, there is no owner created in the api_applications table.
For this reason, if someone need to use authorize URI, the is no association between the username and the client_id.
I forced the owner putting username id, it doesn't work anyway.
I think something is missing with this logic.
I imagine if the admin create a web-app or a single page API, then it should get a list box with the users to be associate with the client_id.
For now, the FreePBX server cannot return any token with the client_id, client_secret, code ...etc
I used this document bellow trying the web-app and single-page method, no way.
https://aaronparecki.com/oauth-2-simplified/#web-server-apps
I think samgoma should write a document giving some examples with the authorize URI usage once fixed.
Here, the link in the FreePBX forum relating this issue.
https://community.freepbx.org/t/api-web-app-type-authentication-issue/94633
However, machine to machine works fine, but it's not safe to use any remote applications for managing any FreePBX / PBXact systems.
framework: 16.0.40.7
api: 16.0.13
{"error":"invalid_client","message":"Client authentication failed"}
FreePBX 17
CLI command fails with the below error: fwconsole api gql genclientcred
In Api.class.php line 30:
[Whoops\Exception\ErrorException (8192)]
Creation of dynamic property FreePBX\Console\Command\Api::$input is deprecated
API 17.0.1.2
No response
FreePBX 16
About Extension we can Add and Update an extension but if the goal is to update any extension, the request featching the extension doesn't return maxcontact. And there is no way to get this value with any existing API requests.
That will be nice to see maxcontact's value when we are editing this extension.
Need to check if this kind of case is true for the other requests. Whatever if the request is RestAPI or GQL though.
Indeed, the locic will be:
If we can update something, the be sure to get the same items with their value. Otherwise, it doesn't make sense.
Example:
We can imagine creating the extension 100 with max contact = 1 (by default).
Some days later, we decide to update max contact to 3. Ok in this case we set maxcontact to 3.
If we need to check this value, then, there is no way to verify it. And I think if we set nothing on maxcontact, the value will be changer to 1 and not 3.
maxcontact is not alone in this case. All fields present in addExtension and updateExtension cannot be read in a same request. Need to send at least 2 requests to get almost what we need to display the fields for udpate.
The logic would be to get everything when we read any items necessary for updates.
FreePBX 17
Doreload doesn't work.
mutation {
doreload(input: {}) {
status
transaction_id
}
}
After getting the transaction ID, it is still being processed and forever.
query {
fetchApiStatus( txnId: 15) {
status message
}
}
Response:
{
"data": {
"fetchApiStatus": {
"status": true,
"message": "Processing"
}
}
}
API 17.0.1.2
Framework 17.0.15.25
[2024-05-31 07:00:12] [dbug.DEBUG]: 2024-May-31 07:00:12 /var/www/html/admin/modules/api/Gql/Api.php:104
[] []
[2024-05-31 07:00:12] [dbug.DEBUG]: stdClass Object
(
[message] => Internal server error
[locations] => Array
(
[0] => stdClass Object
(
[line] => 58
[column] => 7
)
)
[path] => Array
(
[0] => __schema
[1] => types
[2] => 0
[3] => fields
[4] => 0
[5] => args
[6] => 4
[7] => defaultValue
)
)
FreePBX 16
When you delete an extension, Need Reload is not set, however, if you delete an extension through GUI, need reload is set. (You can see Apply Config button).
This action with API should execute the same action as the GUI.
Just set needreload = true at the end of the API for delete extension.
This difference is importent if the changes are not applied after deletion and if there is no way to know if the system needs reloading.
framework: 16.0.40.7
api: 16.0.13
core: 16.0.68.24
No response
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.