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

Method newSipDialogMOUssd

SIP/SIPDialog.cpp:145–182  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

143}
144
145SipDialog *SipDialog::newSipDialogMOUssd(
146 TranEntryId tranid,
147 const FullMobileId &fromMsId, // caller imsi
148 const string &wUssd, // USSD string entered by user to send to network.
149 L3LogicalChannel *chan
150 )
151{
152 LOG(DEBUG) << "MOUssd (INVITE)"<<LOGVAR(fromMsId)<<LOGVARM(wUssd);
153 // TODO: The SIPEngine constructor calls sipSetUser. FIX IT. Maybe I just need to replace SIPEngine.
154 const char *proxyOption = "SIP.Proxy.USSD";
155 string proxy = gConfig.getStr(proxyOption);
156 LOG(DEBUG) << LOGVAR(proxyOption) <<LOGVAR(proxy);
157 if (proxy.length() > 259) { // TODO: This should be in the config checker, if anywhere.
158 LOG(ALERT) << "Configured " <<proxyOption <<" hostname is greater than 253 bytes!";
159 }
160 SipDialog *dialog = new SipDialog(SIPDTMOUssd,proxy,proxyOption);
161 dialog->dsSetLocalMO(fromMsId,true);
162 gReports.incr("OpenBTS.SIP.INVITE.Out");
163 // Must lock once we do dmAddCallDialog to prevent the SIPInterface threads from accessing this dialog
164 // while we finish construction.
165 ScopedLock lock(dialog->mDialogLock,__FILE__,__LINE__); // Must lock before dmAddCallDialog.
166
167 if (proxy == "testmode") {
168 gNewTransactionTable.ttSetDialog(tranid,dialog); // Must do this before the dialog receives any messages.
169 DialogUssdMessage *dmsg = new DialogUssdMessage(tranid,DialogState::dialogBye,0);
170 dmsg->dmMsgPayload = "Hello from OpenBTS. You entered:"+wUssd;
171 LOG(DEBUG) << "USSD test mode"<<LOGVAR(chan)<<LOGVAR(tranid)<<LOGVAR(fromMsId)<<dmsg->dmMsgPayload;
172 dialog->dialogQueueMessage(dmsg);
173 return dialog;
174 }
175 dialog->dsSetRemoteUri(makeUri(wUssd,dialog->localIP()));
176 // TODO: What about codecs? The example in 24.390 annex A has them.
177
178 gSipInterface.dmAddCallDialog(dialog);
179 gNewTransactionTable.ttSetDialog(tranid,dialog); // Must do this before the dialog receives any messages.
180 dialog->MOUssdSendINVITE(wUssd,chan);
181 return dialog;
182}
183
184// Open an MOC [Mobile Originated Call] dialog and send the invite.
185SipDialog *SipDialog::newSipDialogMOC(

Callers

nothing calls this directly

Calls 9

makeUriFunction · 0.85
dsSetLocalMOMethod · 0.80
ttSetDialogMethod · 0.80
dialogQueueMessageMethod · 0.80
dsSetRemoteUriMethod · 0.80
localIPMethod · 0.80
dmAddCallDialogMethod · 0.80
MOUssdSendINVITEMethod · 0.80
lengthMethod · 0.45

Tested by

no test coverage detected