fAuernigg / esp-baresip

A baresip component of esp-idf for esp32.
BSD 3-Clause "New" or "Revised" License
7 stars 4 forks source link

User Guide #3

Open sosaucily opened 4 years ago

sosaucily commented 4 years ago

Hey guys,

So generally I'm pretty new to Baresip, and maybe that's why I'm struggling a bit. That said, this looks like a nice, clean implementation and I'm excited to get to know things better.

Can you point me in the right direction a bit for now? I see in esp-baresip.cpp there are two functions that seem to do most of the heavy lifting: re_main(signal_handler); in baresip_main, which is running in the task. & sipHandleCommand which seems to accept json requests, but I'm not sure what or from where.

I'm looking to let my esp32 board call out to another client, using sip.antisip.com server, when certain events happen in my main esp32 logic. Basically letting my esp32 call out via SIP sometimes.

Can you provide some advice as to how I could do this? Thanks!

sosaucily commented 4 years ago

I've made some progress today. I was able to get the esp32 device to call out to another client on the hosted service. It's crashing in the end, likely with some i2s errors. It could be that my audio pipelines aren't set up on the board, perhaps?

I'll search more tomorrow, but here's my log so far in case you have some time and anything here looks familiar.

sipPhoneInit stack size = 16384I (4546) esp-baresip: sipPhoneInit stack size = 16384
I (4546) esp-baresip: Entered baresip thread
I (4546) esp-baresip: Baresip initialization done
call: alloc with params laddr=192.168.0.118, af=AF_INET, use_rtp=1
I (4566) esp-baresip: call: alloc with params laddr=192.168.0.118, af=AF_INET, use_rtp=1

call: use_video=0
I (4576) esp-baresip: call: use_video=0

call: connecting to 'sip:user+3@91.121.30.149'..
I (4576) esp-baresip: call: connecting to 'sip:user+3@91.121.30.149'..

call: SIP Progress: 100 trying -- your call is important to us (/)
I (5056) esp-baresip: call: SIP Progress: 100 trying -- your call is important to us (/)

call: SIP Progress: 180 Ringing (/)
I (5366) esp-baresip: call: SIP Progress: 180 Ringing (/)

play: /usr/share/baresip/ringback.wav: No such file or directory
I (5386) esp-baresip: play: /usr/share/baresip/ringback.wav: No such file or directory

ua event: CALL_RINGING
call: got SDP answer (359 bytes)
I (9676) esp-baresip: call: got SDP answer (359 bytes)

call: update media
I (9676) esp-baresip: call: update media

stream: update 'audio'
I (9696) esp-baresip: stream: update 'audio'

stream: audio: starting RTCP with remote 91.121.30.149:43473
I (9696) esp-baresip: stream: audio: starting RTCP with remote 91.121.30.149:43473

audio: Set audio decoder: PCMU 8000Hz 1ch
I (9706) esp-baresip: audio: Set audio decoder: PCMU 8000Hz 1ch

audio: start
I (9726) esp-baresip: audio: start

i2s_start_bus start with _i2s_on=1I (9726) esp-baresip: i2s_start_bus start with _i2s_on=1
E (9736) I2S: Register I2S Interrupt error
i2s: could not install i2s driver (ESP_ERR_NOT_FOUND)I (9736) esp-baresip: i2s: could not install i2s driver (ESP_ERR_NOT_FOUND)
audio: start_player failed (.): Invalid argument
I (9756) esp-baresip: audio: start_player failed (.): Invalid argument

audio: Set audio encoder: PCMU 8000Hz 1ch
I (9766) esp-baresip: audio: Set audio encoder: PCMU 8000Hz 1ch

audio: start
I (9776) esp-baresip: audio: start

i2s_start_bus start with _i2s_on=1I (9776) esp-baresip: i2s_start_bus start with _i2s_on=1
i2s_play_alloc starting play thread
I (9786) esp-baresip: i2s_play_alloc starting play thread

E (9796) I2S: Not initialized yet
i2s: playbGuru Meditation Error: Core  1 panic'ed (LoadProhibited). Exception was unhandled.
Core 1 register dump:
PC      : 0x400fdf9b  PS      : 0x00060f30  A0      : 0x80123454  A1      : 0x3fff1d80  
0x400fdf9b: i2s_write at ~/esp/esp-idf/components/driver/i2s.c:1294

A2      : 0x00000000  A3      : 0x3fff0ff8  A4      : 0x00000280  A5      : 0x3fff1dc0  
A6      : 0xffffffff  A7      :
sosaucily commented 4 years ago

In the esp adf voip example application, they have a big state machine that the developer is able to leverage in the callback. I'm not sure where to find something like this with BareSip client. Any advice?

https://github.com/espressif/esp-adf/blob/master/examples/advanced_examples/voip/main/voip_app.c#L182