Working SMS Integration

Status
Not open for further replies.
Jan 9, 2018
152
16
18
54
I read on the php some sql inserts for v_sms... and I can see I have that missing on my end.
Could this be why I am not seeing the destinations"?

View attachment 741
Quite possibly. Grab the app_config.php file from my message in #36, above, and put it in /apps/sms, then run Advanced->Upgrade->Schema. You may also want to go ahead and put in the changes for sms_hook_common.php. I mentioned them in December, but I'll attach them here. This file goes in the same folder.
 

Attachments

  • sms_hook_common.php.txt
    6 KB · Views: 19
Jan 9, 2018
152
16
18
54
One note: You may need to adjust your chatplan settings. This is usually located in /etc/freeswitch/chatplan/default.xml. Here's what I use.

Note that I am only allowing it to send through to the external lua script (thus SMS delivery) when it's a 10-digit phone number. Anything else just attempts to deliver internally. Your experience may dictate a different need.
XML:
<?xml version="1.0" encoding="utf-8"?>
<include>
        <context name="default">
                <extension name="demo">
                        <condition field="to" expression="^(.*)$">
                                <!-- <action application="lua" data="test.lua"/> -->
                                <!-- <action application="reply" data="Hello, you said: ${_body}"/> -->
                        </condition>
                </extension>
        </context>   
        <context name="public">
                <extension name="ten-digit">
                        <condition field="to" expression="^(\d{10}.*)$">
                                <action application="set" data="final_delivery=true"/>
                                <action application="lua" data="app.lua sms outbound"/>
                        </condition>
                </extension>
                <extension name="other">
                        <condition field="to" expression="^(.*)$">
                                <action application="set" data="final_delivery=true"/>
                                <action application="send"/>
                        </condition>
                </extension>
        </context>
</include>
 

FuncVOIP

New Member
Apr 20, 2018
14
1
3
29
Not entirely sure but I can't even get v_sms... created. I checked adminer and not there.
Thanks for the feedback John.
I think I am going to try fresh install tomorrow as I can't make progress with this :/
 
  • Like
Reactions: Edson
Jan 9, 2018
152
16
18
54
Not entirely sure but I can't even get v_sms... created. I checked adminer and not there.
Thanks for the feedback John.
I think I am going to try fresh install tomorrow as I can't make progress with this :/
Yes, something is definitely wrong there, and you won't see any info without those tables.

FYI, I just realized that the version of app_config.php I posted above, while correct otherwise and fine for your use in regards to table schema, doesn't contain the additional settings for carrier Telnyx as I mentioned in my original post. I'm prepping a couple of servers for a new install (FPBX 4.4/FS 1.8) and noticed that. I'm hoping to get a clean install set out of this that I can use for submission to the project.
 
Jan 9, 2018
152
16
18
54
I'll just put this out there for those of you attempting to use this module:
I alluded to an issue in the original post, where on some softphone clients it would duplicate the message 120+ times. It will then usually crash/freeze the freeswitch process. It turns out, this was not a problem with the softphone client. It is a problem with Freeswitch. And apparently, not even with the SMS module itself. This bug report indicates that it is an issue with the underlying handler. In spite of the lack of any apparent definite resolution to that bug report, we have only replicated the problem under 1.6.x versions of Freeswitch and not 1.8.x, so it looks like the problem has been fixed. I believe @MTR has also experienced similar results.

Unfortunately, our production systems are currently running 1.6.x, so we have had to disable the module while prepping a transition. There are some complicating factors that make this transition difficult, which I won't go into.

Suffice it to say that I strongly recommend that if you are considering using this module, make sure that you on Freeswitch 1.8.
 
  • Like
Reactions: brb5548

ropeguru

New Member
Feb 28, 2019
25
1
3
56
I posted a new thread, but I guess I could have just asked in this one.

What would it take to add an additional provider? Looking to get SignalWire added in and working with SMS and maybe even MMS since they have that capability.

Any guidance would be greatly appreciated.
 
Jan 9, 2018
152
16
18
54
I posted a new thread, but I guess I could have just asked in this one.

What would it take to add an additional provider? Looking to get SignalWire added in and working with SMS and maybe even MMS since they have that capability.

Any guidance would be greatly appreciated.
In the very first post on this thread, look at the section where I talked about adding support for Telnyx ("How to make SMS work with Telnyx"). This is a model for how to add a new carrier. Now, obviously the specifics will vary somewhat, carrier to carrier, so you will need to look at what SignalWire requires.

In a nutshell, (and without looking at their API at all) you will probably need to add five things:
  1. Add a new 'if carrier = "signalwire"' section to the /apps/sms/index.lua script. This is for outbound.
  2. Add new "sms_hook_signalwire.php" for inbound.
  3. Add new settings under Advanced/Default Settings. This is so it shows up in the GUI and you can pick that carrier.
  4. Add the carrier's send-from IP address to the ACL. This whitelists them for you.
  5. Add webhook URL on SignalWire's site for https://yourdomain/app/sms/hook/sms_hook_signalwire.php.
Those items will likely need some research in SignalWire's site and API documentation. And some trial and error.
 

ropeguru

New Member
Feb 28, 2019
25
1
3
56
Understood and thanks for the info. Just the general, "look at these sections", is what I needed.
 

Edson

Member
Aug 1, 2017
59
4
8
47
Not entirely sure but I can't even get v_sms... created. I checked adminer and not there.
Thanks for the feedback John.
I think I am going to try fresh install tomorrow as I can't make progress with this :/
FuncVoip, i faced the same issue. The tables are not being created. Did you solve it?
 
Jan 9, 2018
152
16
18
54
FuncVoip, i faced the same issue. The tables are not being created. Did you solve it?
When you run Advanced->Upgrade->Schema, are you getting the message that the two "v_sms_*" tables don't exist, that @FuncVOIP was getting? And then at the top, is it trying to create them?
 
Jan 9, 2018
152
16
18
54
Yes, everytime i run Advanced->Upgrade->Schema, it tries to create the tables.
It looks like something is wrong in the \sms\app_config.php file. It's looking for two tables named "v", not finding them, and trying to create them. Instead, it should be looking for "v_sms_messages" and "v_sms_destinations". There may be updates to the 4.4 schema upgrade engine. I've tweaked a couple of settings in the attached. Give this a try and see how it works.
 

Attachments

  • app_config.php.txt
    21.3 KB · Views: 14

Edson

Member
Aug 1, 2017
59
4
8
47
It looks like something is wrong in the \sms\app_config.php file. It's looking for two tables named "v", not finding them, and trying to create them. Instead, it should be looking for "v_sms_messages" and "v_sms_destinations". There may be updates to the 4.4 schema upgrade engine. I've tweaked a couple of settings in the attached. Give this a try and see how it works.
I have already tried to execute this app_config.flie version without success. It seems to be an strange underline character issue "_", isnt it?
 
Jan 9, 2018
152
16
18
54
No, I don't believe so. All of the Fusion tables have similar naming convention. The issue seems to be a difference in the upgrade engine and some changes that were made in 4.4. I've incorporated those in the copy I attached today. Did you try this new version?
 

Edson

Member
Aug 1, 2017
59
4
8
47
And if so, did it change the output any?
Tried to remove the "_" character but the issue still happens. It does not create the table. I am not very familiar with PHP language, maybe this an issue related with PHP version as well.
 
Jan 9, 2018
152
16
18
54
It definitely needs to be "v_sms_messages" and "v_sms_destinations". And this is consistent with the naming convention used throughout FusionPBX.

As to PHP version, I did have problems (unrelated to this) when I tried 7.2 . I reinstalled with 7.1 and it worked much better.
 
Jan 9, 2018
152
16
18
54
Just an idea: You could go into Adminer and copy/paste that CREATE TABLE command out of the Upgrade page and execute it there to see what kind of error it gives you. And if it doesn't error and just works, well then, at least you have the table created.
 
  • Like
Reactions: Edson

Edson

Member
Aug 1, 2017
59
4
8
47
Just an idea: You could go into Adminer and copy/paste that CREATE TABLE command out of the Upgrade page and execute it there to see what kind of error it gives you. And if it doesn't error and just works, well then, at least you have the table created.
The issue was related to a PG database lock situation, as it is a Cluster. Thanks a lot.
 

FuncVOIP

New Member
Apr 20, 2018
14
1
3
29
Sorry for chiming in so late here. Edson what do you mean by PG database lock? I am running a single server. What do you think would be the solution then? Congrats on getting it working by the way and thank you Jonathan!
 
Status
Not open for further replies.