Hi,

is there any way to return values from a call to python_exec function
orther than the default returned integer?

Following code generates this error:
Oct  1 09:08:23 zskio /usr/sbin/kamailio[21789]: ERROR: app_python
[python_support.c:38]: python_exec2: Unhandled exception in the Python
code:
Oct  1 09:08:23 zskio /usr/sbin/kamailio[21789]: ERROR: app_python
[python_support.c:78]: #011RuntimeError: no such function

                if (!python_exec("get_provider",
$(var(clean_uri){s.prefixes}))) {
                        xlog("L_ERR","Can not choose a provider for $rU\n");
                        sl_send_reply("503","Can not choose a provider
for $rU");
                        exit;
                }


def get_provider(self, msg, param):
        # snipped code...
        result = self.util.get_provider(prefixes, position, mode)
        if result is not None:
            LM_ERR("mode: %s position: %d result: %s" % (mode,
position, result))
            # this raises error
            msg.call_function('rewritehost', result['provider']['ip'])
            return 1
        return -1

I tried to use headers as transport but this simple code does not work:

Oct  1 09:45:31 zskio /usr/sbin/kamailio[22303]: ERROR: <script>: No header

                if (!is_present_hf("X-Test-header")) {
                        xlog("L_ERROR", "No header\n");
                }
                else {
                        xlog("L_INFO", "Header added\n");
                }

    def test_set_header(self, msg):
        msg.call_function('append_hf', 'X-Test-header: test\r\n')
        return 1

Thanks in advance.

_______________________________________________
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users

Reply via email to