Play a custom message with wake up call module

Is there a way to use the wake up call module to play a custom message or audio recording? Currently it plays the standard wake up call recording but I would like to customize that recording. I don’t need the options like “press 1 to snooze for 5 minutes” I just need a message played.

Can this be done?

I’m bored waiting for some PBXs to update to the 10 track so I looked into this. Easy/short answer is that all the recordings are stored in /var/lib/asterisk/sounds/en so you can simply replace this-is-yr-wakeup-call.alaw (ulaw and gsm) and have everything work as it did before but with a different recording.

For some hints as to what files are being played or how to change the behavior look at the php file. The php files for each module can be found in /var/www/html/admin/modules. This module is actually called hotelwakeup in case you can’t find anything called Wake Up Calls in that directory. Starting at line 82 you’ll see the section where it plays sound files based on various IF statements. Here’s the specific one you’re looking for, first it says hello and then it plays the greeting.

if ( !$rc[result] )
	$rc = execute_agi( "STREAM FILE hello \"\" ");
if ( !$rc[result] )
	$rc = execute_agi( "STREAM FILE this-is-yr-wakeup-call \"\" ");

To get it to disable the options afterwards I suppose you should just delete the other lines. Just be warned that if you screw with the php files the dashboard will give you warnings every time you log into the GUI, not to mention you might break something. Here’s the whole section of code.

//=========================================================================
// This is where we interact with the caller. Answer the phone and so on
//=========================================================================

$rc = execute_agi( "ANSWER ");

sleep(1);	// Wait for the channel to get created and RTP packets to be sent
				// On my system the welcome you would only hear 'elcome'  So I paused for 1 second




if ( !$rc[result] )
	$rc = execute_agi( "STREAM FILE hello \"\" ");
if ( !$rc[result] )
	$rc = execute_agi( "STREAM FILE this-is-yr-wakeup-call \"\" ");

// initialize a counter so the while loop will eventually expire
$lgcount = 0;

// Start prompting them if they want to snooze or turn off the wake up
while ( !$rc[result] && $lgcount < 15)   // set hard limit of 15 repeats
{
	if ( !$rc[result] )
		$rc = execute_agi( "STREAM FILE to-cancel-wakeup \"1234\" ");
	if ( !$rc[result] )
		$rc = execute_agi( "STREAM FILE press-1 \"1234\" ");
	if ( !$rc[result] )
		$rc = execute_agi( "STREAM FILE to-snooze-for \"1234\" ");
	if ( !$rc[result] )
		$rc = execute_agi( "STREAM FILE digits/5 \"1234\" ");
	if ( !$rc[result] )
		$rc = execute_agi( "STREAM FILE minutes \"1234\" ");
	if ( !$rc[result] )
		$rc = execute_agi( "STREAM FILE press-2 \"1234\" ");
	if ( !$rc[result] )
		$rc = execute_agi( "STREAM FILE to-snooze-for \"1234\" ");
	if ( !$rc[result] )
		$rc = execute_agi( "STREAM FILE digits/10 \"1234\" ");
	if ( !$rc[result] )
		$rc = execute_agi( "STREAM FILE minutes \"1234\" ");
	if ( !$rc[result] )
		$rc = execute_agi( "STREAM FILE press-3 \"1234\" ");
	if ( !$rc[result] )
		$rc = execute_agi( "STREAM FILE to-snooze-for \"1234\" ");
	if ( !$rc[result] )
		$rc = execute_agi( "STREAM FILE digits/15 \"1234\" ");
	if ( !$rc[result] )
		$rc = execute_agi( "STREAM FILE minutes \"1234\" ");
	if ( !$rc[result] )
		$rc = execute_agi( "STREAM FILE press-4 \"1234\" ");
	if ( !$rc[result] )
	{
		$rc = execute_agi( "WAIT FOR DIGIT 15000");
	}
	if ( $rc[result] != -1 )
	{
		if ( $rc[result] == 49 || $rc[result] == 50 || $rc[result] == 51 || $rc[result] == 52 )
		{
			; // Do nothing correct input
		}
		else
		{
			// This was just for fun, if they press something other than 1, 2, 3, or 4
			$rc[result] = 0;
			$rc = execute_agi( "STREAM FILE im-sorry \"\" ");
			$rc = execute_agi( "STREAM FILE you-dialed-wrong-number \"\" ");
			$rc = execute_agi( "STREAM FILE i-dont-understand3 \"\" ");
			$rc = execute_agi( "STREAM FILE your \"\" ");
			$rc = execute_agi( "STREAM FILE communications \"\" ");

		}
	}
	$lgcount++;   // increment counter so loop will give up eventually
}

switch( $rc[result] )
{
case '49':	// Pressed 1  - This is to cancel the wakeup call
	{
			execute_agi( "EXEC background \"wakeup-call-cancelled\" ");
			execute_agi( "EXEC wait \"1\" ");
			execute_agi( "EXEC background \"goodbye\" ");
			execute_agi( "HANGUP" );
			exit;
	}
	break;

case '50':		// Pressed 2 - Snooze for 5 minutes
	{
		$time_wakeup = time( );
		$time_wakeup += 300;

		create_wakeup( $time_wakeup );

		execute_agi( "EXEC background \"rqsted-wakeup-for\" ");
		execute_agi( "EXEC background \"digits/5\" ");
		execute_agi( "EXEC background \"minutes\" ");
		execute_agi( "EXEC background \"vm-from\" ");
		execute_agi( "EXEC background \"now\" ");
	}
	break;

case '51':		// Pressed 3 - Snooze for 10 minutes
	{
		$time_wakeup = time( );
		$time_wakeup += 600;

		create_wakeup( $time_wakeup );

		execute_agi( "EXEC background \"rqsted-wakeup-for\" ");
		execute_agi( "EXEC background \"digits/10\" ");
		execute_agi( "EXEC background \"minutes\" ");
		execute_agi( "EXEC background \"vm-from\" ");
		execute_agi( "EXEC background \"now\" ");
	}
	break;

case '52':		// Pressed 4 - Snooze for 15 minutes
	{
		$time_wakeup = time( );
		$time_wakeup += 900;

		create_wakeup( $time_wakeup );

		execute_agi( "EXEC background \"rqsted-wakeup-for\" ");
		execute_agi( "EXEC background \"digits/15\" ");
		execute_agi( "EXEC background \"minutes\" ");
		execute_agi( "EXEC background \"vm-from\" ");
		execute_agi( "EXEC background \"now\" ");
	}
	break;
}

$rc = execute_agi( "STREAM FILE goodbye “” ");
execute_agi( “HANGUP” );
exit;
}

Ah, the power of Open Source Software once again is revealed.

Thanks for the help! That seems to work. I replaced the audio file this-is-yr-wake-up-call and the system seems to play it. But I can’t seem to get the file in the correct format. It started as an MP3, I tried to use Audacity to change it to .alaw but that didn’t work. Any tips on software to use to convert the file to the correct format?

Use the system recordings module. It will place them under the custom folder

That worked! Thanks guys!