From 66248b7c5f87663346bd8782ce2869b9737386cd Mon Sep 17 00:00:00 2001 From: Donat Zenichev Date: Mon, 13 Jul 2026 14:01:46 +0200 Subject: [PATCH] MT#62266 SessionTimer: `updateTimer()` return true/false Make both `updateTimer()` overloads be returning true/false, this will allow to react on the func caller's side to act accordingly whenever required. Change-Id: Iba6bfa6b21e74d657652c649064fe0a93ad6f1eb --- core/plug-in/session_timer/SessionTimer.cpp | 24 +++++++++++++-------- core/plug-in/session_timer/SessionTimer.h | 6 +++--- 2 files changed, 18 insertions(+), 12 deletions(-) diff --git a/core/plug-in/session_timer/SessionTimer.cpp b/core/plug-in/session_timer/SessionTimer.cpp index 985eb851..4edc970d 100644 --- a/core/plug-in/session_timer/SessionTimer.cpp +++ b/core/plug-in/session_timer/SessionTimer.cpp @@ -85,7 +85,9 @@ bool SessionTimer::process(AmEvent* ev) bool SessionTimer::onSipRequest(const AmSipRequest& req) { - updateTimer(s,req); + if (!updateTimer(s, req)) { + DBG("Session timers aren't supported by this leg.\n"); + } return false; } @@ -133,7 +135,9 @@ bool SessionTimer::onSipReply(const AmSipRequest& req, const AmSipReply& reply, if ((reply.cseq_method == SIP_METH_INVITE) || (reply.cseq_method == SIP_METH_UPDATE)) { - updateTimer(s,reply); + if (!updateTimer(s, reply)) { + DBG("Session timers aren't supported by this leg.\n"); + } } return false; @@ -264,12 +268,12 @@ bool SessionTimerFactory::checkSessionExpires(const AmSipRequest& req, AmConfigR return true; } -void SessionTimer::updateTimer(AmSession* s, const AmSipRequest& req) +bool SessionTimer::updateTimer(AmSession* s, const AmSipRequest& req) { /* if timers aren't supporte by us, then just hesitate */ if (!session_timer_conf.getEnableSessionTimer()) { DBG("Timers aren't supported, nothing to do."); - return; + return true; } if((req.method == SIP_METH_INVITE)||(req.method == SIP_METH_UPDATE)){ @@ -285,7 +289,7 @@ void SessionTimer::updateTimer(AmSession* s, const AmSipRequest& req) DBG("Session timer not supported by request originator's leg, remove session timer intervals"); session_timer_conf.setEnableSessionTimer(false); removeTimers(s); - return; + return false; } // determine session interval @@ -359,14 +363,15 @@ void SessionTimer::updateTimer(AmSession* s, const AmSipRequest& req) } else if (req.method == "BYE") { removeTimers(s); } + return true; } -void SessionTimer::updateTimer(AmSession* s, const AmSipReply& reply) +bool SessionTimer::updateTimer(AmSession* s, const AmSipReply& reply) { /* if timers aren't supporte by us, then just hesitate */ if (!session_timer_conf.getEnableSessionTimer()) { DBG("Timers aren't supported, nothing to do."); - return; + return true; } DBG("Update session timer (reply)."); @@ -375,7 +380,7 @@ void SessionTimer::updateTimer(AmSession* s, const AmSipReply& reply) if (((reply.code < 200) || (reply.code >= 300)) && (!(accept_501_reply && reply.code == 501))) { - return; + return true; } /* verify if B leg supports Session Timers */ @@ -387,7 +392,7 @@ void SessionTimer::updateTimer(AmSession* s, const AmSipReply& reply) DBG("Session timer not supported by responder's leg, remove session timer intervals"); session_timer_conf.setEnableSessionTimer(false); removeTimers(s); - return; + return false; } /* timer supported by B leg @@ -430,6 +435,7 @@ void SessionTimer::updateTimer(AmSession* s, const AmSipReply& reply) removeTimers(s); setTimers(s); + return true; } void SessionTimer::setTimers(AmSession* s) diff --git a/core/plug-in/session_timer/SessionTimer.h b/core/plug-in/session_timer/SessionTimer.h index ace01fa4..c3bdf5d3 100644 --- a/core/plug-in/session_timer/SessionTimer.h +++ b/core/plug-in/session_timer/SessionTimer.h @@ -139,9 +139,9 @@ protected: SessionRefresherRole session_refresher_role; bool accept_501_reply; - void updateTimer(AmSession* s,const AmSipRequest& req); - void updateTimer(AmSession* s,const AmSipReply& reply); - + bool updateTimer(AmSession* s,const AmSipRequest& req); + bool updateTimer(AmSession* s,const AmSipReply& reply); + virtual void setTimers(AmSession* s); void retryRefreshTimer(AmSession* s); void removeTimers(AmSession* s);