#### Pre-Submission Checklist <!-- Go over all points below, and after creating the PR, tick all the checkboxes that apply --> <!-- All points should be verified, otherwise, read the CONTRIBUTING guidelines from above--> <!-- If you're unsure about any of these, don't hesitate to ask on sr-dev mailing list --> - [x] Commit message has the format required by CONTRIBUTING guide - [x] Commits are split per component (core, individual modules, libs, utils, ...) - [x] Each component has a single commit (if not, squash them into one commit) - [x] No commits to README files for modules (changes must be done to docbook files in `doc/` subfolder, the README file is autogenerated)
#### Type Of Change - [ ] Small bug fix (non-breaking change which fixes an issue) - [x] New feature (non-breaking change which adds new functionality) - [ ] Breaking change (fix or feature that would change existing functionality)
#### Checklist: <!-- Go over all points below, and after creating the PR, tick the checkboxes that apply --> - [ ] PR should be backported to stable branches - [x] Tested changes locally - [ ] Related to issue #XXXX (replace XXXX with an open issue number)
#### Description Needed a way to sync the publ_cache with changes made to the presentity table when using publ_cache modes 1 or 2. This seems pretty simple, and works for me.
Beneficial when adding numerous "message-summary" event entries from an external Voicemail application to the 'presentity' table.
Usage: `kamcmd presence.htable_db_restore` You can view, comment on, or merge this pull request online at:
https://github.com/kamailio/kamailio/pull/3462
-- Commit Summary --
* presence: Add htable_db_restore RPC command.
-- File Changes --
M src/modules/presence/doc/presence_admin.xml (21) M src/modules/presence/presence.c (16)
-- Patch Links --
https://github.com/kamailio/kamailio/pull/3462.patch https://github.com/kamailio/kamailio/pull/3462.diff
The name "htable" usually refers to the "htable" module. Can you find another name to avoid confusion? Thanks!
@oej commented on this pull request.
@@ -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.
"presenity" miss-spelled. "publ_cache" - isn't that a code name? Can you express it in normal language?
@oej commented on this pull request.
@@ -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");
Don't abbreviate when you don't need. "publ" should be a full word
@oej commented on this pull request.
@@ -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();
This functions returns -1 on errors and you need to catch that and return a proper return code on success and errors.
@false-vacuum pushed 1 commit.
ec181f8519eec6c054c76135dd4a85b672bb305e Merge branch 'kamailio:master' into master
@false-vacuum pushed 1 commit.
67cd93c8c404f7e6dbc19c04bb6e1878ec9e0a40 Presence: semantical improvments to docs & rpc command name
@oej What do you think about these changes?
@oej commented on this pull request.
@@ -1854,6 +1854,22 @@ static const char *rpc_presence_cleanup_doc[3] = {
"presentity, and watchers tables.", 0};
+ +void rpc_presence_publish_cache_sync(rpc_t *rpc, void *ctx) +{ + LM_DBG("Synchronizing presentity table with the publish cache.\n"); + if (pres_htable_db_restore() == -1 ) { + rpc->fault(ctx, 500, "Failed to sync presinity table with the publish cache.");
Add a positive answer too, 200
@oej What do you think about these changes?
Looking good. Thank you for the updates. Added a minor thing. RPC calls should always respond with OK or an error. It's not always the case in old code, but we're trying to fix that.
@false-vacuum pushed 1 commit.
cd6a2f3d04ad0ef297f238994121bc2a65a2abfb presence: Add OK response to publish_cache_sync RPC command.
@oej Thanks so much for helping me with this! I just made the changes you requested. Let me know what you think.
Merged #3462 into master.