Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add title to input method #29

Merged
merged 2 commits into from
Feb 26, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ You can also tie this into an existing extension based system, say for example G

When configuring the TwiML app instead of pointing to `index.php` point to `input-method.php?Digits=2`.

If you still want the title to display also point to `input-method.php?Digits=2&PlayTitle=1`.

## Including province prior to lookup

It may be that your yap instance needs to search multiple states. By default yap will be biased towards the local number state (unless it's tollfree). To enable province lookup set the `$province_lookup`, variable to `true` in the `config.php` file.
Expand Down
8 changes: 8 additions & 0 deletions input-method.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>";

$searchType = $_REQUEST['Digits'];
$playTitle = isset($_REQUEST['PlayTitle']) ? $_REQUEST['PlayTitle'] : 0;

if ($searchType == "1") {
$searchDescription = "someone to talk to";
Expand All @@ -14,6 +15,13 @@
?>
<Response>
<Gather numDigits="1" timeout="10" action="input-method-result.php?SearchType=<?php echo $searchType ?>" method="GET">

<?php
if ($playTitle == "1") {
echo "<Say voice=\"" . $voice . "\" language=\"" . $language . "\">" . $GLOBALS['title'] . "</Say>";
}
?>

<Say voice="<?php echo $voice; ?>" language="<?php echo $language; ?>">Press 1 to search for <?php echo $searchDescription ?> by city or county name.</Say>
<Say voice="<?php echo $voice; ?>" language="<?php echo $language; ?>">Press 2 to search for <?php echo $searchDescription ?> by zip code.</Say>
</Gather>
Expand Down