[svn-commits] mmichelson: branch mmichelson/queue_refcount r81409 - in /team/mmichelson/que...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Fri Aug 31 11:19:27 CDT 2007


Author: mmichelson
Date: Fri Aug 31 11:19:26 2007
New Revision: 81409

URL: http://svn.digium.com/view/asterisk?view=rev&rev=81409
Log:
Queue refcounting appears to be working correctly for realtime now...for real.
Tested with multiple calls, single calls, adding and deleting queues from database...it's working as
expected.


Removed:
    team/mmichelson/queue_refcount/configs/modem.conf.sample
Modified:
    team/mmichelson/queue_refcount/   (props changed)
    team/mmichelson/queue_refcount/apps/app_queue.c
    team/mmichelson/queue_refcount/channels/chan_misdn.c
    team/mmichelson/queue_refcount/channels/h323/ast_h323.cxx
    team/mmichelson/queue_refcount/channels/misdn/isdn_lib.c
    team/mmichelson/queue_refcount/configs/enum.conf.sample
    team/mmichelson/queue_refcount/configs/extensions.ael.sample
    team/mmichelson/queue_refcount/main/pbx.c
    team/mmichelson/queue_refcount/res/res_features.c

Propchange: team/mmichelson/queue_refcount/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Fri Aug 31 11:19:26 2007
@@ -1,1 +1,1 @@
-/branches/1.4:1-81358
+/branches/1.4:1-81386

Modified: team/mmichelson/queue_refcount/apps/app_queue.c
URL: http://svn.digium.com/view/asterisk/team/mmichelson/queue_refcount/apps/app_queue.c?view=diff&rev=81409&r1=81408&r2=81409
==============================================================================
--- team/mmichelson/queue_refcount/apps/app_queue.c (original)
+++ team/mmichelson/queue_refcount/apps/app_queue.c Fri Aug 31 11:19:26 2007
@@ -612,7 +612,7 @@
 					"LastCall: %d\r\n"
 					"Status: %d\r\n"
 					"Paused: %d\r\n",
-					q->name, cur->interface, cur->membername, cur->dynamic ? "dynamic" : "static",
+					q->name, cur->interface, cur->membername, cur->dynamic ? "dynamic" : cur->realtime ? "realtime" : "static",
 					cur->penalty, cur->calls, (int)cur->lastcall, cur->status, cur->paused);
 			}
 		}
@@ -1055,7 +1055,7 @@
 	/* Static queues override realtime. */
 	if (q) {
 		ast_mutex_lock(&q->lock);
-		if (!q->realtime) {
+		if (!q->realtime) { /*XXX Is it even possible for this to be executed???*/
 			if (q->dead) {
 				ast_mutex_unlock(&q->lock);
 				queue_unref(q);
@@ -1065,6 +1065,7 @@
 				return q;
 			}
 		}
+		queue_unref(q);
 	} else if (!member_config)
 		/* Not found in the list, and it's not realtime ... */
 		return NULL;
@@ -1084,7 +1085,6 @@
 			/*In this case, we must unref the queue twice since it was reffed once in load_realtime_queue
 			 * and again locally. Otherwise, there's a memory leak
 			 */
-			queue_unref(q);
 			queue_unref(q);
 		}
 		return NULL;
@@ -1590,7 +1590,7 @@
 				"LastCall: %d\r\n"
 				"Status: %d\r\n"
 				"Paused: %d\r\n",
-				q->name, cur->interface, cur->membername, cur->dynamic ? "dynamic" : "static",
+				q->name, cur->interface, cur->membername, cur->dynamic ? "dynamic" : cur->realtime ? "realtime": "static",
 				cur->penalty, cur->calls, (int)cur->lastcall, cur->status, cur->paused);
 		}
 	}

Modified: team/mmichelson/queue_refcount/channels/chan_misdn.c
URL: http://svn.digium.com/view/asterisk/team/mmichelson/queue_refcount/channels/chan_misdn.c?view=diff&rev=81409&r1=81408&r2=81409
==============================================================================
--- team/mmichelson/queue_refcount/channels/chan_misdn.c (original)
+++ team/mmichelson/queue_refcount/channels/chan_misdn.c Fri Aug 31 11:19:26 2007
@@ -2658,8 +2658,10 @@
 static struct ast_frame  *misdn_read(struct ast_channel *ast)
 {
 	struct chan_list *tmp;
-	int len;
-	
+	fd_set rrfs;
+	struct timeval tv;
+	int len, t;
+
 	if (!ast) {
 		chan_misdn_log(1,0,"misdn_read called without ast\n");
 		return NULL;
@@ -2674,11 +2676,34 @@
 		return NULL;
 	}
 
-	len=read(tmp->pipe[0],tmp->ast_rd_buf,sizeof(tmp->ast_rd_buf));
-
-	if (len<=0) {
-		/* we hangup here, since our pipe is closed */
-		chan_misdn_log(2,tmp->bc->port,"misdn_read: Pipe closed, hanging up\n");
+	tv.tv_sec=0;
+	tv.tv_usec=20000;
+
+	FD_ZERO(&rrfs);
+	FD_SET(tmp->pipe[0],&rrfs);
+
+	t=select(FD_SETSIZE,&rrfs,NULL, NULL,&tv);
+
+	if (!t) {
+		chan_misdn_log(3, tmp->bc->port, "read Select Timed out\n");
+		len=160;
+	}
+
+	if (t<0) {
+		chan_misdn_log(-1, tmp->bc->port, "Select Error (err=%s)\n",strerror(errno));
+		return NULL;
+	}
+
+	if (FD_ISSET(tmp->pipe[0],&rrfs)) {
+		len=read(tmp->pipe[0],tmp->ast_rd_buf,sizeof(tmp->ast_rd_buf));
+
+		if (len<=0) {
+			/* we hangup here, since our pipe is closed */
+			chan_misdn_log(2,tmp->bc->port,"misdn_read: Pipe closed, hanging up\n");
+			return NULL;
+		}
+
+	} else {
 		return NULL;
 	}
 
@@ -4468,8 +4493,15 @@
 			}
 		}
 	}
-	
-	/* notice that we don't break here!*/
+	ch->l3id=bc->l3_id;
+	ch->addr=bc->addr;
+
+	start_bc_tones(ch);
+	
+	ch->state = MISDN_CONNECTED;
+	
+	ast_queue_control(ch->ast, AST_CONTROL_ANSWER);
+	break;
 	case EVENT_CONNECT_ACKNOWLEDGE:
 	{
 		ch->l3id=bc->l3_id;
@@ -4478,10 +4510,6 @@
 		start_bc_tones(ch);
 		
 		ch->state = MISDN_CONNECTED;
-		
-		if (!ch->ast) break;
-
-		ast_queue_control(ch->ast, AST_CONTROL_ANSWER);
 	}
 	break;
 	case EVENT_DISCONNECT:
@@ -4541,9 +4569,6 @@
 
 			hangup_chan(ch);
 			release_chan(bc);
-		
-			if (bc->need_release_complete) 
-				misdn_lib_send_event(bc,EVENT_RELEASE_COMPLETE);
 		}
 		break;
 	case EVENT_RELEASE_COMPLETE:

Modified: team/mmichelson/queue_refcount/channels/h323/ast_h323.cxx
URL: http://svn.digium.com/view/asterisk/team/mmichelson/queue_refcount/channels/h323/ast_h323.cxx?view=diff&rev=81409&r1=81408&r2=81409
==============================================================================
--- team/mmichelson/queue_refcount/channels/h323/ast_h323.cxx (original)
+++ team/mmichelson/queue_refcount/channels/h323/ast_h323.cxx Fri Aug 31 11:19:26 2007
@@ -287,7 +287,9 @@
 		cout << "\t-- " << GetLocalUserName() << " is calling host " << fullAddress << endl;
 		cout << "\t-- Call token is " << (const char *)token << endl;
 		cout << "\t-- Call reference is " << *callReference << endl;
+#ifdef PTRACING
 		cout << "\t-- DTMF Payload is " << connection->dtmfCodec << endl;
+#endif
 	}
 	connection->Unlock();
 	return 0;
@@ -1649,10 +1651,12 @@
 				H245_AudioTelephonyEventCapability & atec = cap;
 				atec.m_dynamicRTPPayloadType = dtmfCodec;
 //				on_set_rfc2833_payload(GetCallReference(), (const char *)GetCallToken(), (int)dtmfCodec);
+#ifdef PTRACING
 				if (h323debug) {
 					cout << "\t-- Transmitting RFC2833 on payload " <<
 						atec.m_dynamicRTPPayloadType << endl;
 				}
+#endif
 			}
 		}
 	}
@@ -1712,9 +1716,11 @@
 		on_set_rfc2833_payload(GetCallReference(), (const char *)GetCallToken(), (int)pt);
 		if ((dtmfMode == H323_DTMF_RFC2833) && (sendUserInputMode == SendUserInputAsTone))
 			sendUserInputMode = SendUserInputAsInlineRFC2833;
+#ifdef PTRACING
 		if (h323debug) {
 			cout << "\t-- Inbound RFC2833 on payload " << pt << endl;
 		}
+#endif
 	}
 	memset(&prefs, 0, sizeof(prefs));
 	int peer_capabilities = 0;

Modified: team/mmichelson/queue_refcount/channels/misdn/isdn_lib.c
URL: http://svn.digium.com/view/asterisk/team/mmichelson/queue_refcount/channels/misdn/isdn_lib.c?view=diff&rev=81409&r1=81408&r2=81409
==============================================================================
--- team/mmichelson/queue_refcount/channels/misdn/isdn_lib.c (original)
+++ team/mmichelson/queue_refcount/channels/misdn/isdn_lib.c Fri Aug 31 11:19:26 2007
@@ -1566,9 +1566,6 @@
 		case EVENT_PROGRESS:
 		case EVENT_PROCEEDING:
 		case EVENT_SETUP_ACKNOWLEDGE:
-
-		setup_bc(bc);
-
 		case EVENT_SETUP:
 		{
 			if (bc->channel == 0xff || bc->channel<=0)
@@ -1580,6 +1577,8 @@
 				return -1;
 			}
 		}
+
+		setup_bc(bc);
 		break;
 
 		case EVENT_RELEASE_COMPLETE:

Modified: team/mmichelson/queue_refcount/configs/enum.conf.sample
URL: http://svn.digium.com/view/asterisk/team/mmichelson/queue_refcount/configs/enum.conf.sample?view=diff&rev=81409&r1=81408&r2=81409
==============================================================================
--- team/mmichelson/queue_refcount/configs/enum.conf.sample (original)
+++ team/mmichelson/queue_refcount/configs/enum.conf.sample Fri Aug 31 11:19:26 2007
@@ -2,7 +2,7 @@
 ; ENUM Configuration for resolving phone numbers over DNS
 ;
 ; Sample config for Asterisk
-; This file is reloaded at "reload enum" in the CLI
+; This file is reloaded at "module reload enum" in the CLI
 ;
 [general]
 ;

Modified: team/mmichelson/queue_refcount/configs/extensions.ael.sample
URL: http://svn.digium.com/view/asterisk/team/mmichelson/queue_refcount/configs/extensions.ael.sample?view=diff&rev=81409&r1=81408&r2=81409
==============================================================================
--- team/mmichelson/queue_refcount/configs/extensions.ael.sample (original)
+++ team/mmichelson/queue_refcount/configs/extensions.ael.sample Fri Aug 31 11:19:26 2007
@@ -3,11 +3,11 @@
 //
 //
 // Static extension configuration file, used by
-// the pbx_config module. This is where you configure all your 
+// the pbx_ael module. This is where you configure all your 
 // inbound and outbound calls in Asterisk. 
 // 
 // This configuration file is reloaded 
-// - With the "extensions reload" command in the CLI
+// - With the "ael reload" command in the CLI
 // - With the "reload" command (that reloads everything) in the CLI
 
 // The "Globals" category contains global variables that can be referenced

Modified: team/mmichelson/queue_refcount/main/pbx.c
URL: http://svn.digium.com/view/asterisk/team/mmichelson/queue_refcount/main/pbx.c?view=diff&rev=81409&r1=81408&r2=81409
==============================================================================
--- team/mmichelson/queue_refcount/main/pbx.c (original)
+++ team/mmichelson/queue_refcount/main/pbx.c Fri Aug 31 11:19:26 2007
@@ -5034,10 +5034,13 @@
 			if (ast_exists_extension(chan, context, "failed", 1, NULL)) {
 				chan = ast_channel_alloc(0, AST_STATE_DOWN, 0, 0, "", "", "", 0, "OutgoingSpoolFailed");
 				if (chan) {
+					char failed_reason[4] = "";
 					if (!ast_strlen_zero(context))
 						ast_copy_string(chan->context, context, sizeof(chan->context));
 					set_ext_pri(chan, "failed", 1);
 					ast_set_variables(chan, vars);
+					snprintf(failed_reason, sizeof(failed_reason), "%d", *reason);
+					pbx_builtin_setvar_helper(chan, "REASON", failed_reason);
 					if (account)
 						ast_cdr_setaccount(chan, account);
 					ast_pbx_run(chan);

Modified: team/mmichelson/queue_refcount/res/res_features.c
URL: http://svn.digium.com/view/asterisk/team/mmichelson/queue_refcount/res/res_features.c?view=diff&rev=81409&r1=81408&r2=81409
==============================================================================
--- team/mmichelson/queue_refcount/res/res_features.c (original)
+++ team/mmichelson/queue_refcount/res/res_features.c Fri Aug 31 11:19:26 2007
@@ -1229,6 +1229,13 @@
 							ast_frfree(f);
 							f = NULL;
 							ready=1;
+							break;
+						} else if (f->subclass == -1) {
+							if (option_verbose > 2)
+								ast_verbose( VERBOSE_PREFIX_3 "%s stopped sounds\n", chan->name);
+							ast_indicate(caller, -1);
+							ast_frfree(f);
+							f = NULL;
 							break;
 						} else {
 							ast_log(LOG_NOTICE, "Don't know what to do about control frame: %d\n", f->subclass);




More information about the svn-commits mailing list