[svn-commits] branch oej/multiparking r31639 - in /team/oej/multiparking: ./ channels/ chan...

svn-commits at lists.digium.com svn-commits at lists.digium.com
Thu Jun 1 23:33:35 MST 2006


Author: oej
Date: Fri Jun  2 01:33:34 2006
New Revision: 31639

URL: http://svn.digium.com/view/asterisk?rev=31639&view=rev
Log:
Reset automerge

Modified:
    team/oej/multiparking/   (props changed)
    team/oej/multiparking/CREDITS
    team/oej/multiparking/channels/chan_misdn.c
    team/oej/multiparking/channels/chan_sip.c
    team/oej/multiparking/channels/chan_zap.c
    team/oej/multiparking/channels/misdn/chan_misdn_config.h
    team/oej/multiparking/channels/misdn/isdn_lib.c
    team/oej/multiparking/channels/misdn/isdn_lib.h
    team/oej/multiparking/channels/misdn_config.c
    team/oej/multiparking/configs/features.conf.sample
    team/oej/multiparking/res/res_features.c
    team/oej/multiparking/res/res_jabber.c

Propchange: team/oej/multiparking/
------------------------------------------------------------------------------
    automerge = http://edvina.net/training/

Propchange: team/oej/multiparking/
------------------------------------------------------------------------------
Binary property 'branch-1.2-merged' - no diff available.

Propchange: team/oej/multiparking/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Fri Jun  2 01:33:34 2006
@@ -1,1 +1,1 @@
-/trunk:1-29748
+/trunk:1-29848

Modified: team/oej/multiparking/CREDITS
URL: http://svn.digium.com/view/asterisk/team/oej/multiparking/CREDITS?rev=31639&r1=31638&r2=31639&view=diff
==============================================================================
--- team/oej/multiparking/CREDITS (original)
+++ team/oej/multiparking/CREDITS Fri Jun  2 01:33:34 2006
@@ -79,6 +79,8 @@
 Steve Murphy - privacy support, $[ ] parser upgrade, AEL2 parser upgrade
 Claude Patry - bug fixes, feature enhancements, and bug marshalling
 	cpatry at gmail.com
+Miroslav Nachev, miro at space-comm.com COSMOS Software Enterprises, Ltd.
+	- for Variable for No Answer Timeout for Attended Transfer
 
 === OTHER CONTRIBUTIONS ===
 John Todd - Monkey sounds and associated teletorture prompt

Modified: team/oej/multiparking/channels/chan_misdn.c
URL: http://svn.digium.com/view/asterisk/team/oej/multiparking/channels/chan_misdn.c?rev=31639&r1=31638&r2=31639&view=diff
==============================================================================
--- team/oej/multiparking/channels/chan_misdn.c (original)
+++ team/oej/multiparking/channels/chan_misdn.c Fri Jun  2 01:33:34 2006
@@ -656,39 +656,6 @@
 		misdn_debug[i] = cfg_debug;
 		misdn_debug_only[i] = 0;
 	}
-
-#ifdef M_TIMER
-	if (misdn_sched) 
-		sched_context_destroy(misdn_sched);
-	
-	misdn_sched=sched_context_create();
-
-	if (!misdn_sched) {
-		ast_log(LOG_ERROR,"Couldn't create scheduler\n");
-		return -1;
-	}
-
-	/* Loop through all ports and find out which one should be 
-	 * watched regarding the l1 */
-	int port; 
-	int dotimer=0;
-	for (	port=misdn_cfg_get_next_port(0);
-		port>0;
-		port=misdn_cfg_get_next_port(port)) {
-		int l1timer;
-		misdn_cfg_get( port, MISDN_CFG_L1_TIMER, &l1timer, sizeof(l1timer));
-		if (l1timer>0) {
-			ast_sched_add(misdn_sched, l1timer*1000, l1_timer_cb, &port);
-			dotimer=1;
-;		}
-	}
-
-	if (dotimer) {
-		/*start timer thread*/
-		pthread_create( &misdn_timer, NULL, (void*)misdn_timerd, NULL);
-	}
-#endif
-
 }
 
 static int misdn_reload (int fd, int argc, char *argv[])
@@ -3817,21 +3784,6 @@
 
 /** TE STUFF END **/
 
-#ifdef M_TIMER
-/* timer thread */
-pthread_t misdn_timer;
-struct sched_context *misdn_sched;
-
-void misdn_timerd(void *arg)
-{
-
-	
-}
-
-
-/* timer thread end */
-#endif
-
 /******************************************
  *
  *   Asterisk Channel Endpoint END
@@ -3933,7 +3885,11 @@
 
 	misdn_cfg_update_ptp();
 	misdn_cfg_get_ports_string(ports);
-		
+
+
+	int l1watcher_timeout=0;
+	misdn_cfg_get( 0, MISDN_GEN_L1_TIMEOUT, &l1watcher_timeout, sizeof(int));
+	
 	if (strlen(ports))
 		chan_misdn_log(0, 0, "Got: %s from get_ports\n",ports);
 	
@@ -3942,7 +3898,9 @@
 			.cb_event = cb_events,
 			.cb_log = chan_misdn_log,
 			.cb_jb_empty = chan_misdn_jb_empty,
+			.l1watcher_timeout=l1watcher_timeout,
 		};
+		
 		if (misdn_lib_init(ports, &iface, NULL))
 			chan_misdn_log(0, 0, "No te ports initialized\n");
 	}

Modified: team/oej/multiparking/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/team/oej/multiparking/channels/chan_sip.c?rev=31639&r1=31638&r2=31639&view=diff
==============================================================================
--- team/oej/multiparking/channels/chan_sip.c (original)
+++ team/oej/multiparking/channels/chan_sip.c Fri Jun  2 01:33:34 2006
@@ -12112,7 +12112,7 @@
 	int nounlock;
 	int recount = 0;
 	char iabuf[INET_ADDRSTRLEN];
-	int lockretrycount = 0;
+	unsigned int lockretry = 100;
 
 	len = sizeof(sin);
 	memset(&req, 0, sizeof(req));
@@ -12169,13 +12169,12 @@
 				ast_log(LOG_DEBUG, "Failed to grab lock, trying again...\n");
 			ast_mutex_unlock(&p->lock);
 			ast_mutex_unlock(&netlock);
-			/* Sleep infintismly short amount of time */
+			/* Sleep for a very short amount of time */
 			usleep(1);
-			lockretrycount++;
-			if (lockretrycount < 100)
+			if (--lockretry)
 				goto retrylock;
 		}
-		if (lockretrycount > 100) {
+		if (!lockretry) {
 			ast_log(LOG_ERROR, "We could NOT get the channel lock for %s! \n", p->owner->name);
 			ast_log(LOG_ERROR, "SIP MESSAGE JUST IGNORED: %s \n", req.data);
 			ast_log(LOG_ERROR, "BAD! BAD! BAD!\n");

Modified: team/oej/multiparking/channels/chan_zap.c
URL: http://svn.digium.com/view/asterisk/team/oej/multiparking/channels/chan_zap.c?rev=31639&r1=31638&r2=31639&view=diff
==============================================================================
--- team/oej/multiparking/channels/chan_zap.c (original)
+++ team/oej/multiparking/channels/chan_zap.c Fri Jun  2 01:33:34 2006
@@ -10492,7 +10492,7 @@
 				y = atoi(v->value);
 			} else
 				y = 0;
-			if ((y == 32) || (y == 64) || (y == 128) || (y == 256))
+			if ((y == 32) || (y == 64) || (y == 128) || (y == 256) || (y == 512) || (y == 1024))
 				echocancel = y;
 			else {
 				echocancel = ast_true(v->value);

Modified: team/oej/multiparking/channels/misdn/chan_misdn_config.h
URL: http://svn.digium.com/view/asterisk/team/oej/multiparking/channels/misdn/chan_misdn_config.h?rev=31639&r1=31638&r2=31639&view=diff
==============================================================================
--- team/oej/multiparking/channels/misdn/chan_misdn_config.h (original)
+++ team/oej/multiparking/channels/misdn/chan_misdn_config.h Fri Jun  2 01:33:34 2006
@@ -57,7 +57,6 @@
 	MISDN_CFG_PICKUPGROUP,         /* ast_group_t */
 	MISDN_CFG_MAX_IN,              /* int */
 	MISDN_CFG_MAX_OUT,              /* int */
-	MISDN_CFG_L1_POLL,              /* int */
 	MISDN_CFG_MSNS,                /* char[] */
 	MISDN_CFG_PTP,                 /* int (bool) */
 	MISDN_CFG_LAST,
@@ -73,6 +72,7 @@
 	MISDN_GEN_DYNAMIC_CRYPT,       /* int (bool) */
 	MISDN_GEN_CRYPT_PREFIX,        /* char[] */
 	MISDN_GEN_CRYPT_KEYS,          /* char[] */
+	MISDN_GEN_L1_TIMEOUT,          /* int */
 	MISDN_GEN_LAST
 };
 

Modified: team/oej/multiparking/channels/misdn/isdn_lib.c
URL: http://svn.digium.com/view/asterisk/team/oej/multiparking/channels/misdn/isdn_lib.c?rev=31639&r1=31638&r2=31639&view=diff
==============================================================================
--- team/oej/multiparking/channels/misdn/isdn_lib.c (original)
+++ team/oej/multiparking/channels/misdn/isdn_lib.c Fri Jun  2 01:33:34 2006
@@ -93,9 +93,12 @@
 	int midev;
 	int midev_nt;
 
+	pthread_t l1watcher_thread;
 	pthread_t event_thread;
 	pthread_t event_handler_thread;
-  
+
+	int l1watcher_timeout;
+	
 	void *user_data;
 
 	msg_queue_t upqueue;
@@ -145,6 +148,7 @@
 unsigned char tone_425_flip[TONE_425_SIZE];
 unsigned char tone_silence_flip[TONE_SILENCE_SIZE];
 
+static void misdn_lib_isdn_l1watcher(void *arg);
 static void misdn_lib_isdn_event_catcher(void *arg);
 static int handle_event_nt(void *dat, void *arg);
 
@@ -2508,20 +2512,12 @@
 			break;
 		case SSTATUS_L1_DEACTIVATED:
 			cb_log(1, 0, "MGMT: SSTATUS: L1_DEACTIVATED \n");
-
-			/*reopen L1 if down*/
-			if (stack->l1link==2)
-				stack->l1link--;
-			else			
-				stack->l1link=0;
-			
+			stack->l1link=0;
 			break;
 
 		case SSTATUS_L2_ESTABLISHED:
 			cb_log(1, stack->port, "MGMT: SSTATUS: L2_ESTABLISH \n");
 			stack->l2link=1;
-			if ( !stack->ptp && !stack->nt )
-				stack->l1link=2;
 			break;
 			
 		case SSTATUS_L2_RELEASED:
@@ -2603,6 +2599,33 @@
 	return NULL;
 }
 
+static void misdn_lib_isdn_l1watcher(void *arg)
+{
+	struct misdn_lib *mgr = arg;
+	struct misdn_stack *stack;
+
+	while (1) {
+		sleep(mgr->l1watcher_timeout);
+		
+		/* look out for l1 which are down
+		   and try to pull the up.
+
+		   We might even try to pull the l2 up in the
+		   ptp case.
+		*/
+		for (stack = mgr->stack_list;
+		     stack;
+		     stack = stack->next) {
+			cb_log(4,stack->port,"Checking L1 State\n");	
+			if (!stack->l1link) {
+				cb_log(4,stack->port,"L1 State Down, trying to get it up again\n");	
+				misdn_lib_get_short_status(stack);
+				misdn_lib_get_l1_up(stack); 
+				misdn_lib_get_l2_up(stack); 
+			}
+		}
+	}
+}
 
 static void misdn_lib_isdn_event_catcher(void *arg)
 {
@@ -3447,7 +3470,13 @@
 	pthread_create( &mgr->event_thread, NULL, (void*)misdn_lib_isdn_event_catcher, mgr);
   
 	cb_log(4, 0, "Event Catcher started\n");
-  
+
+	if (iface->l1watcher_timeout > 0) {
+		mgr->l1watcher_timeout=iface->l1watcher_timeout;
+		cb_log(4, 0, "Starting L1 watcher\n");
+		pthread_create( &mgr->l1watcher_thread, NULL, (void*)misdn_lib_isdn_l1watcher, mgr);
+	}
+	
 	global_state= MISDN_INITIALIZED; 
   
 	return (mgr == NULL);

Modified: team/oej/multiparking/channels/misdn/isdn_lib.h
URL: http://svn.digium.com/view/asterisk/team/oej/multiparking/channels/misdn/isdn_lib.h?rev=31639&r1=31638&r2=31639&view=diff
==============================================================================
--- team/oej/multiparking/channels/misdn/isdn_lib.h (original)
+++ team/oej/multiparking/channels/misdn/isdn_lib.h Fri Jun  2 01:33:34 2006
@@ -321,6 +321,8 @@
 	enum event_response_e (*cb_event)(enum event_e event, struct misdn_bchannel *bc, void *user_data);
 	void (*cb_log)(int level, int port, char *tmpl, ...);
 	int (*cb_jb_empty)(struct misdn_bchannel *bc, char *buffer, int len);
+	
+	int l1watcher_timeout;
 };
 
 /***** USER IFACE **********/

Modified: team/oej/multiparking/channels/misdn_config.c
URL: http://svn.digium.com/view/asterisk/team/oej/multiparking/channels/misdn_config.c?rev=31639&r1=31638&r2=31639&view=diff
==============================================================================
--- team/oej/multiparking/channels/misdn_config.c (original)
+++ team/oej/multiparking/channels/misdn_config.c Fri Jun  2 01:33:34 2006
@@ -118,7 +118,6 @@
 	{ "pickupgroup", MISDN_CFG_PICKUPGROUP, MISDN_CTYPE_ASTGROUP, NO_DEFAULT, NONE },
 	{ "max_incoming", MISDN_CFG_MAX_IN, MISDN_CTYPE_INT, "-1", NONE },
 	{ "max_outgoing", MISDN_CFG_MAX_OUT, MISDN_CTYPE_INT, "-1", NONE },
-	{ "l1_poll_timer", MISDN_CFG_L1_POLL, MISDN_CTYPE_INT, "-1", NONE },
 	{ "msns", MISDN_CFG_MSNS, MISDN_CTYPE_MSNLIST, NO_DEFAULT, NONE }
 };
 
@@ -131,7 +130,9 @@
 	{ "append_digits2exten", MISDN_GEN_APPEND_DIGITS2EXTEN, MISDN_CTYPE_BOOL, "yes", NONE },
 	{ "dynamic_crypt", MISDN_GEN_DYNAMIC_CRYPT, MISDN_CTYPE_BOOL, "no", NONE },
 	{ "crypt_prefix", MISDN_GEN_CRYPT_PREFIX, MISDN_CTYPE_STR, NO_DEFAULT, NONE },
-	{ "crypt_keys", MISDN_GEN_CRYPT_KEYS, MISDN_CTYPE_STR, NO_DEFAULT, NONE }
+	{ "crypt_keys", MISDN_GEN_CRYPT_KEYS, MISDN_CTYPE_STR, NO_DEFAULT, NONE },
+	{ "l1watcher_timeout", MISDN_GEN_L1_TIMEOUT, MISDN_CTYPE_INT, "0", NONE }
+	
 };
 
 /* array of port configs, default is at position 0. */

Modified: team/oej/multiparking/configs/features.conf.sample
URL: http://svn.digium.com/view/asterisk/team/oej/multiparking/configs/features.conf.sample?rev=31639&r1=31638&r2=31639&view=diff
==============================================================================
--- team/oej/multiparking/configs/features.conf.sample (original)
+++ team/oej/multiparking/configs/features.conf.sample Fri Jun  2 01:33:34 2006
@@ -27,6 +27,7 @@
 ;pickupexten = *8		; Configure the pickup extension. (default is *8)
 ;featuredigittimeout = 500	; Max time (ms) between digits for 
 				; feature activation  (default is 500 ms)
+;atxfernoanswertimeout = 15	; Timeout for answer on attended transfer default is 15 seconds.
 
 
 [featuremap]

Modified: team/oej/multiparking/res/res_features.c
URL: http://svn.digium.com/view/asterisk/team/oej/multiparking/res/res_features.c?rev=31639&r1=31638&r2=31639&view=diff
==============================================================================
--- team/oej/multiparking/res/res_features.c (original)
+++ team/oej/multiparking/res/res_features.c Fri Jun  2 01:33:34 2006
@@ -71,6 +71,7 @@
 #define DEFAULT_TRANSFER_DIGIT_TIMEOUT 3000		
 #define DEFAULT_FEATURE_DIGIT_TIMEOUT 500
 #define DEFAULT_PARKINGLOT "default"			/*!< Default parking lot */
+#define DEFAULT_NOANSWER_TIMEOUT_ATTENDED_TRANSFER 15000
 
 #define AST_MAX_WATCHERS 256
 
@@ -111,6 +112,8 @@
 
 static int transferdigittimeout = DEFAULT_TRANSFER_DIGIT_TIMEOUT;
 static int featuredigittimeout = DEFAULT_FEATURE_DIGIT_TIMEOUT;
+
+static int atxfernoanswertimeout;
 
 static char *registrar = "res_features";		/*!< Registrar for operations */
 
@@ -790,7 +793,7 @@
 	l = strlen(xferto);
 	snprintf(xferto + l, sizeof(xferto) - l, "@%s/n", transferer_real_context);	/* append context */
 	newchan = ast_feature_request_and_dial(transferer, "Local", ast_best_codec(transferer->nativeformats),
-		xferto, 15000, &outstate, transferer->cid.cid_num, transferer->cid.cid_name);
+		xferto, atxfernoanswertimeout, &outstate, transferer->cid.cid_num, transferer->cid.cid_name);
 	ast_indicate(transferer, -1);
 	if (!newchan) {
 		finishup(transferee);
@@ -2275,6 +2278,10 @@
 	courtesytone[0] = '\0';	/* No default setting */
 	adsipark = 0;
 
+	transferdigittimeout = DEFAULT_TRANSFER_DIGIT_TIMEOUT;
+	featuredigittimeout = DEFAULT_FEATURE_DIGIT_TIMEOUT;
+	atxfernoanswertimeout = DEFAULT_NOANSWER_TIMEOUT_ATTENDED_TRANSFER;
+
 	cfg = ast_config_load("features.conf");
 	if (cfg) {
 		for (var = ast_variable_browse(cfg, "general"); var; var = var->next) {
@@ -2312,6 +2319,12 @@
 					ast_log(LOG_WARNING, "%s is not a valid featuredigittimeout\n", var->value);
 					featuredigittimeout = DEFAULT_FEATURE_DIGIT_TIMEOUT;
 				}
+			} else if (!strcasecmp(var->name, "atxfernoanswertimeout")) {
+				if ((sscanf(var->value, "%d", &atxfernoanswertimeout) != 1) || (atxfernoanswertimeout < 1)) {
+					ast_log(LOG_WARNING, "%s is not a valid atxfernoanswertimeout\n", var->value);
+					atxfernoanswertimeout = DEFAULT_NOANSWER_TIMEOUT_ATTENDED_TRANSFER;
+				} else
+					atxfernoanswertimeout = atxfernoanswertimeout * 1000;
 			} else if (!strcasecmp(var->name, "courtesytone")) {
 				ast_copy_string(courtesytone, var->value, sizeof(courtesytone));
 			}  else if (!strcasecmp(var->name, "parkedplay")) {

Modified: team/oej/multiparking/res/res_jabber.c
URL: http://svn.digium.com/view/asterisk/team/oej/multiparking/res/res_jabber.c?rev=31639&r1=31638&r2=31639&view=diff
==============================================================================
--- team/oej/multiparking/res/res_jabber.c (original)
+++ team/oej/multiparking/res/res_jabber.c Fri Jun  2 01:33:34 2006
@@ -435,7 +435,6 @@
 	iks *auth = NULL;
 
 	pak = iks_packet(node);
-
 
 	if (client->component == AJI_CLIENT) {
 		switch (type) {
@@ -1330,30 +1329,28 @@
 static void *aji_recv_loop(void *data)
 {
 	struct aji_client *client = ASTOBJ_REF((struct aji_client *) data);
-	int res = 0;
-	while (res == IKS_OK) {
+	int res = IKS_HOOK;
+	do {
+		if (res != IKS_OK) {
+			while(res != IKS_OK) {
+				if(option_verbose > 3) ast_verbose("JABBER: reconnecting.\n");
+				res = aji_reconnect(client);
+				sleep(4);
+			}
+		}
 		res = iks_recv(client->p, 1);
 		client->timeout--;
 		if (res == IKS_HOOK) {
 			ast_log(LOG_WARNING, "JABBER: Got hook event.\n");
-			break;
 		} else if (res == IKS_NET_TLSFAIL) {
-			ast_log(LOG_ERROR, "JABBER:  Failure in tls.\n");
-			break;
+			ast_log(LOG_WARNING, "JABBER:  Failure in tls.\n");
 		} else if (client->timeout == 0 && client->state != AJI_CONNECTED) {
 			res = -1;
 			ast_log(LOG_WARNING, "JABBER:  Network Timeout\n");
 		} else if (res == IKS_NET_RWERR) {
-			ast_log(LOG_ERROR, "JABBER: socket read error\n");
-		}
-
-		if (res != IKS_OK) {
-			if(option_verbose > 3) ast_verbose("JABBER: reconnecting %d\n", res);
-			aji_reconnect(client);
-			res = IKS_OK;
-		}
-
-	}
+			ast_log(LOG_WARNING, "JABBER: socket read error\n");
+		}
+	} while (client);
 	ASTOBJ_UNREF(client, aji_client_destroy);
 	return 0;
 }
@@ -1688,14 +1685,13 @@
 
 	if (connected == IKS_NET_NOCONN) {
 		ast_log(LOG_ERROR, "JABBER ERROR: No Connection\n");
-		return 0;
-	}
-	if (connected == IKS_NET_NODNS) {
+		return IKS_HOOK;
+	} else 	if (connected == IKS_NET_NODNS) {
 		ast_log(LOG_ERROR, "JABBER ERROR: No DNS\n");
-		return 0;
+		return IKS_HOOK;
 	} else
 		iks_recv(client->p, 30);
-	return 1;
+	return IKS_OK;
 }
 
 /*!
@@ -1865,9 +1861,6 @@
 	ASTOBJ_CONTAINER_TRAVERSE(&client->buddies, 1, {
 		ASTOBJ_RDLOCK(iterator);
 		ast_verbose("User: %s\n", iterator->name);
-		ast_verbose("User: %s\n", iterator->user);
-		ast_verbose("Pass: %s\n", iterator->pass);
-		ast_verbose("Host: %s\n", iterator->host);
 		for (resource = iterator->resources; resource; resource = resource->next) {
 			ast_verbose("Resource: %s\n", resource->resource);
 			if(resource->cap) {
@@ -2164,8 +2157,7 @@
 		ASTOBJ_CONTAINER_TRAVERSE(&clients, 1, {
 			ASTOBJ_RDLOCK(iterator);
 			if(iterator->state == AJI_DISCONNECTED) {
-				res = aji_reconnect(iterator);
-				if (res != -1 && !iterator->thread)
+				if (!iterator->thread)
 					ast_pthread_create(&iterator->thread, NULL, aji_recv_loop, iterator);
 			} else if (iterator->state == AJI_CONNECTED) {
 				aji_get_roster(iterator);



More information about the svn-commits mailing list