[SR-Users] Simulating kamailio config flows

Daniel-Constantin Mierla miconda at gmail.com
Thu May 23 22:11:45 CEST 2013


First a general recommendation: try to avoid patching core that much for 
non-common use cases.

The pv spec does not store the pv name in most of the cases, storing it 
there will increase size of structure and it is not needed in typical 
use cases.

At this moment, I think a good solution could be:
- most of the code in debugger module
- in core only a hook for a callback function for assignment operations 
that will print the desired info
- 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)
- if this feature is enabled in debugger module, it will create a hash 
table where to index pv set functions by pointer and point to the cache item
- this index has to be created in child_init with rank PROC_INIT to be 
sure all pvs were resolved to cache item
- not being a large set of writable variables, but also a debug case, 
looking up the pointer in hash table should be fast enough

Where to look:
- adding a callback in the core - see how the callback to get the per 
module debug level was added
- hash table - a hash table was created for per module debug level as 
well in debugger module
- pvapi.c show the structure of pv cache items

Cheers,
Daniel

On 5/23/13 5:29 PM, Victor Seva wrote:
> 2013/5/23 Daniel-Constantin Mierla <miconda at gmail.com>:
>> Look for ASSIGN_T in core, one place to go to and check is lval_assign(...)
>> function, not sure there are other in core.
> Ok. First attempt to get this done.
>
> I've created a new core cfg parameter "log_assign_actions" to
> activate/deactivate de log. No problem there.
>
> I've created to new functions on lvalue.c in order to log the assign
> action on lval_assign()
>
> questions:
> - How can I get the name of the pvar if I only have pv_spec_t struct?
> - Why is always called log_assign_action_pvar() with this kamailio.cfg example?
>
>          xdbg("test assign_action: $$var(temp) = $$fu;\n");
>          $var(temp) = $fu;
>          xdbg("test assign_action: $$var(temp) = $$null;\n");
>          $var(temp) = $null;
>          xdbg("test assign_action: $$var(temp) = 2;\n");
>          $var(temp) = 2;
>          xdbg("test assign_action: $$avp(s:temp_avp) = $$si;\n");
>          $avp(s:temp_avp) = $si;
>          xdbg("test assign_action: $$avp(s:temp_avp) = \"hi\";\n");
>          $avp(s:temp_avp) = "hi";
>          xdbg("test assign_action: $$avp(s:temp_avp) = 3;\n");
>          $avp(s:temp_avp) = 3;
>
>
>   4(26395) DEBUG: <script>: test assign_action: $var(temp) = $fu;
>   4(26395) DEBUG: <core> [parser/parse_addr_spec.c:885]:
> parse_addr_spec(): end of header reached, state=10
>   4(26395) DEBUG: <core> [lvalue.c:397]: log_assign_action_pvar(): value.flags: 4
>   4(26395) DEBUG: <core> [lvalue.c:401]: log_assign_action_pvar():
> $var(unknown): sip:janakj at dhcp246.fokus.gmd.de
>   4(26395) DEBUG: <script>: test assign_action: $var(temp) = $null;
>   4(26395) DEBUG: <core> [lvalue.c:397]: log_assign_action_pvar():
> value.flags: 28
>   4(26395) DEBUG: <core> [lvalue.c:401]: log_assign_action_pvar():
> $var(unknown): 0
>   4(26395) DEBUG: <script>: test assign_action: $var(temp) = 2;
>   4(26395) DEBUG: <core> [lvalue.c:397]: log_assign_action_pvar():
> value.flags: 28
>   4(26395) DEBUG: <core> [lvalue.c:401]: log_assign_action_pvar():
> $var(unknown): 2
>   4(26395) DEBUG: <script>: test assign_action: $avp(s:temp_avp) = $si;
>   4(26395) DEBUG: <core> [lvalue.c:397]: log_assign_action_pvar(): value.flags: 4
>   4(26395) DEBUG: <core> [lvalue.c:401]: log_assign_action_pvar():
> $var(unknown): 127.0.0.1
>   4(26395) DEBUG: <script>: test assign_action: $avp(s:temp_avp) = "hi";
>   4(26395) DEBUG: <core> [lvalue.c:397]: log_assign_action_pvar(): value.flags: 4
>   4(26395) DEBUG: <core> [lvalue.c:401]: log_assign_action_pvar():
> $var(unknown): hi
>   4(26395) DEBUG: <script>: test assign_action: $avp(s:temp_avp) = 3;
>   4(26395) DEBUG: <core> [lvalue.c:397]: log_assign_action_pvar():
> value.flags: 28
>   4(26395) DEBUG: <core> [lvalue.c:401]: log_assign_action_pvar():
> $var(unknown): 3
>
> Thanks in advance,
> Victor
>
>
> _______________________________________________
> SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
> sr-users at lists.sip-router.org
> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users

-- 
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 *

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sip-router.org/pipermail/sr-users/attachments/20130523/90dff43d/attachment-0001.html>


More information about the sr-users mailing list