Hello,<br>I can contribute a python part, but currently I&#39;m a very busy at the moment. <br>I will write a patch to enable this ability (and many other features) as soon as possible.<br><br><div class="gmail_quote">2012/10/3 Daniel-Constantin Mierla <span dir="ltr">&lt;<a href="mailto:miconda@gmail.com" target="_blank">miconda@gmail.com</a>&gt;</span><br>

<blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hello,<br>
<br>
the best would be to enhance the module to be able to get/set pseudo-variables. I am not a python guy at all, so I cannot help much, however I can assist with the C side in kamailio if someone starts development and has questions about PVs.<br>


<br>
Calling config functions with parameters from embedded interpreters exposes the risk of memory leaks, so it is better to avoid it. Anyhow, added headers are not visible immediately (even when done form config file), unless you call msg_apply_changes().<br>


<br>
As a workaround for now, I suggest you put your token somehow in request uri (e.g., a parameter).<br>
<br>
Cheers,<br>
Daniel<div class="HOEnZb"><div class="h5"><br>
<br>
On 10/1/12 9:53 AM, Victor Seva wrote:<br>
<blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
Hi,<br>
<br>
is there any way to return values from a call to python_exec function<br>
orther than the default returned integer?<br>
<br>
Following code generates this error:<br>
Oct  1 09:08:23 zskio /usr/sbin/kamailio[21789]: ERROR: app_python<br>
[python_support.c:38]: python_exec2: Unhandled exception in the Python<br>
code:<br>
Oct  1 09:08:23 zskio /usr/sbin/kamailio[21789]: ERROR: app_python<br>
[python_support.c:78]: #011RuntimeError: no such function<br>
<br>
                 if (!python_exec(&quot;get_provider&quot;,<br>
$(var(clean_uri){s.prefixes}))<u></u>) {<br>
                         xlog(&quot;L_ERR&quot;,&quot;Can not choose a provider for $rU\n&quot;);<br>
                         sl_send_reply(&quot;503&quot;,&quot;Can not choose a provider<br>
for $rU&quot;);<br>
                         exit;<br>
                 }<br>
<br>
<br>
def get_provider(self, msg, param):<br>
         # snipped code...<br>
         result = self.util.get_provider(<u></u>prefixes, position, mode)<br>
         if result is not None:<br>
             LM_ERR(&quot;mode: %s position: %d result: %s&quot; % (mode,<br>
position, result))<br>
             # this raises error<br>
             msg.call_function(&#39;<u></u>rewritehost&#39;, result[&#39;provider&#39;][&#39;ip&#39;])<br>
             return 1<br>
         return -1<br>
<br>
I tried to use headers as transport but this simple code does not work:<br>
<br>
Oct  1 09:45:31 zskio /usr/sbin/kamailio[22303]: ERROR: &lt;script&gt;: No header<br>
<br>
                 if (!is_present_hf(&quot;X-Test-<u></u>header&quot;)) {<br>
                         xlog(&quot;L_ERROR&quot;, &quot;No header\n&quot;);<br>
                 }<br>
                 else {<br>
                         xlog(&quot;L_INFO&quot;, &quot;Header added\n&quot;);<br>
                 }<br>
<br>
     def test_set_header(self, msg):<br>
         msg.call_function(&#39;append_hf&#39;, &#39;X-Test-header: test\r\n&#39;)<br>
         return 1<br>
<br>
Thanks in advance.<br>
<br>
______________________________<u></u>_________________<br>
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list<br>
<a href="mailto:sr-users@lists.sip-router.org" target="_blank">sr-users@lists.sip-router.org</a><br>
<a href="http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users" target="_blank">http://lists.sip-router.org/<u></u>cgi-bin/mailman/listinfo/sr-<u></u>users</a><br>
</blockquote>
<br></div></div><span class="HOEnZb"><font color="#888888">
-- <br>
Daniel-Constantin Mierla - <a href="http://www.asipto.com" target="_blank">http://www.asipto.com</a><br>
<a href="http://twitter.com/#%21/miconda" target="_blank">http://twitter.com/#!/miconda</a> - <a href="http://www.linkedin.com/in/miconda" target="_blank">http://www.linkedin.com/in/<u></u>miconda</a><br>
Kamailio Advanced Training, Berlin, Nov 5-8, 2012 - <a href="http://asipto.com/u/kat" target="_blank">http://asipto.com/u/kat</a><br>
Kamailio Advanced Training, Miami, USA, Nov 12-14, 2012 - <a href="http://asipto.com/u/katu" target="_blank">http://asipto.com/u/katu</a></font></span><div class="HOEnZb"><div class="h5"><br>
<br>
<br>
______________________________<u></u>_________________<br>
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list<br>
<a href="mailto:sr-users@lists.sip-router.org" target="_blank">sr-users@lists.sip-router.org</a><br>
<a href="http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users" target="_blank">http://lists.sip-router.org/<u></u>cgi-bin/mailman/listinfo/sr-<u></u>users</a><br>
</div></div></blockquote></div><br>