[Freeswitch-users] WebRTC STUN request for a SIP profile is not working

Alexander Haugg Alexander.Haugg at c4b.de
Fri Jan 10 13:45:21 UTC 2020

I have the solution.

1.       My think was to see the external candidate in the SDP. Freeswitch do that automatically, if the Client Registration from outside the local NW.

2.       To force adding the external candidate, there is the channel var “include_external_ip=true”. For example -> originate {include_external_ip=true,media_webrtc=true}sofia/gateway/GW_SBC2_B2Bua/22100 &park

3.       The srflx candidate will be set, if the internal port different from the external port (stun request). See the switch_core_media implementation for the candidate generation.

My questions are solved (at the moment ;-). My biggest problem was to understand the server stack vs. client stack behaviour for WebRTC.

Thanks a lot!

Von: FreeSWITCH-users <freeswitch-users-bounces at lists.freeswitch.org> Im Auftrag von David Villasmil
Gesendet: Freitag, 10. Januar 2020 13:59
An: FreeSWITCH Users Help <freeswitch-users at lists.freeswitch.org>
Betreff: Re: [Freeswitch-users] WebRTC STUN request for a SIP profile is not working

Does it work with a manually entered IP?

On Fri, 10 Jan 2020 at 12:42, Alexander Haugg <Alexander.Haugg at c4b.de<mailto:Alexander.Haugg at c4b.de>> wrote:

if I set the parameter „<X-PRE-PROCESS cmd="stun-set" data="external_rtp_ip=stun:stun.freeswitch.org<http://stun.freeswitch.org>"/> “ in the vars.xml and use this variable $${external_rtp_ip}  in the SIP Profile, then the Ext-RTP-IP show the real external IP.
I think, that’s OK.

But I miss the srflx candidate in the sdp.

I tried to experimental with the apply-candidate-acl (rfc1918.auto, any_v4.auto, wan_v4.auto), but nothing works.
What’s wrong?

Here is my sofia profile config:
<profile xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="SBC2_B2Bua">
  <aliases />
    <domain name="h3k.sip.c4b" alias="false" parse="true" />
    <param name="user-agent-string" value="XPhone Call Controller" />
    <param name="debug" value="0" />
    <param name="stun-enabled" value="true"/>
    <param name="stun-auto-disable" value="false"/>
    <param name="sip-trace" value="no" />
    <param name="sip-capture" value="no" />
    <param name="dialplan" value="XML" />
    <param name="context" value="SBC2_SP_outbound" />
    <param name="dtmf-type" value="rfc2833" />
    <param name="dtmf-duration" value="100" />
    <param name="rfc2833-pt" value="98" />
    <param name="inbound-codec-prefs" value="OPUS,PCMU,PCMA,VP8" />
    <param name="outbound-codec-prefs" value="OPUS,PCMU,PCMA,VP8" />
    <param name="hold-music" value="local_stream://moh" />
    <param name="rtp-timer-name" value="none" />
    <param name="rtp-rewrite-timestamps" value="true" />
    <param name="manage-presence" value="false" />
    <param name="inbound-codec-negotiation" value="generous" />
    <param name="inbound-late-negotiation" value="true" />
    <param name="nonce-ttl" value="60" />
    <param name="auth-calls" value="false" />
    <param name="sip-port" value="4901" />
    <param name="rtp-ip" value="MyLocalIP" />
    <param name="sip-ip" value=" MyLocalIP " />
    <param name="ext-rtp-ip" value="$${external_rtp_ip}" />
    <param name="ext-sip-ip" value=" MyLocalIP " />
    <param name="local-network-acl" value="SBC2_localnet.auto" />
    <param name="apply-candidate-acl" value="rfc1918.auto" />
    <param name="apply-candidate-acl" value="SBC2_localnet.auto" />
    <param name="apply-candidate-acl" value="any_v4.auto" />
    <param name="apply-candidate-acl" value="wan_v4.auto" />
    <param name="apply-inbound-acl" value="SBC2_localnet.auto" />
    <param name="rtp-timeout-sec" value="300" />
    <param name="rtp-hold-timeout-sec" value="1800" />
    <param name="enable-3pcc" value="true" />
    <param name="inbound-use-callid-as-uuid" value="true" />
    <param name="tls" value="false" />
    <param name="tls-only" value="false" />
    <param name="tls-bind-params" value="transport=tls" />
    <param name="tls-sip-port" value="" />
    <param name="tls-passphrase" value="" />
    <param name="tls-verify-date" value="true" />
    <param name="tls-verify-depth" value="2" />
    <param name="tls-verify-in-subjects" value="" />
    <param name="tls-version" value="tlsv1,tlsv1.1,tlsv1.2" />
    <param name="tls-ciphers" value="ALL:!ADH:!LOW:!EXP:!MD5:@STRENGTH" />
    <param name="zrtp-passthru" value="true" />
    <param name="inbound-reg-force-matching-username" value="true" />
    <param name="auth-all-packets" value="false" />
    <param name="wss-binding" value=":4447" />
    <param name="caller-id-type" value="rpid" />
    <param name="manual-redirect" value="true" />
    <param name="rtcp-audio-interval-msec" value="5000" />
    <X-PRE-PROCESS cmd="include" data="external/GW_SBC2_B2Bua.conf.xml" />

Von: FreeSWITCH-users <freeswitch-users-bounces at lists.freeswitch.org<mailto:freeswitch-users-bounces at lists.freeswitch.org>> Im Auftrag von Alexander Haugg
Gesendet: Donnerstag, 9. Januar 2020 08:17
An: FreeSWITCH Users Help <freeswitch-users at lists.freeswitch.org<mailto:freeswitch-users at lists.freeswitch.org>>
Betreff: [Freeswitch-users] WebRTC STUN request for a SIP profile is not working


I’d read the manuals and configure my sofia profile to work with the external IP in the ext-rtp-ip setting.
<param name="stun-enabled" value="true"/>
<param name="stun-auto-disable" value="false"/>
<param name="ext-rtp-ip" value="stun:stun.freeswitch.org<http://stun.freeswitch.org>" />

The Freeswitch is started with the parameter –nonat
In the pcap trace is no STUN request visible.
I try to restart the Freeswitch, restart the profile, do an outbound call, but there is no STUN request.

If I try to get my external IP via the CLI cmd “stun stun.freeswitch.org<http://stun.freeswitch.org>”, then works it successfully.

The status output of the profile is:
Name                                SBC2_B2Bua
Domain Name                 N/A
Auto-NAT                         false
DBName                           sofia_reg_SBC2_B2Bua
Pres Hosts
Dialplan                            XML
Context                            SBC2_SP_outbound
Challenge Realm             auto_to
RTP-IP                               MY_LOCAL_IP
Ext-RTP-IP                        stun:stun.freeswitch.org<http://stun.freeswitch.org>
SIP-IP                                MY_LOCAL_IP
Ext-SIP-IP                         MY_LOCAL_IP
URL                                   sip:mod_sofia at MY_LOCAL_IP:4901
BIND-URL                  sip:mod_sofia at MY_LOCAL_IP:4901;maddr=MY_LOCAL_IP;transport=udp,tcp
HOLD-MUSIC                   local_stream://moh
CODECS IN                       OPUS,PCMU,PCMA,VP8
CODECS OUT                   OPUS,PCMU,PCMA,VP8
TEL-EVENT                       98
DTMF-MODE                   rfc2833
CNG                                  13
SESSION-TO                     0
MAX-DIALOG                   0
NOMEDIA                        false
LATE-NEG                         true
PROXY-MEDIA                 false
ZRTP-PASSTHRU             false
AGGRESSIVENAT           false
CALLS-IN                           0
FAILED-CALLS-IN             0
CALLS-OUT                       0
REGISTRATIONS              0

Thanks a lot!!!


The FreeSWITCH project is sponsored by SignalWire https://signalwire.com
Enhance your FreeSWITCH install with disruptive priced SMS and PSTN services.
Build your next product on our scalable cloud platform.

Join our online community to chat in real time https://signalwire.community

Professional FreeSWITCH Services
sales at freeswitch.com<mailto:sales at freeswitch.com>

Official FreeSWITCH Sites

FreeSWITCH-users mailing list
FreeSWITCH-users at lists.freeswitch.org<mailto:FreeSWITCH-users at lists.freeswitch.org>

David Villasmil
email: david.villasmil.work at gmail.com<mailto:david.villasmil.work at gmail.com>
phone: +34669448337
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20200110/e3920832/attachment-0001.html>

More information about the FreeSWITCH-users mailing list