sip-lab 1.29.0 → 1.30.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/build_deps.sh +2 -1
- 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/send_and_receive_bfsk.js.future +171 -0
- package/samples_extra/ws_speech_server.bfsk.js +154 -0
- package/samples_extra/ws_speech_server.dtmf.js +5 -21
- package/samples_extra/ws_speech_server.google.js +8 -10
- package/samples_extra/ws_speech_server.send_bfsk.js +156 -0
- package/samples_extra/ws_speech_server.start_bfsk_detection.js.future +164 -0
- package/src/pjmedia/include/pjmedia/bfsk_det.h +0 -2
- package/src/pjmedia/include/pjmedia/ws_speech_port.h +1 -0
- package/src/pjmedia/src/pjmedia/bfsk_det.c +153 -27
- package/src/pjmedia/src/pjmedia/ws_speech_port.cpp +8 -0
- package/src/sip.cpp +69 -51
- package/src/sip.cpp.old +9236 -0
package/src/sip.cpp
CHANGED
|
@@ -267,7 +267,7 @@ int ms_timestamp();
|
|
|
267
267
|
bool g_shutting_down;
|
|
268
268
|
|
|
269
269
|
int g_dtmf_inter_digit_timer = 0;
|
|
270
|
-
int g_bfsk_inter_bit_timer =
|
|
270
|
+
int g_bfsk_inter_bit_timer = 200;
|
|
271
271
|
|
|
272
272
|
pj_str_t g_sip_ipaddress;
|
|
273
273
|
|
|
@@ -641,12 +641,12 @@ static void build_stream_stat(ostringstream &oss, pjmedia_rtcp_stat *stat,
|
|
|
641
641
|
|
|
642
642
|
bool prepare_tonegen(Call *call, AudioEndpoint *ae);
|
|
643
643
|
bool prepare_dtmfdet(Call *call, AudioEndpoint *ae);
|
|
644
|
-
bool prepare_bfsk_det(Call *call, AudioEndpoint *ae, const int freq_zero, const int freq_one
|
|
644
|
+
bool prepare_bfsk_det(Call *call, AudioEndpoint *ae, const int freq_zero, const int freq_one);
|
|
645
645
|
bool prepare_wav_player(Call *call, AudioEndpoint *ae, const char *file, unsigned flags, bool end_of_file_event);
|
|
646
646
|
bool prepare_wav_writer(Call *call, AudioEndpoint *ae, const char *file);
|
|
647
647
|
bool prepare_fax(Call *call, AudioEndpoint *ae, bool is_sender, const char *file, unsigned flags);
|
|
648
|
-
bool prepare_speech_synth(Call *call, AudioEndpoint *ae, const char *server_url, const char *engine, const char *voice, const char *language, const char *text, int times);
|
|
649
|
-
bool prepare_speech_recog(Call *call, AudioEndpoint *ae, const char *server_url, const char *engine, const char *language);
|
|
648
|
+
bool prepare_speech_synth(Call *call, AudioEndpoint *ae, const char *server_url, const char *uuid, const char *engine, const char *voice, const char *language, const char *text, int times);
|
|
649
|
+
bool prepare_speech_recog(Call *call, AudioEndpoint *ae, const char *server_url, const char *uuid, const char *engine, const char *language);
|
|
650
650
|
|
|
651
651
|
void prepare_error_event(ostringstream *oss, char *scope, char *details);
|
|
652
652
|
// void prepare_pjsipcall_error_event(ostringstream *oss, char *scope, char
|
|
@@ -897,7 +897,7 @@ static void on_bfsk_bit(pjmedia_port *port, void *user_data, int bit) {
|
|
|
897
897
|
return;
|
|
898
898
|
}
|
|
899
899
|
|
|
900
|
-
ae->BfskBuffer[len] = bit;
|
|
900
|
+
ae->BfskBuffer[len] = bit == 0 ? '0' : '1';
|
|
901
901
|
ae->BfskBufferLength++;
|
|
902
902
|
|
|
903
903
|
ae->last_bit_timestamp = ms_timestamp();
|
|
@@ -905,7 +905,7 @@ static void on_bfsk_bit(pjmedia_port *port, void *user_data, int bit) {
|
|
|
905
905
|
} else {
|
|
906
906
|
char evt[1024];
|
|
907
907
|
char the_bit[1];
|
|
908
|
-
the_bit[0] = bit;
|
|
908
|
+
the_bit[0] = bit == 0 ? '0' : '1';
|
|
909
909
|
make_evt_bfsk(evt, sizeof(evt), call_id, 1, the_bit, media_id);
|
|
910
910
|
dispatch_event(evt);
|
|
911
911
|
}
|
|
@@ -1457,11 +1457,13 @@ int __pjw_init() {
|
|
|
1457
1457
|
return 1;
|
|
1458
1458
|
}
|
|
1459
1459
|
|
|
1460
|
+
/*
|
|
1460
1461
|
status = pjsip_replaces_init_module(g_sip_endpt);
|
|
1461
1462
|
if (status != PJ_SUCCESS) {
|
|
1462
1463
|
addon_log(L_DBG, "pjsip_replaces_init_module failed\n");
|
|
1463
1464
|
return 1;
|
|
1464
1465
|
}
|
|
1466
|
+
*/
|
|
1465
1467
|
|
|
1466
1468
|
pjsip_inv_callback inv_cb;
|
|
1467
1469
|
pj_bzero(&inv_cb, sizeof(inv_cb));
|
|
@@ -2423,6 +2425,8 @@ int pjw_call_respond(long call_id, const char *json) {
|
|
|
2423
2425
|
|
|
2424
2426
|
if (code >= 200 && code < 300) {
|
|
2425
2427
|
call->pending_request = -1;
|
|
2428
|
+
|
|
2429
|
+
pjsip_msg_find_remove_hdr(tdata->msg, PJSIP_H_SUPPORTED, NULL);
|
|
2426
2430
|
}
|
|
2427
2431
|
}
|
|
2428
2432
|
} else {
|
|
@@ -2446,6 +2450,9 @@ int pjw_call_respond(long call_id, const char *json) {
|
|
|
2446
2450
|
|
|
2447
2451
|
if (code >= 200 && code < 300) {
|
|
2448
2452
|
call->pending_request = -1;
|
|
2453
|
+
|
|
2454
|
+
pjsip_msg *msg = tdata->msg;
|
|
2455
|
+
pjsip_msg_find_remove_hdr(msg, PJSIP_H_SUPPORTED, NULL);
|
|
2449
2456
|
}
|
|
2450
2457
|
}
|
|
2451
2458
|
|
|
@@ -3249,6 +3256,8 @@ int call_create(Transport *t, unsigned flags, pjsip_dialog *dlg,
|
|
|
3249
3256
|
}
|
|
3250
3257
|
addon_log(L_DBG, "inv=%p tdata=%p\n", (void*)inv, (void*)tdata);
|
|
3251
3258
|
|
|
3259
|
+
pjsip_msg_find_remove_hdr(tdata->msg, PJSIP_H_SUPPORTED, NULL);
|
|
3260
|
+
|
|
3252
3261
|
status = pjsip_inv_send_msg(inv, tdata);
|
|
3253
3262
|
addon_log(L_DBG, "status=%d\n", status);
|
|
3254
3263
|
if (status != PJ_SUCCESS) {
|
|
@@ -3470,7 +3479,7 @@ out:
|
|
|
3470
3479
|
}
|
|
3471
3480
|
|
|
3472
3481
|
pj_status_t audio_endpoint_send_bfsk(Call *call, AudioEndpoint *ae,
|
|
3473
|
-
const char *bits, const int freq_zero, const int freq_one, const int level, const int
|
|
3482
|
+
const char *bits, const int freq_zero, const int freq_one, const int level, const int signal_duration) {
|
|
3474
3483
|
pj_status_t status;
|
|
3475
3484
|
|
|
3476
3485
|
if (!prepare_tonegen(call, ae)) {
|
|
@@ -3480,14 +3489,12 @@ pj_status_t audio_endpoint_send_bfsk(Call *call, AudioEndpoint *ae,
|
|
|
3480
3489
|
|
|
3481
3490
|
int len = strlen(bits);
|
|
3482
3491
|
|
|
3483
|
-
int duration = 1000 / baud_rate; // Duration of each tone in milliseconds
|
|
3484
|
-
|
|
3485
3492
|
pjmedia_tone_desc *tones = (pjmedia_tone_desc*)pj_pool_zalloc(call->inv->pool, sizeof(pjmedia_tone_desc) * len);
|
|
3486
3493
|
|
|
3487
3494
|
for (int i = 0; i < len; ++i) {
|
|
3488
3495
|
tones[i].freq1 = bits[i] == '0' ? freq_zero : freq_one;
|
|
3489
|
-
tones[i].on_msec =
|
|
3490
|
-
tones[i].off_msec =
|
|
3496
|
+
tones[i].on_msec = signal_duration;
|
|
3497
|
+
tones[i].off_msec = signal_duration;
|
|
3491
3498
|
tones[i].volume = level;
|
|
3492
3499
|
}
|
|
3493
3500
|
|
|
@@ -3500,7 +3507,7 @@ pj_status_t audio_endpoint_send_bfsk(Call *call, AudioEndpoint *ae,
|
|
|
3500
3507
|
return PJ_SUCCESS;
|
|
3501
3508
|
}
|
|
3502
3509
|
|
|
3503
|
-
pj_status_t send_bfsk(Call *call, const char *bits, const int freq_zero, const int freq_one, const int level, const int
|
|
3510
|
+
pj_status_t send_bfsk(Call *call, const char *bits, const int freq_zero, const int freq_one, const int level, const int signal_duration) {
|
|
3504
3511
|
for (int i = 0; i < call->media_count; i++) {
|
|
3505
3512
|
MediaEndpoint *me = (MediaEndpoint *)call->media[i];
|
|
3506
3513
|
if (me->type != ENDPOINT_TYPE_AUDIO)
|
|
@@ -3511,7 +3518,7 @@ pj_status_t send_bfsk(Call *call, const char *bits, const int freq_zero, const i
|
|
|
3511
3518
|
|
|
3512
3519
|
AudioEndpoint *ae = (AudioEndpoint *)me->endpoint.audio;
|
|
3513
3520
|
|
|
3514
|
-
pj_status_t status = audio_endpoint_send_bfsk(call, ae, bits, freq_zero, freq_one, level,
|
|
3521
|
+
pj_status_t status = audio_endpoint_send_bfsk(call, ae, bits, freq_zero, freq_one, level, signal_duration);
|
|
3515
3522
|
if (status != PJ_SUCCESS)
|
|
3516
3523
|
return status;
|
|
3517
3524
|
}
|
|
@@ -3536,8 +3543,8 @@ int pjw_call_send_bfsk(long call_id, const char *json) {
|
|
|
3536
3543
|
char *bits;
|
|
3537
3544
|
int freq_zero;
|
|
3538
3545
|
int freq_one;
|
|
3539
|
-
int level;
|
|
3540
|
-
int
|
|
3546
|
+
int level = 24000;
|
|
3547
|
+
int signal_duration = 10;
|
|
3541
3548
|
|
|
3542
3549
|
MediaEndpoint *me;
|
|
3543
3550
|
AudioEndpoint *ae;
|
|
@@ -3549,7 +3556,7 @@ int pjw_call_send_bfsk(long call_id, const char *json) {
|
|
|
3549
3556
|
|
|
3550
3557
|
Document document;
|
|
3551
3558
|
|
|
3552
|
-
const char *valid_params[] = {"bits", "freq_zero", "freq_one", "level", "
|
|
3559
|
+
const char *valid_params[] = {"bits", "freq_zero", "freq_one", "level", "signal_duration", "media_id", ""};
|
|
3553
3560
|
|
|
3554
3561
|
if (!g_call_ids.get(call_id, val)) {
|
|
3555
3562
|
set_error("Invalid call_id");
|
|
@@ -3577,11 +3584,11 @@ int pjw_call_send_bfsk(long call_id, const char *json) {
|
|
|
3577
3584
|
goto out;
|
|
3578
3585
|
}
|
|
3579
3586
|
|
|
3580
|
-
if (json_get_int_param(document, "level",
|
|
3587
|
+
if (json_get_int_param(document, "level", true, &level) <= 0) {
|
|
3581
3588
|
goto out;
|
|
3582
3589
|
}
|
|
3583
3590
|
|
|
3584
|
-
if (json_get_int_param(document, "
|
|
3591
|
+
if (json_get_int_param(document, "signal_duration", true, &signal_duration) <= 0) {
|
|
3585
3592
|
goto out;
|
|
3586
3593
|
}
|
|
3587
3594
|
|
|
@@ -3606,7 +3613,7 @@ int pjw_call_send_bfsk(long call_id, const char *json) {
|
|
|
3606
3613
|
|
|
3607
3614
|
if (NOT_FOUND_OPTIONAL == res) {
|
|
3608
3615
|
// send_bfsk_bits to all audio endpoints
|
|
3609
|
-
status = send_bfsk(call, bits, freq_zero, freq_one, level,
|
|
3616
|
+
status = send_bfsk(call, bits, freq_zero, freq_one, level, signal_duration);
|
|
3610
3617
|
if (status != PJ_SUCCESS) {
|
|
3611
3618
|
goto out;
|
|
3612
3619
|
}
|
|
@@ -3626,7 +3633,7 @@ int pjw_call_send_bfsk(long call_id, const char *json) {
|
|
|
3626
3633
|
|
|
3627
3634
|
ae = (AudioEndpoint *)me->endpoint.audio;
|
|
3628
3635
|
|
|
3629
|
-
status = audio_endpoint_send_bfsk(call, ae, bits, freq_one, freq_zero, level,
|
|
3636
|
+
status = audio_endpoint_send_bfsk(call, ae, bits, freq_one, freq_zero, level, signal_duration);
|
|
3630
3637
|
if (status != PJ_SUCCESS) {
|
|
3631
3638
|
goto out;
|
|
3632
3639
|
}
|
|
@@ -3759,6 +3766,8 @@ int pjw_call_reinvite(long call_id, const char *json) {
|
|
|
3759
3766
|
goto out;
|
|
3760
3767
|
}
|
|
3761
3768
|
|
|
3769
|
+
pjsip_msg_find_remove_hdr(tdata->msg, PJSIP_H_SUPPORTED, NULL);
|
|
3770
|
+
|
|
3762
3771
|
status = pjsip_inv_send_msg(call->inv, tdata);
|
|
3763
3772
|
if (status != PJ_SUCCESS) {
|
|
3764
3773
|
set_error("pjsip_inv_send_msg failed");
|
|
@@ -4171,7 +4180,7 @@ out:
|
|
|
4171
4180
|
return 0;
|
|
4172
4181
|
}
|
|
4173
4182
|
|
|
4174
|
-
pj_status_t audio_endpoint_start_speech_synth(Call *call, AudioEndpoint *ae, const char *server_url, const char *engine, const char *voice, const char *language, const char *text, int times) {
|
|
4183
|
+
pj_status_t audio_endpoint_start_speech_synth(Call *call, AudioEndpoint *ae, const char *server_url, const char *uuid, const char *engine, const char *voice, const char *language, const char *text, int times) {
|
|
4175
4184
|
pj_status_t status;
|
|
4176
4185
|
|
|
4177
4186
|
if(!ae->stream_cbp.port) {
|
|
@@ -4185,7 +4194,7 @@ pj_status_t audio_endpoint_start_speech_synth(Call *call, AudioEndpoint *ae, con
|
|
|
4185
4194
|
return -1;
|
|
4186
4195
|
}
|
|
4187
4196
|
|
|
4188
|
-
if (!prepare_speech_synth(call, ae, server_url, engine, voice, language, text, times)) {
|
|
4197
|
+
if (!prepare_speech_synth(call, ae, server_url, uuid, engine, voice, language, text, times)) {
|
|
4189
4198
|
return -1;
|
|
4190
4199
|
}
|
|
4191
4200
|
|
|
@@ -4304,13 +4313,16 @@ int pjw_call_start_speech_synth(long call_id, const char *json) {
|
|
|
4304
4313
|
}
|
|
4305
4314
|
}
|
|
4306
4315
|
|
|
4316
|
+
char uuid[1024];
|
|
4317
|
+
sprintf(uuid, "%.*s", call->inv->dlg->call_id->id.slen, call->inv->dlg->call_id->id.ptr);
|
|
4318
|
+
|
|
4307
4319
|
if (NOT_FOUND_OPTIONAL == res) {
|
|
4308
4320
|
// start on all audio media endpoints
|
|
4309
4321
|
for (int i = 0; i < call->media_count; i++) {
|
|
4310
4322
|
MediaEndpoint *me = (MediaEndpoint *)call->media[i];
|
|
4311
4323
|
if (me->type == ENDPOINT_TYPE_AUDIO) {
|
|
4312
4324
|
AudioEndpoint *ae = (AudioEndpoint *)me->endpoint.audio;
|
|
4313
|
-
status = audio_endpoint_start_speech_synth(call, ae, server_url, engine, voice, language, text, times);
|
|
4325
|
+
status = audio_endpoint_start_speech_synth(call, ae, server_url, uuid, engine, voice, language, text, times);
|
|
4314
4326
|
if (status != PJ_SUCCESS) goto out;
|
|
4315
4327
|
}
|
|
4316
4328
|
}
|
|
@@ -4328,7 +4340,7 @@ int pjw_call_start_speech_synth(long call_id, const char *json) {
|
|
|
4328
4340
|
|
|
4329
4341
|
ae = (AudioEndpoint *)me->endpoint.audio;
|
|
4330
4342
|
|
|
4331
|
-
audio_endpoint_start_speech_synth(call, ae, server_url, engine, voice, language, text, times);
|
|
4343
|
+
audio_endpoint_start_speech_synth(call, ae, server_url, uuid, engine, voice, language, text, times);
|
|
4332
4344
|
}
|
|
4333
4345
|
|
|
4334
4346
|
out:
|
|
@@ -4340,7 +4352,7 @@ out:
|
|
|
4340
4352
|
return 0;
|
|
4341
4353
|
}
|
|
4342
4354
|
|
|
4343
|
-
pj_status_t audio_endpoint_start_speech_recog(Call *call, AudioEndpoint *ae, const char *server_url, const char *engine, const char *language) {
|
|
4355
|
+
pj_status_t audio_endpoint_start_speech_recog(Call *call, AudioEndpoint *ae, const char *server_url, const char *uuid, const char *engine, const char *language) {
|
|
4344
4356
|
pj_status_t status;
|
|
4345
4357
|
|
|
4346
4358
|
if(!ae->stream_cbp.port) {
|
|
@@ -4354,7 +4366,7 @@ pj_status_t audio_endpoint_start_speech_recog(Call *call, AudioEndpoint *ae, con
|
|
|
4354
4366
|
return -1;
|
|
4355
4367
|
}
|
|
4356
4368
|
|
|
4357
|
-
if (!prepare_speech_recog(call, ae, server_url, engine, language)) {
|
|
4369
|
+
if (!prepare_speech_recog(call, ae, server_url, uuid, engine, language)) {
|
|
4358
4370
|
return -1;
|
|
4359
4371
|
}
|
|
4360
4372
|
|
|
@@ -4445,13 +4457,16 @@ int pjw_call_start_speech_recog(long call_id, const char *json) {
|
|
|
4445
4457
|
}
|
|
4446
4458
|
}
|
|
4447
4459
|
|
|
4460
|
+
char uuid[1024];
|
|
4461
|
+
sprintf(uuid, "%.*s", call->inv->dlg->call_id->id.slen, call->inv->dlg->call_id->id.ptr);
|
|
4462
|
+
|
|
4448
4463
|
if (NOT_FOUND_OPTIONAL == res) {
|
|
4449
4464
|
// start on all audio media endpoints
|
|
4450
4465
|
for (int i = 0; i < call->media_count; i++) {
|
|
4451
4466
|
MediaEndpoint *me = (MediaEndpoint *)call->media[i];
|
|
4452
4467
|
if (me->type == ENDPOINT_TYPE_AUDIO) {
|
|
4453
4468
|
AudioEndpoint *ae = (AudioEndpoint *)me->endpoint.audio;
|
|
4454
|
-
status = audio_endpoint_start_speech_recog(call, ae, server_url, engine, language);
|
|
4469
|
+
status = audio_endpoint_start_speech_recog(call, ae, server_url, uuid, engine, language);
|
|
4455
4470
|
if (status != PJ_SUCCESS) goto out;
|
|
4456
4471
|
}
|
|
4457
4472
|
}
|
|
@@ -4469,7 +4484,7 @@ int pjw_call_start_speech_recog(long call_id, const char *json) {
|
|
|
4469
4484
|
|
|
4470
4485
|
ae = (AudioEndpoint *)me->endpoint.audio;
|
|
4471
4486
|
|
|
4472
|
-
audio_endpoint_start_speech_recog(call, ae, server_url, engine, language);
|
|
4487
|
+
audio_endpoint_start_speech_recog(call, ae, server_url, uuid, engine, language);
|
|
4473
4488
|
}
|
|
4474
4489
|
|
|
4475
4490
|
out:
|
|
@@ -4580,7 +4595,7 @@ out:
|
|
|
4580
4595
|
return 0;
|
|
4581
4596
|
}
|
|
4582
4597
|
|
|
4583
|
-
pj_status_t audio_endpoint_start_bfsk_detection(Call *call, AudioEndpoint *ae, const int freq_zero, const int freq_one
|
|
4598
|
+
pj_status_t audio_endpoint_start_bfsk_detection(Call *call, AudioEndpoint *ae, const int freq_zero, const int freq_one) {
|
|
4584
4599
|
pj_status_t status;
|
|
4585
4600
|
|
|
4586
4601
|
if(!ae->stream_cbp.port) {
|
|
@@ -4588,7 +4603,7 @@ pj_status_t audio_endpoint_start_bfsk_detection(Call *call, AudioEndpoint *ae, c
|
|
|
4588
4603
|
return -1;
|
|
4589
4604
|
}
|
|
4590
4605
|
|
|
4591
|
-
if(!prepare_bfsk_det(call, ae, freq_zero, freq_one
|
|
4606
|
+
if(!prepare_bfsk_det(call, ae, freq_zero, freq_one)) {
|
|
4592
4607
|
return -1;
|
|
4593
4608
|
}
|
|
4594
4609
|
|
|
@@ -4614,14 +4629,12 @@ int pjw_call_start_bfsk_detection(long call_id, const char *json) {
|
|
|
4614
4629
|
|
|
4615
4630
|
int freq_zero;
|
|
4616
4631
|
int freq_one;
|
|
4617
|
-
int min_level;
|
|
4618
|
-
int baud_rate;
|
|
4619
4632
|
|
|
4620
4633
|
char buffer[MAX_JSON_INPUT];
|
|
4621
4634
|
|
|
4622
4635
|
Document document;
|
|
4623
4636
|
|
|
4624
|
-
const char *valid_params[] = {"freq_zero", "freq_one", "
|
|
4637
|
+
const char *valid_params[] = {"freq_zero", "freq_one", "media_id", ""};
|
|
4625
4638
|
|
|
4626
4639
|
if (!g_call_ids.get(call_id, val)) {
|
|
4627
4640
|
set_error("Invalid call_id");
|
|
@@ -4654,16 +4667,6 @@ int pjw_call_start_bfsk_detection(long call_id, const char *json) {
|
|
|
4654
4667
|
goto out;
|
|
4655
4668
|
}
|
|
4656
4669
|
|
|
4657
|
-
res = json_get_int_param(document, "min_level", false, &min_level);
|
|
4658
|
-
if (res <= 0) {
|
|
4659
|
-
goto out;
|
|
4660
|
-
}
|
|
4661
|
-
|
|
4662
|
-
res = json_get_int_param(document, "baud_rate", false, &baud_rate);
|
|
4663
|
-
if (res <= 0) {
|
|
4664
|
-
goto out;
|
|
4665
|
-
}
|
|
4666
|
-
|
|
4667
4670
|
res = json_get_int_param(document, "media_id", true, &media_id);
|
|
4668
4671
|
if (res <= 0) {
|
|
4669
4672
|
goto out;
|
|
@@ -4674,7 +4677,7 @@ int pjw_call_start_bfsk_detection(long call_id, const char *json) {
|
|
|
4674
4677
|
MediaEndpoint *me = (MediaEndpoint *)call->media[i];
|
|
4675
4678
|
if (me->type == ENDPOINT_TYPE_AUDIO) {
|
|
4676
4679
|
AudioEndpoint *ae = (AudioEndpoint *)me->endpoint.audio;
|
|
4677
|
-
status = audio_endpoint_start_bfsk_detection(call, ae, freq_zero, freq_one
|
|
4680
|
+
status = audio_endpoint_start_bfsk_detection(call, ae, freq_zero, freq_one);
|
|
4678
4681
|
if (status != PJ_SUCCESS) goto out;
|
|
4679
4682
|
}
|
|
4680
4683
|
}
|
|
@@ -4692,7 +4695,7 @@ int pjw_call_start_bfsk_detection(long call_id, const char *json) {
|
|
|
4692
4695
|
|
|
4693
4696
|
ae = (AudioEndpoint *)me->endpoint.audio;
|
|
4694
4697
|
|
|
4695
|
-
audio_endpoint_start_bfsk_detection(call, ae, freq_zero, freq_one
|
|
4698
|
+
audio_endpoint_start_bfsk_detection(call, ae, freq_zero, freq_one);
|
|
4696
4699
|
}
|
|
4697
4700
|
|
|
4698
4701
|
out:
|
|
@@ -7488,7 +7491,7 @@ bool prepare_dtmfdet(Call *call, AudioEndpoint *ae) {
|
|
|
7488
7491
|
return connect_feature_port_to_stream_port(call, ae, fp);
|
|
7489
7492
|
}
|
|
7490
7493
|
|
|
7491
|
-
bool prepare_bfsk_det(Call *call, AudioEndpoint *ae, const int freq_zero, const int freq_one
|
|
7494
|
+
bool prepare_bfsk_det(Call *call, AudioEndpoint *ae, const int freq_zero, const int freq_one) {
|
|
7492
7495
|
printf("DEBUG prepare_bfsk_det\n");
|
|
7493
7496
|
pj_status_t status;
|
|
7494
7497
|
|
|
@@ -7505,7 +7508,7 @@ bool prepare_bfsk_det(Call *call, AudioEndpoint *ae, const int freq_zero, const
|
|
|
7505
7508
|
PJMEDIA_PIA_CCNT(&ae->stream_cbp.port->info),
|
|
7506
7509
|
PJMEDIA_PIA_SPF(&ae->stream_cbp.port->info),
|
|
7507
7510
|
PJMEDIA_PIA_BITS(&ae->stream_cbp.port->info),
|
|
7508
|
-
on_bfsk_bit, call, freq_zero, freq_one,
|
|
7511
|
+
on_bfsk_bit, call, freq_zero, freq_one, &fp->port);
|
|
7509
7512
|
if (status != PJ_SUCCESS) {
|
|
7510
7513
|
set_error("pjmedia_bfsk_det_create failed");
|
|
7511
7514
|
return false;
|
|
@@ -7552,7 +7555,7 @@ bool prepare_fax(Call *call, AudioEndpoint *ae, bool is_sender, const char *file
|
|
|
7552
7555
|
return connect_feature_port_to_stream_port(call, ae, fp);
|
|
7553
7556
|
}
|
|
7554
7557
|
|
|
7555
|
-
bool prepare_speech_synth(Call *call, AudioEndpoint *ae, const char *server_url, const char *engine, const char *voice, const char *language, const char *text, int times) {
|
|
7558
|
+
bool prepare_speech_synth(Call *call, AudioEndpoint *ae, const char *server_url, const char *uuid, const char *engine, const char *voice, const char *language, const char *text, int times) {
|
|
7556
7559
|
pj_status_t status;
|
|
7557
7560
|
|
|
7558
7561
|
ConfBridgePort *fp = &ae->feature_cbps[FP_SPEECH_SYNTH];
|
|
@@ -7607,6 +7610,7 @@ bool prepare_speech_synth(Call *call, AudioEndpoint *ae, const char *server_url,
|
|
|
7607
7610
|
PJMEDIA_PIA_BITS(&ae->stream_cbp.port->info),
|
|
7608
7611
|
g_ws_endpt,
|
|
7609
7612
|
server_url,
|
|
7613
|
+
uuid,
|
|
7610
7614
|
engine,
|
|
7611
7615
|
voice,
|
|
7612
7616
|
language,
|
|
@@ -7640,7 +7644,7 @@ bool prepare_speech_synth(Call *call, AudioEndpoint *ae, const char *server_url,
|
|
|
7640
7644
|
return PJ_SUCCESS;
|
|
7641
7645
|
}
|
|
7642
7646
|
|
|
7643
|
-
bool prepare_speech_recog(Call *call, AudioEndpoint *ae, const char *server_url, const char *engine, const char *language) {
|
|
7647
|
+
bool prepare_speech_recog(Call *call, AudioEndpoint *ae, const char *server_url, const char *uuid, const char *engine, const char *language) {
|
|
7644
7648
|
pj_status_t status;
|
|
7645
7649
|
|
|
7646
7650
|
ConfBridgePort *fp = &ae->feature_cbps[FP_SPEECH_RECOG];
|
|
@@ -7672,6 +7676,7 @@ bool prepare_speech_recog(Call *call, AudioEndpoint *ae, const char *server_url,
|
|
|
7672
7676
|
PJMEDIA_PIA_BITS(&ae->stream_cbp.port->info),
|
|
7673
7677
|
g_ws_endpt,
|
|
7674
7678
|
server_url,
|
|
7679
|
+
uuid,
|
|
7675
7680
|
NULL,
|
|
7676
7681
|
NULL,
|
|
7677
7682
|
NULL,
|
|
@@ -9106,6 +9111,18 @@ void check_digit_buffer(Call *call, int mode) {
|
|
|
9106
9111
|
*pLen = 0;
|
|
9107
9112
|
ae->last_digit_timestamp[mode] = 0;
|
|
9108
9113
|
}
|
|
9114
|
+
}
|
|
9115
|
+
}
|
|
9116
|
+
|
|
9117
|
+
void check_bit_buffer(Call *call) {
|
|
9118
|
+
char evt[1024];
|
|
9119
|
+
|
|
9120
|
+
for (int i = 0; i < call->media_count; i++) {
|
|
9121
|
+
MediaEndpoint *me = (MediaEndpoint *)call->media[i];
|
|
9122
|
+
if (ENDPOINT_TYPE_AUDIO != me->type)
|
|
9123
|
+
continue;
|
|
9124
|
+
|
|
9125
|
+
AudioEndpoint *ae = (AudioEndpoint *)me->endpoint.audio;
|
|
9109
9126
|
|
|
9110
9127
|
if (ae->last_bit_timestamp > 0 &&
|
|
9111
9128
|
g_now - ae->last_bit_timestamp > g_bfsk_inter_bit_timer) {
|
|
@@ -9118,11 +9135,12 @@ void check_digit_buffer(Call *call, int mode) {
|
|
|
9118
9135
|
}
|
|
9119
9136
|
}
|
|
9120
9137
|
|
|
9121
|
-
void
|
|
9138
|
+
void check_buffers(long id, long val) {
|
|
9122
9139
|
Call *call = (Call *)val;
|
|
9123
9140
|
|
|
9124
9141
|
check_digit_buffer(call, DTMF_MODE_RFC2833);
|
|
9125
9142
|
check_digit_buffer(call, DTMF_MODE_INBAND);
|
|
9143
|
+
check_bit_buffer(call);
|
|
9126
9144
|
}
|
|
9127
9145
|
|
|
9128
9146
|
static int digit_buffer_thread(void *arg) {
|
|
@@ -9137,7 +9155,7 @@ static int digit_buffer_thread(void *arg) {
|
|
|
9137
9155
|
PJW_LOCK();
|
|
9138
9156
|
if (g_dtmf_inter_digit_timer > 0) {
|
|
9139
9157
|
g_now = ms_timestamp();
|
|
9140
|
-
g_call_ids.iterate(
|
|
9158
|
+
g_call_ids.iterate(check_buffers);
|
|
9141
9159
|
}
|
|
9142
9160
|
PJW_UNLOCK();
|
|
9143
9161
|
|