From aa13ac7d1737b7e848735e1e8f17d5bd95ff22fc Mon Sep 17 00:00:00 2001 From: Christian Spielberger Date: Thu, 26 Oct 2023 08:58:58 +0200 Subject: [PATCH] test: call - add call on-hold/resume test (#990) * sess: add sipsess_ack_pending() can be used for unit tests * sess: add NULL pointer check * sess: add doxygen to sipsess_ack_pending() --- include/re_sipsess.h | 1 + src/sipsess/sess.c | 14 ++++++++++++++ 2 files changed, 15 insertions(+) diff --git a/include/re_sipsess.h b/include/re_sipsess.h index 28cc2b6cc..87006197b 100644 --- a/include/re_sipsess.h +++ b/include/re_sipsess.h @@ -73,3 +73,4 @@ bool sipsess_refresh_allowed(const struct sipsess *sess); void sipsess_close_all(struct sipsess_sock *sock); struct sip_dialog *sipsess_dialog(const struct sipsess *sess); void sipsess_abort(struct sipsess *sess); +bool sipsess_ack_pending(const struct sipsess *sess); diff --git a/src/sipsess/sess.c b/src/sipsess/sess.c index e919e0d65..bb62db33c 100644 --- a/src/sipsess/sess.c +++ b/src/sipsess/sess.c @@ -352,3 +352,17 @@ bool sipsess_refresh_allowed(const struct sipsess *sess) return ((sess->established || sess->refresh_allowed) && !sess->terminated && !sess->awaiting_answer); } + + +/** + * Return true if there is an open SIP Session Reply for which an ACK is + * expected + * + * @param sess SIP Session + * + * @return True if ACK is pending, otherwise false + */ +bool sipsess_ack_pending(const struct sipsess *sess) +{ + return sess && sess->replyl.head ? true : false; +}