0
votes

I have problem with Profile roaming in RTC. so let me describe my program to understand it better.

I write Soft-Phone base on sip Protocol, for using Sip I decide using RTC Library for Communication. This Soft-Phone do these features perfectly like hold, redirect, answer, hangup and etc. I use C# and Interop.RTCCORELib dll for RTC. after too many time using this phone with any type of PBX server like (asterisk, asterisk windows and Elestisk) I face mysterious problem in my Soft-Phone.

Problem: when operator login and using phone I create IRTCProfile2 Propety to register this Profile on server. after operator don his/her work with phone, oprator close phone. In this moment I run method to disable profile on server. I checked profile, and profile state changed to "Unregistered". But the sip user still login on server. I check msdn and find this article.

In this article describe how to disable profile on server. and I do this same. here's My Code:

  public void unregisterProfile()
    {
        if (_rtcProvisioning.Profiles.Count > 0 && 
           ((IRTCProfile)_rtcProvisioning.Profiles[1]).State == RTC_REGISTRATION_STATE.RTCRS_REGISTERED)
        {
            _rtcProvisioning.DisableProfile(_rtcProfile);
            _rtcPresence.DisablePresence();
            _rtcClient.PrepareForShutdown();
            Thread.Sleep(2000);
            _rtcClient.Shutdown();
        }
    }

Also in this article say call IRTCClientPresence2.DisablePresence method.

So any solution? any tips? did I miss something?

1

1 Answers

1
votes

Yes, I think you missed IRTCClientPresence2 which has the actual DisablePresence() call.

From the docs;

The IRTCClientPresence2 interface derives from the IRTCClientPresence interface. It adds roaming and grouping capabilities for presence objects to the client. This interface can be obtained by calling QueryInterface on the IRTCClientPresence interface.

Edit: You're also calling RTCClient::Shutdown() immediately after calling DisableProfile (and DisablePresence when that is added), the documentation for ShutDown() states though;

To give the SIP stack a chance to gracefully unregister from registrars and unsubscribe Watchers, the Client should call the asynchronous method PrepareForShutdown before calling Shutdown.