summaryrefslogtreecommitdiff
path: root/src/call.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/call.c')
-rw-r--r--src/call.c29
1 files changed, 26 insertions, 3 deletions
diff --git a/src/call.c b/src/call.c
index 3114830..41c6d16 100644
--- a/src/call.c
+++ b/src/call.c
@@ -62,6 +62,7 @@ struct call {
struct tmr tmr_inv; /**< Timer for incoming calls */
struct tmr tmr_dtmf; /**< Timer for incoming DTMF events */
time_t time_start; /**< Time when call started */
+ time_t time_conn; /**< Time when call initiated */
time_t time_stop; /**< Time when call stopped */
bool got_offer; /**< Got SDP Offer from Peer */
struct mnat_sess *mnats; /**< Media NAT session */
@@ -631,7 +632,10 @@ int call_hangup(struct call *call, uint16_t scode, const char *reason)
break;
default:
- info("call: terminate call with %s\n", call->peer_uri);
+ info("call: terminate call '%s' with %s\n",
+ sip_dialog_callid(sipsess_dialog(call->sess)),
+ call->peer_uri);
+
call->sess = mem_deref(call->sess);
break;
}
@@ -694,7 +698,7 @@ int call_answer(struct call *call, uint16_t scode)
return err;
err = sipsess_answer(call->sess, scode, "Answering", desc,
- "Allow: %s\r\n", uag_allowed_methods());
+ "Allow: %s\r\n", uag_allowed_methods());
mem_deref(desc);
@@ -1115,7 +1119,7 @@ static void sipsess_refer_handler(struct sip *sip, const struct sip_msg *msg,
ua_cuser(call->ua), "message/sipfrag",
auth_handler, call->acc, true,
sipnot_close_handler, call,
- "Allow: %s\r\n", uag_allowed_methods());
+ "Allow: %s\r\n", uag_allowed_methods());
if (err) {
warning("call: refer: sipevent_accept failed: %m\n", err);
return;
@@ -1307,6 +1311,9 @@ static int send_invite(struct call *call)
warning("call: sipsess_connect: %m\n", err);
}
+ /* save call setup timer */
+ call->time_conn = time(NULL);
+
mem_deref(desc);
return err;
@@ -1330,6 +1337,22 @@ uint32_t call_duration(const struct call *call)
/**
+ * Get the current call setup time in seconds
+ *
+ * @param call Call object
+ *
+ * @return Call setup in seconds
+ */
+uint32_t call_setup_duration(const struct call *call)
+{
+ if (!call || !call->time_conn || call->time_conn <= 0 )
+ return 0;
+
+ return (uint32_t)(call->time_start - call->time_conn);
+}
+
+
+/**
* Get the audio object for the current call
*
* @param call Call object