[SR-Users] Simulating kamailio config flows

Daniel-Constantin Mierla miconda at gmail.com
Fri May 24 09:29:42 CEST 2013


Hello,

right direction, but maybe the change is not required everywhere or 
maybe inside some functions, you have to analyze where is pvar and where 
is ser-style avp.

Cheers,
Daniel

On 5/24/13 9:22 AM, Victor Seva wrote:
> 2013/5/23 Victor Seva <linuxmaniac at torreviejawireless.org>:
>> 2013/5/23 Daniel-Constantin Mierla <miconda at gmail.com>:
>>> - update the interpreter to use pv cache instead of own spec per pv (I can
>>> do it, being in my list and hopefully is no big change)
>> I will try to do it myself just to get familliar with this area. Let's
>> see how it goes.
> You mean modifiing cfg.y on:
>
> pvar: PVAR {
> pv_spec=pkg_malloc(sizeof(*pv_spec));
> if (!pv_spec) {
> yyerror("Not enough memory");
> YYABORT;
> }
> memset(pv_spec, 0, sizeof(*pv_spec));
> s_tmp.s=$1; s_tmp.len=strlen($1);
> if (pv_parse_spec(&s_tmp, pv_spec)==0){
> yyerror("unknown script pseudo variable %s", $1 );
> pkg_free(pv_spec);
> pv_spec=0;
> YYABORT;
> }
> $$=pv_spec;
> }
> ;
>
> avp_pvar: AVP_OR_PVAR {
> lval_tmp=pkg_malloc(sizeof(*lval_tmp));
> if (!lval_tmp) {
> yyerror("Not enough memory");
> YYABORT;
> }
> memset(lval_tmp, 0, sizeof(*lval_tmp));
> s_tmp.s=$1; s_tmp.len=strlen(s_tmp.s);
> if (pv_parse_spec2(&s_tmp, &lval_tmp->lv.pvs, 1)==0){
> /* not a pvar, try avps */
> /* lval_tmp might be partially filled by the failed
>    pv_parse_spec2() (especially if the avp name is the
>    same as a pv class) => clean it again */
> memset(lval_tmp, 0, sizeof(*lval_tmp));
> lval_tmp->lv.avps.type|= AVP_NAME_STR;
> lval_tmp->lv.avps.name.s.s = s_tmp.s+1;
> lval_tmp->lv.avps.name.s.len = s_tmp.len-1;
> lval_tmp->type=LV_AVP;
> }else{
> lval_tmp->type=LV_PVAR;
> }
> $$ = lval_tmp;
> DBG("parsed ambigous avp/pvar \"%.*s\" to %d\n",
> s_tmp.len, s_tmp.s, lval_tmp->type);
> }
> ;
>
> Not malloc pv_spec and instead use pv_cache_get()?
>
> Cheers,
> Victor

-- 
Daniel-Constantin Mierla - http://www.asipto.com
http://twitter.com/#!/miconda - http://www.linkedin.com/in/miconda
Kamailio Advanced Training, San Francisco, USA - June 24-27, 2013
   * http://asipto.com/u/katu *




More information about the sr-users mailing list