@babblevoice/babble-drachtio-callmanager 1.6.16 → 1.6.18

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 CHANGED
@@ -1010,7 +1010,9 @@ class call {
1010
1010
  channeldef = call._createchannelremotedef( target.address, target.port, target.audio.payloads[ 0 ] )
1011
1011
  }
1012
1012
 
1013
- this.channels.audio = await projectrtp.openchannel( channeldef, this._handlechannelevents.bind( this ) )
1013
+ const other = this.other
1014
+ if( other && other.channels.audio ) this.channels.audio = await other.channels.audio.openchannel( channeldef, this._handlechannelevents.bind( this ) )
1015
+ else this.channels.audio = await projectrtp.openchannel( channeldef, this._handlechannelevents.bind( this ) )
1014
1016
 
1015
1017
  this.sdp.local = sdpgen.create()
1016
1018
  .addcodecs( this.selectedcodec )
@@ -1022,7 +1024,7 @@ class call {
1022
1024
  }
1023
1025
 
1024
1026
  if( this._iswebrtc ) {
1025
- let ch = this.channels.audio
1027
+ const ch = this.channels.audio
1026
1028
  this.sdp.local.addssrc( ch.local.ssrc )
1027
1029
  .secure( ch.local.dtls.fingerprint, channeldef.remote.dtls.mode )
1028
1030
  .addicecandidates( ch.local.address, ch.local.port, ch.local.icepwd )
@@ -2548,7 +2550,8 @@ class call {
2548
2550
  if( newcall.options.late ) {
2549
2551
  newcall.options.noAck = true /* this is a MUST for late negotiation */
2550
2552
  } else {
2551
- newcall.channels.audio = await projectrtp.openchannel( newcall._handlechannelevents.bind( newcall ) )
2553
+ if( options.parent && options.parent.channels.audio ) newcall.channels.audio = await options.parent.channels.audio.openchannel( newcall._handlechannelevents.bind( newcall ) )
2554
+ else newcall.channels.audio = await projectrtp.openchannel( newcall._handlechannelevents.bind( newcall ) )
2552
2555
 
2553
2556
  newcall.sdp.local = sdpgen.create().addcodecs( newcall.options.preferedcodecs )
2554
2557
  newcall.sdp.local.setaudioport( newcall.channels.audio.local.port )
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@babblevoice/babble-drachtio-callmanager",
3
- "version": "1.6.16",
3
+ "version": "1.6.18",
4
4
  "description": "Call processing to create a PBX",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -1020,7 +1020,7 @@ describe( "call object", function() {
1020
1020
 
1021
1021
  it( `Create a call and mock rtpengine and ensure we receive events`, async function() {
1022
1022
  new srf.srfscenario( {} )
1023
- let rtpserver = callmanager.projectrtp.proxy.listen()
1023
+ let rtpserver = await callmanager.projectrtp.proxy.listen()
1024
1024
 
1025
1025
  let connection = net.createConnection( 9002, "127.0.0.1" )
1026
1026
  .on( "error", ( e ) => {
@@ -1041,13 +1041,13 @@ describe( "call object", function() {
1041
1041
  setTimeout( () => connection.write( projectrtpmessage.createmessage( {"local":{"port":10008,"dtls":{"fingerprint":"Some fingerprint","enabled":false},"address":"192.168.0.141"},"id": msg.id, "uuid":"6d8ba7bb-44b9-4989-9aaf-5d938b496c49","action":"open","status":{"channel":{"available":4995,"current":5},"workercount":12,"instance":"ca0ef6a9-9174-444d-bdeb-4c9eb54d5c94"}} ) ), 2 )
1042
1042
  } else if( "close" == msg.channel ) {
1043
1043
  connection.write( projectrtpmessage.createmessage( {"id": msgid,"uuid":"6d8ba7bb-44b9-4989-9aaf-5d938b496c49","action":"record","file":"/tmp/voicemail/recording/03039cdb-1949-407d-91d6-15ba6894955c.wav","event":"finished.channelclosed","filesize":160684,"emailed":true,"transcription":"test recording for voicemail","status":{"channel":{"available":4995,"current":5},"workercount":12,"instance":"ca0ef6a9-9174-444d-bdeb-4c9eb54d5c94"}} ) )
1044
- connection.write( projectrtpmessage.createmessage( {"id": msgid,"uuid":"6d8ba7bb-44b9-4989-9aaf-5d938b496c49","action":"close","reason":"requested","stats":{"in":{"mos":4.5,"count":586,"dropped":0,"skip":0},"out":{"count":303,"skip":0},"tick":{"meanus":124,"maxus":508,"count":597}}} ) )
1044
+ connection.write( projectrtpmessage.createmessage( {"id": msgid,"uuid":"6d8ba7bb-44b9-4989-9aaf-5d938b496c49","action":"close","reason":"requested","stats":{"in":{"mos":4.5,"count":586,"dropped":0,"skip":0},"out":{"count":303,"skip":0},"tick":{"meanus":124,"maxus":508,"count":597}},"status":{"channel":{"available":4995,"current":5},"workercount":12,"instance":"ca0ef6a9-9174-444d-bdeb-4c9eb54d5c94"}} ) )
1045
1045
  }
1046
1046
  } )
1047
1047
  } )
1048
1048
 
1049
1049
  /* ensure we are connected */
1050
- await new Promise( ( r ) => setTimeout( () => r(), 100 ) )
1050
+ await new Promise( ( resolve ) => setTimeout( () => resolve(), 100 ) )
1051
1051
 
1052
1052
  /* this flow mimicks the flow associated with a voicemail being left */
1053
1053
  let c = await call.newuac( {
@@ -1062,7 +1062,6 @@ describe( "call object", function() {
1062
1062
  expect( ev.event ).to.equal( "end" )
1063
1063
  expect( ev.reason ).to.equal( "completed" )
1064
1064
 
1065
-
1066
1065
  setTimeout( () => connection.write( projectrtpmessage.createmessage( {"id": msgid,"uuid":"6d8ba7bb-44b9-4989-9aaf-5d938b496c49","action":"play","event":"start","reason":"new","status":{"channel":{"available":4995,"current":5},"workercount":12,"instance":"ca0ef6a9-9174-444d-bdeb-4c9eb54d5c94"}} ) ) )
1067
1066
  setTimeout( () => connection.write( projectrtpmessage.createmessage( {"id": msgid,"uuid":"6d8ba7bb-44b9-4989-9aaf-5d938b496c49","action":"play","event":"end","reason":"completed","status":{"channel":{"available":4995,"current":5},"workercount":12,"instance":"ca0ef6a9-9174-444d-bdeb-4c9eb54d5c94"}} ) ) )
1068
1067
  c.channels.audio.play( { "files": [ { "wav": "/voicemail/boing.wav", "alt": "" } ] } )
@@ -1071,7 +1070,6 @@ describe( "call object", function() {
1071
1070
  expect( ev.event ).to.equal( "end" )
1072
1071
  expect( ev.reason ).to.equal( "completed" )
1073
1072
 
1074
-
1075
1073
  setTimeout( () => connection.write( projectrtpmessage.createmessage( {"id": msgid,"uuid":"6d8ba7bb-44b9-4989-9aaf-5d938b496c49","action":"record","file":"/tmp/voicemail/recording/03039cdb-1949-407d-91d6-15ba6894955c.wav","event":"recording","status":{"channel":{"available":4995,"current":5},"workercount":12,"instance":"ca0ef6a9-9174-444d-bdeb-4c9eb54d5c94"}} ) ), 5 )
1076
1074
 
1077
1075
  c.channels.audio.record( {
@@ -1099,7 +1097,7 @@ describe( "call object", function() {
1099
1097
  expect( ev.filesize ).to.equal( 160684 )
1100
1098
 
1101
1099
  connection.destroy()
1102
- rtpserver.destroy()
1100
+ await rtpserver.destroy()
1103
1101
  } )
1104
1102
 
1105
1103
  it( `set get moh`, async function() {
@@ -64,7 +64,7 @@ describe( "callmanager", function() {
64
64
  "srf": { "use": ( method, asynccb ) => {} }
65
65
  }
66
66
 
67
- let rtpserver = callmanager.projectrtp.proxy.listen()
67
+ let rtpserver = await callmanager.projectrtp.proxy.listen()
68
68
  let c = await callmanager.callmanager( options )
69
69
 
70
70
  let closing = false
@@ -38,7 +38,7 @@ describe( "call early", function() {
38
38
 
39
39
  /* Setup the mock RTP server */
40
40
  let srfscenario = new srf.srfscenario()
41
- let rtpserver = callmanager.projectrtp.proxy.listen()
41
+ let rtpserver = await callmanager.projectrtp.proxy.listen()
42
42
 
43
43
  let connection = net.createConnection( 9002, "127.0.0.1" )
44
44
  .on( "error", ( e ) => {
@@ -87,7 +87,8 @@ describe( "call early", function() {
87
87
  }
88
88
  opencount++
89
89
  } else if ( "close" === msg.channel ) {
90
- connection.write( projectrtpmessage.createmessage( {"id": msg.id,"uuid":msg.uuid,"action":"close","reason":"requested","stats":{"in":{"mos":4.5,"count":586,"dropped":0,"skip":0},"out":{"count":303,"skip":0},"tick":{"meanus":124,"maxus":508,"count":597}}} ) )
90
+ connection.write( projectrtpmessage.createmessage( {"id": msg.id,"uuid":msg.uuid,"action":"close","reason":"requested","stats":{"in":{"mos":4.5,"count":586,"dropped":0,"skip":0},"out":{"count":303,"skip":0},"tick":{"meanus":124,"maxus":508,"count":597}}, "status":{"channel":{"available":4995,"current":5},"workercount":12,"instance":"ca0ef6a9-9174-444d-bdeb-4c9eb54d4566"}
91
+ } ) )
91
92
  } else if ( "mix" === msg.channel ) {
92
93
  mixing = true
93
94
  }
@@ -175,7 +176,7 @@ a=sendrecv`.replace(/(\r\n|\n|\r)/gm, "\r\n")
175
176
 
176
177
  /* Setup the mock RTP server */
177
178
  let srfscenario = new srf.srfscenario( { savpf: true } )
178
- let rtpserver = callmanager.projectrtp.proxy.listen()
179
+ let rtpserver = await callmanager.projectrtp.proxy.listen()
179
180
 
180
181
  let connection = net.createConnection( 9002, "127.0.0.1" )
181
182
  .on( "error", ( e ) => {
@@ -224,7 +225,7 @@ a=sendrecv`.replace(/(\r\n|\n|\r)/gm, "\r\n")
224
225
  }
225
226
  opencount++
226
227
  } else if ( "close" === msg.channel ) {
227
- connection.write( projectrtpmessage.createmessage( {"id": msg.id,"uuid":msg.uuid,"action":"close","reason":"requested","stats":{"in":{"mos":4.5,"count":586,"dropped":0,"skip":0},"out":{"count":303,"skip":0},"tick":{"meanus":124,"maxus":508,"count":597}}} ) )
228
+ connection.write( projectrtpmessage.createmessage( {"id": msg.id,"uuid":msg.uuid,"action":"close","reason":"requested","stats":{"in":{"mos":4.5,"count":586,"dropped":0,"skip":0},"out":{"count":303,"skip":0},"tick":{"meanus":124,"maxus":508,"count":597}}, "status":{"channel":{"available":4995,"current":5},"workercount":12,"instance":"ca0ef6a9-9174-444d-bdeb-4c9eb54d4566"}}))
228
229
  } else if ( "mix" === msg.channel ) {
229
230
  mixing = true
230
231
  }
@@ -328,7 +329,7 @@ a=sendrecv`.replace(/(\r\n|\n|\r)/gm, "\r\n")
328
329
 
329
330
  /* Setup the mock RTP server */
330
331
  let srfscenario = new srf.srfscenario( { savpf: true } )
331
- let rtpserver = callmanager.projectrtp.proxy.listen()
332
+ let rtpserver = await callmanager.projectrtp.proxy.listen()
332
333
 
333
334
  let connection = net.createConnection( 9002, "127.0.0.1" )
334
335
  .on( "error", ( e ) => {
@@ -377,7 +378,7 @@ a=sendrecv`.replace(/(\r\n|\n|\r)/gm, "\r\n")
377
378
  }
378
379
  opencount++
379
380
  } else if ( "close" === msg.channel ) {
380
- connection.write( projectrtpmessage.createmessage( {"id": msg.id,"uuid":msg.uuid,"action":"close","reason":"requested","stats":{"in":{"mos":4.5,"count":586,"dropped":0,"skip":0},"out":{"count":303,"skip":0},"tick":{"meanus":124,"maxus":508,"count":597}}} ) )
381
+ connection.write( projectrtpmessage.createmessage( {"id": msg.id,"uuid":msg.uuid,"action":"close","reason":"requested","stats":{"in":{"mos":4.5,"count":586,"dropped":0,"skip":0},"out":{"count":303,"skip":0},"tick":{"meanus":124,"maxus":508,"count":597}}, "status":{"channel":{"available":4995,"current":5},"workercount":12,"instance":"ca0ef6a9-9174-444d-bdeb-4c9eb54d4566"}} ) )
381
382
  } else if ( "mix" === msg.channel ) {
382
383
  mixing = true
383
384
  }