diff options
author | Benny Prijono <bennylp@teluu.com> | 2007-07-10 01:46:08 +0000 |
---|---|---|
committer | Benny Prijono <bennylp@teluu.com> | 2007-07-10 01:46:08 +0000 |
commit | 62932f60662ec8cb2196b27aa922e81ce3082423 (patch) | |
tree | d89de7d86c00ba7d49f0bf979ffd2e91121249b4 /pjsip | |
parent | 68a5173aa1e207c4f985ce35306ef3a522ddd8fb (diff) |
Ticket #352: added PJSIP_CHECK_VIA_SENT_BY configuration to turn off Via sent-by checking for SIP responses, to support IP address change
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@1402 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjsip')
-rw-r--r-- | pjsip/include/pjsip/sip_config.h | 23 | ||||
-rw-r--r-- | pjsip/src/pjsip/sip_endpoint.c | 2 |
2 files changed, 25 insertions, 0 deletions
diff --git a/pjsip/include/pjsip/sip_config.h b/pjsip/include/pjsip/sip_config.h index 3f1276ab..c591e0db 100644 --- a/pjsip/include/pjsip/sip_config.h +++ b/pjsip/include/pjsip/sip_config.h @@ -194,6 +194,29 @@ /** + * Perform Via sent-by checking as specified in RFC 3261 Section 18.1.2, + * which says that UAC MUST silently discard responses with Via sent-by + * containing values that the UAC doesn't recognize as its transport + * address. + * + * In PJSIP, this will cause response to be discarded and a message is + * written to the log, saying something like: + * "Dropping response Response msg 200/INVITE/cseq=608594373 (rdata00A99EF4) + * from 1.2.3.4:5060 because sent-by is mismatch" + * + * The default behavior is yes, but when the UA supports IP address change + * for the SIP transport, it will need to turn this checking off since + * when the transport address is changed between request is sent and + * response is received, the response will be discarded since its Via + * sent-by now contains address that is different than the transport + * address. + */ +#ifndef PJSIP_CHECK_VIA_SENT_BY +# define PJSIP_CHECK_VIA_SENT_BY 1 +#endif + + +/** * If non-zero, SIP parser will unescape the escape characters ('%') * in the original message, which means that it will modify the * original message. Otherwise the parser will create a copy of diff --git a/pjsip/src/pjsip/sip_endpoint.c b/pjsip/src/pjsip/sip_endpoint.c index 33620009..859c47d1 100644 --- a/pjsip/src/pjsip/sip_endpoint.c +++ b/pjsip/src/pjsip/sip_endpoint.c @@ -823,6 +823,7 @@ static void endpt_on_rx_msg( pjsip_endpoint *endpt, PJ_LOG(5, (THIS_FILE, "Processing incoming message: %s", pjsip_rx_data_get_info(rdata))); +#if defined(PJSIP_CHECK_VIA_SENT_BY) && PJSIP_CHECK_VIA_SENT_BY != 0 /* For response, check that the value in Via sent-by match the transport. * If not matched, silently drop the response. * Ref: RFC3261 Section 18.1.2 Receiving Response @@ -879,6 +880,7 @@ static void endpt_on_rx_msg( pjsip_endpoint *endpt, return; } } +#endif /* Distribute to modules, starting from modules with highest priority */ |