[sr-dev] [tracker] Task opened: function for evaluating string value

sip-router admin at sip-router.org
Wed Jun 30 16:49:49 CEST 2010


THIS IS AN AUTOMATED MESSAGE, DO NOT REPLY.

A new Flyspray task has been opened.  Details are below. 

User who did this - Juha Heinanen (jh) 

Attached to Project - sip-router
Summary - function for evaluating string value
Task Type - Feature Request
Category - Module
Status - New
Assigned To - 
Operating System - All
Severity - Medium
Priority - Normal
Reported Version - Development
Due in Version - Undecided
Due Date - Undecided
Details - it would improve dynamic configuration of sip proxy if a function or transformation would exist for evaluating a string value stored in a pseudo variable that contains pseudo variables, transformations, etc.

i tried to implement such function (below), but was not able to make it work.  any help is appreciated.

-- juha


/* 
 * Evaluates first param (string) and saves result to second param (pvar)
 */
int eval(struct sip_msg* _m, char* _string, char* _dst)
{
    str value, result;
    char **param;
    pv_spec_t *dst;
    pv_value_t val;
    fparam_t *fp;

    if (fixup_get_svalue(_m, (gparam_p)_string, &value) != 0) {
	LM_ERR("cannot get parameter value\n");
	return -1;
    }

    param = &(value.s);
    LM_INFO("param value as string is <%s>\n", *param);

    if (fixup_spve_null((void **)param, 1) != 0) {
	LM_ERR("failed to evaluate parameter <%.*s>\n", value.len, value.s);
	return -1;
    }

    fp = (fparam_t *)param;

    LM_INFO("orig <%s>, type <%d>\n", fp->orig, fp->type);
    if (get_str_fparam(&result, _m, fp) != 0) {
	LM_ERR("cannot get result value\n");
	return -1;
    }
    
    val.rs.s = result.s;
    val.rs.len = result.len;
    LM_INFO("eval result: %.*s\n", val.rs.len, val.rs.s);
    val.flags = PV_VAL_STR;
    dst = (pv_spec_t *)_dst;
    dst->setf(_m, &dst->pvp, (int)EQ_T, &val);
    
    return 1;
}


More information can be found at the following URL:
http://sip-router.org/tracker/index.php?do=details&task_id=78

You are receiving this message because you have requested it from the Flyspray bugtracking system.  If you did not expect this message or don't want to receive mails in future, you can change your notification settings at the URL shown above.



More information about the sr-dev mailing list