Solved Configuring realm to talk to FreeSwitch

Status
Not open for further replies.

tewtewtwet

Premier Customer
Joined
Mar 4, 2020
Messages
35
Reaction score
9
Hi there,

I've seen the following post where it mentions changing the realm is no longer available - https://www.3cx.com/community/threads/configure-the-realm.40068/

I'm having an issue where the realm isn't recognised in my freeswitch config and need to set this to the IP address:

[ERR] sofia_reg.c:2232 Cannot locate any authentication credentials to complete an authentication request for realm '"3CXPhoneSystem"'

The gateway is connected and configured:

sbc::3cx gateway sip:[email protected]:5060 REGED

I seem to be unable to pass calls to the 3cx server as it tries to authenticate against the "3CXPhoneSystem" realm in Freeswitch. I even tried a bit of a messy way of adding a host entry for 3CXPhoneSystem to point to the IP of the 3cx box but that wasn't able to register and had DNS problems.

How would I go about getting these connected?

Thanks.
 
Hello @tewtewtwet

You are correct that the realm cannot be configured in the 3CX phone system. However the realm will be set to "3CXPhoneSystem" when 3CX is acting as the server (UAS).
You should configure your Freeswitch as a SIP trunk in 3CX so that 3CX is trying to register to the Freeswitch. In this scenario 3CX is the client (UAC) and the realm will be set by the Freeswitch.
 
Hi Yiannish,

Thanks for your suggestion, it looks like configuring the Freeswitch as a SIP trunk in 3cx has got them communicating correctly.

For any other users that want to do this, this is my Freeswitch config below.

Gateway (located in /etc/freeswitch/sip_profiles/internal/):

Code:
<include>
    <gateway name="3cx">
        <param name="username" value="none"/>
        <param name="password" value="register:false"/>
        <param name="realm" value="172.xx.xx.xx:5060"/>
        <param name="register" value="false"/>
        <param name="register-transport" value="udp"/>
        <param name="context" value="public"/>
        <param name="caller-id-in-from" value="true"/>
        <param name="extension" value="50000"/>
        <param name="extension-in-contact" value="true"/>
        <param name="cid-type" value="rpid"/>
    </gateway>
</include>

Dialplan (/etc/freeswitch/dialplan)

Code:
<!-- Inbound - 3CX - Phones -->
                <extension name="in_to_3cx">
                        <condition field="destination_number" expression="^(020xxxx)?(xxxx)$">
                                <action application="set" data="dialed_number=$2" inline="true"/>
                        </condition>
                        <condition field="network_addr" expression="xx.xxx.xx.xx|xx.xxx.xx.xx">
                                <action application="set" data="RECORD_STEREO=true"/>
                                <action application="set" data="media_bug_answer_req=true"/>
                                <action application="set" data="continue_on_fail=true"/>
                                <action application="set" data="hangup_after_bridge=true"/>
                                <action application="set" data="record_post_process_exec_app=system:/usr/share/freeswitch/scripts/findsilent ${uuid} &"/>
                                <action application="set" data="execute_on_answer=record_session $${recordings_dir}/archive/${strftime(%Y)}/${strftime(%b)}/${strftime(%d)}/${uuid}.wav"/>
                                <action application="export" data="leg_progress_timeout=5"/>
                                <action application="export" data="sip_from_uri=sip:${sip_from_user}@xx.xxx.xx.xx"/>
                        </condition>
                        <condition field="network_addr" expression="xx.xxx.xx.xx" break="never">
                                <action application="set" data="jitterbuffer_msec=60:200:20"/>
                                <anti-action application="set" data="jitterbuffer_msec=20:50:20"/>
                        </condition>
                        <condition>
                                <action application="bridge" data="{sip_invite_domain=xx.xxx.xx.xx,sip_contact_user=50000}sofia/sbc/${dialed_number}@xxx.xx.xx.xxx"/>
                        </condition>
                </extension>

From the freeswitch CLI:

reloadxml
sofia profile sbc rescan
 
Glad i could assist
 
Status
Not open for further replies.

Latest Posts

Forum statistics

Threads
111,939
Messages
589,843
Members
164,825
Latest member
john.fuchs