Maximum number of characters in simple SIP messages

When I send SIP messages with MessageSend() everything works, except that the messages larger than 1024 bytes or so, don’t get through. It seems that there is a limit to the number of characters a message can have, in Asterisk’s source code.

Which parameter has to be changed in order to allow larger messages: is it ‘MAX_BODY_SIZE 1024’ in ‘res/res_pjsip_messaging.c’ or something else ?

Please tell me how can I change this limit!

No one here is likely to have the detailed knowledge of the source code to know all the possible bottlenecks, and you haven’t provided enough information on the overall data flow to work out where those bottlenecks might exist in your specific usage.

For example, there is a limit on the maximum length of the dialplan command line after expansion of variables and functions.

jcolp has that detailed knowledge about the Asterisk code because he wrote a part of it himself; he gave me the answer to a similar question in the past. Unfortunately, he hasn’t read this question or is busy. I am expecting an answer from him or from another Asterisk developer who is familiar with that part of the code which manages SIP simple messaging.

The overall data flow is ordinary. In /etc/asterisk/extensions.conf I just send SIP messages with:

exten => 644,1,MessageSend(pjsip:${EXTEN},${MESSAGE(from)})
same => n,Hangup()

As I said, everything works perfectly. The only problem is that the length of each message can’t exceed 1024 bytes, from my tests. If I send a message longer than 1024 letters, it just doesn’t get through. There are no parameters to set the maximum number of characters by hand in pjsip.conf or elsewhere, so, it’s clear that there is a limit hardcoded in Asterisk’s source code.

Please tell me where is this limit defined in the code, since I believe there will be other users interested to increase this limit, now that Asterisk is used for video calls, which are frequently accompanied by text chat.