TextMessageReceived handler with ARI

Hello,

How can I handle the event “TextMessageReceived” in ARI? I see the message being received in the logs but I want to handle it somehow in my application. Is this possible?

I am sending text messages through a node client using the “sendMessage” method but I am not able to handle it with ARI.

I let you with some of my configurations I’ve done so far…

He is what I have in my extensions.conf:

...
[textmessages]
exten => _.,1,NoOp(Receiving a text message)
 same =>      n,Stasis(hello) ;is this blocking the normal flow?
...

and here is part of my pjsip.conf file:

[100]
type=aor
max_contacts=1
remove_existing=yes
maximum_expiration=7200
minimum_expiration=60
qualify_frequency=60

[100]
type=auth
auth_type=md5
md5_cred=...
username=100

[100]
type=endpoint
aors=100
auth=100
disallow=all
allow=opus,ulaw,alaw,gsm,g726,g722,h264,mpeg4
context=from-internal
message_context=textmessages
callerid=alice <100>
transport=tls-transport
media_encryption=sdes

and here is part of my app trying to handle the event (using node-ari-client):

ari.on('TextMessageReceived', (event, endpoint) => {
        console.log('received a sms from endpoint', endpoint)
        console.log('event', event.message)
    })

All is working fine. I mean, I can make/receive calls and send/receive text messages but my issue is related to the ARI handler for text messages.

What am I doing wrong here? Is this possible through ARI? Is there any other way to achieve this?

Any answer would be much appreciated!! Thank you!

BR,
J. Brito

You subscribe your ARI application to the endpoint you wish to receive text messages from, and then the TextMessageReceived message should occur.

Thank you! It’s working now.