[sr-dev] git:4.0: modules/registrar: outbound_mode=1 fix

Juha Heinanen jh at tutpro.com
Sat Mar 16 05:38:28 CET 2013


Module: sip-router
Branch: 4.0
Commit: e446aa58a89c60ef9449fc8f79492232c7ed6f7f
URL:    http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=e446aa58a89c60ef9449fc8f79492232c7ed6f7f

Author: Juha Heinanen <jh at tutpro.com>
Committer: Juha Heinanen <jh at tutpro.com>
Date:   Sat Mar 16 06:33:13 2013 +0200

modules/registrar: outbound_mode=1 fix

outbound_mode=1 now accepts REGISTER requests that either contain
or do not contain a Supported: outbound header.

a Supported: outbound header is always added to 200 OK reply and if
request contained a Supported: outbound header, also a Require: outbound
header is added.

---

 modules/registrar/doc/registrar_admin.xml |   14 +++++++++-----
 modules/registrar/reply.c                 |   13 ++++++++++---
 2 files changed, 19 insertions(+), 8 deletions(-)

diff --git a/modules/registrar/doc/registrar_admin.xml b/modules/registrar/doc/registrar_admin.xml
index 47e52d5..cb55218 100644
--- a/modules/registrar/doc/registrar_admin.xml
+++ b/modules/registrar/doc/registrar_admin.xml
@@ -731,11 +731,15 @@ modparam("registrar", "gruu_enabled", 0)
 		with the outbound options tag.
 		</para>
 		<para>
-		If set to 1 then this module will accept REGISTER requests
-		that do not contain a Supported: header with the outbound
-		options-tag. The 200 OK response to REGISTER requests that this
-		module generates will contain a Supported: header with the
-		outbound options tag.
+                If set to 1 this module will accept REGISTER requests that do
+		not contain a Supported: header with the outbound options-tag
+		and REGISTER requests that do contain a Supported: or a
+		Requires: header with the outbound options-tag.  The 200 OK
+		response that this module generates, will contain a Supported:
+		header with the outbound options tag.  The 200 OK response
+		will also contain a Require: header with the outbound options
+		tag if the REGISTER request contained a Supported:
+		header with the outbound options-tag.
 		</para>
 		<para>
 		If set to 2 then this module will reject REGISTER requests
diff --git a/modules/registrar/reply.c b/modules/registrar/reply.c
index 5903710..7ed2a05 100644
--- a/modules/registrar/reply.c
+++ b/modules/registrar/reply.c
@@ -658,11 +658,18 @@ int reg_send_reply(struct sip_msg* _m)
 				if (add_flow_timer(_m) < 0)
 					return -1;
 			}
-			/* Fall-thru */
-		case REG_OUTBOUND_SUPPORTED:
 			if (add_supported(_m, &outbound_str) < 0)
-				return -1;
+			    return -1;
 			break;
+		case REG_OUTBOUND_SUPPORTED:
+		    if ((parse_supported(_m) == 0) &&
+			(((struct supported_body *)_m->supported->parsed)->supported_all & F_SUPPORTED_OUTBOUND)) {
+			if (add_require(_m, &outbound_str) < 0)
+			    return -1;
+		    }
+		    if (add_supported(_m, &outbound_str) < 0)
+			return -1;
+		    break;
 		}
 		break;
 	case R_OB_UNSUP:




More information about the sr-dev mailing list