From 51f57d7ce2bb7539a7d8966fe1387cf204e0256d Mon Sep 17 00:00:00 2001 From: Donat Zenichev Date: Fri, 17 Nov 2023 16:02:52 +0100 Subject: [PATCH] MT#58584 Add more logging to `core::AmBasicSipDialog::sendRequest()` Add more logging to the `core::AmBasicSipDialog::sendRequest()`. No functional changes. Change-Id: I3837164393e9dbb6dc592acd3e494ec228bcbcd6 --- core/AmBasicSipDialog.cpp | 45 ++++++++++++++++++++++----------------- 1 file changed, 26 insertions(+), 19 deletions(-) diff --git a/core/AmBasicSipDialog.cpp b/core/AmBasicSipDialog.cpp index b1a2ea48..4e66b021 100644 --- a/core/AmBasicSipDialog.cpp +++ b/core/AmBasicSipDialog.cpp @@ -694,58 +694,65 @@ int AmBasicSipDialog::sendRequest(const string& method, req.method = method; req.r_uri = remote_uri; + DBG("sendRequest: remote_uri='%s'; callid='%s'; cseq='%i'; from_tag='%s'; to_tag='%s';\n", + remote_uri.c_str(), + callid.c_str(), + cseq, + (!ext_local_tag.empty() ? ext_local_tag.c_str() : local_tag.c_str()), + (!remote_tag.empty() ? remote_tag.c_str() : "")); + req.from = SIP_HDR_COLSP(SIP_HDR_FROM) + local_party; - if(!ext_local_tag.empty()) + if (!ext_local_tag.empty()) { req.from += ";tag=" + ext_local_tag; - else if(!local_tag.empty()) + } else if(!local_tag.empty()) { req.from += ";tag=" + local_tag; - + } + req.to = SIP_HDR_COLSP(SIP_HDR_TO) + remote_party; - if(!remote_tag.empty()) + if (!remote_tag.empty()) req.to += ";tag=" + remote_tag; - + req.cseq = cseq; req.callid = callid; - req.hdrs = hdrs; - req.route = getRoute(); - if(body != NULL) { + if (body != NULL) { req.body = *body; } - if(onTxRequest(req,flags) < 0) + if (onTxRequest(req,flags) < 0) { return -1; + } if (!(flags & SIP_FLAGS_NOCONTACT)) { req.contact = getContactHdr(); } if (!(flags & SIP_FLAGS_VERBATIM)) { - // add Signature + /* add Signature */ if (AmConfig::Signature.length()) req.hdrs += SIP_HDR_COLSP(SIP_HDR_USER_AGENT) + AmConfig::Signature + CRLF; } int send_flags = 0; - if(patch_ruri_next_hop && remote_tag.empty()) { + if (patch_ruri_next_hop && remote_tag.empty()) { send_flags |= TR_FLAG_NEXT_HOP_RURI; } - if((flags & SIP_FLAGS_NOBL) || - !remote_tag.empty()) { + if ((flags & SIP_FLAGS_NOBL) || !remote_tag.empty()) { send_flags |= TR_FLAG_DISABLE_BL; } int res = SipCtrlInterface::send(req, local_tag, - remote_tag.empty() || !next_hop_1st_req ? - next_hop : "", - outbound_interface, - send_flags,logger); - if(res) { + remote_tag.empty() || !next_hop_1st_req ? + next_hop : "", + outbound_interface, + send_flags,logger); + + if (res) { ERROR("Could not send request: method=%s; call-id=%s; cseq=%i\n", - req.method.c_str(),req.callid.c_str(),req.cseq); + req.method.c_str(),req.callid.c_str(),req.cseq); return res; }