[Home]

Summary:ASTERISK-10125: Check for callerid being present is incomplete.
Reporter:Dan Swartzendruber (dswartz)Labels:
Date Opened:2007-08-20 16:42:21Date Closed:2007-08-24 17:41:51
Priority:MajorRegression?No
Status:Closed/CompleteComponents:Applications/app_zapateller
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:
Description:
The check currently is:

if (chan->cid.cid_num && nocallerid) {

This is fine if there never was a CID number.  If there was a string present, but it was nulled out by an AGI script (or some context code), this pointer will still be non-null, but will point (correctly) to a null string.  Check should be more like:

if (chan->cid.cid_num && strlen(chan->cid.cid_num) && nocallerid) {

p.s. I have submitted a license and am waiting for approval.
Comments:By: Jason Parker (jparker) 2007-08-20 17:07:18

We have a function that does the length checking along with the NULL checking.

ast_strlen_zero()

You should take a look at that. :)

By: Dan Swartzendruber (dswartz) 2007-08-20 17:09:47

Cool, thanks :)

By: Dan Swartzendruber (dswartz) 2007-08-21 12:03:00

--- app_zapateller.c~   2007-08-20 17:46:17.000000000 -0400
+++ app_zapateller.c    2007-08-21 13:17:42.000000000 -0400
@@ -85,7 +85,7 @@
                       res = ast_safe_sleep(chan, 500);
               }
       }
-       if (chan->cid.cid_num && nocallerid) {
+       if (!ast_strlen_zero(chan->cid.cid_num) && nocallerid) {
               ast_module_user_remove(u);
               return res;
       }

I have verified this works as expected.



By: Digium Subversion (svnbot) 2007-08-24 17:41:50

Repository: asterisk
Revision: 80878

------------------------------------------------------------------------
r80878 | dhubbard | 2007-08-24 17:41:48 -0500 (Fri, 24 Aug 2007) | 1 line

An empty string is an empty callerid ... so zap it.  This closes issue ASTERISK-10125, which was pointed out by dswartz.  Thank you, and may the swartz be with you
------------------------------------------------------------------------