INFO message not delivered to peer


I am trying to send an INFO message between two peers during a call. The goal is to send a text string from peerA to peerB. Asterisk’s log shows that the INFO message (with the correct text string in the Body field) is well received by Asterisk from peerA and that Asterisk is replying to peerA with an OK message.

However, Asterisk doesn’t seem to be forwarding the INFO message to peer B. Neither it appears in the logs, nor is it received by the intended callback in peerB code. Is there a setting for that anywhere please? Thank you.

Asterisk isn’t a SIP proxy and doesn’t forward SIP messages between endpoints. Each side is independent. In the case of INFO messages we only support two: DTMF and video update. All others would result in nothing going on. There’s no setting or configuration to change this, any changes would have to be done in code.


Can I send anything (e.g. a text string) along a DTMF INFO message between A and B via Asterisk? If Asterisk supports DTMF messages, I assume it implies it is able to forward it from A to B. Otherwise, what method would you recommend to exchange data between peers during a call?


Asterisk supports INFO DTMF as specified in the RFC. Each digit is internally turned into a DTMF frame which is then turned back into an INFO message. The SIP MESSAGE[1] type can be used in-dialog to send messages.



Instant messaging seems to be perfect for my goal. Is it enabled by default on the server or should I enable it explicitly please? Thanks.

Within a call it is exchanged without any configuration required. Only text/plain is supported for a content type, though.

1 Like

For some reason, my SIP clients are not able to communicate via IM when using Asterisk. The outgoing message is received by Asterisk but Asterisk is not forwarding the message to the other party. Works perfectly via Linphone server. Any thoughts?

Show the cli output when asterisk receive the meesage and also create a status exten in your context to see what’s happening to the SIP MESSAGE

Out of dialogue messages require explicit dialplan code to route and handle them.

This is the log. It seems that after receiving the MESSAGE, Asterisk is executing the dialplan code of extension peer2 (i.e. peer to whom message is sent).

[2017-08-18 14:06:32] VERBOSE[58560] chan_sip.c: Scheduling destruction of SIP dialog '838bc3e4-1c9d-42b7-8f4a-311c6b876883' in 7104 ms (Method: MESSAGE)
[2017-08-18 14:06:32] VERBOSE[58560] chan_sip.c: Scheduling destruction of SIP dialog '838bc3e4-1c9d-42b7-8f4a-311c6b876883' in 7104 ms (Method: MESSAGE)
[2017-08-18 14:06:32] VERBOSE[58560] chan_sip.c:
<--- SIP read from UDP:XX.XX.XX.YY:9782 --->
MESSAGE sip:peer2@XX.XX.XX.XX:5060;transport=UDP SIP/2.0
v: SIP/2.0/UDP XX.XX.XX.YY:9782;rport;branch=z9hG4bKPj4a3ef9ae-aaa8-4fd0-a57d-c19234abf9ad
Max-Forwards: 70
f: <sip:peer1@XX.XX.XX.XX>;tag=0a7c64a6-38aa-4b73-8028-1da4a93e7112
t: <sip:peer2@XX.XX.XX.XX>
i: 838bc3e4-1c9d-42b7-8f4a-311c6b876883
CSeq: 47822 MESSAGE
Accept: text/plain, application/im-iscomposing+xml
User-Agent: Test Android
Authorization: Digest username="peer1", realm="asterisk", nonce="3fa695e6", uri="sip:peer2@XX.XX.XX.XX:5060;transport=UDP", response="8e9a17928853b5bdf54b415588f626c3", algorithm=MD5
c: text/plain
l: 11

Hello World
[2017-08-18 14:06:32] VERBOSE[58560] chan_sip.c: --- (12 headers 1 lines) ---
[2017-08-18 14:06:32] VERBOSE[58560] chan_sip.c: Receiving message!
[2017-08-18 14:06:32] VERBOSE[58560] chan_sip.c: Found peer 'peer1' for 'peer1' from XX.XX.XX.YY:9782
[2017-08-18 14:06:32] VERBOSE[58560] chan_sip.c: Looking for peer2 in from-sip (domain XX.XX.XX.XX)
[2017-08-18 14:06:32] VERBOSE[58560] chan_sip.c:
<--- Transmitting (NAT) to XX.XX.XX.YY:9782 --->
SIP/2.0 202 Accepted
Via: SIP/2.0/UDP XX.XX.XX.YY:9782;branch=z9hG4bKPj4a3ef9ae-aaa8-4fd0-a57d-c19234abf9ad;received=XX.XX.XX.YY;rport=9782
From: <sip:peer1@XX.XX.XX.XX>;tag=0a7c64a6-38aa-4b73-8028-1da4a93e7112
To: <sip:peer2@XX.XX.XX.XX>;tag=as41a24556
Call-ID: 838bc3e4-1c9d-42b7-8f4a-311c6b876883
CSeq: 47822 MESSAGE
Server: Asterisk PBX GIT-master-b3914dfM
Supported: replaces, timer
Content-Length: 0

[2017-08-18 14:06:32] VERBOSE[58560] chan_sip.c: Scheduling destruction of SIP dialog '838bc3e4-1c9d-42b7-8f4a-311c6b876883' in 7104 ms (Method: MESSAGE)
[2017-08-18 14:06:32] VERBOSE[58539][C-0000005e] pbx_realtime.c: Executing [peer2@from-sip:1] Gosub("Message/ast_msg_queue", "subrtn,1(peer2)")

That is an out of dialog (or out of call) message, in that case you need to configure messages to go to a separate context (there’s a configuration option in sip.conf for it) and then write dialplan logic to forward it using MessageSend.

1 Like

I would rather write client code which sends inside dialog instant messages instead. Thanks.

uh? So basically you prefer to re-invent the wheel than use features that already exists?? That’s weird. Look at google for basic examples on how to handle sip messages with asterisk is easy.

1 Like

The “client code” was simply a single call to the sendInstantMessage method of the Call (in progress) Java object. There’s a callback to catch it on the other end. (I only need inside dialogue messaging for now.) Piece of cake and no wheel reinvented. Cheers.