StarTrinity.com

VoIP software

Sample CallXML script for PBX

<callxml>
<!-- this script processes all SIP calls which are received by Softswitch/PBX -->
<!-- this is an example script for simplest PBX -->
<accept value="183" /> <!-- enable early media for ringback tone -->
<recordcall value="100" /> <!-- record 100% of all incoming calls -->
<if test="$callerIsExt();" > <!-- check if it is a call from extension -->
<!-- this call is from extension: it can be routed to another extension or to outbound trunk -->
  <if test="'$calledId;' startswith '9'"> <!-- if calledId (dialed number starts with 9), route call to outbound trunk -->
   <substring var="numberForTrunk" value="$calledId;" startIndex="1" /> <!-- remove this '9', save result into 'numberForTrunk' -->
   <transfer value="sip:$numberForTrunk;@10.10.10.10:5060" /> <!-- transfer call to SIP-PSTN gateway or trunk, SIP address 10.10.10.10 -->
  </if>
  <else> <!-- dialed number does not start with 9: pass it to another extension like 100, 101, 102, etc. -->
   <transfer value="$ext($calledId;);" /> <!-- get IP address and port of another extension using '$ext();' transfer call to this IP address -->
  </else>
</if>
<else> <!-- this is a call from SIP trunk: pass it to IVR -->
  <switch value="$calledId;" >
   <case equals="1800123456">
    <transfer value="$ext(100);" /> <!-- number 1800123456 (DID) goes directly to extension '100' -->
   </case>
   <case equals="1800123457"> <!-- number 1800123457 (DID) goes to IVR#1: it is for employees when they call the company from their home -->
    <accept value="200" /> <!-- answer call to receive DTMF digits -->
    <inputdigits value="wav\enter_extension.wav" maxdigits="3" var="enteredNumber" /> <!-- enter 3 digits for extension ID -->
    <transfer value="$ext($enteredNumber;);" /> <!-- transfer to directly to extension -->
   </case>
   <case equals="1800123457"> <!-- number 1800123457 (DID) goes to IVR#2: it is for customers -->
    <inputdigits value="wav\public_ivr_entry.mp3" maxdigits="1" var="DTMF1" maxsilence="10s" /> <!-- play WAV or MP3 file, wait for DTMF keys -->
    <switch value="$DTMF1;" >
     <case equals="1"> <transfer value="$ext(100);" /> </case> <!-- digit 1 connects with extension 100 (sales) -->
     <case equals="2"> <transfer value="$ext(102);" /> </case> <!-- digit 2 connects with extension 102 (tech support) -->
     <case equals="3"> <playaudio value="wav\timetable_address.mp3" /> </case> <!-- digit 3: address and time table -->
     <default> <goto value="ivr1" /> </default> <!-- wrong digit or no entry: play same menu again -->
    </switch>
   </case>
  </switch>
</else>
<exit /> <!-- terminate a call -->

<!-- other StarTrinity Softswitch/PBX/call-center features include
call groups/queues/hunt groups, ACD, text-to-speech, fax, email, custom CDR fields, IVR sub-menus,
day/night/weekend schedules, database integration and more.
feel free to ask for support by email: support at [this domain] dot com
-->


</callxml>
Copyright 2011-2017 StarTrinity.com | Blog | Contact lead developer via LinkedIn | Get support via TeamViewer