MCPcopy Create free account
hub / github.com/OpenSIPS/opensips / pv_get_scriptvar

Function pv_get_scriptvar

pvar.c:3192–3224  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3190}
3191
3192static int pv_get_scriptvar(struct sip_msg *msg, pv_param_t *param,
3193 pv_value_t *res)
3194{
3195 int ival = 0;
3196 char *sval = NULL;
3197 script_var_t *sv=NULL;
3198
3199 if(msg==NULL || res==NULL)
3200 return -1;
3201
3202 if(param==NULL || param->pvn.u.dname==0)
3203 return pv_get_null(msg, param, res);
3204
3205 sv= (script_var_t*)param->pvn.u.dname;
3206
3207 if (sv->v.flags&VAR_VAL_NULL)
3208 return pv_get_null(msg, param, res);
3209
3210 if(sv->v.flags&VAR_VAL_STR)
3211 {
3212 res->rs = sv->v.value.s;
3213 res->flags = PV_VAL_STR;
3214 } else {
3215 sval = sint2str(sv->v.value.n, &ival);
3216
3217 res->rs.s = sval;
3218 res->rs.len = ival;
3219
3220 res->ri = sv->v.value.n;
3221 res->flags = PV_VAL_STR|PV_VAL_INT|PV_TYPE_INT;
3222 }
3223 return 0;
3224}
3225
3226/********* end PV get functions *********/
3227

Callers

nothing calls this directly

Calls 2

pv_get_nullFunction · 0.85
sint2strFunction · 0.85

Tested by

no test coverage detected