Discussion:
[SR-Users] KEMI
Aleksandar Sosic
2018-02-05 07:59:01 UTC
Permalink
Hi everyone,

we're valuating on rewriting our kamailio routes in python.
We're doing a lot of string manipulation and GraphQL API queries so
the kamailio scripting language is a little bit limited for this use
case.

Can someone tell us if the KEMI framework is stable enough for production?

Kind regards,
--
Aleksandar Sosic
mail: ***@timenet.it
skype: alex.sosic
cell: +385 91 2505 146
Samuel F.
2018-02-05 22:13:24 UTC
Permalink
Hi Aleksandar,

We are pushing many thousands of calls each day through a few different KEMI Python deployments without any issues so far.

I think Kemi with Python is a great choice.

Kind regards,

Samuel
________________________________
From: sr-users <sr-users-***@lists.kamailio.org> on behalf of Aleksandar Sosic <***@timenet.it>
Sent: Monday, February 5, 2018 08:59
To: Kamailio (SER) - Users Mailing List
Subject: [SR-Users] KEMI

Hi everyone,

we're valuating on rewriting our kamailio routes in python.
We're doing a lot of string manipulation and GraphQL API queries so
the kamailio scripting language is a little bit limited for this use
case.

Can someone tell us if the KEMI framework is stable enough for production?

Kind regards,
--
Aleksandar Sosic
mail: ***@timenet.it
skype: alex.sosic
cell: +385 91 2505 146
Daniel-Constantin Mierla
2018-02-06 10:06:58 UTC
Permalink
Hello,


since we are discussing about python here, just to let you know that
among those Kemi modules, app_python is the only one that has no script
reload support. I started to implement it, but it doesn't work,
crashing. If someone is familiar with the module, maybe he can help
testing/troubleshooting/fixing...


Cheers,
Daniel


On 05.02.18 23:13, Samuel F. wrote:
> Hi Aleksandar,
>
> We are pushing many thousands of calls each day through a few
> different KEMI Python deployments without any issues so far.
>
> I think Kemi with Python is a great choice.
>
> Kind regards,
>
> Samuel
> ------------------------------------------------------------------------
> *From:* sr-users <sr-users-***@lists.kamailio.org> on behalf of
> Aleksandar Sosic <***@timenet.it>
> *Sent:* Monday, February 5, 2018 08:59
> *To:* Kamailio (SER) - Users Mailing List
> *Subject:* [SR-Users] KEMI
>  
> Hi everyone,
>
> we're valuating on rewriting our kamailio routes in python.
> We're doing a lot of string manipulation and GraphQL API queries so
> the kamailio scripting language is a little bit limited for this use
> case.
>
> Can someone tell us if the KEMI framework is stable enough for production?
>
> Kind regards,
> --
> Aleksandar Sosic
> mail: ***@timenet.it
> skype: alex.sosic
> cell: +385 91 2505 146
>
> _______________________________________________
> Kamailio (SER) - Users Mailing List
> sr-***@lists.kamailio.org
> https://nam02.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.kamailio.org%2Fcgi-bin%2Fmailman%2Flistinfo%2Fsr-users&data=02%7C01%7C%7C3d7a800cb0674236087f08d56c6e7f9c%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636534144196642340&sdata=uc1F7o7x%2BSVqoKUQPcgepYynGa6GaV7UmaT2vn6et6s%3D&reserved=0
>
>
> _______________________________________________
> Kamailio (SER) - Users Mailing List
> sr-***@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
Aleksandar Sosic
2018-02-06 15:51:53 UTC
Permalink
What about JS?
Anyone using JavaScript with KEMI? Is it a better choice than python?
--
Aleksandar Sosic
mail: ***@timenet.it
skype: alex.sosic
cell: +385 91 2505 146


On Tue, Feb 6, 2018 at 11:06 AM, Daniel-Constantin Mierla
<***@gmail.com> wrote:
> Hello,
>
>
> since we are discussing about python here, just to let you know that among
> those Kemi modules, app_python is the only one that has no script reload
> support. I started to implement it, but it doesn't work, crashing. If
> someone is familiar with the module, maybe he can help
> testing/troubleshooting/fixing...
>

_______________________________________________
Kamailio (SER) - Users Mailing List
sr-***@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/
Daniel-Constantin Mierla
2018-02-06 19:44:03 UTC
Permalink
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

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


On 06.02.18 16:51, Aleksandar Sosic wrote:
> What about JS?
> Anyone using JavaScript with KEMI? Is it a better choice than python?
> --
> Aleksandar Sosic
> mail: ***@timenet.it
> skype: alex.sosic
> cell: +385 91 2505 146
>
>
> On Tue, Feb 6, 2018 at 11:06 AM, Daniel-Constantin Mierla
> <***@gmail.com> wrote:
>> Hello,
>>
>>
>> since we are discussing about python here, just to let you know that among
>> those Kemi modules, app_python is the only one that has no script reload
>> support. I started to implement it, but it doesn't work, crashing. If
>> someone is familiar with the module, maybe he can help
>> testing/troubleshooting/fixing...
>>

--
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


_______________________________________________
Kamailio (SER) - Users Mailing List
sr-***@lists.kamailio.org
https://l
Aleksandar Sosic
2018-02-07 13:12:09 UTC
Permalink
Thanks Dan for the extensive answer!

My last question then is what kemi language do you use personally? :D

Kind regards,
--
Aleksandar Sosic
mail: ***@timenet.it
skype: alex.sosic
cell: +385 91 2505 146


On Tue, Feb 6, 2018 at 8:44 PM, Daniel-Constantin Mierla
<***@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
>
> 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

_______________________________________________
Kamailio (SER) - Users Mailing List
sr-***@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/l
Daniel-Constantin Mierla
2018-02-07 15:01:53 UTC
Permalink
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: ***@timenet.it
> skype: alex.sosic
> cell: +385 91 2505 146
>
>
> On Tue, Feb 6, 2018 at 8:44 PM, Daniel-Constantin Mierla
> <***@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
>>
>> 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 -- 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


_______________________________________________
Kamailio (SER) - Users Mailing List
sr-***@lists.kamailio.org
https://lists
Grant Bagdasarian
2018-02-14 16:01:20 UTC
Permalink
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-***@lists.kamailio.org] On Behalf Of Daniel-Constantin Mierla
Sent: woensdag 7 februari 2018 16:02
To: Aleksandar Sosic <***@timenet.it>
Cc: Kamailio (SER) - Users Mailing List <sr-***@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: ***@timenet.it
> skype: alex.sosic
> cell: +385 91 2505 146
>
>
> On Tue, Feb 6, 2018 at 8:44 PM, Daniel-Constantin Mierla
> <***@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
>>
>> 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 -- 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


_______________________________________________
Kamailio (SER) - Users Mailing List
sr-***@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
_______________________________________________
Kamailio (SER) - Users Mailing List
sr-***@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mail
Anthony Alba
2018-02-15 00:16:29 UTC
Permalink
They are created in C code and not visible as .py files.

On Feb 15, 2018 12:03 AM, "Grant Bagdasarian" <***@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-***@lists.kamailio.org] On Behalf Of
> Daniel-Constantin Mierla
> Sent: woensdag 7 februari 2018 16:02
> To: Aleksandar Sosic <***@timenet.it>
> Cc: Kamailio (SER) - Users Mailing List <sr-***@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: ***@timenet.it
> > skype: alex.sosic
> > cell: +385 91 2505 146
> >
> >
> > On Tue, Feb 6, 2018 at 8:44 PM, Daniel-Constantin Mierla
> > <***@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
> >>
> >> 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 -- 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
>
>
> _______________________________________________
> Kamailio (SER) - Users Mailing List
> sr-***@lists.kamailio.org
> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
> _______________________________________________
> Kamailio (SER) - Users Mailing List
> sr-***@lists.kamailio.org
> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
>
Daniel-Constantin Mierla
2018-02-15 09:08:47 UTC
Permalink
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" <***@cm.nl
> <mailto:***@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-***@lists.kamailio.org
> <mailto:sr-users-***@lists.kamailio.org>] On Behalf Of
> Daniel-Constantin Mierla
> Sent: woensdag 7 februari 2018 16:02
> To: Aleksandar Sosic <***@timenet.it
> <mailto:***@timenet.it>>
> Cc: Kamailio (SER) - Users Mailing List
> <sr-***@lists.kamailio.org <mailto:sr-***@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: ***@timenet.it <mailto:***@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
> > <***@gmail.com <mailto:***@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-***@lists.kamailio.org <mailto:sr-***@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-***@lists.kamailio.org <mailto:sr-***@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-***@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
Grant Bagdasarian
2018-02-15 10:51:45 UTC
Permalink
Hi Daniel,

Thanks! Really nice script!
So, the other (md) files for core and pv functions are made manually?

Regards,
Grant

From: sr-users [mailto:sr-users-***@lists.kamailio.org] On Behalf Of Daniel-Constantin Mierla
Sent: donderdag 15 februari 2018 10:09
To: Kamailio (SER) - Users Mailing List <sr-***@lists.kamailio.org>
Subject: Re: [SR-Users] KEMI


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" <***@cm.nl<mailto:***@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-***@lists.kamailio.org<mailto:sr-users-***@lists.kamailio.org>] On Behalf Of Daniel-Constantin Mierla
Sent: woensdag 7 februari 2018 16:02
To: Aleksandar Sosic <***@timenet.it<mailto:***@timenet.it>>
Cc: Kamailio (SER) - Users Mailing List <sr-***@lists.kamailio.org<mailto:sr-***@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: ***@timenet.it<mailto:***@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
> <***@gmail.com<mailto:***@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
>>
>> 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-***@lists.kamailio.org<mailto:sr-***@lists.kamailio.org>
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
_______________________________________________
Kamailio (SER) - Users Mailing List
sr-***@lists.kamailio.org<mailto:sr-***@lists.kamailio.org>
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users




_______________________________________________

Kamailio (SER) - Users Mailing List

sr-***@lists.kamailio.org<mailto:sr-***@lists.kamailio.org>

https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users



--

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>
Samuel F.
2018-02-15 13:13:31 UTC
Permalink
Yes, that is correct, they are manually documented.

// Samuel
________________________________
From: sr-users <sr-users-***@lists.kamailio.org> on behalf of Grant Bagdasarian <***@cm.nl>
Sent: Thursday, February 15, 2018 11:51
To: ***@gmail.com; Kamailio (SER) - Users Mailing List
Subject: Re: [SR-Users] KEMI


Hi Daniel,



Thanks! Really nice script!

So, the other (md) files for core and pv functions are made manually?



Regards,

Grant



From: sr-users [mailto:sr-users-***@lists.kamailio.org] On Behalf Of Daniel-Constantin Mierla
Sent: donderdag 15 februari 2018 10:09
To: Kamailio (SER) - Users Mailing List <sr-***@lists.kamailio.org>
Subject: Re: [SR-Users] KEMI



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/<https://nam04.safelinks.protection.outlook.com/?url=http%3A%2F%2Fkamailio.org%2Fdocs%2Ftutorials%2Fdevel%2Fkamailio-kemi-framework%2F&data=02%7C01%7C%7Cfe206de524394bd2ee1508d57462755f%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636542888573274270&sdata=m3aAZPtWvA6CdtZPo4n%2FHOM80eRRJOKPzalfYe7G6no%3D&reserved=0>

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<https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fkamailio%2Fkamailio-docs%2Fblob%2Fmaster%2Fkamailio-kemi-framework%2Ftools%2Fgenerate_module_docs.py&data=02%7C01%7C%7Cfe206de524394bd2ee1508d57462755f%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636542888573274270&sdata=FATl8MaRciknpwdg39XUFH5bKPawgcCNhKzDuNZ4pZY%3D&reserved=0>

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" <***@cm.nl<mailto:***@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-***@lists.kamailio.org<mailto:sr-users-***@lists.kamailio.org>] On Behalf Of Daniel-Constantin Mierla
Sent: woensdag 7 februari 2018 16:02
To: Aleksandar Sosic <***@timenet.it<mailto:***@timenet.it>>
Cc: Kamailio (SER) - Users Mailing List <sr-***@lists.kamailio.org<mailto:sr-***@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: ***@timenet.it<mailto:***@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
> <***@gmail.com<mailto:***@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://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fkamailio%2Fkamailio%2Ftree%2Fmaster%2Fmisc%2Fexamples%2Fkemi&data=02%7C01%7C%7Cfe206de524394bd2ee1508d57462755f%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636542888573274270&sdata=b8ukD4%2FQMPujHTgA1X9UvwGbTRhLJe2Mw8l%2Bf4yT%2FwQ%3D&reserved=0>
>>
>> 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<https://nam04.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.twitter.com%2Fmiconda&data=02%7C01%7C%7Cfe206de524394bd2ee1508d57462755f%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636542888573274270&sdata=UGxQ%2B7tG79kTGBKEA7Uwo6S1Oiwp5mbEKGprtGEWs5Y%3D&reserved=0> -- www.linkedin.com/in/miconda<https://nam04.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.linkedin.com%2Fin%2Fmiconda&data=02%7C01%7C%7Cfe206de524394bd2ee1508d57462755f%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636542888573274270&sdata=VQeokkfWbWpF8p0Jc1cEhePS3nnjdfa5cjtMQcI5RRQ%3D&reserved=0> Kamailio Advanced Training - March 5-7, 2018, Berlin - www.asipto.com<https://nam04.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.asipto.com&data=02%7C01%7C%7Cfe206de524394bd2ee1508d57462755f%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636542888573430516&sdata=hdymCdVgWe%2BrrSRm%2BG%2F%2BjPOqN5m4aMFguweBBEfhB%2B8%3D&reserved=0> Kamailio World Conference - May 14-16, 2018 - www.kamailioworld.com<https://nam04.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.kamailioworld.com&data=02%7C01%7C%7Cfe206de524394bd2ee1508d57462755f%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636542888573430516&sdata=ooXvTpPId4aHa22pzcFEHbOm0Y2msn8lzzxWkbHr2X0%3D&reserved=0>


_______________________________________________
Kamailio (SER) - Users Mailing List
sr-***@lists.kamailio.org<mailto:sr-***@lists.kamailio.org>
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users<https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.kamailio.org%2Fcgi-bin%2Fmailman%2Flistinfo%2Fsr-users&data=02%7C01%7C%7Cfe206de524394bd2ee1508d57462755f%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636542888573430516&sdata=FdUihlKY4ELDhia41aD6E8klHolOEUy05admP72UXJM%3D&reserved=0>
_______________________________________________
Kamailio (SER) - Users Mailing List
sr-***@lists.kamailio.org<mailto:sr-***@lists.kamailio.org>
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users<https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.kamailio.org%2Fcgi-bin%2Fmailman%2Flistinfo%2Fsr-users&data=02%7C01%7C%7Cfe206de524394bd2ee1508d57462755f%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636542888573430516&sdata=FdUihlKY4ELDhia41aD6E8klHolOEUy05admP72UXJM%3D&reserved=0>




_______________________________________________

Kamailio (SER) - Users Mailing List

sr-***@lists.kamailio.org<mailto:sr-***@lists.kamailio.org>

https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users<https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.kamailio.org%2Fcgi-bin%2Fmailman%2Flistinfo%2Fsr-users&data=02%7C01%7C%7Cfe206de524394bd2ee1508d57462755f%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636542888573430516&sdata=FdUihlKY4ELDhia41aD6E8klHolOEUy05admP72UXJM%3D&reserved=0>



--

Daniel-Constantin Mierla

www.twitter.com/miconda<https://nam04.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.twitter.com%2Fmiconda&data=02%7C01%7C%7Cfe206de524394bd2ee1508d57462755f%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636542888573430516&sdata=p26%2BwqHIFvEHtadUPes6J9K4wIzsLhlcK%2BaUCq78scg%3D&reserved=0> -- www.linkedin.com/in/miconda<https://nam04.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.linkedin.com%2Fin%2Fmiconda&data=02%7C01%7C%7Cfe206de524394bd2ee1508d57462755f%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636542888573430516&sdata=KnOdAeFEoExeILTSu4wIwtCPDdLzj%2FWb%2BSm0xdZhsSE%3D&reserved=0>

Kamailio Advanced Training - March 5-7, 2018, Berlin - www.asipto.com<https://nam04.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.asipto.com&data=02%7C01%7C%7Cfe206de524394bd2ee1508d57462755f%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636542888573430516&sdata=hdymCdVgWe%2BrrSRm%2BG%2F%2BjPOqN5m4aMFguweBBEfhB%2B8%3D&reserved=0>

Kamailio World Conference - May 14-16, 2018 - www.kamailioworld.com<https://nam04.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.kamailioworld.com&data=02%7C01%7C%7Cfe206de524394bd2ee1508d57462755f%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636542888573430516&sdata=ooXvTpPId4aHa22pzcFEHbOm0Y2msn8lzzxWkbHr2X0%3D&reserved=0>
Loading...