Author Topic: Issuing commands from irule  (Read 5400 times)

0 Members and 1 Guest are viewing this topic.

JoshK

  • Jr. Member
  • **
  • Posts: 32
  • Karma: 3
    • View Profile
Issuing commands from irule
« on: March 27, 2014, 09:00:13 AM »
I'm trying to work out how to issue commands to vc from irule. I've read the wiki and searched the article but can't quite work it out..

from my understanding I should setup a network gateway in Irule with the IP address of my voxcommando machine and port 3300 and then simply have buttons to send the commands I want to voxcommando and these will execute.

however the network gateway in irule never seems to connect.

I'd love any advice on how to do this as I've just found voxcommando after building a whole house automation system based around Irule, and Global Cache Itache's and plan to move my entire irule system to run through vox commando combined with multiple conference call devices in each room.

I've managed to get Voxcommando working with all my gear and voice commands nicely, however I'm stuck at getting irule to issue commands to vc..

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7713
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Issuing commands from irule
« Reply #1 on: March 27, 2014, 09:13:41 AM »
You should create a UDP gateway and the port should be 33000, unless you have changed the listen port in VoxCommando settings.

I don't know if you only made a typo when posting but you are missing a 0

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7713
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Issuing commands from irule
« Reply #2 on: March 27, 2014, 10:38:38 AM »
Maybe this will help...

Please ignore the name of the gateway, which is misleading!

JoshK

  • Jr. Member
  • **
  • Posts: 32
  • Karma: 3
    • View Profile
Re: Issuing commands from irule
« Reply #3 on: March 29, 2014, 01:17:46 AM »
thanks for your help, I was setting the IP address of the gateway as the ip of my vc machine. Your screen shot solved my problem :)

JoshK

  • Jr. Member
  • **
  • Posts: 32
  • Karma: 3
    • View Profile
Re: Issuing commands from irule
« Reply #4 on: July 17, 2014, 03:59:39 AM »
I'm now having trouble setting this up to work from outside my network.

I can obviously setup a port forwarding rule on my router to forward external port 33000 to any address, and setup irule to connect to my external IP, but what IP address do I forward the port to?

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7713
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Issuing commands from irule
« Reply #5 on: July 17, 2014, 07:52:50 AM »
The ip address of the computer running VoxCommando.

Eg:   192.168.1.103

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7713
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Issuing commands from irule
« Reply #6 on: July 17, 2014, 07:57:00 AM »
I'm not 100% sure but I don't think you can use this method with UDP. You would probably need to switch to sending commands using HTTP or TCP.

JoshK

  • Jr. Member
  • **
  • Posts: 32
  • Karma: 3
    • View Profile
Re: Issuing commands from irule
« Reply #7 on: September 07, 2014, 11:56:16 AM »
so I got this all working however can't seem to get it working through my dynamic dns service... it only works when I actually specifiy my external ip address in irule for the gateway.
I'm guessing this must mean something about udp not working through my ddns service.


how should i configure irule http gateway and commands to issue http request to voxcommando?

I've tried creating at http gateway with address myadress.no-ip.net and port 26408 and configure commands in irule as "vc.tellvox&&turn%on%television" however this ins't working..

any suggestions?

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7713
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Issuing commands from irule
« Reply #8 on: September 07, 2014, 11:58:53 AM »
Yes.  I think I already mentioned that UDP probably won't work across a WAN interface.

Have you already read this?
http://voxcommando.com/mediawiki/index.php?title=API_Application_Programming_Interface#HTTP

Well I guess not, based on the syntax you are using.  Check it out and then let us know if you still have a specific issue.

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7713
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Issuing commands from irule
« Reply #9 on: September 07, 2014, 12:05:00 PM »
so I got this all working however can't seem to get it working through my dynamic dns service... it only works when I actually specifiy my external ip address in irule for the gateway.

Is it possible that iRule only works with an ip address and not a domain name?

JoshK

  • Jr. Member
  • **
  • Posts: 32
  • Karma: 3
    • View Profile
Re: Issuing commands from irule
« Reply #10 on: September 08, 2014, 09:04:12 PM »
I thought that may be the case. but I've got irule communicating directly with an itach through dns address.

I can't seem to get communication via http working even using my vox's internal network IP address..

http gateway in irule set to local vox ip address, port 26408, set to POST.
buttons in irule send "/api/tellvox&&blah"

am i doing something there?

I'm convinced once i've got irule send http requests to vox that this will work with the dynamic dns.

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7713
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Issuing commands from irule
« Reply #11 on: September 08, 2014, 09:08:02 PM »
Did you enable the tcp plugin and then enable the simple web server and set the port to 26408?

It should not be set to post, use get.

The first step would normally to get it working on the LAN and then try to get it working when away from home.

JoshK

  • Jr. Member
  • **
  • Posts: 32
  • Karma: 3
    • View Profile
Re: Issuing commands from irule
« Reply #12 on: September 09, 2014, 11:16:52 AM »
yep tcp plugin working, simple webserver enabled on port 26408.

am successfully sending http requests to vox by typing them into the address bar in a browser, just not from irule, whether it be on my local lan, or outside it.

commands in irule definitely just need to be formated as "/api/vc.tellvox&&blah" there isn't anythign else needed?

I can't work out why it wouldn't be working..

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7713
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Issuing commands from irule
« Reply #13 on: September 09, 2014, 11:22:17 AM »
One reason would be that you have set iRule to POST.

Does VC show anything in the history window when you try to send commands?

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7713
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Issuing commands from irule
« Reply #14 on: September 09, 2014, 01:31:35 PM »
You should not put the slash before api, because irule is already adding that.

You might also need to manually url encode things like spaces if iRule is not doing it for you.

I got it to work, but there seems to be some kind of problem with iRule sending the same message over and over again.  I think it is because it doesn't like the response it gets back, or it is not terminating the communication correctly.

I'm going to play around with the TCP plugin it a bit to see if I can make it better.  I might also try to make it handle POST as well as GET.