Skip to content

function_call: service_control_stop($name, $extras) not working #86

@e2m32

Description

@e2m32

Love this api. Thank you for your work. Been using it with HomeAssistant for a while and have a new use case I'd like to implement.

I am attempting to stop a vpn client. I have enabled function_call for my user and have uncommented the service_control_stop in the "pfsense_function_calls.txt" file on my pfsense box. When I execute the following python code I get a success response, but the client is still running:

stop_openvpn = json.dumps(
            FauxapiLib.function_call({
            'function': 'service_control_stop',
            'args': ['openvpn', 'array(vpnmode => client, id => 3)']
            }
           ))
print(stop_openvpn)

print statement:

{"callid": "63b6541d8ee0a", "action": "function_call", "message": "ok", "data": {"return": "openvpn has been stopped."}}

I tried this call from the pfsense UI for executing php and the client service is properly stopped:

include('service-utils.inc');service_control_stop(openvpn, array(vpnmode => client, id => 3));

Is there something else I need to do to make this work?

I tried adding "service-utils.inc" to the "pfsense_function_calls.txt" file, but that made no difference:

#
# Entries in this file without any function definition are available to be 
# included but none of the functions within them are available to be accessed 
# via FauxAPI function_call()
# 
globals.inc
util.inc
xmlparse.inc
notices.inc
config.lib.inc
system.inc
service-utils.inc

I am running version 1.4.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions