Module: kamailio Branch: master Commit: eef8d69bc88bac394d7134ab9f591cdea3b4914b URL: https://github.com/kamailio/kamailio/commit/eef8d69bc88bac394d7134ab9f591cdea3b4914b
Author: Michael Furmur <fur...@pm.me> Committer: Daniel-Constantin Mierla <mico...@gmail.com> Date: 2025-06-17T22:02:15+02:00 rr: loose_route_mode: add vmode bit 2 to skip outbound --- Modified: src/modules/rr/doc/rr_admin.xml Modified: src/modules/rr/loose.c Modified: src/modules/rr/rr_mod.h --- Diff: https://github.com/kamailio/kamailio/commit/eef8d69bc88bac394d7134ab9f591cdea3b4914b.diff Patch: https://github.com/kamailio/kamailio/commit/eef8d69bc88bac394d7134ab9f591cdea3b4914b.patch --- diff --git a/src/modules/rr/doc/rr_admin.xml b/src/modules/rr/doc/rr_admin.xml index 4801b845dfb..4a2921fce32 100644 --- a/src/modules/rr/doc/rr_admin.xml +++ b/src/modules/rr/doc/rr_admin.xml @@ -446,11 +446,16 @@ if(!loose_route_preloaded()) { <section id="rr.f.loose_route_mode"> <title><function moreinfo="none">loose_route_mode(vmode)</function></title> - <para>The function is similar to `loose_route()`, but it does only - loose routing processing if vmode==1, skipping the testing of r-uri==myself - for performing strict routing. If vmode==0, it behaves like loose_route(). + <para>The function is similar to `loose_route()`, + but it accepts route mode bitmask as <emphasis>vmode</emphasis> parameter. </para> - <para>It is a convenient function to use with application servers that + <para> + If bit one is set, then do only loose routing processing, skipping the testing of r-uri==myself + for performing strict routing. If not, behave like loose_route(). + If bit two is set, then skip flow tokens processing. + </para> + <para> + First bit is convenient to use with application servers that set the Contact URI to SIP server address. </para> <para>This function can be used from REQUEST_ROUTE.</para> diff --git a/src/modules/rr/loose.c b/src/modules/rr/loose.c index 23378147903..443f90b17f4 100644 --- a/src/modules/rr/loose.c +++ b/src/modules/rr/loose.c @@ -854,7 +854,7 @@ static inline void rr_do_force_send_socket( * \param preloaded do we have a preloaded route set * \return -1 on failure, 1 on success */ -static inline int after_loose(struct sip_msg *_m, int preloaded) +static inline int after_loose(struct sip_msg *_m, int _mode, int preloaded) { struct hdr_field *hdr; struct sip_uri puri; @@ -890,9 +890,11 @@ static inline int after_loose(struct sip_msg *_m, int preloaded) routed_msg_id.msgid = _m->id; routed_msg_id.pid = _m->pid; - if((use_ob = process_outbound(_m, puri.user)) < 0) { - LM_INFO("failed to process outbound flow-token\n"); - return RR_FLOW_TOKEN_BROKEN; + if(!(_mode & RR_LR_MODE_SKIP_OUTBOUND)) { + if((use_ob = process_outbound(_m, puri.user)) < 0) { + LM_INFO("failed to process outbound flow-token\n"); + return RR_FLOW_TOKEN_BROKEN; + } } if(rr_force_send_socket && !use_ob) { @@ -1050,12 +1052,12 @@ int loose_route_mode(sip_msg_t *_m, int _mode) if(ret < 0) { return -1; } else if(ret == 1) { - return after_loose(_m, 1); + return after_loose(_m, _mode, 1); } else { - if((_mode == 0) && (is_myself(&_m->parsed_uri))) { + if((!(_mode & RR_LR_MODE_LOOSE_ONLY)) && (is_myself(&_m->parsed_uri))) { return after_strict(_m); } else { - return after_loose(_m, 0); + return after_loose(_m, _mode, 0); } } } diff --git a/src/modules/rr/rr_mod.h b/src/modules/rr/rr_mod.h index 829e912e499..a411625824c 100644 --- a/src/modules/rr/rr_mod.h +++ b/src/modules/rr/rr_mod.h @@ -36,6 +36,11 @@ extern str i_user; #endif +/*! bit to force loose mode in loose_route_mode() */ +#define RR_LR_MODE_LOOSE_ONLY 1 +/*! bit to skip outbound processing in after_loose() */ +#define RR_LR_MODE_SKIP_OUTBOUND 2 + /*! should request's from-tag is appended to record-route */ extern int append_fromtag; /*! insert two record-route header instead of one */ _______________________________________________ Kamailio - Development Mailing List -- sr-dev@lists.kamailio.org To unsubscribe send an email to sr-dev-le...@lists.kamailio.org Important: keep the mailing list in the recipients, do not reply only to the sender!