Hi,
I have been struggling to programatically add a delegate to a user (boss/admin scenario).
After running my test code in the boss sfb client the admin appears as a delegate however, in the admin's sfb client the boss does not appear under the section "people I manage calls for". I verified in the rtc frontend database that the delegation is configured, however the admin subscription record does not list the boss. Below is the code I used to achieve this.
Any ideas why the admin sfb client is not being notified of the new delegation?
Thanks,
Simon
1) add delegate-management
public void SendAddDelegate() { string body = string.Format($"<setDelegates xmlns=\"http://schemas.microsoft.com/2007/09/sip/delegate-management\" version=\"1\"><delegate uri=\"admin@example.com\" action=\"add\"/></setDelegates>"); byte[] encBody = Encoding.UTF8.GetBytes(body); RealTimeAddress rta = new RealTimeAddress("boss@example.com"); System.Net.Mime.ContentType contentType = new System.Net.Mime.ContentType("application/msrtc-setdelegate+xml") endpoint.InnerEndpoint.BeginSendMessage(MessageType.Service, rta, contentType, encBody, SendAddDelegateManagementMessageComplete, null); } private void SendAddDelegateManagementMessageComplete(IAsyncResult result) { try { SipResponseData srd = endpoint.InnerEndpoint.EndSendMessage(result); logger.Debug($"srd.ResponseCode - {srd.ResponseCode}"); } catch (Exception exc) { logger.Error("Exception SendMessageComplete with message - {0}", exc.Message); } }
2) Publish presence
public void PublishRoutingCategory(string delegateUri) { routes.DelegateRingEnabled = true; routes.Delegates.Add(delegateUri); routes.SimultaneousRingEnabled = true; routes.SimultaneousRing.Add(delegateUri); routes.SkipPrimaryEnabled = true; routes.ForwardAudioAppInvitesEnabled = true; try { userEndpoint.LocalOwnerPresence.BeginPublishPresence(new PresenceCategory[] { routes }, PublishComplete, null); } catch (Exception exc) { logger.Error("Unknown error - {0}", exc.Message); } } private void PublishComplete(IAsyncResult result) { try { endpoint.LocalOwnerPresence.EndPublishPresence(result); } catch (Exception exc) { logger.Error("Error Publish Complete- {0}", exc.Message); } }
Simon