:lineOpen failed [0x80000052] Exception occured

Mar 10, 2011 at 9:53 AM

Hi, everybody!

Pre-condition: an  user "connects" to TAPI Line using specific network protocol. A TAPI Line is OPENED (as owner) when the user connects for the first time. In code it look like (I'm talking about C#):

public void OpenLine()
{
 try
 {                
  _line = (TapiLine)_manager.GetLineByName(_phoneNumber, true);
  _line.NewCall           += this.OnNewCall;
  _line.CallInfoChanged   += this.OnCallInfoChanged;
  _line.CallStateChanged  += this.OnCallStateChanged;
                
   if (_line.IsOpen)
      _line.Close();
                                           
   _line.Open(MediaModes.All);
        
 }
 catch (TapiException ex)
 {
      WriteLog(String.Format("Error occured during the TAPI Line init. Line: {0}", _line.Name), TraceEventType.Error);
 }
}

In this  case all works fine. Event handlers catch the line state changes etc.

When the user disconnects the TAPI Line also closes. It looks like the code below:

 

public void CloseLine()
{
        try
        {
                _line.NewCall           -= this.OnNewCall;
                _line.CallInfoChanged   -= this.OnCallInfoChanged;
                _line.CallStateChanged  -= this.OnCallStateChanged;

                if (_line.IsOpen)
                    _line.Close();

                _line.Dispose();                                
            }
            catch (TapiException ex)
            {
                WriteLog(String.Format("Error occured during the TAPI Line dispose. Line: {0}", _line.Name), TraceEventType.Error);
            }
        }

 }

In this case it also works fine. But sometimes (for example) a network connection falls down. User makes 'reconnect'. We have no needs to create an new TAPI Line object (and attach event handlers) just re-init an existing one:

public void UpdateLine(EndPoint endPoint)
        {
            try
            {                
                /* some actions with network update ... */
                // TAPI re-init
                if (_line.IsOpen)
                    _line.Close();

                _line.Open(MediaModes.All);

                            }
            catch (TapiException ex)
            {
                WriteLog(String.Format("Error occured during the TAPI Line re-init. Line: {0} :{1}", _line.Name, ex.Message), TraceEventType.Error);
            }
        }

Problem 1: sometimes (I'm not sure when and why it occurs) an TAPI exception raises during the line update (UpdateLine method, see the code above). Exception look like:

ex.Message = ':lineOpen failed [0x80000052] The operation cannot be completed until all TAPI applications call lineShutdown'

 No one TAPI Line event handler works right after this exception. And all I have to do is to restart the whole application manually (I'm talking about TAPI Manager etc.)

 Problem 2: sometimes there are no TAPI Line events occured. This problem looks like a Problem 1 BUT,

A. It occurs suddenly and without any TAPI exception 

B. Only few TAPI Line state changes are missed, in general all works true.

 

Any suggestions? Does anyone give me a piece of advice? Please, help!

Thanks,

Best regards,