Messaging in through asterisk

hey i am working on a real-time communication project, i need to know how can we configure messaging in asterisk in real time, i tried doing it through pjsip but i am getting some errors saying sip does support messaging.
I’m using Linphone Softphone to send and receive messages… can anyone help me out with which would be the best way to set-up instant messaging on asterisk.

Please provide the full log, with verbosity at least 3, the dialplan on the path that is supposed to handle messages, and the endpoint definition for the sender and receiver.

Does Real Time mean in dialogue messaging, the use of Asterisk Realtime Architecture, or something else?

On Friday 05 April 2024 at 16:47:15, fatimazariwala via Asterisk Community
wrote:

hey i am working on a real-time communication project, i need to know how
can we configure messaging in asterisk in real time,

What do you mean by “messaging”?

i tried doing it through pjsip but i am getting some errors saying sip does
support messaging.

I’ll assume there’s a “not” missing from that sentence…

I’m using Linphone Softphone to send and receive messages… can
anyone help me out with which would be the best way to set-up instant
messaging on asterisk.

Ah “instand messaging” - do you mean something like Jabber / XMPP / etc?

If you do, why are you starting with a SIP application such as Asterisk?

Tell us precisely which protocol you are trying to communicate with, otherwise
the word “messaging” is just too vague.

Antony.


BASIC is to computer languages what Roman numerals are to arithmetic.

                                               Please reply to the list;
                                                     please *don't* CC me.

SIP does have some messaging capabilities, and Asterisk has support for them, but many ITSP’s do not support the SIP mechanism (and, in the USA, there are legal restrictions).

On Friday 05 April 2024 at 17:10:25, david551 via Asterisk Community wrote:

SIP does have some messaging capabilities, and Asterisk has support for
them, but many ITSP’s do not support the SIP mechanism (and, in the USA,
there are legal restrictions).

Yes, I’m aware of SIP phones which can handle “messages”, and the Message
method in SIP, however if the OP is talking about some more generic definition
of “instant messaging” (which to me it sounded like from the wording) then
this isn’t applicable.

Let’s see what detail comes back…

Antony.


It is also possible that putting the birds in a laboratory setting
inadvertently renders them relatively incompetent.

  • Daniel C Dennett

                                                Please reply to the list;
                                                      please *don't* CC me.
    

@Pooh thankyou for responding !!!

Hey you’re right I’ve missed the ‘not’ … since I got an error saying no message technology sip found, I’m not sure which protocol should exactly be used for messaging……

so that’s y I wanted to ask if there is some other way to enable messaging on asterisk

IF yes I’ve heard about xmpp and asterisk supports xmpp, the reason I’ve choosen asterisk is that I am also using pjsip for voip calling functionality which is working alright and I’d like to stick to asterisk and explore more about it, for now my goal is to make available client-to-client messaging on a Softphone for which right now I’m using Linphone.

Can u help me out with some more details on which protocols and other components would be best for instant messaging on asterisk.

Looking forward for your advice

hello @david551 thanks for your response !!!
My project is on Real-time communication right now all i what to do is set up instant messaging client-to-client.

here’s my log at verbose 15:

-- Executing [user1@handle_msg:1] NoOp("Message/ast_msg_queue", "SMS receiving dialplan invoked") in new stack
-- Executing [user1@handle_msg:4] MessageSend("Message/ast_msg_queue", "sip:user1@314.x.x.32,sip:user2@314.x.x.23") in new stack

[Apr 6 09:18:26] WARNING[14352][C-00000003]: message.c:1290 msg_send_exec: No message technology ‘sip’ found.
– Executing [user1@handle_msg:5] NoOp(“Message/ast_msg_queue”, “Send status : INVALID_PROTOCOL”) in new stack
– Executing [user1@handle_msg:6] Hangup(“Message/ast_msg_queue”, “”) in new stack
== Spawn extension (handle_msg, user1, 6) exited non-zero on ‘Message/ast_msg_queue’

my asterisk server is on a vps with external facing ip and users are behind nat here’s my pjsip.conf :
[transport-udp]
type=transport
protocol=udp
bind=0.0.0.0:5060
;bindport=5060
;local_net= local_net=192.0.2.0/24
external_media_address= 314.x.x.32
external_signaling_address= 314.x.x.32

[user1]
type=endpoint
context=inside
direct_media=no
rtp_keepalive=1
force_rport=yes
disallow=all
allow=ulaw
transport=transport-udp
message_context=handle_msg
auth=user1
aors=user1

[user1]
type=auth
auth_type=userpass
password=**
username=user1

[user1]
type=aor
max_contacts=2
remove_existing=yes

[user2]
type=endpoint
context=inside
direct_media=no
rtp_keepalive=1
force_rport=yes
disallow=all
allow=ulaw
transport=transport-udp
message_context=handle_msg
auth=user2
aors=user2

[user2]
type=auth
auth_type=userpass
password=***
username=user2

[user2]
type=aor
max_contacts=2
remove_existing=yes

here is my extensions.conf :
[handle_msg]
exten=>_X.,n,MessageSend(sip:user1@314.x.x.42,sip:user2@314.x.x.42)
exten=>_X.,n,NoOp(Send status : ${MESSAGE_SEND_STATUS})
exten=>_X.,n,Hangup()

I don’t understand how you managed to skip priority 2 and priority 3.

You need to start with priority 1, otherwise the priority numbers run on from the last extension. There is no priority 1 Noop here, but there is in your log!

You are trying to send using chan_sip, which is obsolete, so you are presumably, and correctly, only have chan_pjsip loaded. See MessageSend - Asterisk Documentation for the correct use of SIP out of dialogue messages with chan_sip.

You are not using XMPP, or any of the other complex options mentioned by Pooh; you are using SIP native out of dialogue messages.

hey @david551 i made the changes as you suggested …

here’s my log :

Executing [user1@handle_msg:1] NoOp(“Message/ast_msg_queue”, “SMS receiving dialplan invoked”) in new stack
– Executing [user1@handle_msg:2] NoOp(“Message/ast_msg_queue”, “To sip:user1@314.x.x.7”) in new stack
– Executing [user1@handle_msg:3] NoOp(“Message/ast_msg_queue”, “From sip:user2@314.x.x.7”) in new stack
– Executing [user1@handle_msg:4] NoOp(“Message/ast_msg_queue”, “Body Ollllaaa I am here”) in new stack
– Executing [user1@handle_msg:5] Set(“Message/ast_msg_queue”, “ACTUALTO=pjsip:user1”) in new stack
– Executing [user1@handle_msg:6] Set(“Message/ast_msg_queue”, “ACTUALFROM=sip:user2@314.x.x.7>”) in new stack
– Executing [user2@handle_msg:7] Set(“Message/ast_msg_queue”, “ACTUALFROM=sip:user2@314.x.x.7”) in new stack
– Executing [user1@handle_msg:8] MessageSend(“Message/ast_msg_queue”, “pjsip:user1,pjsip:user2@314.x.x.7”) in new stack
[Apr 6 14:04:08] ERROR[17205]: res_pjsip_messaging.c:621 msg_send: PJSIP MESSAGE - Could not find endpoint ‘user1’ and no default outbound endpoint configured
– Executing [user1@handle_msg:9] NoOp(“Message/ast_msg_queue”, “Send status : FAILURE”) in new stack
– Executing [user1@handle_msg:10] Hangup(“Message/ast_msg_queue”, “”) in new stack
== Spawn extension (handle_msg, user1, 10) exited non-zero on ‘Message/ast_msg_queue’

here my extensions.conf i made the modifications you suggested as well as added a bit more :

[handle_msg]
exten => _X.,1,NoOp(SMS receiving dialplan invoked)
exten => _X.,n,NoOp(To ${MESSAGE_DATA(to)})
exten => _X.,n,NoOp(From ${MESSAGE(from)})
exten => _X.,n,NoOp(Body ${MESSAGE(body)})
exten => _X.,n,Set(ACTUALTO=${CUT(MESSAGE(to),@,1)})
exten => _X.,n,Set(ACTUALFROM=${CUT(MESSAGE(from),<,2)})
exten => _X.,n,Set(ACTUALFROM=${CUT(ACTUALFROM,>,1)})
exten => _X.,n,MessageSend(${ACTUALTO},pj${ACTUALFROM})
exten=>_X.,n,NoOp(Send status : ${MESSAGE_SEND_STATUS})
exten=>_X.,n,Hangup()

[NOTE : my pjsip.conf file is just as mentioned in the last reply no modifications has been made ]

Your destination doesn’t match any of the formats in the MessageSend documentation that I reference:

  • endpoint/<sip[s]:host>
  • endpoint/<sip[s]:user@host>
  • endpoint/"display name" <sip[s]:host>
  • endpoint/"display name" <sip[s]:user@host>
  • endpoint/sip[s]:host
  • endpoint/sip[s]:user@host
  • endpoint/host
  • endpoint/user@host

Similarly for the message source, but with a smaller set of possible formats.

[ This list is incomplete - I missed the default endpoint variants. ]

I went through the documentation I’m finding it a little difficult to understand how to add the destination so plz can u help me out.

This is what I understood:

MessageSend(pisip:user1@10.3.45.3,pjsip:user1,pjsip:user2@314.x.x.7)

So the first parameter is the destination user which is same as ACTUALTO but with the user’s IPAddress ,second is the ACTUALTO (which shows the ‘to’ field of the message) and the third parameter is the ‘from’ field of the message.

Is this the right way to do it??

No.

That format requires a default endpoint. The error message is saying you don’t have one. You have to mark an endpoint as default, with default_outbound_endpoint, see res_pjsip - Asterisk Documentation However, it is probably safer to use an explicit one, in which case the format looks to be basically the same as Dial (), with an explicit contact URI, and with “PJSIP/” replaced by “pjsip:”.

There should be no need to resolve domain names.

thanks @david551 i understood actually while sending message i was using the number of the user specified in the dialplan that’s y pjsip was unable to find the address, so i sent the message using the endpoint name and now it worksss!!!

BUT i am facing one more issue when i send a message my linphone softphone vibrates but i cannot see the meaasge i am using the linphone softphone on ios

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