ESP32 suiteable as a VoIP phone?

schneida
Posts: 1
Joined: Fri May 04, 2018 5:07 pm

ESP32 suiteable as a VoIP phone?

Postby schneida » Fri May 04, 2018 5:53 pm

Hi guys,

I'm new to microcontrollers but a software engineer and I was wondering if the ESP32 was suitable as a VoIP phone / gateway. My idea was to:

* Buy a cheap phone that connects to POTS landline (provided to me free of charge by my cable modem provider)
* Wire up the ESP32 to the Headset of the phone, e.g. connect the Mic and Speaker to the ESP32
* Connect the hook to a GPIO of the ESP32
* Connect the ringer of the phone to another GPIO

Then in software I would like to:
* Detect the ringing and initiate a SIP call to my Asterisk PBX
* On pickup on the SIP side, toggle the hook GPIO so that the phone signals to the landline that the call should be established.
* Sample the audio from the phones speaker as input for a RTP stream to Asterisk (PCM)
* Provide the RTP stream from Asterisk to the Mic input of the phone

I'm familiar with SIP and RTP, I know a bit of C programming (from University) - these days I'm almost exclusively Java and JavaScript, but hey challenge accepted! My weak point is the microcontroller part of the project as well as the electronics.

For the microcontroller stuff I already made some experiments with RTP streams, which worked kind of OK given I only spent an hour with my ESP32 until now. I was thinking about using FreeRTOS to have multiple tasks for listening to SIP and relaying the audio / RTP streams. Do you think the ESP32 has the power to do that?

However I'm not so sure about the electronics part. I saw sample projects of people using the ESP32 to record audio or to playback audio. I'm not sure if they are doing it "manually" or using the I2S bus which as far as I understand can be connected directly to GPIOs to have analog audio with very limited CPU involvement. Audio quality is of course an issue, so I tend to think buying some kind of amplifier which does all the filtering and stuff for me, any suggestions for hardware?

What do you think about it, is the ESP32 suitable for this job, or should I rather give it a try with e.g. a Raspbery Zero (which sadly also doesn't have a standard audio Jack, but at least is a lot faster).

Thanks - feedback is highly appreciated!

mikemoy
Posts: 599
Joined: Fri Jan 12, 2018 9:10 pm

Re: ESP32 suiteable as a VoIP phone?

Postby mikemoy » Sat May 05, 2018 3:22 pm

Funny, you should bring this up. A month ago i just finished a VoIP phone project for a client.
I did try the RPI way first. You can use one of these to help with the audio in/out for testing your code, then later use the IC in there on your own board. https://www.amazon.com/gp/product/B001M ... UTF8&psc=1

I had 2 issues that I was not happy with concerning the RPI. They don't have a locking mechanism for the uSD anymore. So for any real product IMHO its useless. The second (which may be my limited knowledge of embedded Linux) was that customers will not respect the fact that we need to perform a shutdown request before powering it off. They will just yank the power, and thus there is the possibility to corrupt the filesystem.

I think it would be awesome if one could do it on the ESP32. The ESP32-WROVER has plenty of ram for the task. My question for you is what codec implementation are you going to use? I would imagine G.711. I am more a hardware guy than software, so you might be magnitudes better at programming than I, but I looked briefly into doing this on a micro, and the SIP stack software was quite HUGE.
From what I have learned doing SIP and playing with the ESP32, I cannot see any reason the ESP32 does not have enough H.P. to do what you want. I am not sure though if say you plan on implementing another codec style like say G.729 where you have to do all that in software.

At the end of the day I wound up using a IC by OKI (ML7204-001) for my project, to my micro.

At the end of the day, if its for yourself only, then i would say ESP32 can handle it with no problems. But, if this is for a commercial use then I would be interested in how you might handle the other codec styles because you know customers they want everything under the hood :D

Scaevola
Posts: 2
Joined: Wed May 08, 2019 7:23 pm

Re: ESP32 suiteable as a VoIP phone?

Postby Scaevola » Thu May 09, 2019 11:23 am

Hello,
sorry to dig up this thread, but I was curious, did you manage to run the project you wrote about above.
Few days ago we came up with an idea with my friend from youth days to establish a hotline between us. Well, we live now a bit far from each other (about 300km) so it's not that easy. Of course we can call on the cellphones, but the idea is to have fun designing this :) We are both IoT enthusiasts so we decided that it would be nice to rebuild some retro POTS phones and insert a VOIP gateway inside, based on ESP32.

I know that's much or less re-inventing the voip gateway, but whatever. At least we learn something new about telephone protocols.

mikemoy
Posts: 599
Joined: Fri Jan 12, 2018 9:10 pm

Re: ESP32 suiteable as a VoIP phone?

Postby mikemoy » Thu May 09, 2019 12:19 pm

Take a look a this. Its built around the ESP32

https://www.kickstarter.com/projects/21 ... 183f6b4e9d

Scaevola
Posts: 2
Joined: Wed May 08, 2019 7:23 pm

Re: ESP32 suiteable as a VoIP phone?

Postby Scaevola » Thu May 09, 2019 12:52 pm

Yes, I have seen that project, it's quite interesting, but I am interested what is under the hood ;) They say they are going to publish the sources after the phone will be released.

mohitsadan
Posts: 1
Joined: Fri Nov 17, 2023 10:38 am

Re: ESP32 suiteable as a VoIP phone?

Postby mohitsadan » Fri Nov 17, 2023 10:43 am

Have anyone accomplished any success in this project?

Who is online

Users browsing this forum: No registered users and 160 guests