Module: kamailio
Branch: master
Commit: b8ab9fcccd442e9e9ac887a7dc16b690213a6e28
URL:
https://github.com/kamailio/kamailio/commit/b8ab9fcccd442e9e9ac887a7dc16b69…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2017-07-04T11:11:41+02:00
dialog: lookup kemi engine for event route execution
---
Modified: src/modules/dialog/dlg_handlers.c
Modified: src/modules/dialog/dlg_profile.c
---
Diff:
https://github.com/kamailio/kamailio/commit/b8ab9fcccd442e9e9ac887a7dc16b69…
Patch:
https://github.com/kamailio/kamailio/commit/b8ab9fcccd442e9e9ac887a7dc16b69…
---
diff --git a/src/modules/dialog/dlg_handlers.c b/src/modules/dialog/dlg_handlers.c
index eb5d41ceac..c4218be50a 100644
--- a/src/modules/dialog/dlg_handlers.c
+++ b/src/modules/dialog/dlg_handlers.c
@@ -1550,6 +1550,7 @@ void dlg_ontimeout(struct dlg_tl *tl)
if(dlg->toroute>0) {
run_top_route(main_rt.rlist[dlg->toroute], fmsg, 0);
} else {
+ keng = sr_kemi_eng_get();
if(keng!=NULL) {
evname.s = "dialog:timeout";
evname.len = sizeof("dialog:timeout") - 1;
@@ -1703,22 +1704,28 @@ int dlg_run_event_route(dlg_cell_t *dlg, sip_msg_t *msg, int
ostate, int nstate)
if(dlg_event_callback.s==NULL || dlg_event_callback.len<=0) {
if(nstate==DLG_STATE_CONFIRMED_NA) {
rt = dlg_event_rt[DLG_EVENTRT_START];
+ } else if(nstate==DLG_STATE_DELETED) {
+ if(ostate==DLG_STATE_CONFIRMED || ostate==DLG_STATE_CONFIRMED_NA) {
+ rt = dlg_event_rt[DLG_EVENTRT_END];
+ } else if(ostate==DLG_STATE_UNCONFIRMED || ostate==DLG_STATE_EARLY) {
+ rt = dlg_event_rt[DLG_EVENTRT_FAILED];
+ }
+ }
+ if(rt==-1 || event_rt.rlist[rt]==NULL)
+ return 0;
+ } else {
+ if(nstate==DLG_STATE_CONFIRMED_NA) {
evname.s = "dialog:start";
evname.len = sizeof("dialog:start") - 1;
} else if(nstate==DLG_STATE_DELETED) {
if(ostate==DLG_STATE_CONFIRMED || ostate==DLG_STATE_CONFIRMED_NA) {
- rt = dlg_event_rt[DLG_EVENTRT_END];
evname.s = "dialog:end";
evname.len = sizeof("dialog:end") - 1;
} else if(ostate==DLG_STATE_UNCONFIRMED || ostate==DLG_STATE_EARLY) {
evname.s = "dialog:failed";
evname.len = sizeof("dialog:failed") - 1;
- rt = dlg_event_rt[DLG_EVENTRT_FAILED];
}
}
- if(rt==-1 || event_rt.rlist[rt]==NULL)
- return 0;
- } else {
keng = sr_kemi_eng_get();
if(keng==NULL) {
LM_DBG("event callback (%s) set, but no cfg engine\n",
diff --git a/src/modules/dialog/dlg_profile.c b/src/modules/dialog/dlg_profile.c
index e58dbad83d..3576f68036 100644
--- a/src/modules/dialog/dlg_profile.c
+++ b/src/modules/dialog/dlg_profile.c
@@ -594,8 +594,14 @@ int set_dlg_profile(struct sip_msg *msg, str *value, struct
dlg_profile_table *p
linker->hash_linker.value.len = value->len;
}
sruid_next_safe(&_dlg_profile_sruid);
- strcpy(linker->hash_linker.puid, _dlg_profile_sruid.uid.s);
- linker->hash_linker.puid_len = _dlg_profile_sruid.uid.len;
+ if(_dlg_profile_sruid.uid.len<SRUID_SIZE) {
+ strcpy(linker->hash_linker.puid, _dlg_profile_sruid.uid.s);
+ linker->hash_linker.puid_len = _dlg_profile_sruid.uid.len;
+ } else {
+ LM_ERR("sruid size is too large\n");
+ shm_free(linker);
+ goto error;
+ }
if (dlg!=NULL) {
/* add linker directly to the dialog and profile */