[asterisk-commits] russell: branch russell/autoservice_1.4 r89642 - in /team/russell/autoservice...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Nov 27 11:22:20 CST 2007


Author: russell
Date: Tue Nov 27 11:22:19 2007
New Revision: 89642

URL: http://svn.digium.com/view/asterisk?view=rev&rev=89642
Log:
sync with 1.4 branch

Modified:
    team/russell/autoservice_1.4/   (props changed)
    team/russell/autoservice_1.4/apps/app_dial.c
    team/russell/autoservice_1.4/apps/app_mixmonitor.c
    team/russell/autoservice_1.4/apps/app_playback.c
    team/russell/autoservice_1.4/channels/chan_sip.c
    team/russell/autoservice_1.4/configs/cdr.conf.sample
    team/russell/autoservice_1.4/configs/sip.conf.sample
    team/russell/autoservice_1.4/configs/voicemail.conf.sample
    team/russell/autoservice_1.4/funcs/func_env.c
    team/russell/autoservice_1.4/include/asterisk/cdr.h
    team/russell/autoservice_1.4/include/asterisk/rtp.h
    team/russell/autoservice_1.4/main/app.c
    team/russell/autoservice_1.4/main/cdr.c
    team/russell/autoservice_1.4/main/dial.c
    team/russell/autoservice_1.4/main/pbx.c
    team/russell/autoservice_1.4/main/rtp.c
    team/russell/autoservice_1.4/pbx/pbx_config.c
    team/russell/autoservice_1.4/res/res_features.c

Propchange: team/russell/autoservice_1.4/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Tue Nov 27 11:22:19 2007
@@ -1,1 +1,1 @@
-/branches/1.4:1-89583
+/branches/1.4:1-89639

Modified: team/russell/autoservice_1.4/apps/app_dial.c
URL: http://svn.digium.com/view/asterisk/team/russell/autoservice_1.4/apps/app_dial.c?view=diff&rev=89642&r1=89641&r2=89642
==============================================================================
--- team/russell/autoservice_1.4/apps/app_dial.c (original)
+++ team/russell/autoservice_1.4/apps/app_dial.c Tue Nov 27 11:22:19 2007
@@ -57,6 +57,7 @@
 #include "asterisk/app.h"
 #include "asterisk/causes.h"
 #include "asterisk/rtp.h"
+#include "asterisk/cdr.h"
 #include "asterisk/manager.h"
 #include "asterisk/privacy.h"
 #include "asterisk/stringfields.h"
@@ -762,7 +763,26 @@
 		}
 		
 	}
-
+	if (peer && !ast_cdr_log_unanswered()) {
+		/* suppress the CDR's that didn't win */
+		struct dial_localuser *o;
+		for (o = outgoing; o; o = o->next) {
+			struct ast_channel *c = o->chan;
+			if (c && c != peer && c->cdr) {
+				ast_set_flag(c->cdr, AST_CDR_FLAG_POST_DISABLED);
+			}
+		}
+	} else if (!peer && !ast_cdr_log_unanswered()) {
+			/* suppress the CDR's that didn't win */
+		struct dial_localuser *o;
+		for (o = outgoing; o; o = o->next) {
+			struct ast_channel *c = o->chan;
+			if (c && c->cdr) {
+				ast_set_flag(c->cdr, AST_CDR_FLAG_POST_DISABLED);		
+			}
+		}
+	}
+	
 	return peer;
 }
 

Modified: team/russell/autoservice_1.4/apps/app_mixmonitor.c
URL: http://svn.digium.com/view/asterisk/team/russell/autoservice_1.4/apps/app_mixmonitor.c?view=diff&rev=89642&r1=89641&r2=89642
==============================================================================
--- team/russell/autoservice_1.4/apps/app_mixmonitor.c (original)
+++ team/russell/autoservice_1.4/apps/app_mixmonitor.c Tue Nov 27 11:22:19 2007
@@ -211,14 +211,14 @@
 	if (option_verbose > 1)
 		ast_verbose(VERBOSE_PREFIX_2 "End MixMonitor Recording %s\n", mixmonitor->name);
 
+	if (fs)
+		ast_closestream(fs);
+
 	if (mixmonitor->post_process) {
 		if (option_verbose > 2)
 			ast_verbose(VERBOSE_PREFIX_2 "Executing [%s]\n", mixmonitor->post_process);
 		ast_safe_system(mixmonitor->post_process);
 	}
-		
-	if (fs)
-		ast_closestream(fs);
 
 	free(mixmonitor);
 

Modified: team/russell/autoservice_1.4/apps/app_playback.c
URL: http://svn.digium.com/view/asterisk/team/russell/autoservice_1.4/apps/app_playback.c?view=diff&rev=89642&r1=89641&r2=89642
==============================================================================
--- team/russell/autoservice_1.4/apps/app_playback.c (original)
+++ team/russell/autoservice_1.4/apps/app_playback.c Tue Nov 27 11:22:19 2007
@@ -152,7 +152,6 @@
 	struct varshead head = { .first = NULL, .last = NULL };
 	struct ast_var_t *n;
 
-	ast_log(LOG_WARNING, "string <%s> depth <%d>\n", s, depth);
 	if (depth++ > 10) {
 		ast_log(LOG_WARNING, "recursion too deep, exiting\n");
 		return -1;
@@ -164,7 +163,6 @@
 	/* scan languages same as in file.c */
 	if (a->language == NULL)
 		a->language = "en";     /* default */
-	ast_log(LOG_WARNING, "try <%s> in <%s>\n", s, a->language);
 	lang = ast_strdupa(a->language);
 	for (;;) {
 		for (v = ast_variable_browse(say_cfg, lang); v ; v = v->next) {
@@ -190,12 +188,11 @@
 		s = x + 1;
 	if ( (x = strchr(s, ':')) )
 		s = x + 1;
-	ast_log(LOG_WARNING, "value is <%s>\n", s);
 	n = ast_var_assign("SAY", s);
 	AST_LIST_INSERT_HEAD(&head, n, entries);
 
 	/* scan the body, one piece at a time */
-	while ( ret <= 0 && (x = strsep(&rule, ",")) ) { /* exit on key */
+	while ( !ret && (x = strsep(&rule, ",")) ) { /* exit on key */
 		char fn[128];
 		const char *p, *fmt, *data; /* format and data pointers */
 
@@ -206,7 +203,6 @@
 		/* replace variables */
 		memset(fn, 0, sizeof(fn)); /* XXX why isn't done in pbx_substitute_variables_helper! */
 		pbx_substitute_variables_varshead(&head, x, fn, sizeof(fn));
-		ast_log(LOG_WARNING, "doing [%s]\n", fn);
 
 		/* locate prefix and data, if any */
 		fmt = index(fn, ':');
@@ -245,6 +241,10 @@
 				strcpy(fn2 + l, data);
 				ret = do_say(a, fn2, options, depth);
 			}
+			
+			if (ret) {
+				break;
+			}
 		}
 	}
 	ast_var_delete(n);

Modified: team/russell/autoservice_1.4/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/team/russell/autoservice_1.4/channels/chan_sip.c?view=diff&rev=89642&r1=89641&r2=89642
==============================================================================
--- team/russell/autoservice_1.4/channels/chan_sip.c (original)
+++ team/russell/autoservice_1.4/channels/chan_sip.c Tue Nov 27 11:22:19 2007
@@ -5203,16 +5203,37 @@
 			continue;
 		} else if (sscanf(a, "rtpmap: %u %[^/]/", &codec, mimeSubtype) == 2) {
 			/* We have a rtpmap to handle */
-			if (debug)
-				ast_verbose("Found description format %s for ID %d\n", mimeSubtype, codec);
-			found_rtpmap_codecs[last_rtpmap_codec] = codec;
-			last_rtpmap_codec++;
+			int found = FALSE;
+			/* We should propably check if this is an audio or video codec
+				so we know where to look */
 
 			/* Note: should really look at the 'freq' and '#chans' params too */
-			ast_rtp_set_rtpmap_type(newaudiortp, codec, "audio", mimeSubtype,
-					ast_test_flag(&p->flags[0], SIP_G726_NONSTANDARD) ? AST_RTP_OPT_G726_NONSTANDARD : 0);
-			if (p->vrtp)
-				ast_rtp_set_rtpmap_type(newvideortp, codec, "video", mimeSubtype, 0);
+			if(ast_rtp_set_rtpmap_type(newaudiortp, codec, "audio", mimeSubtype,
+					ast_test_flag(&p->flags[0], SIP_G726_NONSTANDARD) ? AST_RTP_OPT_G726_NONSTANDARD : 0) != -1) {
+				if (debug)
+					ast_verbose("Found audio description format %s for ID %d\n", mimeSubtype, codec);
+				found_rtpmap_codecs[last_rtpmap_codec] = codec;
+				last_rtpmap_codec++;
+				found = TRUE;
+
+			} else if (p->vrtp) {
+				if(ast_rtp_set_rtpmap_type(newvideortp, codec, "video", mimeSubtype, 0) != -1) {
+					if (debug)
+						ast_verbose("Found video description format %s for ID %d\n", mimeSubtype, codec);
+					found_rtpmap_codecs[last_rtpmap_codec] = codec;
+					last_rtpmap_codec++;
+					found = TRUE;
+				}
+			}
+			if (!found) {
+				/* Remove this codec since it's an unknown media type for us */
+				/* XXX This is buggy since the media line for audio and video can have the
+					same numbers. We need to check as described above, but for testing this works... */
+				ast_rtp_unset_m_type(newaudiortp, codec);
+				ast_rtp_unset_m_type(newvideortp, codec);
+				if (debug) 
+					ast_verbose("Found unknown media description format %s for ID %d\n", mimeSubtype, codec);
+			}
 		}
 	}
 	

Modified: team/russell/autoservice_1.4/configs/cdr.conf.sample
URL: http://svn.digium.com/view/asterisk/team/russell/autoservice_1.4/configs/cdr.conf.sample?view=diff&rev=89642&r1=89641&r2=89642
==============================================================================
--- team/russell/autoservice_1.4/configs/cdr.conf.sample (original)
+++ team/russell/autoservice_1.4/configs/cdr.conf.sample Tue Nov 27 11:22:19 2007
@@ -12,6 +12,16 @@
 ; Define whether or not to use CDR logging.  Setting this to "no" will override
 ; any loading of backend CDR modules.  Default is "yes".
 ;enable=yes
+
+; Define whether or not to log unanswered calls. Setting this to "yes" will
+; report every attempt to ring a phone in dialing attempts, when it was not 
+; answered. For example, if you try to dial 3 extensions, and this option is "yes",
+; you will get 3 CDR's, one for each phone that was rung. Default is "no". Some
+; find this information horribly useless. Others find it very valuable. Note, in "yes"
+; mode, you will see one CDR, with one of the call targets on one side, and the originating
+; channel on the other, and then one CDR for each channel attempted. This may seem 
+; redundant, but cannot be helped.
+;unanswered = no
 
 ; Define the CDR batch mode, where instead of posting the CDR at the end of
 ; every call, the data will be stored in a buffer to help alleviate load on the

Modified: team/russell/autoservice_1.4/configs/sip.conf.sample
URL: http://svn.digium.com/view/asterisk/team/russell/autoservice_1.4/configs/sip.conf.sample?view=diff&rev=89642&r1=89641&r2=89642
==============================================================================
--- team/russell/autoservice_1.4/configs/sip.conf.sample (original)
+++ team/russell/autoservice_1.4/configs/sip.conf.sample Tue Nov 27 11:22:19 2007
@@ -207,6 +207,9 @@
 				; of a friend will now be added to and compared with
 				; the peer limit instead of applying two call limits,
 				; one for the peer and one for the user.
+				; "sip show inuse" will only show active calls on 
+				; the peer side of a "type=friend" object if this
+				; setting is turned on.
 
 ;----------------------------------------- T.38 FAX PASSTHROUGH SUPPORT -----------------------
 ;

Modified: team/russell/autoservice_1.4/configs/voicemail.conf.sample
URL: http://svn.digium.com/view/asterisk/team/russell/autoservice_1.4/configs/voicemail.conf.sample?view=diff&rev=89642&r1=89641&r2=89642
==============================================================================
--- team/russell/autoservice_1.4/configs/voicemail.conf.sample (original)
+++ team/russell/autoservice_1.4/configs/voicemail.conf.sample Tue Nov 27 11:22:19 2007
@@ -10,7 +10,8 @@
 ;
 
 [general]
-; Default formats for writing Voicemail
+; Formats for writing Voicemail.  Note that when using IMAP storage for
+; voicemail, only the first format specified will be used.
 ;format=g723sf|wav49|wav
 format=wav49|gsm|wav
 ;

Modified: team/russell/autoservice_1.4/funcs/func_env.c
URL: http://svn.digium.com/view/asterisk/team/russell/autoservice_1.4/funcs/func_env.c?view=diff&rev=89642&r1=89641&r2=89642
==============================================================================
--- team/russell/autoservice_1.4/funcs/func_env.c (original)
+++ team/russell/autoservice_1.4/funcs/func_env.c Tue Nov 27 11:22:19 2007
@@ -73,7 +73,7 @@
 	char *action;
 	struct stat s;
 
-	*buf = '\0';
+	ast_copy_string(buf, "0", len);
 
 	action = strsep(&data, "|");
 	if (stat(data, &s)) {

Modified: team/russell/autoservice_1.4/include/asterisk/cdr.h
URL: http://svn.digium.com/view/asterisk/team/russell/autoservice_1.4/include/asterisk/cdr.h?view=diff&rev=89642&r1=89641&r2=89642
==============================================================================
--- team/russell/autoservice_1.4/include/asterisk/cdr.h (original)
+++ team/russell/autoservice_1.4/include/asterisk/cdr.h Tue Nov 27 11:22:19 2007
@@ -100,6 +100,7 @@
 int ast_cdr_serialize_variables(struct ast_cdr *cdr, char *buf, size_t size, char delim, char sep, int recur);
 void ast_cdr_free_vars(struct ast_cdr *cdr, int recur);
 int ast_cdr_copy_vars(struct ast_cdr *to_cdr, struct ast_cdr *from_cdr);
+int ast_cdr_log_unanswered(void);
 
 typedef int (*ast_cdrbe)(struct ast_cdr *cdr);
 

Modified: team/russell/autoservice_1.4/include/asterisk/rtp.h
URL: http://svn.digium.com/view/asterisk/team/russell/autoservice_1.4/include/asterisk/rtp.h?view=diff&rev=89642&r1=89641&r2=89642
==============================================================================
--- team/russell/autoservice_1.4/include/asterisk/rtp.h (original)
+++ team/russell/autoservice_1.4/include/asterisk/rtp.h Tue Nov 27 11:22:19 2007
@@ -170,8 +170,14 @@
 /*! \brief Copy payload types between RTP structures */
 void ast_rtp_pt_copy(struct ast_rtp *dest, struct ast_rtp *src);
 
+/*! \brief Activate payload type */
 void ast_rtp_set_m_type(struct ast_rtp* rtp, int pt);
-void ast_rtp_set_rtpmap_type(struct ast_rtp* rtp, int pt,
+
+/*! \brief clear payload type */
+void ast_rtp_unset_m_type(struct ast_rtp* rtp, int pt);
+
+/*! \brief Initiate payload type to a known MIME media type for a codec */
+int ast_rtp_set_rtpmap_type(struct ast_rtp* rtp, int pt,
 			     char *mimeType, char *mimeSubtype,
 			     enum ast_rtp_options options);
 

Modified: team/russell/autoservice_1.4/main/app.c
URL: http://svn.digium.com/view/asterisk/team/russell/autoservice_1.4/main/app.c?view=diff&rev=89642&r1=89641&r2=89642
==============================================================================
--- team/russell/autoservice_1.4/main/app.c (original)
+++ team/russell/autoservice_1.4/main/app.c Tue Nov 27 11:22:19 2007
@@ -1394,7 +1394,6 @@
 	s = optstr;
 	while (*s) {
 		curarg = *s++ & 0x7f;	/* the array (in app.h) has 128 entries */
-		ast_set_flag(flags, options[curarg].flag);
 		argloc = options[curarg].arg_index;
 		if (*s == '(') {
 			/* Has argument */
@@ -1411,6 +1410,8 @@
 		} else if (argloc) {
 			args[argloc - 1] = NULL;
 		}
+		if (!argloc || !ast_strlen_zero(args[argloc - 1]))
+			ast_set_flag(flags, options[curarg].flag);
 	}
 
 	return res;

Modified: team/russell/autoservice_1.4/main/cdr.c
URL: http://svn.digium.com/view/asterisk/team/russell/autoservice_1.4/main/cdr.c?view=diff&rev=89642&r1=89641&r2=89642
==============================================================================
--- team/russell/autoservice_1.4/main/cdr.c (original)
+++ team/russell/autoservice_1.4/main/cdr.c Tue Nov 27 11:22:19 2007
@@ -89,6 +89,7 @@
 #define BATCH_SAFE_SHUTDOWN_DEFAULT 1
 
 static int enabled;		/*! Is the CDR subsystem enabled ? */
+static int unanswered;
 static int batchmode;
 static int batchsize;
 static int batchtime;
@@ -101,6 +102,11 @@
 AST_MUTEX_DEFINE_STATIC(cdr_pending_lock);
 static ast_cond_t cdr_pending_cond;
 
+
+int ast_cdr_log_unanswered(void)
+{
+	return unanswered;
+}
 
 /*! Register a CDR driver. Each registered CDR driver generates a CDR 
 	\return 0 on success, -1 on failure 
@@ -984,8 +990,6 @@
 	struct ast_cdr_beitem *i;
 
 	for ( ; cdr ; cdr = cdr->next) {
-		if (cdr->disposition < AST_CDR_ANSWERED && (ast_strlen_zero(cdr->channel) || ast_strlen_zero(cdr->dstchannel)))
-			continue; /* people don't want to see unanswered single-channel events */
 		chan = S_OR(cdr->channel, "<unknown>");
 		check_post(cdr);
 		if (ast_tvzero(cdr->end))
@@ -1247,6 +1251,7 @@
 	ast_cli(fd, "CDR logging: %s\n", enabled ? "enabled" : "disabled");
 	ast_cli(fd, "CDR mode: %s\n", batchmode ? "batch" : "simple");
 	if (enabled) {
+		ast_cli(fd, "CDR output unanswered calls: %s\n", unanswered ? "yes" : "no");
 		if (batchmode) {
 			if (batch)
 				cnt = batch->size;
@@ -1298,6 +1303,7 @@
 {
 	struct ast_config *config;
 	const char *enabled_value;
+	const char *unanswered_value;
 	const char *batched_value;
 	const char *scheduleronly_value;
 	const char *batchsafeshutdown_value;
@@ -1328,6 +1334,9 @@
 	if ((config = ast_config_load("cdr.conf"))) {
 		if ((enabled_value = ast_variable_retrieve(config, "general", "enable"))) {
 			enabled = ast_true(enabled_value);
+		}
+		if ((unanswered_value = ast_variable_retrieve(config, "general", "unanswered"))) {
+			unanswered = ast_true(unanswered_value);
 		}
 		if ((batched_value = ast_variable_retrieve(config, "general", "batch"))) {
 			batchmode = ast_true(batched_value);

Modified: team/russell/autoservice_1.4/main/dial.c
URL: http://svn.digium.com/view/asterisk/team/russell/autoservice_1.4/main/dial.c?view=diff&rev=89642&r1=89641&r2=89642
==============================================================================
--- team/russell/autoservice_1.4/main/dial.c (original)
+++ team/russell/autoservice_1.4/main/dial.c Tue Nov 27 11:22:19 2007
@@ -61,6 +61,7 @@
 	const char *device;                    /*! Device being dialed */
 	void *options[AST_DIAL_OPTION_MAX];    /*! Channel specific options */
 	int cause;                             /*! Cause code in case of failure */
+	int is_running_app:1;                  /*! Is this running an application? */
 	struct ast_channel *owner;             /*! Asterisk channel */
 	AST_LIST_ENTRY(ast_dial_channel) list; /*! Linked list information */
 };
@@ -123,8 +124,9 @@
 }
 
 /* Application execution function for 'ANSWER_EXEC' option */
-static void answer_exec_run(struct ast_channel *chan, char *app, char *args)
-{
+static void answer_exec_run(struct ast_dial *dial, struct ast_dial_channel *dial_channel, char *app, char *args)
+{
+	struct ast_channel *chan = dial_channel->owner;
 	struct ast_app *ast_app = pbx_findapp(app);
 
 	/* If the application was not found, return immediately */
@@ -133,6 +135,12 @@
 
 	/* All is well... execute the application */
 	pbx_exec(chan, ast_app, args);
+
+	/* If another thread is not taking over hang up the channel */
+	if (dial->thread != AST_PTHREADT_STOP) {
+		ast_hangup(chan);
+		dial_channel->owner = NULL;
+	}
 
 	return;
 }
@@ -510,8 +518,11 @@
 			channel->owner = NULL;
 		}
 		/* If ANSWER_EXEC is enabled as an option, execute application on answered channel */
-		if ((channel = find_relative_dial_channel(dial, who)) && (answer_exec = FIND_RELATIVE_OPTION(dial, channel, AST_DIAL_OPTION_ANSWER_EXEC)))
-			answer_exec_run(who, answer_exec->app, answer_exec->args);
+		if ((channel = find_relative_dial_channel(dial, who)) && (answer_exec = FIND_RELATIVE_OPTION(dial, channel, AST_DIAL_OPTION_ANSWER_EXEC))) {
+			channel->is_running_app = 1;
+			answer_exec_run(dial, channel, answer_exec->app, answer_exec->args);
+			channel->is_running_app = 0;
+		}
 	} else if (dial->state == AST_DIAL_RESULT_HANGUP) {
 		/* Hangup everything */
 		AST_LIST_TRAVERSE(&dial->channels, channel, list) {
@@ -615,8 +626,16 @@
 	/* Stop the thread */
 	dial->thread = AST_PTHREADT_STOP;
 
-	/* Now we signal it with SIGURG so it will break out of it's waitfor */
-	pthread_kill(thread, SIGURG);
+	/* If the answered channel is running an application we have to soft hangup it, can't just poke the thread */
+	if (AST_LIST_FIRST(&dial->channels)->is_running_app) {
+		struct ast_channel *chan = AST_LIST_FIRST(&dial->channels)->owner;
+		ast_channel_lock(chan);
+		ast_softhangup(chan, AST_SOFTHANGUP_EXPLICIT);
+		ast_channel_unlock(chan);
+	} else {
+		/* Now we signal it with SIGURG so it will break out of it's waitfor */
+		pthread_kill(thread, SIGURG);
+	}
 
 	/* Finally wait for the thread to exit */
 	pthread_join(thread, NULL);

Modified: team/russell/autoservice_1.4/main/pbx.c
URL: http://svn.digium.com/view/asterisk/team/russell/autoservice_1.4/main/pbx.c?view=diff&rev=89642&r1=89641&r2=89642
==============================================================================
--- team/russell/autoservice_1.4/main/pbx.c (original)
+++ team/russell/autoservice_1.4/main/pbx.c Tue Nov 27 11:22:19 2007
@@ -2315,8 +2315,10 @@
 /* helper function to set extension and priority */
 static void set_ext_pri(struct ast_channel *c, const char *exten, int pri)
 {
+	ast_channel_lock(c);
 	ast_copy_string(c->exten, exten, sizeof(c->exten));
 	c->priority = pri;
+	ast_channel_unlock(c);
 }
 
 /*!

Modified: team/russell/autoservice_1.4/main/rtp.c
URL: http://svn.digium.com/view/asterisk/team/russell/autoservice_1.4/main/rtp.c?view=diff&rev=89642&r1=89641&r2=89642
==============================================================================
--- team/russell/autoservice_1.4/main/rtp.c (original)
+++ team/russell/autoservice_1.4/main/rtp.c Tue Nov 27 11:22:19 2007
@@ -1640,23 +1640,36 @@
 	ast_mutex_unlock(&rtp->bridge_lock);
 } 
 
+/*! \brief remove setting from payload type list if the rtpmap header indicates
+    an unknown media type */
+void ast_rtp_unset_m_type(struct ast_rtp* rtp, int pt) 
+{
+	ast_mutex_lock(&rtp->bridge_lock);
+	rtp->current_RTP_PT[pt].isAstFormat = 0;
+	rtp->current_RTP_PT[pt].code = 0;
+	ast_mutex_unlock(&rtp->bridge_lock);
+}
+
 /*! \brief Make a note of a RTP payload type (with MIME type) that was seen in
  * an SDP "a=rtpmap:" line.
+ * \return 0 if the MIME type was found and set, -1 if it wasn't found
  */
-void ast_rtp_set_rtpmap_type(struct ast_rtp *rtp, int pt,
+int ast_rtp_set_rtpmap_type(struct ast_rtp *rtp, int pt,
 			     char *mimeType, char *mimeSubtype,
 			     enum ast_rtp_options options)
 {
 	unsigned int i;
+	int found = 0;
 
 	if (pt < 0 || pt > MAX_RTP_PT) 
-		return; /* bogus payload type */
+		return -1; /* bogus payload type */
 	
 	ast_mutex_lock(&rtp->bridge_lock);
 
 	for (i = 0; i < sizeof(mimeTypes)/sizeof(mimeTypes[0]); ++i) {
 		if (strcasecmp(mimeSubtype, mimeTypes[i].subtype) == 0 &&
 		    strcasecmp(mimeType, mimeTypes[i].type) == 0) {
+			found = 1;
 			rtp->current_RTP_PT[pt] = mimeTypes[i].payloadType;
 			if ((mimeTypes[i].payloadType.code == AST_FORMAT_G726) &&
 			    mimeTypes[i].payloadType.isAstFormat &&
@@ -1668,7 +1681,7 @@
 
 	ast_mutex_unlock(&rtp->bridge_lock);
 
-	return;
+	return (found ? 0 : -1);
 } 
 
 /*! \brief Return the union of all of the codecs that were set by rtp_set...() calls 

Modified: team/russell/autoservice_1.4/pbx/pbx_config.c
URL: http://svn.digium.com/view/asterisk/team/russell/autoservice_1.4/pbx/pbx_config.c?view=diff&rev=89642&r1=89641&r2=89642
==============================================================================
--- team/russell/autoservice_1.4/pbx/pbx_config.c (original)
+++ team/russell/autoservice_1.4/pbx/pbx_config.c Tue Nov 27 11:22:19 2007
@@ -1472,7 +1472,7 @@
 	if (!app_data)
 		app_data="";
 	if (ast_add_extension(argv[4], argc == 6 ? 1 : 0, exten, iprior, NULL, cidmatch, app,
-		(void *)strdup(app_data), free, registrar)) {
+		(void *)strdup(app_data), ast_free, registrar)) {
 		switch (errno) {
 		case ENOMEM:
 			ast_cli(fd, "Out of free memory\n");
@@ -1565,7 +1565,7 @@
 	if (!app_data)
 		app_data="";
 	if (ast_add_extension(argv[5], argc == 7 ? 1 : 0, exten, iprior, NULL, cidmatch, app,
-		(void *)strdup(app_data), free, registrar)) {
+		(void *)strdup(app_data), ast_free, registrar)) {
 		switch (errno) {
 		case ENOMEM:
 			ast_cli(fd, "Out of free memory\n");

Modified: team/russell/autoservice_1.4/res/res_features.c
URL: http://svn.digium.com/view/asterisk/team/russell/autoservice_1.4/res/res_features.c?view=diff&rev=89642&r1=89641&r2=89642
==============================================================================
--- team/russell/autoservice_1.4/res/res_features.c (original)
+++ team/russell/autoservice_1.4/res/res_features.c Tue Nov 27 11:22:19 2007
@@ -1921,6 +1921,7 @@
 			if (error) {
 				ast_log(LOG_WARNING, "Failed to play courtesy tone!\n");
 				ast_hangup(peer);
+				ast_module_user_remove(u);
 				return -1;
 			}
 		} else
@@ -1930,6 +1931,7 @@
 		if (res < 0) {
 			ast_log(LOG_WARNING, "Could not make channels %s and %s compatible for bridge\n", chan->name, peer->name);
 			ast_hangup(peer);
+			ast_module_user_remove(u);
 			return -1;
 		}
 		/* This runs sorta backwards, since we give the incoming channel control, as if it
@@ -1950,6 +1952,7 @@
 		/* Simulate the PBX hanging up */
 		if (res != AST_PBX_NO_HANGUP_PEER)
 			ast_hangup(peer);
+		ast_module_user_remove(u);
 		return res;
 	} else {
 		/*! \todo XXX Play a message XXX */




More information about the asterisk-commits mailing list