<div dir="ltr"><div>yeah indeed, or send them over in a ; separated list and then split them in the python function. <br></div><div><br></div><div>wkr, <br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Op ma 7 dec. 2020 om 07:54 schreef Tomi Hakkarainen <<a href="mailto:tpaivaa@gmail.com">tpaivaa@gmail.com</a>>:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="auto"><div dir="ltr">Hi,</div><div dir="ltr"><br></div><div dir="ltr">I would pass params in a python dictionary if its alllowed.</div><div dir="ltr"><br></div><div dir="ltr">Tomi</div><div dir="ltr"><br>On 6. Dec 2020, at 14.35, Elaine Huang <<a href="mailto:u8k.mel@gmail.com" target="_blank">u8k.mel@gmail.com</a>> wrote:<br><br></div><div dir="ltr"><div dir="auto"><div>Hi Vlad,</div><div dir="auto"><br></div><div dir="auto">Thanks. </div><div dir="auto"><br></div><div dir="auto">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.</div><div dir="auto"><br><div class="gmail_quote" dir="auto"><div dir="ltr" class="gmail_attr">On Sat., 5 Dec. 2020, 03:29 Vlad Patrascu, <<a href="mailto:vladp@opensips.org" target="_blank">vladp@opensips.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div>
<p>Hi Elaine,</p>
<p>Unfortunately the documentation is actually misleading and the
function accepts only one extra argument for passing to python.</p>
<p>Regards,<br>
</p>
<pre cols="72">--
Vlad Patrascu
OpenSIPS Developer
<a href="http://www.opensips-solutions.com" rel="noreferrer" target="_blank">http://www.opensips-solutions.com</a></pre>
<div>On 04.12.2020 11:30, Elaine Huang
wrote:<br>
</div>
<blockquote type="cite">
<div dir="auto">Hi,
<div dir="auto"><br>
</div>
<div dir="auto">I wrote a python function that takes 3
parameters (excluding msg):</div>
<div dir="auto"><br>
</div>
<div dir="auto"><br>
</div>
<div dir="auto">class MyClass:</div>
<div dir="auto"> …</div>
<div dir="auto"> my_f(self, msg, param1, param2, param3):</div>
<div dir="auto"> …</div>
<div dir="auto"> …</div>
<div dir="auto"><br>
</div>
<div dir="auto"><br>
</div>
<div dir="auto">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></div>
<div dir="auto"><br>
</div>
<div dir="auto">my config code:</div>
<div dir="auto">python_exec("my_f", param1, param2, param3)</div>
<div dir="auto"><br>
</div>
<div dir="auto"><br>
</div>
<div dir="auto">It can start if I change it to:</div>
<div dir="auto">python_exec("my_f", param1)</div>
<div dir="auto"><br>
</div>
<div dir="auto"><br>
</div>
<div dir="auto">Any idea why?</div>
<div dir="auto"><br>
</div>
<div dir="auto"><br>
</div>
<div dir="auto">OpenSIPS version: 3.1</div>
<div dir="auto"><br>
</div>
<div dir="auto"><br>
</div>
<div dir="auto"><br>
</div>
<div dir="auto">Kind Regards,</div>
<div dir="auto">Elaine</div>
<div dir="auto"><br>
</div>
</div>
<br>
<fieldset></fieldset>
<pre>_______________________________________________
Users mailing list
<a href="mailto:Users@lists.opensips.org" rel="noreferrer" target="_blank">Users@lists.opensips.org</a>
<a href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users" rel="noreferrer" target="_blank">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a>
</pre>
</blockquote>
</div>
_______________________________________________<br>
Users mailing list<br>
<a href="mailto:Users@lists.opensips.org" rel="noreferrer" target="_blank">Users@lists.opensips.org</a><br>
<a href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users" rel="noreferrer noreferrer" target="_blank">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a><br>
</blockquote></div></div></div>
<span>_______________________________________________</span><br><span>Users mailing list</span><br><span><a href="mailto:Users@lists.opensips.org" target="_blank">Users@lists.opensips.org</a></span><br><span><a href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users" target="_blank">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a></span><br></div></div>_______________________________________________<br>
Users mailing list<br>
<a href="mailto:Users@lists.opensips.org" target="_blank">Users@lists.opensips.org</a><br>
<a href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users" rel="noreferrer" target="_blank">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a><br>
</blockquote></div>