Exemplo n.º 1
0
        private void HangupDialogue(SIPDialogue dialogue, string hangupCause, bool sendBye)
        {
            if (dialogue.CDRId != Guid.Empty)
            {
                CDR cdr = m_cdrDataLayer.Get(dialogue.CDRId);
                if (cdr != null)
                {
                    //cdr.BridgeID = dialogue.BridgeId;
                    //cdr.Hungup(hangupCause);
                    m_cdrDataLayer.Hangup(cdr.ID, hangupCause);
                }
                else
                {
                    logger.LogWarning("CDR could not be found for remote dialogue in SIPCallManager CallHungup.");
                }
            }
            else
            {
                logger.LogWarning("There was no CDR attached to orphaned dialogue in SIPCallManager CallHungup.");
            }

            if (sendBye)
            {
                dialogue.Hangup(m_sipTransport, m_outboundProxy);
                OnCallHungup?.Invoke(dialogue);
            }

            m_sipCallDataLayer.Delete(dialogue.Id);
        }
Exemplo n.º 2
0
        private void HangupDialogue(SIPDialogue dialogue, string hangupCause, bool sendBye)
        {
            if (dialogue.CDRId != Guid.Empty)
            {
                CDR cdr = m_cdrDataLayer.Get(dialogue.CDRId);
                if (cdr != null)
                {
                    //cdr.BridgeID = dialogue.BridgeId;
                    //cdr.Hungup(hangupCause);
                    m_cdrDataLayer.Hangup(cdr.ID, hangupCause);
                }
                else
                {
                    logger.LogWarning("CDR could not be found for remote dialogue in SIPCallManager CallHungup.");
                }
            }
            else
            {
                logger.LogWarning("There was no CDR attached to orphaned dialogue in SIPCallManager CallHungup.");
            }

            if (sendBye)
            {
                // In order to help cope with IPv4 NAT's apply some logic to determine if the Contact header URI looks likely
                // to fail which in turn would result in any in-dialgoue requests not being delivered.
                //var target = dialogue.RemoteTarget;
                //var mangledTarget = SIPURI.Mangle(target, dialogue.RemoteSIPEndPoint?.GetIPEndPoint());
                //if (mangledTarget != null)
                //{
                //    logger.LogDebug($"SIPCallManager adjusting BYE target from {target} to {mangledTarget}.");
                //    target = mangledTarget;
                //}

                //dialogue.Hangup(m_sipTransport, m_outboundProxy, target);

                dialogue.Hangup(m_sipTransport, dialogue.RemoteSIPEndPoint);

                OnCallHungup?.Invoke(dialogue);
            }

            m_sipCallDataLayer.Delete(dialogue.Id);
        }