FOOD FOR THOUGHT BulkVS.com -- Great Origination/Termination/TF rates!

Halea, you have your private messages/conversations turned off. I hacked a routine which reads and IMAP mailbox to check for and then send via fax a pdf using lines formatted within the body. It's not perfect - but it works. If I can get your email/dropbox, I'll send the code your way.

Andrew

I've written a php script that fetches any email from a designated (drop-)mailbox, check the subject line for "from_phone", "to_phone" and "sms_text", and if all three exist use the curl php function send the sms out, then delete the email message. It mostly works but the php imap function(s) used to access an imap mail account seem to be buggy at least in php5.
Anyone has some experience with php imap, either in php5 or php7 and email fetching+parsing?
 
Ward - bulkvs tells me that vitelity has not fully released the number which I ported over to bulkvs, so I raised that issue with vitelity but no response as yet. Thanks again for the code. I am learning a lot by reading your code.
Ward, your sms send script works but only accepts the first word after the destination number on the command line unless the message is in quotes. Is that expected or did I type something wrong.
 
Yep. BASH uses spaces to separate variables. Without the quotes, it sees the next word after the space as a new variable.
 
Halea, you have your private messages/conversations turned off. I hacked a routine which reads and IMAP mailbox to check for and then send via fax a pdf using lines formatted within the body. It's not perfect - but it works. If I can get your email/dropbox, I'll send the code your way.

Andrew
Not done on purpose, unfortunately not very knowledgeable about forum settings (I still can't manage to post code in a post window LOL!) :smash:
On the other hand, I got my code fixed, extensively tested and finalized. I posted it here (somewhere) today :clap:
Hopefully it will be useful for those who want to send/receive sms messages via bulkvs.
 
Great to see this thread with all the comments about bulkvs. I've been having great success with them for quite a while now. Some of the config, illustrated in the posts here, show that configuring for IP Auth is a PITA, but it works great in the end. I've now ported everything away from Vitelity. My Vitelity account was via Ward; I was quite pissed to find that they keep billing you even after a number is ported. That cost me a few dollara, but it will cost them a lot more because I'm done with Vitelity.

My only current gripe with bulkvs is the always-on CNAM lookup on inbound calls. A bunch of my clients are restaurants, where they tend to have very high call volume, but very short calls (ordering). Looking at my billing, I see that 40% of my cost for a month was CNAM, and CNAM was more than my cost for Origination Minutes. Any hints on how to fix this appreciated.
 
My only current gripe with bulkvs is the always-on CNAM lookup on inbound calls. A bunch of my clients are restaurants, where they tend to have very high call volume, but very short calls (ordering). Looking at my billing, I see that 40% of my cost for a month was CNAM, and CNAM was more than my cost for Origination Minutes. Any hints on how to fix this appreciated.

It can't be "fixed" it's part of their pricing model. It might be better to have some high volume callees on a different platform that doesn't require you to have cnam. It's still probably cheaper to pay it given the aggressive pricing.
 
After reviewing my bulkvs billing again, I see my average Origination call cost, including CNAM, is $0.0018469, including the CNAM queries. So, that is not so bad. And, for Termination, PureCall via TelecomsXchange has been very solid at $0.0011 to $0.0015 for USA. (You just have to add an email filter for all the darn rate updates. I get five or six a day. It turns out they do rate conversion from Euros, and, duh, the rate fluctuates with the exchange rate!)
 
If you want to play with BulkVS SMS and you have a public-facing web server, create a subdirectory called bulkvs-sms and then put this into an index.php file in that directory with your $deliverto email address:
Code:
<?php

// Syntax for delivery from bulkvs.com SMS Forwarding Service: http://yourdomain.org/sms-bulkvs/index.php?from=$[from]$&to=$[to]$&message=$[message]$

  $deliverto = "[email protected]";
//  $deliverto = "[email protected]";
  $from = htmlspecialchars($_REQUEST['from']);
  $to = htmlspecialchars($_REQUEST['to']);
  $message = htmlspecialchars($_REQUEST['message']);
  $subject="SMS Message from $from to $to";
  $comment="SMS Message\n\nFROM: $from\n\nTO: $to\n\nMSG: $message\n\n";
  mail("$deliverto", "$subject", "$comment", "$from");
  echo "OK";
?>

Under the SMS tab in your BulkVS portal, set the SMS Provisioning URL to: http://yourdomain.org/bulkvs-sms/index.php. Then enable SMS on your DID, and you're all set.

Greetings all. Long time user of PIAF, apparently my first post to the new site.

Has anyone had any luck getting a php set up for the 911 notification? For some reason BVS sends it as JSON, rather than the format used for SMS. I can get 922 (test call) to trigger my php, but not to decode the details.

Code:
Step 2: When a E911 call is made a notification is sent to your server, you will receive a POST (JSON format) from the BulkVS servers in one of the following three forms.

NOTE: In our example we will use 3109060901 as the caller of 911 and 1.1.1.1 as the example server who made the 911 call.

Example 1: Normal call which completed
{"Caller ID":"13109060901","Called":"911","Result":"Number Provisioned. Call allowed.","IP Address":"1.1.1.1","Time":"Wed, 12 Feb 20 13:46:00 +0000","Unixtime":13109060901}

Any insight appreciated.

Best regards,

PS - I have used BVS for 911 for almost 2 years, and was never able to get SIP connectivity to work reliably. Recently I gave PJSIP a shot and it worked straight away. I've ported over a few numbers already. Can't beat the service (so far). Texting was not an issue because I was already set up for SMS through Anveo Direct and this is nearly the same.
 
Yes, I posted about this a few months ago, google away.
 
Has anyone had any luck getting a php set up for the 911 notification? For some reason BVS sends it as JSON, rather than the format used for SMS. I can get 922 (test call) to trigger my php, but not to decode the details.
JSON processing is quite straigt forward. I've been using the following code successfully. Give a try.

<?php /* Replace following labels with your personal data: [archive-email-address] for instance [email protected] [destination-email-address] for instance [email protected] */ /* This is e911.php A tiny script from Halea for the purpose of receiving e911 messages from BulkVS and emailing them out. The incoming URL from BulkVS is like: http://[YOUR-WEBSERVER]:80/e911.php with a POST in JSON format with one of the following three payloads: Example 1: Normal call which completed {"Caller ID":"13109060901","Called":"911","Result":"Number Provisioned. Call allowed.","IP Address":"1.1.1.1","Time":"Wed, 12 Feb 20 13:46:00 +0000","Unixtime":13109060901} Example 2: Unprovisioned call rejected with 503, you have not added this number to our database {"Caller ID":"13109060901","Called":"911","Result":"Number not Provisioned. Rejected call with SIP 503 Message.","IP Address":"1.1.1.1","Time":"Wed, 12 Feb 20 13:44:14 +0000","Unixtime":1581515054} Example 3: Unprovisioned call allowed through, you have not added this number to our database but as previously requested you would like these calls allowed for a fee. {"Caller ID":"13109060901","Called":"911","Result":"Number not Provisioned. Call allowed and Unprovisioned Fee has been assessed to your account.","IP Address":"1.1.1.1","Time":"Wed, 12 Feb 20 13:46:46 +0000","Unixtime":1581515206} In response the sender would expect the word "OK" as the response to indicate receipt. */ // Let's determine the IP address of the gateway which POSTed this JSON to our server: // whether ip is from share internet if (!empty($_SERVER['HTTP_CLIENT_IP'])) { $ip_address = $_SERVER['HTTP_CLIENT_IP']; } // whether ip is from proxy elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) { $ip_address = $_SERVER['HTTP_X_FORWARDED_FOR']; } // whether ip is from remote address else { $ip_address = $_SERVER['REMOTE_ADDR']; } // echo $ip_address; // The incoming json string from bulkvs is structured like: // $json = {"Caller ID":"13109060901","Called":"911","Result":"Number Provisioned. Call allowed.","IP Address":"1.1.1.1","Time":"Wed, 12 Feb 20 13:46:00 +0000","Unixtime":13109060901} $json = file_get_contents('php://input'); $json_array = json_decode($json,TRUE); // The "From:" field in an email message is required for proper processing although not necessary in our case. Nevertheless, we will use one which will also serve as a carbon-copy message archive for the gateway. $email_headers = "From: [archive-email-address]"."\r\n"."CC: [archive-email-address]"; $email_to = "[destination-email-address]"; $email_subject = "JSON_POST_FR_IP ".$ip_address." says 911_Call_Request from CID ".$json_array['Caller ID']." to ".$json_array['Called'].", which resulted in: ".$json_array['Result']; $email_text = "JSON POST from BulkVS is parsed as follows \r\n"; $email_text .= "------------------------------------------ \r\n"; $email_text .= "Caller ID : ".$json_array['Caller ID']."\r\n"; $email_text .= "Called : ".$json_array['Called']."\r\n"; $email_text .= "Result : ".$json_array['Result']."\r\n"; $email_text .= "IP Address : ".$json_array['IP Address']."\r\n"; $email_text .= "Time : ".$json_array['Time']."\r\n"; $email_text .= "Unixtime : ".$json_array['Unixtime']."\r\n"; // Following requires that sendmail is installed and operational on the web server where this php file is running. mail($email_to,$email_subject,$email_text,$email_headers); echo "OK"; ?>
 
JSON processing is quite straigt forward. I've been using the following code successfully. Give a try.

Thanks very much.

Related question (after a comment): for Anveo Direct I managed to decipher their send-SMS cURL command and turn it into a browser-usable script. But I am confounded by the BVS cURL and haven't been able to do the same for it. Do you/have you found a method to convert BVS into a https command?

For example, this is the command for AD: https://www.anveo.com/api/v1.asp?apikey=123456789&action=sms&from=12125556666&destination=12025554444&message=This is a test. (note: the %20's don't show up between words in the inline code of the 'message' portion, but in the actual http url are present).

I've tried various approaches but no success (no quotes around fields, single quote, double quote, ampersands between fields, etc): https://portal.bulkvs.com/sendSMS?apikey=12345678&apisecret=987654321&from=19595556666&to=121266677777&message=Test 3.

(I keep a local copy of the script on my various devices (not published on the web due to the api keys) and use it for sending SMS when required. It works quite well for Anveo and I'd like to do the same for BVS.)

See: https://www.dslreports.com/forum/r32373314-

Cheers,
 
@user17600: Did you try the code in our Nerd Vittles article??

I did - it was your suggestion to try PJSIP that got me re-engaged with BVS. However that script relies on cURL, which none of the family devices has natively (Windows).

I can run that script (or the one from BVS, I don't recall) on the PBX, the router (Merlin) or my RPi SMS server, but that requires the user log onto a separate device (which is fine for me, not so much the other family members).
 
Related question (after a comment): for Anveo Direct I managed to decipher their send-SMS cURL command and turn it into a browser-usable script. But I am confounded by the BVS cURL and haven't been able to do the same for it. Do you/have you found a method to convert BVS into a https command?
The way I send sms via bulkvs is by emailing my message to an outgoing-sms-emailbox. There is a php script that checks the mailbox periodically. Each email is fetched from the mailbox, its content parsed and formatted to bulkvs' sms requirements (json) and curl'ed to it.
The API key is a static variable in the php script file, so it's not being sent every time as part of the emailed material.
If you don't want to keep it on the server where the script is processed you can change the script so that it takes the API info from the body of the email, but then you would need to include it for each and every email. But since email relays are not guaranteed to be encrypted that would put the API at greater risk than if it is on the gateway server.

My sms gateway to bulkvs has been described in this post: https://www.voip-info.org/forum/threads/bulkvs-sms-reception-transmission-gateway-php-code.24538/ . My scripts are in the post too.

Back to your question; it would probably be possible to extract from my php code what's needed to locally construct the https string and send it straight to bulkvs' gateway without going through an email box. But I started my project with heavy focus on the incoming sms part and built the outgoing as a reply function first. Then it morphed into a general purpose sms transmission tool.

The other unknown would be what happens if multiple devices (quasi) simultaneously hit the bulkvs sms gateway with the same API. With my approach all the messages are processed sequentially one at a time so normally there is no concurrency.

If/when I have time the next couple of days I'll try to cook something along the lines of what you've described.
 
I did - it was your suggestion to try PJSIP that got me re-engaged with BVS. However that script relies on cURL, which none of the family devices has natively (Windows).

I can run that script (or the one from BVS, I don't recall) on the PBX, the router (Merlin) or my RPi SMS server, but that requires the user log onto a separate device (which is fine for me, not so much the other family members).
I encountered the same problem. I ended up using the Windows Linux Subsystem to give me a bash console which allowed me to use the script. I have a small batch file on my Windows desktop with runs the WLS and asks me for the number and message. It is crude but it works and keeps my staff from accessing the server. I put together a similar setup on android using the termux app and a link on my home screen which runs the send sms script.

Windows can run curl commands but I could never figure out the correct sequence so I went the WLS route.

I spent a few hours this weekend trying to write a python program to accomplish this so that I did not need to use WLS but my programming skills tend to peter out around print ("Hello World").

I want to utilize the script developed by Halea but have not gone down that road just yet.
 
However that script relies on cURL, which none of the family devices has natively (Windows).
Curl and bash are available for Windows both as windows executables(any Win version) and via WSL(Windows 10).

If by "native" you mean you don't need to download anything, powershell and wscript/cscript can easily do the job.
 
Get 3CX - Absolutely Free!

Link up your team and customers Phone System Live Chat Video Conferencing

Hosted or Self-managed. Up to 10 users free forever. No credit card. Try risk free.

3CX
A 3CX Account with that email already exists. You will be redirected to the Customer Portal to sign in or reset your password if you've forgotten it.
Back
Top