Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

#339 Dialplan error: fail to build rule

1.6.x
closed-fixed
modules (454)
8
2011-01-17
2011-01-10
Zoltan Medve
No

Using postgres and opensips 1.6.4

When starting/restarting opensips I got this message:
...
DBG:dialplan:build_rule: building subst rule
ERROR:dialplan:build_rule: values 5 is NULL - not allowed
WARNING:dialplan:dp_load_db: failed to build rule -> skipping
...

The dialplan contains only one row:
id | dpid | pr | match_op | match_exp | match_len | subst_exp | repl_exp | attrs
----+------+----+----------+-----------------------+-----------+-----------+----------+--------
8 | 1 | 0 | 1 | ^[a-zA-Z][0-9A-Za-z]+ | 0 | | | usrloc
(1 row)

Discussion

  • Zoltan Medve
    Zoltan Medve
    2011-01-12

    After some investigation I've checked /modules/dialplan/dp_db.c

    It seems the problem is an extra conditional in 1.6.4:
    --- opensips 1.6.2 ---
    #define GET_STR_VALUE(_res, _values, _index)\ do{\ (_res).s = VAL_STR((_values)+ (_index)).s;\ (_res).len = strlen(VAL_STR((_values)+ (_index)).s);\ }while(0);
    --- ---

    --- opensips 1.6.4 ---
    #define GET_STR_VALUE(_res, _values, _index)\ do{\ if ( VAL_NULL((_values)+ (_index)) ) { \ LM_ERR(" values %d is NULL - not allowed\n",_index);\ goto err;\ } \ (_res).s = VAL_STR((_values)+ (_index)).s;\ (_res).len = strlen(VAL_STR((_values)+ (_index)).s);\ }while(0);
    --- ---

     
  • Zoltan Medve
    Zoltan Medve
    2011-01-12

    • assigned_to: nobody --> bogdan_iancu
     
    • priority: 5 --> 8
    • status: open --> open-accepted
     
  • seams to be the postgres driver converting "" (empty strings) to NULL.....investigating

     
    • assigned_to: bogdan_iancu --> vladut-paiu
     
  • patch for db_postgres

     
    Attachments
  • Hi,

    The problem is that the db_postgres module was setting the nul flag to empty strings. I have attached a patch that fixes this behavior. Please apply it and see if it fixes your problem.

     
  • Zoltan Medve
    Zoltan Medve
    2011-01-14

    • status: open-accepted --> open-works-for-me
     
  • Zoltan Medve
    Zoltan Medve
    2011-01-14

    Tested the patch with original 1.6.4 source and the given dialplan. It works for me (but I think its fixed too). Do we need deeper check against the patch?

     
    • status: open-works-for-me --> closed-fixed
     
  • Hi,

    Patch has been applied in trunk and in 1.6 branch.