sip-lab 1.31.0 → 1.33.0
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.
- package/README.md +5 -0
- package/binding.gyp +1 -0
- package/index.js +4 -5
- package/package.json +1 -1
- package/prebuilds/linux-x64/node.abi102.node +0 -0
- package/prebuilds/linux-x64/node.abi108.node +0 -0
- package/prebuilds/linux-x64/node.abi111.node +0 -0
- package/prebuilds/linux-x64/node.abi115.node +0 -0
- package/prebuilds/linux-x64/node.abi120.node +0 -0
- package/prebuilds/linux-x64/node.abi88.node +0 -0
- package/prebuilds/linux-x64/node.abi93.node +0 -0
- package/samples/100_calls.js +7 -4
- package/samples/16_audio_streams.js +1 -0
- package/samples/183_session_progress.js +1 -0
- package/samples/custom_call_id.js +1 -0
- package/samples/delayed_media.js +1 -0
- package/samples/four_audio_streams_two_refused.js +1 -0
- package/samples/g729.js +1 -0
- package/samples/media_fields.js +1 -0
- package/samples/mrcp_and_audio.js +1 -0
- package/samples/mrcp_and_audio.simplified_media.js +1 -0
- package/samples/multiple_audio_streams.js +1 -0
- package/samples/options.js +1 -0
- package/samples/pcma.js +1 -0
- package/samples/play_wav_and_speech_recog.bad_transcript.pcmu8000.js +1 -0
- package/samples/refer.js +1 -0
- package/samples/refuse_telephone_event.js +1 -0
- package/samples/register_no_expires.js +1 -0
- package/samples/register_subscribe.js +1 -0
- package/samples/reinvite_and_dtmf.js +1 -0
- package/samples/reinvite_audio_audio.js +1 -0
- package/samples/reinvite_with_hold_unhold.js +1 -0
- package/samples/rtp_and_srtp.js +1 -0
- package/samples/rtp_and_srtp.rtp_refused.js +1 -0
- package/samples/rtp_and_srtp.unbalanced_sdp_answer.js.future +1 -0
- package/samples/{send_and_receive_bfsk.js.future → send_and_receive_bfsk.js} +25 -27
- package/samples/send_and_receive_fax.js +1 -0
- package/samples/session_expires.update.js.future +1 -0
- package/samples/session_expires.update.with_sipjs-lab.js +64 -47
- package/samples/simple.js +1 -0
- package/samples/sip_cancel.js +1 -0
- package/samples/speech_synth_and_recog.speex16000.js +1 -0
- package/samples/srtp.js +1 -0
- package/samples/start_play_wav_with_end_of_file_event.js +1 -0
- package/samples/start_play_wav_with_no_loop.js +1 -0
- package/samples/stop_with_cleanup.js +134 -0
- package/samples/tcp.js +1 -0
- package/samples/text_to_speech.js +1 -0
- package/samples/tls.js +1 -0
- package/samples/two_audio_streams.js +1 -0
- package/samples/two_audio_streams.port_zero.js +1 -0
- package/samples_extra/ws_speech_server.bfsk.js +1 -0
- package/samples_extra/ws_speech_server.dtmf.js +1 -0
- package/samples_extra/ws_speech_server.google.js +1 -0
- package/samples_extra/ws_speech_server.send_bfsk.js +1 -0
- package/samples_extra/{ws_speech_server.start_bfsk_detection.js.future → ws_speech_server.start_bfsk_detection.js} +1 -0
- package/src/addon.cpp +9 -1
- package/src/idmanager.cpp +4 -0
- package/src/idmanager.hpp +1 -0
- package/src/pjmedia/include/pjmedia/bfsk_det2.h +23 -0
- package/src/pjmedia/src/pjmedia/bfsk_det.c +124 -131
- package/src/pjmedia/src/pjmedia/bfsk_det2.c +226 -0
- package/src/pjmedia/src/pjmedia/ws_speech_port.cpp +16 -1
- package/src/sip.cpp +114 -108
- package/src/sip.hpp +1 -1
package/README.md
CHANGED
|
@@ -8,6 +8,7 @@ It uses pjproject for SIP and media processing.
|
|
|
8
8
|
It permits to:
|
|
9
9
|
- make audio calls using UDP, TCP and TLS transports
|
|
10
10
|
- send/receive DTMF inband/RFC2833/INFO.
|
|
11
|
+
- send/receive [BFSK](https://en.wikipedia.org/wiki/Frequency-shift_keying) bits.
|
|
11
12
|
- play/record audio on a call from/to a wav file
|
|
12
13
|
- send/receive fax (T.30 only)
|
|
13
14
|
- send/receive MRCPv2 messages (TCP only, no TLS)
|
|
@@ -87,4 +88,8 @@ Although the code in written in *.cpp/*.hpp named files, this is not actually a
|
|
|
87
88
|
|
|
88
89
|
It is mostly written in C using some C++ facilities.
|
|
89
90
|
|
|
91
|
+
### Release Notes
|
|
92
|
+
|
|
93
|
+
[ReleaseNotes](https://github.com/MayamaTakeshi/sip-lab/blob/master/RELEASE_NOTES.md)
|
|
94
|
+
|
|
90
95
|
|
package/binding.gyp
CHANGED
|
@@ -120,6 +120,7 @@
|
|
|
120
120
|
'src/addon.cpp',
|
|
121
121
|
'src/pjmedia/src/pjmedia/dtmfdet.c',
|
|
122
122
|
'src/pjmedia/src/pjmedia/bfsk_det.c',
|
|
123
|
+
'src/pjmedia/src/pjmedia/bfsk_det2.c',
|
|
123
124
|
'src/pjmedia/src/pjmedia/fax_port.c',
|
|
124
125
|
'src/pjmedia/src/pjmedia/flite_port.c',
|
|
125
126
|
'src/pjmedia/src/pjmedia/pocketsphinx_port.c',
|
package/index.js
CHANGED
|
@@ -6,8 +6,8 @@ var eventEmitter = new events.EventEmitter();
|
|
|
6
6
|
|
|
7
7
|
process.on('SIGINT', function() {
|
|
8
8
|
console.log("SIGINT");
|
|
9
|
-
var res = addon.shutdown()
|
|
10
|
-
process.exit(
|
|
9
|
+
var res = addon.shutdown(1)
|
|
10
|
+
process.exit(1)
|
|
11
11
|
});
|
|
12
12
|
|
|
13
13
|
addon.event_source = eventEmitter
|
|
@@ -32,10 +32,9 @@ var timerId = setInterval(() => {
|
|
|
32
32
|
}
|
|
33
33
|
}, 50)
|
|
34
34
|
|
|
35
|
-
addon.stop = () => {
|
|
35
|
+
addon.stop = (clean_up = false) => {
|
|
36
36
|
clearInterval(timerId)
|
|
37
|
-
var res = addon.shutdown()
|
|
38
|
-
process.exit(0)
|
|
37
|
+
var res = addon.shutdown(clean_up ? 1 : 0)
|
|
39
38
|
}
|
|
40
39
|
|
|
41
40
|
addon.transport = {
|
package/package.json
CHANGED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/samples/100_calls.js
CHANGED
|
@@ -80,6 +80,11 @@ async function test() {
|
|
|
80
80
|
|
|
81
81
|
await z.wait(events, 50000)
|
|
82
82
|
|
|
83
|
+
ocs.forEach(oc => {
|
|
84
|
+
sip.call.start_inband_dtmf_detection(oc.id)
|
|
85
|
+
})
|
|
86
|
+
|
|
87
|
+
// first send RFC2833 DTMF digits
|
|
83
88
|
ocs.forEach(oc => {
|
|
84
89
|
sip.call.send_dtmf(oc.id, {digits: '1234', mode: 0})
|
|
85
90
|
})
|
|
@@ -92,10 +97,7 @@ async function test() {
|
|
|
92
97
|
media_id: 0,
|
|
93
98
|
})).value(), 50000)
|
|
94
99
|
|
|
95
|
-
|
|
96
|
-
sip.call.start_inband_dtmf_detection(oc.id)
|
|
97
|
-
})
|
|
98
|
-
|
|
100
|
+
// now send inband DTMF digits
|
|
99
101
|
z.store.ic_ids.forEach(ic_id => {
|
|
100
102
|
sip.call.send_dtmf(ic_id, {digits: '4321', mode: 1})
|
|
101
103
|
})
|
|
@@ -139,6 +141,7 @@ async function test() {
|
|
|
139
141
|
console.log("Success")
|
|
140
142
|
|
|
141
143
|
sip.stop()
|
|
144
|
+
process.exit(0)
|
|
142
145
|
}
|
|
143
146
|
|
|
144
147
|
|
package/samples/delayed_media.js
CHANGED
package/samples/g729.js
CHANGED
package/samples/media_fields.js
CHANGED
package/samples/options.js
CHANGED
package/samples/pcma.js
CHANGED
package/samples/refer.js
CHANGED
package/samples/rtp_and_srtp.js
CHANGED
|
@@ -71,11 +71,9 @@ async function test() {
|
|
|
71
71
|
{
|
|
72
72
|
type: 'audio',
|
|
73
73
|
local: {
|
|
74
|
-
port: 10000,
|
|
75
74
|
mode: 'sendrecv'
|
|
76
75
|
},
|
|
77
76
|
remote: {
|
|
78
|
-
port: 10002,
|
|
79
77
|
mode: 'sendrecv'
|
|
80
78
|
},
|
|
81
79
|
},
|
|
@@ -89,11 +87,9 @@ async function test() {
|
|
|
89
87
|
{
|
|
90
88
|
type: 'audio',
|
|
91
89
|
local: {
|
|
92
|
-
port: 10002,
|
|
93
90
|
mode: 'sendrecv'
|
|
94
91
|
},
|
|
95
92
|
remote: {
|
|
96
|
-
port: 10000,
|
|
97
93
|
mode: 'sendrecv'
|
|
98
94
|
},
|
|
99
95
|
}
|
|
@@ -104,33 +100,34 @@ async function test() {
|
|
|
104
100
|
sip.call.start_record_wav(oc.id, {file: 'oc.wav'})
|
|
105
101
|
sip.call.start_record_wav(ic.id, {file: 'ic.wav'})
|
|
106
102
|
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
sip.call.start_bfsk_detection(oc.id, {freq_zero: 880, freq_one: 1280})
|
|
110
|
-
//sip.call.start_bfsk_detection(ic.id, {freq_zero: 880, freq_one: 1280})
|
|
103
|
+
sip.call.start_bfsk_detection(oc.id, {freq_zero: 500, freq_one: 2000})
|
|
104
|
+
sip.call.start_bfsk_detection(ic.id, {freq_zero: 500, freq_one: 2000})
|
|
111
105
|
|
|
112
106
|
oc_bits = '1010'
|
|
113
107
|
ic_bits = '1100'
|
|
114
108
|
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
109
|
+
// wait a little for voice path to open
|
|
110
|
+
await z.sleep(50)
|
|
111
|
+
|
|
112
|
+
for(var i=0 ; i<5 ; i++) {
|
|
113
|
+
sip.call.send_bfsk(ic.id, {bits: ic_bits, freq_zero: 500, freq_one: 2000})
|
|
114
|
+
sip.call.send_bfsk(oc.id, {bits: oc_bits, freq_zero: 500, freq_one: 2000})
|
|
115
|
+
|
|
116
|
+
await z.wait([
|
|
117
|
+
{
|
|
118
|
+
event: 'bfsk',
|
|
119
|
+
call_id: ic.id,
|
|
120
|
+
bits: oc_bits,
|
|
121
|
+
media_id: 0
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
event: 'bfsk',
|
|
125
|
+
call_id: oc.id,
|
|
126
|
+
bits: ic_bits,
|
|
127
|
+
media_id: 0
|
|
128
|
+
},
|
|
129
|
+
], 10000)
|
|
130
|
+
}
|
|
134
131
|
|
|
135
132
|
sip.call.stop_record_wav(oc.id)
|
|
136
133
|
sip.call.stop_record_wav(ic.id)
|
|
@@ -160,6 +157,7 @@ async function test() {
|
|
|
160
157
|
console.log("Success")
|
|
161
158
|
|
|
162
159
|
sip.stop()
|
|
160
|
+
process.exit(0)
|
|
163
161
|
}
|
|
164
162
|
|
|
165
163
|
|
|
@@ -5,7 +5,7 @@ const sip_msg = require('sip-matching')
|
|
|
5
5
|
const uuid = require('uuid')
|
|
6
6
|
|
|
7
7
|
const sipjs = require('sipjs-lab')
|
|
8
|
-
const {endpoint, dialog} = require('sipjs-lab')
|
|
8
|
+
const {endpoint, dialog, sip_msg: sipjs_sip_msg} = require('sipjs-lab')
|
|
9
9
|
|
|
10
10
|
// here we create our Zeq instance
|
|
11
11
|
|
|
@@ -28,8 +28,6 @@ async function test() {
|
|
|
28
28
|
|
|
29
29
|
const address = "127.0.0.1"
|
|
30
30
|
|
|
31
|
-
const t1 = sip.transport.create({address})
|
|
32
|
-
|
|
33
31
|
const e1_port = 7070
|
|
34
32
|
const e1 = endpoint.create({
|
|
35
33
|
address,
|
|
@@ -37,6 +35,11 @@ async function test() {
|
|
|
37
35
|
publicAddress: address
|
|
38
36
|
})
|
|
39
37
|
|
|
38
|
+
// hack to not lose first INVITE
|
|
39
|
+
await z.sleep(0)
|
|
40
|
+
|
|
41
|
+
const t1 = sip.transport.create({address})
|
|
42
|
+
|
|
40
43
|
const sip_call_id = uuid.v4()
|
|
41
44
|
|
|
42
45
|
var oc = sip.call.create(t1.id, {
|
|
@@ -46,28 +49,19 @@ async function test() {
|
|
|
46
49
|
'Call-ID': sip_call_id,
|
|
47
50
|
'Supported': 'timer',
|
|
48
51
|
'Min-SE': '180',
|
|
49
|
-
'Session-Expires': '180',
|
|
52
|
+
'Session-Expires': '180;refresher=uac',
|
|
50
53
|
},
|
|
51
54
|
})
|
|
52
55
|
|
|
53
56
|
await z.wait([
|
|
54
57
|
{
|
|
55
58
|
source: 'sip_endpoint',
|
|
56
|
-
req: m.collect('req', {
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
},
|
|
63
|
-
to: {
|
|
64
|
-
uri: `sip:bob@${address}`,
|
|
65
|
-
},
|
|
66
|
-
supported: 'timer',
|
|
67
|
-
'min-se': '180',
|
|
68
|
-
'session-expires': '180',
|
|
69
|
-
},
|
|
70
|
-
}),
|
|
59
|
+
req: m.collect('req', sipjs_sip_msg({
|
|
60
|
+
$rm: 'INVITE',
|
|
61
|
+
hdr_supported: 'timer',
|
|
62
|
+
hdr_min_se: '180',
|
|
63
|
+
hdr_session_expires: '180;refresher=uac',
|
|
64
|
+
})),
|
|
71
65
|
event: 'dialog_offer',
|
|
72
66
|
dialog_id: m.collect('dialog_id'),
|
|
73
67
|
},
|
|
@@ -107,8 +101,6 @@ async function test() {
|
|
|
107
101
|
|
|
108
102
|
delete z.store.dialog_id
|
|
109
103
|
|
|
110
|
-
await z.sleep(1000)
|
|
111
|
-
|
|
112
104
|
oc = sip.call.create(t1.id, {
|
|
113
105
|
from_uri: 'sip:alice@test.com',
|
|
114
106
|
to_uri: `sip:bob@${address}:${e1_port}`,
|
|
@@ -116,7 +108,7 @@ async function test() {
|
|
|
116
108
|
'Call-ID': sip_call_id,
|
|
117
109
|
'Supported': 'timer',
|
|
118
110
|
'Min-SE': '300',
|
|
119
|
-
'Session-Expires': '300',
|
|
111
|
+
'Session-Expires': '300;refresher=uac',
|
|
120
112
|
},
|
|
121
113
|
})
|
|
122
114
|
|
|
@@ -125,18 +117,12 @@ async function test() {
|
|
|
125
117
|
await z.wait([
|
|
126
118
|
{
|
|
127
119
|
source: 'sip_endpoint',
|
|
128
|
-
req: m.collect('req', {
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
},
|
|
135
|
-
to: {
|
|
136
|
-
uri: `sip:bob@${address}`,
|
|
137
|
-
},
|
|
138
|
-
},
|
|
139
|
-
}),
|
|
120
|
+
req: m.collect('req', sipjs_sip_msg({
|
|
121
|
+
$rm: 'INVITE',
|
|
122
|
+
hdr_supported: 'timer',
|
|
123
|
+
hdr_min_se: '300',
|
|
124
|
+
hdr_session_expires: '300;refresher=uac'
|
|
125
|
+
})),
|
|
140
126
|
event: 'dialog_offer',
|
|
141
127
|
dialog_id: m.collect('dialog_id'),
|
|
142
128
|
},
|
|
@@ -154,6 +140,36 @@ a=rtpmap:101 telephone-event/8000
|
|
|
154
140
|
a=fmtp:101 0-15
|
|
155
141
|
a=ptime:20`.replace(/\n/g, "\r\n")
|
|
156
142
|
|
|
143
|
+
dialog.send_reply(
|
|
144
|
+
z.store.dialog_id,
|
|
145
|
+
z.store.req,
|
|
146
|
+
{
|
|
147
|
+
status: 183,
|
|
148
|
+
reason: 'Session Progress',
|
|
149
|
+
headers: {
|
|
150
|
+
'content-type': 'application/sdp',
|
|
151
|
+
},
|
|
152
|
+
content: sdp_answer,
|
|
153
|
+
}
|
|
154
|
+
)
|
|
155
|
+
|
|
156
|
+
await z.wait([
|
|
157
|
+
{
|
|
158
|
+
event: 'response',
|
|
159
|
+
call_id: oc.id,
|
|
160
|
+
method: 'INVITE',
|
|
161
|
+
msg: sip_msg({
|
|
162
|
+
$rs: '183',
|
|
163
|
+
$rr: 'Session Progress',
|
|
164
|
+
}),
|
|
165
|
+
},
|
|
166
|
+
{
|
|
167
|
+
event: 'media_update',
|
|
168
|
+
call_id: oc.id,
|
|
169
|
+
status: 'ok',
|
|
170
|
+
},
|
|
171
|
+
], 1000)
|
|
172
|
+
|
|
157
173
|
dialog.send_reply(
|
|
158
174
|
z.store.dialog_id,
|
|
159
175
|
z.store.req,
|
|
@@ -199,14 +215,16 @@ a=ptime:20`.replace(/\n/g, "\r\n")
|
|
|
199
215
|
},
|
|
200
216
|
], 1000)
|
|
201
217
|
|
|
202
|
-
|
|
203
218
|
for(var i=0 ; i<5 ; i++) {
|
|
204
219
|
|
|
220
|
+
// sleep here as much as you like
|
|
221
|
+
await z.sleep(0)
|
|
222
|
+
|
|
205
223
|
sip.call.update(oc.id, {
|
|
206
224
|
headers: {
|
|
207
225
|
'Supported': 'timer',
|
|
208
226
|
'Min-SE': '300',
|
|
209
|
-
'Session-Expires': '300',
|
|
227
|
+
'Session-Expires': '300;refresher=uac',
|
|
210
228
|
},
|
|
211
229
|
})
|
|
212
230
|
|
|
@@ -215,14 +233,12 @@ a=ptime:20`.replace(/\n/g, "\r\n")
|
|
|
215
233
|
await z.wait([
|
|
216
234
|
{
|
|
217
235
|
source: 'sip_endpoint',
|
|
218
|
-
req: m.collect('req', {
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
},
|
|
225
|
-
}),
|
|
236
|
+
req: m.collect('req', sipjs_sip_msg({
|
|
237
|
+
$rm: 'UPDATE',
|
|
238
|
+
hdr_supported: 'timer',
|
|
239
|
+
hdr_min_se: '300',
|
|
240
|
+
hdr_session_expires: '300;refresher=uac'
|
|
241
|
+
})),
|
|
226
242
|
event: 'in_dialog_request',
|
|
227
243
|
dialog_id: z.store.dialog_id
|
|
228
244
|
},
|
|
@@ -266,9 +282,9 @@ a=ptime:20`.replace(/\n/g, "\r\n")
|
|
|
266
282
|
await z.wait([
|
|
267
283
|
{
|
|
268
284
|
source: 'sip_endpoint',
|
|
269
|
-
req: m.collect('req', {
|
|
270
|
-
|
|
271
|
-
}),
|
|
285
|
+
req: m.collect('req', sipjs_sip_msg({
|
|
286
|
+
$rm: 'BYE',
|
|
287
|
+
})),
|
|
272
288
|
},
|
|
273
289
|
], 1000)
|
|
274
290
|
|
|
@@ -302,6 +318,7 @@ a=ptime:20`.replace(/\n/g, "\r\n")
|
|
|
302
318
|
console.log("Success")
|
|
303
319
|
|
|
304
320
|
sip.stop()
|
|
321
|
+
process.exit(0)
|
|
305
322
|
}
|
|
306
323
|
|
|
307
324
|
test()
|
package/samples/simple.js
CHANGED
package/samples/sip_cancel.js
CHANGED