32 Commits

Author SHA1 Message Date
frytimo
2951bff6c5 Reuse socket connection to event socket. (#7634)
Reuse the socket connection instead of creating a new connection for each API request.
Add PHPDoc tag "static" for the static methods in event_socket.
2025-11-24 05:30:28 -07:00
frytimo
34821bed7e Documentation, format class, no modification. (#7629) 2025-11-19 09:48:36 -07:00
frytimo
7fdb3644e7 Fix websocket connection (#7581) 2025-10-17 13:45:49 -06:00
frytimo
77eda80c3d Fix socket will not reconnect after disconnect (#7580) 2025-10-17 08:51:49 -06:00
FusionPBX
dda18481ec Refactor PHP code (#7574)
* Use settings-get method
- get default, domain and user settings
- Replace _SESSION

* Simplify get domain paging

* Change isset using empty

* Fix token name and hash

* Add new default settings category: contact, name: default_sort_column, and default_sort_order

* Update app_config.php

* Update footer.php

* Fix require.php and core/dashboard/index.php (#7563)

* Fix require.php and core/dashboard/index.php

* Fix require.php and core/dashboard/index.php

* Fix require.php and core/dashboard/index.php

* Fix require.php and core/dashboard/index.php

* Fix require.php and core/dashboard/index.php

* Fix require.php and core/dashboard/index.php

* Fix require.php and core/dashboard/index.php

* Fix require.php and core/dashboard/index.php

* Fix require.php and core/dashboard/index.php

* Update destinations.php

* Update permission.php

* Update require.php

---------

Co-authored-by: FusionPBX <markjcrane@gmail.com>
Co-authored-by: FusionPBX <mark@fusionpbx.com>

* Update header.php

* Use settings get classes (#7567)

* access_control

* azure

* azure

* basic_operator_panel

* bridges

* call_block

* call_broadcast

* call_center

* call_flows

* call_forward

* call_recordings

* do_not_disturb

* feature_event_notify

* follow_me

* remove unused object properties

* fix esl command

* fix esl command

* conference_centers

* conference_centers - remove whitespace

* conference_controls

* conference_profiles

* conference_profiles

* Delete core/websockets/resources/classes/socket_exception.php.original~

* Delete core/websockets/resources/classes/websocket_server.php.original~

* conferences

* destinations

* device

* dialplan

* email_queue

* event_guard

* extension_settings

* extension

* fax

* fax_queue

* fifo

* gateways

* ivr_menu

* modules

* switch_music_on_hold

* number_translations

* phrases

* pin_numbers

* provision

* switch_recordings

* registrations

* ring_groups

* sip_profiles

* sofia_global_settings

* streams

* presence

* switch_files

* time_conditions

* vars

* voicemail_greetings

* voicemail

* ringbacks

* contacts

* xml_cdr

* authentication

* dashboard

* default_settings

* domain_settings

* email_templates

* permission

* user_logs

* user_settings

* users

* button

* cache

* captcha

* remove cli_option

* remove directory.php for switch_directory class

* email

* file

* groups

* event_socket use config object

* Use intval to give an integer port

* switch_settings

* tones

* fix object used before initialization

* menu

* fix copy paste error for switch_files.php

* always include require.php for framework files

* Fix missing properties

* set the action

* Use the $database object

* Add missing class properties

* Fix the domain_name

* Use public scope for domain_uuid and domain_name

* Add missing parameters

* Correct the user_uuid parameter

* Add json_validate and use it in the dashboard
update indentation on functions.php

* Intialize the active_registrations variable

* Define the $parameters

* Set a default value for user_setting_enabled

* Add condition domain_uuid not empty

* Add not empty condition for domain_uuid

* Declare the global variables

* Update how the defaults are set use ??

* Use ?? to set the default values

* Update call_center_queue_edit.php

* Prevent an error

* Add domain_name property

* Fix the null coalescing operator

* Removed domain_uuid from the URL

* Change condition to check sip_profile_domain_name

* Refactor domain_uuid declaration and comments

Removed redundant domain_uuid declaration and updated comments.

* Account for an empty value

* Refactor constructor to use settings array

Updated constructor to accept settings array for domain UUID and database initialization.

* Refactor xml_cdr.php to improve variable organization

Removed duplicate domain_uuid declaration and reorganized private variables for better structure.

* Enhance transcription button logic and icon display

Updated transcription button visibility conditions and improved application icon handling in the call flow summary.

* Refactor settings initialization in domains.php

Updated settings initialization to include domain_uuid and user_uuid.

* Modify domain change condition in require.php

Updated condition to check if 'domain_change' is not empty before proceeding.

* Set default_setting_enabled to true by default

* Enhance domain UUID check in access controls

* Enhance domain UUID check in settings list

* Refactor category display logic in vars.php

* Simplify list row URL generation

Removed domain UUID check from list row URL construction.

* Refactor module category display logic

* Fix SQL query by removing parameters variable

* Initialize result_count variable for call recordings

* Refactor leg variable usage in xml_cdr_details.php

* Update conference_room_edit.php

* Change GET to REQUEST for order and search variables

* Set timezone and SQL time format in recordings.php

Added timezone and SQL time format settings.

* Set default for ring group greeting

* Improve domain UUID check in stream listing

* Handle null voicemail_option_param safely

* Add file existence check for greeting files

Check if greeting file exists before getting size and date.

* Improve domain UUID check in email templates

* Update FIFO strategy dropdown and description text

* Add multilingual agent descriptions

Added multilingual descriptions for agents in the app_languages.php file.

* Add music on hold descriptions

* Add the chime list description

Updated copyright year from 2024 to 2025.

* Fix domain UUID check and handle email subject decoding

* Add null coalescing for $value in email_test.php

Ensure $value is not null by providing a default empty string.

* Handle undefined dialplan_uuid in input field

* Add translations for 'Status' label in multiple languages

* Fix typo in config instance check

---------

Co-authored-by: frytimo <tim@fusionpbx.com>
2025-10-15 21:24:59 -06:00
frytimo
c4e63c2562 Do not create a new socket when one is provided (#7358)
Check that the current socket in the object is false before trying to create a new socket
2025-04-25 10:38:43 -06:00
frytimo
2cbb4dbc31 remove instances where a pointer is used in a foreach loop for value (#7108) 2024-08-22 12:41:10 -06:00
frytimo
9f204a7cac move explode of $line inside of if block to fix php warning for line 93 (#6842) 2023-12-07 18:38:57 -07:00
frytimo
3a4c2f72e2 Event socket bug fix and more docs (#6823)
* Add documentation to methods. Use is_resource for added type detection

* Allow connect to specify timeout in microseconds with default 30,000

* Update calling mechanism for event sockets

* Update project for new singleton event sockets

* remove unused variable

* catch errors on closing the socket
2023-12-02 17:16:18 -07:00
FusionPBX
7ab357380b simplify the while statement 2023-09-27 23:30:18 -06:00
FusionPBX
bf8c6f8078 Simplify event_socket code 2023-09-27 23:23:56 -06:00
FusionPBX
bf47bbcc47 Event Socket settings auto defaults or custom using config.conf 2023-09-16 15:07:41 -06:00
FusionPBX
88b43cfa14 If no handle return false
Splitting up the condition and return false for each condition works in all tests.
2022-10-20 16:18:55 -06:00
FusionPBX
0a25c48b5d event socket make fp public 2022-10-13 12:52:52 -06:00
FusionPBX
58d0a1ad8c Make sure resource exists before using feof
This code changes prevents this error.

Warning: feof() expects parameter 1 to be resource, bool given
2022-10-13 11:26:53 -06:00
FusionPBX
4d8496f4ad Fix the event socket connected method
It was not detecting the connection to event socket correctly. 
This change resolve the high cpu usage for event guard.
2022-10-04 12:36:27 -06:00
FusionPBX
a43388bace Increase the timeout to 30000 microseconds.
30,000 Microseconds = 0.03 Seconds. Longer timeout reduces the CPU. If the timeout is too long then the Status -> SIP STATUS page will take longer to load.
2022-08-27 16:45:07 -06:00
frytimo
09dbdfb79f Removed usleep command (#6468)
* Removed usleep command

* Update event_socket.php
2022-08-26 16:53:25 -06:00
FusionPBX
b8f1eb7f10 Add function to check if we are connected to event soscket 2022-08-26 11:48:47 -06:00
FusionPBX
7a71f0bf0a Less CPU used to listen to event socket. 2022-07-31 10:15:42 -06:00
FusionPBX
fe099e4dfb Update event_socket.php 2022-02-14 14:08:46 -07:00
FusionPBX
2e62e0316b Set this value to 20.
Improves page load times for pages using event socket.
2022-02-14 11:55:10 -07:00
FusionPBX
7c6ed79d6c usleep 1 million is 1 second 2021-11-26 21:30:39 -07:00
FusionPBX
7c3675107d Update event_socket.php 2019-09-24 18:14:43 -06:00
chansizzle
16e08250bf Update event_socket.php (#4652)
removes potential "Warning: fsockopen(): unable to connect to 127.0.0.1:8021 (Connection refused)"
2019-09-24 16:40:31 -06:00
FusionPBX
95c36e4d35 Update event_socket.php 2017-01-11 14:43:45 -07:00
FusionPBX
da9cd4cbcf Update event_socket.php
Add freeswitch defaults to event_socket.php
2017-01-11 14:14:47 -07:00
Harry G. Coin
cc553a70c5 Cleanups.
Remove default 192.168.42.42/32 allow.
Restore missing app/fax/resources/functions/parse_attachments.php to satisfy pre-existing include
Fix so sql in voicemail app works if var undefined.  Warning: don't know if non Mariadb's like cast(...) .
Cleanup close in event socket.
2016-04-25 22:16:19 -05:00
Harry G. Coin
bda6861f88 \r\n --> \n
Cause all the .php files containing lines ending with \r\n to instead end with \n.

DYI with:

find fusionpbx -type f -name '*.php' -exec dos2unix '{}' \;
2016-04-25 20:30:23 -05:00
Harry G. Coin
8abe003a71 The goal is to increase confidence in fusionpbx, one step is to run by default with error_reporting (E_ALL ^ E_NOTICE);
So, please find in this set numerous small changes which eliminate numerous php warning messages.

Also, a small bug fix in an sql statistics routine, naming a count(*) field as count, so displaying correct detail.

If any of the proposed changes are omitted, the relevant page will experience php warnings.

There are no doubt fusionpbx pages I've yet to visit that still generate warnings, this set is nearly certainly not comprehensive.
2016-04-25 20:19:58 -05:00
markjcrane
b5fbf389dd Change the switch class to freeswitch. 2016-04-02 19:37:37 -06:00
markjcrane
637a3fadb5 Rename the EventSocket file to math current naming standard. 2016-04-02 19:24:32 -06:00