通过 VoIP 播放音频文件

发布于 2024-10-15 01:12:41 字数 187 浏览 9 评论 0原文

我想实现一个简单的VoIP系统,可以实现以下功能:

  1. 用户上传 mp3 或 wav 文件并提供电话号码。
  2. 拨打给定的电话号码,拿起电话后,就会播放上传的 mp3/wav 文件。一旦播放完整个文件,呼叫就会挂断。

我想知道是否有任何开源库支持这个?或者我可以使用一个开源软件来实现这一点?

I want to implement a simple VoIP system which can achieve following;

  1. The user uploads a mp3 or wav file and gives a phone number.
  2. the given phone number is dialed, when the phone is picked, the uploaded mp3/wav file is played. once the whole file is played, the call is hung up.

i want to know if there is any opensource library which supports this?? or an opensource software using which i can achieve this?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

岁月打碎记忆 2024-10-22 01:12:41

我为我的工作做了类似的测试。

  1. 在办公室的盒子上有一个使用 Freeswitch 的测试框架,并且我在 FreeSWITCH 盒子上创建了一些带有密码的用户。
  2. 然后我使用 sip 测试工具/客户端来管理与另一个用户的 sip 代理的连接。

例如...假设我的 freeswitch 是 ip: 120.0.0.7

我正在该 freeswitch 上注册为用户 5000,并且我想呼叫也已注册的用户 4000。

我使用 SIPP (linux)SIPCLI (windows)

SIPP

SIPP 的优点在于它真正强大并且可以执行多种操作性能测试等等。但是发送音频有点具有挑战性,但它是可行的。您基本上是在某些编解码器(g711、g729 等)中发送录制音频的 pcap,因此您运行如下命令:

sudo sipp -s [the phone number/ user] [your freeswitch] -sn uac_pcap -mi [your ip] -l 1 -m 1

最后两个参数(l 和 m)设置多少负载,默认情况下 sipp 将每秒发送 10 个调用。你可能不想要那样。所以 l 说“将调用限制为 #”,而 m 说“一次只运行 x 个调用”。

SIPCLI

更简单的方法是 sipcli (但它是一个仅限 Windows 的工具。)
在 sipcli 中,您基本上可以发送 wav 文件以及文本转语音。我喜欢它。它有一个内置的库,可以拨打号码,您可以传递类似 -t “这是用于 sip 和 voip 测试的测试工具的测试”。它会在通话时将其转换为音频。您还可以构建指向您录制的 wav 文件的场景...

SIPCLI 将使用像 SIPP 这样的命令进行连接:

sipcli [user/phone number] -d [domain or proxy] -t "This is text i want converted to speech on the phone call" 

您还可以传递指向 wav 的链接。

sipcli 还可以发送 dtmf 音调,或者您可以指向 dtmf 音调的 wav。

场景编辑器一开始有点复杂,需要一些时间来适应。但一旦掌握了制作场景文件的窍门,一切就变得非常简单。

SIPP 的优点

SIPP 可以捕获性能指标(配置的起点和终点之间的总时间(以毫秒为单位))
SIPP 可以在您想要的终端拨打数千个呼叫
SIPP 可以即时增加或减少呼叫量
SIPP可以生成统计数据和csv文件进行分析
您编写的 SIPP 场景正在构建数据包本身。因此,您可以更好地控制数据包在 INVITE 上发送的内容。
SIPP 是开源

SIPP 的缺点

SIPP 无法发送 wav 文件
SIPP 无法生成它自己的 dtmf 音调(它使用 pcap,这可能会出现问题)
SIPP 无法生成文本转语音
SIPP 上手有些复杂

SIPCLI 的优点

SIPCLI 可以即时将文本转换为语音
SIPCLI 可以使用录制的 wav 发送给收件人
SIPCLI 易于使用
SIPCLI 还可以充当接收器(即 IVR 播放问候语并接受输入)
SIPCLI 有一些逻辑来验证接收到的数据(例如用户按 #3,然后按 #4。)

SIPCLI 的否定

SIPCLI 不允许您访问它发送的 SIP 标头(因此对 SIP 标头的控制较少)测试)
SIPCLI 不执行负载或性能指标
SIPCLI的编辑器一开始有点难,但并不像学习SIPP的高级功能那么难
SIPCLI 不是开源的......它的试用版有 90% 有用。要获得另外 10%(更长的通话时间),您需要以 70 美元购买。

我还尝试过其他工具,例如 PJSua,但这两个工具是我用来测试您正在谈论的场景的面包和黄油。

关于框架/softwsitch/代理...我使用Freeswitch。

I do similar testing as this for my job.

I have

  1. a test framework on my box in my office using Freeswitch and I've created some users with passwords on the FreeSWITCH box.
  2. Then I use a sip testing tool / client to manage the connection to the sip proxy, to another user.

For example... say my freeswitch is ip: 120.0.0.7

I am registering on that freeswitch as user 5000 and i want to call user 4000 who is also registered.

I use either SIPP (linux) or SIPCLI (windows.)

SIPP

The benefits of SIPP is that it's truly robust and can do a myriad of performance testing, and what not. But ot send audio it's a bit challenging, but it's doable. you're basically sending pcap's of recorded audio in some codec (g711, g729, etc.) so you run a command like:

sudo sipp -s [the phone number/ user] [your freeswitch] -sn uac_pcap -mi [your ip] -l 1 -m 1

The last two parameters (l and m) set how much load, by default sipp will send 10calls per sec. you prob dont want that. so l says "limit the calls to #" and m says "only run x calls at a time."

SIPCLI

The much easier method is sipcli (but it's a windows only tool.)
In sipcli, you basically can send a wav file, as well as text to speech. I love it. it has a built in library that will dial the number and you could pass something like -t "This is a test of the test harness for sip and v o i p testing." it would convert that to audio on the call, on the fly. you can also build out scenarios that point to wav files you've recorded....

SIPCLI would use a command like SIPP to connect:

sipcli [user/phone number] -d [domain or proxy] -t "This is text i want converted to speech on the phone call" 

you could also pass in a link to a wav.

sipcli can also send dtmf tones, or you could point to wav's of dtmf tones.

the scenario editor is a bit complex at first, and takes a bit of getting used to. But once you get the hang of making scenario files, it's pretty easy.

Benefits of SIPP

SIPP can capture performance metrics (the over all time in ms between your configured start and end point)
SIPP can drive thousands of calls at your desired end
SIPP can ramp up calls or ramp them down on the fly
SIPP can generate statisics and csv files for analysis
SIPP scenarios you write are building the packets themselves. So you have more control over what your packet sends on the INVITE.
SIPP is open source

Negatives of SIPP

SIPP can NOT send a wav file
SIPP can NOT generate it's own dtmf tones (it uses pcaps, which can be problematic)
SIPP can NOT generate text to speech
SIPP is somewhat complicated to get going

Benefits of SIPCLI

SIPCLI can convert text to speech on the fly
SIPCLI can use recorded wav's to send to the recipient
SIPCLI is easy to use
SIPCLI can also act as a reciever (i.e. an IVR playing a greeting and taking input)
SIPCLI has some logic to validate data received (like user pressed #3, then #4.)

Negatives of SIPCLI

SIPCLI doesn't let you have access to the SIP headers it sends (so less control over the test)
SIPCLI doesn't do load or performance metrics
SIPCLI's editor is kinda difficult at first, but it's not as hard as learning SIPP's advanced features
SIPCLI is NOT opensource.... it's trial is 90% useful. To get the other 10% (longer phone calls) you need to purchase it at $70.

I've also tried other tools like PJSua, but these two are my bread and butter for testing the scenarios you are talking about.

Regarding the Framework/softwsitch/proxy... I use Freeswitch.

眼眸里的快感 2024-10-22 01:12:41

是的,您可以使用 Asterisk、Freeswitch(我个人的偏好)或许多与此类似的其他平台。

一旦你完成了 freeswitch 设置,请查看此链接以开始使用:
http://wiki.freeswitch.org/wiki/Javascript_QuickStart

Yes You can use Asterisk, Freeswitch ( My personal preference) Or a number of other platforms similar to this.

Once you have freeswitch setup, check out this link to get it going:
http://wiki.freeswitch.org/wiki/Javascript_QuickStart

注定孤独终老 2024-10-22 01:12:41

使用 ivrworx 进行简单测试

,请参阅流媒体示例。

use ivrworx for simple testing

see streamer example.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文