SIP / SIMPLE text messages in Asterisk
During the next telephony of the next office, I noticed that in the MicroSIP softphone we selected there was some built-in “chat”, which, however, did not work out of the box.
![image](https://habrastorage.org/getpro/habr/post_images/a18/f70/a13/a18f70a136cdda85534a7cf9e4f304d8.png)
This program uses the SIP MESSAGE method ( RFC 3428 ), also known as the SIMPLE protocol, to forward messages .
In Asterisk, its support appeared in version 10, but the documentation here, as often happens, was far behind progress. First, I had to search the forums for various configuration options for a long time, and then try them out by trial and error.
As a result, such a working configuration was developed (true for Asterisk 11.6.0).
The following lines are added to the [general] section of the sip.conf file (for owners of FreePBX-based systems - to the sip_general_custom.conf file):
And in dialplan (for FreePBX - in the extensions_custom.conf file) the following context is added:
Put the number X in accordance with the number of digits in your extension numbers.
Hooray, everything works!
![image](https://habrastorage.org/getpro/habr/post_images/38b/a61/e3e/38ba61e3e1dba3eb526f3570fd42617b.png)
you can send messages to hardware phones:
![image](https://habrastorage.org/getpro/habr/post_images/281/c82/00c/281c8200c5dd446c6d647439f9eb0825.jpg)
Well, craftsmen can modify the dialplan for various purposes, for example, to send SMS or e-mail. The content of the message is in the variables $ {MESSAGE (from)} $ {MESSAGE (to)} and $ {MESSAGE (body)}
It also makes sense to try setting auth_message_requests = yes - but compatibility problems may arise here.
It is also important not to confuse what is discussed in the article with the textsupport setting - this setting in Asterisk is responsible for a completely different protocol, ITU-T T.140 realtime text .
![image](https://habrastorage.org/getpro/habr/post_images/a18/f70/a13/a18f70a136cdda85534a7cf9e4f304d8.png)
This program uses the SIP MESSAGE method ( RFC 3428 ), also known as the SIMPLE protocol, to forward messages .
In Asterisk, its support appeared in version 10, but the documentation here, as often happens, was far behind progress. First, I had to search the forums for various configuration options for a long time, and then try them out by trial and error.
As a result, such a working configuration was developed (true for Asterisk 11.6.0).
The following lines are added to the [general] section of the sip.conf file (for owners of FreePBX-based systems - to the sip_general_custom.conf file):
accept_outofcall_message = yes
outofcall_message_context = messages
auth_message_requests = no
And in dialplan (for FreePBX - in the extensions_custom.conf file) the following context is added:
[messages]
exten => _XXX,1,MessageSend(sip:${EXTEN},"${CALLERID(name)}"${MESSAGE(from)})
Put the number X in accordance with the number of digits in your extension numbers.
Hooray, everything works!
![image](https://habrastorage.org/getpro/habr/post_images/38b/a61/e3e/38ba61e3e1dba3eb526f3570fd42617b.png)
you can send messages to hardware phones:
![image](https://habrastorage.org/getpro/habr/post_images/281/c82/00c/281c8200c5dd446c6d647439f9eb0825.jpg)
Well, craftsmen can modify the dialplan for various purposes, for example, to send SMS or e-mail. The content of the message is in the variables $ {MESSAGE (from)} $ {MESSAGE (to)} and $ {MESSAGE (body)}
It also makes sense to try setting auth_message_requests = yes - but compatibility problems may arise here.
It is also important not to confuse what is discussed in the article with the textsupport setting - this setting in Asterisk is responsible for a completely different protocol, ITU-T T.140 realtime text .