本文整理汇总了C#中Command.BuildCommand方法的典型用法代码示例。如果您正苦于以下问题:C# Command.BuildCommand方法的具体用法?C# Command.BuildCommand怎么用?C# Command.BuildCommand使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Command
的用法示例。
在下文中一共展示了Command.BuildCommand方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SendCommand
public AGIReply SendCommand(Command.AGICommand command)
{
agiWriter.SendCommand(command);
agiReply = agiReader.ReadReply();
int status = agiReply.GetStatus();
if (status == (int)AGIReplyStatuses.SC_INVALID_OR_UNKNOWN_COMMAND)
throw new InvalidOrUnknownCommandException(command.BuildCommand());
else if (status == (int)AGIReplyStatuses.SC_INVALID_COMMAND_SYNTAX)
throw new InvalidCommandSyntaxException(agiReply.GetSynopsis(), agiReply.GetUsage());
return agiReply;
}
示例2: SendCommand
public void SendCommand(Command.AGICommand command)
{
string buffer = command.BuildCommand() + "\n";
try
{
socket.Write(buffer);
}
catch (IOException e)
{
throw new AGINetworkException("Unable to send command to Asterisk: " + e.Message, e);
}
}
示例3: SendCommand
public AGIReply SendCommand(Command.AGICommand command)
{
agiWriter.SendCommand(command);
agiReply = agiReader.ReadReply();
int status = agiReply.GetStatus();
if (status == (int)AGIReplyStatuses.SC_INVALID_OR_UNKNOWN_COMMAND)
throw new InvalidOrUnknownCommandException(command.BuildCommand());
else if (status == (int)AGIReplyStatuses.SC_INVALID_COMMAND_SYNTAX)
throw new InvalidCommandSyntaxException(agiReply.GetSynopsis(), agiReply.GetUsage());
else if (status == (int)AGIReplyStatuses.SC_DEAD_CHANNEL && _SC511_CAUSES_EXCEPTION)
throw new AGIHangupException();
else if ((status == 0) && agiReply.FirstLine == "HANGUP" && _SCHANGUP_CAUSES_EXCEPTION)
throw new AGIHangupException();
return agiReply;
}