importfsfrom"node:fs";importprocessfrom"node:process";importtype{RtpPacket}from"werift-rtp";importSoftphonefrom"../src/index.js";constsoftphone=newSoftphone({outboundProxy:process.env.SIP_INFO_OUTBOUND_PROXY!,username:process.env.SIP_INFO_USERNAME!,password:process.env.SIP_INFO_PASSWORD!,authorizationId:process.env.SIP_INFO_AUTHORIZATION_ID!,domain:process.env.SIP_INFO_DOMAIN!,});softphone.enableDebugMode();// print all SIP messagesconstmain=async()=>{awaitsoftphone.register();// detect inbound callsoftphone.on("invite",async(inviteMessage)=>{// answer the callconstcallSession=awaitsoftphone.answer(inviteMessage);// send audio to remote peerconststreamer=callSession.streamAudio(fs.readFileSync('demos/test.wav'));// You may subscribe to the 'finished' event of the streamer to // know when the audio sending is finishedstreamer.once('finished',()=>{console.log('audio sending finished');});// you may pause/resume/stop audio sending at any time// streamer.pause();// streamer.resume();// streamer.stop();// streamer.start();});};main();