From Bright Pattern Documentation
< 5.8:Desktop-integration-api-net-version-tutorial
Revision as of 04:13, 29 May 2024 by BpDeeplTranslateMaintenance (talk | contribs) (Updated via BpDeleteTranslateTags script)
Conference
The following code snippet shows how to merge calls into a conference.
- For an conference via consultation, it assumes existence of a held primary call and an active consult call. Execution of the code snippet would be triggered by an explicit user action (e.g., pressing of a Merge button).
- For a single-step conference, it assumes existence of an active primary call and another call attempt initiated by the logged-in user. Execution of the code snippet would be triggered by connection of the second call.
public void MergeCalls(List<Call> calls) { Call conferencingCall = FindConferencingCall(calls, null); if (conferencingCall == null) return; List<Call> callsToMerge = new List<Call>(); foreach (Call call in calls) { if (call.id != conferencingCall.id && call.state != CallState.Disconnected) { callsToMerge.Add(call); } } conferencingCall.mergeConference(callsToMerge); } private Call FindConferencingCall(List<Call> calls) { Call bestCall = null; DateTime bestTime = DateTime.Now; foreach (Call call in calls) { if (call.state != CallState.Disconnected && call.state != CallState.Unknown) { foreach (CallParty cp in call.parties.Values) { switch (cp.phoneType) { case PhoneType.Trunk: return call; case PhoneType.DialOut: return call; case PhoneType.AccessNumber: return call; case PhoneType.Phone: case PhoneType.Softphone: if (bestCall == null) { bestCall = call; bestTime = call.startTime; } else if (call.startTime < bestTime) { bestCall = call; bestTime = call.startTime; } break; } } } } return bestCall; }
To remove a participant from a conference, the removeParty method from Call should be used as follows:
void RemoveFromConference(string callId, string partyId) { Call call = AgentPlace.call(callId); if (call != null) { CallParty party = call.parties[partyId]; if (party != null) { call.removeParty(party); } } }
To leave a conference (remove oneself from a conference), use the drop method from Call:
public void drop();
To end a conference, use the endConference method from Call:
public void endConference();