Hi everyone,

 

I have installed freeswitch version 1.10.7 -release-19-883d2cb662 64bit on Debian 11 using packages to play with multi-tenant feature.

 

It is loading configuration from a database using lua and configured for multi domain, as described in Multiple Companies - FreeSWITCH - Confluence

 

I have configured 2 sip users in each domain, 1000 and 1001.

 

The problem I am facing is that, when from user 1000 in domain A I am dialing 1001, if the user 1001 in domain A is not registered but 1001 in domain B is registered, it is ringing that user. In fact, it shoud go to voicemail of user 1001 in domain A.

 

I deleted force-register-domain, force-register-db-domain and force-subscription-domain from sofia config.

 

Relevant logs:

 

EXECUTE [depth=0] sofia/internal/1000@domaina bridge(user/1001@domaina)

2022-02-04 13:11:06.422480 96.50% [DEBUG] switch_channel.c:1269 sofia/internal/1000@domaina EXPORTING[export_vars] [RFC2822_DATE]=[Fri, 04 Feb 2022 13:11:06 +0200] to event

2022-02-04 13:11:06.422480 96.50% [DEBUG] switch_channel.c:1269 sofia/internal/1000@domaina EXPORTING[export_vars] [feature]=[false] to event

2022-02-04 13:11:06.422480 96.50% [DEBUG] switch_channel.c:1269 sofia/internal/1000@domain EXPORTING[export_vars] [dialed_extension]=[1001] to event

 

..............................

 

2022-02-04 13:11:06.443339 96.50% [NOTICE] switch_channel.c:1123 New Channel sofia/internal/1001@192.168.255.253:33402 [9620da94-3624-4273-9a59-a5e7b7e45044]

2022-02-04 13:11:06.443339 96.50% [DEBUG] mod_sofia.c:5121 (sofia/internal/1001@192.168.255.253:33402) State Change CS_NEW -> CS_INIT

2022-02-04 13:11:06.443339 96.50% [NOTICE] switch_ivr_originate.c:3039 Cannot create outgoing channel of type [error] cause: [USER_NOT_REGISTERED]

2022-02-04 13:11:06.443339 96.50% [DEBUG] switch_core_state_machine.c:581 (sofia/internal/1001@192.168.255.253:33402) Running State Change CS_INIT (Cur 2 Tot 57)

2022-02-04 13:11:06.443339 96.50% [DEBUG] switch_core_state_machine.c:624 (sofia/internal/1001@192.168.255.253:33402) State INIT

2022-02-04 13:11:06.443339 96.50% [DEBUG] mod_sofia.c:97 sofia/internal/1001@192.168.255.253:33402 SOFIA INIT

2022-02-04 13:11:06.443339 96.50% [DEBUG] sofia_glue.c:1620 sip:1001@192.168.255.253:33402;transport=UDP;rinstance=c09e81d51137e2cf Setting proxy route to sofia/internal/1001@192.168.255.253:33402

2022-02-04 13:11:06.443339 96.50% [INFO] sofia_glue.c:1651 sofia/internal/1001@192.168.255.253:33402 sending invite call-id: (null)

2022-02-04 13:11:06.443339 96.50% [DEBUG] sofia_glue.c:1654 sofia/internal/1001@192.168.255.253:33402 sending invite version: 1.10.7 -release-19-883d2cb662 64bit

 

These are my configs, maybe someone can spot something I am missing.

 

User 1000 in domain A:

=============================

 

<?xml version="1.0" encoding="UTF-8" standalone="no"?>

<document type="freeswitch/xml">

  <section name="directory">

    <domain name="domaina">

    <groups>

    <group name="default">

    <users>

      <user id="1000">

        <params>

          <param name="a1-hash" value="a194316aaae9c438839bdbcec168c35c"/>

          <param name="vm-enabled" value="true"/>

          <param name="vm-password" value=""/>

          <param name="dial-string" value="{^^:sip_invite_domain=${dialed_domain}:presence_id=${dialed_user}@${dialed_domain}}${sofia_contact(*/${dialed_user}@${dialed_domain})},${verto_contact(${dialed_user}@${dialed_domain})}"/>

        </params>

        <variables>

          <variable name="record_call" value="f"/>

          <variable name="user_context" value="default"/>

          <variable name="domain_id" value="12ac00a6-5b0e-4c8a-8bdc-62a3adc27cb3"/>

          <variable name="extension_id" value="c0ccdfab-67ab-4498-b7d8-f0fc02da7dc0"/>

        </variables>

      </user>

    </users>

    </group>

    </groups>

    </domain>

  </section>

</document>

==============================

 

User 1001 in domain A:

==============================

 

<?xml version="1.0" encoding="UTF-8" standalone="no"?>

<document type="freeswitch/xml">

  <section name="directory">

    <domain name="domaina">

    <groups>

    <group name="default">

    <users>

      <user id="1001">

        <params>

          <param name="a1-hash" value="594e223a7048abb236574286437f5569"/>

          <param name="vm-enabled" value="true"/>

          <param name="vm-password" value=""/>

          <param name="dial-string" value="{^^:sip_invite_domain=${dialed_domain}:presence_id=${dialed_user}@${dialed_domain}}${sofia_contact(*/${dialed_user}@${dialed_domain})},${verto_contact(${dialed_user}@${dialed_domain})}"/>

        </params>

        <variables>

          <variable name="record_call" value="t"/>

          <variable name="user_context" value="default"/>

          <variable name="forward_busy_enabled" value="f"/>

          <variable name="forward_busy_destination" value="0740563533"/>

          <variable name="domain_id" value="12ac00a6-5b0e-4c8a-8bdc-62a3adc27cb3"/>

          <variable name="extension_id" value="0e0bd30b-a68a-4234-bda2-fdeefca6f251"/>

        </variables>

      </user>

    </users>

    </group>

    </groups>

    </domain>

  </section>

</document>

 

===============================

 

User 1001 in domain B:

===============================

 

<?xml version="1.0" encoding="UTF-8" standalone="no"?>

<document type="freeswitch/xml">

  <section name="directory">

    <domain name="domainb.local">

    <groups>

    <group name="default">

    <users>

      <user id="1001">

        <params>

          <param name="a1-hash" value="1e20c854e554ed53d4d35ed4a6f515c3"/>

          <param name="vm-enabled" value="true"/>

          <param name="vm-password" value=""/>

          <param name="dial-string" value="{^^:sip_invite_domain=${dialed_domain}:presence_id=${dialed_user}@${dialed_domain}}${sofia_contact(*/${dialed_user}@${dialed_domain})},${verto_contact(${dialed_user}@${dialed_domain})}"/>

        </params>

        <variables>

          <variable name="call_timeout" value="30"/>

          <variable name="record_call" value="t"/>

          <variable name="user_context" value="default"/>

          <variable name="transfer_fallback_extension" value="operator"/>

          <variable name="domain_id" value="f91fea56-34ad-4de2-ac23-e6c4563333b3"/>

          <variable name="extension_id" value="1c8b05db-ed3b-4931-89e9-b8acf6a27b0f"/>

        </variables>

      </user>

    </users>

    </group>

    </groups>

    </domain>

  </section>

</document>

 

===============================

 

 

Dialplan:

===============================

 

<?xml version="1.0" encoding="UTF-8" standalone="no"?>

<document type="freeswitch/xml">

<section name="dialplan">

<context name="default">

<extension name="unloop">

  <condition field="${unroll_loops}" expression="^true$"/>

  <condition field="${sip_looped_call}" expression="^true$">

    <action application="deflect" data="${destination_number}"/>

  </condition>

</extension>

<extension name="global" continue="true">

 <condition field="${call_debug}" expression="^true$" break="never">

    <action application="info"/>

  </condition>

  <!--

  This is an example of how to auto detect if telephone-event is missing and activate inband detection

  -->

  <!--

  <condition field="${switch_r_sdp}" expression="a=rtpmap:(\d+)\stelephone-event/8000" break="never">

    <action application="set" data="rtp_payload_number=$1"/>

    <anti-action application="start_dtmf"/>

  </condition>

  -->

  <condition field="${rtp_has_crypto}" expression="^($${rtp_sdes_suites})$" break="never">

    <action application="set" data="rtp_secure_media=true"/>

  <!-- Offer SRTP on outbound legs if we have it on inbound. -->

  <!-- <action application="export" data="rtp_secure_media=true"/> -->

  </condition>

 

  <!--

  Since we have inbound-late-negotation on by default now the

  above behavior isn't the same so you have to do one extra step.

  -->

  <condition field="${endpoint_disposition}" expression="^(DELAYED NEGOTIATION)"/>

  <condition field="${switch_r_sdp}" expression="(AES_CM_128_HMAC_SHA1_32|AES_CM_128_HMAC_SHA1_80)" break="never">

    <action application="set" data="rtp_secure_media=true"/>

  <!-- Offer SRTP on outbound legs if we have it on inbound. -->

  <!-- <action application="export" data="rtp_secure_media=true"/> -->

  </condition>

 

  <condition>

    <action application="hash" data="insert/${domain_name}-spymap/${caller_id_number}/${uuid}"/>

    <action application="hash" data="insert/${domain_name}-last_dial/${caller_id_number}/${destination_number}"/>

    <action application="hash" data="insert/${domain_name}-last_dial/global/${uuid}"/>

    <action application="export" data="RFC2822_DATE=${strftime(%a, %d %b %Y %T %z)}"/>

    <action application="export" data="feature=false"/>

  </condition>

</extension>

<extension name="feature_false" continue="true">

  <action application="export" data="feature=false"/>

</extension>

 

<extension name="local_extensions">

  <condition>

    <action application="set" data="dial_match1=1001"/>

    <action application="set" data="caller_destination=${destination_number}"/>

    <action application="export" data="dialed_extension=${dial_match1}"/>

    <action application="bind_meta_app" data="1 b s execute_extension::dx XML features"/>

    <action application="bind_meta_app" data="2 b s record_session::$${recordings_dir}/${caller_id_number}.${strftime(%Y-%m-%d-%H-%M-%S)}.wav"/>

    <action application="bind_meta_app" data="3 b s execute_extension::cf XML features"/>

    <action application="bind_meta_app" data="4 b s execute_extension::att_xfer XML features"/>

    <action application="set" data="ringback=${us-ring}"/>

    <action application="set" data="transfer_ringback=$${hold_music}"/>

    <action application="set" data="call_timeout=30"/>

    <action application="set" data="hangup_after_bridge=true"/>

    <action application="set" data="continue_on_fail=true"/>

    <action application="hash" data="insert/${domain_name}-call_return/${dialed_extension}/${caller_id_number}"/>

    <action application="hash" data="insert/${domain_name}-last_dial_ext/${dialed_extension}/${uuid}"/>

    <action application="set" data="called_party_callgroup=${user_data(${dialed_extension}@${domain_name} var callgroup)}"/>

    <action application="hash" data="insert/${domain_name}-last_dial_ext/${called_party_callgroup}/${uuid}"/>

    <action application="hash" data="insert/${domain_name}-last_dial_ext/global/${uuid}"/>

    <action application="hash" data="insert/${domain_name}-last_dial/${called_party_callgroup}/${uuid}"/>

    <action application="bridge" data="user/${dialed_extension}@${domain_name}"/>

    <action application="answer" data=""/>

    <action application="export" data="domain_id=${domain_id}"/>

    <action application="export" data="extension_id=${extension_id}"/>

    <action application="export" data="caller_destination=${caller_destination}"/>

    <action application="sleep" data="1000"/>

    <action application="bridge" data="loopback/app=voicemail:default ${domain_name} ${dialed_extension}"/>

  </condition>

</extension>

</context>

</section>

</document>

 

==============================

 

Thank you for your time.

 

Best regards,

Mircea