Java API in Rules ERROR

9 views
Skip to first unread message

orc trial

unread,
Nov 17, 2019, 3:31:31 PM11/17/19
to openremot...@googlegroups.com
Hi 

i am Trying to use Twilio Java API in rules. This API works fine through Netbeans but i am not sure how to include this in openremote rules. i tried it as follows in a separate rules file. The file gets included with no errors when controller starts; however when the rule gets triggered, i am getting errors (attached). Any help would be greatly appreciated. 

I have included the Twilio library in the openremote libraries folder that has all the .jar files

This API allows making automated phone calls and playing recorded messages. 

I am using controller 2.6 beta 3 on Raspberry pi java version 
java version "1.8.0_65"
________________________________________________________________________________________________________________________
package org.openremote.controller.protocol
global org.openremote.controller.statuscache.CommandFacade execute;
global org.openremote.controller.statuscache.SwitchFacade switches;

import org.openremote.controller.protocol.Event;

import java.net.URI;
import java.net.URISyntaxException;
import com.twilio.Twilio;
import com.twilio.rest.api.v2010.account.Call;
import com.twilio.type.PhoneNumber;


//********Phone call Breach detected*************************************************

rule "Call breach detected on"
when 
Event( source == "breachdetected", value == "on" )
then
 
 
//package trial.phone.twilio.nb8;

/**
 *
 * @author s
 */
final String ACCOUNT_SID = "AC18a6479ce27720a20b7";
final String AUTH_TOKEN = "8b987f8ca";

        Twilio.init(ACCOUNT_SID, AUTH_TOKEN);

        String from = "+14698849800";
        String to = "+15857499940";

        Call call = Call.creator(new PhoneNumber(to), new PhoneNumber(from),
                //new URI("http://demo.twilio.com/docs/voice.xml")).create();
                new URI("http://fha.hopto.org:8688/Wifi_portal/phonecall.xml")).create();

        System.out.println(call.getSid());
       
end

__________________________________________________________________________________________________________________________






Openremote Twilio error.docx
Reply all
Reply to author
Forward
0 new messages