summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlfred E. Heggestad <alfred.heggestad@gmail.com>2018-01-17 19:30:01 +0100
committerAlfred E. Heggestad <alfred.heggestad@gmail.com>2018-01-17 19:30:01 +0100
commit535fc124686c212be2ce6f1a646505a58879b190 (patch)
tree5ecfce28e01bda1bcfc3ed562a295d970ba5eae1
parent67829d86c4c2d173807b532e97c09402415341c5 (diff)
call: add call_id accessor
-rw-r--r--include/baresip.h1
-rw-r--r--src/call.c6
-rw-r--r--test/call.c2
3 files changed, 9 insertions, 0 deletions
diff --git a/include/baresip.h b/include/baresip.h
index 526354d..ee2cdbf 100644
--- a/include/baresip.h
+++ b/include/baresip.h
@@ -113,6 +113,7 @@ void call_set_handlers(struct call *call, call_event_h *eh,
uint16_t call_scode(const struct call *call);
uint32_t call_duration(const struct call *call);
uint32_t call_setup_duration(const struct call *call);
+const char *call_id(const struct call *call);
const char *call_peeruri(const struct call *call);
const char *call_peername(const struct call *call);
const char *call_localuri(const struct call *call);
diff --git a/src/call.c b/src/call.c
index 99bec4b..67b3c22 100644
--- a/src/call.c
+++ b/src/call.c
@@ -901,6 +901,12 @@ int call_sdp_get(const struct call *call, struct mbuf **descp, bool offer)
}
+const char *call_id(const struct call *call)
+{
+ return call ? sip_dialog_callid(sipsess_dialog(call->sess)) : NULL;
+}
+
+
const char *call_peeruri(const struct call *call)
{
return call ? call->peer_uri : NULL;
diff --git a/test/call.c b/test/call.c
index 34c5fd5..73f3ebd 100644
--- a/test/call.c
+++ b/test/call.c
@@ -176,6 +176,8 @@ static void event_handler(struct ua *ua, enum ua_event ev,
case UA_EVENT_CALL_ESTABLISHED:
++ag->n_established;
+ ASSERT_TRUE(str_isset(call_id(call)));
+
/* are both agents established? */
if (ag->n_established >= f->exp_estab &&
ag->peer->n_established >= f->exp_estab) {