diff --git a/include/re_sipsess.h b/include/re_sipsess.h index b1f0087e1..5c9db188b 100644 --- a/include/re_sipsess.h +++ b/include/re_sipsess.h @@ -83,4 +83,5 @@ 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); +bool sipsess_msg_equal(const struct sipsess *sess, const struct sip_msg *msg); enum sdp_neg_state sipsess_sdp_neg_state(const struct sipsess *sess); diff --git a/src/sipsess/sess.c b/src/sipsess/sess.c index 18123aa91..a14ef8180 100644 --- a/src/sipsess/sess.c +++ b/src/sipsess/sess.c @@ -372,6 +372,21 @@ bool sipsess_ack_pending(const struct sipsess *sess) } +/** + * Compares the sessions SIP message with given SIP message + * + * @param sess SIP Session + * @param msg SIP Message + * @return True if msg matches with sess->msg + */ +bool sipsess_msg_equal(const struct sipsess *sess, const struct sip_msg *msg) +{ + if (!sess) + return false; + + return sess->msg == msg; +} + /** * Get the SDP negotiation state of a SIP Session *