[svn-commits] snuffy: branch snuffy/ao2_jabber_take2 r199222 - in /team/snuffy/ao2_jabber_t...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Fri Jun 5 08:16:53 CDT 2009


Author: snuffy
Date: Fri Jun  5 08:16:44 2009
New Revision: 199222

URL: http://svn.asterisk.org/svn-view/asterisk?view=rev&rev=199222
Log:
cough.. merge.. now

Modified:
    team/snuffy/ao2_jabber_take2/   (props changed)
    team/snuffy/ao2_jabber_take2/apps/app_dial.c
    team/snuffy/ao2_jabber_take2/apps/app_directed_pickup.c
    team/snuffy/ao2_jabber_take2/apps/app_macro.c
    team/snuffy/ao2_jabber_take2/apps/app_queue.c
    team/snuffy/ao2_jabber_take2/channels/chan_agent.c
    team/snuffy/ao2_jabber_take2/channels/chan_iax2.c
    team/snuffy/ao2_jabber_take2/channels/chan_local.c
    team/snuffy/ao2_jabber_take2/channels/chan_sip.c
    team/snuffy/ao2_jabber_take2/channels/iax2-parser.c
    team/snuffy/ao2_jabber_take2/configs/sip.conf.sample
    team/snuffy/ao2_jabber_take2/contrib/scripts/meetme.sql
    team/snuffy/ao2_jabber_take2/doc/tex/channelvariables.tex
    team/snuffy/ao2_jabber_take2/funcs/func_math.c
    team/snuffy/ao2_jabber_take2/funcs/func_strings.c
    team/snuffy/ao2_jabber_take2/include/asterisk/_private.h
    team/snuffy/ao2_jabber_take2/include/asterisk/app.h
    team/snuffy/ao2_jabber_take2/include/asterisk/channel.h
    team/snuffy/ao2_jabber_take2/include/asterisk/frame.h
    team/snuffy/ao2_jabber_take2/main/Makefile
    team/snuffy/ao2_jabber_take2/main/app.c
    team/snuffy/ao2_jabber_take2/main/asterisk.c
    team/snuffy/ao2_jabber_take2/main/channel.c
    team/snuffy/ao2_jabber_take2/main/dial.c
    team/snuffy/ao2_jabber_take2/main/features.c
    team/snuffy/ao2_jabber_take2/main/loader.c
    team/snuffy/ao2_jabber_take2/main/manager.c
    team/snuffy/ao2_jabber_take2/main/rtp_engine.c
    team/snuffy/ao2_jabber_take2/main/threadstorage.c
    team/snuffy/ao2_jabber_take2/res/res_agi.c
    team/snuffy/ao2_jabber_take2/res/res_jabber.c
    team/snuffy/ao2_jabber_take2/res/res_monitor.c
    team/snuffy/ao2_jabber_take2/res/res_smdi.c
    team/snuffy/ao2_jabber_take2/res/res_timing_dahdi.c

Propchange: team/snuffy/ao2_jabber_take2/
------------------------------------------------------------------------------
Binary property 'branch-1.4-blocked' - no diff available.

Propchange: team/snuffy/ao2_jabber_take2/
------------------------------------------------------------------------------
Binary property 'branch-1.4-merged' - no diff available.

Propchange: team/snuffy/ao2_jabber_take2/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Fri Jun  5 08:16:44 2009
@@ -1,1 +1,1 @@
-/trunk:1-198364
+/trunk:1-199221

Modified: team/snuffy/ao2_jabber_take2/apps/app_dial.c
URL: http://svn.asterisk.org/svn-view/asterisk/team/snuffy/ao2_jabber_take2/apps/app_dial.c?view=diff&rev=199222&r1=199221&r2=199222
==============================================================================
--- team/snuffy/ao2_jabber_take2/apps/app_dial.c (original)
+++ team/snuffy/ao2_jabber_take2/apps/app_dial.c Fri Jun  5 08:16:44 2009
@@ -724,6 +724,8 @@
  *
  * XXX this code is highly suspicious, as it essentially overwrites
  * the outgoing channel without properly deleting it.
+ *
+ * \todo eventually this function should be intergrated into and replaced by ast_call_forward() 
  */
 static void do_forward(struct chanlist *o,
 	struct cause_args *num, struct ast_flags64 *peerflags, int single, int *to)
@@ -937,7 +939,9 @@
 					ast_verb(3, "%s answered %s\n", c->name, in->name);
 					if (!single && !ast_test_flag64(peerflags, OPT_IGNORE_CONNECTEDLINE)) {
 						if (o->connected.id.number) {
-							ast_channel_update_connected_line(in, &o->connected);
+							if (ast_channel_connected_line_macro(c, in, &o->connected, 1, 0)) {
+								ast_channel_update_connected_line(in, &o->connected);
+							}
 						} else if (!ast_test_flag64(o, DIAL_NOCONNECTEDLINE)) {
 							ast_channel_lock(c);
 							ast_connected_line_copy_from_caller(&connected_caller, &c->cid);
@@ -987,7 +991,9 @@
 						ast_verb(3, "%s answered %s\n", c->name, in->name);
 						if (!single && !ast_test_flag64(peerflags, OPT_IGNORE_CONNECTEDLINE)) {
 							if (o->connected.id.number) {
-								ast_channel_update_connected_line(in, &o->connected);
+								if (ast_channel_connected_line_macro(c, in, &o->connected, 1, 0)) {
+									ast_channel_update_connected_line(in, &o->connected);
+								}
 							} else if (!ast_test_flag64(o, DIAL_NOCONNECTEDLINE)) {
 								ast_channel_lock(c);
 								ast_connected_line_copy_from_caller(&connected_caller, &c->cid);
@@ -1076,8 +1082,9 @@
 						ast_party_connected_line_set(&o->connected, &connected);
 						ast_party_connected_line_free(&connected);
 					} else {
-						ast_verb(3, "%s connected line has changed, passing it to %s\n", c->name, in->name);
-						ast_indicate_data(in, AST_CONTROL_CONNECTED_LINE, f->data.ptr, f->datalen);
+						if (ast_channel_connected_line_macro(c, in, f, 1, 1)) {
+							ast_indicate_data(in, AST_CONTROL_CONNECTED_LINE, f->data.ptr, f->datalen);
+						}
 					}
 					break;
 				case AST_CONTROL_REDIRECTING:
@@ -1198,15 +1205,19 @@
 				if (ast_write(outgoing->chan, f))
 					ast_log(LOG_WARNING, "Unable to forward voice or dtmf\n");
 			}
-			if (single && (f->frametype == AST_FRAME_CONTROL) &&
-				((f->subclass == AST_CONTROL_HOLD) ||
-				(f->subclass == AST_CONTROL_UNHOLD) ||
-				(f->subclass == AST_CONTROL_VIDUPDATE) ||
-				(f->subclass == AST_CONTROL_SRCUPDATE) ||
-				(f->subclass == AST_CONTROL_CONNECTED_LINE) ||
-				(f->subclass == AST_CONTROL_REDIRECTING))) {
-				ast_verb(3, "%s requested special control %d, passing it to %s\n", in->name, f->subclass, outgoing->chan->name);
-				ast_indicate_data(outgoing->chan, f->subclass, f->data.ptr, f->datalen);
+			if (single && (f->frametype == AST_FRAME_CONTROL)) { 
+				if ((f->subclass == AST_CONTROL_HOLD) ||
+				    (f->subclass == AST_CONTROL_UNHOLD) ||
+				    (f->subclass == AST_CONTROL_VIDUPDATE) ||
+				    (f->subclass == AST_CONTROL_SRCUPDATE) ||
+				    (f->subclass == AST_CONTROL_REDIRECTING)) {
+					ast_verb(3, "%s requested special control %d, passing it to %s\n", in->name, f->subclass, outgoing->chan->name);
+					ast_indicate_data(outgoing->chan, f->subclass, f->data.ptr, f->datalen);
+				} else if (f->subclass == AST_CONTROL_CONNECTED_LINE) {
+					if (ast_channel_connected_line_macro(in, outgoing->chan, f, 0, 1)) {
+						ast_indicate_data(outgoing->chan, f->subclass, f->data.ptr, f->datalen);
+					}
+				}
 			}
 			ast_frfree(f);
 		}

Modified: team/snuffy/ao2_jabber_take2/apps/app_directed_pickup.c
URL: http://svn.asterisk.org/svn-view/asterisk/team/snuffy/ao2_jabber_take2/apps/app_directed_pickup.c?view=diff&rev=199222&r1=199221&r2=199222
==============================================================================
--- team/snuffy/ao2_jabber_take2/apps/app_directed_pickup.c (original)
+++ team/snuffy/ao2_jabber_take2/apps/app_directed_pickup.c Fri Jun  5 08:16:44 2009
@@ -98,7 +98,9 @@
 
 	connected_caller = target->connected;
 	connected_caller.source = AST_CONNECTED_LINE_UPDATE_SOURCE_ANSWER;
-	ast_channel_update_connected_line(chan, &connected_caller);
+	if (ast_channel_connected_line_macro(NULL, chan, &connected_caller, 0, 0)) {
+		ast_channel_update_connected_line(chan, &connected_caller);
+	}
 
 	ast_channel_lock(chan);
 	ast_connected_line_copy_from_caller(&connected_caller, &chan->cid);

Modified: team/snuffy/ao2_jabber_take2/apps/app_macro.c
URL: http://svn.asterisk.org/svn-view/asterisk/team/snuffy/ao2_jabber_take2/apps/app_macro.c?view=diff&rev=199222&r1=199221&r2=199222
==============================================================================
--- team/snuffy/ao2_jabber_take2/apps/app_macro.c (original)
+++ team/snuffy/ao2_jabber_take2/apps/app_macro.c Fri Jun  5 08:16:44 2009
@@ -36,6 +36,7 @@
 #include "asterisk/config.h"
 #include "asterisk/utils.h"
 #include "asterisk/lock.h"
+#include "asterisk/app.h"
 
 /*** DOCUMENTATION
 	<application name="Macro" language="en_US">

Modified: team/snuffy/ao2_jabber_take2/apps/app_queue.c
URL: http://svn.asterisk.org/svn-view/asterisk/team/snuffy/ao2_jabber_take2/apps/app_queue.c?view=diff&rev=199222&r1=199221&r2=199222
==============================================================================
--- team/snuffy/ao2_jabber_take2/apps/app_queue.c (original)
+++ team/snuffy/ao2_jabber_take2/apps/app_queue.c Fri Jun  5 08:16:44 2009
@@ -2735,7 +2735,6 @@
 		strcpy(tmp->chan->cdr->accountcode, qe->chan->cdr->accountcode);
 		strcpy(tmp->chan->cdr->userfield, qe->chan->cdr->userfield);
 	}
-	ast_channel_unlock(qe->chan);
 
 	/* Place the call, but don't wait on the answer */
 	if ((res = ast_call(tmp->chan, location, 0))) {
@@ -3002,6 +3001,8 @@
  * \param[in] prebusies number of busy members calculated prior to calling wait_for_answer
  * \param[in] caller_disconnect if the 'H' option is used when calling Queue(), this is used to detect if the caller pressed * to disconnect the call
  * \param[in] forwardsallowed used to detect if we should allow call forwarding, based on the 'i' option to Queue()
+ *
+ * \todo eventually all call forward logic should be intergerated into and replaced by ast_call_forward()
  */
 static struct callattempt *wait_for_answer(struct queue_ent *qe, struct callattempt *outgoing, int *to, char *digit, int prebusies, int caller_disconnect, int forwardsallowed, int update_connectedline)
 {
@@ -3093,7 +3094,9 @@
 					ast_verb(3, "%s answered %s\n", ochan_name, inchan_name);
 					if (update_connectedline) {
 						if (o->connected.id.number) {
-							ast_channel_update_connected_line(in, &o->connected);
+							if (ast_channel_connected_line_macro(o->chan, in, &o->connected, 1, 0)) {
+								ast_channel_update_connected_line(in, &o->connected);
+							}
 						} else if (o->update_connectedline) {
 							ast_channel_lock(o->chan);
 							ast_connected_line_copy_from_caller(&connected_caller, &o->chan->cid);
@@ -3193,7 +3196,9 @@
 								ast_verb(3, "%s answered %s\n", ochan_name, inchan_name);
 								if (update_connectedline) {
 									if (o->connected.id.number) {
-										ast_channel_update_connected_line(in, &o->connected);
+										if (ast_channel_connected_line_macro(o->chan, in, &o->connected, 1, 0)) {
+											ast_channel_update_connected_line(in, &o->connected);
+										}
 									} else if (o->update_connectedline) {
 										ast_channel_lock(o->chan);
 										ast_connected_line_copy_from_caller(&connected_caller, &o->chan->cid);
@@ -3253,8 +3258,9 @@
 								ast_party_connected_line_set(&o->connected, &connected);
 								ast_party_connected_line_free(&connected);
 							} else {
-								ast_verb(3, "%s connected line has changed, passing it to %s\n", ochan_name, inchan_name);
-								ast_indicate_data(in, AST_CONTROL_CONNECTED_LINE, f->data.ptr, f->datalen);
+								if (ast_channel_connected_line_macro(o->chan, in, f, 1, 1)) {
+									ast_indicate_data(in, AST_CONTROL_CONNECTED_LINE, f->data.ptr, f->datalen);
+								}
 							}
 							break;
 						case AST_CONTROL_REDIRECTING:

Modified: team/snuffy/ao2_jabber_take2/channels/chan_agent.c
URL: http://svn.asterisk.org/svn-view/asterisk/team/snuffy/ao2_jabber_take2/channels/chan_agent.c?view=diff&rev=199222&r1=199221&r2=199222
==============================================================================
--- team/snuffy/ao2_jabber_take2/channels/chan_agent.c (original)
+++ team/snuffy/ao2_jabber_take2/channels/chan_agent.c Fri Jun  5 08:16:44 2009
@@ -156,9 +156,6 @@
 					<enum name="mohclass">
 						<para>MusicOnHold class</para>
 					</enum>
-					<enum name="exten">
-						<para>The callback extension for the Agent (AgentCallbackLogin)</para>
-					</enum>
 					<enum name="channel">
 						<para>The name of the active channel for the Agent (AgentLogin)</para>
 					</enum>

Modified: team/snuffy/ao2_jabber_take2/channels/chan_iax2.c
URL: http://svn.asterisk.org/svn-view/asterisk/team/snuffy/ao2_jabber_take2/channels/chan_iax2.c?view=diff&rev=199222&r1=199221&r2=199222
==============================================================================
--- team/snuffy/ao2_jabber_take2/channels/chan_iax2.c (original)
+++ team/snuffy/ao2_jabber_take2/channels/chan_iax2.c Fri Jun  5 08:16:44 2009
@@ -736,7 +736,8 @@
 		/*! Default parkinglot */
 		AST_STRING_FIELD(parkinglot);
 	);
-	
+	/*! AUTHREJ all AUTHREP frames */
+	int authrej;
 	/*! permitted authentication methods */
 	int authmethods;
 	/*! permitted encryption methods */
@@ -4277,7 +4278,7 @@
 		return AST_BRIDGE_FAILED;
 	}
 
-	timeoutms = 0;
+	timeoutms = -1;
 
 	lock_both(callno0, callno1);
 	if (!iaxs[callno0] || !iaxs[callno1]) {
@@ -6488,6 +6489,18 @@
 			ast_string_field_set(iaxs[callno], secret, user->secret);
 		res = 0;
 		user = user_unref(user);
+	} else {
+		 /* user was not found, but we should still fake an AUTHREQ.
+		  * Set authmethods to the last known authmethod used by the system
+		  * Set a fake secret, it's not looked at, just required to attempt authentication.
+		  * Set authrej so the AUTHREP is rejected without even looking at its contents */
+		iaxs[callno]->authmethods = last_authmethod ? last_authmethod : (IAX_AUTH_MD5 | IAX_AUTH_PLAINTEXT);
+		ast_string_field_set(iaxs[callno], secret, "badsecret");
+		iaxs[callno]->authrej = 1;
+		if (!ast_strlen_zero(iaxs[callno]->username)) {
+			/* only send the AUTHREQ if a username was specified. */
+			res = 0;
+		}
 	}
 	ast_set2_flag(iaxs[callno], iax2_getpeertrunk(*sin), IAX_TRUNK);	
 	return res;
@@ -6598,6 +6611,9 @@
 		.name = p->username,	
 	};
 
+	if (p->authrej) {
+		return res;
+	}
 	user = ao2_find(users, &tmp_user, OBJ_POINTER);
 	if (user) {
 		if (ast_test_flag(p, IAX_MAXAUTHREQ)) {

Modified: team/snuffy/ao2_jabber_take2/channels/chan_local.c
URL: http://svn.asterisk.org/svn-view/asterisk/team/snuffy/ao2_jabber_take2/channels/chan_local.c?view=diff&rev=199222&r1=199221&r2=199222
==============================================================================
--- team/snuffy/ao2_jabber_take2/channels/chan_local.c (original)
+++ team/snuffy/ao2_jabber_take2/channels/chan_local.c Fri Jun  5 08:16:44 2009
@@ -434,10 +434,11 @@
 			}
 			f.subclass = condition;
 			f.data.ptr = frame_data;
-			ast_mutex_lock(&p->lock);
 			if (!(res = local_queue_frame(p, isoutbound, &f, ast, 1))) {
 				ast_mutex_unlock(&p->lock);
 			}
+		} else {
+			ast_mutex_unlock(&p->lock);
 		}
 	} else {
 		/* Queue up a frame representing the indication as a control frame */

Modified: team/snuffy/ao2_jabber_take2/channels/chan_sip.c
URL: http://svn.asterisk.org/svn-view/asterisk/team/snuffy/ao2_jabber_take2/channels/chan_sip.c?view=diff&rev=199222&r1=199221&r2=199222
==============================================================================
--- team/snuffy/ao2_jabber_take2/channels/chan_sip.c (original)
+++ team/snuffy/ao2_jabber_take2/channels/chan_sip.c Fri Jun  5 08:16:44 2009
@@ -7239,7 +7239,7 @@
 	if (hostname)
 		*hostname++ = '\0';
 	if (ast_strlen_zero(username) || ast_strlen_zero(hostname)) {
-		ast_log(LOG_WARNING, "Format for registration is [transport://]user[:secret[:authuser]]@domain[:port][/extension][~expiry] at line %d\n", lineno);
+		ast_log(LOG_WARNING, "Format for registration is [transport://]user[@domain][:secret[:authuser]]@host[:port][/extension][~expiry] at line %d\n", lineno);
 		return -1;
 	}
 
@@ -10794,8 +10794,6 @@
 
 	reqprep(&req, p, SIP_NOTIFY, 0, 1);
 
-	add_header(&req, "Event", subscriptiontype->event);
-	add_header(&req, "Content-Type", subscriptiontype->mediatype);
 	switch(state) {
 	case AST_EXTENSION_DEACTIVATED:
 		if (timeout)
@@ -20409,6 +20407,8 @@
 					/* Chan 2: Call from Asterisk to target */
 	int res = 0;
 	struct sip_pvt *targetcall_pvt;
+	struct ast_party_connected_line connected_to_transferee;
+	struct ast_party_connected_line connected_to_target;
 
 	/* Check if the call ID of the replaces header does exist locally */
 	if (!(targetcall_pvt = get_sip_pvt_byid_locked(transferer->refer->replaces_callid, transferer->refer->replaces_callid_totag, 
@@ -20476,6 +20476,13 @@
 		transferer->callid,
 		target.chan1->name,
 		target.chan1->uniqueid);
+	ast_party_connected_line_init(&connected_to_transferee);
+	ast_party_connected_line_init(&connected_to_target);
+	/* No need to lock current->chan1 here since it was locked in sipsock_read */
+	ast_party_connected_line_copy(&connected_to_transferee, &current->chan1->connected);
+	/* No need to lock target.chan1 here since it was locked in get_sip_pvt_byid_locked */
+	ast_party_connected_line_copy(&connected_to_target, &target.chan1->connected);
+	connected_to_target.source = connected_to_transferee.source = AST_CONNECTED_LINE_UPDATE_SOURCE_TRANSFER;
 	res = attempt_transfer(current, &target);
 	sip_pvt_unlock(targetcall_pvt);
 	if (res) {
@@ -20486,8 +20493,6 @@
 			ast_channel_unlock(targetcall_pvt->owner);
 		ast_clear_flag(&transferer->flags[0], SIP_DEFER_BYE_ON_TRANSFER);
 	} else {
-		struct ast_party_connected_line connected_caller;
-
 		/* Transfer succeeded! */
 		const char *xfersound = pbx_builtin_getvar_helper(target.chan1, "ATTENDED_TRANSFER_COMPLETE_SOUND");
 
@@ -20503,45 +20508,29 @@
 			ast_channel_unlock(targetcall_pvt->owner);
 		}
 
-		ast_party_connected_line_init(&connected_caller);
+		/* By forcing the masquerade, we know that target.chan1 and target.chan2 are bridged. We then
+		 * can queue connected line updates where they need to go.
+		 *
+		 * No need to lock target.chan1 here since it was previously locked in get_sip_pvt_byid_locked
+		 */
+		if (target.chan1->masq) {
+			/* If the channel thread already did the masquerade, then we don't need to do anything */
+			ast_do_masquerade(target.chan1);
+		}
 		if (target.chan2) {
-			if (current->chan2) {
-				/* Tell each of the other channels to whom they are now connected */
-				ast_channel_lock(current->chan2);
-				ast_connected_line_copy_from_caller(&connected_caller, &current->chan2->cid);
-				ast_channel_unlock(current->chan2);
-				connected_caller.source = AST_CONNECTED_LINE_UPDATE_SOURCE_TRANSFER;
-				ast_channel_update_connected_line(target.chan2, &connected_caller);
-				ast_channel_lock(target.chan2);
-				ast_connected_line_copy_from_caller(&connected_caller, &target.chan2->cid);
-				ast_channel_unlock(target.chan2);
-				connected_caller.source = AST_CONNECTED_LINE_UPDATE_SOURCE_TRANSFER;
-				ast_channel_update_connected_line(current->chan2, &connected_caller);
-				ast_party_connected_line_free(&connected_caller);
-			}
+			ast_channel_queue_connected_line_update(target.chan1, &connected_to_transferee);
+			ast_channel_queue_connected_line_update(target.chan2, &connected_to_target);
 		} else {
-			/* Notify the first other party that they are connected to someone else assuming that target.chan1
-			   has progressed far enough through the dialplan to have its called party information set. */
-			if (current->chan2) {
-				ast_channel_lock(target.chan1);
-				ast_party_connected_line_copy(&connected_caller, &target.chan1->connected);
-				ast_channel_unlock(target.chan1);
-				connected_caller.source = AST_CONNECTED_LINE_UPDATE_SOURCE_TRANSFER;
-				ast_channel_update_connected_line(current->chan2, &connected_caller);
-				ast_party_connected_line_free(&connected_caller);
-			}
-
-			/* We can't indicate to the called channel directly so we force the masquerade to complete
-			   and queue and update to be read and passed-through */
-			ast_channel_lock(target.chan1);
-			ast_do_masquerade(target.chan1);
-			ast_channel_unlock(target.chan1);
-
-			ast_party_connected_line_collect_caller(&connected_caller, &target.chan1->cid);
-			connected_caller.source = AST_CONNECTED_LINE_UPDATE_SOURCE_TRANSFER;
-			ast_channel_queue_connected_line_update(target.chan1, &connected_caller);
-		}
-	}
+			/* Since target.chan1 isn't actually connected to another channel, there is no way for us
+			 * to queue a frame so that its connected line status will be updated. Instead, we have to
+			 * change it directly. Since we are not the channel thread, we cannot run a connected line
+			 * interception macro on target.chan1
+			 */
+			ast_channel_update_connected_line(target.chan1, &connected_to_target);
+		}
+	}
+	ast_party_connected_line_free(&connected_to_target);
+	ast_party_connected_line_free(&connected_to_transferee);
 	if (targetcall_pvt)
 		ao2_t_ref(targetcall_pvt, -1, "drop targetcall_pvt");
 	return 1;

Modified: team/snuffy/ao2_jabber_take2/channels/iax2-parser.c
URL: http://svn.asterisk.org/svn-view/asterisk/team/snuffy/ao2_jabber_take2/channels/iax2-parser.c?view=diff&rev=199222&r1=199221&r2=199222
==============================================================================
--- team/snuffy/ao2_jabber_take2/channels/iax2-parser.c (original)
+++ team/snuffy/ao2_jabber_take2/channels/iax2-parser.c Fri Jun  5 08:16:44 2009
@@ -573,7 +573,13 @@
 		"PROCDNG",
 		"HOLD   ",
 		"UNHOLD ",
-		"VIDUPDT", };
+		"VIDUPDT",
+		"T38    ",
+		"SRCUPDT",
+		"TXFER  ",
+		"CNLINE ",
+		"REDIR  ",
+	};
 	struct ast_iax2_full_hdr *fh;
 	char retries[20];
 	char class2[20];

Modified: team/snuffy/ao2_jabber_take2/configs/sip.conf.sample
URL: http://svn.asterisk.org/svn-view/asterisk/team/snuffy/ao2_jabber_take2/configs/sip.conf.sample?view=diff&rev=199222&r1=199221&r2=199222
==============================================================================
--- team/snuffy/ao2_jabber_take2/configs/sip.conf.sample (original)
+++ team/snuffy/ao2_jabber_take2/configs/sip.conf.sample Fri Jun  5 08:16:44 2009
@@ -475,7 +475,7 @@
 ;----------------------------------------- OUTBOUND SIP REGISTRATIONS  ------------------------
 ; Asterisk can register as a SIP user agent to a SIP proxy (provider)
 ; Format for the register statement is:
-;       register => [transport://]user[:secret[:authuser]]@domain[:port][/extension][~expiry]
+;       register => [transport://]user[@domain][:secret[:authuser]]@host[:port][/extension][~expiry]
 ;
 ;
 ;

Modified: team/snuffy/ao2_jabber_take2/contrib/scripts/meetme.sql
URL: http://svn.asterisk.org/svn-view/asterisk/team/snuffy/ao2_jabber_take2/contrib/scripts/meetme.sql?view=diff&rev=199222&r1=199221&r2=199222
==============================================================================
--- team/snuffy/ao2_jabber_take2/contrib/scripts/meetme.sql (original)
+++ team/snuffy/ao2_jabber_take2/contrib/scripts/meetme.sql Fri Jun  5 08:16:44 2009
@@ -4,9 +4,17 @@
 
 CREATE TABLE meetme (
 	confno char(80) DEFAULT '0' NOT NULL,
+	-- Must set schedule=yes in meetme.conf to use starttime and endtime
+	starttime datetime NULL,
+	endtime datetime NULL,
+	-- PIN to enter the conference, if any
 	pin char(20) NULL,
+	-- PIN to enter the conference as an administrator, if any
 	adminpin char(20) NULL,
+	-- Current count of conference participants
 	members integer DEFAULT 0 NOT NULL,
-	PRIMARY KEY (confno)
+	-- Maximum conference participants allowed concurrently
+	maxusers integer DEFAULT 0 NOT NULL,
+	PRIMARY KEY (confno, starttime)
 );
 

Modified: team/snuffy/ao2_jabber_take2/doc/tex/channelvariables.tex
URL: http://svn.asterisk.org/svn-view/asterisk/team/snuffy/ao2_jabber_take2/doc/tex/channelvariables.tex?view=diff&rev=199222&r1=199221&r2=199222
==============================================================================
--- team/snuffy/ao2_jabber_take2/doc/tex/channelvariables.tex (original)
+++ team/snuffy/ao2_jabber_take2/doc/tex/channelvariables.tex Fri Jun  5 08:16:44 2009
@@ -1005,3 +1005,10 @@
 ${OSPOUTTIMELIMIT}      Duration limit for out_bound call
 ${OSPRESULTS}           Number of remained destinations
 \end{verbatim}
+
+\subsection{Connected line digit manipulation}
+\begin{verbatim}
+${CONNECTED_LINE_SEND_CALLEE_MACRO}        Macro to call before sending a connected line update to the callee
+${CONNECTED_LINE_SEND_CALLEE_MACRO_ARGS}   Arguments to pass to ${CONNECTED_LINE_SEND_CALLEE_MACRO}
+${CONNECTED_LINE_SEND_CALLER_MACRO}        Macro to call before sending a connected line update to the caller
+${CONNECTED_LINE_SEND_CALLER_MACRO_ARGS}   Arguments to pass to ${CONNECTED_LINE_SEND_CALLER_MACRO}

Modified: team/snuffy/ao2_jabber_take2/funcs/func_math.c
URL: http://svn.asterisk.org/svn-view/asterisk/team/snuffy/ao2_jabber_take2/funcs/func_math.c?view=diff&rev=199222&r1=199221&r2=199222
==============================================================================
--- team/snuffy/ao2_jabber_take2/funcs/func_math.c (original)
+++ team/snuffy/ao2_jabber_take2/funcs/func_math.c Fri Jun  5 08:16:44 2009
@@ -1,9 +1,10 @@
 /*
  * Asterisk -- An open source telephony toolkit.
  *
- * Copyright (C) 2004 - 2006, Andy Powell 
+ * Copyright (C) 2004 - 2006, Andy Powell
  *
  * Updated by Mark Spencer <markster at digium.com>
+ * Updated by Nir Simionovich <nirs at greenfieldtech.net>
  *
  * See http://www.asterisk.org for more information about
  * the Asterisk project. Please do not directly contact
@@ -22,6 +23,7 @@
  *
  * \author Andy Powell
  * \author Mark Spencer <markster at digium.com>
+ * \author Nir Simionovich <nirs at greenfieldtech.net>
  *
  * \ingroup functions
  */
@@ -66,6 +68,40 @@
 			<para>Example: Set(i=${MATH(123%16,int)}) - sets var i=11</para>
 		</description>
 	</function>
+	<function name="INC" language="en_US">
+		<synopsis>
+			Increments the value of a variable, while returning the updated value to the dialplan
+		</synopsis>
+		<syntax>
+			<parameter name="variable" required="true">
+				<para>
+				The variable name to be manipulated, without the braces.
+				</para>
+			</parameter>
+		</syntax>
+		<description>
+			<para>Increments the value of a variable, while returning the updated value to the dialplan</para>
+			<para>Example: INC(MyVAR) - Increments MyVar</para>
+			<para>Note: INC(${MyVAR}) - Is wrong, as INC expects the variable name, not its value</para>
+		</description>
+	</function>
+	<function name="DEC" language="en_US">
+		<synopsis>
+			Decrements the value of a variable, while returning the updated value to the dialplan
+		</synopsis>
+		<syntax>
+			<parameter name="variable" required="true">
+				<para>
+				The variable name to be manipulated, without the braces.
+				</para>
+			</parameter>
+		</syntax>
+		<description>
+			<para>Decrements the value of a variable, while returning the updated value to the dialplan</para>
+			<para>Example: DEC(MyVAR) - Increments MyVar</para>
+			<para>Note: DEC(${MyVAR}) - Is wrong, as INC expects the variable name, not its value</para>
+		</description>
+	</function>
  ***/
 
 enum TypeOfFunctions {
@@ -333,19 +369,107 @@
 	return 0;
 }
 
+static int crement_function_read(struct ast_channel *chan, const char *cmd,
+                     char *data, char *buf, size_t len)
+{
+	int ret = -1;
+	int int_value = 0;
+	int modify_orig = 0;
+	const char *var;
+	char endchar = 0, returnvar[12]; /* If you need a variable longer than 11 digits - something is way wrong */
+
+	if (ast_strlen_zero(data)) {
+		ast_log(LOG_WARNING, "Syntax: %s(<data>) - missing argument!\n", cmd);
+		return -1;
+	}
+
+	ast_channel_lock(chan);
+
+	if (!(var = pbx_builtin_getvar_helper(chan, data))) {
+		ast_log(LOG_NOTICE, "Failed to obtain variable %s, bailing out\n", data);
+		ast_channel_unlock(chan);
+		return -1;
+	}
+
+	if (ast_strlen_zero(var)) {
+		ast_log(LOG_NOTICE, "Variable %s doesn't exist - are you sure you wrote it corrrectly?\n", data);
+		ast_channel_unlock(chan);
+		return -1;
+	}
+
+	if (sscanf(var, "%d%c", &int_value, &endchar) == 0 || endchar != 0) {
+		ast_log(LOG_NOTICE, "The content of ${%s} is not a numeric value - bailing out!\n", data);
+		ast_channel_unlock(chan);
+		return -1;
+	}
+
+	/* now we'll actually do something useful */
+	if (!strcasecmp(cmd, "INC")) {              /* Increment variable */
+		int_value++;
+		modify_orig = 1;
+	} else if (!strcasecmp(cmd, "DEC")) {       /* Decrement variable */
+		int_value--;
+		modify_orig = 1;
+	}
+
+	ast_log(LOG_NOTICE, "The value is now: %d\n", int_value);
+
+	if (snprintf(returnvar, sizeof(returnvar), "%d", int_value) > 0) {
+		pbx_builtin_setvar_helper(chan, data, returnvar);
+		if (modify_orig) {
+			ast_copy_string(buf, returnvar, len);
+		}
+		ret = 0;
+	} else {
+		pbx_builtin_setvar_helper(chan, data, "0");
+		if (modify_orig) {
+			ast_copy_string(buf, "0", len);
+		}
+		ast_log(LOG_NOTICE, "Variable %s refused to be %sREMENTED, setting value to 0", data, cmd);
+		ret = 0;
+	}
+
+	ast_channel_unlock(chan);
+
+	return ret;
+}
+
+
 static struct ast_custom_function math_function = {
 	.name = "MATH",
 	.read = math
 };
 
+static struct ast_custom_function increment_function = {
+	.name = "INC",
+	.read = crement_function_read,
+};
+
+static struct ast_custom_function decrement_function = {
+	.name = "DEC",
+	.read = crement_function_read,
+};
+
 static int unload_module(void)
 {
-	return ast_custom_function_unregister(&math_function);
+	int res = 0;
+
+	res |= ast_custom_function_unregister(&math_function);
+	res |= ast_custom_function_unregister(&increment_function);
+	res |= ast_custom_function_unregister(&decrement_function);
+
+	return res;
 }
 
 static int load_module(void)
 {
-	return ast_custom_function_register(&math_function);
+	int res = 0;
+
+	res |= ast_custom_function_register(&math_function);
+	res |= ast_custom_function_register(&increment_function);
+	res |= ast_custom_function_register(&decrement_function);
+
+	return res;
 }
 
 AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Mathematical dialplan function");

Modified: team/snuffy/ao2_jabber_take2/funcs/func_strings.c
URL: http://svn.asterisk.org/svn-view/asterisk/team/snuffy/ao2_jabber_take2/funcs/func_strings.c?view=diff&rev=199222&r1=199221&r2=199222
==============================================================================
--- team/snuffy/ao2_jabber_take2/funcs/func_strings.c (original)
+++ team/snuffy/ao2_jabber_take2/funcs/func_strings.c Fri Jun  5 08:16:44 2009
@@ -51,7 +51,12 @@
 			<parameter name="delim" required="true" />
 		</syntax>
 		<description>
-			<para>Example: ${FIELDQTY(ex-amp-le,-)} returns 3</para>
+			<para>The delimiter may be specified as a special or extended ASCII character, by encoding it.  The characters
+			<literal>\n</literal>, <literal>\r</literal>, and <literal>\t</literal> are all recognized as the newline,
+			carriage return, and tab characters, respectively.  Also, octal and hexadecimal specifications are recognized
+			by the patterns <literal>\0nnn</literal> and <literal>\xHH</literal>, respectively.  For example, if you wanted
+			to encode a comma as the delimiter, you could use either <literal>\054</literal> or <literal>\x2C</literal>.</para>
+			<para>Example: If ${example} contains <literal>ex-amp-le</literal>, then ${FIELDQTY(example,-)} returns 3.</para>
 		</description>
 	</function>
 	<function name="LISTFILTER" language="en_US">

Modified: team/snuffy/ao2_jabber_take2/include/asterisk/_private.h
URL: http://svn.asterisk.org/svn-view/asterisk/team/snuffy/ao2_jabber_take2/include/asterisk/_private.h?view=diff&rev=199222&r1=199221&r2=199222
==============================================================================
--- team/snuffy/ao2_jabber_take2/include/asterisk/_private.h (original)
+++ team/snuffy/ao2_jabber_take2/include/asterisk/_private.h Fri Jun  5 08:16:44 2009
@@ -60,6 +60,18 @@
  */
 int ast_module_reload(const char *name);
 
+/*!
+ * \brief Process reload requests received during startup.
+ *
+ * This function requests that the loader execute the pending reload requests
+ * that were queued during server startup.
+ *
+ * \note This function will do nothing if the server has not completely started
+ *       up.  Once called, the reload queue is emptied, and further invocations
+ *       will have no affect.
+ */
+void ast_process_pending_reloads(void);
+
 /*! \brief Load XML documentation. Provided by xmldoc.c 
  *  \retval 1 on error.
  *  \retval 0 on success. 

Modified: team/snuffy/ao2_jabber_take2/include/asterisk/app.h
URL: http://svn.asterisk.org/svn-view/asterisk/team/snuffy/ao2_jabber_take2/include/asterisk/app.h?view=diff&rev=199222&r1=199221&r2=199222
==============================================================================
--- team/snuffy/ao2_jabber_take2/include/asterisk/app.h (original)
+++ team/snuffy/ao2_jabber_take2/include/asterisk/app.h Fri Jun  5 08:16:44 2009
@@ -109,6 +109,26 @@
 int ast_app_getdata_full(struct ast_channel *c, const char *prompt, char *s, int maxlen, int timeout, int audiofd, int ctrlfd);
 
 /*!
+ * \since 1.6.3
+ * \brief Run a macro on a channel, placing a second channel into autoservice.
+ *
+ * This is a shorthand method that makes it very easy to run a macro on any given 
+ * channel. It is perfectly reasonable to supply a NULL autoservice_chan here in case
+ * there is no channel to place into autoservice. It is very important that the 
+ * autoservice_chan parameter is not locked prior to calling ast_app_run_macro. A 
+ * deadlock could result, otherwise.
+ *
+ * \param autoservice_chan A channel to place into autoservice while the macro is run
+ * \param macro_chan The channel to run the macro on
+ * \param macro_name The name of the macro to run
+ * \param macro_args The arguments to pass to the macro
+ * \retval 0 success
+ * \retval -1 failure
+ */
+int ast_app_run_macro(struct ast_channel *autoservice_chan, struct ast_channel 
+		*macro_chan, const char * const macro_name, const char * const macro_args);
+
+/*!
  * \brief Set voicemail function callbacks
  * \param[in] inboxcount2_func set function pointer
  * \param[in] sayname_func set function pointer

Modified: team/snuffy/ao2_jabber_take2/include/asterisk/channel.h
URL: http://svn.asterisk.org/svn-view/asterisk/team/snuffy/ao2_jabber_take2/include/asterisk/channel.h?view=diff&rev=199222&r1=199221&r2=199222
==============================================================================
--- team/snuffy/ao2_jabber_take2/include/asterisk/channel.h (original)
+++ team/snuffy/ao2_jabber_take2/include/asterisk/channel.h Fri Jun  5 08:16:44 2009
@@ -929,7 +929,7 @@
  *
  * \note The channel does not need to be locked before calling this function.
  */
-int ast_queue_frame(struct ast_channel *chan, struct ast_frame *f);
+int ast_queue_frame(struct ast_channel *chan, const struct ast_frame *f);
 
 /*!
  * \brief Queue an outgoing frame to the head of the frame queue
@@ -943,7 +943,7 @@
  * \retval 0 success
  * \retval non-zero failure
  */
-int ast_queue_frame_head(struct ast_channel *chan, struct ast_frame *f);
+int ast_queue_frame_head(struct ast_channel *chan, const struct ast_frame *f);
 
 /*!
  * \brief Queue a hangup frame
@@ -1079,6 +1079,18 @@
  */
 struct ast_channel *__ast_request_and_dial(const char *type, int format, void *data,
 	int timeout, int *reason, const char *cid_num, const char *cid_name, struct outgoing_helper *oh);
+
+/*!
+ * \brief Forwards a call to a new channel specified by the original channel's call_forward str.  If possible, the new forwarded channel is created and returned while the original one is terminated.
+ * \param caller in channel that requested orig
+ * \param orig channel being replaced by the call forward channel
+ * \param timeout maximum amount of time to wait for setup of new forward channel
+ * \param format requested channel format
+ * \param oh outgoing helper used with original channel
+ * \param outstate reason why unsuccessful (if uncuccessful)
+ * \return Returns the forwarded call's ast_channel on success or NULL on failure
+ */
+struct ast_channel *ast_call_forward(struct ast_channel *caller, struct ast_channel *orig, int *timeout, int format, struct outgoing_helper *oh, int *outstate);
 
 /*!
  * \brief Register a channel technology (a new channel driver)
@@ -2550,6 +2562,34 @@
  */
 void ast_channel_queue_redirecting_update(struct ast_channel *chan, const struct ast_party_redirecting *redirecting);
 
+/*!
+ * \since 1.6.3
+ * \brief Run a connected line interception macro and update a channel's connected line
+ * information
+ *
+ * Whenever we want to update a channel's connected line information, we may need to run
+ * a macro so that an administrator can manipulate the information before sending it 
+ * out. This function both runs the macro and sends the update to the channel.
+ *
+ * \param autoservice_chan Channel to place into autoservice while the macro is running. 
+ * 	It is perfectly safe for this to be NULL 
+ * \param macro_chan The channel to run the macro on. Also the channel from which we 
+ * 	determine which macro we need to run.
+ * \param connected_info Either an ast_party_connected_line or ast_frame pointer of type 
+ * 	AST_CONTROL_CONNECTED_LINE
+ * \param caller If true, then run CONNECTED_LINE_CALLER_SEND_MACRO, otherwise run 
+ * 	CONNECTED_LINE_CALLEE_SEND_MACRO
+ * \param frame If true, then connected_info is an ast_frame pointer, otherwise it is an 
+ * 	ast_party_connected_line pointer.
+ * \retval 0 Success
+ * \retval -1 Either the macro does not exist, or there was an error while attempting to 
+ * 	run the macro
+ *
+ * \todo Have multiple return codes based on the MACRO_RESULT
+ * \todo Make constants so that caller and frame can be more expressive than just '1' and
+ * 	'0'
+ */
+int ast_channel_connected_line_macro(struct ast_channel *autoservice_chan, struct ast_channel *macro_chan, const void *connected_info, int caller, int frame);
 #if defined(__cplusplus) || defined(c_plusplus)
 }
 #endif

Modified: team/snuffy/ao2_jabber_take2/include/asterisk/frame.h
URL: http://svn.asterisk.org/svn-view/asterisk/team/snuffy/ao2_jabber_take2/include/asterisk/frame.h?view=diff&rev=199222&r1=199221&r2=199222
==============================================================================
--- team/snuffy/ao2_jabber_take2/include/asterisk/frame.h (original)
+++ team/snuffy/ao2_jabber_take2/include/asterisk/frame.h Fri Jun  5 08:16:44 2009
@@ -322,8 +322,8 @@
 	AST_CONTROL_T38 = 19,		/*!< T38 state change request/notification */
 	AST_CONTROL_SRCUPDATE = 20,     /*!< Indicate source of media has changed */
 	AST_CONTROL_TRANSFER = 21,      /*!< Indicate status of a transfer request */
-	AST_CONTROL_CONNECTED_LINE = 22,  /*!< Indicate connected line has changed */
-	AST_CONTROL_REDIRECTING = 23	/*!< Indicate redirecting id has changed */
+	AST_CONTROL_CONNECTED_LINE = 22,/*!< Indicate connected line has changed */
+	AST_CONTROL_REDIRECTING = 23    /*!< Indicate redirecting id has changed */
 };
 
 enum ast_control_t38 {

Modified: team/snuffy/ao2_jabber_take2/main/Makefile
URL: http://svn.asterisk.org/svn-view/asterisk/team/snuffy/ao2_jabber_take2/main/Makefile?view=diff&rev=199222&r1=199221&r2=199222
==============================================================================
--- team/snuffy/ao2_jabber_take2/main/Makefile (original)
+++ team/snuffy/ao2_jabber_take2/main/Makefile Fri Jun  5 08:16:44 2009
@@ -25,10 +25,6 @@
 # otherwise modules will not have them available if none of the static
 # objects use it.
 OBJS+=stdtime/localtime.o
-
-# At the moment say.o is an optional component which can be overridden
-# by a module.
-OBJS+=say.o
 
 AST_LIBS += $(OPENSSL_LIB)
 AST_LIBS += $(BKTR_LIB)

Modified: team/snuffy/ao2_jabber_take2/main/app.c
URL: http://svn.asterisk.org/svn-view/asterisk/team/snuffy/ao2_jabber_take2/main/app.c?view=diff&rev=199222&r1=199221&r2=199222
==============================================================================
--- team/snuffy/ao2_jabber_take2/main/app.c (original)
+++ team/snuffy/ao2_jabber_take2/main/app.c Fri Jun  5 08:16:44 2009
@@ -200,6 +200,28 @@
 
 	res = ast_readstring_full(c, s, maxlen, to, fto, "#", audiofd, ctrlfd);
 
+	return res;
+}
+
+int ast_app_run_macro(struct ast_channel *autoservice_chan, struct ast_channel *macro_chan, const char * const macro_name, const char * const macro_args)
+{
+	struct ast_app *macro_app;
+	int res;
+	char buf[1024];
+
+	macro_app = pbx_findapp("Macro");
+	if (!macro_app) {
+		ast_log(LOG_WARNING, "Cannot run macro '%s' because the 'Macro' application in not available\n", macro_name);
+		return -1;
+	}

[... 1530 lines stripped ...]



More information about the svn-commits mailing list