From 13ceb766e0aad722a20290ede1f83bab08fa6d87 Mon Sep 17 00:00:00 2001 From: gthoffer Date: Fri, 2 Oct 2020 14:54:02 -0500 Subject: [PATCH 1/5] Fix issue #51: add environment variable placeholders for FROM_NUMBER and VONAGE_API_SIGNATURE_SECRET so things work when running sms/send-signed-sms.php --- .env-example | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.env-example b/.env-example index c6e0e2c..bc0c35a 100644 --- a/.env-example +++ b/.env-example @@ -1,10 +1,12 @@ VONAGE_API_KEY= VONAGE_API_SECRET= -VONAGE_APPLICATION_ID= +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= From 082a58ca75e731aec0d7934cbb2c033a66584d09 Mon Sep 17 00:00:00 2001 From: gthoffer Date: Fri, 2 Oct 2020 15:22:16 -0500 Subject: [PATCH 2/5] Fix #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 --- numbers/search-available.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/numbers/search-available.php b/numbers/search-available.php index 3098479..7b87a06 100644 --- a/numbers/search-available.php +++ b/numbers/search-available.php @@ -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, From f4a94f2eb8da7d88a03292e2e7799325bf5584f7 Mon Sep 17 00:00:00 2001 From: gthoffer Date: Fri, 2 Oct 2020 15:22:16 -0500 Subject: [PATCH 3/5] Fix #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 --- numbers/search-available.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/numbers/search-available.php b/numbers/search-available.php index 3098479..7b87a06 100644 --- a/numbers/search-available.php +++ b/numbers/search-available.php @@ -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, From fc566f78b1e13819bc2f8190d96f34c684a396c3 Mon Sep 17 00:00:00 2001 From: gthoffer Date: Mon, 5 Oct 2020 16:10:33 -0500 Subject: [PATCH 4/5] fix: remove unnecessary comment information The information in the code snippet duplicates the online documentation, so there is no need to include it in the PHP code. --- numbers/search-available.php | 5 ----- 1 file changed, 5 deletions(-) diff --git a/numbers/search-available.php b/numbers/search-available.php index 7b87a06..3af0985 100644 --- a/numbers/search-available.php +++ b/numbers/search-available.php @@ -12,11 +12,6 @@ /** 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" => (string)NUMBER_SEARCH_CRITERIA, From 22b85307efe0446a9da2151581f25c4412132066 Mon Sep 17 00:00:00 2001 From: gthoffer Date: Mon, 5 Oct 2020 16:10:33 -0500 Subject: [PATCH 5/5] fix: remove unnecessary comment information The information in the code snippet duplicates the online documentation, so there is no need to include it in the PHP code. --- numbers/search-available.php | 5 ----- 1 file changed, 5 deletions(-) diff --git a/numbers/search-available.php b/numbers/search-available.php index 7b87a06..3af0985 100644 --- a/numbers/search-available.php +++ b/numbers/search-available.php @@ -12,11 +12,6 @@ /** 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" => (string)NUMBER_SEARCH_CRITERIA,