[OpenSIPS-Users] too many parameters for command <python_exec>

Johan De Clercq Johan at democon.be
Mon Dec 7 09:01:41 EST 2020


yeah indeed, or send them over in a ; separated list and then split them in
the python function.

wkr,

Op ma 7 dec. 2020 om 07:54 schreef Tomi Hakkarainen <tpaivaa at gmail.com>:

> Hi,
>
> I would pass params in a python dictionary if its alllowed.
>
> Tomi
>
> On 6. Dec 2020, at 14.35, Elaine Huang <u8k.mel at gmail.com> wrote:
>
> 
> Hi Vlad,
>
> Thanks.
>
> What would you do if you need to pass multiple parameters to a function?
> I'm thinking of compile the params into one string (separated by comma
> maybe) and parse them in the python function, but that's hacky.
>
> On Sat., 5 Dec. 2020, 03:29 Vlad Patrascu, <vladp at opensips.org> wrote:
>
>> Hi Elaine,
>>
>> Unfortunately the documentation is actually misleading and the function
>> accepts only one extra argument for passing to python.
>>
>> Regards,
>>
>> --
>> Vlad Patrascu
>> OpenSIPS Developerhttp://www.opensips-solutions.com
>>
>> On 04.12.2020 11:30, Elaine Huang wrote:
>>
>> Hi,
>>
>> I wrote a python function that takes 3 parameters (excluding msg):
>>
>>
>> class MyClass:
>>>>   my_f(self, msg, param1, param2, param3):
>>>>>>
>>
>> While the python module readme suggests it can accept extra args (more
>> than 1), opensips fail to start with error: too many parameters for command
>> <python_exec>
>>
>> my config code:
>> python_exec("my_f", param1, param2, param3)
>>
>>
>> It can start if I change it to:
>> python_exec("my_f", param1)
>>
>>
>> Any idea why?
>>
>>
>> OpenSIPS version: 3.1
>>
>>
>>
>> Kind Regards,
>> Elaine
>>
>>
>> _______________________________________________
>> Users mailing listUsers at lists.opensips.orghttp://lists.opensips.org/cgi-bin/mailman/listinfo/users
>>
>> _______________________________________________
>> Users mailing list
>> Users at lists.opensips.org
>> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>>
> _______________________________________________
> Users mailing list
> Users at lists.opensips.org
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
> _______________________________________________
> Users mailing list
> Users at lists.opensips.org
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opensips.org/pipermail/users/attachments/20201207/a3ad0568/attachment.html>


More information about the Users mailing list