本文整理汇总了C#中SIPLib.SIP.UserAgent类的典型用法代码示例。如果您正苦于以下问题:C# UserAgent类的具体用法?C# UserAgent怎么用?C# UserAgent使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
UserAgent类属于SIPLib.SIP命名空间,在下文中一共展示了UserAgent类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Cancelled
/// <summary>
/// Stub to alert on cancellation.
/// </summary>
/// <param name="ua">The ua.</param>
/// <param name="request">The request.</param>
/// <param name="sipStack">The sip stack.</param>
public abstract void Cancelled(UserAgent ua, Message request, SIPStack sipStack);
示例2: SendMessage
public void SendMessage(string uri, string message, string contentType = "text/plain")
{
uri = checkURI(uri);
UserAgent mua = new UserAgent(Stack) { LocalParty = PublicServiceIdentity, RemoteParty = new Address(uri) };
Useragents.Add(mua);
Message m = mua.CreateRequest("MESSAGE", message);
m.InsertHeader(new Header(contentType, "Content-Type"));
mua.SendRequest(m);
}
示例3: Authenticate
public override string[] Authenticate(UserAgent ua, Header header, SIPStack sipStack)
{
throw new NotImplementedException();
}
示例4: ReceivedResponse
public override void ReceivedResponse(UserAgent ua, Message response, SIPStack stack)
{
Log.Info("Received response with code " + response.ResponseCode + " " + response.ResponseText);
Log.Debug("\n\n" + response.ToString());
if (ResponseRecvEvent != null)
{
ResponseRecvEvent(this, new SipMessageEventArgs(response));
}
}
示例5: SendInvite
public void SendInvite(string uri)
{
uri = checkURI(uri);
UserAgent cua = new UserAgent(Stack) { LocalParty = PublicServiceIdentity, RemoteParty = new Address(uri) };
Useragents.Add(cua);
Message invite = cua.CreateRequest("INVITE");
cua.SendRequest(invite);
}
示例6: UpdateServiceMetrics
private static void UpdateServiceMetrics(Dictionary<string, float> metrics)
{
UserAgent pua = new UserAgent(_app.Stack)
{
RemoteParty = new Address("<sip:" + ServerURI + ">"),
LocalParty = _localParty
};
Message request = pua.CreateRequest("PUBLISH");
request.InsertHeader(new Header("service-description", "Event"));
request.InsertHeader(new Header("application/SERV_DESC+xml", "Content-Type"));
XmlDocument xmlDoc = new XmlDocument();
xmlDoc.Load("Resources/ServiceDescription.xml");
XmlNode node = xmlDoc.SelectSingleNode("Service/Metrics/TotalCPU");
node.InnerText = String.Format("{0:0.##}", metrics["totalCPU"]);
node = xmlDoc.SelectSingleNode("Service/Metrics/CPU");
node.InnerText = String.Format("{0:0.##}", metrics["cpu"]);
node = xmlDoc.SelectSingleNode("Service/Metrics/TotalMemory");
node.InnerText = String.Format("{0:0.##}", metrics["memAvailable"]) + " MB";
node = xmlDoc.SelectSingleNode("Service/Metrics/Memory");
node.InnerText = String.Format("{0:0.##}", ((metrics["memUsed"] / 1024) / 1024)) + " MB";
request.Body = xmlDoc.OuterXml;
pua.SendRequest(request);
}
示例7: DialogCreated
public override void DialogCreated(Dialog dialog, UserAgent ua, SIPStack stack)
{
Useragents.Remove(ua);
Useragents.Add(dialog);
Log.Info("New dialog created");
}
示例8: ReceivedRequest
/// <summary>
/// Passes a received request to the associated SIP application.
/// </summary>
/// <param name="ua">The ua.</param>
/// <param name="request">The request.</param>
public void ReceivedRequest(UserAgent ua, Message request)
{
App.ReceivedRequest(ua, request, this);
}
示例9: ReceivedResponse
/// <summary>
/// Passes a received response to the associated SIP application.
/// </summary>
/// <param name="ua">The ua.</param>
/// <param name="response">The response.</param>
public void ReceivedResponse(UserAgent ua, Message response)
{
App.ReceivedResponse(ua, response, this);
}
示例10: CreateTimer
/// <summary>
/// Creates a timer on the associated SIP application.
/// </summary>
/// <param name="obj">The obj.</param>
/// <returns>Timer.</returns>
public Timer CreateTimer(UserAgent obj)
{
return App.CreateTimer(obj, this);
}
示例11: DialogCreated
/// <summary>
/// Notifies the associated SIP application that a dialog has been created.
/// </summary>
/// <param name="dialog">The dialog.</param>
/// <param name="ua">The ua.</param>
public void DialogCreated(Dialog dialog, UserAgent ua)
{
App.DialogCreated(dialog, ua, this);
}
示例12: Cancelled
/// <summary>
/// Passes the notification of a cancellation to the associated SIP application.
/// </summary>
/// <param name="ua">The ua.</param>
/// <param name="request">The request.</param>
public void Cancelled(UserAgent ua, Message request)
{
App.Cancelled(ua, request, this);
}
示例13: Authenticate
/// <summary>
/// Authenticates through the associated SIP application.
/// </summary>
/// <param name="ua">The ua.</param>
/// <param name="header">The header.</param>
/// <returns>System.String[][].</returns>
public string[] Authenticate(UserAgent ua, Header header)
{
return App.Authenticate(ua, header, this);
}
示例14: CreateTimer
/// <summary>
/// Stub to create timers.
/// </summary>
/// <param name="obj">The obj.</param>
/// <param name="sipStack">The sip stack.</param>
/// <returns>Timer.</returns>
public abstract Timer CreateTimer(UserAgent obj, SIPStack sipStack);
示例15: SendIM
public void SendIM(string uri, string message,string contentType = "text/plain")
{
uri = checkURI(uri);
if (IsRegistered())
{
UserAgent mua = new UserAgent(Stack) {LocalParty = RegisterUA.LocalParty, RemoteParty = new Address(uri)};
Useragents.Add(mua);
Message m = mua.CreateRequest("MESSAGE", message);
m.InsertHeader(new Header(contentType, "Content-Type"));
mua.SendRequest(m);
}
}