summaryrefslogtreecommitdiff
path: root/src/call.c
diff options
context:
space:
mode:
authorAlfred E. Heggestad <aeh@db.org>2015-10-11 11:24:37 +0200
committerAlfred E. Heggestad <aeh@db.org>2015-10-11 11:24:37 +0200
commit25225de72f2ba6c89abe862e2e027906c9ef8a76 (patch)
treeb1cf229229b7e29249d57fd0e41eee3ebbd9d147 /src/call.c
parentbf9a477a0fc1ab83690a2083a02708e85224b3c1 (diff)
ua: add support for hold+answer
- added ua_hold_answer() which will first put on-hold the active call (if exist) and then answer the new incoming call fixes #50
Diffstat (limited to 'src/call.c')
-rw-r--r--src/call.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/src/call.c b/src/call.c
index 322f468..c67980d 100644
--- a/src/call.c
+++ b/src/call.c
@@ -65,6 +65,7 @@ struct call {
time_t time_conn; /**< Time when call initiated */
time_t time_stop; /**< Time when call stopped */
bool got_offer; /**< Got SDP Offer from Peer */
+ bool on_hold; /**< True if call is on hold */
struct mnat_sess *mnats; /**< Media NAT session */
bool mnat_wait; /**< Waiting for MNAT to establish */
struct menc_sess *mencs; /**< Media encryption session state */
@@ -779,8 +780,13 @@ int call_hold(struct call *call, bool hold)
if (!call || !call->sess)
return EINVAL;
+ if (hold == call->on_hold)
+ return 0;
+
info("call: %s %s\n", hold ? "hold" : "resume", call->peer_uri);
+ call->on_hold = hold;
+
FOREACH_STREAM
stream_hold(le->data, hold);
@@ -909,8 +915,10 @@ int call_info(struct re_printf *pf, const struct call *call)
if (!call)
return 0;
- return re_hprintf(pf, "%H %8s %s", print_duration, call,
- state_name(call->state), call->peer_uri);
+ return re_hprintf(pf, "%H %9s %s %s", print_duration, call,
+ state_name(call->state),
+ call->on_hold ? "(on hold)" : " ",
+ call->peer_uri);
}
@@ -1654,3 +1662,9 @@ void call_set_xrtpstat(struct call *call)
"X-RTP-Stat: %H\r\n",
audio_print_rtpstat, call->audio);
}
+
+
+bool call_is_onhold(const struct call *call)
+{
+ return call ? call->on_hold : false;
+}