星号:来自'192.168.x.xxx'的连接尝试无法进行身份验证

时间:2015-08-18 09:00:26

标签: c# rest curl asterisk

尝试从我的.NET应用程序连接到Ubuntu虚拟盒上的Asterisk 13.4.0:AsterNET.ARI> Conference Sample使用以下配置:

ari.conf

[general]
enabled = yes
pretty = yes
[asterisk]
type = user
read_only = no
password = asterisk

的extensions.conf

[default]
exten = 1000,1,Noop()
same = n,Answer()
same = n,Stasis(simpleconf,test)
same = n,Hangup()

manager.conf

[general]
enabled = yes
webenabled = yes
port = 5038
bindaddr = 0.0.0.0

AsterNET.ARI.SimpleConfExample

public class AppConfig
    {
        public const string AppName =      "simpleconf";
        public const string RestAddress =  "http://localhost:8088/";
        public const string ServerIP =     "192.168.x.xx";
        public const int    Port =          5038;
        public const string UserName =     "asterisk";
        public const string UserPassword = "asterisk";
        public const string ConfName =     "test";
    }

private static void Main(string[] args)
    {
        try
        {
            // Create a message client to receive events on
            Client = new AriClient(new StasisEndpoint(AppConfig.ServerIP, AppConfig.Port, AppConfig.UserName, AppConfig.UserPassword), AppConfig.AppName);
            Conference.Conferences.Add(new Conference(Client, Guid.NewGuid(), AppConfig.ConferenceName));
            ....
        }

我从CLI终端获得以下内容:

Connect attempt from '192.168.x.xxx' unable to authenticate

我做错了什么?

1 个答案:

答案 0 :(得分:0)

Asterisk Manager界面(AMI)和Asterisk REST界面(ARI)是两种不同的动物。你的代码混合和匹配来自两者的各种东西,特别是连接的端口--5038是AMI端口,而不是ARI端口。将您的Port声明更改为:

public const int    Port =          8088;