cbc1136704
RFC3261 Section 10 "Registrations", specifically paragraph "10.2.4: Refreshing Bindings", states that a user agent compares each contact address (in a 200 REGISTER response) to see if it created the contact. If the Asterisk endpoint has the rewrite_contact option set however, the contact host and port sent back in the 200 response will be the rewritten one and not the one sent by the user agent. This prevents the user agent from matching its own contact. Some user agents get very upset when this happens and will not consider the registration successful. While this is rare, it is acceptable behavior especially if more than 1 user agent is allowed to register to a single endpoint/aor. This commit updates res_pjsip_nat (where rewrite_contact is implemented) to store the original incoming Contact header in a new "x-ast-orig-host" URI parameter before rewriting it, and to restore the original host and port to the Contact headers in the outgoing response. This is only done if the request is a REGISTER and rewrite_contact is enabled. pjsip_message_filter was also updated to ensure that if a request comes in with any existing x-ast-* URI parameters, we remove them so they don't conflict. Asterisk will never send a request with those headers in it but someone might just decide to add them to a request they craft and send to Asterisk. NOTE: If a device changes its contact address and registers again, it's a NEW registration. If the device didn't unregister the original registration then all existing behavior based on aor/remove_existing and aor/max_contacts apply. ASTERISK-28502 Reported-by: Ross Beer Change-Id: Idc263ad2d2d7bd8faa047e5804d96a5fe1cd282e |
||
---|---|---|
.. | ||
include | ||
config_auth.c | ||
config_domain_aliases.c | ||
config_global.c | ||
config_system.c | ||
config_transport.c | ||
location.c | ||
pjsip_cli.c | ||
pjsip_configuration.c | ||
pjsip_distributor.c | ||
pjsip_global_headers.c | ||
pjsip_message_filter.c | ||
pjsip_options.c | ||
pjsip_resolver.c | ||
pjsip_scheduler.c | ||
pjsip_session.c | ||
pjsip_transport_events.c | ||
pjsip_transport_management.c | ||
presence_xml.c | ||
security_events.c |