summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/baresip.h1
-rw-r--r--modules/menu/menu.c9
-rw-r--r--src/ua.c21
3 files changed, 31 insertions, 0 deletions
diff --git a/include/baresip.h b/include/baresip.h
index cfd3972..9ade882 100644
--- a/include/baresip.h
+++ b/include/baresip.h
@@ -509,6 +509,7 @@ const char *ua_local_cuser(const struct ua *ua);
struct account *ua_account(const struct ua *ua);
const char *ua_outbound(const struct ua *ua);
struct call *ua_call(const struct ua *ua);
+struct call *ua_prev_call(const struct ua *ua);
struct account *ua_prm(const struct ua *ua);
struct list *ua_calls(const struct ua *ua);
enum presence_status ua_presence_status(const struct ua *ua);
diff --git a/modules/menu/menu.c b/modules/menu/menu.c
index bf64b28..08bd49c 100644
--- a/modules/menu/menu.c
+++ b/modules/menu/menu.c
@@ -513,6 +513,14 @@ static int call_holdresume(struct re_printf *pf, void *arg)
}
+static int hold_prev_call(struct re_printf *pf, void *unused)
+{
+ (void)pf;
+ (void)unused;
+ return call_hold(ua_prev_call(uag_cur()), true);
+}
+
+
#ifdef USE_VIDEO
static int call_videoenc_cycle(struct re_printf *pf, void *unused)
{
@@ -569,6 +577,7 @@ static const struct cmd callcmdv[] = {
{'m', 0, "Call mute/un-mute", call_mute },
{'r', CMD_IPRM,"Transfer call", call_xfer },
{'x', 0, "Call hold", call_holdresume },
+ {'H', 0, "Hold previous call", hold_prev_call },
#ifdef USE_VIDEO
{'E', 0, "Cycle video encoder", call_videoenc_cycle },
diff --git a/src/ua.c b/src/ua.c
index 5bdb991..0010de5 100644
--- a/src/ua.c
+++ b/src/ua.c
@@ -923,6 +923,27 @@ struct call *ua_call(const struct ua *ua)
}
+struct call *ua_prev_call(const struct ua *ua)
+{
+ struct le *le;
+ int prev = 0;
+
+ if (!ua)
+ return NULL;
+
+ for (le = ua->calls.tail; le; le = le->prev) {
+ if ( prev == 1) {
+ struct call *call = le->data;
+ return call;
+ }
+ if ( prev == 0)
+ prev = 1;
+ }
+
+ return NULL;
+}
+
+
int ua_debug(struct re_printf *pf, const struct ua *ua)
{
struct le *le;