Inbound SMS from voip.ms gateway

sammyizimmy

New Member
Nov 13, 2023
3
1
3
31
Hello everyone. I'm trying to get incoming sip MESSAGEs from a voip.ms gateway routed to an extension.
All inbound and outbound calling work great on the gateway, no issues there.
I did install mod_sms and got local extension to extension SMS to work.

When sending a SMS to my voip.ms number this appears on the console
Code:
2024-11-11 20:17:28.253301 99.83% [WARNING] sofia_reg.c:3210 Can't find user [12345@192.168.0.213] from 208.100.60.6
You must define a domain called '192.168.0.213' in your directory and add a user with the id="12345" attribute
and you must configure your device to use the proper domain in its authentication credentials.

And this is the sngrep log.
1731378146036.png

Any tips or guides on how I can route all incoming SMS to a particular extension?

Thanks a bunch.
 
Last edited:

pbxguru

New Member
Nov 7, 2024
17
2
3
49
Hello,

I would not use SMS app. Instead, use the Messages App. Then, under Accounts | Providers, add your SMS provider with all endpoint/header information. Since there is no template for voip.ms, you will need to add it all manually, including whitelisting their IPs. You will also need to assign the extension to user, and make sure the user has SMS enabled. It's going to take some work - I got it working once with Telnyx.

More here:
 

sammyizimmy

New Member
Nov 13, 2023
3
1
3
31
The messages app does look promising. I'll give it a whirl.
Is there a proper procedure to uninstall the SMS app to make sure it does not conflict with the Messages App?

Thanks.
 

whut

Active Member
Dec 23, 2022
246
27
28
Recursively delete the sms directory. Run all fusion updates except for updates #1. Then as a cleanup review make sure the default settings variables were removed. If they somehow were not removed, then delete them.
 

sammyizimmy

New Member
Nov 13, 2023
3
1
3
31
Yay! After a ton of research and fiddling I got everything working as far as I can tell for what I need. SMS from VoIP phones work but not sending from the messages web app.

First I setup a simple http dumper that logged all http request and pointed Voip.ms to that so I could see the incoming sms POST. That led me to these provider settings.
inbound.png

Outbound is using the SIP SIMPLE MESSAGE through the chat plan so I deleted all the outbound provider settings and modified the chat-plan using hints from the Voip.ms wiki page on SMS for Asterisk. Voip.ms only accepts 10 digit dialing, so in the chat-plan I removed all leading +1 stuff.

XML:
<?xml version="1.0" encoding="utf-8"?>
<include>
        <context name="default">
                <extension name="demo">
                        <condition field="to" expression="^(.*)$">
                        </condition>
                </extension>
        </context>
        <context name="public">
                <extension name="ten-digit">
                        <condition field="to" expression="^(\d{10}.*)$">
                                    <action inline="true" application="set" data="to=${regex(${to}|^(\d{10}).*|%1@chicago4.voip.ms)}"/>
                                    <action inline="true" application="set" data="from='YOUR_VOIPMS_OUTBOUND_NUMBER' <sip:YOUR_VOIPMS_MAIN_ACCOUNT_NUM@chicago4.voip.ms>"/>
                                    <action inline="true" application="set" data="from_full='YOUR_VOIPMS_OUTBOUND_NUMBER' <sip:YOUR_VOIPMS_MAIN_ACCOUNT_NUM@chicago4.voip.ms>"/>
                        </condition>
                </extension>
                <extension name="eleven-digit">
                        <condition field="to" expression="^(1\d{10}.*)$">
                                    <action inline="true" application="set" data="to=${regex(${to}|^1(\d{10}).*|%1@chicago4.voip.ms)}"/>
                                    <action inline="true" application="set" data="from='YOUR_VOIPMS_OUTBOUND_NUMBER' <sip:YOUR_VOIPMS_MAIN_ACCOUNT_NUM@chicago4.voip.ms>"/>
                                    <action inline="true" application="set" data="from_full='YOUR_VOIPMS_OUTBOUND_NUMBER' <sip:YOUR_VOIPMS_MAIN_ACCOUNT_NUM@chicago4.voip.ms>"/>
                        </condition>
                </extension>
                <extension name="plus_eleve-digit">
                        <condition field="to" expression="^(\+1\d{10}.*)$">
                                    <action inline="true" application="set" data="to=${regex(${to}|^\+1(\d{10}).*|%1@chicago4.voip.ms)}"/>
                                    <action inline="true" application="set" data="from='YOUR_VOIPMS_OUTBOUND_NUMBER' <sip:YOUR_VOIPMS_MAIN_ACCOUNT_NUM@chicago4.voip.ms>"/>
                                    <action inline="true" application="set" data="from_full='YOUR_VOIPMS_OUTBOUND_NUMBER' <sip:YOUR_VOIPMS_MAIN_ACCOUNT_NUM@chicago4.voip.ms>"/>
                        </condition>
                </extension>

                <extension name="unreg">
                        <condition field="${sofia_contact(profile/${to})}" expression="error\/user_not_registered">
                                <action application="set" data="final_delivery=true"/>
                        </condition>
                </extension>

                <extension name="other">
                        <condition field="to" expression="^(.*)$">
                                <action application="set" data="final_delivery=true"/>
                                <action application="send"/>
                        </condition>
                </extension>
        </context>
</include>

Thanks a bunch and hope you all had a happy thanksgiving!
 
  • Like
Reactions: voipBull