Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- require_once "config.php";
- // generate menu using builder
- $caller_ddi = $_REQUEST['caller'];
- $connect_success = $config['messages']['wait_we_connect']; // success message to be played
- $office_closed = $config['messages']['office_closed']; // message to be played when it is saturday/sunday to let the caller know office is closed
- $operator1 = $config['user_operator']['bob'];
- $operator2 = $config['user_operator']['alice'];
- $xml =<<< XML
- <menu audio ="$connect_success" >
- XML
- ;
- $day = date("w");
- $hour = date("H");
- if(($day == "1" || $day == "2" || $day == "3") && $hour < 18)
- {
- $xml .= <<< XML<action default="true" type="dial_short_number">$operator1</action>XML;
- }
- else if(($day == "1" || $day == "2" || $day == "3") && $hour >= 18)
- {
- $xml .= <<< XML <action default="true" type="dial_voicemail">$operator1</action>XML;
- }
- else if(($day == "4" || $day == "5") && $hour < 18)
- {
- $xml .=<<< XML<action default="true" type="dial_short_number">$operator2</action>XML;
- }
- else if(($day == "4" || $day == "5") && $hour >= 18)
- {
- $xml .= <<< XML <action default="true" type="dial_voicemail">$operator2</action>XML;
- }
- else if(($day == "6" || $day == "0"))
- {
- $xml .= <<< XML <action default="true" type="hangup" audio="$office_closed"></action>XML;
- }
- $xml .= <<< XML</menu>XML;
- echo $xml;
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement