Unable to send SMS Notification via Twilio API

roneskinder6 years ago

This is my traccar.xml file, all the configuration needed for Twilio are there, but is not working, not even having any logs about SMS on tracker-server.log, any ideas what might be happening?

I also have multiple notifications with SMS and Email enabled and i am only receiving email, but no SMS. Any help will be great

<?xml version='1.0' encoding='UTF-8'?>

<!DOCTYPE properties SYSTEM 'http://java.sun.com/dtd/properties.dtd'>

<properties>

    <entry key='config.default'>./conf/default.xml</entry>

    <!--

    This is the main configuration file. All your configuration parameters should be placed in this file.

    Default configuration parameters are located in the "default.xml" file. You should not modify it to avoid issues
    with upgrading to a new version. Parameters in the main config file override values in the default file. Do not
    remove "config.default" parameter from this file unless you know what you are doing.

    For list of available parameters see following page: https://www.traccar.org/configuration-file/

    -->

    <!-- DATABASE CONFIG -->
    <entry key='database.driver'>com.mysql.jdbc.Driver</entry>
    <entry key='database.url'>jdbc:mysql://localhost:3306/****************?useSSL=false&amp;allowMultiQueries=true&amp;autoReconnect=true&amp;useUnicode=y$
    <entry key='database.user'>****************</entry>
    <entry key='database.password'>****************</entry>

    <!-- EMAIL NOTIFICATIONS CONFIG -->
    <entry key='mail.smtp.host'>****************</entry>
    <entry key='mail.smtp.port'>26</entry>
    <entry key='mail.smtp.ssl.enable'>false</entry>
    <entry key='mail.smtp.from'>****************</entry>
    <entry key='mail.smtp.auth'>true</entry>
    <entry key='mail.smtp.username'>****************</entry>
    <entry key='mail.smtp.password'>****************</entry>

    <!-- GOOGLE GEOCODER CONFIG -->
    <entry key='geocoder.enable'>true</entry>
    <entry key='geocoder.type'>google</entry>
    <entry key='geocoder.key'>****************</entry>
    <entry key='geocoder.onRequest'>true</entry>
    <entry key='geocoder.ignorePositions'>true</entry>
    <entry key='geocoder.reuseDistance'>10</entry>
    <entry key='geocoder.cacheSize'>20000</entry>
    <entry key='geocoder.format'>%r, %h, %t, %p, %s, %c</entry>

    <entry key='filter.enable'>false</entry>

    <!-- TWILIO SMS CONFIG -->
    <entry key='notificator.types'>web,mail,sms</entry>
    <entry key='notificator.sms.manager.class'>org.traccar.sms.HttpSmsClient</entry>
    <entry key='sms.http.url'>
        https://api.twilio.com/2010-04-01/Accounts/AC***************/Messages.json
    </entry>
    <entry key='sms.http.user'>AC***************</entry>
    <entry key='sms.http.password'>****************</entry>
    <entry key='sms.http.template'>
        From=%2B17813039668&amp;To={phone}&amp;Body={message}
    </entry>

</properties>
Anton Tananaev6 years ago

Have you tested notifications? What is the response you get?

roneskinder6 years ago

Hi Anton, when you say "tested notifications" is there a test i can make?

What i have done is set up multiple notifications for Web, email and SMS for multiple devices and wait for them to happen, im only receiving web and email notifications like the example below, this was supposed to also send an SMS but did not.

Email today at 6:24am
Device: GT602
Has exited geofence: Office
Time: 2019-05-10 08:24:56
Point: CT-137, 1616, Stamford, 06902, CT, US

Anton Tananaev6 years ago

There is a button to send test notification from the account dialog.

roneskinder6 years ago

Clicked on it and only received an email with message "Test message". Nothing else.

The phone in account preferences is set to +50589597179, my own number that is proven to receive SMS from the twilio platform

Anton Tananaev6 years ago

Unless Twilio has some logs, you should probably debug the code to find out what's happening.

roneskinder6 years ago

Twilio does have logs, nothing in them only my previous tests with from the twilio platform.

I will try debugging the SmppClient.java file, to check the parameters received and the request made.

dirkdeb6 years ago

I enabled sms notification for V4.5, But have obvious configuration problems, hopefully only syntax problems.
I make use of a bulk sms supplier:
The user and sms notifications are configured and linked to the device.
User cellnumber is entered correctly.
Notifications for web is working fine.

My bulk sms supplier instructions:

"Sending Messages (HTTP Parameter based)

The API supports XML and Parameter based sending.
Parameter Based

Make use of parameter driven variables to send.
The function accepts the following parameters:

Type (String) = “sendparam”
Username (String)
Password (String)

Examples:
Send to Single Number:
https://mymobileapi.com/api5/http5.aspx?Type=sendparam&username=xxx&password= yyy&numto=1234567890&data1=mytestmsg

My server settings:
traccar.xml entry:

   <!-- ENABLE CONFIGURE EVENTS -->
    <entry key='event.enable'>true</entry>
    <entry key='event.motionHandler'>true</entry>
    <entry key='event.geofenceHandler'>true</entry>
    <entry key='event.alertHandler'>true</entry>
    <entry key='event.statusHandler'>true</entry>
    <!-- GLOBAL NOTIFICATORS CONFIGURE -->
    <entry key='sms.enable'>true</entry>
    <entry key='notificator.types'>web,sms</entry>
 
<!-- NOTIFICATORS CONFIGURE SMS V4.5  -->
    <entry key='notificator.sms.manager.class'>org.traccar.sms.HttpSmsClient</entry>
    <entry key='sms.http.url'>https://mymobileapi.com/api5/http5.aspx?Type=sendparam</entry>
    <entry key='sms.http.user'>yyyyyyyyy</entry>
    <entry key='sms.http.password'>xxxxx</entry>
    <entry key='sms.http.template'>
         numto={phone}&amp;data1={message}</entry>

Error in log file:
2019-05-15 11:33:18 WARN: Client did not connect. - Connection refused - ConnectException (...)
2019-05-15 11:33:18 WARN: Unable to connect to SMPP server: - Connection refused - ConnectException (...)

I also tested the following as per the bulk sms supplier instructions:

<!-- NOTIFICATORS CONFIGURE SMS V4.5  -->
    <entry key='notificator.sms.manager.class'>org.traccar.sms.HttpSmsClient</entry>
 <entry key='sms.http.url'>https://mymobileapi.com/api5/http5.aspx?Type=sendparam
  &username=yyyyyy&password=xxxxxxxx&numto={phone}&data1={message}</entry> 

This gives me server startup error....
as well as replacing the "&" with "&amp" in the above config.

Any pointers will help.
Thanks for the help.