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

Method dialogCancel

SIP/SIPDialog.cpp:319–433  ·  view source on GitHub ↗

If the cause is handoverOutbound, kill the dialog now: dont send a BYE, dont wait for any other incoming messsages. Used for outbound handover, where the SIP session was transferred to another BTS.

Source from the content-addressed store, hash-verified

317// If the cause is handoverOutbound, kill the dialog now: dont send a BYE, dont wait for any other incoming messsages.
318// Used for outbound handover, where the SIP session was transferred to another BTS.
319void SipDialog::dialogCancel(CancelCause cause)
320{
321 WATCH("dialogCancel"<<LOGVAR(getSipState())<<LOGVAR(cause) );
322 ScopedLock lock(mDialogLock,__FILE__,__LINE__);
323
324 SIP::SipState state = this->getSipState();
325 LOG(INFO) << dialogText(); // "SIP state " << state;
326
327 switch (cause) {
328 case CancelCauseHandoverOutbound:
329 case CancelCauseSipInternalError:
330 // Terminate the dialog instantly. Dont send anything on the SIP interface.
331 sipStopTimers();
332 // We need to remove the callid of the terminated outbound dialog queue from SIPInterface in case
333 // the same call is handerovered back, it would then be a duplicate.
334 gSipInterface.dmRemoveDialog(this);
335 return;
336 default:
337 break;
338 }
339
340 //why aren't we checking for failed here? -kurtis ; we are now. -david
341 if (this->sipIsFinished()) return;
342 switch (mDialogType) {
343 case SIPDTRegister:
344 case SIPDTUnregister:
345 // The Register is not a full dialog so we dont send anything when we cancel.
346 break;
347 case SIPDTMOSMS:
348 case SIPDTMTSMS:
349 case SIPDTMOUssd:
350 setSipState(Cleared);
351 break;
352 case SIPDTMTC:
353 case SIPDTMOC:
354 switch (state) {
355 case SSTimeout:
356 case MOSMSSubmit: // Should never see a message state in an INVITE dialog.
357 LOG(ERR) "Unexpected SIP State:"<<state;
358 break;
359 case Active: // (pat) MOC received OK; MTC sent ACK
360 //Changes state to clearing
361 this->MODSendBYE();
362 //then cleared
363 sipStartTimers(); // formerly: MODWaitForBYEOK();
364 break;
365 case SSNullState: // (pat) MTC initial state - nothing sent yet. MOC not used because sends INVITE on construction.
366 case Starting: // (pat) MOC or MOSMS or inboundHandover sent INVITE; MTC not used.
367 case Proceeding: // (pat) MOC received Trying, Queued, BeingForwarded; MTC sent Trying
368 case Ringing: // (pat) MOC received Ringing, notably not used for MTC sent Ringing.
369 case MOCBusy: // (pat) MOC received Busy; MTC not used.
370 case Connecting: // (pat) MTC sent OK.
371 case HandoverInbound:
372 if (mDialogType == SIPDTMOC) {
373 // To cancel the invite before the ACK is received we must send CANCEL instead of BYE.
374 this->MODSendCANCEL(); //Changes state to MODCanceling
375 } else {
376 // We are the INVITE recipient server and have not received the ACK yet, so we must send an error response.

Callers 4

machineRunStateMethod · 0.80
teCloseDialogMethod · 0.80
teRemoveMethod · 0.80
handleInviteMethod · 0.80

Calls 6

MODSendBYEMethod · 0.95
dmRemoveDialogMethod · 0.80
sipIsFinishedMethod · 0.80
MODSendCANCELMethod · 0.80
MTCEarlyErrorMethod · 0.80
getSipStateMethod · 0.45

Tested by

no test coverage detected