The command searches the smdr record for whatever string you put in there. The system only track the last 20,000 calls.
You'd have to run the command for each extension at a time.
Weather it tracks incoming or out going calls depends on how you've programmed the SMDR form.
If you need to do this a lot then you may have to purchase a call accounting system.
Prairie Fyre actively supports this forum directly so it's a good choice for a full blown system.
There is another member of this forum that is working on writing his own system for a light weight call tracking system. Not sure what his stats is but perhaps he may want to jump in on this conversation.
Ralph