1

I need to convert an audio file (any common format) into a rtp stream saved in a .pcap file with G.722 Codec.

The generated .pcap file will be sent with SIPp using:

<exec play_pcap_audio="g722.pcap"/>

I know it is possible to send also .wav file with the following command, if the .wav is correctly encoded:

<exec rtp_stream="g711.wav"/>

But seems that is not possible to encode a .wav with G722.

There are multiple solutions on the web and SO on how to convert a .pcap into an audio file, but I'm actually looking for the opposite.

Gsk
  • 2,929
  • 5
  • 22
  • 29

2 Answers2

1

Steps to convert wav audio to .pcap file:

  1. Split audio to 20 ms chunks
  2. Encode each chunk with G.722 encoder
  3. Create RTP header for each encoded chunk
  4. Save RTP stream to .pcap

I've never used SIPp, but if it can process encoded G.722 stream, then use ffmpeg for encoding:

ffmpeg -i sample.wav -ar 16000 -acodec g722 sample.g722
Kozyr
  • 201
  • 1
  • 7
  • Thank you for the answer, I am really confident in this answer. I need some time to test it out – Gsk Oct 23 '18 at 12:21
1

Get softphone supporting wav files as source and G.722 codec, make call with only G.722 enabled, capture RTP stream to pcap.

TMSZ
  • 695
  • 4
  • 5
  • This is an interesting workaround, but I can't find softphones able to send audio files, and I am not going to play the audio file and put the microphone near to the speaker (or am I?). Do you know some softphone that allows me to stream audio files? – Gsk Oct 23 '18 at 12:20
  • Some softphones with wav input: pjsua (cross platform), baresip (cross platform) , tSIP (Windows). For baresip or tSIP you may need to convert file first to mono, 16-bit PCM with 16k sampling (matching G.722), pjsua is more flexible. One quick solution working with any softphone would be also connecting signal to Line-In input with audio cable. – TMSZ Oct 23 '18 at 12:49