# Forwarding decimal value from provision function to some php script

**URL:** <https://forum.genieacs.com/t/forwarding-decimal-value-from-provision-function-to-some-php-script/7221>\
**Category:** Uncategorized\
**Created:** [November 4, 2025, 7:20pm UTC](https://forum.genieacs.com/t/forwarding-decimal-value-from-provision-function-to-some-php-script/7221 "2025-11-04T19:20:27Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![tarikt](https://avatars.discourse-cdn.com/v4/letter/t/4da419/32.png) [@tarikt](https://forum.genieacs.com/u/tarikt)\
**Post date:** [November 4, 2025, 7:20pm UTC](https://forum.genieacs.com/t/forwarding-decimal-value-from-provision-function-to-some-php-script/7221/1 "2025-11-04T19:20:27Z")

</div>

Hi,

I need to find a way to forward some decimal value from the provision script that is triggered by 8 DIAGNOSTICS COMPLETE event to the extension function and then to forward that same value to some external php script that has AJAX call and access to some web GUI (to put decimal value into the GUI).

Is this theoretically possible to do? If yes, how?

Best regards,

Tarik

---

<div class="post-metadata">

**Author:** ![mike99](https://avatars.discourse-cdn.com/v4/letter/m/8797f3/32.png) [@mike99](https://forum.genieacs.com/u/mike99)\
**Post date:** [November 5, 2025, 6:40pm UTC](https://forum.genieacs.com/t/forwarding-decimal-value-from-provision-function-to-some-php-script/7221/2 "2025-11-05T18:40:35Z")

</div>

You can use external script to send values. I use an external script to send values to a database but I’m pretty sure you could send it to an API.

It’s not my expertise but it seems like you want to do is some kind of API that will update the frontend when receiving new data on the API but I think you need something in between because I think frontend fetch information but don’t allow to push the information directly to the frontend. If I’m right, you could add a backend API that would receive the information and store it until the frontend fetch it.

Personnaly, I think the closer to what you describe would be to query back the API every X seconds until the diagnostic value change to “completed” and then get through the API the needed values for the diagnostic.

---

<div class="post-metadata">

**Author:** ![akcoder](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.genieacs.com/akcoder/32/11_2.png) [@akcoder](https://forum.genieacs.com/u/akcoder)\
**Post date:** [November 5, 2025, 6:49pm UTC](https://forum.genieacs.com/t/forwarding-decimal-value-from-provision-function-to-some-php-script/7221/3 "2025-11-05T18:49:22Z")

</div>

> [@tarikt](#):
>
> Is this theoretically possible to do? If yes, how?

Call an [extension script](https://docs.genieacs.com/en/latest/extensions.html) from your provision script.

---

<div class="post-metadata">

**Author:** ![tarikt](https://avatars.discourse-cdn.com/v4/letter/t/4da419/32.png) [@tarikt](https://forum.genieacs.com/u/tarikt)\
**Post date:** [November 6, 2025, 9:19am UTC](https://forum.genieacs.com/t/forwarding-decimal-value-from-provision-function-to-some-php-script/7221/4 "2025-11-06T09:19:28Z")

</div>

thank you mike99 for your answer and for suggesting the easier way to collect the value. I already imeplemented it but this option is a bit slower beacuse you need to query the value of the TR-143 parameter from time to time to check whether its status has changed ant in this way you generate unneccessary GPV TR-069 method calls. I would like to use the 8 DIAGNOSTICS COMPLETE event for this purpose and without any addtional GPVs methods

---

<div class="post-metadata">

**Author:** ![tarikt](https://avatars.discourse-cdn.com/v4/letter/t/4da419/32.png) [@tarikt](https://forum.genieacs.com/u/tarikt)\
**Post date:** [November 6, 2025, 9:31am UTC](https://forum.genieacs.com/t/forwarding-decimal-value-from-provision-function-to-some-php-script/7221/5 "2025-11-06T09:31:25Z")

</div>

I created this extension script:

```auto
const http = require(‘http’);

/**

Sends a decimal value and IMEI to a local PHP endpoint using a GET request

to save the result for the frontend client.

@param {number} decimalValue The decimal number to send.

@param {string} imei The IMEI associated with the diagnostic run.

@param {function} callback A function to execute upon completion: (error, data) => void.*/function sendDecimalToPHP(decimalValue, imei, callback){

const phpEndpoint = ‘/IMEI_SPV_RunDiagnostic4.php’;

const pathWithQuery = ${phpEndpoint}?imei=${encodeURIComponent(imei)}&value=${encodeURIComponent(decimalValue)};

const options = {hostname: ‘localhost’,port: 80,path: pathWithQuery,method: ‘GET’,};

const req = http.request(options, (res) => {let responseBody = ‘’;res.setEncoding(‘utf8’);

 res.on('data', (chunk) => {
     responseBody += chunk;
 });

 res.on('end', () => {
     if (res.statusCode >= 200 && res.statusCode < 300) {
         // Success: Value has been saved to the server file
         callback(null, responseBody);
     } else {
         // Error (e.g., PHP returned 400 or 500)
         callback(new Error(`PHP returned status ${res.statusCode}: ${responseBody}`));
     }
 });

});

// Handle system errors (e.g., connection refused)req.on(‘error’, (e) => {callback(e);});

req.end();}

exports.sendDecimalToPHP = sendDecimalToPHP;

```

and calls it from the provision script by:

ext(“decimal\_value\_forwarding”, “sendDecimalToPHP”, m, IMEI, “arg2”);

where “m” is the decimal value and “IMEI” is the IMEI but I got this error message in the log files:

faultCode=“ext.TypeError” faultMessage=“callback is not a function”

Can you please help me in resolving thise issue?

Best regards,

Tarik

---

<div class="post-metadata">

**Author:** ![akcoder](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.genieacs.com/akcoder/32/11_2.png) [@akcoder](https://forum.genieacs.com/u/akcoder)\
**Post date:** [November 6, 2025, 11:02am UTC](https://forum.genieacs.com/t/forwarding-decimal-value-from-provision-function-to-some-php-script/7221/6 "2025-11-06T11:02:12Z")

</div>

> [@tarikt](#):
>
> faultCode=“ext.TypeError” faultMessage=“callback is not a function”

Please review the [extension script documentation](https://docs.genieacs.com/en/latest/extensions.html) and follow it more closely.

---

<div class="post-metadata">

**Author:** ![tarikt](https://avatars.discourse-cdn.com/v4/letter/t/4da419/32.png) [@tarikt](https://forum.genieacs.com/u/tarikt)\
**Post date:** [November 7, 2025, 9:35am UTC](https://forum.genieacs.com/t/forwarding-decimal-value-from-provision-function-to-some-php-script/7221/7 "2025-11-07T09:35:07Z")

</div>

It seems to me that the error was that I used 3 arguments whan calling extension script. When I used only 2 of them (first of them is decimal value and the second one is callback function) I didn’t get the error. However I hardcoded the value of the IMEI in the extension script and that is not a viable solution. Is there some way to pass to values to the extension script. I tried with array that has 2 elements (decimal value and IMEI), but then I got this error: faultCode=“ext.Error” faultMessage="connect ECONNREFUSED 127.0.0.1:80

---

<div class="post-metadata">

**Author:** ![tarikt](https://avatars.discourse-cdn.com/v4/letter/t/4da419/32.png) [@tarikt](https://forum.genieacs.com/u/tarikt)\
**Post date:** [November 7, 2025, 9:36am UTC](https://forum.genieacs.com/t/forwarding-decimal-value-from-provision-function-to-some-php-script/7221/8 "2025-11-07T09:36:46Z")

</div>

sorry, I mistyped in the prevoius post: Is there some way to pass **two** values to the extension script?

---

<div class="post-metadata">

**Author:** ![westnet-paul](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.genieacs.com/westnet-paul/32/2239_2.png) [@westnet-paul](https://forum.genieacs.com/u/westnet-paul)\
**Post date:** [November 7, 2025, 12:04pm UTC](https://forum.genieacs.com/t/forwarding-decimal-value-from-provision-function-to-some-php-script/7221/9 "2025-11-07T12:04:55Z")

</div>

Pass an object?

```auto
function sendDecimalToPHP({ decimalValue, imei }, callback){
   ...
}

```

---

<div class="post-metadata">

**Author:** ![westnet-paul](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.genieacs.com/westnet-paul/32/2239_2.png) [@westnet-paul](https://forum.genieacs.com/u/westnet-paul)\
**Post date:** [November 7, 2025, 12:06pm UTC](https://forum.genieacs.com/t/forwarding-decimal-value-from-provision-function-to-some-php-script/7221/10 "2025-11-07T12:06:03Z")

</div>

Mind you, the ECONNREFUSED error suggests that your API isn’t responding.

---

<div class="post-metadata">

**Author:** ![akcoder](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.genieacs.com/akcoder/32/11_2.png) [@akcoder](https://forum.genieacs.com/u/akcoder)\
**Post date:** [November 7, 2025, 7:46pm UTC](https://forum.genieacs.com/t/forwarding-decimal-value-from-provision-function-to-some-php-script/7221/11 "2025-11-07T19:46:52Z")

</div>

```auto
let myData = ext('scriptFileName', 'methodName', JSON.stringify(myParams));

```

---

<div class="post-metadata">

**Author:** ![tarikt](https://avatars.discourse-cdn.com/v4/letter/t/4da419/32.png) [@tarikt](https://forum.genieacs.com/u/tarikt)\
**Post date:** [November 29, 2025, 8:03pm UTC](https://forum.genieacs.com/t/forwarding-decimal-value-from-provision-function-to-some-php-script/7221/12 "2025-11-29T20:03:29Z")

</div>

Thanks, my Genieacs runs inside the docker container and I am using binded mount for the extension functions so that they can communicate with the host on which apache web server runs so using localhost wasn’t an option. As soon as I changed to the actual IP address of the host this issue has been solved

---

<div class="post-metadata">

**Author:** ![tarikt](https://avatars.discourse-cdn.com/v4/letter/t/4da419/32.png) [@tarikt](https://forum.genieacs.com/u/tarikt)\
**Post date:** [November 29, 2025, 8:04pm UTC](https://forum.genieacs.com/t/forwarding-decimal-value-from-provision-function-to-some-php-script/7221/13 "2025-11-29T20:04:05Z")

</div>

actually array with 2 values is working properly
