chrta/sip_call

Audio Support

Opened this issue · 10 comments

Hi,
having a look at the code, I thought that including audio should be the next stage :-) I tried to compile a list of tasks:

  • Basic audio encoding in PCMA or PCMU (codecs 0 and 8)
  • Parsing body for m=audio in sipPacket (provides IP port of receiver)
  • providing adequat answer in send_sip_ack()
  • Processing incoming voice in rtp_task()
  • Determine IP address of recipient
  • Start task that sends audio to port/IP (SIP server and SIP receiver are not the same in all scenarios)

Have I missed something? I tried the audio encoding and think that one is there. I'm missing a good way to determine the IP adress of the receiver.

The IP and port number for RTP audio of the calling/called party is part of the information found in the INVITE packet. Take a look at a breakdown of it's anatomy here

In particular, you'll need the "media descriptor" (m=<media> <port> <proto> <fmt>) to determine what port to send RTP audio on. The IP to send RTP audio to is specified by the "connection information" SDP field (c=IN IP4 10.101.6.120)

chrta commented

Accepting pull requests...

i think major question is how much ram is available now.
russian guys tried to port pjsip to stm32 with 192k ram and after a lot of pain did that.
major issue - not enough ram. after some rework they make it working within 150k ram + they have some ram for app/logic.
try google translate on this article https://habr.com/company/embox/blog/259721/

My first thought on this was much in line with the g711 approach. Using

http://web.mit.edu/audio/src/build/i386_linux2/sox-11gamma-cb/g711.c

and a reference project for audio streaming (https://www.hackster.io/julianfschroeter/esp32-voice-streamer-52bd7e) provides a first running system which is able to do PCMA and PCMU.

Here is my a bit primitive audio implementation on this project.

ESP32 simple VoIP phone based on SPH0645 mic and UDA1334A decoder

chrta commented

@sikorapatryk Great, thank you. I will have a look at it. Which hardware did you use? Some board that is readily available?

Edit: added strike-through

Hi....If it could receive and send audio and DTMF encode and decode, I can help the project with some money, my intention is transform an Analog Intercom with Keypad into an IP SIP INTERCOM simply adding an ESP32. I think ESP32 has ADC that can do G711 encoding. We can add too, an client for an RTSP stream (h264) and send together with media packet to SIP Server.
If anyone have time to do it, please talk to me.
my email ale.trevizoli@gmail.com

Here is my a bit primitive audio implementation on this project.

ESP32 simple VoIP phone based on SPH0645 mic and UDA1334A decoder

@sikorapatryk Hi, Patryk. I get error when I try to compile yours project. I get undefined reference to 'app_main'. Can you help me to build yours project

@sikorapatryk Hi, Patryk! Your sip-call project on github does not have CMakeList.txt files in the main folder and in all components. Can you add them to the repository and push it?