Ticket #682: New API to register (external) Python thread (thanks Johan Risberg for the patch)

git-svn-id: https://svn.pjsip.org/repos/pjproject/trunk@2375 74dad513-b988-da41-8d7b-12977e46ad98
diff --git a/pjsip-apps/src/python/pjsua.py b/pjsip-apps/src/python/pjsua.py
index 90dad86..b49b79a 100644
--- a/pjsip-apps/src/python/pjsua.py
+++ b/pjsip-apps/src/python/pjsua.py
@@ -2137,6 +2137,20 @@
         lck = self.auto_lock()
         return _pjsua.handle_events(timeout)
 
+    def thread_register(self, name):
+	"""Register external threads (threads that are not created by PJSIP,
+	such as threads that are created by Python API) to PJSIP.
+
+	The call must be made from the new thread before calling any pjlib 
+	functions.
+
+	Keyword arguments:
+	name	-- Non descriptive name for the thread
+	"""
+	dummy = 1
+	err = _pjsua.thread_register(name, dummy)
+	self._err_check("thread_register()", self, err)
+
     def verify_sip_url(self, sip_url):
         """Verify that the specified string is a valid URI. 
         
@@ -2732,9 +2746,6 @@
         if buddy:
             buddy._cb.on_state()
 
-
-
-
 #
 # Internal
 #