Module: sip-router Branch: pd/outbound Commit: c9f8bfdf7a124c9136b28cf78936ac14cec511b9 URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=c9f8bfdf...
Author: Peter Dunkley peter.dunkley@crocodile-rcs.com Committer: Peter Dunkley peter.dunkley@crocodile-rcs.com Date: Thu Mar 14 12:25:52 2013 +0000
modules/registrar: fixes to checking of Require: and Supported: headers for outbound
---
modules/registrar/reply.c | 3 ++- modules/registrar/save.c | 21 +++++++++++---------- 2 files changed, 13 insertions(+), 11 deletions(-)
diff --git a/modules/registrar/reply.c b/modules/registrar/reply.c index 129e7d6..46b1619 100644 --- a/modules/registrar/reply.c +++ b/modules/registrar/reply.c @@ -673,7 +673,8 @@ int reg_send_reply(struct sip_msg* _m) if (add_supported(_m, &outbound_str) < 0) return -1;
- if (get_require(_m) & F_OPTION_TAG_OUTBOUND) { + if ((get_require(_m) & F_OPTION_TAG_OUTBOUND) + || (get_supported(_m) & F_OPTION_TAG_OUTBOUND)) { if (add_require(_m, &outbound_str) < 0) return -1;
diff --git a/modules/registrar/save.c b/modules/registrar/save.c index dc19011..c4bfb02 100644 --- a/modules/registrar/save.c +++ b/modules/registrar/save.c @@ -865,7 +865,7 @@ int save(struct sip_msg* _m, udomain_t* _d, int _cflags, str *_uri) }
if (parse_require(_m) == 0) { - if (!(get_require(_m) & F_OPTION_TAG_OUTBOUND) + if ((get_require(_m) & F_OPTION_TAG_OUTBOUND) && reg_outbound_mode == REG_OUTBOUND_NONE) { LM_WARN("Outbound required by UAC and not supported by server\n"); rerrno = R_OB_REQD; @@ -908,17 +908,18 @@ int save(struct sip_msg* _m, udomain_t* _d, int _cflags, str *_uri) goto error; }
- if (use_ob == 0 && (get_supported(_m) & F_OPTION_TAG_OUTBOUND) - && contact->reg_id) { - LM_WARN("Outbound used by UAC but not supported by edge proxy\n"); - rerrno = R_OB_UNSUP_EDGE; - goto error; - } else { - /* ignore ;reg-id parameter */ - use_regid = 0; + if (use_ob == 0) { + if ((get_supported(_m) & F_OPTION_TAG_OUTBOUND) + && contact->reg_id) { + LM_WARN("Outbound used by UAC but not supported by edge proxy\n"); + rerrno = R_OB_UNSUP_EDGE; + goto error; + } else { + /* ignore ;reg-id parameter */ + use_regid = 0; + } } } - get_act_time(); c = get_first_contact(_m);