@babblevoice/babble-drachtio-callmanager 1.2.0 → 1.3.1
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/lib/call.js +22 -4
- package/package.json +2 -2
- package/test/interface/call.js +39 -11
package/lib/call.js
CHANGED
|
@@ -420,8 +420,8 @@ class call {
|
|
|
420
420
|
parsed = this._req.getParsedHeader( "from" )
|
|
421
421
|
}
|
|
422
422
|
|
|
423
|
-
let parseduri = parseuri( parsed.uri )
|
|
424
423
|
if( !parsed ) parsed = {}
|
|
424
|
+
let parseduri = parseuri( parsed.uri )
|
|
425
425
|
if( !parsed.params ) parsed.params = {}
|
|
426
426
|
|
|
427
427
|
return {
|
|
@@ -1060,7 +1060,7 @@ class call {
|
|
|
1060
1060
|
|
|
1061
1061
|
this._req.on( "cancel", () => this._oncanceled() )
|
|
1062
1062
|
|
|
1063
|
-
let authorization = this._auth.parseauthheaders( this._req
|
|
1063
|
+
let authorization = this._auth.parseauthheaders( this._req )
|
|
1064
1064
|
|
|
1065
1065
|
if( undefined === callmanager.options.userlookup ) {
|
|
1066
1066
|
this._promises.reject.auth( "no userlookup function provided")
|
|
@@ -1443,6 +1443,24 @@ class call {
|
|
|
1443
1443
|
}
|
|
1444
1444
|
}
|
|
1445
1445
|
|
|
1446
|
+
/**
|
|
1447
|
+
* Set the sound soup for music on hold.
|
|
1448
|
+
* @param { object } soup - sound soup as described in projectrtp
|
|
1449
|
+
*/
|
|
1450
|
+
set moh( soup ) {
|
|
1451
|
+
this._moh = soup
|
|
1452
|
+
}
|
|
1453
|
+
|
|
1454
|
+
/**
|
|
1455
|
+
* Return the current moh
|
|
1456
|
+
*/
|
|
1457
|
+
get moh() {
|
|
1458
|
+
if( this._moh ) {
|
|
1459
|
+
return this._moh
|
|
1460
|
+
}
|
|
1461
|
+
return callmanager.options.moh
|
|
1462
|
+
}
|
|
1463
|
+
|
|
1446
1464
|
/**
|
|
1447
1465
|
* If we have been placed on hold (and it has been neotiated) then configure audio to match.
|
|
1448
1466
|
* @private
|
|
@@ -1458,7 +1476,7 @@ class call {
|
|
|
1458
1476
|
let other = this.other
|
|
1459
1477
|
if( other ) {
|
|
1460
1478
|
other.channels.audio.unmix()
|
|
1461
|
-
other.channels.audio.play(
|
|
1479
|
+
other.channels.audio.play( this.moh )
|
|
1462
1480
|
}
|
|
1463
1481
|
|
|
1464
1482
|
this._em.emit( "call.hold", this )
|
|
@@ -2447,7 +2465,7 @@ class call {
|
|
|
2447
2465
|
@private
|
|
2448
2466
|
*/
|
|
2449
2467
|
c._req = req
|
|
2450
|
-
c._req.on( "cancel", () =>
|
|
2468
|
+
c._req.on( "cancel", () => c._oncanceled.bind( c ) )
|
|
2451
2469
|
/**
|
|
2452
2470
|
@member
|
|
2453
2471
|
@private
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@babblevoice/babble-drachtio-callmanager",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.1",
|
|
4
4
|
"description": "Call processing to create a PBX",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
],
|
|
21
21
|
"license": "MIT",
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@babblevoice/babble-drachtio-auth": "^1.0.
|
|
23
|
+
"@babblevoice/babble-drachtio-auth": "^1.0.2",
|
|
24
24
|
"chai": "^4.3.4",
|
|
25
25
|
"drachtio-srf": "^4.4.47",
|
|
26
26
|
"mocha": "^9.2.2",
|
package/test/interface/call.js
CHANGED
|
@@ -752,7 +752,7 @@ describe( "call object", function() {
|
|
|
752
752
|
} )
|
|
753
753
|
|
|
754
754
|
it( `uas.newuac - early callback is called`, async function() {
|
|
755
|
-
|
|
755
|
+
new srf.srfscenario( {} )
|
|
756
756
|
|
|
757
757
|
let options = {
|
|
758
758
|
"contact": "ourcontactstring",
|
|
@@ -768,7 +768,7 @@ describe( "call object", function() {
|
|
|
768
768
|
} )
|
|
769
769
|
|
|
770
770
|
it( `uas.newuac - confirmed callback is called`, async function() {
|
|
771
|
-
|
|
771
|
+
new srf.srfscenario( {} )
|
|
772
772
|
|
|
773
773
|
let options = {
|
|
774
774
|
"contact": "ourcontactstring",
|
|
@@ -784,7 +784,7 @@ describe( "call object", function() {
|
|
|
784
784
|
} )
|
|
785
785
|
|
|
786
786
|
it( `uas.newuac - simple update`, async function() {
|
|
787
|
-
|
|
787
|
+
new srf.srfscenario( {} )
|
|
788
788
|
|
|
789
789
|
let options = {
|
|
790
790
|
"contact": "ourcontactstring",
|
|
@@ -814,7 +814,7 @@ describe( "call object", function() {
|
|
|
814
814
|
} )
|
|
815
815
|
|
|
816
816
|
it( `uas.newuac - simple update - but don't allow as not in allow`, async function() {
|
|
817
|
-
|
|
817
|
+
new srf.srfscenario( {} )
|
|
818
818
|
|
|
819
819
|
let options = {
|
|
820
820
|
"contact": "ourcontactstring",
|
|
@@ -841,7 +841,7 @@ describe( "call object", function() {
|
|
|
841
841
|
} )
|
|
842
842
|
|
|
843
843
|
it( `Test listen and emit event on call object`, async function() {
|
|
844
|
-
|
|
844
|
+
new srf.srfscenario( {} )
|
|
845
845
|
|
|
846
846
|
let options = {
|
|
847
847
|
"contact": "ourcontactstring",
|
|
@@ -864,7 +864,7 @@ describe( "call object", function() {
|
|
|
864
864
|
} )
|
|
865
865
|
|
|
866
866
|
it( `Test listen and emit event on and removealllisteners call object`, async function() {
|
|
867
|
-
|
|
867
|
+
new srf.srfscenario( {} )
|
|
868
868
|
|
|
869
869
|
let options = {
|
|
870
870
|
"contact": "ourcontactstring",
|
|
@@ -890,7 +890,7 @@ describe( "call object", function() {
|
|
|
890
890
|
} )
|
|
891
891
|
|
|
892
892
|
it( `Test listen and emit event on and removealllisteners (none specified) call object`, async function() {
|
|
893
|
-
|
|
893
|
+
new srf.srfscenario( {} )
|
|
894
894
|
|
|
895
895
|
let options = {
|
|
896
896
|
"contact": "ourcontactstring",
|
|
@@ -916,7 +916,7 @@ describe( "call object", function() {
|
|
|
916
916
|
} )
|
|
917
917
|
|
|
918
918
|
it( `Test listen and emit event on and off call object`, async function() {
|
|
919
|
-
|
|
919
|
+
new srf.srfscenario( {} )
|
|
920
920
|
|
|
921
921
|
let options = {
|
|
922
922
|
"contact": "ourcontactstring",
|
|
@@ -944,7 +944,7 @@ describe( "call object", function() {
|
|
|
944
944
|
} )
|
|
945
945
|
|
|
946
946
|
it( `Test listen and emit event once call object`, async function() {
|
|
947
|
-
|
|
947
|
+
new srf.srfscenario( {} )
|
|
948
948
|
|
|
949
949
|
let options = {
|
|
950
950
|
"contact": "ourcontactstring",
|
|
@@ -968,7 +968,7 @@ describe( "call object", function() {
|
|
|
968
968
|
} )
|
|
969
969
|
|
|
970
970
|
it( `Test listen and emit call.pick on call object`, async function() {
|
|
971
|
-
|
|
971
|
+
new srf.srfscenario( {} )
|
|
972
972
|
|
|
973
973
|
let options = {
|
|
974
974
|
"contact": "ourcontactstring",
|
|
@@ -990,7 +990,7 @@ describe( "call object", function() {
|
|
|
990
990
|
} )
|
|
991
991
|
|
|
992
992
|
it( `Create a call and mock rtpengine and ensure we receive events`, async function() {
|
|
993
|
-
|
|
993
|
+
new srf.srfscenario( {} )
|
|
994
994
|
let rtpserver = callmanager.projectrtp.proxy.listen()
|
|
995
995
|
|
|
996
996
|
let connection = net.createConnection( 9002, "127.0.0.1" )
|
|
@@ -1072,4 +1072,32 @@ describe( "call object", function() {
|
|
|
1072
1072
|
connection.destroy()
|
|
1073
1073
|
rtpserver.destroy()
|
|
1074
1074
|
} )
|
|
1075
|
+
|
|
1076
|
+
it( `set get moh`, async function() {
|
|
1077
|
+
new srf.srfscenario( {} )
|
|
1078
|
+
|
|
1079
|
+
let options = {
|
|
1080
|
+
"contact": "ourcontactstring",
|
|
1081
|
+
"late": true
|
|
1082
|
+
}
|
|
1083
|
+
|
|
1084
|
+
let c = await call.newuac( options )
|
|
1085
|
+
|
|
1086
|
+
let s = {
|
|
1087
|
+
"loop": true,
|
|
1088
|
+
"files": [
|
|
1089
|
+
{ "wav": "some.wav" }
|
|
1090
|
+
]
|
|
1091
|
+
}
|
|
1092
|
+
|
|
1093
|
+
/* no default configured */
|
|
1094
|
+
expect( c.moh ).to.be.undefined
|
|
1095
|
+
c.moh = s
|
|
1096
|
+
|
|
1097
|
+
expect( c._moh.loop ).to.equal( true )
|
|
1098
|
+
expect( c.moh.loop ).to.equal( true )
|
|
1099
|
+
|
|
1100
|
+
c._onhangup( "wire" )
|
|
1101
|
+
|
|
1102
|
+
} )
|
|
1075
1103
|
} )
|