Advertisement
Guest User

Untitled

a guest
Nov 24th, 2014
144
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.31 KB | None | 0 0
  1. require_once "config.php";
  2.  
  3. // generate menu using builder
  4. $caller_ddi = $_REQUEST['caller'];
  5.  
  6. $connect_success = $config['messages']['wait_we_connect']; // success message to be played
  7. $office_closed = $config['messages']['office_closed']; // message to be played when it is saturday/sunday to let the caller know office is closed
  8. $operator1 = $config['user_operator']['bob'];
  9. $operator2 = $config['user_operator']['alice'];
  10.  
  11.  
  12. $xml =<<< XML
  13. <menu audio ="$connect_success" >
  14. XML
  15. ;
  16.  
  17.  
  18. $day = date("w");
  19. $hour = date("H");
  20.  
  21. if(($day == "1" || $day == "2" || $day == "3") && $hour < 18)
  22. {
  23. $xml .= <<< XML<action default="true" type="dial_short_number">$operator1</action>XML;
  24. }
  25. else if(($day == "1" || $day == "2" || $day == "3") && $hour >= 18)
  26. {
  27. $xml .= <<< XML <action default="true" type="dial_voicemail">$operator1</action>XML;
  28. }
  29. else if(($day == "4" || $day == "5") && $hour < 18)
  30. {
  31. $xml .=<<< XML<action default="true" type="dial_short_number">$operator2</action>XML;
  32. }
  33. else if(($day == "4" || $day == "5") && $hour >= 18)
  34. {
  35. $xml .= <<< XML <action default="true" type="dial_voicemail">$operator2</action>XML;
  36. }
  37. else if(($day == "6" || $day == "0"))
  38. {
  39. $xml .= <<< XML <action default="true" type="hangup" audio="$office_closed"></action>XML;
  40. }
  41.  
  42. $xml .= <<< XML</menu>XML;
  43. echo $xml;
  44. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement