Module: kamailio
Branch: master
Commit: fa3cf27abf1f76ef90941f47ef81adef4ffae68e
URL:
https://github.com/kamailio/kamailio/commit/fa3cf27abf1f76ef90941f47ef81ade…
Author: Bastian Triller <bastian.triller(a)gmail.com>
Committer: Henning Westerholt <hw(a)gilawa.com>
Date: 2022-05-02T16:42:35+02:00
pua_dialoginfo: Determine dialog event types in mod_init
Determine dialog event types for dialog callback on module
initialization, since these will not change.
---
Modified: src/modules/pua_dialoginfo/pua_dialoginfo.c
---
Diff:
https://github.com/kamailio/kamailio/commit/fa3cf27abf1f76ef90941f47ef81ade…
Patch:
https://github.com/kamailio/kamailio/commit/fa3cf27abf1f76ef90941f47ef81ade…
---
diff --git a/src/modules/pua_dialoginfo/pua_dialoginfo.c
b/src/modules/pua_dialoginfo/pua_dialoginfo.c
index 7b27e666c5..2dae4d449b 100644
--- a/src/modules/pua_dialoginfo/pua_dialoginfo.c
+++ b/src/modules/pua_dialoginfo/pua_dialoginfo.c
@@ -101,6 +101,7 @@ int disable_callee_publish_flag = DEF_DISABLE_CALLEE_PUBLISH_FLAG;
char * pubruri_caller_avp = DEF_PUBRURI_CALLER_AVP;
char * pubruri_callee_avp = DEF_PUBRURI_CALLEE_AVP;
int publish_dialog_req_within = DEF_PUBLISH_DIALOG_REQ_WITHIN;
+int dialog_event_types = DLGCB_FAILED| DLGCB_CONFIRMED_NA | DLGCB_TERMINATED |
DLGCB_EXPIRED | DLGCB_EARLY;
int puadinfo_attribute_display = 0;
@@ -622,25 +623,12 @@ struct dlginfo_cell* get_dialog_data(struct dlg_cell *dlg, int type,
int disable
}
/* register dialog callbacks which triggers sending PUBLISH */
- if (publish_dialog_req_within) {
- if (dlg_api.register_dlgcb(dlg,
- DLGCB_FAILED| DLGCB_CONFIRMED_NA | DLGCB_TERMINATED
- | DLGCB_EXPIRED | DLGCB_REQ_WITHIN | DLGCB_EARLY,
- __dialog_sendpublish, dlginfo, free_dlginfo_cell) != 0) {
- LM_ERR("cannot register callback for interesting dialog types\n");
- free_dlginfo_cell(dlginfo);
- return NULL;
- }
- } else {
- if (dlg_api.register_dlgcb(dlg,
- DLGCB_FAILED| DLGCB_CONFIRMED_NA | DLGCB_TERMINATED
- | DLGCB_EXPIRED | DLGCB_EARLY,
- __dialog_sendpublish, dlginfo, free_dlginfo_cell) != 0) {
- LM_ERR("cannot register callback for interesting dialog types\n");
- free_dlginfo_cell(dlginfo);
- return NULL;
- }
- }
+ if (dlg_api.register_dlgcb(dlg, dialog_event_types,
+ __dialog_sendpublish, dlginfo, free_dlginfo_cell) != 0) {
+ LM_ERR("cannot register callback for interesting dialog types\n");
+ free_dlginfo_cell(dlginfo);
+ return NULL;
+ }
#ifdef PUA_DIALOGINFO_DEBUG
/* dialog callback testing (registered last to be executed first) */
@@ -856,6 +844,9 @@ static int mod_init(void)
LM_DBG("configured to use headers for uri values\n");
}
+ if(publish_dialog_req_within)
+ dialog_event_types |= DLGCB_REQ_WITHIN;
+
return 0;
}