I have just edited kamctl in order to make lcr commands work. Hope that helps someone.
Using Kamailio 4.3.0
Please find kamctl attached also
### LCR management
#
lcr() *{*
*case* $1 *in*
show_gws)
# merr "command disabled"
# exit 1
require_dbengine
mecho "lcr gateways"
QUERY="select * FROM lcr_gw ORDER BY id; "
$DBROCMD "$QUERY"
;;
show_routes)
# merr "command disabled"
# exit 1
require_dbengine
mecho "lcr routes"
QUERY="select * FROM lcr_rule ORDER BY id;"
$DBROCMD "$QUERY"
;;
reload)
# merr "command disabled"
# exit 1
kamcmd lcr.reload
;;
dump_gws)
# merr "command disabled"
# exit 1
kamcmd lcr.dump_gws
;;
dump_routes)
# merr "command disabled"
# exit 1
kamcmd lcr.dump_rules
*exit* 1
;;
eval_weights)
*shift*
$AWK 'BEGIN {
if (ARGC < 2) {
printf("Usage: lcr eval_weights <list of weights (integers 1-254)>\n");
exit;
}
iters = 100000;
for (i = 1; i < ARGC; i++) { counts[i] = 0; }
for (i = 1; i <= iters; i++) {
for (j = 1; j < ARGC; j++) {
elem[j] = ARGV[j] * rshift(int(2147483647 * rand()), 8);
}
at = 1;
max = elem[at];
for (j = 2; j < ARGC; j++) {
if (elem[j] > max) {
max = elem[j];
at = j;
}
}
counts[at] = counts[at] + 1;
}
for (i = 1; i < ARGC; i++) {
printf("weight %d probability %.4f\n", ARGV[i], counts[i]/iters);
}
}' $@
;;
*)
usage_lcr
*exit* 1
*esac*
*}*
Alberto Sagredo writes:
I have just edited kamctl in order to make lcr commands work. Hope that helps someone.
Using Kamailio 4.3.0
Please find kamctl attached also
Alberto,
Thanks for your kamctl contribution. If you like it to be committed to next release, please provide a new version that does not replace $ variables with fixed values. Also, remove old code comments.
-- Juha
On 02/03/16 08:54, Juha Heinanen wrote:
Alberto Sagredo writes:
I have just edited kamctl in order to make lcr commands work. Hope that helps someone.
Using Kamailio 4.3.0
Please find kamctl attached also
Alberto,
Thanks for your kamctl contribution. If you like it to be committed to next release, please provide a new version that does not replace $ variables with fixed values. Also, remove old code comments.
The best it will be to make a pull request via Github portal, it is easier to review and see if there are conflicts on merging.
Here are few links for github docs on this matter: - https://help.github.com/articles/using-pull-requests/ - https://help.github.com/articles/creating-a-pull-request/
Also, important to properly format the commit message:
- https://www.kamailio.org/wiki/devel/github-contributions#commit_message_form...
Cheers, Daniel