Author Topic: Nodejs library compatible to javascript.yate  (Read 17487 times)

Anton

  • Newbie
  • *
  • Posts: 25
    • View Profile
Nodejs library compatible to javascript.yate
« on: January 26, 2020, 11:09:16 AM »
Maybe someone will be useful
https://github.com/0LEG0/next-yate
Best regards,
Anton

Anton

  • Newbie
  • *
  • Posts: 25
    • View Profile
Re: Nodejs library compatible to javascript.yate
« Reply #1 on: February 11, 2020, 10:56:59 AM »
Library are published as npm module now.
to install run:
Code: [Select]
npm install next-yate
Best regards,
Anton

P.S.
Any suggestions and criticism are welcome

cc08

  • Newbie
  • *
  • Posts: 27
    • View Profile
Re: Nodejs library compatible to javascript.yate
« Reply #2 on: February 11, 2020, 01:37:31 PM »
Anton, can you suggest more complex use cases that reveal the benefits of this module.
Waht differens from others ?

Anton

  • Newbie
  • *
  • Posts: 25
    • View Profile
Re: Nodejs library compatible to javascript.yate
« Reply #3 on: February 12, 2020, 01:32:03 AM »
Hello.

This library does not have obvious advantages over libraries in python, php or perl.
All advantages only over the javascript.yate module.
At the moment, I see the following problems with the javascript.yate module:
1. Low performance: slow arrays and operations with them, it is almost impossible to work with> 200 simultaneous calls.
2. Poor language constructs: it is impossible to call the function returned by the expression in without intermediate storage of the result in variable; lack of syntactic sugar.
3. There is no way to go beyond the yate sandbox.
All of these shortcomings motivated me to take up the development of a full-fledged javascript library, while the idea to preserve the original javascript.yate API seemed interesting to me.
Inside my library, all entities are connected by events and promises. Perhaps as one of the advantages over libraries in php and perl there will be no need to develop your own event reading / processing loop. This simplifies the code a bit.
Otherwise, as I said, there are no advantages over other external libraries.

Best regards,
Anton

Anton

  • Newbie
  • *
  • Posts: 25
    • View Profile
Re: Nodejs library compatible to javascript.yate
« Reply #4 on: February 16, 2020, 03:42:42 AM »
Dear Community.

"Channel" support was added.
Here is example of adapted welcome.js script:
https://github.com/0LEG0/next-yate/blob/master/examples/welcome.js

Best regards,
Anton

Anton

  • Newbie
  • *
  • Posts: 25
    • View Profile
Re: Nodejs library compatible to javascript.yate
« Reply #5 on: February 26, 2020, 10:35:42 AM »
Hello Community.

I decided to split the project into two:
The first will be core (stable) https://github.com/0LEG0/next-yate
and the second compatible with javascript.yate (experimental) https://github.com/0LEG0/next-yate-compat
In the next "Next-Yate" update, the compatibility abstraction will be removed. If someone needs javasctipt.yate compatibility please go to "Next-Yate-Compat" https://github.com/0LEG0/next-yate-compat.

Best regards,
Anton
« Last Edit: February 26, 2020, 10:58:02 AM by Anton »

Anton

  • Newbie
  • *
  • Posts: 25
    • View Profile
Re: Nodejs library compatible to javascript.yate
« Reply #6 on: April 14, 2020, 12:16:00 PM »
Here is next release:
- Message filter are moved to the application side.
- Method Yate.watch provided with filter like Yate.install.
- The Channel object is now available in global script mode too (+YateChannel class).
- And bug fixes of course...
https://github.com/0LEG0/next-yate

Best regards,
Anton

cc08

  • Newbie
  • *
  • Posts: 27
    • View Profile
Re: Nodejs library compatible to javascript.yate
« Reply #7 on: April 16, 2020, 08:17:50 AM »
I try to play with your module, but this string from  example_core_api.js :

Code: [Select]
yate.init(() => console.log("Connected"));
causes an error in yate console :

Code: [Select]
<ExtModReceiver:WARN> Error: 'Connected'
this is normal ?

Anton

  • Newbie
  • *
  • Posts: 25
    • View Profile
Re: Nodejs library compatible to javascript.yate
« Reply #8 on: April 16, 2020, 09:00:51 AM »
I try to play with your module, but this string from  example_core_api.js :

Code: [Select]
yate.init(() => console.log("Connected"));
causes an error in yate console :

Code: [Select]
<ExtModReceiver:WARN> Error: 'Connected'
this is normal ?

Something seems to be wrong.
Are you using the latest version from Git?
Outdated examples with own bugs have been removed. :) So, please, show the beginning of this code, if it’s not difficult for you.

Best regards.
Anton

cc08

  • Newbie
  • *
  • Posts: 27
    • View Profile
Re: Nodejs library compatible to javascript.yate
« Reply #9 on: April 16, 2020, 09:16:59 AM »
Yes, today was a free day, I decided to try it.
Today's git too.
I took an example from the first page of your git, slightly modifying it.

Code: [Select]
// Core API
const { Yate, YateMessage } = require("next-yate");
let yate = new Yate({ host: "127.0.0.1", port:6030 });

yate.init(() => {console.log("Connected")}); // Initialize connection before use
yate.output("Hello World!");


A little cleared up, this error appears when the script is launched by the extmodule from yate.

If the launch is manual, then everything is clean in yate.

Second question :)
When playing several wav files between them I listen to clicks.
How can you deal with this?

« Last Edit: April 16, 2020, 09:26:22 AM by cc08 »

Anton

  • Newbie
  • *
  • Posts: 25
    • View Profile
Re: Nodejs library compatible to javascript.yate
« Reply #10 on: April 16, 2020, 10:33:59 AM »
I suppose you messed up something with running a script with extmodule.
If the script would be launched by extmodule there is no need to use a network connection.
For example:

extmodule.conf configuration
[scripts]
node.sh=local_connected.js

And local_connected.js could contains something like this:
let yate = new Yate();

Of course, If you really want network connected script and launched by yate you can do it in "execute" section:
extmodule.conf configuration
[listener sample]
type=tcp
addr=127.0.0.1
port=6030
role=global

[execute]
node.sh=network_connected.js

And network_connected.js:
let yate = new Yate({ host: "127.0.0.1", port:6030 });

Second answer :)
I've experimented with WAV files and listened artifacts per voice file too. I don’t understand why such a popular format is still ignored by Yate Team. I would recommend to you converting WAV files to a more suitable format. Here is brief guide http://docs.yate.ro/wiki/ConvertingAudio

Best regards,
Anton

cc08

  • Newbie
  • *
  • Posts: 27
    • View Profile
Re: Nodejs library compatible to javascript.yate
« Reply #11 on: April 19, 2020, 04:59:19 PM »
Indeed, the conversion to the slin solved the click problems.
Thanks a lot.