ASterisk agi get variable Node js


#1

Hi, I hope someone can help me, I’m working with an asterisk on a project, I use AGI to work with node js. Through one of its functions, I managed to send a variable from extencions.conf to my script in nodejs if there are no messages I printed a 0 and if there is a message my print a 1 up there, I get a 1, but I do not know how to get the variable information information sent. Thank you.

extensions.conf

exten => 4000,1,Answer()
exten => 4000,n,Wait(0.5)
exten => 4000,n,Set(ident=300) 
exten => 4000,n,AGI(agi://localhost:4000,"${ident}")
exten => 4000,n,Wait(0.5)

node js estiy usando DING-DONG ide deberia ser el valor pero me imprime 1

var AGIServer = require('ding-dong');
var request = require('request');
var numero=0;
const
    io = require("socket.io-client"),
    ioClient = io.connect("http://192.168.0.10:3000");
    a=0;  

var app={
    foo:null
} ;     
var fs = require('fs');
var handler = function (context) {
    context.onEvent('variables')
        .then(function (v) {
            f=context.getVariable('ident');
          
            return f
        })

        .then(function (varx) {
            ide=varx.result
            console.log("this is the variable"+ide)
            return context.getData('codigonum',15000,9);
        })

#2

I would like to help but for me these seems to be more a node.js programming issue than Asterisk related