SIP/SMS with FreePBX - VoIP.ms Wiki

Check out our YouTube channel to watch our simple tutorials that will help you set up most of our features.

SIP/SMS with FreePBX

From VoIP.ms Wiki

(Difference between revisions)
Jump to: navigation, search
[draft revision][draft revision]
(Setting the outbound messaging context)
(Setting the outbound messaging context)
Line 27: Line 27:
# Go to Admin/config Edit.  In the Asterisk custom Configuration Files, find pjsip.endpoint_custom_post.conf.
# Go to Admin/config Edit.  In the Asterisk custom Configuration Files, find pjsip.endpoint_custom_post.conf.
# For each of your PJSIP extension, add the following block of text, making sure to replace "nnnnnnn" with the extension identifier:
# For each of your PJSIP extension, add the following block of text, making sure to replace "nnnnnnn" with the extension identifier:
-
 
-
<nowiki>
 
-
[nnnnnnn](+)
 
-
message_context=msgout
 
-
</nowiki>
 
  <nowiki>
  <nowiki>
Line 38: Line 33:
protocol = udp
protocol = udp
bind = 0.0.0.0
bind = 0.0.0.0
 +
 +
[nnnnnnn](+)
 +
message_context=msgout
[voipms]
[voipms]

Revision as of 17:48, 16 July 2019

Contents

Introduction

This page will detail the basic configuration required in order to send and receive SMS messages through FreePBX

The information in this page is based on the newer Chan_PJSIP channel driver. This is because the older Chan_SIP driver does not correctly implement authentication for SIP messaging, which is mandatory with VoIP.ms servers for security reasons. The current version of FreePBX supports using both SIP channel drivers side by side without any issue. We therefore assume the following:

  • You have configured your FreePBX so that it has a PJSIP trunk that is registering with one of the VoIP.ms POPs (Point of Presence).
  • You have added a PJSIP Extension to your FreePBX configuration, with appropriate routes for sending and receiving phone calls.
  • You have a soft-phone that is configured for registering with the above FreePBX extension, for making and receiving phone calls. This soft-phone also has the ability to send and receive SIP text messages.

You will find that the information in this page is geared towards implementing SIP messaging and has little mention of SMS. That's because sending an SMS from SIP, using the VoIP.ms gateway, starts as a SIP message where the source and destination are identifiable as SMS capable phone numbers. The VoIP.ms SIP/SMS gateway does all the rest.

Setting the messaging contexts

Setting the inbound messaging context

The first step in implementing SIP messaging is setting the contexts for inbound and outbound messaging. These contexts are the places, in the FreePBX dial-plan, where inbound and outbound messages will be handled.

The inbound context is specified as part of your PJSIP Trunk settings.

  1. Go to Connectivity/Trunks. Find your trunk in the list and edit it.
  2. In PJSIP Settings, choose the Advanced tab.
  3. Scroll to the bottom of the page and enter "msgin" in the Message Context field.
  4. Submit your changes and Apply the new config.

Setting the outbound messaging context

Setting the outbound context is a little trickier. This setting needs to be applied to each PJSIP extension that is to be used for sending messages. However, the setting does not exist in the user interface, so it needs to be added manually using the configuration editor.

  1. Go to Admin/config Edit. In the Asterisk custom Configuration Files, find pjsip.endpoint_custom_post.conf.
  2. For each of your PJSIP extension, add the following block of text, making sure to replace "nnnnnnn" with the extension identifier:
[transport-udp]
type = transport
protocol = udp
bind = 0.0.0.0

[nnnnnnn](+)
message_context=msgout

[voipms]
type = registration
transport = transport-udp
outbound_auth = voipms
client_uri = sip:[email protected]:5060     ; (one of our multiple servers, you can choose the one closer to your location)
server_uri = sip:atlanta.voip.ms:5060            ; (one of our multiple servers, you can choose the one closer to your location)

[voipms]
type = auth
auth_type = userpass
username = 100000            ; (Replace with your 6 digit Main SIP Account User ID or Sub Account username, i.e. 123456 or 123456_sub)
password = johnspassword     ; your password

[voipms]
type = aor
contact = sip:[email protected]             ; (one of our multiple servers, you can choose the one closer to your location)

[voipms]
type = endpoint
transport = transport-udp
context = mycontext
disallow = all
allow = ulaw
; allow=g729                 ; uncomment if you support g729
from_user = 100000           ; (Replace with your 6 digit Main SIP Account User ID or Sub Account username, i.e. 123456 or 123456_sub)
auth = voipms
outbound_auth = voipms
aors = voipms
; NAT parameters:
rtp_symmetric = yes
rewrite_contact = yes
send_rpid = yes

[voipms]
type = identify
endpoint = voipms
match = atlanta.voip.ms      ; (one of our multiple servers, you can choose the one closer to your location)

Filling in the dial-plan

Filling in the inbound messaging context

Filling in the outbound messaging context

Personal tools
Namespaces
Variants
Actions
VoIP.ms Wiki
Guides 🇨🇦
Guías 🇲🇽