Git Product home page Git Product logo

Comments (6)

TempoTian avatar TempoTian commented on August 28, 2024 1

I have checked the log seems the issue is caused by second invite response not contain sdp body, I have build one version with response with sdp also when reply after connection build, you can have a try. I just upload the version for ESP32, you can replace it to folder https://github.com/espressif/esp-adf-libs/tree/master/esp_media_protocols/lib/esp32.
libesp_media_protocols.zip

from esp-adf.

TempoTian avatar TempoTian commented on August 28, 2024 1

Thanks for you investigation. I have fixed the issue you mentioned, please help to try if OK we will merge it
esp_media_protocol.zip

from esp-adf.

carlosrodridel avatar carlosrodridel commented on August 28, 2024

I have checked the log seems the issue is caused by second invite response not contain sdp body, I have build one version with response with sdp also when reply after connection build, you can have a try. I just upload the version for ESP32, you can replace it to folder https://github.com/espressif/esp-adf-libs/tree/master/esp_media_protocols/lib/esp32. libesp_media_protocols.zip

Hi,

Thank you for the quick response and for providing the updated version.

I have tested the solution and observed in Wireshark that the ESP32 is now responding to the INVITE SDP messages with the corresponding 200 OK SDP messages. However, I'm still receiving more INVITE messages from the server. This indicates that there might be something missing or incorrect in the response message from the ESP32.

Screenshot 2024-06-18 at 17 06 56

I will continue to perform tests to identify the exact issue and will post a new comment with my findings as soon as possible.

Thanks again for your assistance.

from esp-adf.

carlosrodridel avatar carlosrodridel commented on August 28, 2024

Hi @TempoTian ,

I have completed the necessary tests and have some findings to share.

Using a Python VoIP library, I reproduced the OK SDP replies that the ESP32 is sending to the server to debug the SIP packets. Here are my analysis and conclusions:

Analysis of Frames Replicating ESP32 Behavior:

image

INVITE SDP from Server:

INVITE sip:[email protected]:5060;transport=udp SIP/2.0
Call-ID: [email protected]
Contact: <sip:XX.XXX.XXX.XXX:5060>
Content-Type: application/sdp
CSeq: 1992890617 INVITE
From: "+33XXXXXXXXX" <sip:[email protected];user=phone>;tag=07739-HP-e9e0fd69-5378e1814
Max-Forwards: 29
Record-Route: <sip:XX.XXX.XXX.XXX:5060;lr>;session=467403
To: <sip:[email protected];user=phone>
Via: SIP/2.0/UDP XX.XXX.XXX.XXX:5060;branch=z9hG4bK-OHOR-13ec59b9-147ba413
Allow: REFER,INVITE,NOTIFY,ACK,UPDATE,OPTIONS,REGISTER,SUBSCRIBE,NOTIFY,CANCEL,BYE,PRACK
User-Agent: Cirpack/v4.76 (gw_sip)
Content-Length: 323

v=0
o=anonymous 171932821733 171932821733 IN IP4 XX.XXX.XXX.XXX
s=SIP Call
c=IN IP4 91.121.129.155
t=0 0
m=audio 36700 RTP/AVP 8 0 18 101
b=AS:82
a=rtpmap:8 PCMA/8000/1
a=rtpmap:0 PCMU/8000/1
a=rtpmap:18 G729/8000/1
a=fmtp:18 annexb=no
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-15
a=ptime:20
a=sendrecv

First 200 OK SDP:

SIP/2.0 200 OK
Via: SIP/2.0/UDP XX.XXX.XXX.XXX:5060;branch=z9hG4bK-OHOR-13ec59b9-147ba413
Record-Route: <sip:XX.XXX.XXX.XXX:5060;lr>;session=467403
From: "+33XXXXXXXXX" <sip:[email protected];user=phone>;tag=07739-HP-e9e0fd69-5378e1814
To: <sip:[email protected];user=phone>;tag=-1239239399
Call-ID: [email protected]
CSeq: 1992890617 INVITE
Server: ESP32 SIP/2.0
Contact: <sip:[email protected]:5060;transport=UDP>
Allow: INVITE, ACK, BYE, CANCEL, UPDATE, OPTIONS, INFO
Content-Type: application/sdp
Content-Length: 153

v=0
o=Z 0 3 IN IP4 192.168.2.6
s=Z
t=0 0
c=IN IP4 192.168.2.6
m=audio 31952 RTP/AVP 8 101
a=rtpmap:8 PCMA/8000
a=rtpmap:101 telephone-event/8000

Second INVITE SDP from Server:


INVITE sip:[email protected]:5060;transport=udp SIP/2.0
Call-ID: [email protected]
Contact: <sip:XX.XXX.XXX.XXX:5060>
Content-Type: application/sdp
CSeq: 1992890618 INVITE
From: "+33XXXXXXXXX" <sip:[email protected];user=phone>;tag=07739-HP-e9e0fd69-5378e1814
Max-Forwards: 29
Record-Route: <sip:XX.XXX.XXX.XXX:5060;lr>;session=467403
To: <sip:[email protected];user=phone>;tag=-1239239399
Via: SIP/2.0/UDP XX.XXX.XXX.XXX:5060;branch=z9hG4bK-JZSQ-13ec5dba-634a921c
Allow: REFER,INVITE,NOTIFY,ACK,UPDATE,OPTIONS,REGISTER,SUBSCRIBE,NOTIFY,CANCEL,BYE,PRACK
User-Agent: Cirpack/v4.76 (gw_sip)
Content-Length: 248

v=0
o=anonymous 171932821733 171932821734 IN IP4 XX.XXX.XXX.XXX
s=SIP Call
c=IN IP4 91.121.129.155
t=0 0
m=audio 36700 RTP/AVP 8 101
b=AS:82
a=rtpmap:8 PCMA/8000/1
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-15
a=ptime:20
a=sendrecv

Second 200 OK SDP Reply:

SIP/2.0 200 OK
Via: SIP/2.0/UDP XX.XXX.XXX.XXX:5060;branch=z9hG4bK-JZSQ-13ec5dba-634a921c
Record-Route: <sip:XX.XXX.XXX.XXX:5060;lr>;session=467403
From: "+33XXXXXXXXX" <sip:[email protected];user=phone>;tag=07739-HP-e9e0fd69-5378e1814
To: <sip:[email protected];user=phone>;tag=-1239239399;tag=-2004755355
Call-ID: [email protected]
CSeq: 1992890617 INVITE
Server: ESP32 SIP/2.0
Contact: <sip:[email protected]:5060;transport=UDP>
Allow: INVITE, ACK, BYE, CANCEL, UPDATE, OPTIONS, INFO
Content-Type: application/sdp
Content-Length: 153

v=0
o=Z 0 3 IN IP4 192.168.2.6
s=Z
t=0 0
c=IN IP4 192.168.2.6
m=audio 31952 RTP/AVP 8 101
a=rtpmap:8 PCMA/8000
a=rtpmap:101 telephone-event/8000

Issue Identified:
The ESP32 is sending an extra tag in the "To" Header, which causes the packet to not be recognized and acknowledged by the server. When the second tag is removed from this header, the server responds with an ACK, and the INVITE SDP requests stop As we see next :

Frame Analysis with Corrected "To" Header:

image

INVITE SDP from Server:

INVITE sip:[email protected]:5060;transport=udp SIP/2.0
Call-ID: [email protected]
Contact: <sip:XX.XXX.XXX.XXX:5060>
Content-Type: application/sdp
CSeq: 2003502912 INVITE
From: "+33XXXXXXXXX" <sip:[email protected];user=phone>;tag=02587-OF-ea6c106b-3ddada606
Max-Forwards: 29
Record-Route: <sip:XX.XXX.XXX.XXX:5060;lr>;session=225575
To: <sip:[email protected];user=phone>
Via: SIP/2.0/UDP XX.XXX.XXX.XXX:5060;branch=z9hG4bK-GNBF-175f9337-1fe841e0
Allow: REFER,INVITE,NOTIFY,ACK,UPDATE,OPTIONS,REGISTER,SUBSCRIBE,NOTIFY,CANCEL,BYE,PRACK
User-Agent: Cirpack/v4.76 (gw_sip)
Content-Length: 323

v=0
o=anonymous 171938964817 171938964817 IN IP4 XX.XXX.XXX.XXX
s=SIP Call
c=IN IP4 91.121.129.146
t=0 0
m=audio 36926 RTP/AVP 8 0 18 101
b=AS:82
a=rtpmap:8 PCMA/8000/1
a=rtpmap:0 PCMU/8000/1
a=rtpmap:18 G729/8000/1
a=fmtp:18 annexb=no
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-15
a=ptime:20
a=sendrecv

First 200 OK SDP:

SIP/2.0 200 OK
Via: SIP/2.0/UDP XX.XXX.XXX.XXX:5060;branch=z9hG4bK-GNBF-175f9337-1fe841e0
Record-Route: <sip:XX.XXX.XXX.XXX:5060;lr>;session=225575
From: "+33XXXXXXXXX" <sip:[email protected];user=phone>;tag=02587-OF-ea6c106b-3ddada606
To: <sip:[email protected];user=phone>;tag=-1239239399
Call-ID: [email protected]
CSeq: 2003502912 INVITE
Server: ESP32 SIP/2.0
Contact: <sip:[email protected]:5060;transport=UDP>
Allow: INVITE, ACK, BYE, CANCEL, UPDATE, OPTIONS, INFO
Content-Type: application/sdp
Content-Length: 153

v=0
o=Z 0 3 IN IP4 192.168.2.6
s=Z
t=0 0
c=IN IP4 192.168.2.6
m=audio 31952 RTP/AVP 8 101
a=rtpmap:8 PCMA/8000
a=rtpmap:101 telephone-event/8000

Second INVITE SDP from Server:

INVITE sip:[email protected]:5060;transport=udp SIP/2.0
Call-ID: [email protected]
Contact: <sip:XX.XXX.XXX.XXX:5060>
Content-Type: application/sdp
CSeq: 2003502913 INVITE
From: "+33XXXXXXXXX" <sip:[email protected];user=phone>;tag=02587-OF-ea6c106b-3ddada606
Max-Forwards: 29
Record-Route: <sip:XX.XXX.XXX.XXX:5060;lr>;session=225575
To: <sip:[email protected];user=phone>;tag=-1239239399
Via: SIP/2.0/UDP XX.XXX.XXX.XXX:5060;branch=z9hG4bK-RLJA-175f976a-4c0300ec
Allow: REFER,INVITE,NOTIFY,ACK,UPDATE,OPTIONS,REGISTER,SUBSCRIBE,NOTIFY,CANCEL,BYE,PRACK
User-Agent: Cirpack/v4.76 (gw_sip)
Content-Length: 248

v=0
o=anonymous 171938964817 171938964818 IN IP4 XX.XXX.XXX.XXX
s=SIP Call
c=IN IP4 91.121.129.146
t=0 0
m=audio 36926 RTP/AVP 8 101
b=AS:82
a=rtpmap:8 PCMA/8000/1
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-15
a=ptime:20
a=sendrecv

Second 200 OK SDP Reply:

SIP/2.0 200 OK
Via: SIP/2.0/UDP XX.XXX.XXX.XXX:5060;branch=z9hG4bK-RLJA-175f976a-4c0300ec
Record-Route: <sip:XX.XXX.XXX.XXX:5060;lr>;session=225575
From: "+33XXXXXXXXX" <sip:[email protected];user=phone>;tag=02587-OF-ea6c106b-3ddada606
To: <sip:[email protected];user=phone>;tag=-1239239399
Call-ID: [email protected]
CSeq: 2003502912 INVITE
Server: ESP32 SIP/2.0
Contact: <sip:[email protected]:5060;transport=UDP>
Allow: INVITE, ACK, BYE, CANCEL, UPDATE, OPTIONS, INFO
Content-Type: application/sdp
Content-Length: 153

v=0
o=Z 0 3 IN IP4 192.168.2.6
s=Z
t=0 0
c=IN IP4 192.168.2.6
m=audio 31952 RTP/AVP 8 101
a=rtpmap:8 PCMA/8000
a=rtpmap:101 telephone-event/8000

After making the correction, the server properly acknowledges the OK replies with an ACK and stops the continuous INVITE SDP requests.

Note on CSeq Number:
It was also observed that the ESP32 replies to the first INVITE SDP with the same CSeq number as the request, which is correct. However, for subsequent INVITE requests from the server, the CSeq increments while the ESP32 replies with the same CSeq as the first request. Currently, this is not causing any issues with the server's acceptance of the response, but it might be a potential issue with different servers in the future.

Finally, I would like to request this correction specifically for the ESP32-S3, as we are currently using a custom ESP32-S3 board to implement our solution. The Lyra Board was utilized solely for testing purposes.

Please let me know if there are any further steps or additional information required.

from esp-adf.

carlosrodridel avatar carlosrodridel commented on August 28, 2024

Thank you for the quick response and fix. I have tested the updated library on both the ESP32 and ESP32S3, and I can confirm that both are now working as expected. Thanks again for your help!

from esp-adf.

carlosrodridel avatar carlosrodridel commented on August 28, 2024

hi, @TempoTian Could you please remember to merge the fix once it's verified? Thank you!

from esp-adf.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.