[asterisk-commits] file: branch group/pimp_my_sip r379454 - /team/group/pimp_my_sip/channels/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Jan 18 11:38:06 CST 2013


Author: file
Date: Fri Jan 18 11:38:03 2013
New Revision: 379454

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=379454
Log:
Until the thread pool is used register the Asterisk PBX thread with pjlib.

Modified:
    team/group/pimp_my_sip/channels/chan_gulp.c

Modified: team/group/pimp_my_sip/channels/chan_gulp.c
URL: http://svnview.digium.com/svn/asterisk/team/group/pimp_my_sip/channels/chan_gulp.c?view=diff&rev=379454&r1=379453&r2=379454
==============================================================================
--- team/group/pimp_my_sip/channels/chan_gulp.c (original)
+++ team/group/pimp_my_sip/channels/chan_gulp.c Fri Jan 18 11:38:03 2013
@@ -128,6 +128,18 @@
 	.update_peer = gulp_set_rtp_peer,
 };
 
+static void pj_thread_register_check(void)
+{
+	pj_thread_desc desc;
+	pj_thread_t *thread;
+
+	if (pj_thread_is_registered() == PJ_TRUE) {
+		return;
+	}
+
+	pj_thread_register("Asterisk Thread", desc, &thread);
+}
+
 /*! \brief Function called to create a new Gulp Asterisk channel */
 static struct ast_channel *gulp_new(struct ast_sip_session *session, int state, const char *exten, const char *title, const char *linkedid, const char *cid_name)
 {
@@ -262,6 +274,8 @@
 	struct ast_sip_session *session = ast_channel_tech_pvt(ast);
 	pj_status_t status = -1;
 	pjsip_tx_data *packet = NULL;
+
+	pj_thread_register_check();
 
 	switch (condition) {
 	case AST_CONTROL_RINGING:
@@ -427,6 +441,8 @@
 	pjsip_tx_data *packet = NULL;
 	int cause = hangup_cause2sip(ast_channel_hangupcause(session->channel));
 
+	pj_thread_register_check();
+
 	if (((status = pjsip_inv_end_session(session->inv_session, cause ? cause : 603, NULL, &packet)) == PJ_SUCCESS) && packet) {
 		if (packet->msg->type == PJSIP_RESPONSE_MSG) {
 			ast_sip_session_send_response(session, packet);




More information about the asterisk-commits mailing list