Here is again the patch attached. Try it and let me know if works. I
will commit it on 1.5 branch once I get another report that is working
(I did my tests...).
Thanks,
Daniel
On 04/18/2009 01:20 AM, Alex Balashov wrote:
This is a bug in 1.5.0. It is in the process of being patched.
Jinsong Hu wrote:
Hi,
I am trying to use get_profile_size in the dialog module. but copy and
paste from the kamailio 1.5.0 module
http://kamailio.org/docs/modules/1.5.x/dialog.html#id2531307
get_profile_size("caller","$fu");
xlog("currently, the user %fu has $avp(size) active outgoing calls\n");
doesn't work at all. then finally decide to use pv.so and got following
setting:
modparam("dialog", "dlg_flag", 4)
modparam("pv", "varset", "size=i:44")
get_profile_size("caller","$fu", "$shv(size)");
but even this doesn't work either:
Apr 17 22:56:33 sip1m01 /usr/sbin/kamailio[7201]:
ERROR:core:fix_actions: fixing failed (code=-6) at cfg line 373
Apr 17 22:56:33 sip1m01 /usr/sbin/kamailio[7201]: ERROR:core:main:
failed to fix configuration with err code -6
can anybody tell me how to call this properly ?
Jinsong
------------------------------------------------------------------------
_______________________________________________
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
--
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