Thanks for detailed report. Hopefully I fixed all issues. Please find
attached a patch which includes the one I sent previously for the crash
reported by Alex. If all ok I will fix on 1.5 branch.
Cheers,
Daniel
On 04/09/2009 02:40 PM, Iñaki Baz Castillo wrote:
2009/4/9 Iñaki Baz Castillo <[email protected]>:
Yes, using the flag it just didn't work at all.
Using dlg_manage() it worked. However I saw duplicate dialog entries
(in both memory and DB table).
Profiles don't work for me at all.
Forget the above, now I've re-checked it:
----
Kamailio rev 5772
modparam("dialog", "dlg_match_mode", 1)
modparam("dialog", "db_mode", 1)
----
I've checked basically the following two cases:
a)
setflag(FLAG_DIALOG);
set_dlg_profile("inbound");
b)
dlg_manage();
set_dlg_profile("inbound");
In both cases I add:
[[ in-dialog section ]]
is_in_profile("inbound"))
xlog("L_CRIT", "*********** this request belongs to a inbound call\n");
if(dlg_isflagset("1"))
xlog("L_CRIT", "*********** Dialog Flag is SET \n");
Results:
a)
- Dialog entries are created correctly in memory and DB.
- Dialog profiles are not created:
profile:: name=inbound value= count=0
- is_in_profile("inbound")) obviously doesn't work.
- if(dlg_isflagset("1")) doesnt' work for in_dialog request (it just
works if I check it in the initial INVITE request after setting it, so
it behaves as a script flag).
b)
- Dialog entries are created correctly in memory and DB.
- Dialog profiles are correctly created:
profile:: name=inbound value= count=1
- is_in_profile("inbound")) doesn't work for in-dialog requests,
neither in the initial INVITE after setting:
set_dlg_profile("inbound");
- if(dlg_isflagset("1")) doesnt' work for in_dialog request (it just
works if I check it in the initial INVITE request after setting it, so
it behaves as a script flag).
There are some things I son't know (documentation is not very
extended). For example, I don't know if I must use dlg_manage() when
processing in-dialog requests, perhaps it's enough with running this
function when proccesing the initial request?
Also, the order in which functions as dlg_manage() and
set_dlg_profile() is not documented. Doesn't it matter?
Regards.
--
Daniel-Constantin Mierla
http://www.asipto.com/
Index: modules/dialog/dialog.c
===================================================================
--- modules/dialog/dialog.c (revision 5791)
+++ modules/dialog/dialog.c (working copy)
@@ -680,9 +680,14 @@
unsigned int size;
pv_value_t val;
- pve = (pv_elem_t *)value;
- sp_dest = (pv_spec_t *)result;
-
+ if(result!=NULL)
+ {
+ pve = (pv_elem_t *)value;
+ sp_dest = (pv_spec_t *)result;
+ } else {
+ pve = NULL;
+ sp_dest = (pv_spec_t *)value;
+ }
if ( pve!=NULL && ((struct dlg_profile_table*)profile)->has_value) {
if ( pv_printf_s(msg, pve, &val_s)!=0 ||
val_s.len == 0 || val_s.s == NULL) {
@@ -709,7 +714,7 @@
static int w_dlg_setflag(struct sip_msg *msg, char *flag, char *s2)
{
- struct dlg_cell *dlg;
+ dlg_ctx_t *dctx;
int val;
if(fixup_get_ivalue(msg, (gparam_p)flag, &val)!=0)
@@ -719,17 +724,19 @@
}
if(val<0 || val>31)
return -1;
- if ( (dlg=dlg_get_ctx_dialog())==NULL )
+ if ( (dctx=dlg_get_dlg_ctx())==NULL )
return -1;
- dlg->sflags |= 1<<val;
+ dctx->flags |= 1<<val;
+ if(dctx->dlg)
+ dctx->dlg->sflags |= 1<<val;
return 1;
}
static int w_dlg_resetflag(struct sip_msg *msg, char *flag, str *s2)
{
- struct dlg_cell *dlg;
+ dlg_ctx_t *dctx;
int val;
if(fixup_get_ivalue(msg, (gparam_p)flag, &val)!=0)
@@ -740,17 +747,19 @@
if(val<0 || val>31)
return -1;
- if ( (dlg=dlg_get_ctx_dialog())==NULL )
+ if ( (dctx=dlg_get_dlg_ctx())==NULL )
return -1;
- dlg->sflags &= ~(1<<val);
+ dctx->flags &= ~(1<<val);
+ if(dctx->dlg)
+ dctx->dlg->sflags &= ~(1<<val);
return 1;
}
static int w_dlg_isflagset(struct sip_msg *msg, char *flag, str *s2)
{
- struct dlg_cell *dlg;
+ dlg_ctx_t *dctx;
int val;
if(fixup_get_ivalue(msg, (gparam_p)flag, &val)!=0)
@@ -761,10 +770,12 @@
if(val<0 || val>31)
return -1;
- if ( (dlg=dlg_get_ctx_dialog())==NULL )
+ if ( (dctx=dlg_get_dlg_ctx())==NULL )
return -1;
- return (dlg->sflags&(1<<val))?1:-1;
+ if(dctx->dlg)
+ return (dctx->dlg->sflags&(1<<val))?1:-1;
+ return (dctx->flags&(1<<val))?1:-1;
}
static int w_dlg_manage(struct sip_msg *msg, char *s1, char *s2)
Index: modules/dialog/dlg_db_handler.c
===================================================================
--- modules/dialog/dlg_db_handler.c (revision 5791)
+++ modules/dialog/dlg_db_handler.c (working copy)
@@ -509,8 +509,10 @@
SET_PROPER_NULL_FLAG(cell->contact[DLG_CALLER_LEG], values, 16);
SET_PROPER_NULL_FLAG(cell->contact[DLG_CALLEE_LEG], values, 17);
- VAL_INT(values+18) = cell->sflags;
- VAL_INT(values+19) = cell->toroute;
+ VAL_NULL(values+18) = 0;
+ VAL_INT(values+18) = cell->sflags;
+ VAL_NULL(values+19) = 0;
+ VAL_INT(values+19) = cell->toroute;
if((dialog_dbf.insert(dialog_db_handle, insert_keys, values,
DIALOG_TABLE_COL_NO)) !=0){
Index: modules/dialog/dlg_var.c
===================================================================
--- modules/dialog/dlg_var.c (revision 5791)
+++ modules/dialog/dlg_var.c (working copy)
@@ -372,3 +372,7 @@
return _dlg_ctx.dlg;
}
+dlg_ctx_t* dlg_get_dlg_ctx(void)
+{
+ return &_dlg_ctx;
+}
Index: modules/dialog/dlg_var.h
===================================================================
--- modules/dialog/dlg_var.h (revision 5791)
+++ modules/dialog/dlg_var.h (working copy)
@@ -54,4 +54,6 @@
void dlg_set_ctx_dialog(struct dlg_cell *dlg);
struct dlg_cell* dlg_get_ctx_dialog(void);
+dlg_ctx_t* dlg_get_dlg_ctx(void);
+
#endif
Index: modules/dialog/dlg_handlers.c
===================================================================
--- modules/dialog/dlg_handlers.c (revision 5791)
+++ modules/dialog/dlg_handlers.c (working copy)
@@ -484,7 +484,7 @@
return -1;
}
- current_dlg_pointer = dlg;
+ set_current_dialog(msg, dlg);
_dlg_ctx.dlg = dlg;
link_dlg(dlg, 2/* extra ref for the callback and current dlg hook */);
_______________________________________________
Kamailio (OpenSER) - Users mailing list
[email protected]
http://lists.kamailio.org/cgi-bin/mailman/listinfo/users
http://lists.openser-project.org/cgi-bin/mailman/listinfo/users