[SR-Users] KEMI Ruby - exit from within function

Andrew White andrew at uconnected.com.au
Sat Mar 23 05:16:51 CET 2019

Thanks so much for your quick response and fix Daniel!

This works perfectly! I’ve come across another minor bug around KEMI/Ruby, but I’ll post it to GitHub issues.

See you at Kamailio World in a few weeks, looks like I owe you a beer!



Andrew White - Director
Email: andrew at uconnected.com.au
Web: www.uConnected.com.au


> On 23 Mar 2019, at 12:05 am, Daniel-Constantin Mierla <miconda at gmail.com> wrote:
> Hello,
> can you try with latest master or pick the next commit in your local clone?
>   * https://github.com/kamailio/kamailio/commit/97189d7508a3946c2b3de49c178614356d816508 <https://github.com/kamailio/kamailio/commit/97189d7508a3946c2b3de49c178614356d816508>
> I just pushed it trying to catch the exception triggered by 'exit' and don't log error messages in that case.
> Cheers,
> Daniel
> On 22.03.19 04:48, Andrew White wrote:
>> Hi all,
>> I know ruby is pretty new to KEMI, so I understand this might not be supported.
>> I’ve been able to build a functional basic configuration using KEMI based app_ruby. However the function KSR::x.exit is not exposed to the interpreter. Reading up on the function (https://kamailio.org/docs/tutorials/devel/kamailio-kemi-framework/kemimods/#ksrxexit <https://kamailio.org/docs/tutorials/devel/kamailio-kemi-framework/kemimods/#ksrxexit>) I can see either a native `exit` or a return from the request_route is recommended.
>> The latter of these works fine, however the former throws the following error when called either within the request_route function or any others:
>> Mar 22 03:40:46 guest /usr/sbin/kamailio[17474]: ERROR: {1 19731 BYE 8u6We4ReU01GuU-zoa7VuqC.qWwwg29S} app_ruby [app_ruby_api.c:105]: app_ruby_print_last_exception(): exception: exit
>> Mar 22 03:40:46 guest /usr/sbin/kamailio[17474]: ERROR: {1 19731 BYE 8u6We4ReU01GuU-zoa7VuqC.qWwwg29S} app_ruby [app_ruby_api.c:1078]: app_ruby_run_ex(): ruby exception (6) on callback for: ksr_request_route (res type: 17)
>> It appears the app_ruby wrapper is seeing an exit as an exception and throwing an error. I’m unsure if this is affecting my actual flow (still building the config), but the error in the logs is certainly annoying. Returning from the request_route function works fine, however this is obviously harder to do from within a sub function.
>> Any direction on how to correctly exit in similar ways to native or other KEMI implementations would be appreciated.
>> By the way, thanks Daniel for writing this module! This makes Kamailio significantly more accessible for myself and others like me!
>> ________________________________
>> Andrew White - Director
>> uConnected
>> Email: andrew at uconnected.com.au <mailto:andrew at uconnected.com.au>
>> Web: www.uConnected.com.au <http://www.uconnected.com.au/>
>> _______________________________________________
>> 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>
> -- 
> Daniel-Constantin Mierla -- www.asipto.com <http://www.asipto.com/>
> www.twitter.com/miconda <http://www.twitter.com/miconda> -- www.linkedin.com/in/miconda <http://www.linkedin.com/in/miconda>
> Kamailio World Conference - May 6-8, 2019 -- www.kamailioworld.com <http://www.kamailioworld.com/>
> Kamailio Advanced Training - Mar 25-27, 2019, in Washington, DC, USA -- www.asipto.com <http://www.asipto.com/>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kamailio.org/pipermail/sr-users/attachments/20190323/9e6eb7fc/attachment.html>

More information about the sr-users mailing list