From e4d1514a4b228a3b5c29cc57332a2bb5a1148a04 Mon Sep 17 00:00:00 2001 From: Ben Ramsden Date: Wed, 10 Jan 2018 15:11:24 +0000 Subject: [PATCH 01/28] add subscribe logging for 403s --- src/subscriptionsproutlet.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/subscriptionsproutlet.cpp b/src/subscriptionsproutlet.cpp index 91cc21c77..81924ab94 100644 --- a/src/subscriptionsproutlet.cpp +++ b/src/subscriptionsproutlet.cpp @@ -342,6 +342,8 @@ void SubscriptionSproutletTsx::process_subscription_request(pjsip_msg* req) std::string aor; if (!irs_info._associated_uris.get_default_impu(aor, false)) { + TRC_ERROR("SUBSCRIBE for public ID %s uses AOR %s", public_id.c_str(), aor.c_str()); + TRC_ERROR("Could not determine default URI, Subscribe is being rejected with 403"); pjsip_msg* rsp = create_response(req, PJSIP_SC_FORBIDDEN); send_response(rsp); free_msg(req); @@ -349,7 +351,6 @@ void SubscriptionSproutletTsx::process_subscription_request(pjsip_msg* req) return; } - TRC_DEBUG("aor = %s", aor.c_str()); TRC_DEBUG("SUBSCRIBE for public ID %s uses AOR %s", public_id.c_str(), aor.c_str()); // Create a subscription object from the request that we can pass down to From f95aa1827b72ffdd2e9e19613a609fd2c9706d2b Mon Sep 17 00:00:00 2001 From: Ben Ramsden Date: Fri, 12 Jan 2018 15:05:37 +0000 Subject: [PATCH 02/28] add 500 error logs --- src/authenticationsproutlet.cpp | 2 +- src/registrarsproutlet.cpp | 3 ++- src/subscriptionsproutlet.cpp | 1 + src/thread_dispatcher.cpp | 2 +- 4 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/authenticationsproutlet.cpp b/src/authenticationsproutlet.cpp index dcb6c348c..78f6cb648 100644 --- a/src/authenticationsproutlet.cpp +++ b/src/authenticationsproutlet.cpp @@ -871,7 +871,7 @@ void AuthenticationSproutletTsx::create_challenge(pjsip_digest_credential* crede // We've failed to store the nonce in memcached, so we have no hope of // successfully authenticating any repsonse to a 401 Unauthorized. Send // a 500 Server Internal Error instead. - TRC_DEBUG("Failed to store nonce in memcached"); + TRC_ERROR("Failed to store nonce in memcached, for impi %s", impi.c_str()); rsp->line.status.code = PJSIP_SC_INTERNAL_SERVER_ERROR; rsp->line.status.reason = *pjsip_get_status_text(PJSIP_SC_INTERNAL_SERVER_ERROR); diff --git a/src/registrarsproutlet.cpp b/src/registrarsproutlet.cpp index 94a1e4db2..827720903 100644 --- a/src/registrarsproutlet.cpp +++ b/src/registrarsproutlet.cpp @@ -529,6 +529,7 @@ void RegistrarSproutletTsx::process_register_request(pjsip_msg *req) // Failed to connect to the local store. Reject the register with a 500 // response. // LCOV_EXCL_START - the can't fail to connect to the store we use for UT + TRC_ERROR("Failed to connect to local store, private_id= %s", private_id.c_str()); st_code = PJSIP_SC_INTERNAL_SERVER_ERROR; SAS::Event event(trail(), SASEvent::REGISTER_FAILED_REGSTORE, 0); @@ -604,7 +605,7 @@ void RegistrarSproutletTsx::process_register_request(pjsip_msg *req) if (gen_hdr == NULL) { // LCOV_EXCL_START - can't see how this could ever happen - TRC_ERROR("Failed to add RFC 5626 headers"); + TRC_ERROR("Failed to add RFC 5626 headers to reply"); SAS::Event event(trail(), SASEvent::REGISTER_FAILED_5636, 0); event.add_var_param(public_id); diff --git a/src/subscriptionsproutlet.cpp b/src/subscriptionsproutlet.cpp index 81924ab94..96ee8393a 100644 --- a/src/subscriptionsproutlet.cpp +++ b/src/subscriptionsproutlet.cpp @@ -407,6 +407,7 @@ void SubscriptionSproutletTsx::process_subscription_request(pjsip_msg* req) { // Failed to connect to the local store. Reject the subscribe with a 500 // response. + TRC_ERROR("Failed to connect to local store for SUBSCRIBE, aor=%s", aor); st_code = PJSIP_SC_INTERNAL_SERVER_ERROR; // Build and send the reply. diff --git a/src/thread_dispatcher.cpp b/src/thread_dispatcher.cpp index 4aa9546db..b752305a9 100644 --- a/src/thread_dispatcher.cpp +++ b/src/thread_dispatcher.cpp @@ -254,7 +254,7 @@ bool process_queue_element() if ((rdata->msg_info.msg->type == PJSIP_REQUEST_MSG) && (rdata->msg_info.msg->line.req.method.id != PJSIP_ACK_METHOD)) { - TRC_DEBUG("Returning 500 response following exception"); + TRC_ERROR("Returning 500 response following exception"); reject_with_retry_header(rdata, PJSIP_SC_INTERNAL_SERVER_ERROR); } From 6036f26050f3994797b633085217c320923daec0 Mon Sep 17 00:00:00 2001 From: Ben Ramsden Date: Fri, 12 Jan 2018 15:07:36 +0000 Subject: [PATCH 03/28] c_str doh --- src/subscriptionsproutlet.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/subscriptionsproutlet.cpp b/src/subscriptionsproutlet.cpp index 96ee8393a..35896cf8c 100644 --- a/src/subscriptionsproutlet.cpp +++ b/src/subscriptionsproutlet.cpp @@ -407,7 +407,7 @@ void SubscriptionSproutletTsx::process_subscription_request(pjsip_msg* req) { // Failed to connect to the local store. Reject the subscribe with a 500 // response. - TRC_ERROR("Failed to connect to local store for SUBSCRIBE, aor=%s", aor); + TRC_ERROR("Failed to connect to local store for SUBSCRIBE, aor=%s", aor.c_str()); st_code = PJSIP_SC_INTERNAL_SERVER_ERROR; // Build and send the reply. From 3106297ec0b086ea62d015f79055b8e7cb3916b6 Mon Sep 17 00:00:00 2001 From: Rob Day Date: Tue, 16 Jan 2018 21:07:57 +0000 Subject: [PATCH 04/28] Use apple_scrumble branch of cpp-common --- modules/cpp-common | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/cpp-common b/modules/cpp-common index 6bfc196ee..e9cf780bf 160000 --- a/modules/cpp-common +++ b/modules/cpp-common @@ -1 +1 @@ -Subproject commit 6bfc196ee985e87e2fe94c58cc4f75b76f639662 +Subproject commit e9cf780bf0027d0d825b042ce5ba63c9e0fd6c49 From b80a0277a01cdb10e6f50b2838b1c03723552a66 Mon Sep 17 00:00:00 2001 From: Rob Day Date: Wed, 17 Jan 2018 17:42:20 +0000 Subject: [PATCH 05/28] Use apple_scrumble branch of cpp-common --- modules/cpp-common | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/cpp-common b/modules/cpp-common index e9cf780bf..4b16b8404 160000 --- a/modules/cpp-common +++ b/modules/cpp-common @@ -1 +1 @@ -Subproject commit e9cf780bf0027d0d825b042ce5ba63c9e0fd6c49 +Subproject commit 4b16b84041e4d3b112403f46eafc65d274c30009 From 7e9c346df0909f7d6dd3f3128b14a228d29260f6 Mon Sep 17 00:00:00 2001 From: Rob Day Date: Wed, 17 Jan 2018 18:27:52 +0000 Subject: [PATCH 06/28] Use apple_scrumble branch of cpp-common --- modules/cpp-common | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/cpp-common b/modules/cpp-common index 4b16b8404..6b6631082 160000 --- a/modules/cpp-common +++ b/modules/cpp-common @@ -1 +1 @@ -Subproject commit 4b16b84041e4d3b112403f46eafc65d274c30009 +Subproject commit 6b6631082d3c5db7959ac618562b16f875c318d7 From 99dcc8e6b0d34aad79e3a969cbeaaedcd230f008 Mon Sep 17 00:00:00 2001 From: Ben Ramsden Date: Thu, 18 Jan 2018 18:07:59 +0000 Subject: [PATCH 07/28] fix @file headings --- src/dnsresolver.cpp | 2 +- src/enumservice.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/dnsresolver.cpp b/src/dnsresolver.cpp index 0ebccf86d..b55164886 100644 --- a/src/dnsresolver.cpp +++ b/src/dnsresolver.cpp @@ -1,5 +1,5 @@ /** - * @file enumservice.cpp class implementation for an ENUM service provider + * @file dnsresolver.cpp class implementation for a DNS resolver * * Copyright (C) Metaswitch Networks 2015 * If license terms are provided to you in a COPYING file in the root directory diff --git a/src/enumservice.cpp b/src/enumservice.cpp index a61c3960d..62e0cf911 100644 --- a/src/enumservice.cpp +++ b/src/enumservice.cpp @@ -1,5 +1,5 @@ /** - * @file dnsresolver.cpp class implementation for a DNS resolver + * @file enumservice.cpp class implementation for an ENUM service provider * * Copyright (C) Metaswitch Networks 2017 * If license terms are provided to you in a COPYING file in the root directory From 0c825ef870137af2d9c16c13a8ad8bc893b70c68 Mon Sep 17 00:00:00 2001 From: Rob Day Date: Thu, 18 Jan 2018 18:45:55 +0000 Subject: [PATCH 08/28] Use apple_scrumble branch of cpp-common --- modules/cpp-common | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/cpp-common b/modules/cpp-common index 6b6631082..fc880772f 160000 --- a/modules/cpp-common +++ b/modules/cpp-common @@ -1 +1 @@ -Subproject commit 6b6631082d3c5db7959ac618562b16f875c318d7 +Subproject commit fc880772f247ed4111d9335355f9b4457aedc974 From 74cb92cb580f658badb511f705706f6b44628a65 Mon Sep 17 00:00:00 2001 From: Rob Day Date: Thu, 18 Jan 2018 19:02:10 +0000 Subject: [PATCH 09/28] Warn on overload --- src/thread_dispatcher.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/thread_dispatcher.cpp b/src/thread_dispatcher.cpp index b752305a9..a57b63bef 100644 --- a/src/thread_dispatcher.cpp +++ b/src/thread_dispatcher.cpp @@ -514,7 +514,7 @@ static void reject_rx_msg_overload(pjsip_rx_data* rdata, SAS::TrailId trail) { // Respond statelessly with a 503 Service Unavailable, including a // Retry-After header with a zero length timeout. - TRC_DEBUG("Rejected request due to overload"); + TRC_WARNING("Rejected request due to overload"); SAS::Marker start_marker(trail, MARKER_ID_START, 1u); SAS::report_marker(start_marker); From 1f0caa10f6b4e4cc47e3c003cf50d89e3a71c498 Mon Sep 17 00:00:00 2001 From: Rob Day Date: Tue, 23 Jan 2018 11:59:14 +0000 Subject: [PATCH 10/28] WIP: load from /etc/clearwater/dns.json --- src/main.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/main.cpp b/src/main.cpp index d42b39a6e..d5809d8c7 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -87,6 +87,7 @@ extern "C" { #include "sprout_alarmdefinition.h" #include "sproutlet_options.h" #include "astaire_impistore.h" +#include "updater.h" enum OptionTypes { @@ -2003,7 +2004,15 @@ int main(int argc, char* argv[]) hc); // Create a DNS resolver and a SIP specific resolver. - dns_resolver = new DnsCachedResolver(opt.dns_servers, opt.dns_timeout); + dns_resolver = new DnsCachedResolver(opt.dns_servers, + opt.dns_timeout, + "/etc/clearwater/dns.json"); + + // Reload dns.json on SIGHUP + Updater* dns_updater = + new Updater(dns_resolver, + std::mem_fun(&DnsCachedResolver::reload_static_records)); + if (opt.pcscf_enabled) { sip_resolver = new SIPResolver(dns_resolver, opt.sip_blacklist_duration, 0); @@ -2562,6 +2571,7 @@ int main(int argc, char* argv[]) delete enum_service; delete scscf_acr_factory; + delete dns_updater; delete sip_resolver; delete http_resolver; delete astaire_resolver; From 43941853c666e789f532a8cda08116cc1096ef2d Mon Sep 17 00:00:00 2001 From: Rob Day Date: Wed, 24 Jan 2018 09:03:52 +0000 Subject: [PATCH 11/28] Bring dns.json changes into apple_scrumble branch --- modules/cpp-common | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/cpp-common b/modules/cpp-common index fc880772f..812f94be7 160000 --- a/modules/cpp-common +++ b/modules/cpp-common @@ -1 +1 @@ -Subproject commit fc880772f247ed4111d9335355f9b4457aedc974 +Subproject commit 812f94be71180310573f4a1f1c6dce79ce3a655b From e9474ec3e8e624959d972f714a3ea620a4a10e88 Mon Sep 17 00:00:00 2001 From: Rob Day Date: Tue, 23 Jan 2018 11:59:14 +0000 Subject: [PATCH 12/28] Load records from /etc/clearwater/dns.json --- src/Makefile | 1 + src/main.cpp | 12 +++++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/Makefile b/src/Makefile index dc2293aff..a52c65341 100644 --- a/src/Makefile +++ b/src/Makefile @@ -9,6 +9,7 @@ SPROUT_COMMON_SOURCES := logger.cpp \ stack.cpp \ dnsparser.cpp \ dnscachedresolver.cpp \ + static_dns_cache.cpp \ baseresolver.cpp \ sipresolver.cpp \ bono.cpp \ diff --git a/src/main.cpp b/src/main.cpp index d42b39a6e..d5809d8c7 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -87,6 +87,7 @@ extern "C" { #include "sprout_alarmdefinition.h" #include "sproutlet_options.h" #include "astaire_impistore.h" +#include "updater.h" enum OptionTypes { @@ -2003,7 +2004,15 @@ int main(int argc, char* argv[]) hc); // Create a DNS resolver and a SIP specific resolver. - dns_resolver = new DnsCachedResolver(opt.dns_servers, opt.dns_timeout); + dns_resolver = new DnsCachedResolver(opt.dns_servers, + opt.dns_timeout, + "/etc/clearwater/dns.json"); + + // Reload dns.json on SIGHUP + Updater* dns_updater = + new Updater(dns_resolver, + std::mem_fun(&DnsCachedResolver::reload_static_records)); + if (opt.pcscf_enabled) { sip_resolver = new SIPResolver(dns_resolver, opt.sip_blacklist_duration, 0); @@ -2562,6 +2571,7 @@ int main(int argc, char* argv[]) delete enum_service; delete scscf_acr_factory; + delete dns_updater; delete sip_resolver; delete http_resolver; delete astaire_resolver; From 7313e43fbdecf0bff2ade2f0542bca86180681c5 Mon Sep 17 00:00:00 2001 From: Ben Ramsden Date: Thu, 25 Jan 2018 11:58:29 +0000 Subject: [PATCH 13/28] fix up file comment --- src/compositesproutlet.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/compositesproutlet.cpp b/src/compositesproutlet.cpp index 758220e14..1fbdf5eff 100644 --- a/src/compositesproutlet.cpp +++ b/src/compositesproutlet.cpp @@ -1,5 +1,5 @@ /** - * @file compositesproutlet.h + * @file compositesproutlet.cpp * * Copyright (C) Metaswitch Networks 2017 * If license terms are provided to you in a COPYING file in the root directory From c1c0ff393ecc722408c83eb91027c5dfeffe6a20 Mon Sep 17 00:00:00 2001 From: Ben Ramsden Date: Thu, 25 Jan 2018 12:10:03 +0000 Subject: [PATCH 14/28] raise logging for 504s from sprout to error status --- src/authenticationsproutlet.cpp | 2 +- src/icscfsproutlet.cpp | 1 + src/scscfsproutlet.cpp | 3 ++- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/authenticationsproutlet.cpp b/src/authenticationsproutlet.cpp index 78f6cb648..205a9f4d0 100644 --- a/src/authenticationsproutlet.cpp +++ b/src/authenticationsproutlet.cpp @@ -902,7 +902,7 @@ void AuthenticationSproutletTsx::create_challenge(pjsip_digest_credential* crede // a 4xx error to the client. if (av_source_unavailable) { - TRC_DEBUG("Downstream node is overloaded or unresponsive, unable to get Authentication vector"); + TRC_ERROR("Downstream node is overloaded or unresponsive, unable to get Authentication vector"); rsp->line.status.code = PJSIP_SC_SERVER_TIMEOUT; rsp->line.status.reason = *pjsip_get_status_text(PJSIP_SC_SERVER_TIMEOUT); SAS::Event event(trail(), SASEvent::AUTHENTICATION_FAILED_OVERLOAD, 0); diff --git a/src/icscfsproutlet.cpp b/src/icscfsproutlet.cpp index 2cd805339..a17fc5a03 100644 --- a/src/icscfsproutlet.cpp +++ b/src/icscfsproutlet.cpp @@ -403,6 +403,7 @@ void ICSCFSproutletRegTsx::on_rx_response(pjsip_msg* rsp, int fork_id) // capabilitires, or the HSS is temporarily unavailable). There was at // least one valid S-CSCF (as this is retry processing). The I-CSCF // must return 504 (TS 24.229, 5.3.1.3) in this case. + TRC_ERROR("I-CSCF can't select an S-CSCF for REGISTER request"); rsp->line.status.code = PJSIP_SC_SERVER_TIMEOUT; rsp->line.status.reason = *pjsip_get_status_text(rsp->line.status.code); diff --git a/src/scscfsproutlet.cpp b/src/scscfsproutlet.cpp index 95242c28f..14fc2549d 100644 --- a/src/scscfsproutlet.cpp +++ b/src/scscfsproutlet.cpp @@ -1149,6 +1149,7 @@ pjsip_status_code SCSCFSproutletTsx::determine_served_user(pjsip_msg* req) if ((http_code == HTTP_SERVER_UNAVAILABLE) || (http_code == HTTP_GATEWAY_TIMEOUT)) { // Send a SIP 504 response if we got a 500/503 HTTP response. + TRC_ERROR("AS retargeting failed to lookup IFCs for served user"); status_code = PJSIP_SC_SERVER_TIMEOUT; } else @@ -1260,7 +1261,7 @@ pjsip_status_code SCSCFSproutletTsx::determine_served_user(pjsip_msg* req) } else { - TRC_DEBUG("Failed to retrieve ServiceProfile for %s", served_user.c_str()); + TRC_ERROR("Failed to retrieve ServiceProfile for %s", served_user.c_str()); if ((http_code == HTTP_SERVER_UNAVAILABLE) || (http_code == HTTP_GATEWAY_TIMEOUT)) { From 0ea6e73c66f1b771b3565b5daeb16c15828adbc6 Mon Sep 17 00:00:00 2001 From: Ben Ramsden Date: Thu, 25 Jan 2018 14:42:14 +0000 Subject: [PATCH 15/28] set all errors we've seen into dummy values --- src/authenticationsproutlet.cpp | 4 ++-- src/hss_sip_mapping.cpp | 12 ++++++------ src/icscfrouter.cpp | 10 +++++----- src/icscfsproutlet.cpp | 2 +- src/pjutils.cpp | 4 ++-- src/registrarsproutlet.cpp | 4 ++-- src/scscfsproutlet.cpp | 6 +++--- src/subscriptionsproutlet.cpp | 2 +- 8 files changed, 22 insertions(+), 22 deletions(-) diff --git a/src/authenticationsproutlet.cpp b/src/authenticationsproutlet.cpp index 205a9f4d0..e10066d83 100644 --- a/src/authenticationsproutlet.cpp +++ b/src/authenticationsproutlet.cpp @@ -903,8 +903,8 @@ void AuthenticationSproutletTsx::create_challenge(pjsip_digest_credential* crede if (av_source_unavailable) { TRC_ERROR("Downstream node is overloaded or unresponsive, unable to get Authentication vector"); - rsp->line.status.code = PJSIP_SC_SERVER_TIMEOUT; - rsp->line.status.reason = *pjsip_get_status_text(PJSIP_SC_SERVER_TIMEOUT); + rsp->line.status.code = 514; + rsp->line.status.reason = *pjsip_get_status_text((pjsip_status_code)55); SAS::Event event(trail(), SASEvent::AUTHENTICATION_FAILED_OVERLOAD, 0); SAS::report_event(event); } diff --git a/src/hss_sip_mapping.cpp b/src/hss_sip_mapping.cpp index 98a9fcce3..77879d635 100644 --- a/src/hss_sip_mapping.cpp +++ b/src/hss_sip_mapping.cpp @@ -40,12 +40,12 @@ pjsip_status_code determine_hss_sip_response(HTTPCode http_code, // "if the Request-URI of the SUBSCRIBE request contains a URI for // which currently no binding exists, then send a 480 (Temporarily // Unavailable) response" - st_code = PJSIP_SC_TEMPORARILY_UNAVAILABLE; + st_code = (pjsip_status_code)471; } else { // LCOV_EXCL_START - st_code = PJSIP_SC_SERVER_TIMEOUT; + st_code = (pjsip_status_code)524; // LCOV_EXCL_STOP } break; @@ -56,7 +56,7 @@ pjsip_status_code determine_hss_sip_response(HTTPCode http_code, TRC_ERROR("Rejecting %s request as subscriber not present on the HSS", sip_msg_type); - st_code = PJSIP_SC_FORBIDDEN; + st_code = (pjsip_status_code)472; break; case HTTP_SERVER_UNAVAILABLE: @@ -67,7 +67,7 @@ pjsip_status_code determine_hss_sip_response(HTTPCode http_code, TRC_ERROR("Rejecting %s request as unable to contact HSS: %d", sip_msg_type, http_code); - st_code = PJSIP_SC_SERVER_TIMEOUT; + st_code = (pjsip_status_code)534; break; case HTTP_SERVER_ERROR: @@ -76,14 +76,14 @@ pjsip_status_code determine_hss_sip_response(HTTPCode http_code, TRC_ERROR("Rejecting %s request following error communicating with the HSS", sip_msg_type); - st_code = PJSIP_SC_INTERNAL_SERVER_ERROR; + st_code = (pjsip_status_code)520; break; default: TRC_ERROR("Rejecting %s request following response %d from HSS", sip_msg_type, http_code); - st_code = PJSIP_SC_SERVER_TIMEOUT; + st_code = (pjsip_status_code)544; break; } } diff --git a/src/icscfrouter.cpp b/src/icscfrouter.cpp index 53a297fc2..95176097c 100644 --- a/src/icscfrouter.cpp +++ b/src/icscfrouter.cpp @@ -169,7 +169,7 @@ int ICSCFRouter::get_scscf(pj_pool_t* pool, else { TRC_WARNING("Invalid SCSCF URI %s", scscf.c_str()); - status_code = PJSIP_SC_TEMPORARILY_UNAVAILABLE; + status_code = (pjsip_status_code)477; } } else @@ -253,7 +253,7 @@ int ICSCFRouter::parse_hss_response(rapidjson::Document*& rsp, bool queried_caps { // Failed to parse capabilities, so reject with 480 response. TRC_INFO("Malformed required capabilities returned by HSS"); - status_code = PJSIP_SC_TEMPORARILY_UNAVAILABLE; + status_code = (pjsip_status_code)473; } } @@ -270,7 +270,7 @@ int ICSCFRouter::parse_hss_response(rapidjson::Document*& rsp, bool queried_caps { // Failure response from HSS indicating that a subscriber exists but is unregistered and // has no unregistered services, so respond with 480 Temporarily Unavailable. - status_code = PJSIP_SC_TEMPORARILY_UNAVAILABLE; + status_code = (pjsip_status_code)474; } else { @@ -374,7 +374,7 @@ int ICSCFUARouter::hss_query() { // HSS failed to respond or responded with invalid data, so reject the // request with a 480. - status_code = PJSIP_SC_TEMPORARILY_UNAVAILABLE; + status_code = (pjsip_status_code)475; } else { @@ -447,7 +447,7 @@ int ICSCFLIRouter::hss_query() // HSS failed to respond or responded with invalid data, so reject the // request with a 480. // LCOV_EXCL_START - status_code = PJSIP_SC_TEMPORARILY_UNAVAILABLE; + status_code = (pjsip_status_code)476; // LCOV_EXCL_STOP } else diff --git a/src/icscfsproutlet.cpp b/src/icscfsproutlet.cpp index a17fc5a03..270b08842 100644 --- a/src/icscfsproutlet.cpp +++ b/src/icscfsproutlet.cpp @@ -404,7 +404,7 @@ void ICSCFSproutletRegTsx::on_rx_response(pjsip_msg* rsp, int fork_id) // least one valid S-CSCF (as this is retry processing). The I-CSCF // must return 504 (TS 24.229, 5.3.1.3) in this case. TRC_ERROR("I-CSCF can't select an S-CSCF for REGISTER request"); - rsp->line.status.code = PJSIP_SC_SERVER_TIMEOUT; + rsp->line.status.code = 564; rsp->line.status.reason = *pjsip_get_status_text(rsp->line.status.code); } diff --git a/src/pjutils.cpp b/src/pjutils.cpp index 081111612..9e6352af3 100644 --- a/src/pjutils.cpp +++ b/src/pjutils.cpp @@ -1875,7 +1875,7 @@ pjsip_status_code PJUtils::redirect_int(pjsip_msg* msg, pjsip_uri* target, pj_po static const int MAX_HISTORY_INFOS = 5; // Default the code to 480 Temporarily Unavailable. - code = (code != 0) ? code : PJSIP_SC_TEMPORARILY_UNAVAILABLE; + code = (code != 0) ? code : (pjsip_status_code)478; pjsip_status_code rc = code; // Count the number of existing History-Info headers. @@ -1900,7 +1900,7 @@ pjsip_status_code PJUtils::redirect_int(pjsip_msg* msg, pjsip_uri* target, pj_po std::string div = PJUtils::uri_to_string(PJSIP_URI_IN_REQ_URI, msg->line.req.uri); div += ";reason="; div += (code == PJSIP_SC_BUSY_HERE) ? "user-busy" : - (code == PJSIP_SC_TEMPORARILY_UNAVAILABLE) ? "no-answer" : + (code == (pjsip_status_code)478) ? "no-answer" : (code == PJSIP_SC_NOT_FOUND) ? "out-of-service" : (code == 0) ? "unconditional" : "unknown"; diff --git a/src/registrarsproutlet.cpp b/src/registrarsproutlet.cpp index 827720903..fa8bf1cd6 100644 --- a/src/registrarsproutlet.cpp +++ b/src/registrarsproutlet.cpp @@ -530,7 +530,7 @@ void RegistrarSproutletTsx::process_register_request(pjsip_msg *req) // response. // LCOV_EXCL_START - the can't fail to connect to the store we use for UT TRC_ERROR("Failed to connect to local store, private_id= %s", private_id.c_str()); - st_code = PJSIP_SC_INTERNAL_SERVER_ERROR; + st_code = (pjsip_status_code)510; SAS::Event event(trail(), SASEvent::REGISTER_FAILED_REGSTORE, 0); event.add_var_param(public_id); @@ -611,7 +611,7 @@ void RegistrarSproutletTsx::process_register_request(pjsip_msg *req) event.add_var_param(public_id); SAS::report_event(event); - rsp->line.status.code = PJSIP_SC_INTERNAL_SERVER_ERROR; + rsp->line.status.code = 520; acr->tx_response(rsp); diff --git a/src/scscfsproutlet.cpp b/src/scscfsproutlet.cpp index 14fc2549d..51e748a2a 100644 --- a/src/scscfsproutlet.cpp +++ b/src/scscfsproutlet.cpp @@ -1150,7 +1150,7 @@ pjsip_status_code SCSCFSproutletTsx::determine_served_user(pjsip_msg* req) { // Send a SIP 504 response if we got a 500/503 HTTP response. TRC_ERROR("AS retargeting failed to lookup IFCs for served user"); - status_code = PJSIP_SC_SERVER_TIMEOUT; + status_code = (pjsip_status_code)574; } else { @@ -1266,7 +1266,7 @@ pjsip_status_code SCSCFSproutletTsx::determine_served_user(pjsip_msg* req) if ((http_code == HTTP_SERVER_UNAVAILABLE) || (http_code == HTTP_GATEWAY_TIMEOUT)) { // Send a SIP 504 response if we got a 500/503 HTTP response. - status_code = PJSIP_SC_SERVER_TIMEOUT; + status_code = (pjsip_status_code)584; } else { @@ -1859,7 +1859,7 @@ void SCSCFSproutletTsx::route_to_ue_bindings(pjsip_msg* req) if (targets.empty()) { // No valid target bindings for this request, so reject it. - pjsip_msg* rsp = create_response(req, PJSIP_SC_TEMPORARILY_UNAVAILABLE); + pjsip_msg* rsp = create_response(req, (pjsip_status_code)479); send_response(rsp); free_msg(req); } diff --git a/src/subscriptionsproutlet.cpp b/src/subscriptionsproutlet.cpp index 35896cf8c..a07e10802 100644 --- a/src/subscriptionsproutlet.cpp +++ b/src/subscriptionsproutlet.cpp @@ -322,7 +322,7 @@ void SubscriptionSproutletTsx::process_subscription_request(pjsip_msg* req) if (st_code != PJSIP_SC_OK) { - if (st_code == PJSIP_SC_TEMPORARILY_UNAVAILABLE) + if (st_code == (pjsip_status_code)499) { // A 480 response means that the subscriber wasn't registered SAS::Event event(trail_id, SASEvent::SUBSCRIBE_FAILED_EARLY_NOT_REG, 0); From 90a2cd444eeec8e2d0db39103043a9c3391401ee Mon Sep 17 00:00:00 2001 From: Rob Day Date: Thu, 25 Jan 2018 18:31:37 +0000 Subject: [PATCH 16/28] Improve distinction between error codes --- src/hss_sip_mapping.cpp | 9 +++++++++ src/icscfrouter.cpp | 2 ++ 2 files changed, 11 insertions(+) diff --git a/src/hss_sip_mapping.cpp b/src/hss_sip_mapping.cpp index 77879d635..2bde468d5 100644 --- a/src/hss_sip_mapping.cpp +++ b/src/hss_sip_mapping.cpp @@ -60,6 +60,15 @@ pjsip_status_code determine_hss_sip_response(HTTPCode http_code, break; case HTTP_SERVER_UNAVAILABLE: + // The HSS is unavailable - the client should retry on timeout but no + // other Clearwater nodes should (as Sprout will already have retried on + // timeout). Reject with a 504 (503 is used for overload). + TRC_ERROR("Rejecting %s request as unable to contact HSS: %d", + sip_msg_type, http_code); + + st_code = (pjsip_status_code)554; + break; + case HTTP_GATEWAY_TIMEOUT: // The HSS is unavailable - the client should retry on timeout but no // other Clearwater nodes should (as Sprout will already have retried on diff --git a/src/icscfrouter.cpp b/src/icscfrouter.cpp index 95176097c..fc5e58add 100644 --- a/src/icscfrouter.cpp +++ b/src/icscfrouter.cpp @@ -374,6 +374,7 @@ int ICSCFUARouter::hss_query() { // HSS failed to respond or responded with invalid data, so reject the // request with a 480. + TRC_ERROR("I-CSCF UAR got %d HTTP response from Homestead, replying with SIP error 475", rc); status_code = (pjsip_status_code)475; } else @@ -447,6 +448,7 @@ int ICSCFLIRouter::hss_query() // HSS failed to respond or responded with invalid data, so reject the // request with a 480. // LCOV_EXCL_START + TRC_ERROR("I-CSCF UAR got %d HTTP response from Homestead, replying with SIP error 476", rc); status_code = (pjsip_status_code)476; // LCOV_EXCL_STOP } From 581f05486b4e25e5455b6ae50c09989db42ed878 Mon Sep 17 00:00:00 2001 From: Rob Day Date: Thu, 25 Jan 2018 18:44:50 +0000 Subject: [PATCH 17/28] Take latest cpp-common --- modules/cpp-common | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/cpp-common b/modules/cpp-common index 812f94be7..254f3b73e 160000 --- a/modules/cpp-common +++ b/modules/cpp-common @@ -1 +1 @@ -Subproject commit 812f94be71180310573f4a1f1c6dce79ce3a655b +Subproject commit 254f3b73e715f68977ec86286a1d7d7f4dd9fb9c From 1a2ef2faf4ba147b109e17b3e2e80b4acf74e316 Mon Sep 17 00:00:00 2001 From: Rob Day Date: Thu, 25 Jan 2018 19:39:01 +0000 Subject: [PATCH 18/28] Take latest cpp-common --- modules/cpp-common | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/cpp-common b/modules/cpp-common index 254f3b73e..cb50e5406 160000 --- a/modules/cpp-common +++ b/modules/cpp-common @@ -1 +1 @@ -Subproject commit 254f3b73e715f68977ec86286a1d7d7f4dd9fb9c +Subproject commit cb50e540623ffdd30070f70f03eaa89874ebaec5 From 17cd8bebc1ef44d8611e0c53d497025f6342552c Mon Sep 17 00:00:00 2001 From: Rob Day Date: Mon, 5 Feb 2018 09:52:42 +0000 Subject: [PATCH 19/28] SAS log on high post-dial delay --- include/scscfsproutlet.h | 2 +- src/scscfsproutlet.cpp | 13 +++++++++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/include/scscfsproutlet.h b/include/scscfsproutlet.h index a8b5c808f..ff8e31e77 100644 --- a/include/scscfsproutlet.h +++ b/include/scscfsproutlet.h @@ -147,7 +147,7 @@ class SCSCFSproutlet : public Sproutlet /// Record the time an INVITE took to reach ringing state. /// /// @param ringing_us Time spent until a 180 Ringing, in microseconds. - void track_session_setup_time(uint64_t tsx_start_time_usec, bool video_call); + uint64_t track_session_setup_time(uint64_t tsx_start_time_usec, bool video_call); /// Translate RequestURI using ENUM service if appropriate. void translate_request_uri(pjsip_msg* req, pj_pool_t* pool, SAS::TrailId trail); diff --git a/src/scscfsproutlet.cpp b/src/scscfsproutlet.cpp index 34e455962..0c4ffb2c7 100644 --- a/src/scscfsproutlet.cpp +++ b/src/scscfsproutlet.cpp @@ -378,7 +378,7 @@ void SCSCFSproutlet::track_app_serv_comm_success(const std::string& uri, } } -void SCSCFSproutlet::track_session_setup_time(uint64_t tsx_start_time_usec, +uint64_t SCSCFSproutlet::track_session_setup_time(uint64_t tsx_start_time_usec, bool video_call) { // Calculate how long it has taken to setup the session. @@ -394,6 +394,8 @@ void SCSCFSproutlet::track_session_setup_time(uint64_t tsx_start_time_usec, { _audio_session_setup_time_tbl->accumulate(ringing_usec); } + + return ringing_usec; } SCSCFSproutletTsx::SCSCFSproutletTsx(SCSCFSproutlet* scscf, @@ -884,7 +886,14 @@ void SCSCFSproutletTsx::on_tx_response(pjsip_msg* rsp) ((st_code == PJSIP_SC_RINGING) || PJSIP_IS_STATUS_IN_CLASS(st_code, 200))) { - _scscf->track_session_setup_time(_tsx_start_time_usec, _video_call); + uint64_t setup_time = _scscf->track_session_setup_time(_tsx_start_time_usec, _video_call); + if (setup_time > 2000000) + { + pjsip_cid_hdr* cid = PJSIP_MSG_CID_HDR(rsp); + TRC_WARNING("Call setup time exceeded 2 seconds for Call-ID %.*s", + cid->id.slen, + cid->id.ptr); + } _record_session_setup_time = false; } } From 20c175d4c941a30b178d6b5e97461d1a74efbd6e Mon Sep 17 00:00:00 2001 From: Rob Day Date: Mon, 5 Feb 2018 09:55:23 +0000 Subject: [PATCH 20/28] Downgrade log triggered by valid RPH header --- src/rphservice.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/rphservice.cpp b/src/rphservice.cpp index 30ec375ac..219aca984 100644 --- a/src/rphservice.cpp +++ b/src/rphservice.cpp @@ -221,9 +221,9 @@ SIPEventPriorityLevel RPHService::lookup_priority(std::string rph_value, // We received a message with an unknown RPH value. This could be because: // - It is not defined in the IANA namespace. // - It is not assigned a priority value in the rph.json file. - TRC_WARNING("An unknown RPH value \"%s\" was received on an incoming message." - " This message will be handled, but will not be prioritized.", - rph_value.c_str()); + TRC_DEBUG("An unknown RPH value \"%s\" was received on an incoming message." + " This message will be handled, but will not be prioritized.", + rph_value.c_str()); SAS::Event event(trail, SASEvent::RPH_VALUE_UNKNOWN, 0); event.add_var_param(rph_value); SAS::report_event(event); From e46fd2a002dfce1d163573122b4115c842020fe9 Mon Sep 17 00:00:00 2001 From: Rob Day Date: Mon, 5 Feb 2018 15:37:25 +0000 Subject: [PATCH 21/28] Update cpp-common --- modules/cpp-common | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/cpp-common b/modules/cpp-common index cb50e5406..a628fbeff 160000 --- a/modules/cpp-common +++ b/modules/cpp-common @@ -1 +1 @@ -Subproject commit cb50e540623ffdd30070f70f03eaa89874ebaec5 +Subproject commit a628fbeff2a8e984b15c671a385cfb4f9ec3c71a From 5200661939ef9b1bc978ac113f3d287c4cdf0cb6 Mon Sep 17 00:00:00 2001 From: Rob Day Date: Mon, 5 Feb 2018 15:37:54 +0000 Subject: [PATCH 22/28] Log out observed call setup time --- src/scscfsproutlet.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/scscfsproutlet.cpp b/src/scscfsproutlet.cpp index 0c4ffb2c7..3b301f21a 100644 --- a/src/scscfsproutlet.cpp +++ b/src/scscfsproutlet.cpp @@ -890,9 +890,10 @@ void SCSCFSproutletTsx::on_tx_response(pjsip_msg* rsp) if (setup_time > 2000000) { pjsip_cid_hdr* cid = PJSIP_MSG_CID_HDR(rsp); - TRC_WARNING("Call setup time exceeded 2 seconds for Call-ID %.*s", + TRC_WARNING("Call setup time exceeded 2 seconds for Call-ID %.*s (was %lu us)", cid->id.slen, - cid->id.ptr); + cid->id.ptr, + setup_time); } _record_session_setup_time = false; } From 7a1eda24e192b2ed9ce1586295c3b824f494f069 Mon Sep 17 00:00:00 2001 From: Rob Day Date: Tue, 6 Feb 2018 12:32:13 +0000 Subject: [PATCH 23/28] Update cpp-common --- modules/cpp-common | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/cpp-common b/modules/cpp-common index a628fbeff..4480d1fc9 160000 --- a/modules/cpp-common +++ b/modules/cpp-common @@ -1 +1 @@ -Subproject commit a628fbeff2a8e984b15c671a385cfb4f9ec3c71a +Subproject commit 4480d1fc96aad514902e4f1a3152ad70a4390ed7 From 66b140ef225e8352e814dd023684f725d932b0d6 Mon Sep 17 00:00:00 2001 From: Rob Day Date: Tue, 6 Feb 2018 12:35:08 +0000 Subject: [PATCH 24/28] Update cpp-common --- modules/cpp-common | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/cpp-common b/modules/cpp-common index 4480d1fc9..3983f9992 160000 --- a/modules/cpp-common +++ b/modules/cpp-common @@ -1 +1 @@ -Subproject commit 4480d1fc96aad514902e4f1a3152ad70a4390ed7 +Subproject commit 3983f99928e3bd452839c8cbebbf541f1e3bc10f From 37df15fecfc0b020f62c67e4199a552fc0f1a800 Mon Sep 17 00:00:00 2001 From: Rob Day Date: Tue, 6 Feb 2018 17:44:25 +0000 Subject: [PATCH 25/28] Update cpp-common --- modules/cpp-common | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/cpp-common b/modules/cpp-common index 3983f9992..c2910c563 160000 --- a/modules/cpp-common +++ b/modules/cpp-common @@ -1 +1 @@ -Subproject commit 3983f99928e3bd452839c8cbebbf541f1e3bc10f +Subproject commit c2910c563a6183a32c9089d82429bd996279106d From 4cee03464019d5ad38cf826418c7a75dea9b8220 Mon Sep 17 00:00:00 2001 From: Rob Dover Date: Tue, 13 Feb 2018 12:33:09 +0000 Subject: [PATCH 26/28] Increasing memcached timeout --- modules/cpp-common | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/cpp-common b/modules/cpp-common index c2910c563..1018d2531 160000 --- a/modules/cpp-common +++ b/modules/cpp-common @@ -1 +1 @@ -Subproject commit c2910c563a6183a32c9089d82429bd996279106d +Subproject commit 1018d253146e1b5df89378f68570963d03dfcae7 From 66906c0ac7e661662de67f48b5f218255915e8f3 Mon Sep 17 00:00:00 2001 From: Rob Dover Date: Tue, 13 Feb 2018 13:15:01 +0000 Subject: [PATCH 27/28] Taking the correct cpp-common branch --- modules/cpp-common | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/cpp-common b/modules/cpp-common index 1018d2531..78dd50deb 160000 --- a/modules/cpp-common +++ b/modules/cpp-common @@ -1 +1 @@ -Subproject commit 1018d253146e1b5df89378f68570963d03dfcae7 +Subproject commit 78dd50deb55cbb4e59f3e3ab75edbb2d03cdeb04 From 400577c31234753e9fa242b9fab30f188e015ac6 Mon Sep 17 00:00:00 2001 From: Rob Dover Date: Fri, 16 Feb 2018 20:09:21 +0000 Subject: [PATCH 28/28] Revert "set all errors we've seen into dummy values" This reverts commit 0ea6e73c66f1b771b3565b5daeb16c15828adbc6. Conflicts: src/icscfrouter.cpp --- src/authenticationsproutlet.cpp | 4 ++-- src/hss_sip_mapping.cpp | 12 ++++++------ src/icscfrouter.cpp | 14 +++++++------- src/icscfsproutlet.cpp | 2 +- src/pjutils.cpp | 4 ++-- src/registrarsproutlet.cpp | 4 ++-- src/scscfsproutlet.cpp | 6 +++--- src/subscriptionsproutlet.cpp | 2 +- 8 files changed, 24 insertions(+), 24 deletions(-) diff --git a/src/authenticationsproutlet.cpp b/src/authenticationsproutlet.cpp index e10066d83..205a9f4d0 100644 --- a/src/authenticationsproutlet.cpp +++ b/src/authenticationsproutlet.cpp @@ -903,8 +903,8 @@ void AuthenticationSproutletTsx::create_challenge(pjsip_digest_credential* crede if (av_source_unavailable) { TRC_ERROR("Downstream node is overloaded or unresponsive, unable to get Authentication vector"); - rsp->line.status.code = 514; - rsp->line.status.reason = *pjsip_get_status_text((pjsip_status_code)55); + rsp->line.status.code = PJSIP_SC_SERVER_TIMEOUT; + rsp->line.status.reason = *pjsip_get_status_text(PJSIP_SC_SERVER_TIMEOUT); SAS::Event event(trail(), SASEvent::AUTHENTICATION_FAILED_OVERLOAD, 0); SAS::report_event(event); } diff --git a/src/hss_sip_mapping.cpp b/src/hss_sip_mapping.cpp index 2bde468d5..a6e26dd62 100644 --- a/src/hss_sip_mapping.cpp +++ b/src/hss_sip_mapping.cpp @@ -40,12 +40,12 @@ pjsip_status_code determine_hss_sip_response(HTTPCode http_code, // "if the Request-URI of the SUBSCRIBE request contains a URI for // which currently no binding exists, then send a 480 (Temporarily // Unavailable) response" - st_code = (pjsip_status_code)471; + st_code = PJSIP_SC_TEMPORARILY_UNAVAILABLE; } else { // LCOV_EXCL_START - st_code = (pjsip_status_code)524; + st_code = PJSIP_SC_SERVER_TIMEOUT; // LCOV_EXCL_STOP } break; @@ -56,7 +56,7 @@ pjsip_status_code determine_hss_sip_response(HTTPCode http_code, TRC_ERROR("Rejecting %s request as subscriber not present on the HSS", sip_msg_type); - st_code = (pjsip_status_code)472; + st_code = PJSIP_SC_FORBIDDEN; break; case HTTP_SERVER_UNAVAILABLE: @@ -76,7 +76,7 @@ pjsip_status_code determine_hss_sip_response(HTTPCode http_code, TRC_ERROR("Rejecting %s request as unable to contact HSS: %d", sip_msg_type, http_code); - st_code = (pjsip_status_code)534; + st_code = PJSIP_SC_SERVER_TIMEOUT; break; case HTTP_SERVER_ERROR: @@ -85,14 +85,14 @@ pjsip_status_code determine_hss_sip_response(HTTPCode http_code, TRC_ERROR("Rejecting %s request following error communicating with the HSS", sip_msg_type); - st_code = (pjsip_status_code)520; + st_code = PJSIP_SC_INTERNAL_SERVER_ERROR; break; default: TRC_ERROR("Rejecting %s request following response %d from HSS", sip_msg_type, http_code); - st_code = (pjsip_status_code)544; + st_code = PJSIP_SC_SERVER_TIMEOUT; break; } } diff --git a/src/icscfrouter.cpp b/src/icscfrouter.cpp index fc5e58add..c71ccff1c 100644 --- a/src/icscfrouter.cpp +++ b/src/icscfrouter.cpp @@ -169,7 +169,7 @@ int ICSCFRouter::get_scscf(pj_pool_t* pool, else { TRC_WARNING("Invalid SCSCF URI %s", scscf.c_str()); - status_code = (pjsip_status_code)477; + status_code = PJSIP_SC_TEMPORARILY_UNAVAILABLE; } } else @@ -253,7 +253,7 @@ int ICSCFRouter::parse_hss_response(rapidjson::Document*& rsp, bool queried_caps { // Failed to parse capabilities, so reject with 480 response. TRC_INFO("Malformed required capabilities returned by HSS"); - status_code = (pjsip_status_code)473; + status_code = PJSIP_SC_TEMPORARILY_UNAVAILABLE; } } @@ -270,7 +270,7 @@ int ICSCFRouter::parse_hss_response(rapidjson::Document*& rsp, bool queried_caps { // Failure response from HSS indicating that a subscriber exists but is unregistered and // has no unregistered services, so respond with 480 Temporarily Unavailable. - status_code = (pjsip_status_code)474; + status_code = PJSIP_SC_TEMPORARILY_UNAVAILABLE; } else { @@ -374,8 +374,8 @@ int ICSCFUARouter::hss_query() { // HSS failed to respond or responded with invalid data, so reject the // request with a 480. - TRC_ERROR("I-CSCF UAR got %d HTTP response from Homestead, replying with SIP error 475", rc); - status_code = (pjsip_status_code)475; + TRC_ERROR("I-CSCF UAR got %d HTTP response from Homestead", rc); + status_code = PJSIP_SC_TEMPORARILY_UNAVAILABLE; } else { @@ -448,8 +448,8 @@ int ICSCFLIRouter::hss_query() // HSS failed to respond or responded with invalid data, so reject the // request with a 480. // LCOV_EXCL_START - TRC_ERROR("I-CSCF UAR got %d HTTP response from Homestead, replying with SIP error 476", rc); - status_code = (pjsip_status_code)476; + TRC_ERROR("I-CSCF UAR got %d HTTP response from Homestead", rc); + status_code = PJSIP_SC_TEMPORARILY_UNAVAILABLE; // LCOV_EXCL_STOP } else diff --git a/src/icscfsproutlet.cpp b/src/icscfsproutlet.cpp index fe75d21f7..1a957b748 100644 --- a/src/icscfsproutlet.cpp +++ b/src/icscfsproutlet.cpp @@ -404,7 +404,7 @@ void ICSCFSproutletRegTsx::on_rx_response(pjsip_msg* rsp, int fork_id) // least one valid S-CSCF (as this is retry processing). The I-CSCF // must return 504 (TS 24.229, 5.3.1.3) in this case. TRC_ERROR("I-CSCF can't select an S-CSCF for REGISTER request"); - rsp->line.status.code = 564; + rsp->line.status.code = PJSIP_SC_SERVER_TIMEOUT; rsp->line.status.reason = *pjsip_get_status_text(rsp->line.status.code); } diff --git a/src/pjutils.cpp b/src/pjutils.cpp index ff49cbe9c..8016bff2a 100644 --- a/src/pjutils.cpp +++ b/src/pjutils.cpp @@ -1967,7 +1967,7 @@ pjsip_status_code PJUtils::redirect_int(pjsip_msg* msg, pjsip_uri* target, pj_po static const int MAX_HISTORY_INFOS = 5; // Default the code to 480 Temporarily Unavailable. - code = (code != 0) ? code : (pjsip_status_code)478; + code = (code != 0) ? code : PJSIP_SC_TEMPORARILY_UNAVAILABLE; pjsip_status_code rc = code; // Count the number of existing History-Info headers. @@ -1992,7 +1992,7 @@ pjsip_status_code PJUtils::redirect_int(pjsip_msg* msg, pjsip_uri* target, pj_po std::string div = PJUtils::uri_to_string(PJSIP_URI_IN_REQ_URI, msg->line.req.uri); div += ";reason="; div += (code == PJSIP_SC_BUSY_HERE) ? "user-busy" : - (code == (pjsip_status_code)478) ? "no-answer" : + (code == PJSIP_SC_TEMPORARILY_UNAVAILABLE) ? "no-answer" : (code == PJSIP_SC_NOT_FOUND) ? "out-of-service" : (code == 0) ? "unconditional" : "unknown"; diff --git a/src/registrarsproutlet.cpp b/src/registrarsproutlet.cpp index fa8bf1cd6..827720903 100644 --- a/src/registrarsproutlet.cpp +++ b/src/registrarsproutlet.cpp @@ -530,7 +530,7 @@ void RegistrarSproutletTsx::process_register_request(pjsip_msg *req) // response. // LCOV_EXCL_START - the can't fail to connect to the store we use for UT TRC_ERROR("Failed to connect to local store, private_id= %s", private_id.c_str()); - st_code = (pjsip_status_code)510; + st_code = PJSIP_SC_INTERNAL_SERVER_ERROR; SAS::Event event(trail(), SASEvent::REGISTER_FAILED_REGSTORE, 0); event.add_var_param(public_id); @@ -611,7 +611,7 @@ void RegistrarSproutletTsx::process_register_request(pjsip_msg *req) event.add_var_param(public_id); SAS::report_event(event); - rsp->line.status.code = 520; + rsp->line.status.code = PJSIP_SC_INTERNAL_SERVER_ERROR; acr->tx_response(rsp); diff --git a/src/scscfsproutlet.cpp b/src/scscfsproutlet.cpp index 3b301f21a..e08cd8bd2 100644 --- a/src/scscfsproutlet.cpp +++ b/src/scscfsproutlet.cpp @@ -1148,7 +1148,7 @@ pjsip_status_code SCSCFSproutletTsx::determine_served_user(pjsip_msg* req) { // Send a SIP 504 response if we got a 500/503 HTTP response. TRC_ERROR("AS retargeting failed to lookup IFCs for served user"); - status_code = (pjsip_status_code)574; + status_code = PJSIP_SC_SERVER_TIMEOUT; } else { @@ -1264,7 +1264,7 @@ pjsip_status_code SCSCFSproutletTsx::determine_served_user(pjsip_msg* req) if ((http_code == HTTP_SERVER_UNAVAILABLE) || (http_code == HTTP_GATEWAY_TIMEOUT)) { // Send a SIP 504 response if we got a 500/503 HTTP response. - status_code = (pjsip_status_code)584; + status_code = PJSIP_SC_SERVER_TIMEOUT; } else { @@ -1857,7 +1857,7 @@ void SCSCFSproutletTsx::route_to_ue_bindings(pjsip_msg* req) if (targets.empty()) { // No valid target bindings for this request, so reject it. - pjsip_msg* rsp = create_response(req, (pjsip_status_code)479); + pjsip_msg* rsp = create_response(req, PJSIP_SC_TEMPORARILY_UNAVAILABLE); send_response(rsp); free_msg(req); } diff --git a/src/subscriptionsproutlet.cpp b/src/subscriptionsproutlet.cpp index a07e10802..35896cf8c 100644 --- a/src/subscriptionsproutlet.cpp +++ b/src/subscriptionsproutlet.cpp @@ -322,7 +322,7 @@ void SubscriptionSproutletTsx::process_subscription_request(pjsip_msg* req) if (st_code != PJSIP_SC_OK) { - if (st_code == (pjsip_status_code)499) + if (st_code == PJSIP_SC_TEMPORARILY_UNAVAILABLE) { // A 480 response means that the subscriber wasn't registered SAS::Event event(trail_id, SASEvent::SUBSCRIBE_FAILED_EARLY_NOT_REG, 0);