Good job
@Prits ! I'm glad you got the sms to email part to work.
@kenn10 's and
@jerrm 's help is invaluable as there are so many ends to master in order to get all the pieces to work together. IncrediblePBX is a complex mix of software to handle if it needs to be setup outside of its intended configuration.
When you need to do troubleshooting, it calls on every bit of knowledge and experience that you have accumulated over the years, and even that is often not enough, hence the need to follow closely forums such as this.
Regarding the firewalling matter that turned out to be the culprit (at least partially) in your case, I traditionally took a different approach on my home grown systems; I always dismantle all firewalling from the application servers like the PBX, web server, etc. Instead I use the firewall on my main router which for the last 10+ years has always been pfsense.
Now for the second part of the setup, install the sms-tx.php script where you've installed sms-rx.php.
(Make sure that the required php modules are installed on your PBX. The info is in the comments of the script file)
Then adjust its settings in the private/personal data section so that the mailbox which will be monitored is properly identified. There are 3 parameters for that; the server URL, the user id and the password. There is a gmail example which shows you what it's supposed to look like. The $hostname should include the full path to the IMAP incoming email box. It's not just the domain name. Again, look at the example.
The $AllowKey variable is a simple authorization code that you can set to anything you want. The example is "SendIt". What it means is that if you're not replying to an incoming message, thus making a fresh new outgoing text message, you need to have the variable KEY in addition to SMS_FR and SMS_TO entered on the subject line in the proper format (no space but the & sign as a separator, you should have KEY=SendIt if you keep the default authorization code) just like what the subject line structure looks like when you receive a message or reply to it.
Then you need to put in your BulkVS parameters API key and API secret. The URL is already in there and it's the same for all, so there is no need to change it.
Once the transmission script is properly configured, run the following command on the console of your PBX:
watch -n 10 "curl
https://MyPBX.MyDomainName.com/sms-tx.php"
(Adjust the domain name and the URL to your PBX's path)
This will launch the script every 10 seconds, and if you replied to any incoming emailed sms message, or made an outbound one, it will process it and send it upstream through BulkVS' gateway.
If everything works the way it should, you can send to your BulkVS DID a text message from your cell phone and it will appear in your inbox almost instantly.
Then, when you reply to that email message, you'll see the reply text on your cell within 10 to 12 seconds.
To make the return faster you can reduce the script execution interval from 10s to 5s, but at some point the mailbox access timing will become the culprit. So, you can reasonably expect a 5 to 10 second responsiveness.
Now if the monitored mailbox is on your hardware within your control there are ways you can improve the responsiveness of everything and reduce the whole cycle to 1-2 seconds. That's the best I've achieved so far.
Ok, give it a try and see how it works for you. Keep us informed of your progress.
Once everything above worked for you, we'll trigger the periodic execution of the transmission script on your machine with a local cron job.
PS: Also, make sure that the reply-to address in the sms-rx.php script file corresponds to the email box that the transmission script sms-tx.php will be monitoring. Otherwise the reply message won't be properly routed.