| 616 | } |
| 617 | |
| 618 | bool SipInterface::newCheckInvite(SipMessage *msg) |
| 619 | { |
| 620 | // Check for INVITE or MESSAGE methods. |
| 621 | // Check channel availability now, too, |
| 622 | // even if we are not actually assigning the channel yet. |
| 623 | if (msg->isINVITE()) { |
| 624 | gReports.incr("OpenBTS.SIP.INVITE.In"); |
| 625 | handleInvite(msg,true); |
| 626 | return true; |
| 627 | } else if (msg->isMESSAGE()) { |
| 628 | gReports.incr("OpenBTS.SIP.MESSAGE.In"); |
| 629 | handleInvite(msg,false); |
| 630 | return true; |
| 631 | } else { |
| 632 | |
| 633 | // Is this a message for an existing INVITE transaction, ie, that part of the INVITE before ACK? |
| 634 | // The findDialogMsg also finds a matching MESSAGE dialog or REGISTER dialog, but we are subsequently |
| 635 | // testing against the INVITE via-branch, which will find only INVITE transactions. |
| 636 | if (SipDialog *existing = findDialogByMsg(msg)) { |
| 637 | // The ACK and CANCEL message are sent to the INVITE server transaction. |
| 638 | // Other messages (BYE, INFO, etc) would be sent to the TU created for them. |
| 639 | if (msg->smGetCode() ? msg->smGetBranch() == existing->mInviteViaBranch : msg->isACK() || msg->isCANCEL()) { |
| 640 | WATCH("SIP Sending message to existing dialog"<<LOGVAR2("state",existing->getSipState())); |
| 641 | LOG(DEBUG) << "Sending message to existing dialog"<<LOGVAR(msg->smGetCode()) <<LOGVAR(msg->smGetBranch()) << LOGVAR(existing->mInviteViaBranch) << LOGVAR(msg->smGetMethodName()) << existing->dialogText(); |
| 642 | if (! existing->dgWriteHighSide(msg)) { |
| 643 | LOG(ERR) << "Confusing SIP message not handled, to dialog:" <<existing->dialogText(false)<< " message was:"<<msg; |
| 644 | } |
| 645 | return true; // We handled it or threw it away. |
| 646 | } |
| 647 | } |
| 648 | } |
| 649 | } |
| 650 | |
| 651 | |
| 652 | void SipInterface::siDrive2() |
nothing calls this directly
no test coverage detected