MCPcopy Create free account
hub / github.com/SIPp/sipp / process_unexpected

Method process_unexpected

src/call.cpp:2323–2407  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2321}
2322
2323bool call::process_unexpected(const char* msg)
2324{
2325 char buffer[MAX_HEADER_LEN];
2326 StringBuilder sb(buffer);
2327 int res = 0;
2328
2329 message *curmsg = call_scenario->messages[msg_index];
2330
2331 curmsg->nb_unexp++;
2332
2333 if (default_behaviors & DEFAULT_BEHAVIOR_ABORTUNEXP) {
2334 sb << "Aborting ";
2335 } else {
2336 sb << "Continuing ";
2337 }
2338 sb << "call on unexpected message for Call-Id '" << id << "': ";
2339
2340 if (curmsg -> M_type == MSG_TYPE_RECV) {
2341 if (curmsg -> recv_request) {
2342 sb << "while expecting '" << curmsg -> recv_request << "' ";
2343 } else {
2344 sb << "while expecting '" << curmsg -> recv_response << "' ";
2345 }
2346 } else if (curmsg -> M_type == MSG_TYPE_SEND) {
2347 sb << "while sending ";
2348 } else if (curmsg -> M_type == MSG_TYPE_PAUSE) {
2349 sb << "while pausing ";
2350 } else if (curmsg -> M_type == MSG_TYPE_SENDCMD) {
2351 sb << "while sending command ";
2352 } else if (curmsg -> M_type == MSG_TYPE_RECVCMD) {
2353 sb << "while expecting command ";
2354 } else {
2355 sb << "while in message type " << curmsg->M_type << " ";
2356 }
2357 sb << "(index " << msg_index << ")";
2358
2359 WARNING("%s, received '%s'", sb.get(), msg);
2360
2361 TRACE_MSG("-----------------------------------------------\n"
2362 "Unexpected %s message received:\n\n%s\n",
2363 TRANSPORT_TO_STRING(transport),
2364 msg);
2365
2366 callDebug("Unexpected %s message received (index %d, hash %lu):\n\n%s\n",
2367 TRANSPORT_TO_STRING(transport), msg_index, hash(msg), msg);
2368
2369 if (get_reply_code(msg)) {
2370 this->call_scenario->stats->error_codes.push_back(get_reply_code(msg));
2371 }
2372
2373 if (default_behaviors & DEFAULT_BEHAVIOR_ABORTUNEXP) {
2374 // if twin socket call => reset the other part here
2375 if (twinSippSocket && (msg_index > 0)) {
2376 res = sendCmdBuffer(createSendingMessage(get_default_message("3pcc_abort")));
2377 if (res < 0) {
2378 WARNING("sendCmdBuffer returned %d", res);
2379 return false;
2380 }

Callers

nothing calls this directly

Calls 6

WARNINGFunction · 0.85
TRACE_MSGFunction · 0.85
get_reply_codeFunction · 0.85
get_default_messageFunction · 0.85
ERRORFunction · 0.85
getMethod · 0.80

Tested by

no test coverage detected