[SR-Users] KEMI

Daniel-Constantin Mierla miconda at gmail.com
Thu Feb 15 10:08:47 CET 2018


To add a bit more ...

The list of the methods exported to KSR module in python (or any other
KEMI scripting language) are listed at:

  - http://kamailio.org/docs/tutorials/devel/kamailio-kemi-framework/

There is a python script contributed that scans the C code in kamailio
and extracts the KEMI exports, maybe you can adjust it to generate code
completion rules:

  -
https://github.com/kamailio/kamailio-docs/blob/master/kamailio-kemi-framework/tools/generate_module_docs.py

Cheers,
Daniel

On 15.02.18 01:16, Anthony Alba wrote:
> They are created in C code and not visible as .py files.
>
> On Feb 15, 2018 12:03 AM, "Grant Bagdasarian" <gb at cm.nl
> <mailto:gb at cm.nl>> wrote:
>
>     Hi,
>
>     Where would one get the files which are imported when creating a
>     Kamailio file using python?
>     import Router.Logger as Logger
>     import KSR as KSR
>
>     Would be awesome if we could reference these and get code
>     completion when using for instance Visual Studio code.
>     So, basically, I'm looking for the KSR.py and Router.py files, but
>     I cannot find them.
>
>     Regards,
>     Grant
>
>     -----Original Message-----
>     From: sr-users [mailto:sr-users-bounces at lists.kamailio.org
>     <mailto:sr-users-bounces at lists.kamailio.org>] On Behalf Of
>     Daniel-Constantin Mierla
>     Sent: woensdag 7 februari 2018 16:02
>     To: Aleksandar Sosic <alex.sosic at timenet.it
>     <mailto:alex.sosic at timenet.it>>
>     Cc: Kamailio (SER) - Users Mailing List
>     <sr-users at lists.kamailio.org <mailto:sr-users at lists.kamailio.org>>
>     Subject: Re: [SR-Users] KEMI
>
>     I am more into Lua when it comes on doing something the native
>     kamailio.cfg cannot do, that's because Lua has a decent range of
>     extensions (external Lua libraries).
>
>     JavaScript was added for those that do not need a lot of external
>     extensions, but want to have script reload.
>
>     Same for Squirrel, but that language is not so popular as
>     JavaScript, however, there could be people liking it, being very
>     minimal, thus expecting to need very low resources.
>
>     Anyhow, once implemented, a kemi interpreter module should not
>     need much maintenance. New kemi functions will be exported
>     directly from the other modules.
>
>     Cheers,
>     Daniel
>
>
>     On 07.02.18 14:12, Aleksandar Sosic wrote:
>     > Thanks Dan for the extensive answer!
>     >
>     > My last question then is what kemi language do you use
>     personally? :D
>     >
>     > Kind regards,
>     > --
>     > Aleksandar Sosic
>     > mail: alex.sosic at timenet.it <mailto:alex.sosic at timenet.it>
>     > skype: alex.sosic
>     > cell: +385 91 2505 146 <tel:%2B385%2091%202505%20146>
>     >
>     >
>     > On Tue, Feb 6, 2018 at 8:44 PM, Daniel-Constantin Mierla
>     > <miconda at gmail.com <mailto:miconda at gmail.com>> wrote:
>     >> The C code is the same for 99% of the KSR functions available
>     either
>     >> in python or javascript (or the other kemi languages). Only KSR.pv
>     >> and KSR.x functions are implemented in the app_python or
>     app_jsdt modules.
>     >> So if such a KSR function is broken, it is the same everywhere
>     >>
>     >> Probably KSR.pv can be moved in a common place, but KSR.x are
>     >> specific extensions for each interpreter, so it will stay in app_*.
>     >>
>     >> Then of course, it is a matter of the script interpreter, python vs
>     >> js ducktape, which are external project, we just bind to them.
>     Also,
>     >> it is about the maintenance of app_python and app_jsdt. I am
>     not the
>     >> developer of app_python and I cannot assert its state, I just added
>     >> the kemi enhancement. app_jsdt was developed by me, but I haven't
>     >> used it extensively so far.
>     >>
>     >> Probably you can do some basic configs and test yourself and
>     see what
>     >> fits your needs better, you can start from the examples at:
>     >>
>     >>   -
>     >>
>     https://github.com/kamailio/kamailio/tree/master/misc/examples/kemi
>     <https://github.com/kamailio/kamailio/tree/master/misc/examples/kemi>
>     >>
>     >> In long term, you have to look at the extensions you may need, what
>     >> python offers vs ducktape js interpreter in terms of their own
>     >> extensions and libraries.
>     >>
>     >> Cheers,
>     >> Daniel
>
>     --
>     Daniel-Constantin Mierla
>     www.twitter.com/miconda <http://www.twitter.com/miconda> --
>     www.linkedin.com/in/miconda <http://www.linkedin.com/in/miconda>
>     Kamailio Advanced Training - March 5-7, 2018, Berlin -
>     www.asipto.com <http://www.asipto.com> Kamailio World Conference -
>     May 14-16, 2018 - www.kamailioworld.com <http://www.kamailioworld.com>
>
>
>     _______________________________________________
>     Kamailio (SER) - Users Mailing List
>     sr-users at lists.kamailio.org <mailto:sr-users at lists.kamailio.org>
>     https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
>     <https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users>
>     _______________________________________________
>     Kamailio (SER) - Users Mailing List
>     sr-users at lists.kamailio.org <mailto:sr-users at lists.kamailio.org>
>     https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
>     <https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users>
>
>
>
> _______________________________________________
> Kamailio (SER) - Users Mailing List
> sr-users at lists.kamailio.org
> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users

-- 
Daniel-Constantin Mierla
www.twitter.com/miconda -- www.linkedin.com/in/miconda
Kamailio Advanced Training - March 5-7, 2018, Berlin - www.asipto.com
Kamailio World Conference - May 14-16, 2018 - www.kamailioworld.com

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kamailio.org/pipermail/sr-users/attachments/20180215/01b34bf0/attachment.html>


More information about the sr-users mailing list