From 49ea18057b64e2a806d6799bc2aa87b30491634e Mon Sep 17 00:00:00 2001 From: "Alfred E. Heggestad" Date: Tue, 26 Jul 2016 23:38:03 +0200 Subject: add '@' command to switch calls using line numbers 1. for a given UA, each call has a unique line number starting from 1 2. the list of calls is sorted in an arbitrary order, but the last list element indicates "current call" 3. the '@' command takes a numeric argument which is the line-number of the wanted call --- src/ua.c | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) (limited to 'src/ua.c') diff --git a/src/ua.c b/src/ua.c index 35626f7..41a80e7 100644 --- a/src/ua.c +++ b/src/ua.c @@ -1545,21 +1545,35 @@ int ua_print_sip_status(struct re_printf *pf, void *unused) */ int ua_print_calls(struct re_printf *pf, const struct ua *ua) { - struct le *le; + uint32_t n, count=0; + uint32_t linenum; int err = 0; + if (!ua) { err |= re_hprintf(pf, "\n--- No active calls ---\n"); return err; } + n = list_count(&ua->calls); + err |= re_hprintf(pf, "\n--- List of active calls (%u): ---\n", - list_count(&ua->calls)); + n); + + for (linenum=CALL_LINENUM_MIN; linenumcalls.head; le; le = le->next) { + const struct call *call; - const struct call *call = le->data; + call = call_find_linenum(&ua->calls, linenum); + if (call) { + ++count; - err |= re_hprintf(pf, " %H\n", call_info, call); + err |= re_hprintf(pf, " %c %H\n", + call == ua_call(ua) ? '>' : ' ', + call_info, call); + } + + if (count >= n) + break; } err |= re_hprintf(pf, "\n"); -- cgit v1.2.3