I am trying to pass some call information, to an api-script if the call is answered following variables will be needed:

1. Caller ID
2. Time Call Started
3. Time Call Ended
4. Total Call Duration
5. Conclusion type (1= Completed, so the call went through, 2=Aborted )
6. State (if the call was aborted, the "why" state, busy,no-answer,cancelled,failed,voicemail)

The perfect thing would be to do this in the extension , something like

```
exten=> X,1,Wait(1)
exten=> X,2,Set(CallerID=${CALLERID(num)})
exten=> X,3,Dial(number)
exten=> X,4,AGI(api.php?var1=callerid etc...)
exten=> X,5,Hangup()

```

Any idea on how to approach all this would be welcomed, even partially as I read a lot of different google results, but cant figure this out

P.S. The server has FreePBX installed so its not a bare-bone installation.

Thanks in advance