Hello all,
How can we handle stateless replies with kemi? tm has the following param: modparam("tm", "on_sl_reply", "stateless_replies")
What's the proper way to map the "stateless_reply" onreply_route to a kemi function. I'm playing with the app_jsdt module.
Thanks, Ovidiu
Hello,
have you tried to just define a onreply_route:
// Manage incoming replies // equivalent of onreply_route[...]{} function ksr_onreply_manage() { KSR.dbg("incoming reply\n"); var scode = KSR.kx.gets_status(); if (scode>100 && scode<=299) { ksr_route_natmanage(); } return; }
And then register this with the tm module function, as indicated in the docs? https://www.kamailio.org/docs/modules/devel/modules/tm.html#tm.p.on_sl_reply
Cheers,
Henning
-----Original Message----- From: Ovidiu Sas osas@voipembedded.com Sent: Montag, 27. März 2023 22:04 To: Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org Subject: [SR-Users] Handling stateless replies with kemi
Hello all,
How can we handle stateless replies with kemi? tm has the following param: modparam("tm", "on_sl_reply", "stateless_replies")
What's the proper way to map the "stateless_reply" onreply_route to a kemi function. I'm playing with the app_jsdt module.
Thanks, Ovidiu __________________________________________________________ Kamailio - Users Mailing List - Non Commercial Discussions To unsubscribe send an email to sr-users-leave@lists.kamailio.org Important: keep the mailing list in the recipients, do not reply only to the sender! Edit mailing list options or unsubscribe:
Hello Henning,
Everything is working ok. I guess the docs should be more clear (I was expecting some dedicated route). I will try to update the docs.
Thanks, Ovidiu
On Thu, Mar 30, 2023 at 3:30 AM Henning Westerholt hw@gilawa.com wrote:
Hello,
have you tried to just define a onreply_route:
// Manage incoming replies // equivalent of onreply_route[...]{} function ksr_onreply_manage() { KSR.dbg("incoming reply\n"); var scode = KSR.kx.gets_status(); if (scode>100 && scode<=299) { ksr_route_natmanage(); } return; }
And then register this with the tm module function, as indicated in the docs? https://www.kamailio.org/docs/modules/devel/modules/tm.html#tm.p.on_sl_reply
Cheers,
Henning
-----Original Message----- From: Ovidiu Sas osas@voipembedded.com Sent: Montag, 27. März 2023 22:04 To: Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org Subject: [SR-Users] Handling stateless replies with kemi
Hello all,
How can we handle stateless replies with kemi? tm has the following param: modparam("tm", "on_sl_reply", "stateless_replies")
What's the proper way to map the "stateless_reply" onreply_route to a kemi function. I'm playing with the app_jsdt module.
Thanks, Ovidiu __________________________________________________________ Kamailio - Users Mailing List - Non Commercial Discussions To unsubscribe send an email to sr-users-leave@lists.kamailio.org Important: keep the mailing list in the recipients, do not reply only to the sender! Edit mailing list options or unsubscribe:
Hi Ovidiu,
thanks for confirming back, sure some extension to the docs would be great.
Cheers,
Henning
-----Original Message----- From: Ovidiu Sas osas@voipembedded.com Sent: Donnerstag, 30. März 2023 18:00 To: Henning Westerholt hw@gilawa.com Cc: Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org Subject: Re: [SR-Users] Handling stateless replies with kemi
Hello Henning,
Everything is working ok. I guess the docs should be more clear (I was expecting some dedicated route). I will try to update the docs.
Thanks, Ovidiu
On Thu, Mar 30, 2023 at 3:30 AM Henning Westerholt hw@gilawa.com wrote:
Hello,
have you tried to just define a onreply_route:
// Manage incoming replies // equivalent of onreply_route[...]{} function ksr_onreply_manage() { KSR.dbg("incoming reply\n"); var scode = KSR.kx.gets_status(); if (scode>100 && scode<=299) { ksr_route_natmanage(); } return; }
And then register this with the tm module function, as indicated in the docs? https://www.kamailio.org/docs/modules/devel/modules/tm.html#tm.p.on_sl_reply
Cheers,
Henning
-----Original Message----- From: Ovidiu Sas osas@voipembedded.com Sent: Montag, 27. März 2023 22:04 To: Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org Subject: [SR-Users] Handling stateless replies with kemi
Hello all,
How can we handle stateless replies with kemi? tm has the following param: modparam("tm", "on_sl_reply", "stateless_replies")
What's the proper way to map the "stateless_reply" onreply_route to a kemi function. I'm playing with the app_jsdt module.
Thanks, Ovidiu __________________________________________________________ Kamailio - Users Mailing List - Non Commercial Discussions To unsubscribe send an email to sr-users-leave@lists.kamailio.org Important: keep the mailing list in the recipients, do not reply only to the sender! Edit mailing list options or unsubscribe:
Hello,
I have a question regarding Kamailio script and how the return code from a command export is handled as a boolean.
In Kamailio script, see this example:
if (!jansson_get("method", $rb, "$var(method)")) { xhttp_reply("400", "Bad Request", "", ""); exit; }
This code works, but I'm not sure why. Command "jansson_get" returns 1 if successful, and -1 if fails. Both values should be false. Which I can see when testing with this:
$var(r) = jansson_get("method", $rb, "$var(method)"); xlog("L_INFO", "jansson_get r: [$var(r)]\n"); if (!$var(r)) { xlog("L_INFO", "jansson_get r: [$var(r)] => FALSE\n"); } else { xlog("L_INFO", "jansson_get r: [$var(r)] => TRUE\n"); }
In all cases, the result is always TRUE. Is there some kind of "magic" conversion when directly checking the return of a command in Kamailio script ?
With KEMI python, the equivalent does not work:
if not KSR.jansson.get("method", KSR.pv.get("$rb"), "$var(method)"): KSR.xhttp.xhttp_reply(400, "Bad Request", "", "") return 1
So I have to do the following instead:
if KSR.jansson.get("method", KSR.pv.get("$rb"), "$var(method)") < 0: KSR.xhttp.xhttp_reply(400, "Bad Request", "", "") return 1
Thank you for your help.
Regards, Nicolas.
This message contains information that may be privileged or confidential and is the property of the Capgemini Group. It is intended only for the person to whom it is addressed. If you are not the intended recipient, you are not authorized to read, print, retain, copy, disseminate, distribute, or use this message or any part thereof. If you receive this message in error, please notify the sender immediately and delete all copies of this message.
Consider $rc.
— Sent from mobile, apologies for brevity and errors.
On Apr 2, 2023, at 1:01 PM, Chaigneau, Nicolas nicolas.chaigneau@capgemini.com wrote:
Hello,
I have a question regarding Kamailio script and how the return code from a command export is handled as a boolean.
In Kamailio script, see this example:
if (!jansson_get("method", $rb, "$var(method)")) { xhttp_reply("400", "Bad Request", "", ""); exit; }
This code works, but I'm not sure why. Command "jansson_get" returns 1 if successful, and -1 if fails. Both values should be false. Which I can see when testing with this:
$var(r) = jansson_get("method", $rb, "$var(method)"); xlog("L_INFO", "jansson_get r: [$var(r)]\n"); if (!$var(r)) { xlog("L_INFO", "jansson_get r: [$var(r)] => FALSE\n"); } else { xlog("L_INFO", "jansson_get r: [$var(r)] => TRUE\n"); }
In all cases, the result is always TRUE. Is there some kind of "magic" conversion when directly checking the return of a command in Kamailio script ?
With KEMI python, the equivalent does not work:
if not KSR.jansson.get("method", KSR.pv.get("$rb"), "$var(method)"): KSR.xhttp.xhttp_reply(400, "Bad Request", "", "") return 1
So I have to do the following instead:
if KSR.jansson.get("method", KSR.pv.get("$rb"), "$var(method)") < 0: KSR.xhttp.xhttp_reply(400, "Bad Request", "", "") return 1
Thank you for your help.
Regards, Nicolas.
This message contains information that may be privileged or confidential and is the property of the Capgemini Group. It is intended only for the person to whom it is addressed. If you are not the intended recipient, you are not authorized to read, print, retain, copy, disseminate, distribute, or use this message or any part thereof. If you receive this message in error, please notify the sender immediately and delete all copies of this message.
Kamailio - Users Mailing List - Non Commercial Discussions To unsubscribe send an email to sr-users-leave@lists.kamailio.org Important: keep the mailing list in the recipients, do not reply only to the sender! Edit mailing list options or unsubscribe:
Thanks Alex :)
I searched for $rc and found this:
The definition of the sub-route block follows the general rules, with a name in between square brackets and actions between curly braces. A sub-route can return an integer value back to the routing block that executed it. The return code can be retrieved via $rc variables.
Evaluation of the return of a subroute is done with following rules:
negative value is evaluated as false 0 - is interpreted as exit positive value is evaluated as true
I assume this also applies to command functions, not just "route" blocks.
But this only applies to Kamailio script, not to KEMI, is that correct ? If so, do you know why the behavior is not the same in KEMI script ?
Regards, Nicolas.
-----Message d'origine----- De : Alex Balashov abalashov@evaristesys.com
Consider $rc.
On Apr 2, 2023, at 1:01 PM, Chaigneau, Nicolas nicolas.chaigneau@capgemini.com wrote:
Hello,
I have a question regarding Kamailio script and how the return code from a command export is handled as a boolean.
In Kamailio script, see this example:
if (!jansson_get("method", $rb, "$var(method)")) { xhttp_reply("400", "Bad Request", "", ""); exit; }
This code works, but I'm not sure why. Command "jansson_get" returns 1 if successful, and -1 if fails. Both values should be false. Which I can see when testing with this:
$var(r) = jansson_get("method", $rb, "$var(method)"); xlog("L_INFO", "jansson_get r: [$var(r)]\n"); if (!$var(r)) { xlog("L_INFO", "jansson_get r: [$var(r)] => FALSE\n"); } else { xlog("L_INFO", "jansson_get r: [$var(r)] => TRUE\n"); }
In all cases, the result is always TRUE. Is there some kind of "magic" conversion when directly checking the return of a command in Kamailio script ?
With KEMI python, the equivalent does not work:
if not KSR.jansson.get("method", KSR.pv.get("$rb"), "$var(method)"): KSR.xhttp.xhttp_reply(400, "Bad Request", "", "") return 1
So I have to do the following instead:
if KSR.jansson.get("method", KSR.pv.get("$rb"), "$var(method)") < 0: KSR.xhttp.xhttp_reply(400, "Bad Request", "", "") return 1
Thank you for your help.
Regards, Nicolas.
This message contains information that may be privileged or confidential and is the property of the Capgemini Group. It is intended only for the person to whom it is addressed. If you are not the intended recipient, you are not authorized to read, print, retain, copy, disseminate, distribute, or use this message or any part thereof. If you receive this message in error, please notify the sender immediately and delete all copies of this message.
Hello,
we can control/decide how to interpret returned codes on our config language interpreter written from scratch, but not how it is done by an external interpreter written by others.
Cheers, Daniel
On 03.04.23 00:20, Chaigneau, Nicolas wrote:
Thanks Alex :)
I searched for $rc and found this:
The definition of the sub-route block follows the general rules, with a name in between square brackets and actions between curly braces. A sub-route can return an integer value back to the routing block that executed it. The return code can be retrieved via $rc variables.
Evaluation of the return of a subroute is done with following rules:
negative value is evaluated as false 0 - is interpreted as exit positive value is evaluated as true
I assume this also applies to command functions, not just "route" blocks.
But this only applies to Kamailio script, not to KEMI, is that correct ? If so, do you know why the behavior is not the same in KEMI script ?
Regards, Nicolas.
-----Message d'origine----- De : Alex Balashov abalashov@evaristesys.com
Consider $rc.
On Apr 2, 2023, at 1:01 PM, Chaigneau, Nicolas nicolas.chaigneau@capgemini.com wrote:
Hello,
I have a question regarding Kamailio script and how the return code from a command export is handled as a boolean.
In Kamailio script, see this example:
if (!jansson_get("method", $rb, "$var(method)")) { xhttp_reply("400", "Bad Request", "", ""); exit; }
This code works, but I'm not sure why. Command "jansson_get" returns 1 if successful, and -1 if fails. Both values should be false. Which I can see when testing with this:
$var(r) = jansson_get("method", $rb, "$var(method)"); xlog("L_INFO", "jansson_get r: [$var(r)]\n"); if (!$var(r)) { xlog("L_INFO", "jansson_get r: [$var(r)] => FALSE\n"); } else { xlog("L_INFO", "jansson_get r: [$var(r)] => TRUE\n"); }
In all cases, the result is always TRUE. Is there some kind of "magic" conversion when directly checking the return of a command in Kamailio script ?
With KEMI python, the equivalent does not work:
if not KSR.jansson.get("method", KSR.pv.get("$rb"), "$var(method)"): KSR.xhttp.xhttp_reply(400, "Bad Request", "", "") return 1
So I have to do the following instead:
if KSR.jansson.get("method", KSR.pv.get("$rb"), "$var(method)") < 0: KSR.xhttp.xhttp_reply(400, "Bad Request", "", "") return 1
Thank you for your help.
Regards, Nicolas.
This message contains information that may be privileged or confidential and is the property of the Capgemini Group. It is intended only for the person to whom it is addressed. If you are not the intended recipient, you are not authorized to read, print, retain, copy, disseminate, distribute, or use this message or any part thereof. If you receive this message in error, please notify the sender immediately and delete all copies of this message. __________________________________________________________ Kamailio - Users Mailing List - Non Commercial Discussions To unsubscribe send an email to sr-users-leave@lists.kamailio.org Important: keep the mailing list in the recipients, do not reply only to the sender! Edit mailing list options or unsubscribe: