[asterisk-commits] branch oej/codecnegotiation r35236 - in /team/oej/codecnegotiation: ./ channe...

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Wed Jun 21 02:17:28 MST 2006


Author: oej
Date: Wed Jun 21 04:17:27 2006
New Revision: 35236

URL: http://svn.digium.com/view/asterisk?rev=35236&view=rev
Log:
Resolve conflict, reset automerge

Modified:
    team/oej/codecnegotiation/   (props changed)
    team/oej/codecnegotiation/channels/chan_sip.c
    team/oej/codecnegotiation/res/res_features.c

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

Propchange: team/oej/codecnegotiation/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Wed Jun 21 04:17:27 2006
@@ -1,1 +1,1 @@
-/trunk:1-35196
+/trunk:1-35234

Modified: team/oej/codecnegotiation/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/team/oej/codecnegotiation/channels/chan_sip.c?rev=35236&r1=35235&r2=35236&view=diff
==============================================================================
--- team/oej/codecnegotiation/channels/chan_sip.c (original)
+++ team/oej/codecnegotiation/channels/chan_sip.c Wed Jun 21 04:17:27 2006
@@ -11970,6 +11970,10 @@
 	copy_request(&req, &d->req);
 	free(d);
 
+	if (!transferee || !transferer) {
+		ast_log(LOG_ERROR, "Missing channels for parking! Transferer %s Transferee %s\n", transferer ? "<available>" : "<missing>", transferee ? "<available>" : "<missing>" );
+		return NULL;
+	}
 	if (option_debug > 3) 
 		ast_log(LOG_DEBUG, "SIP Park: Transferer channel %s, Transferee %s\n", transferer->name, transferee->name);
 
@@ -12091,7 +12095,8 @@
 		d->chan1 = transferee;	/* Transferee */
 		d->chan2 = transferer;	/* Transferer */
 		d->seqno = seqno;
-		if (!ast_pthread_create(&th, NULL, sip_park_thread, d)) {
+		if (ast_pthread_create(&th, NULL, sip_park_thread, d) < 0) {
+			/* Could not start thread */
 			free(d);	/* We don't need it anymore. If thread is created, d will be free'd
 					   by sip_park_thread() */
 			return 0;

Modified: team/oej/codecnegotiation/res/res_features.c
URL: http://svn.digium.com/view/asterisk/team/oej/codecnegotiation/res/res_features.c?rev=35236&r1=35235&r2=35236&view=diff
==============================================================================
--- team/oej/codecnegotiation/res/res_features.c (original)
+++ team/oej/codecnegotiation/res/res_features.c Wed Jun 21 04:17:27 2006
@@ -76,18 +76,18 @@
 
 static char *parkedcall = "ParkedCall";
 
-static int parkingtime = DEFAULT_PARK_TIME; 		/*!< No more than 45 seconds parked before you do something with them */
-static char parking_con[AST_MAX_EXTENSION];		/*!< Context for which parking is made accessible */
-static char parking_con_dial[AST_MAX_EXTENSION];	/*!< Context for dialback for parking (KLUDGE) */
-static char parking_ext[AST_MAX_EXTENSION];		/*!< Extension you type to park the call */
-static char pickup_ext[AST_MAX_EXTENSION];		/*!< Call pickup extension */
-static int parking_start;				/*!< First available extension for parking */
-static int parking_stop;				/*!< Last available extension for parking */
-
-static char courtesytone[256];				/*!< Courtesy tone */
-static int parkedplay = 0;				/*!< Who to play the courtesy tone to */
-static char xfersound[256];				/*!< Call transfer sound */
-static char xferfailsound[256];				/*!< Call transfer failure sound */
+static int parkingtime = DEFAULT_PARK_TIME;                /*!< No more than 45 seconds parked before you do something with them */
+static char parking_con[AST_MAX_EXTENSION];                /*!< Context for which parking is made accessible */
+static char parking_con_dial[AST_MAX_EXTENSION];           /*!< Context for dialback for parking (KLUDGE) */
+static char parking_ext[AST_MAX_EXTENSION];                /*!< Extension you type to park the call */
+static char pickup_ext[AST_MAX_EXTENSION];                 /*!< Call pickup extension */
+static int parking_start;                                  /*!< First available extension for parking */
+static int parking_stop;                                   /*!< Last available extension for parking */
+
+static char courtesytone[256];                             /*!< Courtesy tone */
+static int parkedplay = 0;                                 /*!< Who to play the courtesy tone to */
+static char xfersound[256];                                /*!< Call transfer sound */
+static char xferfailsound[256];                            /*!< Call transfer failure sound */
 
 static int parking_offset;
 static int parkfindnext;
@@ -99,7 +99,7 @@
 
 static int atxfernoanswertimeout;
 
-static char *registrar = "res_features";		/*!< Registrar for operations */
+static char *registrar = "res_features";		   /*!< Registrar for operations */
 
 /* module and CLI command definitions */
 static char *synopsis = "Answer a parked call";
@@ -125,14 +125,13 @@
 static int monitor_ok = 1;
 
 struct parkeduser {
-	struct ast_channel *chan;
-	struct timeval start;
-	int parkingnum;
-	/* Where to go if our parking time expires */
-	char context[AST_MAX_CONTEXT];
+	struct ast_channel *chan;                   /*!< Parking channel */
+	struct timeval start;                       /*!< Time the parking started */
+	int parkingnum;                             /*!< Parking lot */
+	char context[AST_MAX_CONTEXT];              /*!< Where to go if our parking time expires */
 	char exten[AST_MAX_EXTENSION];
 	int priority;
-	int parkingtime;
+	int parkingtime;                            /*!< Maximum length in parking lot before return */
 	int notquiteyet;
 	char peername[1024];
 	unsigned char moh_trys;
@@ -265,7 +264,7 @@
 }
 
 /*! \brief Park a call 
- 	We put the user in the parking list, then wake up the parking thread to be sure it looks
+ 	\note We put the user in the parking list, then wake up the parking thread to be sure it looks
 	after these channels too */
 int ast_park_call(struct ast_channel *chan, struct ast_channel *peer, int timeout, int *extout)
 {
@@ -274,9 +273,9 @@
 	char exten[AST_MAX_EXTENSION];
 	struct ast_context *con;
 	
-	if (!(pu = ast_calloc(1, sizeof(*pu)))) {
+	if (!(pu = ast_calloc(1, sizeof(*pu)))) 
 		return -1;
-	}
+
 	ast_mutex_lock(&parking_lock);
 	parking_range = parking_stop - parking_start+1;
 	for (i = 0; i < parking_range; i++) {
@@ -305,7 +304,7 @@
 	pu->chan = chan;
 	/* Start music on hold */
 	if (chan != peer) {
-		ast_indicate(pu->chan, AST_CONTROL_HOLD);
+		ast_indicate(pu->chan, AST_CONTROL_HOLD);	/* Indicate to peer that we're on hold */
 		ast_moh_start(pu->chan, NULL);
 	}
 	pu->start = ast_tvnow();
@@ -345,22 +344,21 @@
 		S_OR(pu->chan->cid.cid_name, "<unknown>")
 		);
 
-	if (peer) {
-		if (adsipark && adsi_available(peer))
-			adsi_announce_park(peer, pu->parkingnum);
-		if (adsipark && adsi_available(peer))
-			adsi_unload_session(peer);
-	}
+	if (peer && adsipark && adsi_available(peer)) {
+		adsi_announce_park(peer, pu->parkingnum);
+		adsi_unload_session(peer);
+	}
+
 	con = ast_context_find(parking_con);
-	if (!con) {
+	if (!con) 
 		con = ast_context_create(NULL, parking_con, registrar);
-		if (!con)
-			ast_log(LOG_ERROR, "Parking context '%s' does not exist and unable to create\n", parking_con);
-	}
-	if (con) {
+	if (!con)	/* Still no context? Bad */
+		ast_log(LOG_ERROR, "Parking context '%s' does not exist and unable to create\n", parking_con);
+	else {		/* Add extension to context */
 		snprintf(exten, sizeof(exten), "%d", x);
 		ast_add_extension2(con, 1, exten, 1, NULL, NULL, parkedcall, strdup(exten), FREE, registrar);
 	}
+	/* Tell the peer channel the number of the parking space */
 	if (peer) 
 		ast_say_digits(peer, pu->parkingnum, "", peer->language);
 	if (pu->notquiteyet) {
@@ -378,27 +376,27 @@
 	struct ast_frame *f;
 
 	/* Make a new, fake channel that we'll use to masquerade in the real one */
-	if ((chan = ast_channel_alloc(0))) {
-		/* Let us keep track of the channel name */
-		ast_string_field_build(chan, name, "Parked/%s",rchan->name);
-
-		/* Make formats okay */
-		chan->readformat = ast_get_read_format(rchan);
-		chan->writeformat = ast_get_write_format(rchan);
-		ast_channel_masquerade(chan, rchan);
-
-		/* Setup the extensions and such */
-		set_c_e_p(chan, rchan->context, rchan->exten, rchan->priority);
-
-		/* Make the masq execute */
-		f = ast_read(chan);
-		if (f)
-			ast_frfree(f);
-		ast_park_call(chan, peer, timeout, extout);
-	} else {
+	if (!(chan = ast_channel_alloc(0))) {
 		ast_log(LOG_WARNING, "Unable to create parked channel\n");
 		return -1;
 	}
+	/* Let us keep track of the channel name */
+	ast_string_field_build(chan, name, "Parked/%s",rchan->name);
+
+	/* Make formats okay */
+	chan->readformat = ast_get_read_format(rchan);
+	chan->writeformat = ast_get_write_format(rchan);
+	ast_channel_masquerade(chan, rchan);
+
+	/* Setup the extensions and such */
+	set_c_e_p(chan, rchan->context, rchan->exten, rchan->priority);
+
+	/* Make the masq execute */
+	f = ast_read(chan);
+	if (f)
+		ast_frfree(f);
+
+	ast_park_call(chan, peer, timeout, extout);
 	return 0;
 }
 



More information about the asterisk-commits mailing list