<!-- Kamailio Pull Request Template -->
<!-- IMPORTANT: - for detailed contributing guidelines, read: https://github.com/kamailio/kamailio/blob/master/.github/CONTRIBUTING.md - pull requests must be done to master branch, unless they are backports of fixes from master branch to a stable branch - backports to stable branches must be done with 'git cherry-pick -x ...' - code is contributed under BSD for core and main components (tm, sl, auth, tls) - code is contributed GPLv2 or a compatible license for the other components - GPL code is contributed with OpenSSL licensing exception -->
#### 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) - [ ] 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) - [ ] 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 - [ ] Tested changes locally - [ ] Related to issue #XXXX (replace XXXX with an open issue number)
#### Description <!-- Describe your changes in detail -->
- add `event_callback` KEMI param like in other modules - expose `KSR.nats.publish`
I can fix module doc if it looks good. How to generate docs locally btw?
You can view, comment on, or merge this pull request online at:
https://github.com/kamailio/kamailio/pull/3154
-- Commit Summary --
* nats: add KEMI publish function and event_callback param
-- File Changes --
M src/modules/nats/defs.h (3) M src/modules/nats/nats_mod.c (88) M src/modules/nats/nats_mod.h (3) M src/modules/nats/nats_pub.c (5) M src/modules/nats/nats_pub.h (1)
-- Patch Links --
https://github.com/kamailio/kamailio/pull/3154.patch https://github.com/kamailio/kamailio/pull/3154.diff
@seven1240 generate locally - see here http://www.kamailio.org/wiki/devel/module-docbook-readme
@seven1240 pushed 1 commit.
de914794694fb8093b9d43e4bca3fc0487658bec nats: update doc, add event_callback parameter
I updated the doc and squashed into one commit.
@eschmidbauer: any comments on this PR?
@eschmidbauer commented on this pull request.
@@ -73,39 +79,36 @@ static void onMsg(
natsConnection *nc, natsSubscription *sub, natsMsg *msg, void *closure) { nats_on_message_ptr on_message = (nats_on_message_ptr)closure; - char *s = (char *)natsMsg_GetSubject(msg); + // char *s = (char *)natsMsg_GetSubject(msg);
can we remove this comment?
@eschmidbauer commented on this pull request.
}
fmsg = faked_msg_next(); memcpy(&tmsg, fmsg, sizeof(sip_msg_t)); fmsg = &tmsg; set_route_type(EVENT_ROUTE); init_run_actions_ctx(&ctx); - run_top_route(event_rt.rlist[rt], fmsg, 0); + if (rt < 0 && keng) { + if (sr_kemi_route(keng, fmsg, EVENT_ROUTE, + &nats_event_callback, evname) < 0) { + LM_ERR("error running event route kemi callback\n"); + } + } else { + run_top_route(event_rt.rlist[rt], fmsg, 0); + }
``` if (rt < 0 && keng) { if (sr_kemi_route(keng, fmsg, EVENT_ROUTE, &nats_event_callback, evname) < 0) { LM_ERR("error running event route kemi callback\n"); } return 0; }
run_top_route(event_rt.rlist[rt], fmsg, 0); return 0; ```
@eschmidbauer commented on this pull request.
@@ -30,6 +30,7 @@
#include "../json/api.h" #include "../../core/cfg/cfg_struct.h" #include "../../core/fmsg.h" +// #include "../../core/str.h"
can we remove this commented code ?
@eschmidbauer approved this pull request.
a few minor comments - otherwise looks good. thank you!
Thanks. updated as suggested and squashed and rebased to the latest master.
I see @eschmidbauer approved the changes, therefore I merge it.
Merged #3154 into master.