Howto:Getting started with your own PBX voicemail script: Difference between revisions

From innovaphone wiki
Jump to navigation Jump to search
Line 21: Line 21:


===Editing your xml file===
===Editing your xml file===
Editing your xml script is much easier if you use a dedicated xml editor that is capable of reading the corresponding xml schema file (vm.xsd).
Editing your xml script is much easier if you use a dedicated xml editor that is capable of reading the corresponding xml schema file (vm.xsd).
 
==Example xml functions==
 
===encode asterisk===
<code xml>
<function define="encode_asterisk">
  <!-- expect existing variable called $string_encode_asterisk -->
  <assign out="$string_position" value="1" />
  <assign out="$string_position_finished" value="0" />
  <assign out="$string_encode_asterisk_tmp" value="" />
  <lib-strlen string="$string_encode_asterisk" out="$string_length" />
  <while notcond="$string_position_finished">
    <index out="$res" value="$string_encode_asterisk" pos="$string_position" size="1"/>
    <switch var="$res">
      <case equal="*">
        <lib-strcat out-string="$string_encode_asterisk_tmp" string="$string_encode_asterisk_tmp" string2="%2a"/>
      </case>
      <default>
        <lib-strcat out-string="$string_encode_asterisk_tmp" string="$string_encode_asterisk_tmp" string2="$res"/>
      </default>
    </switch>
    <add value="$string_position" value2="1" out="$string_position" />
    <switch var="$string_position">
      <case greater="$string_length">
        <assign out="$string_encode_asterisk" value="$string_encode_asterisk_tmp" />
        <assign out="$string_position_finished" value="1" />
      </case>
    </switch>
  </while>
</function>
</code>
 
=== remove first char ===
<code xml>
<function define="remove_first_char">
  <!-- expect existing variable called $string_remove_first_char -->
  <lib-strlen string="$string_remove_first_char" out="$file_length" />
  <sub value="$file_length" value2="1" out="$file_length" />
  <index out="$string_remove_first_char" value="$string_remove_first_char" pos="2" size="$file_length"/>-->
</function>
</code>


==Related Articles==
==Related Articles==

Revision as of 16:37, 14 November 2018

The innovaphone voicemail is implemented as an XML script running in a PBX Voicemail object. While this is a pretty complete implementation of a voice box, it is possible to modify the script or even write your own scripts. Here is how to start.

Voice mail scripting is a quite powerful tool. Please note that "voice mail script" is rather a misnomer. You can support a variety of applications using this scripting language, not only voice mail.

Applies To

This information applies to

  • All V6 and later PBX Platforms

More Information

System Requirements

The PBX voicemail object provides an interpreter for an XML based scripting language. This language is defined in a XML schema file vm.xsd and a documentation is available in vm.htm. Both files can be found in the schema folder in the voicemail application download package on the download page (beware: you must download the full "vm" package, not a single language package only).

To start your own voice mail derivative, just

  • copy vm.xml (found in the \drive\CF0\VM\en|de) in your voicemail installation to a new name
  • change the URL in the voicemail configuration page to point to the new script
  • make the required changes to your new xml copy

To interface the voicemail to other web based applications (such as php or asp scripts on your web server), have a look at the exec tag in vm.htm.

Editing your xml file

Editing your xml script is much easier if you use a dedicated xml editor that is capable of reading the corresponding xml schema file (vm.xsd).

Example xml functions

encode asterisk

<function define="encode_asterisk">

 <assign out="$string_position" value="1" />
 <assign out="$string_position_finished" value="0" />
 <assign out="$string_encode_asterisk_tmp" value="" />
 <lib-strlen string="$string_encode_asterisk" out="$string_length" />
 <while notcond="$string_position_finished">
   <index out="$res" value="$string_encode_asterisk" pos="$string_position" size="1"/>
   <switch var="$res">
     <case equal="*">
       <lib-strcat out-string="$string_encode_asterisk_tmp" string="$string_encode_asterisk_tmp" string2="%2a"/>
     </case>
     <default>
       <lib-strcat out-string="$string_encode_asterisk_tmp" string="$string_encode_asterisk_tmp" string2="$res"/>
     </default>
   </switch>
   <add value="$string_position" value2="1" out="$string_position" />
   <switch var="$string_position">
     <case greater="$string_length">
       <assign out="$string_encode_asterisk" value="$string_encode_asterisk_tmp" />
       <assign out="$string_position_finished" value="1" />
     </case>
   </switch>	
 </while>

</function>

remove first char

<function define="remove_first_char">

 <lib-strlen string="$string_remove_first_char" out="$file_length" />
  
 <index out="$string_remove_first_char" value="$string_remove_first_char" pos="2" size="$file_length"/>-->

</function>

Related Articles

The most current VoiceMail XML language documentation can be found in vm.htm on www.innovaphone.com/xsd.