0

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?

Rev
  • 2,269
  • 8
  • 45
  • 75

1 Answers1

1

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.

Joachim Isaksson
  • 176,943
  • 25
  • 281
  • 294
  • @Rev Are you sure the actual call to `_rtcProvisioning.DisableProfile(_rtcProfile);` is done? – Joachim Isaksson Mar 03 '12 at 06:30
  • @Rev It's been a while since I did COM interop so my array mapping may be off, but is Profiles[1] really the correct element to check the status on, not Profiles[0] if Count is > 0? – Joachim Isaksson Mar 03 '12 at 06:44
  • First yes, cuz `_rtcProfile state` change after this line , Second: I think so. profiles[1] use only in if condition and `_rtcProfile` is same object registered on server and this object goes for disable method. – Rev Mar 03 '12 at 06:55
  • @Rev Added some extra info to the answer. – Joachim Isaksson Mar 03 '12 at 07:23
  • 1
    @Rev Not sure why you un-upvoted without a comment on why the PrepareForShutdown information was not helpful. It solves exactly the problem you're stating that you're having. – Joachim Isaksson Mar 14 '12 at 08:23
  • Cuz I want run bounty and create same Conditions for all(whom answer to question). In that way your are only person helped me. Thanks, but I still have this problem! – Rev Mar 17 '12 at 09:21
  • @Rev Did you implement the PrepareForShutdown solution? If so, could you post the code? I tested it, works for me to get it to sign out. – Joachim Isaksson Mar 17 '12 at 10:50