2017-11-15 31 views
1

나는 2013 년ContactAvailability Lync

내 응용 프로그램이 내 휴대 전화와 연결되어 Lync SDK를 사용하는 응용 프로그램을 가지고 있고, 나는 전화받을 때 내가 전화를 종료 할 때 내 precence Lync는 (ContactAvilability.Busy) 바쁜되고 내 상태를 원래 상태 (사용 가능 또는 방해 금지 ....)로 되돌리고 싶습니다.

내 질문은 내 실제 상태를 저장하고 전화를 끝낼 때 어떻게 되돌릴 수 있습니까? 복원하려면

_previousPresence = client.Self.Contact.GetContactInformation(new[] 
{ 
    ContactInformationType.Availability, 
    ContactInformationType.ActivityId, 
    ContactInformationType.CustomActivity 
}); 

때문에 우리는 사용자 정의 활동 지역화 된 문자열을 얻을 수 있지만 "사용자 지정"활동의 조금 어렵습니다 :

public static void notify(Call call) 
     { 
      // How to save my current state 
      if (call.state == Answer) 
      { 
       client.Self.BeginPublishContactInformation(
       new Dictionary<PublishableContactInformationType, object>() { 
       { PublishableContactInformationType.Availability, ContactAvailability.Busy } 
       }, null, null); 
      } 
      else 
      { 
       // where i want to return to my original state 
      } 
     } 

감사

답변

0

는 이전의 존재를 저장하려면 맞춤 활동 ID. 또한 알 수없는 사용자 정의 활동 (즉, 사용자 정의 활동 xml 파일에 정의되지 않은 사용자 정의 활동 존재)을 복원 할 수있는 방법이 없습니다. UCMA 엔드 포인트 또는 다른 클라이언트 엔드 포인트에 정의되지 않은 사용자 정의 활동 설정이있는 경우 이 클라이언트에서). 모든 경우에 정확하게 존재를 저장하고 복원하는 유일한 방법은 UCMA 응용 프로그램 (서버 또는 클라이언트)을 사용하여 현재 상태가 어떻 게/어떻게 설정되어 있는지, 즉 사용자 정의 활동 존재 유형에 대한 세부적인 제어를보다 많이 제어 할 수있게하는 것입니다. 은 Lync 클라이언트에서 존재를 복원

예 :

var publishData = new Dictionary<PublishableContactInformationType, object> 
{ 
    {PublishableContactInformationType.Availability, _previousPresence[ContactInformationType.Availability]}, 
    {PublishableContactInformationType.ActivityId, _previousPresence[ContactInformationType.ActivityId]} 
}; 

var customId = FindCustomActivityId(client, 
    (ContactAvailability)_previousPresence[ContactInformationType.Availability], 
    ((List<object>)_previousPresence[ContactInformationType.CustomActivity]).Cast<LocaleString>().ToList()); 
if (customId != null) 
{ 
    publishData.Add(PublishableContactInformationType.CustomActivityId, customId); 
} 

await Task.Factory.FromAsync(client.Self.BeginPublishContactInformation(publishData, null, null), client.Self.EndPublishContactInformation); 

FindCustomActiviyId이있는이 문자열을하고 있다는 점에서 사용자 정의를 다시 제공하지 않는 presvious 현재 상태 정보에서 검색 비교 "해킹"약간의 액티비티 ID가 아니라 사용자 정의 액티비티의 지역화 된 문자열 만 포함합니다.

private static object FindCustomActivityId(Client client, ContactAvailability availability, IReadOnlyCollection<LocaleString> customActivities) 
{ 
    var currentLcid = System.Globalization.CultureInfo.CurrentUICulture.LCID; 
    var customStates = client.Self.GetPublishableCustomAvailabilityStates(currentLcid); 

    if (customStates == null || !customStates.Any()) 
    { 
     return null; 
    } 

    var state = customStates.FirstOrDefault(cs => customActivities.Any(ca => cs.Availability == availability && string.Equals(ca.Value, cs.Activity))); 

    return state?.Id; 
} 

겹치는 전화도 고려할 수 있습니다. 즉 귀하의 전화 통화와 Lync 통화가 중복됩니다. 이러한 경우 Lync 클라이언트가 이미 "OnThePhone"사용 중 상태에있을 수 있습니다. 또는 다른 전화 시스템 호출에 응답 한 후에 현재 상태가 "OnThePhone"으로 변경된 경우.

또한 다른 Lync 사용자가 통화 중임을 알 수 있도록 통화 중 하위 상태를 OnThePhone으로 설정하는 것이 좋습니다. 이것은 Lync 클라이언트 호출에 응답 할 때 Lync 클라이언트가 자동으로 수행하는 작업입니다.

// publish on-the-phone presence 
var publishData = new Dictionary<PublishableContactInformationType, object> 
{ 
    {PublishableContactInformationType.Availability, ContactAvailability.Busy}, 
    {PublishableContactInformationType.ActivityId, "on-the-phone"} 
}; 
await Task.Factory.FromAsync(client.Self.BeginPublishContactInformation(publishData, null, null), client.Self.EndPublishContactInformation); 
+0

내 notify (호출)가 완료되기 전에 여러 상태를 거칩니다. Ringing => Answer => Terminate, 그래서 'ringing'은 _previousPresence를 저장하고 else (call.state! = Answer)는 _previousPresence를 반환합니다. 하지만 내가 대답하면 _previousPresence 전에 저장 한 다음 상태를 바쁜 (왜냐하면 if (call.state == 답변) 사실이기 때문에), 그리고 전화를 끝낼 때 _previousPresence (이 경우 _previousPresence = busy)는 else를 거쳐 _previousPresence = Busy를 복원합니다. 그래서 내 부름의 끝에서 항상 존재는 바쁘다. –

+0

나는 당신의 논리를 잘 모르겠습니다. 나는 언젠가 전에 존재를 바꾸기 바로 전에 그 존재를 구할 것이다. 그 동안 로컬 Lync가 변경 될 수있는 경우 벨이 울리는 상태가 오래 걸릴 수 있습니다. 전화 시스템은 대부분 여러 주를 거치므로 보류/재개 상태를 잊지 마십시오. 일부 시스템에서는 다시 시작 상태가 "응답 한"것으로 나타날 수 있습니다. –

+0

답변과 설명에 감사드립니다. –