MCPcopy Create free account
hub / github.com/RangeNetworks/openbts / newSipDialogMT

Method newSipDialogMT

SIP/SIPDialog.cpp:71–97  ·  view source on GitHub ↗

(pat) This is the post-l3-rewrite way, most initialization during construction.

Source from the content-addressed store, hash-verified

69
70// (pat) This is the post-l3-rewrite way, most initialization during construction.
71SipDialog *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.
100SipDialog *SipDialog::newSipDialogRegister1() // caller imsi

Callers

nothing calls this directly

Calls 6

smGetProxyMethod · 0.80
dsSetLocalHeaderMTMethod · 0.80
dsSetRemoteHeaderMethod · 0.80
dsSetCallIdMethod · 0.80
saveInviteOrMessageMethod · 0.80
dmAddCallDialogMethod · 0.80

Tested by

no test coverage detected