[asterisk-commits] oej: branch oej/codename-pineapple r47883 - in /team/oej/codename-pineapple: ...

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Tue Nov 21 06:03:30 MST 2006


Author: oej
Date: Tue Nov 21 07:03:30 2006
New Revision: 47883

URL: http://svn.digium.com/view/asterisk?view=rev&rev=47883
Log:
Update to trunk

Modified:
    team/oej/codename-pineapple/   (props changed)
    team/oej/codename-pineapple/.cleancount
    team/oej/codename-pineapple/UPGRADE.txt
    team/oej/codename-pineapple/apps/app_db.c
    team/oej/codename-pineapple/apps/app_dial.c
    team/oej/codename-pineapple/apps/app_directed_pickup.c
    team/oej/codename-pineapple/apps/app_directory.c
    team/oej/codename-pineapple/apps/app_followme.c
    team/oej/codename-pineapple/apps/app_queue.c
    team/oej/codename-pineapple/apps/app_voicemail.c
    team/oej/codename-pineapple/channels/chan_oss.c
    team/oej/codename-pineapple/channels/chan_sip.c
    team/oej/codename-pineapple/channels/chan_zap.c
    team/oej/codename-pineapple/configs/sip.conf.sample
    team/oej/codename-pineapple/configs/voicemail.conf.sample
    team/oej/codename-pineapple/configs/zapata.conf.sample
    team/oej/codename-pineapple/doc/ael.txt
    team/oej/codename-pineapple/doc/billing.txt
    team/oej/codename-pineapple/include/asterisk/channel.h
    team/oej/codename-pineapple/include/asterisk/cli.h
    team/oej/codename-pineapple/include/asterisk/file.h
    team/oej/codename-pineapple/main/app.c
    team/oej/codename-pineapple/main/cdr.c
    team/oej/codename-pineapple/main/channel.c
    team/oej/codename-pineapple/main/cli.c
    team/oej/codename-pineapple/main/file.c
    team/oej/codename-pineapple/main/frame.c
    team/oej/codename-pineapple/main/manager.c
    team/oej/codename-pineapple/main/rtp.c
    team/oej/codename-pineapple/res/res_features.c
    team/oej/codename-pineapple/res/res_realtime.c

Propchange: team/oej/codename-pineapple/
------------------------------------------------------------------------------
Binary property 'branch-1.4-blocked' - no diff available.

Propchange: team/oej/codename-pineapple/
------------------------------------------------------------------------------
Binary property 'branch-1.4-merged' - no diff available.

Propchange: team/oej/codename-pineapple/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Tue Nov 21 07:03:30 2006
@@ -1,1 +1,1 @@
-/trunk:1-47759
+/trunk:1-47882

Modified: team/oej/codename-pineapple/.cleancount
URL: http://svn.digium.com/view/asterisk/team/oej/codename-pineapple/.cleancount?view=diff&rev=47883&r1=47882&r2=47883
==============================================================================
--- team/oej/codename-pineapple/.cleancount (original)
+++ team/oej/codename-pineapple/.cleancount Tue Nov 21 07:03:30 2006
@@ -1,1 +1,1 @@
-25
+26

Modified: team/oej/codename-pineapple/UPGRADE.txt
URL: http://svn.digium.com/view/asterisk/team/oej/codename-pineapple/UPGRADE.txt?view=diff&rev=47883&r1=47882&r2=47883
==============================================================================
--- team/oej/codename-pineapple/UPGRADE.txt (original)
+++ team/oej/codename-pineapple/UPGRADE.txt Tue Nov 21 07:03:30 2006
@@ -6,3 +6,14 @@
 * The CallerID fields across Manager events have now been made more
   consistent. CallerID Number will be sent as CallerIDNum and CallerID
   Name will be sent as CallerIDName wherever used.
+
+AEL:
+
+* Macros are now implemented underneath with the Gosub() application.
+  Heaven Help You if you wrote code depending on any aspect of this!
+  Previous to 1.6, macros were implemented with the Macro() app, which
+  provided a nice feature of auto-returning. The compiler will do its
+  best to insert a Return() app call at the end of your macro if you did
+  not include it, but really, you should make sure that all execution
+  paths within your macros end in "return;".
+

Modified: team/oej/codename-pineapple/apps/app_db.c
URL: http://svn.digium.com/view/asterisk/team/oej/codename-pineapple/apps/app_db.c?view=diff&rev=47883&r1=47882&r2=47883
==============================================================================
--- team/oej/codename-pineapple/apps/app_db.c (original)
+++ team/oej/codename-pineapple/apps/app_db.c Tue Nov 21 07:03:30 2006
@@ -50,7 +50,7 @@
 
 /*! \todo XXX Remove this application after 1.4 is relased */
 static char *d_descrip =
-"  DBdel(family/key): This applicaiton will delete a key from the Asterisk\n"
+"  DBdel(family/key): This application will delete a key from the Asterisk\n"
 "database.\n"
 "  This application has been DEPRECATED in favor of the DB_DELETE function.\n";
 

Modified: team/oej/codename-pineapple/apps/app_dial.c
URL: http://svn.digium.com/view/asterisk/team/oej/codename-pineapple/apps/app_dial.c?view=diff&rev=47883&r1=47882&r2=47883
==============================================================================
--- team/oej/codename-pineapple/apps/app_dial.c (original)
+++ team/oej/codename-pineapple/apps/app_dial.c Tue Nov 21 07:03:30 2006
@@ -67,7 +67,7 @@
 
 static char *descrip =
 "  Dial(Technology/resource[&Tech2/resource2...][|timeout][|options][|URL]):\n"
-"This applicaiton will place calls to one or more specified channels. As soon\n"
+"This application will place calls to one or more specified channels. As soon\n"
 "as one of the requested channels answers, the originating channel will be\n"
 "answered, if it has not already been answered. These two channels will then\n"
 "be active in a bridged call. All other channels that were requested will then\n"
@@ -419,7 +419,12 @@
 					src->name, dialstatus);
 }	
 
-/* helper function for wait_for_answer() */
+/*!
+ * helper function for wait_for_answer()
+ *
+ * XXX this code is highly suspicious, as it essentially overwrites
+ * the outgoing channel without properly deleting it.
+ */
 static void do_forward(struct dial_localuser *o,
 	struct cause_args *num, struct ast_flags *peerflags, int single)
 {
@@ -504,10 +509,10 @@
 				char cidname[AST_MAX_EXTENSION];
 				ast_set_callerid(c, S_OR(in->macroexten, in->exten), get_cid_name(cidname, sizeof(cidname), in), NULL);
 			}
-		}
-	}
-	/* Hangup the original channel now, in case we needed it */
-	ast_hangup(c);
+			/* Hangup the original channel now, in case we needed it */
+			ast_hangup(c);
+		}
+	}
 }
 
 /* argument used for some functions. */
@@ -590,7 +595,7 @@
 						       OPT_CALLEE_MONITOR | OPT_CALLER_MONITOR |
 						       OPT_CALLEE_PARK | OPT_CALLER_PARK |
 						       DIAL_NOFORWARDHTML);
-					ast_copy_string(c->context, "", sizeof(c->context));
+					ast_copy_string(c->dialcontext, "", sizeof(c->dialcontext));
 					ast_copy_string(c->exten, "", sizeof(c->exten));
 				}
 				continue;
@@ -625,7 +630,7 @@
 							       OPT_CALLEE_MONITOR | OPT_CALLER_MONITOR |
 							       OPT_CALLEE_PARK | OPT_CALLER_PARK |
 							       DIAL_NOFORWARDHTML);
-						ast_copy_string(c->context, "", sizeof(c->context));
+						ast_copy_string(c->dialcontext, "", sizeof(c->dialcontext));
 						ast_copy_string(c->exten, "", sizeof(c->exten));
 						/* Setup early bridge if appropriate */
 						ast_channel_early_bridge(in, peer);
@@ -1369,7 +1374,7 @@
 			ast_app_group_set_channel(tmp->chan, outbound_group);
 
 		/* Inherit context and extension */
-		ast_copy_string(tmp->chan->context, chan->context, sizeof(tmp->chan->context));
+		ast_copy_string(tmp->chan->dialcontext, chan->context, sizeof(tmp->chan->dialcontext));
 		ast_copy_string(tmp->chan->exten, chan->exten, sizeof(tmp->chan->exten));
 
 		/* Place the call, but don't wait on the answer */

Modified: team/oej/codename-pineapple/apps/app_directed_pickup.c
URL: http://svn.digium.com/view/asterisk/team/oej/codename-pineapple/apps/app_directed_pickup.c?view=diff&rev=47883&r1=47882&r2=47883
==============================================================================
--- team/oej/codename-pineapple/apps/app_directed_pickup.c (original)
+++ team/oej/codename-pineapple/apps/app_directed_pickup.c Tue Nov 21 07:03:30 2006
@@ -97,7 +97,7 @@
 
 	while ((target = ast_channel_walk_locked(target))) {
 		if (!strcasecmp(target->exten, exten) &&
-		    !strcasecmp(target->context, context) &&
+		    !strcasecmp(target->dialcontext, context) &&
 		    can_pickup(target)) {
 			res = pickup_do(chan, target);
 			ast_channel_unlock(target);

Modified: team/oej/codename-pineapple/apps/app_directory.c
URL: http://svn.digium.com/view/asterisk/team/oej/codename-pineapple/apps/app_directory.c?view=diff&rev=47883&r1=47882&r2=47883
==============================================================================
--- team/oej/codename-pineapple/apps/app_directory.c (original)
+++ team/oej/codename-pineapple/apps/app_directory.c Tue Nov 21 07:03:30 2006
@@ -282,17 +282,17 @@
 #endif
 
 	if (ast_fileexists(fn, NULL, chan->language) > 0) {
-		res = ast_stream_and_wait(chan, fn, chan->language, AST_DIGIT_ANY);
+		res = ast_stream_and_wait(chan, fn, AST_DIGIT_ANY);
 		ast_stopstream(chan);
 		/* If Option 'e' was specified, also read the extension number with the name */
 		if (readext) {
-			ast_stream_and_wait(chan, "vm-extension", chan->language, AST_DIGIT_ANY);
+			ast_stream_and_wait(chan, "vm-extension", AST_DIGIT_ANY);
 			res = ast_say_character_str(chan, ext, AST_DIGIT_ANY, chan->language);
 		}
 	} else {
 		res = ast_say_character_str(chan, S_OR(name, ext), AST_DIGIT_ANY, chan->language);
 		if (!ast_strlen_zero(name) && readext) {
-			ast_stream_and_wait(chan, "vm-extension", chan->language, AST_DIGIT_ANY);
+			ast_stream_and_wait(chan, "vm-extension", AST_DIGIT_ANY);
 			res = ast_say_character_str(chan, ext, AST_DIGIT_ANY, chan->language);
 		}
 	}
@@ -303,7 +303,7 @@
 
 	for (loop = 3 ; loop > 0; loop--) {
 		if (!res)
-			res = ast_stream_and_wait(chan, "dir-instr", chan->language, AST_DIGIT_ANY);
+			res = ast_stream_and_wait(chan, "dir-instr", AST_DIGIT_ANY);
 		if (!res)
 			res = ast_waitfordigit(chan, 3000);
 		ast_stopstream(chan);
@@ -622,7 +622,7 @@
 
 	for (;;) {
 		if (!res)
-			res = ast_stream_and_wait(chan, dirintro, chan->language, AST_DIGIT_ANY);
+			res = ast_stream_and_wait(chan, dirintro, AST_DIGIT_ANY);
 		ast_stopstream(chan);
 		if (!res)
 			res = ast_waitfordigit(chan, 5000);

Modified: team/oej/codename-pineapple/apps/app_followme.c
URL: http://svn.digium.com/view/asterisk/team/oej/codename-pineapple/apps/app_followme.c?view=diff&rev=47883&r1=47882&r2=47883
==============================================================================
--- team/oej/codename-pineapple/apps/app_followme.c (original)
+++ team/oej/codename-pineapple/apps/app_followme.c Tue Nov 21 07:03:30 2006
@@ -982,7 +982,7 @@
 		ast_mutex_unlock(&f->lock);
 
 		if (targs.followmeflags.flags & FOLLOWMEFLAG_STATUSMSG) 
-			ast_stream_and_wait(chan, targs.statusprompt, chan->language, "");
+			ast_stream_and_wait(chan, targs.statusprompt, "");
 
 		snprintf(namerecloc,sizeof(namerecloc),"%s/followme.%s",ast_config_AST_SPOOL_DIR,chan->uniqueid);
 		duration = 5;
@@ -1022,7 +1022,7 @@
 		if (targs.status != 100) {
 			ast_moh_stop(chan);
 			if (targs.followmeflags.flags & FOLLOWMEFLAG_UNREACHABLEMSG) 
-				ast_stream_and_wait(chan, targs.sorryprompt, chan->language, "");
+				ast_stream_and_wait(chan, targs.sorryprompt, "");
 			res = 0;
 		} else {
 			caller = chan;

Modified: team/oej/codename-pineapple/apps/app_queue.c
URL: http://svn.digium.com/view/asterisk/team/oej/codename-pineapple/apps/app_queue.c?view=diff&rev=47883&r1=47882&r2=47883
==============================================================================
--- team/oej/codename-pineapple/apps/app_queue.c (original)
+++ team/oej/codename-pineapple/apps/app_queue.c Tue Nov 21 07:03:30 2006
@@ -4461,6 +4461,27 @@
 	return 0;
 }
 
+static int manager_queue_log_custom(struct mansession *s, struct message *m)
+{
+	char *queuename, *event, *message, *interface, *uniqueid;
+
+	queuename = astman_get_header(m, "Queue");
+	uniqueid = astman_get_header(m, "UniqueId");
+	interface = astman_get_header(m, "Interface");
+	event = astman_get_header(m, "Event");
+	message = astman_get_header(m, "Message");
+
+	if (ast_strlen_zero(queuename) || ast_strlen_zero(event)) {
+		astman_send_error(s, m, "Need 'Queue' and 'Event' parameters.");
+		return 0;
+	}
+
+	ast_queue_log(queuename, S_OR(uniqueid, "NONE"), interface, event, "%s", message);
+	astman_send_ack(s, m, "Event added successfully");
+
+	return 0;
+}
+
 static int handle_queue_add_member(int fd, int argc, char *argv[])
 {
 	char *queuename, *interface, *membername;
@@ -4648,6 +4669,7 @@
 	res |= ast_manager_unregister("QueueAdd");
 	res |= ast_manager_unregister("QueueRemove");
 	res |= ast_manager_unregister("QueuePause");
+	res |= ast_manager_unregister("QueueLog");
 	res |= ast_unregister_application(app_aqm);
 	res |= ast_unregister_application(app_rqm);
 	res |= ast_unregister_application(app_pqm);
@@ -4686,6 +4708,7 @@
 	res |= ast_manager_register("QueueAdd", EVENT_FLAG_AGENT, manager_add_queue_member, "Add interface to queue.");
 	res |= ast_manager_register("QueueRemove", EVENT_FLAG_AGENT, manager_remove_queue_member, "Remove interface from queue.");
 	res |= ast_manager_register("QueuePause", EVENT_FLAG_AGENT, manager_pause_queue_member, "Makes a queue member temporarily unavailable");
+	res |= ast_manager_register("QueueLog", EVENT_FLAG_AGENT, manager_queue_log_custom, "Adds custom entry in queue_log");
 	res |= ast_custom_function_register(&queuevar_function);
 	res |= ast_custom_function_register(&queuemembercount_function);
 	res |= ast_custom_function_register(&queuememberlist_function);

Modified: team/oej/codename-pineapple/apps/app_voicemail.c
URL: http://svn.digium.com/view/asterisk/team/oej/codename-pineapple/apps/app_voicemail.c?view=diff&rev=47883&r1=47882&r2=47883
==============================================================================
--- team/oej/codename-pineapple/apps/app_voicemail.c (original)
+++ team/oej/codename-pineapple/apps/app_voicemail.c Tue Nov 21 07:03:30 2006
@@ -401,6 +401,10 @@
 static char VM_SPOOL_DIR[PATH_MAX];
 
 static char ext_pass_cmd[128];
+
+#define PWDCHANGE_INTERNAL (1 << 1)
+#define PWDCHANGE_EXTERNAL (1 << 2)
+static int pwdchange = PWDCHANGE_INTERNAL;
 
 #if ODBC_STORAGE
 #define tdesc "Comedian Mail (Voicemail System) with ODBC Storage"
@@ -1105,8 +1109,14 @@
 						fd = -1;
 						continue;
 					}
-					if (fd > -1)
-						fdm = mmap(NULL, fdlen, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
+					if (fd > -1) {
+						if ((fdm = mmap(NULL, fdlen, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0)) == -1) {
+							ast_log(LOG_WARNING, "Could not mmap the output file: %s (%d)\n", strerror(errno), errno);
+							SQLFreeHandle(SQL_HANDLE_STMT, stmt);
+							ast_odbc_release_obj(obj);
+							goto yuck;
+						}
+					}
 				}
 				if (fdm) {
 					memset(fdm, 0, fdlen);
@@ -2143,7 +2153,7 @@
 	snprintf(fn, sizeof(fn), "%s%s/%s/greet", VM_SPOOL_DIR, context, ext);
 	RETRIEVE(fn, -1);
 	if (ast_fileexists(fn, NULL, NULL) > 0) {
-		res = ast_stream_and_wait(chan, fn, chan->language, ecodes);
+		res = ast_stream_and_wait(chan, fn, ecodes);
 		if (res) {
 			DISPOSE(fn, -1);
 			return res;
@@ -2151,14 +2161,14 @@
 	} else {
 		/* Dispose just in case */
 		DISPOSE(fn, -1);
-		res = ast_stream_and_wait(chan, "vm-theperson", chan->language, ecodes);
+		res = ast_stream_and_wait(chan, "vm-theperson", ecodes);
 		if (res)
 			return res;
 		res = ast_say_digit_str(chan, ext, ecodes, chan->language);
 		if (res)
 			return res;
 	}
-	res = ast_stream_and_wait(chan, busy ? "vm-isonphone" : "vm-isunavail", chan->language, ecodes);
+	res = ast_stream_and_wait(chan, busy ? "vm-isonphone" : "vm-isunavail", ecodes);
 	return res;
 }
 
@@ -2925,7 +2935,7 @@
 		res = 0;
 	}
 	if (!res && !ast_test_flag(options, OPT_SILENT)) {
-		res = ast_stream_and_wait(chan, INTRO, chan->language, ecodes);
+		res = ast_stream_and_wait(chan, INTRO, ecodes);
 		if (res == '#') {
 			ast_set_flag(options, OPT_SILENT);
 			res = 0;
@@ -3039,7 +3049,7 @@
 		/* Now play the beep once we have the message number for our next message. */
 		if (res >= 0) {
 			/* Unless we're *really* silent, try to send the beep */
-			res = ast_stream_and_wait(chan, "beep", chan->language, "");
+			res = ast_stream_and_wait(chan, "beep", "");
 		}
 				
 		/* Store information */
@@ -4152,7 +4162,7 @@
 static int wait_file2(struct ast_channel *chan, struct vm_state *vms, char *file)
 {
 	int res;
-	if ((res = ast_stream_and_wait(chan, file, chan->language, AST_DIGIT_ANY)) < 0) 
+	if ((res = ast_stream_and_wait(chan, file, AST_DIGIT_ANY)) < 0) 
 		ast_log(LOG_WARNING, "Unable to play message %s\n", file); 
 	return res;
 }
@@ -4283,7 +4293,7 @@
 							ast_verbose(VERBOSE_PREFIX_3 "Playing envelope info: CID number '%s' matches mailbox number, playing recorded name\n", callerid);
 						if (!callback)
 							res = wait_file2(chan, vms, "vm-from");
-						res = ast_stream_and_wait(chan, prefile, chan->language, "");
+						res = ast_stream_and_wait(chan, prefile, "");
 					} else {
 						if (option_verbose > 2)
 							ast_verbose(VERBOSE_PREFIX_3 "Playing envelope info: message from '%s'\n", callerid);
@@ -5741,10 +5751,11 @@
 		if (++tries == 3)
 			return -1;
 	}
-	if (ast_strlen_zero(ext_pass_cmd)) 
-		vm_change_password(vmu,newpassword);
-	else 
-		vm_change_password_shell(vmu,newpassword);
+	if (pwdchange & PWDCHANGE_INTERNAL)
+		vm_change_password(vmu, newpassword);
+	if ((pwdchange & PWDCHANGE_EXTERNAL) && !ast_strlen_zero(ext_pass_cmd))
+		vm_change_password_shell(vmu, newpassword);
+
 	if (option_debug)
 		ast_log(LOG_DEBUG,"User %s set password to %s of length %d\n",vms->username,newpassword,(int)strlen(newpassword));
 	cmd = ast_play_and_wait(chan, vm_passchanged);
@@ -5844,10 +5855,11 @@
 				cmd = ast_play_and_wait(chan, vm_mismatch);
 				break;
 			}
-			if (ast_strlen_zero(ext_pass_cmd)) 
-				vm_change_password(vmu,newpassword);
-			else 
-				vm_change_password_shell(vmu,newpassword);
+			if (pwdchange & PWDCHANGE_INTERNAL)
+				vm_change_password(vmu, newpassword);
+			if ((pwdchange & PWDCHANGE_EXTERNAL) && !ast_strlen_zero(ext_pass_cmd))
+				vm_change_password_shell(vmu, newpassword);
+
 			if (option_debug)
 				ast_log(LOG_DEBUG,"User %s set password to %s of length %d\n",vms->username,newpassword,(int)strlen(newpassword));
 			cmd = ast_play_and_wait(chan, vm_passchanged);
@@ -7176,7 +7188,12 @@
 		/* External password changing command */
 		if ((extpc = ast_variable_retrieve(cfg, "general", "externpass"))) {
 			ast_copy_string(ext_pass_cmd,extpc,sizeof(ext_pass_cmd));
-		}
+			pwdchange = PWDCHANGE_EXTERNAL;
+		} else if ((extpc = ast_variable_retrieve(cfg, "general", "externpassnotify"))) {
+			ast_copy_string(ext_pass_cmd,extpc,sizeof(ext_pass_cmd));
+			pwdchange = PWDCHANGE_EXTERNAL | PWDCHANGE_INTERNAL;
+		}
+
 #ifdef IMAP_STORAGE
 		/* IMAP server address */
 		if ((imap_server = ast_variable_retrieve(cfg, "general", "imapserver"))) {
@@ -7994,7 +8011,7 @@
 				/* Otherwise 1 is to save the existing message */
 				if (option_verbose > 2)
 					ast_verbose(VERBOSE_PREFIX_3 "Saving message as is\n");
-				ast_stream_and_wait(chan, "vm-msgsaved", chan->language, "");
+				ast_stream_and_wait(chan, "vm-msgsaved", "");
 				cmd = 't';
 				return res;
 			}
@@ -8002,7 +8019,7 @@
 			/* Review */
 			if (option_verbose > 2)
 				ast_verbose(VERBOSE_PREFIX_3 "Reviewing the message\n");
-			cmd = ast_stream_and_wait(chan, recordfile, chan->language, AST_DIGIT_ANY);
+			cmd = ast_stream_and_wait(chan, recordfile, AST_DIGIT_ANY);
 			break;
 		case '3':
 			message_exists = 0;

Modified: team/oej/codename-pineapple/channels/chan_oss.c
URL: http://svn.digium.com/view/asterisk/team/oej/codename-pineapple/channels/chan_oss.c?view=diff&rev=47883&r1=47882&r2=47883
==============================================================================
--- team/oej/codename-pineapple/channels/chan_oss.c (original)
+++ team/oej/codename-pineapple/channels/chan_oss.c Tue Nov 21 07:03:30 2006
@@ -530,7 +530,7 @@
 		return 0;
 	}
 	o->w_errors = 0;
-	return write(o->sounddev, ((void *) data), FRAME_SIZE * 2);
+	return write(o->sounddev, (void *)data, FRAME_SIZE * 2);
 }
 
 /*
@@ -559,10 +559,8 @@
 		l = s->samplen - l_sampsent;	/* # of available samples */
 		if (l > 0) {
 			start = l_sampsent % s->datalen;	/* source offset */
-			if (l > FRAME_SIZE - ofs)	/* don't overflow the frame */
-				l = FRAME_SIZE - ofs;
-			if (l > s->datalen - start)	/* don't overflow the source */
-				l = s->datalen - start;
+			l = MIN(l, FRAME_SIZE - ofs);	/* don't overflow the frame */
+			l = MIN(l, s->datalen - start);	/* don't overflow the source */
 			bcopy(s->data + start, myframe + ofs, l * 2);
 			if (0)
 				ast_log(LOG_WARNING, "send_sound sound %d/%d of %d into %d\n", l_sampsent, l, s->samplen, ofs);
@@ -572,8 +570,7 @@
 
 			l += s->silencelen;
 			if (l > 0) {
-				if (l > FRAME_SIZE - ofs)
-					l = FRAME_SIZE - ofs;
+				l = MIN(l, FRAME_SIZE - ofs);
 				bcopy(silence, myframe + ofs, l * 2);
 				l_sampsent += l;
 			} else {			/* silence is over, restart sound if loop */
@@ -605,6 +602,7 @@
 	for (;;) {
 		fd_set rfds, wfds;
 		int maxfd, res;
+		struct timeval *to = NULL, t;
 
 		FD_ZERO(&rfds);
 		FD_ZERO(&wfds);
@@ -620,13 +618,19 @@
 				maxfd = MAX(o->sounddev, maxfd);
 			}
 			if (o->cursound > -1) {
-				FD_SET(o->sounddev, &wfds);
-				maxfd = MAX(o->sounddev, maxfd);
+				/*
+				 * We would like to use select here, but the device
+				 * is always writable, so this would become busy wait.
+				 * So we rather set a timeout to 1/2 of the frame size.
+				 */
+				t.tv_sec = 0;
+				t.tv_usec = (1000000 * FRAME_SIZE) / (5 * DEFAULT_SAMPLE_RATE);
+				to = &t;
 			}
 		}
 		/* ast_select emulates linux behaviour in terms of timeout handling */
-		res = ast_select(maxfd + 1, &rfds, &wfds, NULL, NULL);
-		if (res < 1) {
+		res = ast_select(maxfd + 1, &rfds, &wfds, NULL, to);
+		if (res < 0) {
 			ast_log(LOG_WARNING, "select failed: %s\n", strerror(errno));
 			sleep(1);
 			continue;
@@ -650,7 +654,7 @@
 		if (o->sounddev > -1) {
 			if (FD_ISSET(o->sounddev, &rfds))	/* read and ignore errors */
 				read(o->sounddev, ign, sizeof(ign));
-			if (FD_ISSET(o->sounddev, &wfds))
+			if (to != NULL)			/* maybe it is possible to write */
 				send_sound(o);
 		}
 	}
@@ -696,22 +700,24 @@
 		return -1;
 	}
 	switch (mode) {
-		case O_RDWR:
-			res = ioctl(fd, SNDCTL_DSP_SETDUPLEX, 0);
-			/* Check to see if duplex set (FreeBSD Bug) */
-			res = ioctl(fd, SNDCTL_DSP_GETCAPS, &fmt);
-			if (res == 0 && (fmt & DSP_CAP_DUPLEX)) {
-				if (option_verbose > 1)
-					ast_verbose(VERBOSE_PREFIX_2 "Console is full duplex\n");
-				o->duplex = M_FULL;
-			};
-			break;
-		case O_WRONLY:
-			o->duplex = M_WRITE;
-			break;
-		case O_RDONLY:
-			o->duplex = M_READ;
-			break;
+	case O_RDWR:
+		res = ioctl(fd, SNDCTL_DSP_SETDUPLEX, 0);
+		/* Check to see if duplex set (FreeBSD Bug) */
+		res = ioctl(fd, SNDCTL_DSP_GETCAPS, &fmt);
+		if (res == 0 && (fmt & DSP_CAP_DUPLEX)) {
+			if (option_verbose > 1)
+				ast_verbose(VERBOSE_PREFIX_2 "Console is full duplex\n");
+			o->duplex = M_FULL;
+		};
+		break;
+
+	case O_WRONLY:
+		o->duplex = M_WRITE;
+		break;
+
+	case O_RDONLY:
+		o->duplex = M_READ;
+		break;
 	}
 
 	fmt = 0;
@@ -949,32 +955,34 @@
 	int res = -1;
 
 	switch (cond) {
-		case AST_CONTROL_BUSY:
-		case AST_CONTROL_CONGESTION:
-		case AST_CONTROL_RINGING:
-			res = cond;
-			break;
-
-		case -1:
-			o->cursound = -1;
-			o->nosound = 0;		/* when cursound is -1 nosound must be 0 */
-			return 0;
-
-		case AST_CONTROL_VIDUPDATE:
-			res = -1;
-			break;
-		case AST_CONTROL_HOLD:
-			ast_verbose(" << Console Has Been Placed on Hold >> \n");
-			ast_moh_start(c, data, o->mohinterpret);
-			break;
-		case AST_CONTROL_UNHOLD:
-			ast_verbose(" << Console Has Been Retrieved from Hold >> \n");
-			ast_moh_stop(c);
-			break;
-
-		default:
-			ast_log(LOG_WARNING, "Don't know how to display condition %d on %s\n", cond, c->name);
-			return -1;
+	case AST_CONTROL_BUSY:
+	case AST_CONTROL_CONGESTION:
+	case AST_CONTROL_RINGING:
+		res = cond;
+		break;
+
+	case -1:
+		o->cursound = -1;
+		o->nosound = 0;		/* when cursound is -1 nosound must be 0 */
+		return 0;
+
+	case AST_CONTROL_VIDUPDATE:
+		res = -1;
+		break;
+
+	case AST_CONTROL_HOLD:
+		ast_verbose(" << Console Has Been Placed on Hold >> \n");
+		ast_moh_start(c, data, o->mohinterpret);
+		break;
+
+	case AST_CONTROL_UNHOLD:
+		ast_verbose(" << Console Has Been Retrieved from Hold >> \n");
+		ast_moh_stop(c);
+		break;
+
+	default:
+		ast_log(LOG_WARNING, "Don't know how to display condition %d on %s\n", cond, c->name);
+		return -1;
 	}
 
 	if (res > -1)
@@ -1058,88 +1066,101 @@
 	return c;
 }
 
-static int console_autoanswer(int fd, int argc, char *argv[])
+static char *console_autoanswer(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
 {
 	struct chan_oss_pvt *o = find_desc(oss_active);
 
-	if (argc == 2) {
-		ast_cli(fd, "Auto answer is %s.\n", o->autoanswer ? "on" : "off");
-		return RESULT_SUCCESS;
-	}
-	if (argc != 3)
-		return RESULT_SHOWUSAGE;
+	switch (cmd) {
+	case CLI_INIT:
+		e->command = "console autoanswer [on|off]";
+		e->usage =
+			"Usage: console autoanswer [on|off]\n"
+			"       Enables or disables autoanswer feature.  If used without\n"
+			"       argument, displays the current on/off status of autoanswer.\n"
+			"       The default value of autoanswer is in 'oss.conf'.\n";
+		return NULL;
+
+	case CLI_GENERATE:
+		return NULL;
+	}
+
+	if (a->argc == e->args - 1) {
+		ast_cli(a->fd, "Auto answer is %s.\n", o->autoanswer ? "on" : "off");
+		return CLI_SUCCESS;
+	}
+	if (a->argc != e->args)
+		return CLI_SHOWUSAGE;
 	if (o == NULL) {
 		ast_log(LOG_WARNING, "Cannot find device %s (should not happen!)\n",
 		    oss_active);
-		return RESULT_FAILURE;
-	}
-	if (!strcasecmp(argv[2], "on"))
-		o->autoanswer = -1;
-	else if (!strcasecmp(argv[2], "off"))
+		return CLI_FAILURE;
+	}
+	if (!strcasecmp(a->argv[e->args-1], "on"))
+		o->autoanswer = 1;
+	else if (!strcasecmp(a->argv[e->args - 1], "off"))
 		o->autoanswer = 0;
 	else
-		return RESULT_SHOWUSAGE;
-	return RESULT_SUCCESS;
-}
-
-static char *autoanswer_complete(const char *line, const char *word, int pos, int state)
-{
-	static char *choices[] = { "on", "off", NULL };
-
-	return (pos != 3) ? NULL : ast_cli_complete(word, choices, state);
-}
-
-static char autoanswer_usage[] =
-	"Usage: console autoanswer [on|off]\n"
-	"       Enables or disables autoanswer feature.  If used without\n"
-	"       argument, displays the current on/off status of autoanswer.\n"
-	"       The default value of autoanswer is in 'oss.conf'.\n";
+		return CLI_SHOWUSAGE;
+	return CLI_SUCCESS;
+}
 
 /*
  * answer command from the console
  */
-static int console_answer(int fd, int argc, char *argv[])
+static char *console_answer(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
 {
 	struct ast_frame f = { AST_FRAME_CONTROL, AST_CONTROL_ANSWER };
 	struct chan_oss_pvt *o = find_desc(oss_active);
 
-	if (argc != 2)
-		return RESULT_SHOWUSAGE;
+	switch (cmd) {
+	case CLI_INIT:
+		e->command = "console answer";
+		e->usage =
+			"Usage: console answer\n"
+			"       Answers an incoming call on the console (OSS) channel.\n";
+		return NULL;
+
+	case CLI_GENERATE:
+		return NULL;	/* no completion */
+	}
+	if (a->argc != e->args)
+		return CLI_SHOWUSAGE;
 	if (!o->owner) {
-		ast_cli(fd, "No one is calling us\n");
-		return RESULT_FAILURE;
+		ast_cli(a->fd, "No one is calling us\n");
+		return CLI_FAILURE;
 	}
 	o->hookstate = 1;
 	o->cursound = -1;
 	o->nosound = 0;
 	ast_queue_frame(o->owner, &f);
-#if 0
-	/* XXX do we really need it ? considering we shut down immediately... */
-	ring(o, AST_CONTROL_ANSWER);
-#endif
-	return RESULT_SUCCESS;
-}
-
-static char answer_usage[] =
-	"Usage: console answer\n"
-	"       Answers an incoming call on the console (OSS) channel.\n";
+	return CLI_SUCCESS;
+}
 
 /*
  * concatenate all arguments into a single string. argv is NULL-terminated
  * so we can use it right away
  */
-static int console_sendtext(int fd, int argc, char *argv[])
+static char *console_sendtext(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
 {
 	struct chan_oss_pvt *o = find_desc(oss_active);
 	char buf[TEXT_SIZE];
 
-	if (argc < 3)
-		return RESULT_SHOWUSAGE;
+	if (cmd == CLI_INIT) {
+		e->command = "console send text";
+		e->usage =
+			"Usage: console send text <message>\n"
+			"       Sends a text message for display on the remote terminal.\n";
+		return NULL;
+	} else if (cmd == CLI_GENERATE)
+		return NULL;
+
+	if (a->argc < e->args + 1)
+		return CLI_SHOWUSAGE;
 	if (!o->owner) {
-		ast_cli(fd, "Not in a call\n");
-		return RESULT_FAILURE;
-	}
-	ast_join(buf, sizeof(buf) - 1, argv + 3);
+		ast_cli(a->fd, "Not in a call\n");
+		return CLI_FAILURE;
+	}
+	ast_join(buf, sizeof(buf) - 1, a->argv + e->args);
 	if (!ast_strlen_zero(buf)) {
 		struct ast_frame f = { 0, };
 		int i = strlen(buf);
@@ -1150,85 +1171,100 @@
 		f.datalen = i + 1;
 		ast_queue_frame(o->owner, &f);
 	}
-	return RESULT_SUCCESS;
-}
-
-static char sendtext_usage[] =
-	"Usage: console send text <message>\n"
-	"       Sends a text message for display on the remote terminal.\n";
-
-static int console_hangup(int fd, int argc, char *argv[])
+	return CLI_SUCCESS;
+}
+
+static char *console_hangup(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
 {
 	struct chan_oss_pvt *o = find_desc(oss_active);
 
-	if (argc != 2)
-		return RESULT_SHOWUSAGE;
+	if (cmd == CLI_INIT) {
+		e->command = "console hangup";
+		e->usage =
+			"Usage: console hangup\n"
+			"       Hangs up any call currently placed on the console.\n";
+		return NULL;
+	} else if (cmd == CLI_GENERATE)
+		return NULL;
+
+	if (a->argc != e->args)
+		return CLI_SHOWUSAGE;
 	o->cursound = -1;
 	o->nosound = 0;
 	if (!o->owner && !o->hookstate) { /* XXX maybe only one ? */
-		ast_cli(fd, "No call to hang up\n");
-		return RESULT_FAILURE;
+		ast_cli(a->fd, "No call to hang up\n");
+		return CLI_FAILURE;
 	}
 	o->hookstate = 0;
 	if (o->owner)
 		ast_queue_hangup(o->owner);
 	setformat(o, O_CLOSE);
-	return RESULT_SUCCESS;
-}
-
-static char hangup_usage[] =
-	"Usage: console hangup\n"
-	"       Hangs up any call currently placed on the console.\n";
-
-static int console_flash(int fd, int argc, char *argv[])
+	return CLI_SUCCESS;
+}
+
+static char *console_flash(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
 {
 	struct ast_frame f = { AST_FRAME_CONTROL, AST_CONTROL_FLASH };
 	struct chan_oss_pvt *o = find_desc(oss_active);
 
-	if (argc != 2)
-		return RESULT_SHOWUSAGE;
+	if (cmd == CLI_INIT) {
+		e->command = "console flash";
+		e->usage =
+			"Usage: console flash\n"
+			"       Flashes the call currently placed on the console.\n";
+		return NULL;
+	} else if (cmd == CLI_GENERATE)
+		return NULL;
+
+	if (a->argc != e->args)
+		return CLI_SHOWUSAGE;
 	o->cursound = -1;
 	o->nosound = 0;				/* when cursound is -1 nosound must be 0 */
 	if (!o->owner) {			/* XXX maybe !o->hookstate too ? */
-		ast_cli(fd, "No call to flash\n");
-		return RESULT_FAILURE;
+		ast_cli(a->fd, "No call to flash\n");
+		return CLI_FAILURE;
 	}
 	o->hookstate = 0;
 	if (o->owner)				/* XXX must be true, right ? */
 		ast_queue_frame(o->owner, &f);
-	return RESULT_SUCCESS;
-}
-
-static char flash_usage[] =
-	"Usage: console flash\n"
-	"       Flashes the call currently placed on the console.\n";
-
-static int console_dial(int fd, int argc, char *argv[])
+	return CLI_SUCCESS;
+}
+
+static char *console_dial(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
 {
 	char *s = NULL, *mye = NULL, *myc = NULL;
 	struct chan_oss_pvt *o = find_desc(oss_active);
 
-	if (argc != 2 && argc != 3)
-		return RESULT_SHOWUSAGE;
+	if (cmd == CLI_INIT) {
+		e->command = "console dial";
+		e->usage =
+			"Usage: console dial [extension[@context]]\n"
+			"       Dials a given extension (and context if specified)\n";
+		return NULL;
+	} else if (cmd == CLI_GENERATE)
+		return NULL;
+
+	if (a->argc > e->args + 1)
+		return CLI_SHOWUSAGE;
 	if (o->owner) {	/* already in a call */
 		int i;
 		struct ast_frame f = { AST_FRAME_DTMF, 0 };
 
-		if (argc == 1) {	/* argument is mandatory here */
-			ast_cli(fd, "Already in a call. You can only dial digits until you hangup.\n");
-			return RESULT_FAILURE;
-		}
-		s = argv[2];
+		if (a->argc == e->args) {	/* argument is mandatory here */
+			ast_cli(a->fd, "Already in a call. You can only dial digits until you hangup.\n");
+			return CLI_FAILURE;
+		}
+		s = a->argv[e->args];
 		/* send the string one char at a time */
 		for (i = 0; i < strlen(s); i++) {
 			f.subclass = s[i];
 			ast_queue_frame(o->owner, &f);
 		}
-		return RESULT_SUCCESS;
+		return CLI_SUCCESS;
 	}
 	/* if we have an argument split it into extension and context */
-	if (argc == 3)
-		s = ast_ext_ctx(argv[2], &mye, &myc);
+	if (a->argc == e->args + 1)
+		s = ast_ext_ctx(a->argv[e->args], &mye, &myc);
 	/* supply default values if needed */
 	if (mye == NULL)
 		mye = o->ext;
@@ -1238,45 +1274,37 @@
 		o->hookstate = 1;
 		oss_new(o, mye, myc, AST_STATE_RINGING);
 	} else
-		ast_cli(fd, "No such extension '%s' in context '%s'\n", mye, myc);
+		ast_cli(a->fd, "No such extension '%s' in context '%s'\n", mye, myc);
 	if (s)
 		free(s);
-	return RESULT_SUCCESS;
-}
-
-static char dial_usage[] =
-	"Usage: console dial [extension[@context]]\n"
-	"       Dials a given extension (and context if specified)\n";
-
-static int __console_mute_unmute(int mute)
+	return CLI_SUCCESS;
+}
+
+static char *console_mute(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
 {
 	struct chan_oss_pvt *o = find_desc(oss_active);
+	char *s;
 	
-	o->mute = mute;
-	return RESULT_SUCCESS;
-}
-
-static int console_mute(int fd, int argc, char *argv[])
-{
-	if (argc != 2)
-		return RESULT_SHOWUSAGE;
-
-	return __console_mute_unmute(1);
-}
-
-static char mute_usage[] =
-	"Usage: console mute\nMutes the microphone\n";
-
-static int console_unmute(int fd, int argc, char *argv[])
-{
-	if (argc != 2)
-		return RESULT_SHOWUSAGE;
-
-	return __console_mute_unmute(0);
-}
-
-static char unmute_usage[] =
-	"Usage: console unmute\nUnmutes the microphone\n";
+	if (cmd == CLI_INIT) {
+		e->command = "console {mute|unmute}";
+		e->usage =
+			"Usage: console {mute|unmute}\n"
+			"       Mute/unmute the microphone.\n";
+		return NULL;
+	} else if (cmd == CLI_GENERATE)
+		return NULL;
+
+	if (a->argc != e->args)
+		return CLI_SHOWUSAGE;
+	s = a->argv[e->args-1];
+	if (!strcasecmp(s, "mute"))
+		o->mute = 1;
+	else if (!strcasecmp(s, "unmute"))
+		o->mute = 0;
+	else
+		return CLI_SHOWUSAGE;
+	return CLI_SUCCESS;
+}
 
 static int console_transfer(int fd, int argc, char *argv[])
 {
@@ -1375,41 +1403,17 @@
 }
 
 static struct ast_cli_entry cli_oss[] = {
-	{ { "console", "answer", NULL },
-	console_answer, "Answer an incoming console call",
-	answer_usage },
-
-	{ { "console", "hangup", NULL },
-	console_hangup, "Hangup a call on the console",
-	hangup_usage },
-
-	{ { "console", "flash", NULL },
-	console_flash, "Flash a call on the console",
-	flash_usage },
-
-	{ { "console", "dial", NULL },
-	console_dial, "Dial an extension on the console",
-	dial_usage },
-
-	{ { "console", "mute", NULL },
-	console_mute, "Disable mic input",
-	mute_usage },
-
-	{ { "console", "unmute", NULL },
-	console_unmute, "Enable mic input",
-	unmute_usage },
-
+	NEW_CLI(console_answer, "Answer an incoming console call"),
+	NEW_CLI(console_hangup, "Hangup a call on the console"),
+	NEW_CLI(console_flash, "Flash a call on the console"),
+	NEW_CLI(console_dial, "Dial an extension on the console"),
+	NEW_CLI(console_mute, "Disable/Enable mic input"),
 	{ { "console", "transfer", NULL },
 	console_transfer, "Transfer a call to a different extension",
 	transfer_usage },
 
-	{ { "console", "send", "text", NULL },
-	console_sendtext, "Send text to the remote device",
-	sendtext_usage },
-
-	{ { "console", "autoanswer", NULL },
-	console_autoanswer, "Sets/displays autoanswer",
-	autoanswer_usage, autoanswer_complete },
+	NEW_CLI(console_sendtext, "Send text to the remote device"),
+	NEW_CLI(console_autoanswer, "Sets/displays autoanswer"),
 
 	{ { "console", "boost", NULL },
 	do_boost, "Sets/displays mic boost in dB",

Modified: team/oej/codename-pineapple/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/team/oej/codename-pineapple/channels/chan_sip.c?view=diff&rev=47883&r1=47882&r2=47883
==============================================================================
--- team/oej/codename-pineapple/channels/chan_sip.c (original)
+++ team/oej/codename-pineapple/channels/chan_sip.c Tue Nov 21 07:03:30 2006
@@ -2095,6 +2095,7 @@
 				if (sipdebug && option_debug > 3)
 					ast_log(LOG_DEBUG, "** SIP TIMER: Cancelling retransmit of packet (reply received) Retransid #%d\n", cur->retransid);
 				ast_sched_del(sched, cur->retransid);
+				cur->retransid = -1;
 			}
 			UNLINK(cur, p->packets, prev);
 			free(cur);
@@ -2139,8 +2140,8 @@
 				if (option_debug > 3 && sipdebug)
 					ast_log(LOG_DEBUG, "*** SIP TIMER: Cancelling retransmission #%d - %s (got response)\n", cur->retransid, sip_methods[sipmethod].text);
 				ast_sched_del(sched, cur->retransid);
+				cur->retransid = -1;
 			}
-			cur->retransid = -1;
 			res = 0;
 			break;
 		}
@@ -2458,6 +2459,7 @@
 	}
 	if (peer->expire > -1)
 		ast_sched_del(sched, peer->expire);
+
 	if (peer->pokeexpire > -1)
 		ast_sched_del(sched, peer->pokeexpire);
 	register_peer_exten(peer, FALSE);
@@ -7818,8 +7820,10 @@
 	else
 		peer->username[0] = '\0';
 
-	if (peer->expire > -1)
+	if (peer->expire > -1) {
 		ast_sched_del(sched, peer->expire);
+		peer->expire = -1;
+	}
 	if (expiry > max_expiry)
 		expiry = max_expiry;
 	if (expiry < min_expiry)
@@ -8925,11 +8929,12 @@
 	if (!end || end == input)	/* we require a part in brackets */
 		return NULL;
 
-	/* move away from "<" */
-	end--;
-
-	/* we found "name" */
-	if (tmp && tmp < end) {
+	end--; /* move just before "<" */
+
+	if (tmp && tmp <= end) {
+		/* The quote (tmp) precedes the bracket (end+1).
+		 * Find the matching quote and return the content.
+		 */
 		end = strchr(tmp+1, '"');
 		if (!end)
 			return NULL;
@@ -8939,7 +8944,7 @@
 			bytes = maxbytes;
 		ast_copy_string(output, tmp + 1, bytes);
 	} else {
-		/* we didn't find "name" */
+		/* No quoted string, or it is inside brackets. */
 		/* clear the empty characters in the begining*/
 		input = ast_skip_blanks(input);
 		/* clear the empty characters in the end */
@@ -11814,7 +11819,7 @@
 				ast_log(LOG_WARNING, "Ooooh.. no tech!  That's REALLY bad\n");
 				break;
 			}
-			if (!strcasecmp(bridgepeer->tech->type,"SIP")) {
+			if (bridgepeer->tech == &sip_tech) {
 				bridgepvt = (struct sip_pvt*)(bridgepeer->tech_pvt);
 				if (bridgepvt->udptl) {
 					if (p->t38.state == T38_PEER_REINVITE) {
@@ -12002,6 +12007,7 @@
 		if (global_regattempts_max)
 			p->registry->regattempts = global_regattempts_max+1;
 		ast_sched_del(sched, r->timeout);
+		r->timeout = -1;
 		ast_set_flag(&p->flags[0], SIP_NEEDDESTROY);	
 		break;
 	case 404:	/* Not found */
@@ -12011,6 +12017,7 @@
 		ast_set_flag(&p->flags[0], SIP_NEEDDESTROY);	
 		r->call = NULL;
 		ast_sched_del(sched, r->timeout);
+		r->timeout = -1;
 		break;
 	case 407:	/* Proxy auth */
 		if (p->authtries == MAX_AUTHTRIES || do_register_auth(p, req, resp)) {
@@ -12044,6 +12051,7 @@
 		ast_set_flag(&p->flags[0], SIP_NEEDDESTROY);	
 		r->call = NULL;
 		ast_sched_del(sched, r->timeout);
+		r->timeout = -1;
 		break;
 	case 200:	/* 200 OK */
 		if (!r) {
@@ -13555,7 +13563,7 @@
 				if ((bridgepeer = ast_bridged_channel(p->owner))) {
 					/* We have a bridge, and this is re-invite to switchover to T38 so we send re-invite with T38 SDP, to other side of bridge*/
 					/*! XXX: we should also check here does the other side supports t38 at all !!! XXX */
-					if (!strcasecmp(bridgepeer->tech->type, "SIP")) { /* If we are bridged to SIP channel */
+					if (bridgepeer->tech == &sip_tech) {
 						bridgepvt = (struct sip_pvt*)bridgepeer->tech_pvt;

[... 1524 lines stripped ...]


More information about the asterisk-commits mailing list