(pat) This is the post-l3-rewrite way, most initialization during construction.
| 69 | |
| 70 | // (pat) This is the post-l3-rewrite way, most initialization during construction. |
| 71 | SipDialog *SipDialog::newSipDialogMT(DialogType dtype, SipMessage *req) |
| 72 | { |
| 73 | LOG(DEBUG); |
| 74 | assert(dtype == SIPDTMTC || dtype == SIPDTMTSMS); |
| 75 | string proxy = req->smGetProxy(); // Get it from the top via. |
| 76 | if (proxy.empty()) { |
| 77 | LOG(ERR) << "Missing proxy (from top via) in MT SIP message:"<<req; |
| 78 | // Guess at a proxy and try to keep going. |
| 79 | proxy = gConfig.getStr(dtype == SIPDTMTSMS ? "SIP.Proxy.SMS" : "SIP.Proxy.Speech"); |
| 80 | } |
| 81 | SipDialog *dialog = new SipDialog(dtype,proxy,"INVITE or MESSAGE via"); |
| 82 | /* TEMPORARY WORKAROUND : smqueue needs to handle this "To:" header properly, disabled for now to ship 4.0. |
| 83 | // 2-2014: RFC 3267 8.2.6.2 says the UAS (sip server) MUST add a "to" tag to a response, and MAY add a "to" tag to a provisional (100) response. |
| 84 | // The reason is in case the request is forked, the client could distinguish responses from multiple servers, a case that would not happen for us. |
| 85 | dialog->dsSetLocalHeaderMT(&req->msmTo,true); //dtype == SIPDTMTC); |
| 86 | */ |
| 87 | dialog->dsSetLocalHeaderMT(&req->msmTo,dtype == SIPDTMTC); |
| 88 | dialog->dsSetRemoteHeader(&req->msmFrom); |
| 89 | //dialog->mSipUsername = req->smUriUsername(); // IMSI/TMSI is in both the URI and the To: header. |
| 90 | // TODO: Validate username - must be valid IMSI or TMSI. |
| 91 | ScopedLock lock(dialog->mDialogLock,__FILE__,__LINE__); // probably unnecessary. |
| 92 | dialog->dsSetCallId(req->msmCallId); |
| 93 | dialog->mSdpOffer = req->msmBody; // Only useful for MTC, a no-op for MTSMS. |
| 94 | dialog->saveInviteOrMessage(req,false); |
| 95 | gSipInterface.dmAddCallDialog(dialog); |
| 96 | return dialog; |
| 97 | } |
| 98 | |
| 99 | // There is just one SipDialog that handles all REGISTER requests. |
| 100 | SipDialog *SipDialog::newSipDialogRegister1() // caller imsi |
nothing calls this directly
no test coverage detected