Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 192193
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T16:24:19+00:00 2026-05-11T16:24:19+00:00

In my DoWork() function I register with our sip server. Then I have to

  • 0

In my DoWork() function I register with our sip server. Then I have to wait for a response back. However, the response I get is received in another event. However, before I am able to check the flag in the DoWork() the DoWork() has all ready finished and the response comes after.

I am trying to find a way to wait in the DoWork() until I get a response in the Diagnotic event. I have a global flag that is set in that event that I have to check in the DoWork().

Thanks for any advice,

// Do work in background worker
//Will return less than 8 if there are no error message from the library 
        if (!this.bgwProcessLogin.CancellationPending)
        {
                // Register and wait for response
                VaxSIPUserAgentOCX.RegisterToProxy(3600);
        }
        else
        {
                // Update label
                if (this.lblRegistering.InvokeRequired)
                {
                  // do something here
                }
                else
                {
                    // Display error
                }
         }

// WAIT FOR A RESPONSE FROM THE DIAGNOTIC EVENT BEFORE CONTINUING - MAYBE JOIN HERE
        if (!this.bgwProcessLogin.CancellationPending)
        {
            if (this.responseFlag)
            {
                // Do something here   
            }
            else
            {
                // Do something else here
            }
        }


// Another function where I receive the response
private void VaxSIPUserAgentOCX_OnIncomingDiagnostic(object sender, AxVAXSIPUSERAGENTOCXLib._DVaxSIPUserAgentOCXEvents_OnIncomingDiagnosticEvent e)
    {
        string messageSip = e.msgSIP;
        //Find this message in the sip header

        string sipErrorCode = "600 User Found"; 
        if (messageSip.Contains(sipErrorCode))
        {
            // Set global flag for response
            this.responseFlag = true;
        }
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-11T16:24:20+00:00Added an answer on May 11, 2026 at 4:24 pm

    You could use a ManualResetEvent. Once your code hits the the WaitOne call, it will block until the event is Set. The WaitOne call is also overloaded so you can provide a duration to wait if you need to.

    void SomeFunction()
    {
    // Do work in background worker
    //Will return less than 8 if there are no error message from the library 
            if (!this.bgwProcessLogin.CancellationPending)
            {
                    // Register and wait for response
                    VaxSIPUserAgentOCX.RegisterToProxy(3600);
            }
            else
            {
                    // Update label
                    if (this.lblRegistering.InvokeRequired)
                    {
                      // do something here
                    }
                    else
                    {
                        // Display error
                    }
             }
    
    // WAIT FOR A RESPONSE FROM THE DIAGNOTIC EVENT BEFORE CONTINUING - MAYBE JOIN HERE
    
            waitEvent.WaitOne();
            if (!this.bgwProcessLogin.CancellationPending)
            {
                if (this.responseFlag)
                {
                    // Do something here   
                }
                else
                {
                    // Do something else here
                }
            }
    }
    
    ManualResetEvent waitEvent = new ManualResetEvent(false);
    
    // Another function where I receive the response
    private void VaxSIPUserAgentOCX_OnIncomingDiagnostic(object sender, AxVAXSIPUSERAGENTOCXLib._DVaxSIPUserAgentOCXEvents_OnIncomingDiagnosticEvent e)
        {
            string messageSip = e.msgSIP;
            //Find this message in the sip header
    
            string sipErrorCode = "600 User Found"; 
            if (messageSip.Contains(sipErrorCode))
            {
                // Set global flag for response
                this.responseFlag = true;
                waitEvent.Set();
            }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Currently I have a background thread whose doWork calls a function similar to below.
I have this simple code : console.log('calling doWork func...') doWork('a', 'b', myCb); function doWork(param1,
I have the following code: public Mainform() { ... // scheduler scheduler.DoWork += new
Is this possible? What I want to do is have my doWork method instantiate
function dowork() { $(.wrappedElement).removeClass(wrappedElement); $(.wrappedElementout).removeClass(wrappedElementout); var a=$(div#DepPart select option:selected).val(); $(div#TestPart select option[value^=a]).addClass(wrappedElement); $(div#TestPart select
am trying to get my head around the following: Have a small program am
i have used a mail function. after inserting every record simultaneously from multiple PC.
I am creating a composite control, that implements IScriptControl. in CreateChildControls() function i have
Should I ALWAYS use this practice... Public Function DoWork() Using dc as New myDataContext()
I have two function that do the exact same thing in two different ways.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.