Configuring an Asterisk PJSIP trunk: registering a SMS Conecta number

Short answer: Connecting Asterisk to SMS Conecta takes five pjsip.conf sections for one trunk: a registration pointed at sip.smsconecta.com, an auth carrying your SIP username and password, an aor, an endpoint restricted to ulaw and alaw, and an identify matching our server. From there, route the DID inside extensions.conf and dial out through that endpoint.

This is the plain-Asterisk version aimed at people managing config files by hand directly. It mirrors the trunk layout in the official res_pjsip examples, with SMS Conecta's own values filled in.

What you need first

  • A SMS Conecta number plus its SIP username and password, found on that number's dashboard page.
  • Asterisk running with res_pjsip loaded (any currently supported release works).
  • Shell access for editing /etc/asterisk/pjsip.conf and extensions.conf, plus the Asterisk CLI for testing.

SMS Conecta values used in the config

SettingValue
SIP server / registrar / domainsip.smsconecta.com
Transport and portUDP or TCP 5060; TLS 5061
Username<SIP_USERNAME> (from the number's page in the dashboard)
Password<SIP_PASSWORD> (from the same page)
AuthenticationDigest (username + password), registration based
CodecsG.711 µ-law (PCMU) and G.711 A-law (PCMA)
DTMFRFC 2833 (RTP events) or SIP INFO
Inbound DID<YOUR_NUMBER> in E.164 format

pjsip.conf: transport and trunk

Paste this block into pjsip.conf, replacing the placeholders. Skip the transport section if a UDP transport already exists. For TCP or TLS, create a matching transport and use port 5061 with TLS.

Identify matching works off the source address of our SIP traffic; Asterisk resolves the hostname as soon as the config loads.

[transport-udp]
type=transport
protocol=udp
bind=0.0.0.0
; behind NAT also set:
; external_media_address=<PUBLIC_IP>
; external_signaling_address=<PUBLIC_IP>
; local_net=192.168.0.0/16

[smsconecta]
type=registration
transport=transport-udp
outbound_auth=smsconecta-auth
server_uri=sip:sip.smsconecta.com:5060
client_uri=sip:<SIP_USERNAME>@sip.smsconecta.com
contact_user=<YOUR_NUMBER>
retry_interval=60

[smsconecta-auth]
type=auth
auth_type=userpass
username=<SIP_USERNAME>
password=<SIP_PASSWORD>

[smsconecta]
type=aor
contact=sip:sip.smsconecta.com:5060
qualify_frequency=60

[smsconecta]
type=endpoint
transport=transport-udp
context=from-smsconecta
disallow=all
allow=ulaw,alaw
dtmf_mode=rfc4733
outbound_auth=smsconecta-auth
aors=smsconecta
from_user=<SIP_USERNAME>
from_domain=sip.smsconecta.com
callerid=<YOUR_NUMBER>
rtp_symmetric=yes
force_rport=yes
rewrite_contact=yes

[smsconecta]
type=identify
endpoint=smsconecta
match=sip.smsconecta.com

extensions.conf: inbound and outbound dialplan

Inbound calls land inside the from-smsconecta context, with your number acting as the dialed extension. The outbound pattern sends anything dialed with a leading plus out through the trunk.

${EXTEN} in the outbound line is Asterisk's channel variable holding the dialed number. Swap 1001 for your own extension or ring group.

[from-smsconecta]
; inbound: DID = your SMS Conecta number
exten => <YOUR_NUMBER>,1,NoOp(Inbound call on SMS Conecta DID)
 same => n,Dial(PJSIP/1001,30)
 same => n,Hangup()
; catch other DID formats (with or without +)
exten => _X.,1,Goto(from-smsconecta,<YOUR_NUMBER>,1)

[from-internal]
; outbound: dial +<country code><number>
exten => _+X.,1,Set(CALLERID(num)=<YOUR_NUMBER>)
 same => n,Dial(PJSIP/${EXTEN}@smsconecta,60)
 same => n,Hangup()

Step-by-step: loading and testing

  1. Save both files and run pjsip reload plus dialplan reload from the Asterisk CLI (asterisk -rvvv).
  2. Run pjsip show registrations to confirm smsconecta shows Registered.
  3. Run pjsip show endpoint smsconecta to verify codecs, the aor contact and the identify match.
  4. Call your SMS Conecta number from a different phone and watch the CLI: the call should enter from-smsconecta and ring extension 1001.
  5. Dial an international number from a local extension in +country format, then confirm the called party sees your SMS Conecta number.

Outbound caller ID

Set the caller ID to whichever number owns the SIP account, using either callerid on the endpoint or CALLERID(num) in the dialplan as shown above. Keep it matched to the trunk's credentials. Outgoing calls draw against the number's 1,000 included minutes per month.

Troubleshooting

  • Registration 401/403: a username or password mismatch, or the auth section not linked through outbound_auth. Run pjsip set logger on and inspect the REGISTER exchange.
  • Inbound calls rejected as anonymous or with 'No matching endpoint found': the identify section is missing or its source address doesn't match. Confirm the hostname resolves on your server, then reload.
  • One-way audio: set external_media_address, external_signaling_address and local_net on the transport, keep rtp_symmetric and force_rport turned on, and open your rtp.conf port range in the firewall.
  • 488 Not Acceptable Here: a codec mismatch. Keep allow=ulaw,alaw.
  • DTMF goes undetected: keep dtmf_mode=rfc4733 (the RTP-event method defined by RFC 2833); switch to info only if the other side specifically requires SIP INFO.

Frequently asked questions

Are both the registration and identify sections necessary?

Yes. Registration tells SMS Conecta where your calls should go, while identify lets Asterisk match incoming calls back to the smsconecta endpoint.

Is rfc4733 equivalent to RFC 2833 DTMF?

Yes. RFC 4733 updated RFC 2833 while describing the same RTP event method, which is exactly what Asterisk's rfc4733 setting relies on.

Could chan_sip be used instead of PJSIP?

chan_sip has been dropped from current Asterisk releases, making PJSIP the supported route. The same server, credentials and codecs still apply.

Does Asterisk support TLS here?

Yes. Create a TLS transport, point both the registration and aor at port 5061, and reference that transport. SRTP media encryption isn't offered, though.

How would I add a second SMS Conecta number?

Duplicate the registration, auth, aor, endpoint and identify sections under a fresh name using that number's credentials, then add its DID to the dialplan.

Does SMS Conecta provide an API for Asterisk?

No. There are no customer APIs or webhooks; Asterisk simply connects over standard SIP using the per-number credentials.

Related pages

Get a number in these countries

Sources