Howto:Simple Wake-UP Service

From innovaphone wiki
Jump to navigation Jump to search
3rd party input
this is 3rd party content not provided by innovaphone, see history for authors.

This article describes a simple Wake-Up service. Any improvements are encouraged!

Applies To

innovaphone PBX, V7 or higher for version 1.4 of perl script

innovaphone PBX, V9 hotfix 22 or higher for version 2.0 of perl script


More Information

The wake-up call is a typical Hotel or TelCo service. Innovaphone does not support wake-up calls natively but you can build this service with a simple XML and PERL script.

XML script

The wakeup.xml feature is realized using Innovaphone XML Voicemail script, no license is required for this feature. If you call the script a main menu is played. In this menu you can select 1 for set the wake-up time, 2 for disable the wake-up or 3 to check the configured alarm time. The XML gets the alarm time via DTMF. It must be specified in 24 hours format as explained in examples below:

1030 means 10 am and 30 minutes

2230 means 10 pm and 30 minutes

0700 means 7 am o'clock

0000 means midnight

Once the alarm time is setted, the XML writes a txt file in the "alarm" folder. Files have this particular format: file name is equal to calling party number and file content is the alarm time in 24 hours format with : as separator between hours and minutes. The calling party number will be used as called number and re-called when will be the time to wake-up. In this way a user can set only his wake-up and can set again the time without disable it. Every time that a user select the option to enable the wake-up, the XML rewrites the file in the "alarm" folder with the new time. Obviously, if the calling party number is missing or restricted the XML will prompt an error message. To disable the alarm the XML deletes the file. Examples:

ext. 101 calls XML and sets 0800 ---> XML writes the file 101.txt with the content 08:00

ext. 101 recalls XML and sets 0830 ---> XML rewrite the file 101.txt with the content 08:30

ext. 101 recalls XML and disables the wake-up ---> XML deletes the file 101.txt

PERL script

PERL is an interpreted language and so can be executed on Linux and Windows operating systems. Linux can interpret perl natively while for Windows you can download many free interpreters like Activeperl or Strawberry perl. To run the script send_call.pl you must use a third party server or the Innovaphone Linux Application Platform. The reason of a PERL script is the following: the Innovaphone XML script can't start a call and so is necessary an external agent. The script runs in background as a service and performs the following tasks:

- every minute checks the folder called "alarm"

- reads files

- uses the file name as called number

- checks the file content to verify if is wake up time

The version 1.4 of the script uses SIP and handles 4 call responses: 404 user not found, 486 busy, 487 not answer and 200 answer ok. In every cases sends an email and deletes files. Only for the answer case plays a nice music.

The version 2.0 uses the Innovaphone CallBack function to generate a call (for more info see the Related Articles at the bottom of the page). This release doesn't handle the call state like busy or not answer.

Configuration

Create a VM object in your PBX and put in the “Script URL” the path of your XML object. Example of configuration of a directory called "wakeup":

http://xxx.yyy.zzz.vvv/inno/wakeup/wakeup.xml

Assign a number to this object, now you can call it from any phone and the main menu will be prompted.

Voicemail obj.PNG

Create a GW without registration with the IP Address of the server where is running the PERL script. Create a route from the GW created just now to the GW registered as PBX TRUNK line. In this way you can permit calls from PERL script to PBX.

Gw route.PNG

Open the PERL script with a text editor and configure the global parameters at the beginning of the file as showed in example below:

Perl global.PNG

The version 1.4 handles 4 sip responses: 404 user not found, 486 busy, 487 not answer and 200 answer ok. If you want add a new cause you can edit the script and create a new condition. The music played during connection uses the G.711A codec. If you want change it you must modify the rtp_param [ 8, 160, 160/8000, 'PCMA/8000' ] in the "invite" routine.

Perl sip ua.png

If you want, there is an optional feature to register the Perl SIP agent to your PBX: #$ua->register ( expires => "300",). It's disabled per default.


Only for version 2.0 you must have a Waiting Queue object in your PBX used to generate the call and play the Wake Up music.


If you want execute the script in a service mode, you must edit rc.local in your Linux OS file and write the istruction: "perl /your script path/send_call.pl 2>&1 & "

Localization

This script is delivered with Italian prompts, but you can produce your own prompts and wordings. Audio files are in the "audio" folder. Files are following:

Filename: Prompt

welcomemenu: “press 1 to set the wake-up, press 2 to disable wake-up, press 3 to check wake-up status”

Invalidcgpn: “the calling party number is missing or restricted, the service can not be activated”

wrongselection: “the selected option is invalid”

timemenu: "set the time in 24 hours format"

wrongtime: "the time selected is invalid"

finalok: "wake-up service enable"

cancelalarm: "wake-up service disable"

timeis: "setted time is"

min: "minutes"

0..23: hours followed by "and"

n00..n59: minutes

Wakeupmsg: nice music wake-up alert (used in version 1.4 only; in version 2.0 the wake up music is generated by the PBX Waiting Queue object)

Known Problems

In version 1.4, if you activate the Authentication for SIP messages and there are more then two simultaneous calls, the script sends some INVITEs without authentication or with wrong checksum and so not all phones ring.

Download

media:wakeup.zip

XML revisioned by Marc Steiner, inikon AG: media:wakeup-xml.zip

New version of send_call.pl (v1.4 April 2012): media:send_call_perl.zip

Alternative version of send_call.pl (v2.0 september 2013): media:send_call_2_0_perl.zip

Wakeup XML script with norwegian promts, by Vcom - Norway. (11. November 2014): Media:Wakeup_NO.zip

  • Compared to the original wakeup script, this script allow dtmf choices to interrupting the voice promts. The script is also prepared for multi language. New prompts in other languages can be added with the file prefix XX_. Line 9 in the XML script choose language.
  • All promts for hours and minutes can be taken from the innovaphone voicemail promts.
  • Vcom has also created a script for a Linux cron job that can be placed direct on IPx10 application platform. The advantage with this script compared with the Pearl script, is autostart of the script after a reboot of IPx10. Contact support@vcom.no for more info.

Related Articles

Howto:Initiate a Mobility CallBack via simple HTTP GET or POST request