I am trying to create an ARI based app using .net Core 2.1and asterisk 15 on an ubuntu 18.04 box.
I am connecting using the loopback interface with the following code:
Console.WriteLine("Creating connection:");
StasisEndpoint ARIStasisEP = new StasisEndpoint("127.0.0.1", 8088, "CareHawk", "chNTM");
Console.WriteLine(ARIStasisEP.AriEndPoint);
ActionClient = new AriClient(ARIStasisEP, "CareHawkNTM");
// Hook into required events
ActionClient.OnStasisStartEvent += NewPhoneConnected;
ActionClient.OnStasisEndEvent += PhoneHangup;
ActionClient.OnChannelDtmfReceivedEvent += DTMFReceived;
ActionClient.OnConnectionStateChanged += StateChanged;
Console.WriteLine("Succesfully created ARI.");
ActionClient.Connect();
Console.WriteLine("Connect to ARI attempt started.");
Occasionally I get the StateChanged function showing the state has changed to true and everything works fine.
But many more times I get no response after the ActionClient.Connect() and nothing shows in the asterisk about my ari app being connected.
the asterisk http.conf is:
;
; Asterisk Builtin mini-HTTP server
;
;
; Note about Asterisk documentation:
; If Asterisk was installed from a tarball, then the HTML documentation should
; be installed in the static-http/docs directory which is
; (/var/lib/asterisk/static-http/docs) on linux by default. If the Asterisk
; HTTP server is enabled in this file by setting the "enabled", "bindaddr",
; and "bindport" options, then you should be able to view the documentation
; remotely by browsing to:
; http://<server_ip>:/static/docs/index.html
;
[general]
;
; The name of the server, advertised in both the Server field in HTTP
; response message headers, as well as the
element in certain HTTP
; response message bodies. If not furnished here, "Asterisk/{version}" will be
; used as a default value for the Server header field and the
; element. Setting this property to a blank value will result in the omission
; of the Server header field from HTTP response message headers and the
; element from HTTP response message bodies.
;
servername=Asterisk
;
; Whether HTTP/HTTPS interface is enabled or not. Default is no.
; This also affects manager/rawman/mxml access (see manager.conf)
;
enabled=yes
;
; Address to bind to, both for HTTP and HTTPS. You MUST specify
; a bindaddr in order for the HTTP server to run. There is no
; default value.
;
bindaddr=0.0.0.0
;
; Port to bind to for HTTP sessions (default is 8088)
;
bindport=8088
;
;... (the rest is all comments
the asterisk ari file is:
[general]
enabled = yes ; When set to no, ARI support is disabled.
pretty = yes ; When set to yes, responses from ARI are
; ; formatted to be human readable.
allowed_origins = ws://127.0.0.1:8088
; ; Cross-Origin Resource Sharing. May be set to * to
; ; allow all origins.
;auth_realm = ; Realm to use for authentication. Defaults to Asterisk
; ; REST Interface.
;
; Default write timeout to set on websockets. This value may need to be adjusted
; for connections where Asterisk must write a substantial amount of data and the
; receiving clients are slow to process the received information. Value is in
; milliseconds; default is 100 ms.
;websocket_write_timeout = 100
;
; Display certain channel variables every time a channel-oriented
; event is emitted:
;
;channelvars = var1,var2,var3
;[username]
;type = user ; Specifies user configuration
;read_only = no ; When set to yes, user is only authorized for
; ; read-only requests.
;
;password = ; Crypted or plaintext password (see password_format).
;
; password_format may be set to plain (the default) or crypt. When set to crypt,
; crypt(3) is used to validate the password. A crypted password can be generated
; using mkpasswd -m sha-512.
;
; When set to plain, the password is in plaintext.
;
;password_format = plain
[CareHawk]
type = user
read_only = no
password = $6$7rbx86y2/xNrG4$evTgZNjGLzurw4cNsl99iHCOV3904otuEKQErbQMvTQBK6LxJn7P/AnAiKcNAJEy6/7xdlRuS/mm/rTSvFTHz1
password_format = crypt
I have other ARI apps written in node.js that work fine with same versions of Linux(Ubuntu) and Asterisk.
Any idea what I might be doing wrong?