From fe3e51e2688157bd1f1ed07586e0f163b0329172 Mon Sep 17 00:00:00 2001 From: Kirill Solomko Date: Mon, 19 Oct 2020 19:14:49 +0200 Subject: [PATCH] TT#97750 add kamailio.v_subscriber_devices * this new view accumulates possible auth data containing both subscrber usernames and devices (aliases with is_devid=1) * this view is used in subscriber auth and the proxy code to fetch registered devices not only by subscriber username but also by the device Change-Id: Ic4e2596ad461c70acf34cf75a2590640813ec2ca --- db_scripts/diff/15640.down | 6 ++++++ db_scripts/diff/15640.up | 12 ++++++++++++ 2 files changed, 18 insertions(+) create mode 100644 db_scripts/diff/15640.down create mode 100644 db_scripts/diff/15640.up diff --git a/db_scripts/diff/15640.down b/db_scripts/diff/15640.down new file mode 100644 index 00000000..815807bc --- /dev/null +++ b/db_scripts/diff/15640.down @@ -0,0 +1,6 @@ +USE kamailio; +SET autocommit=0; + +DROP VIEW v_subscriber_devices; + +COMMIT; diff --git a/db_scripts/diff/15640.up b/db_scripts/diff/15640.up new file mode 100644 index 00000000..a01d51e0 --- /dev/null +++ b/db_scripts/diff/15640.up @@ -0,0 +1,12 @@ +USE kamailio; +SET autocommit=0; + +CREATE VIEW v_subscriber_devices as + SELECT s.username, s.domain, s.uuid, s.password, 0 as is_devid, NULL as devid_alias + FROM subscriber s + UNION DISTINCT + SELECT d.alias_username as username, d.alias_domain as domain, s.uuid, s.password, d.is_devid, d.devid_alias + FROM subscriber s + JOIN dbaliases d on d.username = s.username and d.domain = s.domain and is_devid = 1; + +COMMIT;