This message exists to encapsulate the Dialog State into a SIP message. It is created on BS1 to send to BS2, which then uses it as a re-invite. So fill it out as a re-invite but leaving the parts based on the BS2 address empty, ie, no via or contact. Note that when we send it to BS2 the via and contact are BS1, which BS2 must fix. We need to pass the the remote proxy address that we derived from t
| 509 | // This goes in the URI of the header, implying that we cannot send this message to BS2 using normal SIP |
| 510 | // unless we move that to another field, eg, Contact. |
| 511 | SipMessageHandoverRefer::SipMessageHandoverRefer(const SipBase *dialog, string peer) |
| 512 | { |
| 513 | // The request URI will be the BTS we are sending it to... |
| 514 | this->msmReqMethod = string("REFER"); |
| 515 | this->msmReqUri = makeUri("handover",peer); |
| 516 | this->msmTo = *dialog->dsRequestToHeader(); |
| 517 | this->msmFrom = *dialog->dsRequestFromHeader(); |
| 518 | this->msmCallId = dialog->callId(); |
| 519 | this->msmCSeqMethod = this->msmReqMethod; // It is "INVITE". |
| 520 | // The CSeq num of the are-INVITE follows. |
| 521 | // RFC3261 14.1: The Cseq for re-INVITE follows same rules for in-dialog requests, namely, CSeq num must be |
| 522 | // incremented by exactly one. We do not know if BTS-2 is going to send this this re-INVITE or not, |
| 523 | // so we send the current CSeqNum without incrementing it and let BTS-2 increment it. |
| 524 | this->msmCSeqNum = dialog->mLocalCSeq; |
| 525 | SipParam refer("Refer-To",dialog->dsRemoteURI()); // This is the proxy from the Contact or route header. |
| 526 | this->msmHeaders.push_back(refer); |
| 527 | |
| 528 | // We need to send the SDP answer, which is the local SDP for MTC or the remote SDP for MOC, |
| 529 | // but we need to send the peer (remote) RTP port in either case. |
| 530 | // For the re-invite, you can put nearly anything in here, but you must not just use |
| 531 | // the identical o= line of the original without at least incrementing the version number. |
| 532 | SdpInfo sdpRefer, sdpRemote; |
| 533 | //sdpRefer.sdpInitOffer(dialog); |
| 534 | sdpRemote.sdpParse(dialog->getSdpRemote()); |
| 535 | |
| 536 | // Put the remote SIP server port in the REFER message. BTS-2 will grab it then substitute its own local port. |
| 537 | //sdpRefer.sdpRtpPort = sdpRemote.sdpRtpPort; |
| 538 | |
| 539 | sdpRefer.sdpInitRefer(dialog, sdpRemote.sdpRtpPort); |
| 540 | |
| 541 | // TODO: Put the remote session id and version, incrementing the version. Paul at yate says these should be 0 |
| 542 | |
| 543 | //SdpInfo sdpRefer; sdpRefer.sdpParse(dialog->mSdpAnswer); |
| 544 | //sdpRefer.sdpUsername = dialog->sipLocalusername(); |
| 545 | |
| 546 | // Update: This did not work for asterisk either. |
| 547 | //sdpRefer.sdpUsername = dialog->sipLocalUsername(); // This modification was recommended by Paul for Yate. |
| 548 | |
| 549 | //this->smAddBody(string("application/sdp"),sdpRefer.sdpValue()); |
| 550 | // Try just using the sdpremote verbatim? Gosh, that worked too. |
| 551 | this->smAddBody(string("application/sdp"),sdpRefer.sdpValue()); |
| 552 | |
| 553 | // The via and contact will be filled in by BS2: |
| 554 | // this->smAddViaBranch(dialog); |
| 555 | // this->msmContactValue = dialog->dsRemoteURI(); |
| 556 | // TODO: route set. |
| 557 | } |
| 558 | |
| 559 | // section 4: must preserve the vias in the reply to INVITE. |
| 560 | // 12.1.1: Dialog reply must have a contact. |
nothing calls this directly
no test coverage detected