31 lines
951 B
C#
31 lines
951 B
C#
using Independentsoft.Sip;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace SipComponent
|
|
{
|
|
static class ExtentionMethods
|
|
{
|
|
/// <summary>
|
|
/// Gets the Dialog with the specified id
|
|
/// </summary>
|
|
/// <param name="sipClient">The object to which the method applies</param>
|
|
/// <param name="sipID">A sip Id with whom the SipClient class is in dialog</param>
|
|
/// <returns></returns>
|
|
public static Dialog GetDialogWith(this SipClient sipClient, string sipID)
|
|
{
|
|
return sipClient.Dialogs.FirstOrDefault((dialog) =>
|
|
{
|
|
if ((dialog.From.Address.Split(':', '@')[1] == sipID) ||
|
|
(dialog.To.Address.Split(':', '@')[1] == sipID))
|
|
return true;
|
|
else
|
|
return false;
|
|
});
|
|
}
|
|
}
|
|
}
|