Custom FreeSWITCH programming
In order to add custom programming to FreeSWITCH it is recommended to create a separate SIP profile and dialplan to prevent any issues with the sipXecs FreeSWITCH configurations.
For this example we'll add a valet parking lot.
Note |
---|
Due to the complex nature of this scenario and all the REFERing involved sipXbridge is required to be in the signaling path for this to operate correctly. |
Warning |
---|
The following scenarios either work poorly or not at all (there may be more that just don't work as well)
|
Add the following content to a new file, cd /etc/sipxpbx/freeswitch/conf/dialplan/custom_context.xml
Code Block | ||
---|---|---|
| ||
<context name="custom">
<extension name="Park-Call">
<condition field="destination_number" expression="^(3500)$">
<action application="answer"/>
<action application="sleep" data="300"/>
<action application="valet_park" data="my_lot auto in 3501 3599"/>
</condition>
</extension>
<extension name="Park-Retrieve">
<condition field="destination_number" expression="^(35\d\d)$">
<action application="answer"/>
<action application="valet_park" data="my_lot $1"/>
</condition>
</extension>
</context> |
This dialplan has a valet parking number of 3500 with parking slots 3501-3599
Now we need to set up sophia
Add the following content to a new file, /etc/sipxpbx/freeswitch/conf/sip_profiles/custom_profile.xml
MAKE SURE YOU REPLACE THE DOMAIN NAMES AT THE BOTTOM OF THIS CONFIG FILE WITH WHATEVER YOUR sipXecs DOMAIN NAME IS
Code Block | ||
---|---|---|
| ||
<profile name="custom_dialplan">
<aliases>
<!--
<alias name="outbound"/>
<alias name="nat"/>
-->
</aliases>
<domains>
<domain name="all" alias="false" parse="true"/>
</domains>
<settings>
<param name="debug" value="1"/>
<param name="sip-trace" value="no"/>
<param name="rfc2833-pt" value="101"/>
<param name="sip-port" value="9061"/>
<param name="dialplan" value="XML"/>
<param name="dtmf-duration" value="100"/>
<param name="codec-prefs" value="G722,PCMU<at:var at:name="20i,PCMA" />20i,speex,L16"/>
<param name="hold-music" value="$${hold_music}"/>
<param name="rtp-timer-name" value="soft"/>
<!--<param name="enable-100rel" value="true"/>-->
<!-- This could be set to "passive" -->
<param name="local-network-acl" value="localnet.auto"/>
<param name="manage-presence" value="false"/>
<param name="context" value="custom"/>
<!-- 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="$org.sipfoundry.sipxconfig.domain.Domain@1"/>-->
<!--<param name="force-register-domain" value="$org.sipfoundry.sipxconfig.domain.Domain@1"/>-->
<!--all inbound reg will stored in the db using this domain -->
<!--<param name="force-register-db-domain" value="$org.sipfoundry.sipxconfig.domain.Domain@1"/>-->
<!-- ************************************************* -->
<!--<param name="aggressive-nat-detection" value="true"/>-->
<param name="inbound-codec-negotiation" value="scrooge"/>
<param name="nonce-ttl" value="60"/>
<param name="auth-calls" value="false"/>
<param name="accept-blind-auth" value="true"/>
<!--
DO NOT USE HOSTNAMES, ONLY IP ADDRESSES IN THESE SETTINGS!
-->
<param name="rtp-ip" value="$${local_ip_v4}"/>
<param name="sip-ip" value="$${local_ip_v4}"/>
<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}"/>
<!-- 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="$${external_tls_port}"/>
<!-- Location of the agent.pem and cafile.pem ssl certificates (needed for TLS server) -->
<param name="tls-cert-dir" value="$${external_ssl_dir}"/>
<!-- TLS version ("sslv23" (default), "tlsv1"). NOTE: Phones may not work with TLSv1 -->
<param name="tls-version" value="$${sip_tls_version}"/>
</settings>
<gateways>
<gateway name="pbx.example.com">
<param name="proxy" value="pbx.example.com/>
<param name="realm" value="pbx.example.com"/>
<param name="username" value="~~id~media"/>
<param name="password" value="1kJLRiF9YS"/>
<param name="register" value="false"/>
</gateway>
</gateways>
</profile>
|
Grab the FreeSWITCH sounds from http://files.freeswitch.org/freeswitch-sounds-en-us-callie-8000-1.0.13.tar.gz and place them in /usr/local/freeswitch/sounds so FreeSWITCH can tell you what slot the call is in.
In sipXecs create a SIP trunk to the hostname of your sipXecs server on port 9061. Make sure to select the internal SBC or you will experience weird issues.
Next, add a custom dial plan entry for 35 and 2 digits and append entire dialed number and use your new SIP trunk as the gateway.
Restart all necessary services as well as Media ServicesIt is possible to add custom non-supported advanced features to sipXecs by working directly with FreeSWITCH.
Child pages (Children Display) |
---|