Update extension advanced setting from external app (laravel)

Hi, I’m looking for a way to update extension advanced setting from my laravel app. Currently, I have some endpoints in my laravel app that uses freepbx graphql to create and update extension but it does not support updating the advanced setting of the extension. Is there a way to achieve this?

You can submit a patch to make the graphql do what you are trying to do. There could be another way. What specifically are you trying to update?

Hi James, thanks for your quick reply. My use case is, upon new extension creation, I want to also update these fields from advanced setting tab:

devinfo_avpf: yes
devinfo_icesupport: yes
devinfo_rtcp_mux: yes
devinfo_media_use_received_transport: yes
devinfo_media_encryption: dtls
devinfo_outbound_auth: yes
dtls_enable: yes
dtls_auto_generate_cert: 1

Hi @jfinstrom, other than submitting a patch for the graphql, is there any other workaround possible for this? I’m looking for a quick way that can possible help to achieve what I’m trying to do.

The quick and dirty way is to make a module and hook in to core. Then when a module is being created you simply manipulate the device data when the module is created. You could also write a script that does this via a cli app or something similar.

I see where you’re going into. I’ve been considering these two approaches (custom module or script) as well but I was hoping to find a more straightforward way to get it done. I think it should be no problem on my side to go with either one of these approach. I’m interested with creating custom module but my guess is, it may require more effort than just creating a script?

As a side note, I’ve been juggling around with one of your repo for creating helloworld module recently but I’m kind of stuck somewhere in between where I can’t find any proper documentation/reference on how to manage the extension, how to build it (if there’s a build step required) and how to actually use it in freepbx.

p.s: I can’t put link in the post for some reason since my account was marked as new account. The repo I’m referring to is from your github with path: /jfinstrom/helloworld

It would be nice if the custom module can have some sort of listener that triggers/emits something whenever new extension is created. In this case, I can update the advanced settings of the extension upon new extension creation.

Really appreciate it if you can provide some hints on which direction should I go.

You can use the method

	public static function myConfigPageInits() {
		return array("extensions", "users");
	}

and then

public function doConfigPageInit($page) {
    // Other code you may have

    // Check if the page is "extensions" or "devices"
    if ($page == "extensions" || $page == "devices") {
        // Check if the request is a POST request and if the action is 'add'
        if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['action']) && $_POST['action'] === 'add') {
            // Do stuff with the POST data, call webhook, etc.
            $this->handleAddAction($_POST);
        }
    }

    // Other code you may have
}