Get phone number of current call


(Ian Arman) #1

hi,

i’m wondering if there is a simple command to get the DID number of the call - if I know the extension number the call is connected to.

I’m trying to work on a simple bash script that does this


#2

You could issue
asterisk -rx 'core show channels'
get the channel name containing the extension, then issue
asterisk -rx 'core show channel xxxxx'
and the called number will be in the FROM_DID variable.

However, please explain your application. If you want to inform the callee (or his CRM application) which organization, department or person was called (so he can answer appropriately), there are many ways to do that without a script.

If this is for a report, the info is already in the CDRs.