]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Permit zero-length text messages in SIP.
authorTilghman Lesher <tilghman@meg.abyt.es>
Thu, 9 Apr 2009 16:38:37 +0000 (16:38 +0000)
committerTilghman Lesher <tilghman@meg.abyt.es>
Thu, 9 Apr 2009 16:38:37 +0000 (16:38 +0000)
(Related to an issue posted to the -users list, subject "AEL2, BASE64_DECODE and hexadecimal")

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@187362 65c4cc65-6c06-0410-ace0-fbb531ad65f3

apps/app_sendtext.c
channels/chan_sip.c

index af4fcade5320503bfe7f0a6782dea209838f0981..e64bf03ee56832a131b9bc69641eb00a61b83a11 100644 (file)
@@ -78,7 +78,9 @@ static int sendtext_exec(struct ast_channel *chan, void *data)
                
        u = ast_module_user_add(chan);  
 
-       if (ast_strlen_zero(data)) {
+       /* NOT ast_strlen_zero, because some protocols (e.g. SIP) MUST be able to
+        * send a zero-length message. */
+       if (!data) {
                ast_log(LOG_WARNING, "SendText requires an argument (text[|options])\n");
                ast_module_user_remove(u);
                return -1;
index ebdb2d3a0cf044656eac910c583b451f8a1a05f5..5990077473f246b0bb94467463ab0875e33ea415 100644 (file)
@@ -2413,7 +2413,9 @@ static int sip_sendtext(struct ast_channel *ast, const char *text)
                ast_verbose("Sending text %s on %s\n", text, ast->name);
        if (!p)
                return -1;
-       if (ast_strlen_zero(text))
+       /* NOT ast_strlen_zero, because a zero-length message is specifically
+        * allowed by RFC 3428 (See section 10, Examples) */
+       if (!text)
                return 0;
        if (debug)
                ast_verbose("Really sending text %s on %s\n", text, ast->name);