6 Appendix A: Full Routing Script Preamble Format

Following is the full XML schema for the routing script preamble:

<?xml version="1.0" encoding="utf-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://schemas.microsoft.com/02/2006/sip/routing" xmlns:tns="http://schemas.microsoft.com/02/2006/sip/routing" elementFormDefault="qualified" attributeFormDefault="unqualified">
  <!-- The following type definations are used in the preamble-->
  <xs:complexType name="target-type">
    <xs:annotation>
      <xs:documentation>At least one of uri or application attributes are required to be present.</xs:documentation>
    </xs:annotation>
    <xs:attribute name="uri" type="xs:string" use="optional" />
    <xs:attribute name="application" type="xs:string" use="optional" />
    <xs:anyAttribute namespace="##any" processContents="lax" />
  </xs:complexType>
  <xs:complexType name="timezone-date-type">
    <xs:attribute name="name" type="xs:string" use="optional" />
    <xs:attribute name="bias" type="xs:integer" use="required" />
    <xs:attribute name="year" type="xs:short" use="required" />
    <xs:attribute name="month" type="xs:short" use="required" />
    <xs:attribute name="dayofweek" type="xs:short" use="required" />
    <xs:attribute name="day" type="xs:short" use="required" />
    <xs:attribute name="hour" type="xs:short" use="required" />
    <xs:attribute name="minute" type="xs:short" use="required" />
  </xs:complexType>
  <xs:complexType name="timezone-type">
    <xs:annotation>
      <xs:documentation>This type is based of the TIME_ZONE_INFORMATION type from Win32 API.</xs:documentation>
    </xs:annotation>
    <xs:sequence>
      <xs:element name="standard" type="tns:timezone-date-type" />
      <xs:element name="daylight" type="tns:timezone-date-type" />
    </xs:sequence>
    <xs:attribute name="bias" type="xs:integer" use="required" />
  </xs:complexType>
  <xs:complexType name="period-type">
    <xs:attribute name="dow" type="tns:days-of-week-type" use="required" />
    <xs:attribute name="start" type="tns:minutes-from-midnight-type" use="required" />
    <xs:attribute name="end" type="tns:minutes-from-midnight-type" use="required" />
  </xs:complexType>
  <xs:complexType name="period-array-type">
    <xs:sequence>
      <xs:element name="period" type="tns:period-type" minOccurs="0" maxOccurs="unbounded" />
    </xs:sequence>
  </xs:complexType>
  <xs:simpleType name="refname-type">
    <xs:restriction base="xs:string">
      <xs:pattern value="[A-Za-z0-9_]+" />
    </xs:restriction>
  </xs:simpleType>
  <xs:complexType name="preamble-member-base-type">
    <xs:attribute name="name" type="tns:refname-type" use="required" />
  </xs:complexType>
  <xs:complexType name="wait-type">
    <xs:complexContent>
      <xs:extension base="tns:preamble-member-base-type">
        <xs:attribute name="seconds" type="xs:nonNegativeInteger" use="required" />
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:complexType name="list-type">
    <xs:complexContent>
      <xs:extension base="tns:preamble-member-base-type">
        <xs:sequence>
          <xs:element name="target" type="tns:target-type" minOccurs="0" maxOccurs="unbounded" />
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:complexType name="time-type">
    <xs:complexContent>
      <xs:extension base="tns:preamble-member-base-type">
        <xs:sequence>
          <xs:element name="timezone" type="tns:timezone-type" minOccurs="0" maxOccurs="1" />
        </xs:sequence>
        <xs:attribute name="range" type="xs:string" use="required" />
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:complexType name="time-period-type">
    <xs:complexContent>
      <xs:extension base="tns:preamble-member-base-type">
        <xs:sequence>
          <xs:element name="timezone" type="tns:timezone-type" minOccurs="0" maxOccurs="1" />
          <xs:element name="periodarray" type="tns:period-array-type" />
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:complexType name="flags-type">
    <xs:complexContent>
      <xs:extension base="tns:preamble-member-base-type">
        <xs:attribute name="value" type="xs:string" use="required" />
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:complexType name="preamble-type">
    <xs:sequence>
      <xs:choice minOccurs="0" maxOccurs="unbounded">
        <xs:element name="flags" type="tns:flags-type" />
        <xs:element name="time" type="tns:time-type" />
        <xs:element name="timeperiod" type="tns:time-period-type" />
        <xs:element name="wait" type="tns:wait-type" />
        <xs:element name="list" type="tns:list-type" />
      </xs:choice>
    </xs:sequence>
  </xs:complexType>
  <xs:simpleType name="minutes-from-midnight-type">
    <xs:restriction base="xs:integer">
      <xs:minInclusive value="0" />
      <xs:maxInclusive value="1440" />
    </xs:restriction>
  </xs:simpleType>
  <xs:simpleType name="day-of-week-type">
    <xs:restriction base="xs:string">
      <xs:enumeration value="sun" />
      <xs:enumeration value="mon" />
      <xs:enumeration value="tue" />
      <xs:enumeration value="wed" />
      <xs:enumeration value="thu" />
      <xs:enumeration value="fri" />
      <xs:enumeration value="sat" />
    </xs:restriction>
  </xs:simpleType>
  <xs:simpleType name="days-of-week-type">
    <xs:list itemType="tns:day-of-week-type" />
  </xs:simpleType>
  <!-- The following type definations are used in the script-->
  <xs:simpleType name="criteria-type">
    <xs:restriction base="xs:string">
      <xs:pattern value="!{0,1}dnd" />
      <xs:pattern value="!{0,1}umenabled" />
      <xs:pattern value="!{0,1}class:(primary|secondary)" />
      <xs:pattern value="!{0,1}registered" />
      <xs:pattern value="!{0,1}time:[A-Za-z0-9_]+" />
      <xs:pattern value="!{0,1}flags:[A-Za-z0-9_]+\(.*\)" />
      <xs:pattern value="!{0,1}member:[A-Za-z0-9_]+" />
      <xs:pattern value="!{0,1}workinghours" />
    </xs:restriction>
  </xs:simpleType>
  <xs:complexType name="reference-type">
    <xs:attribute name="name" type="tns:refname-type" use="required" />
  </xs:complexType>
 
  <!-- Root document defintion -->
  <xs:complexType name="routing-type">
    <xs:annotation>
      <xs:documentation>The name and version attributes are both mandatory.         </xs:documentation>
    </xs:annotation>
    <xs:sequence>
      <xs:element name="preamble" type="tns:preamble-type" minOccurs="1" maxOccurs="1"/>
    </xs:sequence>
    <xs:attribute name="name" type="xs:string" />
    <xs:attribute name="version" type="xs:integer" />
    <xs:attribute name="minSupportedClientVersion" type="xs:string" use="optional" />
  </xs:complexType>
  <xs:element name="routing" type="tns:routing-type" />
</xs:schema>