Summary:ASTERISK-26758: res_hep_pjsip: For WebRTC clients Asterisk insert same ip address in "source ip address" and "destination ip address" fields in HEP packets
Reporter:Max Norba (miralin)Labels:pjsip webrtc
Date Opened:2017-01-30 01:16:31.000-0600Date Closed:2017-11-16 10:58:20.000-0600
Status:Closed/CompleteComponents:Resources/res_hep Resources/res_hep_pjsip
Versions:13.13.1 14.3.0 Frequency of
is related toASTERISK-27363 res_http_websocket: Wrong LocalAddress (it is equal to RemoteAddress)
Environment:Centos 7.3 (1611), HOMER 5.0.5, PJPROJECT 2.5.5Attachments:( 0) ASTERISK-26758.pcap
( 1) ASTERISK-26758.txt
Description:For all SIP packets that generate my WebRTC clients Asterisk send in HEP packets same ip address (client ip address) in source and destination field. On call-flow in HOMER it looks like client send all SIP packets to himself. Some example from pcap trace:
HEP3 Protocol
Length (Bytes): 1892
Protocol family: IPv4
Protocol ID: UDP
Source port: 49467
Destination port: 49467
Timestamp: 1485262590
Timestamp us: 903000
Protocol Type: SIP
Capture ID: 1234
Source IP address:
Destination IP address:
Correlation ID: 48607821-99d8-d400-4531-557e671ef1cf
For trunk connections, clients that use ip phones or softphones all work as expected. The problem only with clients that use websocket as transport.
Comments:By: Asterisk Team (asteriskteam) 2017-01-30 01:16:32.392-0600

Thanks for creating a report! The issue has entered the triage process. That means the issue will wait in this status until a Bug Marshal has an opportunity to review the issue. Once the issue has been reviewed you will receive comments regarding the next steps towards resolution.

A good first step is for you to review the [Asterisk Issue Guidelines|https://wiki.asterisk.org/wiki/display/AST/Asterisk+Issue+Guidelines] if you haven't already. The guidelines detail what is expected from an Asterisk issue report.

Then, if you are submitting a patch, please review the [Patch Contribution Process|https://wiki.asterisk.org/wiki/display/AST/Patch+Contribution+Process].

By: Rusty Newton (rnewton) 2017-01-31 13:46:08.531-0600

Howdy. This is an extended support module maintained by the community, where [~mjordan] is currently the maintainer. I've assigned the issue to him for investigating the issue.

Can you go ahead and attach a wire-shark viewable packet capture showing both the HEP packets and the SIP packets they represent?

By: Matt Jordan (mjordan) 2017-01-31 13:49:34.697-0600

I'll echo what [~rnewton] asked for - I'll need a pcap of the SIP message traffic. A full pjsip log with debug information would also be helpful.

That being said, there's a **very** good chance that there won't be much I can do. With WebRTC, you can't always trust the IP information that the client presents. We'll have to see if there's anything in the SIP message traffic or in the PJSIP transport layer that is reliable.

By: Max Norba (miralin) 2017-02-01 09:42:53.543-0600

I attached files with pcap trace and pjsip debug. i hope i did it exactly as you want.

By: Max Norba (miralin) 2017-03-16 12:27:23.213-0500

I found some ugly solution for this problem. Now Asterisk sends right ip address but as port it sends 5060. On callflow in HOMER it looks correctly. As I understand the problem is in function pjsip_tpmgr_find_local_addr2() that can't correctly handle situation whith websocket as transport type. So I just paste condition where I check is transport WS and if so, just replace it with TCP.

By: Friendly Automation (friendly-automation) 2017-11-16 10:58:21.118-0600

Change 7223 merged by Jenkins2:
pjsip / hep: Provide correct local address for Websockets.


By: Friendly Automation (friendly-automation) 2017-11-16 11:22:47.564-0600

Change 7224 merged by Jenkins2:
pjsip / hep: Provide correct local address for Websockets.


By: Friendly Automation (friendly-automation) 2017-11-16 11:54:45.940-0600

Change 7225 merged by Joshua Colp:
pjsip / hep: Provide correct local address for Websockets.