@jambonz/speech-utils 0.0.31 → 0.0.32

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -14,6 +14,9 @@ jobs:
14
14
  node-version: lts/*
15
15
  - run: npm install
16
16
  - run: npm run jslint
17
+ - run: sudo apt update && sudo apt install -y squid
18
+ - run: sudo cp test/squid.conf /etc/squid/squid.conf
19
+ - run: sudo systemctl start squid
17
20
  - run: npm test
18
21
  env:
19
22
  AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
@@ -29,3 +32,5 @@ jobs:
29
32
  ELEVENLABS_API_KEY: ${{ secrets.ELEVENLABS_API_KEY }}
30
33
  ELEVENLABS_VOICE_ID: ${{ secrets.ELEVENLABS_VOICE_ID }}
31
34
  ELEVENLABS_MODEL_ID: ${{ secrets.ELEVENLABS_MODEL_ID }}
35
+ JAMBONES_HTTP_PROXY_IP: 127.0.0.1
36
+ JAMBONES_HTTP_PROXY_PORT: 3128
package/README.md CHANGED
@@ -1,3 +1,3 @@
1
- # speech-utils
1
+ # speech-utils ![CI](https://github.com/jambonz/speech-utils/workflows/CI/badge.svg)
2
2
  TTS-related speech utilities for jambonz.
3
3
 
@@ -400,6 +400,12 @@ const synthMicrosoft = async(logger, {
400
400
  speechConfig.speechSynthesisOutputFormat = trimSilence ?
401
401
  SpeechSynthesisOutputFormat.Raw8Khz16BitMonoPcm :
402
402
  SpeechSynthesisOutputFormat.Audio16Khz32KBitRateMonoMp3;
403
+
404
+ if (process.env.JAMBONES_HTTP_PROXY_IP && process.env.JAMBONES_HTTP_PROXY_PORT) {
405
+ logger.debug(
406
+ `synthMicrosoft: using proxy ${process.env.JAMBONES_HTTP_PROXY_IP}:${process.env.JAMBONES_HTTP_PROXY_PORT}`);
407
+ speechConfig.setProxy(process.env.JAMBONES_HTTP_PROXY_IP, process.env.JAMBONES_HTTP_PROXY_PORT);
408
+ }
403
409
  const synthesizer = new SpeechSynthesizer(speechConfig);
404
410
 
405
411
  if (content.startsWith('<speak>')) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jambonz/speech-utils",
3
- "version": "0.0.31",
3
+ "version": "0.0.32",
4
4
  "description": "TTS-related speech utilities for jambonz",
5
5
  "main": "index.js",
6
6
  "author": "Dave Horton",
@@ -0,0 +1,85 @@
1
+ #
2
+ # Recommended minimum configuration:
3
+ #
4
+
5
+ # Example rule allowing access from your local networks.
6
+ # Adapt to list your (internal) IP networks from where browsing
7
+ # should be allowed
8
+ acl localnet src 0.0.0.1-0.255.255.255 # RFC 1122 "this" network (LAN)
9
+ acl localnet src 10.0.0.0/8 # RFC 1918 local private network (LAN)
10
+ acl localnet src 100.64.0.0/10 # RFC 6598 shared address space (CGN)
11
+ acl localnet src 169.254.0.0/16 # RFC 3927 link-local (directly plugged) machines
12
+ acl localnet src 172.16.0.0/12 # RFC 1918 local private network (LAN)
13
+ acl localnet src 192.168.0.0/16 # RFC 1918 local private network (LAN)
14
+ acl localnet src fc00::/7 # RFC 4193 local private network range
15
+ acl localnet src fe80::/10 # RFC 4291 link-local (directly plugged) machines
16
+
17
+ acl SSL_ports port 443
18
+ acl Safe_ports port 80 # http
19
+ acl Safe_ports port 21 # ftp
20
+ acl Safe_ports port 443 # https
21
+ acl Safe_ports port 70 # gopher
22
+ acl Safe_ports port 210 # wais
23
+ acl Safe_ports port 1025-65535 # unregistered ports
24
+ acl Safe_ports port 280 # http-mgmt
25
+ acl Safe_ports port 488 # gss-http
26
+ acl Safe_ports port 591 # filemaker
27
+ acl Safe_ports port 777 # multiling http
28
+
29
+ #
30
+ # Recommended minimum Access Permission configuration:
31
+ #
32
+ # Deny requests to certain unsafe ports
33
+ http_access deny !Safe_ports
34
+
35
+ # Deny CONNECT to other than secure SSL ports
36
+ http_access allow CONNECT !SSL_ports
37
+
38
+ # Only allow cachemgr access from localhost
39
+ http_access allow localhost manager
40
+ http_access deny manager
41
+
42
+ # This default configuration only allows localhost requests because a more
43
+ # permissive Squid installation could introduce new attack vectors into the
44
+ # network by proxying external TCP connections to unprotected services.
45
+ http_access allow localhost
46
+
47
+ # The two deny rules below are unnecessary in this default configuration
48
+ # because they are followed by a "deny all" rule. However, they may become
49
+ # critically important when you start allowing external requests below them.
50
+
51
+ # Protect web applications running on the same server as Squid. They often
52
+ # assume that only local users can access them at "localhost" ports.
53
+ http_access deny to_localhost
54
+
55
+ # Protect cloud servers that provide local users with sensitive info about
56
+ # their server via certain well-known link-local (a.k.a. APIPA) addresses.
57
+ http_access deny to_linklocal
58
+
59
+ #
60
+ # INSERT YOUR OWN RULE(S) HERE TO ALLOW ACCESS FROM YOUR CLIENTS
61
+ #
62
+
63
+ # For example, to allow access from your local networks, you may uncomment the
64
+ # following rule (and/or add rules that match your definition of "local"):
65
+ # http_access allow localnet
66
+
67
+ # And finally deny all other access to this proxy
68
+ http_access deny all
69
+
70
+ # Squid normally listens to port 3128
71
+ http_port 3128
72
+
73
+ # Uncomment and adjust the following to add a disk cache directory.
74
+ #cache_dir ufs /usr/local/var/cache/squid 100 16 256
75
+
76
+ # Leave coredumps in the first cache dir
77
+ coredump_dir /usr/local/var/cache/squid
78
+
79
+ #
80
+ # Add any of your own refresh_pattern entries above these.
81
+ #
82
+ refresh_pattern ^ftp: 1440 20% 10080
83
+ refresh_pattern ^gopher: 1440 0% 1440
84
+ refresh_pattern -i (/cgi-bin/|\?) 0 0% 0
85
+ refresh_pattern . 0 20% 4320
package/test/synth.js CHANGED
@@ -182,7 +182,9 @@ test('Azure speech synth tests', async(t) => {
182
182
  text: longText,
183
183
  });
184
184
  t.ok(!opts.servedFromCache, `successfully synthesized microsoft audio to ${opts.filePath}`);
185
-
185
+ if (process.env.JAMBONES_HTTP_PROXY_IP && process.env.JAMBONES_HTTP_PROXY_PORT) {
186
+ t.pass('successfully used proxy to reach microsoft tts service');
187
+ }
186
188
 
187
189
  opts = await synthAudio(stats, {
188
190
  vendor: 'microsoft',