Skip to content

Commit

Permalink
51 signed sms env vars (#1)
Browse files Browse the repository at this point in the history
* Fix issue Vonage#51: add environment variable placeholders for FROM_NUMBER and VONAGE_API_SIGNATURE_SECRET so things work when running sms/send-signed-sms.php

* Fix Vonage#52 - cast 'NUMBER_SEARCH_CRITERIA' as (string).  Added comment to caution use of criteria starting with '0' to avoid conversion-to-octal issues.  Added some more comments while I was at it to help users understand the use of the filter object
  • Loading branch information
gthoffer authored Oct 5, 2020
1 parent 5439eae commit 867c98c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 2 additions & 0 deletions .env-example
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
VONAGE_API_KEY=
VONAGE_API_SECRET=
VONAGE_API_SIGNATURE_SECRET=
VONAGE_APPLICATION_ID=12a3b4cd-a1b2-1ab2-a1b2-a1234bc5d678
VONAGE_APPLICATION_PRIVATE_KEY_PATH=
FROM=
VONAGE_TO_NUMBER=
RECIPIENT_NUMBER=
FROM_NUMBER=
TO_NUMBER=
VONAGE_SECRET_ID=
INSIGHT_NUMBER=
Expand Down
11 changes: 10 additions & 1 deletion numbers/search-available.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,17 @@
$client = new \Vonage\Client($basic);

/** @var IterableAPICollection $response */
/** Note: be careful when specifying "NUMBER_SEARCH_CRITERIA" environment variable:
* surround it with quotes if it has a leading zero, otherwise the (string) conversion
* will assume it is an Octal number and convert it. e.g., (string)0123 results in "83".
* NUMBER_SEARCH_PATTERN will be one of 0 (search for numbers that start with pattern);
* 1 (search for numbers that contain pattern), or 2 (search for numbers that end with pattern).
* VONAGE_NUMBER_TYPE must be one of: landline, mobile-lvn or landline-toll-free
* VONAGE_NUMBER_FEATURES Must be one of: SMS, VOICE, SMS,VOICE, MMS, SMS,MMS, VOICE,MMS
* or SMS,MMS,VOICE
*/
$filter = new AvailableNumbers([
"pattern" => (int) NUMBER_SEARCH_CRITERIA,
"pattern" => (string)NUMBER_SEARCH_CRITERIA,
"search_pattern" => (int) NUMBER_SEARCH_PATTERN,
"type" => VONAGE_NUMBER_TYPE,
"features" => VONAGE_NUMBER_FEATURES,
Expand Down

0 comments on commit 867c98c

Please sign in to comment.