Feature #1680

OsmoNITB - Bug #1604: Easier / more direct SIP integration

osmo-sip-connector: Add show VTY commands

Added by zecke over 2 years ago. Updated about 2 hours ago.

Target version:
Start date:
Due date:
% Done:


Estimated time:


Add show calls and maybe other commands to list calls and legs and their individual state.


#1 Updated by laforge over 2 years ago

  • Category set to osmo-sip-connector

#2 Updated by laforge over 1 year ago

  • Project changed from OsmoNITB to osmo-sip-connector
  • Category deleted (osmo-sip-connector)

#3 Updated by laforge 11 months ago

#4 Updated by laforge 6 months ago

  • Assignee changed from zecke to sysmocom

#5 Updated by laforge 19 days ago

  • Assignee changed from sysmocom to osmith

#6 Updated by laforge about 5 hours ago

  • Priority changed from Normal to High

#7 Updated by neels about 2 hours ago

little VTY code intro:

example from osmo-bsc: osmo-bsc.git/src/osmo-bsc/bsc_vty.c

DEFUN(show_bts, show_bts_cmd, "show bts [<0-255>]",
        SHOW_STR "Display information about a BTS\n" 
                "BTS number")
        struct gsm_network *net = gsmnet_from_vty(vty);
        int bts_nr;

        if (argc != 0) {
                /* use the BTS number that the user has specified */
                bts_nr = atoi(argv[0]);
                if (bts_nr >= net->num_bts) {
                        vty_out(vty, "%% can't find BTS '%s'%s", argv[0],
                        return CMD_WARNING;
                bts_dump_vty(vty, gsm_bts_num(net, bts_nr));
                return CMD_SUCCESS;
        /* print all BTS's */
        for (bts_nr = 0; bts_nr < net->num_bts; bts_nr++)
                bts_dump_vty(vty, gsm_bts_num(net, bts_nr));

        return CMD_SUCCESS;



The DEFUN comes from libosmocore/include/osmocom/vty/command.h.

DEFUN(my_invented_name, my_invented_name_cmd,
      "my invented name (with|options)",
      "Documentation for 'my' keyword\n"  // <-- for the docs, no comma! just a str separated by newlines
      "Documentation for 'invented' keyword\n" 
      "Doc for 'name'\n" 
      "Doc for 'with'\n" 
      "Doc for 'options'\n")
    vty_out(vty, "selected option was '%s'.%s", argv[0], VTY_NEWLINE); // <-- always use VTY_NEWLINE!
    return CMD_SUCCESS;

then, in some init func, place the _cmd at the VTY nodes, e.g. on the VIEW and ENABLE nodes with


In the VTY, you typically don't do input validation, since the command description already ensures that the input matches. In above example, just strcmp("option", argv[0 ]), no need to do something like 'else vty_out(vty, "unknown command!%s", VTY_NEWLINE);'.

braces indicate (alternatives|...), <numbers>, [args-that-can-be-omitted], and all-caps means unvalidated arbitrary argument.

my command (keyword|choices) <0-9> [(optional|arg)] [optional_arg2]
my command2 FREE_FORMAT_STR

So, the example above is a VTY command invoked as one of

show bts
show bts 0

Often, it makes sense to not use optional [args], but instead create two separate DEFUN, one with and one without the arg.

#8 Updated by neels about 2 hours ago

and btw, each of our manuals has an introductory chapter describing the vty interaction and nodes... e.g. chapter 8 in

There are also separate auto-generated VTY reference manuals; less interesting / identical to the VTY cmdline online help.

Also available in: Atom PDF

Add picture from clipboard (Maximum size: 48.8 MB)