Comments (2)
Add the following columns and indexes ( MySQL ) to your sip_capture table :
resu_ot
varchar(100) NOT NULL DEFAULT '',
resu_morf
varchar(100) NOT NULL DEFAULT '',
KEY resu_morf
(resu_morf
),
KEY resu_ot
(resu_ot
)
Run the following in your database :
DELIMITER |
Create Trigger reverse_field
Before insert on sip_capture
FOR EACH ROW
BEGIN
set NEW.resu_ot = reverse( NEW.to_user);
set NEW.resu_morf = reverse( NEW.from_user );
END;
|
DELIMITER ;
And apply the following patch :
diff --git a/webhomer/DataTable/sip/SipSearchService.php b/webhomer/DataTable/sip/SipSearchService.php
index e41ec68..0e41f53 100644
--- a/webhomer/DataTable/sip/SipSearchService.php
+++ b/webhomer/DataTable/sip/SipSearchService.php
@@ -129,7 +131,15 @@ class SipSearchService implements ISipService
if(!isset($callwhere)) $callwhere = "(";
if($key == "callid" && $b2b ) $callwhere.=" (";
-
if ( in_array( $key, arraY('from_user', 'to_user' )) && $value[0] === '%' )
-
{
-
$key = strrev( $key );
-
$value = strrev( $value );
-
}
- $eqlike = preg_match("/%/", $value) ? " like " : " = ";
if(preg_match("/^!/", $value)) { $value = preg_replace("/^!/", "", $value);
Here is the patch as a base64 :
ZGlmZiAtLWdpdCBhL3dlYmhvbWVyL0RhdGFUYWJsZS9zaXAvU2lwU2VhcmNoU2VydmljZS5waHAg
Yi93ZWJob21lci9EYXRhVGFibGUvc2lwL1NpcFNlYXJjaFNlcnZpY2UucGhwCmluZGV4IGU0MWVj
NjguLjBlNDFmNTMgMTAwNjQ0Ci0tLSBhL3dlYmhvbWVyL0RhdGFUYWJsZS9zaXAvU2lwU2VhcmNo
U2VydmljZS5waHAKKysrIGIvd2ViaG9tZXIvRGF0YVRhYmxlL3NpcC9TaXBTZWFyY2hTZXJ2aWNl
LnBocApAQCAtMTI5LDcgKzEzMSwxNSBAQCBjbGFzcyBTaXBTZWFyY2hTZXJ2aWNlIGltcGxlbWVu
dHMgSVNpcFNlcnZpY2UKIAkgICBpZighaXNzZXQoJGNhbGx3aGVyZSkpICRjYWxsd2hlcmUgPSAi
KCI7CiAJICAgaWYoJGtleSA9PSAiY2FsbGlkIiAmJiAkYjJiICkgJGNhbGx3aGVyZS49IiAoIjsK
IAorICAgICAgICBpZiAoIGluX2FycmF5KCAka2V5LCBhcnJhWSgnZnJvbV91c2VyJywgJ3RvX3Vz
ZXInICkpICYmICR2YWx1ZVswXSA9PT0gJyUnICkKKyAgICAgICAgeworICAgICAgICAgICAgICRr
ZXkgPSBzdHJyZXYoICRrZXkgKTsKKyAgICAgICAgICAgICAkdmFsdWUgPSBzdHJyZXYoICR2YWx1
ZSApOworICAgICAgICB9CisKIAkgICAkZXFsaWtlID0gcHJlZ19tYXRjaCgiLyUvIiwgJHZhbHVl
KSA/ICIgbGlrZSAiIDogIiA9ICI7CiAgICAgIAogICAgICAgICAgICBpZihwcmVnX21hdGNoKCIv
XiEvIiwgJHZhbHVlKSkgewogICAgICAgICAgICAgICAgJHZhbHVlID0gIHByZWdfcmVwbGFjZSgi
L14hLyIsICIiLCAkdmFsdWUpOwo=
On the tested machine, the search time for a query prefixed with % took several minutes. With the patch, it took less than 2 seconds. Test machine had 70,000,000 rows in the table.
from homer.
Thanks for the patch, but we couldn't accept it.
first, you should understand if you use % (wildcard) as prefix, mysql don't use index at all and make full scan on the table/tables and of course it takes a lot time (depends how much records you have).
second, to avoid such behavior, better use predefined prefixes and MYSQL SQL query with "IN (array)" i.e. (123456 will search +123456, 00123456, 023456 etc)
such query will use index and will be more effective than use reverse value and create additional two indexes.
btw, please use Homer5. There we use more effective sql schema and design.
from homer.
Related Issues (20)
- HOMER7/Captagent truncated message data HOT 3
- Promtheus - Query values change after defining PromTargetName & PromTargetIP HOT 4
- Incorrect "Session Duration Time" HOT 6
- homer-webapp inclusion HOT 3
- New SIP Source HOT 4
- Problem installing Homer 10 HOT 8
- custom header "id" HOT 1
- Homer7 - dashboards broken for all users - "/api/v3/*" HTTP 400 HOT 2
- Docker homer and X-CID HOT 1
- Install on RHEL 9 HOT 3
- Docker 10 Install Error qryn container is unhealthy HOT 6
- homer UI only displaying 200 records HOT 5
- unable to see any invite in homer dashboard HOT 1
- Homer7 sometimes don´t collect media stream info HOT 1
- Heplify-server doesn't insert HEP packets from Kamailio siptrace HOT 4
- 400 bad request returned by UI HOT 1
- Homer 10 - Call Flow - Sorting Issues/Wrong Order HOT 19
- homer-app fails to start (code=exited, status=2) HOT 4
- Web UI possiility to reset password on first sign-in and maybe delete support user HOT 1
- iptables-persistent and Homer problem ? HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from homer.