[asterisk-bugs] [Asterisk 0018432]: No audio on incoming calls when callerid (database cidname) was saved with a newline

Asterisk Bug Tracker noreply at bugs.digium.com
Tue Dec 7 11:43:55 CST 2010


The following issue has been UPDATED. 
====================================================================== 
https://issues.asterisk.org/view.php?id=18432 
====================================================================== 
Reported By:                xerofun
Assigned To:                
====================================================================== 
Project:                    Asterisk
Issue ID:                   18432
Category:                   Functions/func_callerid
Reproducibility:            always
Severity:                   minor
Priority:                   normal
Status:                     acknowledged
Asterisk Version:           1.6.2.14 
JIRA:                        
Regression:                 No 
Reviewboard Link:            
SVN Branch (only for SVN checkouts, not tarball releases): N/A 
SVN Revision (number only!):  
Request Review:              
====================================================================== 
Date Submitted:             2010-12-07 08:30 CST
Last Modified:              2010-12-07 11:43 CST
====================================================================== 
Summary:                    No audio on incoming calls when callerid (database
cidname) was saved with a newline
Description: 
(I'm not sure if the initial Category func_callerid is right, so please
move it once the right place is found.)

Whenever there is a 'cidname' database entry submitted with a newline (via
php script for example), there's no (incoming) audio on incoming calls
originating from that specific callerid via DAHDI (or in earlier versions
zaptel).

Acknowledgment: Setting a database entry with a newline at the end is
wrong, I agree on this one. I fixed the erroneous code and it's working
fine without the newline. But shouldn't asterisk sanitize the input, so
that such a crude error doesn't lead to blocked audio at all?

I'm not nearly an expert, but I would guess that the SIP header breaks
because of the newline from the database.

Here's a way to reproduce the problem:

PHP Code used to submit the database entry:

<?php
$cmd = "database put cidname 12345678 \"Test CID\"\n";
exec('/usr/sbin/asterisk -rx '.escapeshellarg($cmd), $output, $ret);
?>

Entry in the extensions.conf (placed in the context that's receiving
incoming ISDN calls, i.e isdn-incoming)

[isdn-incoming]
exten => 1234,1,Set(CALLERID(name)=${DB(cidname/${CALLERID(num)})})
exten => 1234,n,Set(CALLERID(num)=00${CALLERID(num)})
exten => 1234,n,Dial(SIP/myphone)
exten => 1234,n,Return


1. Call the php script with a php interpreter in order to add the number
to the 'cidname' database.
2. Place a call from the phone with the callerid 12345678
3. Pick up the incoming call on the sip phone identified as "myphone" 
4. Notice the missing incoming audio and the 

This is how the broken entry looks like:
snip------------
asterisk*CLI> database show cidname 12345678
/cidname/12345678                                 : Test CID
                
1 results found.
asterisk*CLI>
snap------------

Notice the empty line after "Test CID".

This is how the cdr-csv/Master.csv entry looks like:
snip------------
"","12345678","79999999","isdn-incoming","""Test CID
""
<12345678>","DAHDI/4-1","SIP/myphone-0000006f","Dial","SIP/myphone","2010-12-07
13:16:15","2010-12-07 13:16:17","2010-12-07
13:16:26",11,9,"ANSWERED","DOCUMENTATION","1291727775.137",""
snap------------

There's also a linebreak after "Test CID".


Substitute 12345678 with your incoming caller id (i.e. number of your
cellphone). Again, I know setting the "\n" at the end of $cmd is wrong and
escapeshellarg() ensures, that it is saved in the cidname database, but
again, I think this should be properly sanitized by asterisk so this won't
happen.

I stumbled across this bug in 1.2.x already, turning off the functionality
without debugging until moving to 1.6.2.14 now. I thought this bug is fixed
already so I gave it another try failing again.
====================================================================== 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2010-12-07 11:43 lmadsen        Description Updated                          
======================================================================




More information about the asterisk-bugs mailing list