Code Monkey home page Code Monkey logo

ts-agi's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

ts-agi's Issues

getFullVariable example needs tweaking

Thank you SO much for this excellent package!

But the demo wasn't working as I expected, and when turning on agi debug, I could see the problem...

This works as expected

<Local/1000@default-00000020;2>AGI Rx << SET VARIABLE myVar "Hello World!!!"
<Local/1000@default-00000020;2>AGI Tx >> 200 result=1
<Local/1000@default-00000020;2>AGI Rx << GET VARIABLE myVar
<Local/1000@default-00000020;2>AGI Tx >> 200 result=1 (Hello World!!!)

But GET FULL VARIABLE just returns the NAME of the variable

<Local/1000@default-0000001f;2>AGI Rx << SET VARIABLE myVar "Hello World!!!"
<Local/1000@default-0000001f;2>AGI Tx >> 200 result=1
<Local/1000@default-0000001f;2>AGI Rx << GET FULL VARIABLE myVar
<Local/1000@default-0000001f;2>AGI Tx >> 200 result=1 (myVar)

The documentation looked right:

https://wiki.asterisk.org/wiki/display/AST/Asterisk+17+AGICommand_get+full+variable
GET FULL VARIABLE VARIABLENAME CHANNEL NAME
Example return code: 200 result=1 (testvariable)

https://wiki.asterisk.org/wiki/display/AST/Asterisk+17+AGICommand_get+variable
GET VARIABLE VARIABLENAME
Example return code: 200 result=1 (testvariable)

So I asked on the forum, and it turns out that when using GET FULL VARIABLE, you need to send it as ${myVar}, so your example needs to change from

const { value: myVariable } = await ctx.getFullVariable('myVar');
to
const { value: myVariable } = await ctx.getFullVariable('${myVar}');
otherwise, it just sends back "myVar"!

Hope that helps someone, and thanks again!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.