diff --git a/kamcli/commands/cmd_acc.py b/kamcli/commands/cmd_acc.py index 9e57eb6..6052de5 100644 --- a/kamcli/commands/cmd_acc.py +++ b/kamcli/commands/cmd_acc.py @@ -231,6 +231,51 @@ def acc_list(ctx, oformat, ostyle, limit): ioutils_dbres_print(ctx, oformat, ostyle, res) +@cli.command( + "mc-list", + short_help="List missed calls records", +) +@click.option( + "oformat", + "--output-format", + "-F", + type=click.Choice(["raw", "json", "table", "dict"]), + default=None, + help="Format the output", +) +@click.option( + "ostyle", + "--output-style", + "-S", + default=None, + help="Style of the output (tabulate table format)", +) +@click.option( + "limit", + "--limit", + "-l", + type=int, + default=20, + help="The limit of listed records (default: 20)", +) +@pass_context +def acc_mc_list(ctx, oformat, ostyle, limit): + """List missed calls records + + \b + """ + e = create_engine(ctx.gconfig.get("db", "rwurl")) + ctx.vlog("Showing missed calls records") + query = "" + if limit == 0: + query = "select * from missed_calls order by id desc" + else: + query = "select * from missed_calls order by id desc limit {0}".format(limit) + res = e.execute(query) + ioutils_dbres_print(ctx, oformat, ostyle, res) + + + @cli.command( "cdrs-generate", short_help="Run SQL stored procedure to generate CDRS",