SMS to Email or file

I need some help or advice on getting voip sms working.

We created business cards that show direct DID as cell numbers. These number forward directly to the employees cell number. Customers sometimes text these numbers and currently they go nowhere. I would like them to either go to email or a file that we can track.

We are currently using 1-VOIP as our sip trunking and they provide sms enabled numbers. Our current system is FreePBX 14.0.13.6 with Asterisk 13.27.1. Just upgraded from FreePBX 13 yesterday which was a headache.

When I turn on sip debugging, I can see the sms message but am not sure how to retrieve it using agi or php and have it sent to an email or file. Below is a snippet of the sip trace.

I tried researching this all day today and could not find anything useful.

[2019-10-11 14:03:40] VERBOSE[2941] chan_sip.c:
<— SIP read from UDP:XX.XX.XXX.XX:5060 —>
MESSAGE sip:[email protected]:5060 SIP/2.0
Via: SIP/2.0/UDP 209.XXX.XXX.XX:5060;branch=z7hG4bK5beb3e52
Max-Forwards: 70
From: “443XXXXXX” <sip:[email protected]>;tag=as2d6815bb
To: <sip:[email protected]:5060>
Contact: <sip:[email protected]:5060>
Call-ID: [email protected]:5060
CSeq: 102 MESSAGE
User-Agent: VYLmedia-SBCDAL
Content-Type: text/plain;charset=UTF-8
Content-Length: 7

Test123
<------------->
[2019-10-11 14:03:40] VERBOSE[2941] chan_sip.c: — (11 headers 1 lines) —
[2019-10-11 14:03:40] VERBOSE[2941] chan_sip.c: Sending to XXX.XXX.XXX.XX:5060 (NAT)
[2019-10-11 14:03:40] VERBOSE[2941] chan_sip.c: Receiving message!
[2019-10-11 14:03:40] VERBOSE[2941] chan_sip.c: Looking for 443XXXXXX in dpma_message_context (domain XXX.XXX.XXX.XX)
[2019-10-11 14:03:40] VERBOSE[2941] chan_sip.c:
<— Transmitting (NAT) to XXX.XXX.XXX.XX:5060 —>
SIP/2.0 404 Not Found
Via: SIP/2.0/UDP XXX.XXX.XXX.XX:5060;branch=z7hG4bK5beb3e52;received=XXX.XXX.XXX.XX;rport=5060
From: “443XXXXXX” <sip:[email protected]>;tag=as2d6815bb
To: <sip:[email protected]:5060>;tag=as243031a8
Call-ID: [email protected]:5060
CSeq: 102 MESSAGE
Server: FPBX-14.0.13.6(13.27.1)
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
Content-Length: 0

Any help would be appreciated.

Thanks
-Dimitry

See also multipost at https://community.asterisk.org/t/sms-to-email-or-file/81242

More information on doing this in FreePBX can be found in FreePBX 14.04.5: how to enable sip SIMPLE message

@maxillosoft If you’re using Chan_SIP then you need to have these settings in the trunk peer.

accept_outofcall_message=yes
outofcall_message_context=astsms  (the context can be a name of your choosing)

This is the most basic example from Asterisk 10-ish when this was introduced. This will accept the message and from there you can modify it to do what you want.

[astsms]
exten => _X.,1,NoOp(SMS receiving dialplan invoked)
exten => _X.,n,NoOp(To ${MESSAGE(to)}) ; This is the DID/user/exten the message is to
exten => _X.,n,NoOp(From ${MESSAGE(from)}) ; This is the DID/user/exten it is from
exten => _X.,n,NoOp(Body ${MESSAGE(body)}) ; This is the body of the message.
exten => _X.,n,Hangup()

Tom,

Thanks for replying so quickly.

A couple of questions:
1)Would I put:
accept_outofcall_message=yes
outofcall_message_context=astsms (the context can be a name of your choosing)
in each trunk peer or in Settings->Asterisk Sip Settings under Chan SIP Settings in Other Sip Settings section. I read another post before that says to put it in the Other Sip Settings.

2)Where do I put:
[astsms] exten => _X.,1,NoOp(SMS receiving dialplan invoked) exten => _X.,n,NoOp(To ${MESSAGE(to)}) ; This is the DID/user/exten the message is to exten => _X.,n,NoOp(From ${MESSAGE(from)}) ; This is the DID/user/exten it is from exten => _X.,n,NoOp(Body ${MESSAGE(body)}) ; This is the body of the message. exten => _X.,n,Hangup()

Under Config Edit but which file would I put it under.

Thanks again,
-Dimitry

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.