Charmed Quark Systems, Ltd. - Support Forums and Community
New Amazon Echo Support - Printable Version

+- Charmed Quark Systems, Ltd. - Support Forums and Community (https://www.charmedquark.com/vb_forums)
+-- Forum: General Discussion (https://www.charmedquark.com/vb_forums/forumdisplay.php?fid=3)
+--- Forum: CQC Support (https://www.charmedquark.com/vb_forums/forumdisplay.php?fid=9)
+--- Thread: New Amazon Echo Support (/showthread.php?tid=9423)



New Amazon Echo Support - Sendero - 10-29-2015

In my setup, I have a single machine which terminates SSL connections from external sources. That machine then communicates with any of X internal machines which provide different webservice capabilities. I have routing setup by path so that mydomain.com/Foo/XXX goes to http://Server1/XXX and mydomain.com/Bar/XXX goes to http://server2/XXX.

For CQC, I changed the javascript to use the root path of "/cqcsrv/CQCEcho" instead of just "CQCEcho". When I am external to my network and make a request to https://mydomain.com/cqcsrv/CQCEcho, I do indeed get a response back of "<html><body>Done</body></html>". So it surely appears to be hitting CQC. But, when asking alexa to tell CQC to load its config I just get a reply that there was a problem with the requested skill's response.


New Amazon Echo Support - Dean Roddey - 10-29-2015

That's not an echo handler response, all of which are JSON, and that's HTML.

The URL, unfortunately, has to be just /CQCEcho, since that's how the Web Server knows it's an Echo type request. So you won't be able to use the path to disambiguate, it looks like.


New Amazon Echo Support - Sendero - 10-30-2015

Dean Roddey Wrote:That's not an echo handler response, all of which are JSON, and that's HTML.

The URL, unfortunately, has to be just /CQCEcho, since that's how the Web Server knows it's an Echo type request. So you won't be able to use the path to disambiguate, it looks like.

Hmm, when I am on the CQCServer and hit http://localhost/CQCEcho I get the same HTML "Done" response. I'm on 4.8.0.

On the 2nd part, the path requested from the CQCServer itself ends up just as /CQCEcho. Making a request to mydomain.com/cqc/CQCEcho/ will pass along the request to CQC as just http://<cqcservername>/CQCEcho (including all querystring and params, etc).


New Amazon Echo Support - Dean Roddey - 10-30-2015

There's nothing anywhere in the web server at all that would send such a response. If it's not a special URL, then it has to map to a real file of some sort to return. If it is a special one (Echo, WebSocket, Repo Image), then those would not return that sort of response.

You sure you don't have another web server or some other type of service on that machine that's got port 80? If I do that URL I get the expected JSON error back, i.e. it's sending back to the Echo (from the point of view of the echo itself) that the web server rejected the message):

Code:
{
"Reply" : "CQC rejected the message I sent as invalid. Please contact your CQC administrator."
}



New Amazon Echo Support - Sendero - 10-30-2015

Dean Roddey Wrote:There's nothing anywhere in the web server at all that would send such a response. If it's not a special URL, then it has to map to a real file of some sort to return. If it is a special one (Echo, WebSocket, Repo Image), then those would not return that sort of response.

You sure you don't have another web server or some other type of service on that machine that's got port 80? If I do that URL I get the expected JSON error back, i.e. it's sending back to the Echo (from the point of view of the echo itself) that the web server rejected the message):

Code:
{
"Reply" : "CQC rejected the message I sent as invalid. Please contact your CQC administrator."
}


I double checked and made sure that there is no IIS or anything else there. I also have CQC setup so that it's webserver is not on port 80. So, my request from IE is to http://cqcserver:12345/CQCEcho. I know the port is right because I have taught CQC some URL triggers and they work with that port.

Is it possible my learned HTTP triggers are still catching this URL even though its a different pattern/path? the learned URLs are more like http://cqcserver:12345/Lighting/Action=On&Light=Office


New Amazon Echo Support - Dean Roddey - 10-30-2015

It actually checks for the special ones first, so even if you had a file called CQCEcho.html in the HTMLRoot directory, you still wouldn't be able to get to it, because the /Echo and other special ones are checked first.

The HTTP trigger driver will be listening of course, so it needs to be on a different port from anything else. If both the WS and the trigger driver were on the same port, this could happen, but only one could win so one wouldn't be working.


New Amazon Echo Support - Sendero - 10-30-2015

Dean Roddey Wrote:It actually checks for the special ones first, so even if you had a file called CQCEcho.html in the HTMLRoot directory, you still wouldn't be able to get to it, because the /Echo and other special ones are checked first.

The HTTP trigger driver will be listening of course, so it needs to be on a different port from anything else. If both the WS and the trigger driver were on the same port, this could happen, but only one could win so one wouldn't be working.

OK, thats it. I changed my webserver port and can now get expected response locally. Time to see about interaction with Echo...


New Amazon Echo Support - Sendero - 10-30-2015

OK, now I'm having another issue, again related to SSL. I decided to skip trying to use my reverse proxy as a way to maybe simplify things. So, I created a subdomain for my home - jarvis.mydomain.com. I created an ssl cert for that domain and installed it for CQC. I tested that within my network I can hit https://jarvis.mydomain.com/CQCEcho and get back an error in json format, as expected. I have my port forwarding setup so that 444 externally gets routed to 443 on my cqc server. However, when I set my alexa skill as:

Code:
var CQC_TarAddr = "jarvis.mydomain.com";
var CQC_TarPort = "444";
var CQC_HTTPType = "https";

I get errors. I have another port mapping for 445 mapping to my cqc web server non-secure port. When I change the javascript to
Code:
var CQC_TarAddr = "jarvis.mydomain.com";
var CQC_TarPort = "445";
var CQC_HTTPType = "http";
it loads correctly.

Any ideas why the https approach isn't working?


New Amazon Echo Support - Sendero - 10-30-2015

I just noticed that the CQC_HTTPType variable is defined in the javascript but I don't see it used anywhere????

OK, that was the bug. I had to change line 394 to now read:
Code:
var http = require(CQC_HTTPType);



New Amazon Echo Support - Dean Roddey - 10-30-2015

The most recent Javascript should be using that. Does it work correctly once you made that change?