Resource icon

TUTORIAL Send SMS Messages with VoIP.ms 2016-11-3 UPDATE

No permission to download

wardmundy

Nerd Uno
Joined
Oct 12, 2007
Messages
15,071
Reaction score
2,597
wardmundy submitted a new resource:

Send SMS Messages with VoIP.ms - This tutorial will show you how to send SMS messages from PIAF CLI using VoIP.ms.

Here's a quick-and-dirty command line script to send SMS messages using a VoIP.ms DID that is SMS-capable and SMS-enabled.

Download the code here.

Prerequisites:

1. VoIP.ms account with at least one DID that is SMS-capable (cellphone icon appears beside the DID number).

2. SMS-capable DID has been enabled for SMS use. Also configure SMS messaging with a destination email and/or forwarding SMS number to receive replies from the SMS messages you generate.

3. VoIP.ms API has been enabled...
Read more about this resource...
 
Last edited:

wardmundy

Nerd Uno
Joined
Oct 12, 2007
Messages
15,071
Reaction score
2,597
lgaetz: Thanks. Fixed the typo.

VoIP.ms account names are email addresses. That is all that's meant by "email format" for your account name.
 

mikeybs

New Member
Joined
Mar 12, 2014
Messages
6
Reaction score
0
I am unable to get this working. The output of the script contains the entire content of class.voipms.php. No SMS message is sent. Error messages are generated if I use bad arguments:
ERROR: SMS number must be 10 digits.

SYNTAX: ./voipms-sms.php smsnumber "sms message"
I enabled voip.ms API, enabled SMS on my desired DID, I created an API password. I am using my email address associated with my voip.ms account and the API password I created.
Any ideas?
 

wardmundy

Nerd Uno
Joined
Oct 12, 2007
Messages
15,071
Reaction score
2,597
Works fine for me.

In class.voipms.php, you should have:
Code:
    var $api_username  = '[email protected]';
    var $api_password  = 'yourAPIpassword';
And in voipms-sms.php, you should have:
Code:
// This must be your actual VoIP.ms number that supports SMS
$SMSsender="8435551212";
Then send away:
Code:
# This must be a valid number that can receive SMS messages
./voipms-sms.php 8085551212 "Here is a test message"
 

mikeybs

New Member
Joined
Mar 12, 2014
Messages
6
Reaction score
0
That is exactly what I've done.... There is no useful output at all. The output is the content of class.voipms.php
there is no error message or anything like that....
 

wardmundy

Nerd Uno
Joined
Oct 12, 2007
Messages
15,071
Reaction score
2,597
What's the platform on which you are trying to use this??
 

mikeybs

New Member
Joined
Mar 12, 2014
Messages
6
Reaction score
0
not sure what you mean... do you mean the output of the script?
 

mikeybs

New Member
Joined
Mar 12, 2014
Messages
6
Reaction score
0
I am not running PBXinaflash, there is no status command. I am running stock centos7 with freepbx installed manually.
 

wardmundy

Nerd Uno
Joined
Oct 12, 2007
Messages
15,071
Reaction score
2,597
I am not running PBXinaflash, there is no status command. I am running stock centos7 with freepbx installed manually.

Oh. Sorry we only support the PIAF and Incredible PBX platforms. You might look through one of the Incredible PBX install scripts to see what package(s) you may be missing or contact voip.ms support and see if they have any suggestions.
 

lifespeed

Member
Joined
Sep 25, 2010
Messages
287
Reaction score
0
Location
San Jose, CA
I am running PIAF 1.7.5.5 Asterisk 1.8.3.2. Am I hopelessly out of date to try to implement SMS? I have significant (to me anyway) customization to port over were I to upgrade.
 

bond007

New Member
Joined
Nov 2, 2016
Messages
6
Reaction score
2
I had what seems to be the same issue. Script runs but no SMS was sent. After I added the stream_context option it got the API to connect to voip.ms.

Ward may want to add links to this and my other reply in the main thread for the script so folks are aware they may need to modify things slightly depending on their installation.

Code:
  /*******************************************\
     *  VoIPms - SoapClient / SoapCall
    \*******************************************/
    var $soap_client;
    function soapClient(){
        $this->soap_client = new SoapClient(null, array(
                'location'      => "https://voip.ms/api/v1/server.php",
                'uri'           => "urn://voip.ms",
                'soap_version'  => SOAP_1_2,
                'trace'         => 1,
                'stream_context'=> stream_context_create(array('ssl'=> array('ve
rify_peer'=>false,'verify_peer_name'=>false)))
            )
        );
    }
 
  • Like
Reactions: wardmundy

Members online

PIAF 5 - Powered by 3CX

Forum statistics

Threads
22,317
Messages
136,958
Members
14,542
Latest member
k0dean