SMS

Status
Not open for further replies.

Bifur

Member
Sep 13, 2020
122
9
18
Is the SMS app (https://github.com/fusionpbx/fusionpbx-apps/tree/master/sms) still the proper way to enable SMS inside of FusionPBX? I have looked at all of the threads (some quite dated) and want to make sure I am moving in the right direction. I see Messaging under applications, but not sure if that is another method to get things going. I will be using Telnyx for the SMS support.

Any insights would be great!

Thank you!
 

Bifur

Member
Sep 13, 2020
122
9
18
So I followed the steps, but I am a bit confused on a couple things. The main thing is step 16 for the SMS app instructions:
Add your callback URL on your carrier to IE for twillio it would be: https://YOURDOMAIN/app/sms/hook/sms_hook_twilio.php

That step is just not clear to me and I do not understand what I am suppose to do. I see my sms_hook_telnyx.php file.

The second part is the carrier access key and carrier secret key. I assume the secret key would be my API key generated in Telnyx? I am not sure if there is a carrier access key for them or maybe it is different terminology?
 

Bifur

Member
Sep 13, 2020
122
9
18
I have inbound "working" but it is broken. I can send a SMS from my cell phone to my SMS enabled DID, it hits Fusion, groundwire receives a text, but it is from 0 and the message is blank.

I realized the https://YOURDOMAIN/app/sms/hook/sms_hook_twilio.php needed to be added in Telnyx to forward the messages to. Getting closer though.
 

Bifur

Member
Sep 13, 2020
122
9
18
I have inbound working now. I was trying to use Telnyx APIv2 but it looks like the SMS app was designed around version 1. Changing my settings over to use version 1 allowed inbound to come through and display properly.

Now I am working on outbound. Information on this seems more scarce though. I have uncommented the line <action application="lua" data="app.lua sms outbound"/> in /etc/freeswitch/chatplan/default.xml which I came across in other forum posts. That seemed to help others send, but I am still receiving:

2021-04-18 11:06:06.068702 [INFO] mod_sms.c:368 Processing text message 201->5551234567 in context public
Chatplan: 5551234567 parsing [public->demo] continue=false
Chatplan: 5551234567@pbx.domain.com Regex (PASS) [demo] to(5551234567@pbx.domain.com) =~ /^(.*)$/ break=on-false
2021-04-18 11:06:06.068702 [DEBUG] mod_sms.c:477 SMS chatplan no actions found
2021-04-18 11:06:06.068702 [DEBUG] sofia_presence.c:225 Can't find registered user 5551234567@pbx.domain.com
2021-04-18 11:06:06.068702 [WARNING] sofia_presence.c:4817 Not sending message to ourselves!
 

bbardon

New Member
Jun 20, 2020
16
1
3
68
I am using the v1 API as well. I just sent a text out and watched the fs_cli. It doesn't match on the name "demo", but rather on "ten-digit".

2021-04-19 09:54:06.487756 [INFO] mod_sms.c:368 Processing text message 101->4999999999 in context public Chatplan: 4999999999 parsing [public->ten-digit] continue=false Chatplan: 4999999999@host.domain.tld Regex (PASS) [ten-digit] to(4999999999@host.domain.tld) =~ /^(\d{10}.*)$/ break=on-false Chatplan: 4999999999@host.domain.tld Action set(final_delivery=true) Chatplan: 4999999999@host.domain.tld Action lua(app.lua sms outbound)

This /etc/freeswitch/chatplan/default.xml is working for me. Note the action lines in the demo ext are still commented.

<?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>
 

Bifur

Member
Sep 13, 2020
122
9
18
I am using the v1 API as well. I just sent a text out and watched the fs_cli. It doesn't match on the name "demo", but rather on "ten-digit".

2021-04-19 09:54:06.487756 [INFO] mod_sms.c:368 Processing text message 101->4999999999 in context public Chatplan: 4999999999 parsing [public->ten-digit] continue=false Chatplan: 4999999999@host.domain.tld Regex (PASS) [ten-digit] to(4999999999@host.domain.tld) =~ /^(\d{10}.*)$/ break=on-false Chatplan: 4999999999@host.domain.tld Action set(final_delivery=true) Chatplan: 4999999999@host.domain.tld Action lua(app.lua sms outbound)

This /etc/freeswitch/chatplan/default.xml is working for me. Note the action lines in the demo ext are still commented.

<?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>

Thank you so much for your reply. I set up a new server yesterday and just enabled SMS. I have inbound working fine, but outbound is still a no go. I see that the context ten-digit passes now, but I am receiving an error still. Here is a copy of the logs. Maybe you could point me in the right direction! Thanks again.

021-04-19 23:59:15.211935 [INFO] mod_sms.c:368 Processing text message 201->15551234567 in context public
Chatplan: 15551234567 parsing [public->ten-digit] continue=false
Chatplan: 15551234567@pbx.mydomain.com Regex (PASS) [ten-digit] to(15551234567@pbx.mydomain.com) =~ /^\+?1?(\d{10}.*)$/ break=on-false
Chatplan: 15551234567@pbx.mydomain.com Action set(final_delivery=true)
Chatplan: 15551234567@pbx.mydomain.com Action lua(app.lua sms outbound)
2021-04-19 23:59:15.211935 [NOTICE] switch_cpp.cpp:1465 [sms] DIRECTION: outbound
2021-04-19 23:59:15.211935 [INFO] switch_cpp.cpp:1465 chat console
2021-04-19 23:59:15.211935 [NOTICE] switch_cpp.cpp:1465 [sms] BODY-raw: test
2021-04-19 23:59:15.211935 [INFO] switch_cpp.cpp:1465 Event-Name: MESSAGE
Core-UUID: fe3d5321-35a4-43a6-96bd-6f21517a23c8
FreeSWITCH-Hostname: FusionPBX
FreeSWITCH-Switchname: FusionPBX
FreeSWITCH-IPv4: 155.xxx.xxx.xxx
FreeSWITCH-IPv6: %3A%3A1
Event-Date-Local: 2021-04-19%2023%3A59%3A15
Event-Date-GMT: Mon,%2019%20Apr%202021%2023%3A59%3A15%20GMT
Event-Date-Timestamp: 1618876755211935
Event-Calling-File: sofia_presence.c
Event-Calling-Function: sofia_presence_handle_sip_i_message
Event-Calling-Line-Number: 4888
Event-Sequence: 584
login: sip%3Amod_sofia%40155.xxx.xxx.xxx%3A5060
proto: sip
to_proto: sip
from: 201%40pbx.mydomain.com
from_user: 201
from_host: pbx.mydomain.com
to_user: 15551234567
to_host: pbx.mydomain.com
from_sip_ip: 75.xxx.xxx.xxx
from_sip_port: 44704
to: 15551234567%40pbx.mydomain.com
subject: SIMPLE%20MESSAGE
context: public
type: text/plain
from_full: %3Csip%3A201%40pbx.mydomain.com%3E%3Btag%3DF1CC4606CE09D7A436015150A477377F
sip_profile: internal
dest_proto: sip
max_forwards: 70
DP_MATCH: 5551234567%40pbx.mydomain.com
final_delivery: true
Content-Length: 4

test
2021-04-19 23:59:15.211935 [NOTICE] switch_cpp.cpp:1465 [sms] DIRECTION: outbound
2021-04-19 23:59:15.211935 [NOTICE] switch_cpp.cpp:1465 [sms] TO: 15551234567
2021-04-19 23:59:15.211935 [NOTICE] switch_cpp.cpp:1465 [sms] FROM: 201
2021-04-19 23:59:15.211935 [NOTICE] switch_cpp.cpp:1465 [sms] BODY: test
2021-04-19 23:59:15.211935 [NOTICE] switch_cpp.cpp:1465 [sms] DOMAIN_NAME: pbx.mydomain.com
2021-04-19 23:59:15.211935 [NOTICE] switch_cpp.cpp:1465 [sms] SQL: SELECT domain_uuid FROM v_domains WHERE domain_name = :domain_name and domain_enabled = 'true' ; params:{"domain_name":"pbx.mydomain.com"}
2021-04-19 23:59:15.231936 [NOTICE] switch_cpp.cpp:1465 [sms] DOMAIN_UUID: 9356210b-bb0f-468f-862f-2d65c10e3bc9
2021-04-19 23:59:15.231936 [NOTICE] switch_cpp.cpp:1465 [sms] SQL: SELECT outbound_caller_id_number, extension_uuid, carrier FROM v_extensions , v_sms_destinations WHERE outbound_caller_id_number = destination and v_extensions.domain_uuid = :domain_uuid and extension = :from and v_sms_destinations.enabled = 'true' and v_extensions.enabled = 'true'; params:{"from":"201","domain_uuid":"9356210b-bb0f-468f-862f-2d65c10e3bc9"}
2021-04-19 23:59:15.231936 [NOTICE] switch_cpp.cpp:1465 [settings] SQL: SELECT * FROM v_default_settings WHERE default_setting_enabled = 'true' AND default_setting_category is not null AND default_setting_subcategory is not null AND default_setting_name is not null AND default_setting_value is not null ORDER BY default_setting_category, default_setting_subcategory ASC
2021-04-19 23:59:15.251944 [NOTICE] switch_cpp.cpp:1465 [settings] SQL: SELECT * FROM v_domain_settings WHERE domain_uuid = :domain_uuid AND domain_setting_enabled = 'true' AND domain_setting_category is not null AND domain_setting_subcategory is not null AND domain_setting_name is not null AND domain_setting_value is not null ORDER BY domain_setting_category, domain_setting_subcategory ASC ; params: {"domain_uuid":"9356210b-bb0f-468f-862f-2d65c10e3bc9"}
2021-04-19 23:59:15.251944 [NOTICE] switch_cpp.cpp:1465 [sms] secret_key: api_key (hidden)
2021-04-19 23:59:15.251944 [NOTICE] switch_cpp.cpp:1465 [sms] api_url: https://sms.telnyx.com/messages
2021-04-19 23:59:15.251944 [ERR] mod_lua.cpp:202 /usr/share/freeswitch/scripts/app/sms/index.lua:424: attempt to concatenate global 'delivery_status_webhook_url' (a nil value)
stack traceback:
/usr/share/freeswitch/scripts/app/sms/index.lua:424: in main chunk
/usr/share/freeswitch/scripts/app.lua:48: in main chunk
 

bbardon

New Member
Jun 20, 2020
16
1
3
68
Seems there is nothing found when querying settings for telnyx_delivery_status_webhook_url. Do you have it set in Default Settings? If not, you need to create it.

Screenshot_20210419_215928.png
 

Bifur

Member
Sep 13, 2020
122
9
18
That was it completely. I didn't realize I needed that. I think "delivery status" threw me off. I was thinking delivery status reports. I am sending outbound and receiving now.

Thank you for your help!
 

PJPMontreal

Member
Feb 28, 2020
60
2
8
58
Seems there is nothing found when querying settings for telnyx_delivery_status_webhook_url. Do you have it set in Default Settings? If not, you need to create it.

View attachment 2232
Hi Bbardon,
Im trying also to setup the SMS with Telnyx. Can you help me by showing me what I have to put in this settings? see attached
 

Attachments

  • SMS.jpg
    SMS.jpg
    175.3 KB · Views: 106

bbardon

New Member
Jun 20, 2020
16
1
3
68
Hi Bbardon,
Im trying also to setup the SMS with Telnyx. Can you help me by showing me what I have to put in this settings? see attached
I didn't use the Default Values Message module/category, rather SMS:
Screenshot_20211004_193913.png

Here are my default values in the SMS category for Telnyx:
Screenshot_20211004_193524.png
 

PJPMontreal

Member
Feb 28, 2020
60
2
8
58
Is the SMS app (https://github.com/fusionpbx/fusionpbx-apps/tree/master/sms) still the proper way to enable SMS inside of FusionPBX? I have looked at all of the threads (some quite dated) and want to make sure I am moving in the right direction. I see Messaging under applications, but not sure if that is another method to get things going. I will be using Telnyx for the SMS support.

Any insights would be great!

Thank you!
Hi, I'm trying to follow the step by step to install the SMS app but I'm getting this error (Permission Denied) when running:
git clone https://github.com/fusionpbx/fusionpbx-apps
See picture
Any help please!
 

Attachments

  • Denied.jpg
    Denied.jpg
    23.7 KB · Views: 37

Bifur

Member
Sep 13, 2020
122
9
18
At the console/terminal type 'sudo su' press enter then enter your root password. Then try following instructions again.
 

PJPMontreal

Member
Feb 28, 2020
60
2
8
58
Many Thanks! I did it... Actually used sudo before each command and it would appear that all is good. However I'm still unable to send and received.
Questions:
for the callback URL you used https://YOURDOMAIN/app/sms/hook/sms_hook_twilio.php or https://YOURDOMAIN/app/sms/hook/sms_hook_telnyx.php ???

On SMS default settings you put same key on the telnyx_access_key and telnyx_secret_key ??? if not which one I need to use. I know I can generate a secret key on Telnyx but I dont know where to find the access Key.

Thanks again for your HELP!!!!
 

PJPMontreal

Member
Feb 28, 2020
60
2
8
58
This what I get on the log when trying to send a message from extension 1999 to cell phone 3145837333:

2022-03-09 17:27:28.424209 [INFO] mod_sms.c:368 Processing text message 1999->3145837333 in context public
Chatplan: 3145837333 parsing [public->demo] continue=false
Chatplan: 3145837333@mydomain.com Regex (PASS) [demo] to(3145837333@mydomain.com) =~ /^(.*)$/ break=on-false
2022-03-09 17:27:28.424209 [DEBUG] mod_sms.c:477 SMS chatplan no actions found
2022-03-09 17:27:28.424209 [DEBUG] sofia_presence.c:225 Can't find registered user 3145837333@mydomain.com
2022-03-09 17:27:28.504164 [WARNING] sofia_presence.c:4817 Not sending message to ourselves!
 
Last edited:

Bifur

Member
Sep 13, 2020
122
9
18
Access key is the api key and then their should be a secret key. Both In telnyx portal.

You want to use the webhook for whichever vendor you are using so telnyx is what I used and what you should use if you're using telnyx for sms
 

PJPMontreal

Member
Feb 28, 2020
60
2
8
58
Yes, I'm using the API 1. But I'm Still confused with API keys and Secret Key... on Telnyx they seems to be the same. If I click Generate Secret will only change the API Key see on the picture attached.
Maybe I have to use the top Profile ID??? maybe as a KEY??? If yes, Where I have to put that on Fusion.
Thank you!!!
 

Attachments

  • SMSTelnyxd.jpg
    SMSTelnyxd.jpg
    181 KB · Views: 72

Bifur

Member
Sep 13, 2020
122
9
18
They profile id is the api key I believe. The secret is the secret. It should go under the settings for the SMS. It should go wherever the webhook url is. Maybe apps sms. I'm not able to check right now. Look at a previous screenshot. It shows that information.
 
Status
Not open for further replies.