<!-- 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) - [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 - [x] Related to issue #2996
#### Description closes #2996
You can view, comment on, or merge this pull request online at:
https://github.com/kamailio/kamailio/pull/3003
-- Commit Summary --
* presence: added default_expires parameter * presence_conference: use parameter presence/default_expires instead of 3600 constant * presence_dialoginfo: use parameter presence/default_expires instead of 3600 constant * presence_mwi: use parameter presence/default_expires instead of 3600 constant * presence_profile: use parameter presence/default_expires instead of 3600 constant * presence_reginfo: use parameter presence/default_expires instead of 3600 constant * presence_xml: use parameter presence/default_expires instead of 3600 constant
-- File Changes --
M src/modules/presence/doc/presence_admin.xml (22) M src/modules/presence/presence.c (6) M src/modules/presence/presence.h (1) M src/modules/presence_conference/add_events.c (14) M src/modules/presence_dialoginfo/add_events.c (12) M src/modules/presence_mwi/add_events.c (12) M src/modules/presence_profile/add_events.c (13) M src/modules/presence_reginfo/add_events.c (12) M src/modules/presence_xml/add_events.c (19)
-- Patch Links --
https://github.com/kamailio/kamailio/pull/3003.patch https://github.com/kamailio/kamailio/pull/3003.diff
@lnicola commented on this pull request.
#include "../presence/event_list.h"
#include "presence_conference.h" #include "notify_body.h"
int conference_add_events(void) -{ +{
```suggestion { ```
@lnicola commented on this pull request.
@@ -43,7 +53,7 @@ int conference_add_events(void)
event.content_type.s = "application/conference-info+xml"; event.content_type.len = 31;
- event.default_expires= 3600; + event.default_expires= pres_default_expires;
```suggestion event.default_expires = pres_default_expires; ```
@lnicola commented on this pull request.
@@ -43,7 +53,7 @@ int dlginfo_add_events(void)
event.content_type.s = "application/dialog-info+xml"; event.content_type.len = 27;
- event.default_expires= 3600; + event.default_expires= pres_default_expires;
```suggestion event.default_expires = pres_default_expires; ```
@lnicola commented on this pull request.
@@ -124,7 +134,7 @@ int mwi_add_events(void)
event.content_type.s = "application/simple-message-summary"; event.content_type.len = 34;
- event.default_expires= 3600; + event.default_expires= pres_default_expires;
```suggestion event.default_expires = pres_default_expires; ```
@lnicola commented on this pull request.
event.content_type.s = "text/xml";
event.content_type.len = 8;
- event.default_expires= 3600; + event.default_expires= pres_default_expires;
```suggestion event.default_expires = pres_default_expires; ```
@lnicola commented on this pull request.
/* constructing message-summary event */
memset(&event, 0, sizeof(pres_ev_t)); event.name.s = "reg"; event.name.len = 3;
event.content_type.s = "application/reginfo+xml"; event.content_type.len = 23; - event.default_expires= 3600; + event.default_expires= pres_default_expires;
```suggestion event.default_expires = pres_default_expires; ```
@lnicola commented on this pull request.
@@ -49,6 +51,15 @@ int xml_add_events(void)
{ pres_ev_t event;
+ /* read default expires from presence, if exists */ + int pres_default_expires = 3600; + modparam_t type = 0; + int *param = find_param_export(find_module_by_name("presence"), "default_expires", INT_PARAM, &type); + if ( param && (type == INT_PARAM) )
```suggestion if(param && type == INT_PARAM) ```
@lnicola commented on this pull request.
#include "../presence/event_list.h"
#include "presence_reginfo.h"
int reginfo_add_events(void) { pres_ev_t event;
+ /* read default expires from presence, if exists */ + int pres_default_expires = 3600; + modparam_t type = 0; + int *param = find_param_export(find_module_by_name("presence"), "default_expires", INT_PARAM, &type); + if ( param && (type == INT_PARAM) )
```suggestion if(param && type == INT_PARAM) ```
@lnicola commented on this pull request.
@@ -40,16 +41,24 @@ int profile_add_events(void)
{ pres_ev_t event;
+ /* read default expires from presence, if exists */ + int pres_default_expires = 3600; + modparam_t type = 0; + int *param = find_param_export(find_module_by_name("presence"), "default_expires", INT_PARAM, &type); + if ( param && (type == INT_PARAM) )
```suggestion if(param && type == INT_PARAM) ```
@lnicola commented on this pull request.
@@ -116,6 +117,15 @@ int mwi_add_events(void)
{ pres_ev_t event;
+ /* read default expires from presence, if exists */ + int pres_default_expires = 3600; + modparam_t type = 0; + int *param = find_param_export(find_module_by_name("presence"), "default_expires", INT_PARAM, &type); + if ( param && (type == INT_PARAM) )
```suggestion if(param && type == INT_PARAM) ```
@lnicola commented on this pull request.
@@ -35,6 +36,15 @@ int dlginfo_add_events(void)
{ pres_ev_t event;
+ /* read default expires from presence, if exists */ + int pres_default_expires = 3600; + modparam_t type = 0; + int *param = find_param_export(find_module_by_name("presence"), "default_expires", INT_PARAM, &type); + if ( param && (type == INT_PARAM) )
```suggestion if(param && type == INT_PARAM) ```
@lnicola commented on this pull request.
pres_ev_t event;
+ /* read default expires from presence, if exists */ + int pres_default_expires = 3600; + modparam_t type = 0; + int *param = find_param_export(find_module_by_name("presence"), "default_expires", INT_PARAM, &type); + if ( param && (type == INT_PARAM) )
```suggestion if(param && type == INT_PARAM) ```
@adita76: every module (that needs it) has to get its own parameter, not to lookup the parameter from another module. That's not how usual is done and each module can do some internal optimization to its parameters, so in long term might create hidden issues.
@lnicola: probably the modules' code just need to be run through clang-format.
Being a parameter with very simple functionality, I thought it would be easier to use it once than having to configure one for each module. I'll create one per module, if that's the usual way.
@adita76 pushed 6 commits.
2758136a1683d55e4bd76893e2581219c795ad2c presence_conference: use parameter default_expires instead of 3600 constant ae393ffc0b636cfadff3cdb8b658ed42431261f3 presence_dialoginfo: use parameter default_expires instead of 3600 constant 41faed6a8b36b0280dfa63e54ede0b92b4135d73 presence_mwi: use parameter default_expires instead of 3600 constant 001cf4961fec3881efbdf121f907269b2a82193f presence_profile: use parameter default_expires instead of 3600 constant 18e08d931b735defb86638d4157a5075bee226ba presence_reginfo: use parameter default_expires instead of 3600 constant ae4de063f3f568438ede4e909c391ecd509ffd36 presence_xml: use parameter default_expires instead of 3600 constant
@adita76 pushed 6 commits.
7bc490bfeb8e626a8203dee3396553e426256e4e presence_conference: use parameter default_expires instead of 3600 constant 8297df39568a956b393897e48426b165986d3a40 presence_dialoginfo: use parameter default_expires instead of 3600 constant 5954ff9ca1a3d340408258dff0aa7901df2aa59c presence_mwi: use parameter default_expires instead of 3600 constant fe1c2b0030a36accf9c5aee9a83166d1e7aa204f presence_profile: use parameter default_expires instead of 3600 constant 46b2aa90e71c54d74a87019ba8bcbbd0a1c04636 presence_reginfo: use parameter default_expires instead of 3600 constant e771b1e96d97eafdae640fa79a4d0802db3511ef presence_xml: use parameter default_expires instead of 3600 constant
Thanks! Modules are for different purposes and each event can be with its own expire settings.
Merged #3003 into master.