[asterisk-dev] limiting SIP MESSAGE to 1300 bytes (was: fix odd logic in get_msg_text() and a couple of related quirks)
walter+asterisk-dev at osso.nl
Thu Nov 24 02:53:07 CST 2011
Hm.. either reviewboard is slow with the mails, or it doesn't send
comments to a closed review along.
> Looks like a define is in order for the 1300 limit and appropriate comments documenting such. Need to eliminate the magic number.
> Normally asterisk is in the be-loose-in-what-you-accept mode. I don't think we need to be trimming messages just because RFC says the sender shouldn't exceed a certain limit. Otherwise I think we can be quite a bit more strict in other places as well.
> We're talking about the receive_message() method: it takes a buffer that a different UAC has created.
> - if there's a dialog, it sends an AST_FRAME_TEXT (T140 over RTP) along (which probably doesn't have a similar limit)
> - if there isn't a dialog, it enqueues the message (ast_msg_queue) which hits the dialplan
> In neither of these cases do we (automatically) send it along over SIP, and even if we did, I still don't think we should simply trim it. One should either refuse it when it comes in or trust that the UAC (the original sender) does know the full path MTU.
> (If you want to limit outgoing texts... there's add_text() and the callers of that (foremost sip_sendtext()) that we should be concerned about.)
> Ergo, I'd vote for moving the get_msg_text2() from 10 to 1.8; simultaneously removing the old get_msg_text(), because having two functions that do the same thing is not good.
> As for limits, a check in the MessageSend() dialplan app would probably be appropriate (returning TOO_LARGE). (A check done by the specific channel driver obviously.)
More information about the asterisk-dev