Jump to content

Send Rest command from Asterisk PBX to ISY, possible?


ferdies

Recommended Posts

Posted

Hi,

 

I have this idea but I don’t know where to start. From Asterisk PBX, is there a way to send a Rest command to change an ISY variable content?

 

What I am thinking is that by using an IVR, one can press an option and specific variable in ISY will be changed thus triggering a program to execute.

 

Is this a good starting point?

https://wiki.asterisk.org/wiki/display/AST/Asterisk+12+Applications+REST+API

 

 

Thoughts? Thanks.

Posted

I do this with an earlier version of Asterisk, by incorporating calling curl into my dialplan IVR menus. Works well. I think the URL you mention is the other way around, having Asterisk provide a REST api for things like call placement, queue management etc.

Posted

Hi,

 

Maybe the URL is not the right one.

 

Do you still have the curl program that you've have incorporated into your dial plan you may be able to share?

 

I am planning to have a "secret" option within the IVR. However, since I know the option, after keying in the option, sub-IVR can give options like 1- turning garage on ; 2- Kitchen lights, 3-etc....

 

Thanks.

Posted

Based on the suggestion of MWareman, I tried using "curl" Asterisk:

 

exten => 11688,n,curl(https://login:password@test.dyndns.biz:1234/rest/vars/set/2/88/1)

 

 

Example (POST-Method):
exten => _X.,2,curl(http://www.somehost.com/may_be_a_dir/file_to_call.php,postdata_var1=1&postdata_var2=something)
exten => _X.,3,Wait(5)
exten => _X.,4,NoOp(CURL-RESPONSE: ${CURL})

 

However, just trying ISY rest on a browser did not work.

https://login:password@test.dyndns.biz:1234/rest/vars/set/2/88/1

 

I could not remember where I read about authentication. Need some assistance please. BTW, I am running the rest command from a remote site.

 

 

Thanks.

Posted

You may be running into a couple of things.

 

First - SSL trust. Is it a trusted cert. If not - you'll need -k to ignore that - but it's not *that* secure to do that.

Second - with curl you don't put the username and password on the URL. You specify the -u parameter.

 

Try it from the shell on your Asterisk system first:

 

curl -k -s -u user:pass https://test.dyndns.biz:1234/rest/vars/set/2/88/1

 

If this works, I included it in my dialplan like this:

 

exten => s,n,system(curl -k -s -u user:pass https://test.dyndns.biz:1234/rest/vars/set/2/88/1)

 

I'm not using the curl Asterisk command. Not sure why (it way a while ago!)

 

Michael.

Posted

This is awesome! Thank you very much.

 

Turning ON and and OFF lights now through my phone system. There's so much to explore now! :D:D:D

  • 1 month later...
Posted (edited)

Hi,

 

I started playing around recently a bit with the PBX in a Flash version of Asterisk. The non-GUI version of Asterisk is above my pay-grade. Is there any way to implement the above mentioned way of sending REST commands in the PBX in a Flash system? Thanks in advance.

Edited by hbsh01
Posted

I've only ever compiled my own Asterisk, and worked from the CLI, so I'm afraid I don't know what capabilities 'PBX In a Flash' has. Sorry.

Posted

Thanks anyway.

 

The PBX in a Flash is a graphical UI for Asterisk. But It is still possible to manually edit the 'extensions.conf' file. If my understanding is correct, that's where the above cURL command needs to be written. I will try to see if I can figure something out.

 

Sent from my SPH-D710 using Tapatalk

Guest
This topic is now closed to further replies.

  • Recently Browsing

    • No registered users viewing this page.
  • Who's Online (See full list)

  • Forum Statistics

    • Total Topics
      37k
    • Total Posts
      371.5k
×
×
  • Create New...