How to Record, track and manage call from PhoneSystem.MakeCall

Status
Not open for further replies.

Jaspalsinh Chauhan

Joined
Sep 12, 2018
Messages
7
Reaction score
0
I am using C# / .NET Core based console to integrate with 3CX system, based on some trigger I initiate a call using PhoneSystem.MakeCall("1001", "some_mobile_number").

This works but this call does not give back any info on the call that go initiated, like I wish to track if the call went through, was the other party busy, other errors while try to make call, if connected then indicate that "record this call", once call is complete I wish to get notified that call completed and fetch duration of the call.

Also I see another overload of PhoneSystem.MakeCall method which takes two param - dnNumber and Dictionary parameters - not sure what can I pass in this dictionary of parameters? is there a doc or article i can refer to get a list of possible parameters i can pass in.

Hope to get some help on this, very new to 3CX API, thanks
 
Both MakeCall methods are just an asynchronous request to 3CX. Later, 3CX will make the call. So you don't receive any information back when you invoke the method. You need to monitor active calls in the system, identify your call based on the caller and destination numbers, and then follow up the call from there.
 
Do I get a call ID or something in someway to recognize the correct call I need to track?
There could be a case where person a called person b like 5 times and I wish to get details of the second call - how can i differentiate if I have to search based on the caller and callee alone?

Also I request to provide details on following:
1). I can I indicate 3CX server that a call should be record - and get back the recorded audio URL to share
2). Change the name / phone number the recipient user sees on their phone when we make call via 3CX
3). Get event or something to know if an active call is complete
4). Get time duration of a call (or if it never happened then what was the reason of failure)

I would appreciate if you could point me in correct direction for above queries, thanks
 
Do I get a call ID or something in someway to recognize the correct call I need to track?
No, the MakeCall method doesn't return anything.

There could be a case where person a called person b like 5 times and I wish to get details of the second call - how can i differentiate if I have to search based on the caller and callee alone?
You would have to use the start date time to tell them apart...

1). I can I indicate 3CX server that a call should be record - and get back the recorded audio URL to share
You can't do this. Calls are recorded if the extension taking part is set to record all calls. And if the call is between 2 external parties, it can't be recorded at all, only calls where at least 1 extension participates can be recorded.

2). Change the name / phone number the recipient user sees on their phone when we make call via 3CX
You can't control this in a per call basis. Outbound calls are made using the configuration you have in the SIP Trunk when the call is made.

3). Get event or something to know if an active call is complete
You can subscribe to events using the 3CX Call Control API. You can be notified when a call is created, when any parameter changes (for example when it's answered), or when it ends. There is a sample project showcasing how to do this, check the documentation:
https://www.3cx.com/docs/call-control-api/

4). Get time duration of a call (or if it never happened then what was the reason of failure)
You need to calculate this yourself using the events provided by 3CX. So you save the current date and time when a call starts, and you calculate the difference when it ends.
 
https://www.3cx.com/docs/call-control-api/

I looked at the zip code from above URL and I see a example in "Samples" > RecordCall.cs to record a call if it is in Connected state.

As per your comment: You can't do this. Calls are recorded if the extension taking part is set to record all calls. And if the call is between 2 external parties, it can't be recorded at all, only calls where at least 1 extension participates can be recorded.

Can i use above RecordCall method to switch recording of call or not? Little confused as these two contradicts each other.

PS: One of the parties of the call is always going to be extension participate.

Also this example indicates something about CallID where can I find that and is that unique across the system or something, need more insight to find an id i can use to reference a call once i recognized it
 
Can i use above RecordCall method to switch recording of call or not? Little confused as these two contradicts each other.
Yes, you can do it. But it will only work if at least 1 participant is an extension.

Also this example indicates something about CallID where can I find that and is that unique across the system or something, need more insight to find an id i can use to reference a call once i recognized it
The CallID is the identifier of the ActiveConnection object you need to update. This is unique while the process is running, but the counter starts from zero again when you restart the 3CX services. You get it from the ActiveConnection object, once you have identified the call.
 
Yes one participant is always an extension.
CallID - ActiveConnection - got it, thanks.

I see that when i record the call - it saves all recording to file root path as specified in "CALLRECORDSROOT" and then creates folders based on extension DN number.

Can you please help me find a way to link a particular recording in that "DN extension folder" with a call. In my case for e.g.: I got a file called "[Ext One]_1001-1002_20181114114941(2).wav"

Also assume that the recording file would appear in the folder as soon as the call is over or am I assuming wrong?
 
Here you have some information about how the name of the file is created:
https://www.3cx.com/blog/voip-howto/managing-recordings/

Yes, the recording will be there when the call ends. Unfortunately there is no API to get the recording file name, that's only saved in the 3CX database and available through reports.
 
Do we have a clean way to access the 3CX DB to get those file name associated with a call by some means of Id?

Also, what API methods can I use to read the call logs (not active connection)
Similar to the one I see at https://myurl.3cx.in:99999/#/app/call_log in my server
 
Accessing the 3CX database is not recommended. Any change you make to the database structure or data might cause that 3CX stops working. Also, the database structure is not documented and might change with any 3CX update, so if you base your solution on that, it might stop working with any 3CX update without further notice.

For Call Logs you can read CDRs:
https://www.3cx.com/docs/cdr-call-data-records/

However, these CDRs don't have the recording path.
 
Status
Not open for further replies.

Latest Posts

Forum statistics

Threads
112,323
Messages
591,896
Members
165,474
Latest member
costionofrei