/// <summary> /// Retrieves the other end of a call given the dialogue from one end. /// </summary> /// <param name="dialogue"></param> /// <returns></returns> public SIPDialogue GetOppositeDialogue(SIPDialogue dialogue) { if (dialogue.BridgeId != Guid.Empty) { SIPCall sipCall = m_sipCallDataLayer.Get(d => d.BridgeID == dialogue.BridgeId && d.ID != dialogue.Id); return((sipCall != null) ? sipCall.ToSIPDialogue() : null); } else { return(null); } }
public SIPDialogue GetDialogue(string callId, string localTag, string remoteTag) { SIPCall sipCall = m_sipCallDataLayer.Get(d => d.CallID == callId && d.LocalTag == localTag && d.RemoteTag == remoteTag); if (sipCall != null) { //logger.Debug("SIPDialogueManager dialogue match correctly found on dialogue hash."); return(sipCall.ToSIPDialogue()); } else { // Try on To tag. sipCall = m_sipCallDataLayer.Get(d => d.LocalTag == localTag); if (sipCall != null) { logger.LogWarning("SIPDialogueManager dialogue match found on fallback mechanism of To tag."); return(sipCall.ToSIPDialogue()); } // Try on From tag. sipCall = m_sipCallDataLayer.Get(d => d.RemoteTag == remoteTag); if (sipCall != null) { logger.LogWarning("SIPDialogueManager dialogue match found on fallback mechanism of From tag."); return(sipCall.ToSIPDialogue()); } // As an experiment will try on the Call-ID as well. However as a safeguard it will only succeed if there is only one instance of the // Call-ID in use. Since the Call-ID is not mandated by the SIP standard as being unique there it may be that matching on it causes more // problems then it solves. sipCall = m_sipCallDataLayer.Get(d => d.CallID == callId); if (sipCall != null) { logger.LogWarning("SIPDialogueManager dialogue match found on fallback mechanism of Call-ID."); return(sipCall.ToSIPDialogue()); } } return(null); }