[Kamailio-Devel] new http_query function

Daniel-Constantin Mierla miconda at gmail.com
Tue Nov 18 15:17:44 CET 2008



On 11/18/08 15:59, Juha Heinanen wrote:
> Daniel-Constantin Mierla writes:
>
>  > The group modules has a function get_user_group() that sets to a PV an 
>  > integer value -- just as example to start -- also, action.c has 
>  > do_assign() using same mechanism.
>
> yes, in case of get_user_group, result is assigned to an avp and in
> dp_translate result is assigned to a pseudo variable that can be an avp,
> script var or two core pseudo vars.  
>
> if you look at the code of dp_translate, you will see quite complicated
> testing and what to do depending on which kind of pseudo variable is
> receiving the result.  it makes little sense that each module includes
> similar tests, case statements, and do_action calls.
>
> what i tried to suggest is that pvar.h would include a function that can
> be used to set a value to ANY kind of pseudo variable provided that the
> pv is such that it can be assigned a new value.
>   
the "setf" member of pv_spec_t is the function to be used to set the 
value of that pv. There is no need to check the type of PV, if setf is 
not null, then the PV is writable:

if(pvs->setf)
    pvs->setf(sip_msg, &pvs->pvp, (int)EQ_T, &val);

where val is a pv_value_t struct, where you can set the type and str/int 
value.

That is all needed, no bother with what PV type is there.

Cheers,
Daniel

-- 
Daniel-Constantin Mierla
http://www.asipto.com




More information about the Devel mailing list