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 SMS-provider spesific exception handlers #148

Open
kengu opened this issue Aug 19, 2014 · 0 comments
Open

Add SMS-provider spesific exception handlers #148

kengu opened this issue Aug 19, 2014 · 0 comments
Assignees
Labels
Milestone

Comments

@kengu
Copy link
Member

kengu commented Aug 19, 2014

To prevent and handle known errors, like Nexmo which reports "15: Illegal sender address" when sending SMS to recipients in the United States with a sender id violating the limited numeric sender only policy of US and Canada carriers. The solution is to use a a pre-approved virtual long number which you can purchase on the Nexmo site. In this case, the exception handler should do two things

Check (exceptions before sending sms)

  1. Check if recipient address a home base (country) which requires a private number
  2. It it does, check if a private number is associated with the account and replace default sender id with it
  3. If it does, and no private number was found, notify user BEFORE sending the SMS

Handle (errors after sending sms)

  1. Check if an exception handle exist for given error context
  2. If it does, run exception handler

Implementation
These steps should be implemented using interfaces, for example

interface RescueMe\SMS\Check {
        /**
         * @param string $country Country code (ISO2)
         * @param string $number Local number
         * @param array $params Parameters to service
         * @return boolean|array True if allowed, adapted parameters otherwise.
         */
        public function recipient($country, $number);
}
interface RescueMe\SMS\Handle {
        /**
         * @param string $country Country code (ISO2)
         * @param string $number Local number
         * @param array $params Parameters used to invoke service
         */
        public function error($error, $message, $params);
}

Important: Exception resolutions should be configurable from the SMS provider setup page.

@kengu kengu changed the title Add SMS-provider spesific exception handlers to prevent and handle known errors Add SMS-provider spesific exception handlers Aug 19, 2014
@kengu kengu self-assigned this Aug 19, 2014
@kengu kengu modified the milestone: 1.0.0-RC03 Sep 6, 2017
@kengu kengu added the high label Apr 25, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant