Jump to content
Vodia PBX forum

yurylankovskiy

Members
  • Content Count

    1
  • Joined

  • Last visited

Community Reputation

0 Neutral

About yurylankovskiy

  • Rank
    Newbie
  1. I'm trying to implement a live ACD web UI, and I ran into an issue. The program is on asp.net core 2. I'm using the documentations found here, https://doc.vodia.com/third_party https://doc.vodia.com/websocket According to the documentations above, I must first obtain the session ID and then open up a websocket connection. I try to obtain a session ID using information from third party documentation, but always receive a response 'false'. How can I debug this, or what could be wrong? A portion of my code, var url = string.Format("http://ipaddress/rest/system/session"); var encoded_url = HttpUtility.UrlEncode(url); var uri = new Uri(url); var base64_hash = Convert.ToBase64String(Encoding.ASCII.GetBytes(string.Format("{0}:{1}", "user", "password"))); var client = new RestClient(uri); var host_address = "myhost"; var response = ""; HttpWebRequest request = (HttpWebRequest)WebRequest.Create(uri); request.Method = "post"; request.Host = host_address; request.Accept = "*/*"; request.ContentType = "application/json"; request.Headers.Add("Authorization", string.Format("Basic {0}", base64_hash)); request.Headers.Add("DNT", "1"); request.Headers.Add("Origin", string.Format("http://{0}", host_address)); using (var streamWriter = new StreamWriter(request.GetRequestStream())) { string json = "{\"name\":\"3rd\"," + "\"username\":\"user\"," + "\"domain\":\"domain\"}"; streamWriter.Write(json); streamWriter.Flush(); streamWriter.Close(); } using (HttpWebResponse resp = request.GetResponse() as HttpWebResponse) { var reader = new StreamReader(resp.GetResponseStream(), Encoding.UTF8); response = reader.ReadToEnd(); } So the idea is, I obtain the session ID on the backend and insert it into a cookie, and then fire up websocket connection via javascript to receive ACD updates. I can fetch other information like wallboard, domain users etc, so it doesn't look like a rights issue for my user.
×
×
  • Create New...