Skip to content

Commit 867c98c

Browse files
authored
51 signed sms env vars (#1)
* 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
1 parent 5439eae commit 867c98c

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

.env-example

+2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
VONAGE_API_KEY=
22
VONAGE_API_SECRET=
3+
VONAGE_API_SIGNATURE_SECRET=
34
VONAGE_APPLICATION_ID=12a3b4cd-a1b2-1ab2-a1b2-a1234bc5d678
45
VONAGE_APPLICATION_PRIVATE_KEY_PATH=
56
FROM=
67
VONAGE_TO_NUMBER=
78
RECIPIENT_NUMBER=
9+
FROM_NUMBER=
810
TO_NUMBER=
911
VONAGE_SECRET_ID=
1012
INSIGHT_NUMBER=

numbers/search-available.php

+10-1
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,17 @@
99
$client = new \Vonage\Client($basic);
1010

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

0 commit comments

Comments
 (0)