@@ -1238,20 +1238,48 @@ class Endpoint extends Emitter {
12381238
12391239 /**
12401240 * Pause sending audio over the websocket connection
1241+ * @param {string } [bugname] - bugname to pause
1242+ * @param {boolean } [silence] - whether to send silence frames while paused, only applied if bugname is specified
12411243 * @param {function } [callback] - callback invoked when api request completes
12421244 * @return {Promise|Endpoint } returns a Promise if no callback supplied; otherwise
12431245 * a reference to the Endpoint object
12441246 */
1245- forkAudioPause ( bugname , callback ) {
1247+ forkAudioPause ( bugname , silence , callback ) {
12461248 const args = [ this . uuid , 'pause' ] ;
1249+
12471250 if ( arguments . length === 1 ) {
1248- // If the function is called with 1 argument, could be bugname or callback.
12491251 if ( typeof bugname === 'function' ) {
1252+ //forkAudioPause(callback)
12501253 callback = bugname ;
12511254 bugname = null ;
1255+ silence = false ;
1256+ } else if ( typeof bugname === 'boolean' ) {
1257+ // forkAudioPause(silence)
1258+ silence = bugname ;
1259+ bugname = null ;
1260+ } else {
1261+ // forkAudioPause('my-bugname')
1262+ silence = false ;
12521263 }
1264+ } else if ( arguments . length === 2 ) {
1265+ if ( typeof silence === 'function' ) {
1266+ callback = silence ;
1267+ if ( typeof bugname === 'boolean' ) {
1268+ // forkAudioPause(true, callback)
1269+ silence = bugname ;
1270+ bugname = null ;
1271+ } else {
1272+ // forkAudioPause('my-bugname', callback)
1273+ silence = false ;
1274+ }
1275+ }
1276+ //forkAudioPause('my-bugname', true)
1277+ }
1278+ //forkAudioPause('my-bugname', true, callback)
1279+ if ( bugname ) {
1280+ args . push ( bugname ) ;
1281+ args . push ( silence ? 'silence' : 'blank' ) ;
12531282 }
1254- if ( bugname ) args . push ( bugname ) ;
12551283
12561284 const __x = ( callback ) => {
12571285 debug ( `calling uuid_audio_fork with args ${ JSON . stringify ( args ) } ` ) ;
0 commit comments