[Freeswitch-users] Routing Calls to registered endpoints.

Jospeh Waite joelists at tm.net.uk
Tue Jun 20 19:01:10 UTC 2017

Hi Guys.

Final question of the day. I promise!!

I have 2 sofia profiles, one for IP authenticated calls and one for Sip Registrations. There both on port 5060 on 2 different IP addresses. 
This is basically a Wholesale/retail billing/switching platform. We have a JeraSoft VCS radius based billing and Sip Redirect server.

Everything works ok, except for inbound calls from DID provider destined for a registered extension.

Call comes in on the IP profile, which then sends a request to the JeraSoft SIP Redirect server, which replies with a 300 multiple choices as follows.

SIP/2.0 300 Multiple Choices
Via: SIP/2.0/UDP {ip of FS IP profile};rport;branch=z9hG4bKSKFBFy6K81U9H
From: "07966677711" <sip:07966677711@{ip of did provider}>;tag=S6Xmmj7meS2Fr
To: <sip:443307881011@{ip of jerasoft redirect}:5060>
Contact: <sip:joehouse@{ip of FS IP profile}>;q=1.00
Call-ID: aed22c59-d082-1235-baa2-363165383663
CSeq: 108654212 INVITE
Max-Forwards: 67
Content-Length: 0
Server: JeraSoft VCS SIP Redirect Server

joehouse is the username of a registered user, registered to the reg profile.

Now FS instead of connecting the call to the registered user it sends a new request to the Jerasoft redirect.

How would I get it to route the call to the registered user?

<?xml version="1.0"?>
    <extension name="JeraSoft VCS Routing">
        <condition field="${radius_auth_result}" expression="0"/>

        <condition field="${h323-redirect-number}" expression="^(.+)$" break="never">
            <action application="set" data="destination_number=$1" />

        <condition field="destination_number" expression="^(.+)$">
            <!--<action application="info"/>-->
            <action application="export" data="nolocal:h323-call-origin=originate"/>
            <action application="set" data="sip_h_X-accountcode=${accountcode}" />
            <action application="set" data="call_direction=outbound" />
            <action application="set" data="hangup_after_bridge=true"/>
            <action application="set" data="continue_on_fail=true"/>
            <action application="set" data="inherit_codec=true" />
            <action application="set" data="call_timeout=20"/>
            <action application="set" data="fail_on_single_reject=USER_BUSY" />
            <action application="set" data="origination_caller_id_name=${sip_req_user}"/>
            <action application="set" data="origination_caller_id_number=${sip_from_user}”/>
            <action application="set" data="execute_on_answer=sched_hangup +${h323-credit-time} alloted_timeout" />
            <action application="bridge" data="{sip_invite_from_uri=sip:${sip_from_user}@${sip_network_ip}}sofia/external/${destination_number}@{Jerasoft SIP Redirect IP}:5060" />
            <action application="hangup" data="${bridge_hangup_cause}"/>

<profile name="external">
  <!-- http://wiki.freeswitch.org/wiki/Sofia_Configuration_Files -->
  <!-- This profile is only for outbound registrations to providers -->
    <X-PRE-PROCESS cmd="include" data="external/*.xml"/>

        <alias name="outbound"/>
        <alias name="nat"/>

    <domain name="all" alias="false" parse="true"/>

    <param name="debug" value="0"/>
    <!-- If you want FreeSWITCH to shutdown if this profile fails to load, uncomment the next line. -->
    <!-- <param name="shutdown-on-fail" value="true"/> -->
    <param name="sip-trace" value="no"/>
    <param name="sip-capture" value="no"/>
    <param name="rfc2833-pt" value="101"/>
    <!-- RFC 5626 : Send reg-id and sip.instance -->
    <!--<param name="enable-rfc-5626" value="true"/> -->
    <param name="sip-port" value="5060"/>
    <param name="dialplan" value="XML"/>
    <param name="context" value="public"/>
    <param name="dtmf-duration" value="2000"/>
    <param name="inbound-codec-prefs" value="$${global_codec_prefs}"/>
    <param name="outbound-codec-prefs" value="$${outbound_codec_prefs}"/>
    <param name="hold-music" value="$${hold_music}"/>
    <param name="rtp-timer-name" value="soft"/>
    <!--<param name="enable-100rel" value="true"/>-->
    <!--<param name="disable-srv503" value="true"/>-->
    <!-- This could be set to "passive" -->
    <param name="local-network-acl" value="localnet.auto"/>
    <param name="manage-presence" value="passive"/>

    <!-- used to share presence info across sofia profiles
         manage-presence needs to be set to passive on this profile
         if you want it to behave as if it were the internal profile
         for presence.
    <!-- Name of the db to use for this profile -->
    <!--<param name="dbname" value="share_presence"/>-->
    <!--<param name="presence-hosts" value="$${domain}"/>-->
    <!--<param name="force-register-domain" value="$${domain}"/>-->
    <!--all inbound reg will stored in the db using this domain -->
    <!--<param name="force-register-db-domain" value="$${domain}"/>-->
    <!-- ************************************************* -->

    <!--<param name="aggressive-nat-detection" value="true"/>-->
    <param name="inbound-codec-negotiation" value="generous"/>
    <param name="nonce-ttl" value="60"/>
    <param name="auth-calls" value="false"/>
    <param name="inbound-late-negotiation" value="true"/>
    <param name="inbound-zrtp-passthru" value="true"/> <!-- (also enables late negotiation) -->
    <param name="rtp-ip" value=“{IP address}"/>
   <param name="sip-ip" value=“{ip address}"/>
    <param name="ext-rtp-ip" value="auto-nat"/>
    <param name="ext-sip-ip" value="auto-nat"/>
    <param name="rtp-timeout-sec" value="300"/>
    <param name="rtp-hold-timeout-sec" value="1800"/>
    <!--<param name="enable-3pcc" value="true"/>-->

    <!-- TLS: disabled by default, set to "true" to enable -->
    <param name="tls" value="$${external_ssl_enable}"/>
    <!-- Set to true to not bind on the normal sip-port but only on the TLS port -->
    <param name="tls-only" value="false"/>
    <!-- additional bind parameters for TLS -->
    <param name="tls-bind-params" value="transport=tls"/>
    <!-- Port to listen on for TLS requests. (5081 will be used if unspecified) -->
    <param name="tls-sip-port" value="5061"/>
    <!-- Location of the agent.pem and cafile.pem ssl certificates (needed for TLS server) -->
    <param name="tls-cert-dir" value="$${external_ssl_dir}"/>
    <!-- Optionally set the passphrase password used by openSSL to encrypt/decrypt TLS private key files -->
    <param name="tls-passphrase" value=""/>
    <!-- Verify the date on TLS certificates -->
    <param name="tls-verify-date" value="true"/>
   <!-- TLS verify policy, when registering/inviting gateways with other servers (outbound) or handling inbound registration/invite requests how should we verify their certificate -->
    <!-- set to 'in' to only verify incoming connections, 'out' to only verify outgoing connections, 'all' to verify all connections, also 'in_subjects', 'out_subjects' and 'all_subjects' for subject validation. Multiple policies can be split with a '|' pipe -->
    <param name="tls-verify-policy" value="none"/>
    <!-- Certificate max verify depth to use for validating peer TLS certificates when the verify policy is not none -->
    <param name="tls-verify-depth" value="2"/>
    <!-- If the tls-verify-policy is set to subjects_all or subjects_in this sets which subjects are allowed, multiple subjects can be split with a '|' pipe -->
    <param name="tls-verify-in-subjects" value=""/>
    <!-- TLS version ("sslv23" (default), "tlsv1"). NOTE: Phones may not work with TLSv1 -->
    <param name="tls-version" value="$${sip_tls_version}"/>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20170620/81b3bfd9/attachment-0001.html>

More information about the FreeSWITCH-users mailing list