Export contact with Call


I try to export one Call with the linked contact.
I’m a developper and i tried to resolve the problem with coding. It’s work, but i think is not the best way to do that because i saw in file ‘modules\Calls\Call.php’ the process is already coding :

                    $query = "SELECT calls.*, contacts.first_name, contacts.last_name, users.user_name as assigned_user_name ";
                    $query .= $custom_join['select'];
                    $query .= " FROM contacts, calls, calls_contacts ";
                    $where_auto = "calls_contacts.contact_id = contacts.id AND calls_contacts.call_id = calls.id AND calls.deleted=0 AND contacts.deleted=0";
                     $query = 'SELECT calls.*, users.user_name as assigned_user_name ';
                     $query .= $custom_join['select'];
                     $query .= ' FROM calls ';
                     $where_auto = "calls.deleted=0";

Now, my problem is : how $contact_required can be ‘True’ ?
To be ‘True’, I need to have the string “contacts” on $where :

$contact_required = stristr($where, "contacts");

Maybe I missed a parameter ?

(Sorry for my english, I try to improve myself)