| 275 | |
| 276 | |
| 277 | string SipMessage::text(bool verbose) const |
| 278 | { |
| 279 | std::ostringstream ss; |
| 280 | ss << "SipMessage("; |
| 281 | { int code = smGetCode(); ss <<LOGVAR(code); } |
| 282 | if (!msmReqMethod.empty()) ss <<LOGVAR2("ReqMethod",msmReqMethod); |
| 283 | if (!msmReason.empty()) ss <<LOGVAR2("reason",msmReason); |
| 284 | if (!msmCSeqMethod.empty()) ss<<" CSeq="<<msmCSeqNum<< " "<<msmCSeqMethod; |
| 285 | if (!msmCallId.empty()) ss <<LOGVAR2("callid",msmCallId); |
| 286 | if (!msmReqUri.empty()) ss << LOGVAR2("ReqUri",msmReqUri); |
| 287 | { string To = msmTo.value(); if (!To.empty()) ss << LOGVAR(To); } |
| 288 | { string From = msmFrom.value(); if (!From.empty()) ss<<LOGVAR(From); } |
| 289 | if (!msmVias.empty()) ss <<LOGVAR2("Vias",msmVias); |
| 290 | if (!msmRoutes.empty()) ss <<LOGVAR2("Routes",msmRoutes); |
| 291 | if (!msmRecordRoutes.empty()) ss <<LOGVAR2("RecordRoutes",msmRecordRoutes); |
| 292 | if (!msmContactValue.empty()) ss <<LOGVAR2("Contact",msmContactValue); |
| 293 | //list<SipBody> msmBodies; |
| 294 | if (!msmContentType.empty()) ss<<LOGVAR2("ContentType",msmContentType); |
| 295 | if (!msmBody.empty()) ss<<LOGVAR2("Body",msmBody); |
| 296 | //if (!msmAuthenticateValue.empty()) ss<<LOGVARM(msmAuthenticateValue); |
| 297 | if (!msmAuthorizationValue.empty()) ss<<LOGVARM(msmAuthorizationValue); |
| 298 | for (SipParamList::const_iterator it = msmHeaders.begin(); it != msmHeaders.end(); it++) { |
| 299 | ss <<" header "<<it->mName <<"="<<it->mValue; |
| 300 | } |
| 301 | |
| 302 | if (verbose) { ss << LOGVARM(msmContent); } else { ss << LOGVAR2("firstLine",smGetFirstLine()); } |
| 303 | ss << ")"; |
| 304 | return ss.str(); |
| 305 | } |
| 306 | ostream& operator<<(ostream& os, const SipMessage&msg) { os << msg.text(); return os; } |
| 307 | ostream& operator<<(ostream& os, const SipMessage*msg) { os << (msg ? msg->text(false) : "(null SipMessage)"); return os; } |
| 308 |
no test coverage detected