[asterisk-scf-commits] asterisk-scf/integration/sip.git branch "master" updated.

Commits to the Asterisk SCF project code repositories asterisk-scf-commits at lists.digium.com
Fri Aug 20 16:02:31 CDT 2010


branch "master" has been updated
       via  e53a95c97d142b2ec2cd276a2a794d899a3c3305 (commit)
       via  f4d8ba9b716540cd51339e51a2dbb57906395d98 (commit)
      from  fbc6f99656df255bb4f497e7697abffb1b406af3 (commit)

Summary of changes:
 src/PJSipManager.cpp |   20 +++++++++++++++-----
 1 files changed, 15 insertions(+), 5 deletions(-)


- Log -----------------------------------------------------------------
commit e53a95c97d142b2ec2cd276a2a794d899a3c3305
Author: Mark Michelson <mmichelson at digium.com>
Date:   Fri Aug 20 16:03:11 2010 -0500

    Flesh out the SIP maintenance thread some more.
    
    It now registers itself with PJSIP, and has an infinite loop
    to handle events. This will, of course, be modified to have a
    finite timeout later, but for now, inifinite will do.

diff --git a/src/PJSipManager.cpp b/src/PJSipManager.cpp
index c28a98e..2fc8c21 100644
--- a/src/PJSipManager.cpp
+++ b/src/PJSipManager.cpp
@@ -2,9 +2,19 @@
 
 PJSipManager *PJSipManager::mInstance = NULL;
 
-static void *monitorThread(pjsip_uint32_t ignore)
+static void *monitorThread(void *endpt)
 {
-	//Fill this in later
+	pj_thread_t *this_thread;
+	pj_thread_desc desc;
+	pj_bzero(desc, sizeof(desc));
+	pj_thread_register("SIP Maintenance", desc, &this_thread);
+	pjsip_endpoint *endpoint = endpt;
+	for (;;)
+	{
+		// No timeout is a bad idea in the long run, but for now,
+		// let's just go with it.
+		pjsip_endpt_handle_events(endpoint, NULL);
+	}
 }
 
 PJSipManager *PJSipManager::getInstance()
@@ -34,7 +44,7 @@ PJSipManager::PJSipManager()
 		std::cerr << "[ERROR] Failed to create a memory pool" << std::endl;
 	}
 	status = pj_thread_create(mMemoryPool, "SIP", (pj_thread_proc *) &monitorThread,
-			NULL, PJ_THREAD_DEFAULT_STACK_SIZE, 0, &mPjThread);
+			NULL, PJ_THREAD_DEFAULT_STACK_SIZE, mEndpoint, &mPjThread);
 	if (status != PJ_SUCCESS)
 	{
 		std::cerr << "[ERROR] Failed to create SIP maintenance thread" << std::endl;

commit f4d8ba9b716540cd51339e51a2dbb57906395d98
Author: Mark Michelson <mmichelson at digium.com>
Date:   Fri Aug 20 15:46:35 2010 -0500

    Fixing up some of the error functions.

diff --git a/src/PJSipManager.cpp b/src/PJSipManager.cpp
index 1eb86b5..c28a98e 100644
--- a/src/PJSipManager.cpp
+++ b/src/PJSipManager.cpp
@@ -31,13 +31,13 @@ PJSipManager::PJSipManager()
 	mMemoryPool = pj_pool_create(&mCachingPool.factory, "SIP", 1024, 1024, NULL);
 	if (!mMemoryPool)
 	{
-		std::cerr << "Oh crap again!\n" << std::endl;
+		std::cerr << "[ERROR] Failed to create a memory pool" << std::endl;
 	}
 	status = pj_thread_create(mMemoryPool, "SIP", (pj_thread_proc *) &monitorThread,
 			NULL, PJ_THREAD_DEFAULT_STACK_SIZE, 0, &mPjThread);
 	if (status != PJ_SUCCESS)
 	{
-		std::cerr << "And again, oh crap!" << std::endl;
+		std::cerr << "[ERROR] Failed to create SIP maintenance thread" << std::endl;
 	}
 }
 

-----------------------------------------------------------------------


-- 
asterisk-scf/integration/sip.git



More information about the asterisk-scf-commits mailing list