//private bool m_closed = false; public SIPUDPChannel(IPEndPoint endPoint) { m_localSIPEndPoint = new SIPEndPoint(SIPProtocolsEnum.udp, endPoint); Initialise(); }
private void UASInviteTransaction_TransactionResponseReceived(SIPEndPoint localSIPEndPoint, SIPEndPoint remoteEndPoint, SIPTransaction sipTransaction, SIPResponse sipResponse) { //logger.Warn("UASInviteTransaction received unexpected response, " + sipResponse.ReasonPhrase + " from " + remoteEndPoint.ToString() + ", ignoring."); }
private void UASInviteTransaction_TransactionRequestReceived(SIPEndPoint localSIPEndPoint, SIPEndPoint remoteEndPoint, SIPTransaction sipTransaction, SIPRequest sipRequest) { try { if (TransactionState == SIPTransactionStatesEnum.Terminated) { logger.Debug("Request received by UASInviteTransaction for a terminated transaction, ignoring."); } else if (sipRequest.Method != SIPMethodsEnum.INVITE) { logger.Warn("Unexpected " + sipRequest.Method + " passed to UASInviteTransaction."); } else { if (TransactionState != SIPTransactionStatesEnum.Trying) { SIPResponse tryingResponse = GetInfoResponse(m_transactionRequest, SIPResponseStatusCodesEnum.Trying); SendInformationalResponse(tryingResponse); } // Notify new call subscribers. if (NewCallReceived != null) { NewCallReceived(localSIPEndPoint, remoteEndPoint, this, sipRequest); } else { // Nobody wants the call so return an error response. SIPResponse declinedResponse = SIPTransport.GetResponse(sipRequest, SIPResponseStatusCodesEnum.Decline, "Nothing listening"); SendFinalResponse(declinedResponse); } } } catch (Exception excp) { logger.Error("Exception UASInviteTransaction GotRequest. " + excp.Message); } }
public void GotRequest(SIPEndPoint localSIPEndPoint, SIPEndPoint remoteEndPoint, SIPRequest sipRequest) { FireTransactionTraceMessage("Received Request " + localSIPEndPoint.ToString() + "<-" + remoteEndPoint.ToString() + m_crLF + sipRequest.ToString()); TransactionRequestReceived?.Invoke(localSIPEndPoint, remoteEndPoint, this, sipRequest); }
public void ACKReceived(SIPEndPoint localSIPEndPoint, SIPEndPoint remoteEndPoint, SIPRequest sipRequest) { UpdateTransactionState(SIPTransactionStatesEnum.Confirmed); }
public SIPResponse(SIPResponseStatusCodesEnum responseType, string reasonPhrase, SIPEndPoint localSIPEndPoint) { SIPVersion = m_sipVersion; StatusCode = (int)responseType; Status = responseType; ReasonPhrase = reasonPhrase; ReasonPhrase = responseType.ToString(); LocalSIPEndPoint = localSIPEndPoint; }
public SIPEndPoint CopyOf() { SIPEndPoint copy = new SIPEndPoint(Protocol, new IPAddress(Address.GetAddressBytes()), Port); return(copy); }
public static bool AreEqual(SIPEndPoint endPoint1, SIPEndPoint endPoint2) { return(endPoint1 == endPoint2); }
/// <summary> /// This constructor is used by client user agents or SIP elements acting in a client user agent role. When /// acting as a client user agent the local fields are contained in the From header and the remote fields are /// in the To header. /// </summary> public SIPDialogue( UACInviteTransaction uacInviteTransaction, string owner, string adminMemberId) { Id = Guid.NewGuid(); CallId = uacInviteTransaction.TransactionRequest.Header.CallId; RouteSet = (uacInviteTransaction.TransactionFinalResponse != null && uacInviteTransaction.TransactionFinalResponse.Header.RecordRoutes != null) ? uacInviteTransaction.TransactionFinalResponse.Header.RecordRoutes.Reversed() : null; LocalUserField = uacInviteTransaction.TransactionFinalResponse.Header.From.FromUserField; LocalTag = uacInviteTransaction.TransactionFinalResponse.Header.From.FromTag; RemoteUserField = uacInviteTransaction.TransactionFinalResponse.Header.To.ToUserField; RemoteTag = uacInviteTransaction.TransactionFinalResponse.Header.To.ToTag; CSeq = uacInviteTransaction.TransactionRequest.Header.CSeq; CDRId = uacInviteTransaction.CDR.CDRId; Owner = owner; AdminMemberId = adminMemberId; ContentType = uacInviteTransaction.TransactionRequest.Header.ContentType; SDP = uacInviteTransaction.TransactionRequest.Body; RemoteSDP = uacInviteTransaction.TransactionFinalResponse.Body; Inserted = DateTimeOffset.UtcNow; Direction = SIPCallDirection.Out; // Set the dialogue remote target and take care of mangling if an upstream proxy has indicated it's required. RemoteTarget = new SIPURI(uacInviteTransaction.TransactionRequest.URI.Scheme, SIPEndPoint.ParseSIPEndPoint(uacInviteTransaction.RemoteEndPoint.ToString())); ProxySendFrom = uacInviteTransaction.TransactionFinalResponse.Header.ProxyReceivedOn; if (uacInviteTransaction.TransactionFinalResponse.Header.Contact != null && uacInviteTransaction.TransactionFinalResponse.Header.Contact.Count > 0) { RemoteTarget = uacInviteTransaction.TransactionFinalResponse.Header.Contact[0].ContactURI.CopyOf(); if (!uacInviteTransaction.TransactionFinalResponse.Header.ProxyReceivedFrom.IsNullOrBlank()) { // Setting the Proxy-ReceivedOn header is how an upstream proxy will let an agent know it should mangle the contact. // Don't mangle private contacts if there is a Record-Route header. If a proxy is putting private IP's in a Record-Route header that's its problem. if (RouteSet == null && IPSocket.IsPrivateAddress(RemoteTarget.Host)) { SIPEndPoint remoteUASSIPEndPoint = SIPEndPoint.ParseSIPEndPoint(uacInviteTransaction.TransactionFinalResponse.Header.ProxyReceivedFrom); RemoteTarget.Host = remoteUASSIPEndPoint.GetIPEndPoint().ToString(); } } } }
public SIPDNSLookupEndPoint(SIPEndPoint sipEndPoint, int ttl) { LookupEndPoint = sipEndPoint; TTL = ttl; ResolvedAt = DateTime.Now; }