Open an MOC [Mobile Originated Call] dialog and send the invite.
| 183 | |
| 184 | // Open an MOC [Mobile Originated Call] dialog and send the invite. |
| 185 | SipDialog *SipDialog::newSipDialogMOC( |
| 186 | TranEntryId tranid, |
| 187 | const FullMobileId &fromMsId, // caller imsi |
| 188 | const string &wCalledDigits, // number being called, or empty for an emergency call. |
| 189 | CodecSet wCodecs, // phone capabilities |
| 190 | L3LogicalChannel *chan |
| 191 | ) |
| 192 | { |
| 193 | |
| 194 | #ifdef C_CRELEASE |
| 195 | LOG(DEBUG) << "MOC SIP (INVITE)"<<LOGVAR(fromMsId)<<LOGVAR2("called",wCalledDigits) <<LOGVAR(isEmergency); |
| 196 | // TODO: The SIPEngine constructor calls sipSetUser. FIX IT. Maybe I just need to replace SIPEngine. |
| 197 | const char *proxyOption = isEmergency ? "SIP.Proxy.Emergency" : "SIP.Proxy.Speech"; |
| 198 | #else |
| 199 | LOG(DEBUG) << "MOC SIP (INVITE)"<<LOGVAR(fromMsId)<<LOGVAR2("called",wCalledDigits); |
| 200 | // TODO: The SIPEngine constructor calls sipSetUser. FIX IT. Maybe I just need to replace SIPEngine. |
| 201 | const char *proxyOption = "SIP.Proxy.Speech"; |
| 202 | #endif |
| 203 | |
| 204 | string proxy = gConfig.getStr(proxyOption); |
| 205 | LOG(DEBUG) << LOGVAR(proxyOption) <<LOGVAR(proxy); |
| 206 | if (proxy.length() > 259) { // TODO: This should be in the config checker, if anywhere. |
| 207 | LOG(ALERT) << "Configured " <<proxyOption <<" hostname is greater than 253 bytes!"; |
| 208 | } |
| 209 | |
| 210 | SipDialog *dialog = new SipDialog(SIPDTMOC,proxy,proxyOption); |
| 211 | dialog->dsSetLocalMO(fromMsId,true); |
| 212 | |
| 213 | { |
| 214 | gReports.incr("OpenBTS.SIP.INVITE.Out"); |
| 215 | dialog->dsSetRemoteUri(makeUri(wCalledDigits,dialog->localIP())); |
| 216 | } |
| 217 | |
| 218 | dialog->mRTPPort = Control::allocateRTPPorts(); |
| 219 | dialog->mCodec = wCodecs; |
| 220 | |
| 221 | // Must lock once we do dmAddCallDialog to prevent the SIPInterface threads from accessing this dialog |
| 222 | // while we finish construction. |
| 223 | ScopedLock lock(dialog->mDialogLock,__FILE__,__LINE__); // Must lock before dmAddCallDialog. |
| 224 | gSipInterface.dmAddCallDialog(dialog); |
| 225 | gNewTransactionTable.ttSetDialog(tranid,dialog); // Must do this before the dialog receives any messages. |
| 226 | dialog->MOCSendINVITE(chan); |
| 227 | return dialog; |
| 228 | } |
| 229 | |
| 230 | // This is called in BS2 after a handover complete is received. It is an inbound handover, but an outoing MO re-INVITE. |
| 231 | // We take the SIP REFER message created by BS1 and send it to the SIP server as a re-INVITE. |
nothing calls this directly
no test coverage detected