How to Identify that the call is inbound or outbound by cdr table in Astriskcdrdb database

I want a list of all incoming and outgoing calls from the cdr table of the Astriskcdrdb database. But I am not able to identify that the call is inbound (i.e call came from outside) or outbound.
Is there any flag in the cdr table or any other way to identify it ?
Please suggest.

You can log custom data in the userfield column with the CDR function, Modify your dialplan for your inbound calls and tag them however you wish to search for them.

Asterisk Astriskcdrdb it is usally the DB use by freepbx to log calls, and if so you cand o the filter based on the context name also you can use the channel field and dstchannel also to do this filtering.

Thanks for reply @johnkiniston
Actually we are not writing our own dialplan. We need to write a mysql query to get the list of all incoming and all outgoing calls from cdr table in Asteriskcdrdb database.

You would probably be better off asking on a it looks like most of your difficulties arise from FreePBX, not Asterisk.

As already noted, there is a lot of information in standard Asterisk CDRs that makes it possible to deduce whether a call starts or ends on an external device.

1 Like