Howto12r1:Getting started with your own PBX voicemail script: Difference between revisions
m Slu moved page Howto:Getting started with your own PBX voicemail script to Howto12r1:Getting started with your own PBX voicemail script |
|||
(11 intermediate revisions by 3 users not shown) | |||
Line 26: | Line 26: | ||
There is a predefined structure like this example: | There is a predefined structure like this example: | ||
< | <syntaxhighlight lang="html5"> | ||
<?xml version="1.0" encoding="utf-8" ?> | <?xml version="1.0" encoding="utf-8" ?> | ||
<voicemail> | <voicemail> | ||
Line 33: | Line 33: | ||
</function> | </function> | ||
</voicemail> | </voicemail> | ||
</ | </syntaxhighlight> | ||
You will find a global ''voicemail'' tag. Within this tag you can define your own functions.<br> | You will find a global ''voicemail'' tag. Within this tag you can define your own functions.<br> | ||
Line 39: | Line 39: | ||
The Voicemail XML documentation can be found in https://www.innovaphone.com/xsd/vm.htm. | The Voicemail XML documentation can be found in https://www.innovaphone.com/xsd/vm.htm. | ||
==Global variables from PBX== | |||
{{v13_vm_email_script_variables}} | |||
==XML helper functions== | ==XML helper functions== | ||
Line 46: | Line 49: | ||
===disconnect control calls / calls without media=== | ===disconnect control calls / calls without media=== | ||
< | <syntaxhighlight lang="html5"> | ||
<!-- check if the incoming call was a control call without audio, eg. a presence call --> | <!-- check if the incoming call was a control call without audio, eg. a presence call --> | ||
<pbx-getcallinfo out-ctl-call="$ctl_call" /> | <pbx-getcallinfo out-ctl-call="$ctl_call" /> | ||
Line 53: | Line 56: | ||
<pbx-disc /> | <pbx-disc /> | ||
</if> | </if> | ||
</ | </syntaxhighlight> | ||
===encode asterisk=== | ===encode asterisk=== | ||
Line 59: | Line 62: | ||
The ''lib-enc'' method does not encode "*" in a string. | The ''lib-enc'' method does not encode "*" in a string. | ||
< | <syntaxhighlight lang="html5"> | ||
<function define="encode_asterisk"> | <function define="encode_asterisk"> | ||
<!-- expect existing variable called $string_encode_asterisk --> | <!-- expect existing variable called $string_encode_asterisk --> | ||
Line 86: | Line 89: | ||
</while> | </while> | ||
</function> | </function> | ||
</ | </syntaxhighlight> | ||
=== remove first char === | === remove first char === | ||
< | <syntaxhighlight lang="html5"> | ||
<function define="remove_first_char"> | <function define="remove_first_char"> | ||
<!-- expect existing variable called $string_remove_first_char --> | <!-- expect existing variable called $string_remove_first_char --> | ||
Line 96: | Line 99: | ||
<index out="$string_remove_first_char" value="$string_remove_first_char" pos="2" size="$file_length"/> | <index out="$string_remove_first_char" value="$string_remove_first_char" pos="2" size="$file_length"/> | ||
</function> | </function> | ||
</ | </syntaxhighlight> | ||
==Related Articles== | ==Related Articles== | ||
*[[Howto:How to Configure the innovaphone Voicemail]] | *[[Howto:How to Configure the innovaphone Voicemail]] | ||
*[[Howto:Send Email MWI Notification From The innovaphone Voicemail]] | |||
The most current VoiceMail XML language documentation can be found in [http://www.innovaphone.com/xsd/vm.htm vm.htm on www.innovaphone.com/xsd]. | The most current VoiceMail XML language documentation can be found in [http://www.innovaphone.com/xsd/vm.htm vm.htm on www.innovaphone.com/xsd]. | ||
[[Category:Howto|{{PAGENAME}}]] | [[Category:Howto|{{PAGENAME}}]] |
Latest revision as of 12:46, 14 March 2025
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).
Structure
There is a predefined structure like this example:
<?xml version="1.0" encoding="utf-8" ?>
<voicemail>
<function define="Main">
<!-- some stuff -->
</function>
</voicemail>
You will find a global voicemail tag. Within this tag you can define your own functions.
If the script is executed the Main function will be executed automatically.
The Voicemail XML documentation can be found in https://www.innovaphone.com/xsd/vm.htm.
Global variables from PBX
As of 13r1, scripts that use email functionality (such as email.xml) do not need to include a definition of SMTP connection parameters. The static configuration data from PBX/Config/Authentication/Email Verification can be read in for this purpose.
The following script variables will yield those email settings when read.
- $_pbx_auth_email_server
SMTP server
- $_pbx_auth_email_host
Client host name
- $_pbx_auth_email_addr
Sender Email address
- $_pbx_auth_email_usr
Username for authentication
- $_pbx_auth_email_pwd
Password for authentication
- $_pbx_auth_email_sender
Sender name
XML helper functions
There is not a native method for every logical operation. Here are some helper functions where no native method exist.
disconnect control calls / calls without media
<!-- check if the incoming call was a control call without audio, eg. a presence call -->
<pbx-getcallinfo out-ctl-call="$ctl_call" />
<if cond="$ctl_call">
<dbg string="disconnect control call" />
<pbx-disc />
</if>
encode asterisk
The lib-enc method does not encode "*" in a string.
<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>
remove first char
<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>
Related Articles
- Howto:How to Configure the innovaphone Voicemail
- Howto:Send Email MWI Notification From The innovaphone Voicemail
The most current VoiceMail XML language documentation can be found in vm.htm on www.innovaphone.com/xsd.