# Messaging in through asterisk

**URL:** <https://community.asterisk.org/t/messaging-in-through-asterisk/101945>\
**Category:** Asterisk SIP\
**Created:** [April 5, 2024, 2:36pm UTC](https://community.asterisk.org/t/messaging-in-through-asterisk/101945 "2024-04-05T14:36:15Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![fatimazariwala](https://avatars.discourse-cdn.com/v4/letter/f/71e660/32.png) [@fatimazariwala](https://community.asterisk.org/u/fatimazariwala)\
**Post date:** [April 5, 2024, 2:36pm UTC](https://community.asterisk.org/t/messaging-in-through-asterisk/101945/1 "2024-04-05T14:36:15Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![david551](https://avatars.discourse-cdn.com/v4/letter/d/3bc359/32.png) [@david551](https://community.asterisk.org/u/david551)\
**Post date:** [April 5, 2024, 2:45pm UTC](https://community.asterisk.org/t/messaging-in-through-asterisk/101945/2 "2024-04-05T14:45:48Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![Pooh](https://avatars.discourse-cdn.com/v4/letter/p/f05b48/32.png) [@Pooh](https://community.asterisk.org/u/Pooh)\
**Post date:** [April 5, 2024, 2:50pm UTC](https://community.asterisk.org/t/messaging-in-through-asterisk/101945/3 "2024-04-05T14:50:42Z")

</div>

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.

```

---

<div class="post-metadata">

**Author:** ![david551](https://avatars.discourse-cdn.com/v4/letter/d/3bc359/32.png) [@david551](https://community.asterisk.org/u/david551)\
**Post date:** [April 5, 2024, 2:59pm UTC](https://community.asterisk.org/t/messaging-in-through-asterisk/101945/4 "2024-04-05T14:59:33Z")

</div>

> [@Pooh](#):
>
> If you do, why are you starting with a SIP application such as Asterisk?

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).

---

<div class="post-metadata">

**Author:** ![Pooh](https://avatars.discourse-cdn.com/v4/letter/p/f05b48/32.png) [@Pooh](https://community.asterisk.org/u/Pooh)\
**Post date:** [April 5, 2024, 3:13pm UTC](https://community.asterisk.org/t/messaging-in-through-asterisk/101945/5 "2024-04-05T15:13:51Z")

</div>

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

> > [@Pooh](#):
> >
> > If you do, why are you starting with a SIP application such as Asterisk?
> 
> 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

---

<div class="post-metadata">

**Author:** ![fatimazariwala](https://avatars.discourse-cdn.com/v4/letter/f/71e660/32.png) [@fatimazariwala](https://community.asterisk.org/u/fatimazariwala)\
**Post date:** [April 6, 2024, 2:44am UTC](https://community.asterisk.org/t/messaging-in-through-asterisk/101945/6 "2024-04-06T02:44:24Z")

</div>

@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

---

<div class="post-metadata">

**Author:** ![fatimazariwala](https://avatars.discourse-cdn.com/v4/letter/f/71e660/32.png) [@fatimazariwala](https://community.asterisk.org/u/fatimazariwala)\
**Post date:** [April 6, 2024, 9:32am UTC](https://community.asterisk.org/t/messaging-in-through-asterisk/101945/8 "2024-04-06T09:32:08Z")

</div>

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()

---

<div class="post-metadata">

**Author:** ![david551](https://avatars.discourse-cdn.com/v4/letter/d/3bc359/32.png) [@david551](https://community.asterisk.org/u/david551)\
**Post date:** [April 6, 2024, 11:22am UTC](https://community.asterisk.org/t/messaging-in-through-asterisk/101945/9 "2024-04-06T11:22:19Z")

</div>

> [@fatimazariwala](#):
>
> ```auto
> -- 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
> 
> ```

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

> [@fatimazariwala](#):
>
> [handle\_msg]  
> exten=\>\_X.,n,MessageSend(sip:user1@314.x.x.42,sip:user2@314.x.x.42)

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](https://docs.asterisk.org/Asterisk_16_Documentation/API_Documentation/Dialplan_Applications/MessageSend/) 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.

---

<div class="post-metadata">

**Author:** ![fatimazariwala](https://avatars.discourse-cdn.com/v4/letter/f/71e660/32.png) [@fatimazariwala](https://community.asterisk.org/u/fatimazariwala)\
**Post date:** [April 6, 2024, 2:11pm UTC](https://community.asterisk.org/t/messaging-in-through-asterisk/101945/10 "2024-04-06T14:11:52Z")

</div>

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]

---

<div class="post-metadata">

**Author:** ![david551](https://avatars.discourse-cdn.com/v4/letter/d/3bc359/32.png) [@david551](https://community.asterisk.org/u/david551)\
**Post date:** [April 6, 2024, 2:27pm UTC](https://community.asterisk.org/t/messaging-in-through-asterisk/101945/11 "2024-04-06T14:27:43Z")

</div>

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.]

---

<div class="post-metadata">

**Author:** ![fatimazariwala](https://avatars.discourse-cdn.com/v4/letter/f/71e660/32.png) [@fatimazariwala](https://community.asterisk.org/u/fatimazariwala)\
**Post date:** [April 6, 2024, 5:10pm UTC](https://community.asterisk.org/t/messaging-in-through-asterisk/101945/12 "2024-04-06T17:10:31Z")

</div>

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??

---

<div class="post-metadata">

**Author:** ![david551](https://avatars.discourse-cdn.com/v4/letter/d/3bc359/32.png) [@david551](https://community.asterisk.org/u/david551)\
**Post date:** [April 6, 2024, 5:52pm UTC](https://community.asterisk.org/t/messaging-in-through-asterisk/101945/13 "2024-04-06T17:52:15Z")

</div>

> [@fatimazariwala](#):
>
> 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](https://docs.asterisk.org/Latest_API/API_Documentation/Module_Configuration/res_pjsip/) 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.

---

<div class="post-metadata">

**Author:** ![fatimazariwala](https://avatars.discourse-cdn.com/v4/letter/f/71e660/32.png) [@fatimazariwala](https://community.asterisk.org/u/fatimazariwala)\
**Post date:** [April 6, 2024, 8:08pm UTC](https://community.asterisk.org/t/messaging-in-through-asterisk/101945/14 "2024-04-06T20:08:45Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/asterisk/original/2X/4/475d0c889911cfb84ac4881ad6df8b523e3f9105.png) [@system](https://community.asterisk.org/u/system)\
**Post date:** [May 6, 2024, 8:09pm UTC](https://community.asterisk.org/t/messaging-in-through-asterisk/101945/15 "2024-05-06T20:09:00Z")

</div>

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