I’ve set up a notification subscription for everything to do with calls (so call’s being made and call records). I receive every call object correctly but for the ‘Call Record’ notifications I only receive those for internal calls. So calls from device x to device y, I receive the call record for. For outgoing (from device x to external number y) or incoming (from external number y to device x) i’m not getting any call records.
The difference between internal and external seems strange but in general for on-premise endpoints then I think you would be better with a slightly different subscription.
Try using ‘^/2017-09-01/endpoints/[^/]+/calls/[^/]+$’ as the subject without a subjectFilter.
That’s indeed what’s going on, I can only receive call records for my own user. I also created a Client and tested with that but then no CDR records are received. So only call records for the current user are received and there is indeed no way to receive them all.
This might be a handy feature to add! Also at the moment there is no link between calls that are linked in the CDR records. For example when you receive a phone call and transfer that phone call to a 2nd party. There is no link between the 2 CDR records.
However you can only receive CDR through the API for your own calls. For call control though, you can subscribe to events on specific on-premise PBX endpoints using the /endpoints path. Since you can use regular expressions for the subjectFilter, you can create a subscription to a range of endpoints you need to monitor, instead of having to set them up individually. This would be how you would monitor a range of virtual devices for ringing events, then perform the appropriate call control, assuming you’re building an app that handles dynamic routing or acts like an IVR.
We don’t recommend you monitor everything as that would generate a lot of traffic and might cause performance issues.