| 399 | } |
| 400 | |
| 401 | void SipInterface::newDriveIncoming(char *content) |
| 402 | { |
| 403 | LOG(DEBUG) << "SIP recv:"<<content; |
| 404 | |
| 405 | SipMessage *msg = sipParseBuffer(content); |
| 406 | if (!msg) { return; } |
| 407 | |
| 408 | WATCH("SIP recv "<<msg->smGetPrecis()); |
| 409 | |
| 410 | try { |
| 411 | if (newCheckInvite(msg)) { delete msg; return; } |
| 412 | |
| 413 | const char *methodname = msg->smGetMethodName(); // May be empty, but never NULL |
| 414 | if (*methodname) { LOG(DEBUG) << "non-initiating SIP method " << methodname; } |
| 415 | |
| 416 | if (checkTU(msg)) { delete msg; return; } |
| 417 | |
| 418 | // Send message to the appropriate SipDialog. |
| 419 | SipDialog *dialog = findDialogByMsg(msg); |
| 420 | if (dialog) { |
| 421 | if (msg->smGetCode()) { |
| 422 | // All replies go to the TUs, so if we did not find one above, this is an error. |
| 423 | LOG(NOTICE) << "SIP reply to non-existent SIP transaction "<<msg; |
| 424 | newSendEarlyError(msg,500,"Server Error"); |
| 425 | } |
| 426 | dialog->dialogWriteDownlink(msg); |
| 427 | } else { |
| 428 | string callid = msg->smGetCallId(); |
| 429 | LOG(NOTICE) << "unrecognized"<<LOGVAR(callid) <<LOGVAR2("SIP Message:",msg); |
| 430 | // Alert the SIP peer that this user is bogus. We did not do this pre-l3-rewrite. |
| 431 | // Asterisk seems to send 500 for this type of error. |
| 432 | newSendEarlyError(msg,404,"Not Found"); |
| 433 | delete msg; |
| 434 | } |
| 435 | |
| 436 | } catch(exception &e) { |
| 437 | LOG(ERR) << "SIP processing exception "<<e.what() << " " << typeid(&e).name(); |
| 438 | } catch(...) { |
| 439 | LOG(CRIT) << "Unhandled exception attempted to kill OpenBTS SIP processor"; // pat added |
| 440 | devassert(0); |
| 441 | } |
| 442 | } |
| 443 | |
| 444 | |
| 445 |
nothing calls this directly
no test coverage detected