Module: kamailio
Branch: master
Commit: 5197e7b41dd5d08451b7a7906177fc04e1c3ce8b
URL:
https://github.com/kamailio/kamailio/commit/5197e7b41dd5d08451b7a7906177fc0…
Author: Jake Greene <jacobgreene1991(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2023-06-12T11:49:27+02:00
presence: Add htable_db_restore RPC command.
- Introduced `htable_db_restore` RPC command to load updates from the
'presentity' table into the 'publ_cache' specifically for
'publ_cache' modes 1 or 2.
- update docs for htable_db_restore RPC command
---
Modified: src/modules/presence/doc/presence_admin.xml
Modified: src/modules/presence/presence.c
---
Diff:
https://github.com/kamailio/kamailio/commit/5197e7b41dd5d08451b7a7906177fc0…
Patch:
https://github.com/kamailio/kamailio/commit/5197e7b41dd5d08451b7a7906177fc0…
---
diff --git a/src/modules/presence/doc/presence_admin.xml
b/src/modules/presence/doc/presence_admin.xml
index dbad0acf65a..41546d87d5b 100644
--- a/src/modules/presence/doc/presence_admin.xml
+++ b/src/modules/presence/doc/presence_admin.xml
@@ -1284,6 +1284,27 @@ pres_update_watchers("sip:test@kamailio.org",
"presence");
...
</programlisting>
</section>
+
+<section>
+ <section id="presence.r.htable_db_restore">
+ <title>presence.htable_db_restore</title>
+ <para>
+ Manually apply changes to the presenity table to the publ_cache.
+ </para>
+ <para>
+ Name: <emphasis>presence.htable_db_restore</emphasis>
+ </para>
+ <para>Parameters: <emphasis>none</emphasis></para>
+ <para>
+ RPC Command Format:
+ </para>
+ <programlisting format="linespecific">
+...
+&kamcmd; presence.htable_db_restore
+...
+</programlisting>
+ </section>
+
<section id="presence.r.refreshWatchers">
<title>presence.refreshWatchers</title>
<para>
diff --git a/src/modules/presence/presence.c b/src/modules/presence/presence.c
index 254315aebbb..bb4fc98a66c 100644
--- a/src/modules/presence/presence.c
+++ b/src/modules/presence/presence.c
@@ -1854,6 +1854,20 @@ static const char *rpc_presence_cleanup_doc[3] = {
"presentity, and watchers tables.",
0};
+
+void rpc_presence_htable_db_restore(rpc_t *rpc, void *c)
+{
+ LM_DBG("Restoring presence publ cache from database.\n");
+ pres_htable_db_restore();
+ return;
+}
+
+static const char *rpc_presence_htable_db_restore_doc[4] = {
+ "Sync publ_cache from database. Syncs changes made to presentity table with the
publ_cache.",
+ 0
+};
+
+
/*! \brief
* Build the rpc response for listing presentity records
* - imode - output attributes control
@@ -2119,6 +2133,8 @@ static const char *rpc_presence_watcher_list_doc[2] = {
rpc_export_t presence_rpc[] = {
+ {"presence.htable_db_restore", rpc_presence_htable_db_restore,
+ rpc_presence_htable_db_restore_doc, 0},
{"presence.cleanup", rpc_presence_cleanup, rpc_presence_cleanup_doc, 0},
{"presence.refreshWatchers", rpc_presence_refresh_watchers,
rpc_presence_refresh_watchers_doc, 0},