Thank you Razvan. Bogdan
--- On Wed, 4/13/11, Razvan Crainea <razvancrai...@opensips.org> wrote: From: Razvan Crainea <razvancrai...@opensips.org> Subject: Re: [OpenSIPS-Users] function with 6 parameters To: "rad bogdan" <bogdan_rad2...@yahoo.com> Cc: users@lists.opensips.org Date: Wednesday, April 13, 2011, 5:28 PM Hello, Bogdan, The problem is that the function you are using to fetch the values of the pseudo variables (fixup_get_svalue) uses static buffers to store the string values. These buffers are only 5 an they are used circularly. That's why the first value is the same with the last one. The best solution is to make sure you don't use more than 5 buffers concurrently, preferably process the value right after fetching it (in your example print the value right after getting it). Another solution is to use the "pv_printf" function where you can specify your buffer. As a last resort you can increase the buffers number in "pvar.c" (search PV_PRINT_BUF_NO definition). Regards, Razvan On 04/13/2011 01:58 PM, rad bogdan wrote: Hi Razvan, I've applied the patch you gave me. This is the output: INFO:core:do_action: called test6(0x81b1398, 0x81b144c, 0x81b14b4, 0x81b151c, 0x81b1584, 0x81b15ec) INFO:test:test6: arg1: [789] INFO:test:test6: arg2: [222] INFO:test:test6: arg3: [333] INFO:test:test6: arg4: [123] INFO:test:test6: arg5: [456] INFO:test:test6: arg6: [789] INFO:core:fix_actions: fixed test6[1] 0x81b1398 INFO:core:fix_actions: fixed test6[2] 0x81b144c INFO:core:fix_actions: fixed test6[3] 0x81b14b4 INFO:core:fix_actions: fixed test6[4] 0x81b151c INFO:core:fix_actions: fixed test6[5] 0x81b1584 INFO:core:fix_actions: fixed test6[6] 0x81b15ec This is the code from opensips.cfg: $var(var1) = 111; $var(var2) = 222; $var(var3) = 333; $avp(s:avp1) = 123; $avp(s:avp2) = 456; $avp(s:avp3) = 789; test6("$var(var1)", "$var(var2)", "$var(var3)", "$avp(s:avp1)", "$avp(s:avp2)", "$avp(s:avp3)"); Attached is the module. Thanks, Bogdan --- On Mon, 4/11/11, Razvan Crainea <razvancrai...@opensips.org> wrote: From: Razvan Crainea <razvancrai...@opensips.org> Subject: Re: [OpenSIPS-Users] function with 6 parameters To: users@lists.opensips.org Date: Monday, April 11, 2011, 1:45 PM Hello Bogdan, I implemented a similar test function that takes 6 parameters. All values seems to be in the correct order in both fixup function and triggered function. I attached a small patch that prints the value of the parameters right after the fixup function and then again before the function is called. Please apply this patch and then check if the parameters values and order match between the fixup and triggered function? Regards, Razvan On 04/06/2011 05:51 PM, rad bogdan wrote: Hi Bogdan, The "inversion" is only in the triggered function. The arguments are passed correctly from left to right to the fixup function. The triggered function is: test_function(struct sip_msg *msg, char *arg1, char *arg2, char* arg3, char* arg4, char* arg5, char* arg6) { str arg1_s = {NULL, 0}; if(arg1 == NULL || fixup_get_svalue(msg, (gparam_p)arg1, &arg1_s) != 0) { LM_ERR("Invalid arg1 argument\n"); return -1; } ......... } arg1_s.s has the value of arg6_s.s while arg6_s.s has the correct value. Thanks, Bogdan --- On Wed, 4/6/11, Bogdan-Andrei Iancu <bog...@opensips.org> wrote: From: Bogdan-Andrei Iancu <bog...@opensips.org> Subject: Re: [OpenSIPS-Users] function with 6 parameters To: "OpenSIPS users mailling list" <users@lists.opensips.org> Cc: "rad bogdan" <bogdan_rad2...@yahoo.com> Date: Wednesday, April 6, 2011, 5:15 PM Hi Bogdan, This "inversion" is visible in the fixup function or is the triggered function ? Regards, Bogdan On 04/06/2011 02:44 PM, rad bogdan wrote: Hi everyone, I implemented an OpenSIPS custom module that communicates with an external application. From the routing script I call a function with 6 parameters: test_function('$fU', '$tU', '$ci', '$avp(s:name1)', '$avp(s:name2)', '$var(name3)') The problem is that when the corresponding function is called in C, the first parameter gets the value of the last one. This doesn't happen when the function is made to take 5 parameters. The fixup function that I use is this: static int pvn_fixup_spve_spve_6(void** param, int param_no) { if (!(param_no >= 1 && param_no <= 6)) { LM_ERR("invalid parameter number %d\n", param_no); return E_UNSPEC; } return fixup_spve(param); } Is there something wrong with it or the problem is elsewhere ? Thanks, Bogdan _______________________________________________ Users mailing list Users@lists.opensips.org http://lists.opensips.org/cgi-bin/mailman/listinfo/users -- Bogdan-Andrei Iancu OpenSIPS eBootcamp - 2nd of May 2011 OpenSIPS solutions and "know-how" _______________________________________________ Users mailing list Users@lists.opensips.org http://lists.opensips.org/cgi-bin/mailman/listinfo/users -----Inline Attachment Follows----- _______________________________________________ Users mailing list Users@lists.opensips.org http://lists.opensips.org/cgi-bin/mailman/listinfo/users
_______________________________________________ Users mailing list Users@lists.opensips.org http://lists.opensips.org/cgi-bin/mailman/listinfo/users