[asterisk-commits] loren: branch loren/sdp-parser r276613 - in /team/loren/sdp-parser/channels: ...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Jul 14 20:47:07 CDT 2010


Author: loren
Date: Wed Jul 14 20:47:01 2010
New Revision: 276613

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=276613
Log:
resolve conflicts and re-enable automerge

Modified:
    team/loren/sdp-parser/channels/   (props changed)
    team/loren/sdp-parser/channels/chan_agent.c
    team/loren/sdp-parser/channels/chan_console.c
    team/loren/sdp-parser/channels/chan_dahdi.c
    team/loren/sdp-parser/channels/chan_gtalk.c
    team/loren/sdp-parser/channels/chan_h323.c
    team/loren/sdp-parser/channels/chan_iax2.c
    team/loren/sdp-parser/channels/chan_jingle.c
    team/loren/sdp-parser/channels/chan_local.c
    team/loren/sdp-parser/channels/chan_mgcp.c
    team/loren/sdp-parser/channels/chan_misdn.c
    team/loren/sdp-parser/channels/chan_multicast_rtp.c
    team/loren/sdp-parser/channels/chan_oss.c
    team/loren/sdp-parser/channels/chan_phone.c
    team/loren/sdp-parser/channels/chan_sip.c
    team/loren/sdp-parser/channels/chan_skinny.c
    team/loren/sdp-parser/channels/chan_unistim.c
    team/loren/sdp-parser/channels/chan_usbradio.c
    team/loren/sdp-parser/channels/chan_vpb.cc
    team/loren/sdp-parser/channels/sig_analog.c
    team/loren/sdp-parser/channels/sig_analog.h
    team/loren/sdp-parser/channels/sig_pri.c
    team/loren/sdp-parser/channels/sig_ss7.c
    team/loren/sdp-parser/channels/sip/config_parser.c
    team/loren/sdp-parser/channels/sip/dialplan_functions.c
    team/loren/sdp-parser/channels/sip/include/dialog.h
    team/loren/sdp-parser/channels/sip/include/globals.h
    team/loren/sdp-parser/channels/sip/include/reqresp_parser.h
    team/loren/sdp-parser/channels/sip/include/sip.h
    team/loren/sdp-parser/channels/sip/reqresp_parser.c

Propchange: team/loren/sdp-parser/channels/
------------------------------------------------------------------------------
--- automerge (original)
+++ automerge Wed Jul 14 20:47:01 2010
@@ -1,1 +1,1 @@
-addons
+*

Modified: team/loren/sdp-parser/channels/chan_agent.c
URL: http://svnview.digium.com/svn/asterisk/team/loren/sdp-parser/channels/chan_agent.c?view=diff&rev=276613&r1=276612&r2=276613
==============================================================================
--- team/loren/sdp-parser/channels/chan_agent.c (original)
+++ team/loren/sdp-parser/channels/chan_agent.c Wed Jul 14 20:47:01 2010
@@ -67,6 +67,7 @@
 #include "asterisk/monitor.h"
 #include "asterisk/stringfields.h"
 #include "asterisk/event.h"
+#include "asterisk/data.h"
 
 /*** DOCUMENTATION
 	<application name="AgentLogin" language="en_US">
@@ -278,6 +279,19 @@
 	AST_LIST_ENTRY(agent_pvt) list;	/**< Next Agent in the linked list. */
 };
 
+#define DATA_EXPORT_AGENT(MEMBER)				\
+	MEMBER(agent_pvt, autologoff, AST_DATA_INTEGER)		\
+	MEMBER(agent_pvt, ackcall, AST_DATA_BOOLEAN)		\
+	MEMBER(agent_pvt, deferlogoff, AST_DATA_BOOLEAN)	\
+	MEMBER(agent_pvt, wrapuptime, AST_DATA_MILLISECONDS)	\
+	MEMBER(agent_pvt, acknowledged, AST_DATA_BOOLEAN)	\
+	MEMBER(agent_pvt, name, AST_DATA_STRING)		\
+	MEMBER(agent_pvt, password, AST_DATA_PASSWORD)		\
+	MEMBER(agent_pvt, acceptdtmf, AST_DATA_CHARACTER)	\
+	MEMBER(agent_pvt, logincallerid, AST_DATA_STRING)
+
+AST_DATA_STRUCTURE(agent_pvt, DATA_EXPORT_AGENT);
+
 static AST_LIST_HEAD_STATIC(agents, agent_pvt);	/*!< Holds the list of agents (loaded form agents.conf). */
 
 #define CHECK_FORMATS(ast, p) do { \
@@ -1496,16 +1510,17 @@
 		if (p->chan) {
 			loginChan = ast_strdupa(p->chan->name);
 			if (p->owner && p->owner->_bridge) {
-				talkingto = p->chan->cid.cid_num;
+				talkingto = S_COR(p->chan->caller.id.number.valid,
+					p->chan->caller.id.number.str, "n/a");
 				if (ast_bridged_channel(p->owner))
 					talkingtoChan = ast_strdupa(ast_bridged_channel(p->owner)->name);
 				else
 					talkingtoChan = "n/a";
-        			status = "AGENT_ONCALL";
+				status = "AGENT_ONCALL";
 			} else {
 				talkingto = "n/a";
 				talkingtoChan = "n/a";
-        			status = "AGENT_IDLE";
+				status = "AGENT_IDLE";
 			}
 		} else {
 			loginChan = "n/a";
@@ -2155,10 +2170,12 @@
 		if (strchr(data, 'c'))
 			changeoutgoing = 1;
 	}
-	if (chan->cid.cid_num) {
+	if (chan->caller.id.number.valid
+		&& !ast_strlen_zero(chan->caller.id.number.str)) {
 		const char *tmp;
 		char agentvar[AST_MAX_BUF];
-		snprintf(agentvar, sizeof(agentvar), "%s_%s", GETAGENTBYCALLERID, chan->cid.cid_num);
+		snprintf(agentvar, sizeof(agentvar), "%s_%s", GETAGENTBYCALLERID,
+			chan->caller.id.number.str);
 		if ((tmp = pbx_builtin_getvar_helper(NULL, agentvar))) {
 			struct agent_pvt *p;
 			ast_copy_string(agent, tmp, sizeof(agent));
@@ -2321,6 +2338,75 @@
 	.read = function_agent,
 };
 
+/*!
+ * \internal
+ * \brief Callback used to generate the agents tree.
+ * \param[in] search The search pattern tree.
+ * \retval NULL on error.
+ * \retval non-NULL The generated tree.
+ */
+static int agents_data_provider_get(const struct ast_data_search *search,
+	struct ast_data *data_root)
+{
+	struct agent_pvt *p;
+	struct ast_data *data_agent, *data_channel, *data_talkingto;
+
+	AST_LIST_LOCK(&agents);
+	AST_LIST_TRAVERSE(&agents, p, list) {
+		data_agent = ast_data_add_node(data_root, "agent");
+		if (!data_agent) {
+			continue;
+		}
+
+		ast_mutex_lock(&p->lock);
+		if (!(p->pending)) {
+			ast_data_add_str(data_agent, "id", p->agent);
+			ast_data_add_structure(agent_pvt, data_agent, p);
+
+			ast_data_add_bool(data_agent, "logged", p->chan ? 1 : 0);
+			if (p->chan) {
+				data_channel = ast_data_add_node(data_agent, "loggedon");
+				if (!data_channel) {
+					ast_mutex_unlock(&p->lock);
+					ast_data_remove_node(data_root, data_agent);
+					continue;
+				}
+				ast_channel_data_add_structure(data_channel, p->chan, 0);
+				if (p->owner && ast_bridged_channel(p->owner)) {
+					data_talkingto = ast_data_add_node(data_agent, "talkingto");
+					if (!data_talkingto) {
+						ast_mutex_unlock(&p->lock);
+						ast_data_remove_node(data_root, data_agent);
+						continue;
+					}
+					ast_channel_data_add_structure(data_talkingto, ast_bridged_channel(p->owner), 0);
+				}
+			} else {
+				ast_data_add_node(data_agent, "talkingto");
+				ast_data_add_node(data_agent, "loggedon");
+			}
+			ast_data_add_str(data_agent, "musiconhold", p->moh);
+		}
+		ast_mutex_unlock(&p->lock);
+
+		/* if this agent doesn't match remove the added agent. */
+		if (!ast_data_search_match(search, data_agent)) {
+			ast_data_remove_node(data_root, data_agent);
+		}
+	}
+	AST_LIST_UNLOCK(&agents);
+
+	return 0;
+}
+
+static const struct ast_data_handler agents_data_provider = {
+	.version = AST_DATA_HANDLER_VERSION,
+	.get = agents_data_provider_get
+};
+
+static const struct ast_data_entry agents_data_providers[] = {
+	AST_DATA_ENTRY("asterisk/channel/agent/list", &agents_data_provider),
+};
 
 /*!
  * \brief Initialize the Agents module.
@@ -2342,6 +2428,9 @@
 	/* Dialplan applications */
 	ast_register_application_xml(app, login_exec);
 	ast_register_application_xml(app3, agentmonitoroutgoing_exec);
+
+	/* data tree */
+	ast_data_register_multiple(agents_data_providers, ARRAY_LEN(agents_data_providers));
 
 	/* Manager commands */
 	ast_manager_register_xml("Agents", EVENT_FLAG_AGENT, action_agents);
@@ -2376,6 +2465,8 @@
 	/* Unregister manager command */
 	ast_manager_unregister("Agents");
 	ast_manager_unregister("AgentLogoff");
+	/* Unregister the data tree */
+	ast_data_unregister(NULL);
 	/* Unregister channel */
 	AST_LIST_LOCK(&agents);
 	/* Hangup all interfaces if they have an owner */

Modified: team/loren/sdp-parser/channels/chan_console.c
URL: http://svnview.digium.com/svn/asterisk/team/loren/sdp-parser/channels/chan_console.c?view=diff&rev=276613&r1=276612&r2=276613
==============================================================================
--- team/loren/sdp-parser/channels/chan_console.c (original)
+++ team/loren/sdp-parser/channels/chan_console.c Wed Jul 14 20:47:01 2010
@@ -566,7 +566,9 @@
 	enum ast_control_frame_type ctrl;
 
 	ast_verb(1, V_BEGIN "Call to device '%s' on console from '%s' <%s>" V_END,
-		dest, c->cid.cid_name, c->cid.cid_num);
+		dest,
+		S_COR(c->caller.id.name.valid, c->caller.id.name.str, ""),
+		S_COR(c->caller.id.number.valid, c->caller.id.number.str, ""));
 
 	console_pvt_lock(pvt);
 

Modified: team/loren/sdp-parser/channels/chan_dahdi.c
URL: http://svnview.digium.com/svn/asterisk/team/loren/sdp-parser/channels/chan_dahdi.c?view=diff&rev=276613&r1=276612&r2=276613
==============================================================================
--- team/loren/sdp-parser/channels/chan_dahdi.c (original)
+++ team/loren/sdp-parser/channels/chan_dahdi.c Wed Jul 14 20:47:01 2010
@@ -117,6 +117,7 @@
 #include "asterisk/devicestate.h"
 #include "asterisk/paths.h"
 #include "asterisk/ccss.h"
+#include "asterisk/data.h"
 
 /*** DOCUMENTATION
 	<application name="DAHDISendKeypadFacility" language="en_US">
@@ -1204,6 +1205,77 @@
 	char dialstring[AST_CHANNEL_NAME];
 };
 
+#define DATA_EXPORT_DAHDI_PVT(MEMBER)					\
+	MEMBER(dahdi_pvt, cid_rxgain, AST_DATA_DOUBLE)			\
+	MEMBER(dahdi_pvt, rxgain, AST_DATA_DOUBLE)			\
+	MEMBER(dahdi_pvt, txgain, AST_DATA_DOUBLE)			\
+	MEMBER(dahdi_pvt, txdrc, AST_DATA_DOUBLE)			\
+	MEMBER(dahdi_pvt, rxdrc, AST_DATA_DOUBLE)			\
+	MEMBER(dahdi_pvt, adsi, AST_DATA_BOOLEAN)			\
+	MEMBER(dahdi_pvt, answeronpolarityswitch, AST_DATA_BOOLEAN)	\
+	MEMBER(dahdi_pvt, busydetect, AST_DATA_BOOLEAN)			\
+	MEMBER(dahdi_pvt, callreturn, AST_DATA_BOOLEAN)			\
+	MEMBER(dahdi_pvt, callwaiting, AST_DATA_BOOLEAN)		\
+	MEMBER(dahdi_pvt, callwaitingcallerid, AST_DATA_BOOLEAN)	\
+	MEMBER(dahdi_pvt, cancallforward, AST_DATA_BOOLEAN)		\
+	MEMBER(dahdi_pvt, canpark, AST_DATA_BOOLEAN)			\
+	MEMBER(dahdi_pvt, confirmanswer, AST_DATA_BOOLEAN)		\
+	MEMBER(dahdi_pvt, destroy, AST_DATA_BOOLEAN)			\
+	MEMBER(dahdi_pvt, didtdd, AST_DATA_BOOLEAN)			\
+	MEMBER(dahdi_pvt, dialednone, AST_DATA_BOOLEAN)			\
+	MEMBER(dahdi_pvt, dialing, AST_DATA_BOOLEAN)			\
+	MEMBER(dahdi_pvt, digital, AST_DATA_BOOLEAN)			\
+	MEMBER(dahdi_pvt, dnd, AST_DATA_BOOLEAN)			\
+	MEMBER(dahdi_pvt, echobreak, AST_DATA_BOOLEAN)			\
+	MEMBER(dahdi_pvt, echocanbridged, AST_DATA_BOOLEAN)		\
+	MEMBER(dahdi_pvt, echocanon, AST_DATA_BOOLEAN)			\
+	MEMBER(dahdi_pvt, faxhandled, AST_DATA_BOOLEAN)			\
+	MEMBER(dahdi_pvt, usefaxbuffers, AST_DATA_BOOLEAN)		\
+	MEMBER(dahdi_pvt, bufferoverrideinuse, AST_DATA_BOOLEAN)	\
+	MEMBER(dahdi_pvt, firstradio, AST_DATA_BOOLEAN)			\
+	MEMBER(dahdi_pvt, hanguponpolarityswitch, AST_DATA_BOOLEAN)	\
+	MEMBER(dahdi_pvt, hardwaredtmf, AST_DATA_BOOLEAN)		\
+	MEMBER(dahdi_pvt, hidecallerid, AST_DATA_BOOLEAN)		\
+	MEMBER(dahdi_pvt, hidecalleridname, AST_DATA_BOOLEAN)		\
+	MEMBER(dahdi_pvt, ignoredtmf, AST_DATA_BOOLEAN)			\
+	MEMBER(dahdi_pvt, immediate, AST_DATA_BOOLEAN)			\
+	MEMBER(dahdi_pvt, inalarm, AST_DATA_BOOLEAN)			\
+	MEMBER(dahdi_pvt, mate, AST_DATA_BOOLEAN)			\
+	MEMBER(dahdi_pvt, outgoing, AST_DATA_BOOLEAN)			\
+	MEMBER(dahdi_pvt, permcallwaiting, AST_DATA_BOOLEAN)		\
+	MEMBER(dahdi_pvt, priindication_oob, AST_DATA_BOOLEAN)		\
+	MEMBER(dahdi_pvt, priexclusive, AST_DATA_BOOLEAN)		\
+	MEMBER(dahdi_pvt, pulse, AST_DATA_BOOLEAN)			\
+	MEMBER(dahdi_pvt, pulsedial, AST_DATA_BOOLEAN)			\
+	MEMBER(dahdi_pvt, restartpending, AST_DATA_BOOLEAN)		\
+	MEMBER(dahdi_pvt, restrictcid, AST_DATA_BOOLEAN)		\
+	MEMBER(dahdi_pvt, threewaycalling, AST_DATA_BOOLEAN)		\
+	MEMBER(dahdi_pvt, transfer, AST_DATA_BOOLEAN)			\
+	MEMBER(dahdi_pvt, use_callerid, AST_DATA_BOOLEAN)		\
+	MEMBER(dahdi_pvt, use_callingpres, AST_DATA_BOOLEAN)		\
+	MEMBER(dahdi_pvt, usedistinctiveringdetection, AST_DATA_BOOLEAN)	\
+	MEMBER(dahdi_pvt, dahditrcallerid, AST_DATA_BOOLEAN)			\
+	MEMBER(dahdi_pvt, transfertobusy, AST_DATA_BOOLEAN)			\
+	MEMBER(dahdi_pvt, mwimonitor_neon, AST_DATA_BOOLEAN)			\
+	MEMBER(dahdi_pvt, mwimonitor_fsk, AST_DATA_BOOLEAN)			\
+	MEMBER(dahdi_pvt, mwimonitor_rpas, AST_DATA_BOOLEAN)			\
+	MEMBER(dahdi_pvt, mwimonitoractive, AST_DATA_BOOLEAN)			\
+	MEMBER(dahdi_pvt, mwisendactive, AST_DATA_BOOLEAN)			\
+	MEMBER(dahdi_pvt, inservice, AST_DATA_BOOLEAN)				\
+	MEMBER(dahdi_pvt, locallyblocked, AST_DATA_BOOLEAN)			\
+	MEMBER(dahdi_pvt, remotelyblocked, AST_DATA_BOOLEAN)			\
+	MEMBER(dahdi_pvt, manages_span_alarms, AST_DATA_BOOLEAN)		\
+	MEMBER(dahdi_pvt, use_smdi, AST_DATA_BOOLEAN)				\
+	MEMBER(dahdi_pvt, context, AST_DATA_STRING)				\
+	MEMBER(dahdi_pvt, defcontext, AST_DATA_STRING)				\
+	MEMBER(dahdi_pvt, exten, AST_DATA_STRING)				\
+	MEMBER(dahdi_pvt, language, AST_DATA_STRING)				\
+	MEMBER(dahdi_pvt, mohinterpret, AST_DATA_STRING)			\
+	MEMBER(dahdi_pvt, mohsuggest, AST_DATA_STRING)				\
+	MEMBER(dahdi_pvt, parkinglot, AST_DATA_STRING)
+
+AST_DATA_STRUCTURE(dahdi_pvt, DATA_EXPORT_DAHDI_PVT);
+
 static struct dahdi_pvt *iflist = NULL;	/*!< Main interface list start */
 static struct dahdi_pvt *ifend = NULL;	/*!< Main interface list end */
 
@@ -1815,7 +1887,7 @@
 	return 0;
 }
 
-static int my_send_callerid(void *pvt, int cwcid, struct ast_callerid *cid)
+static int my_send_callerid(void *pvt, int cwcid, struct ast_party_caller *caller)
 {
 	struct dahdi_pvt *p = pvt;
 
@@ -1828,11 +1900,17 @@
 
 	if ((p->cidspill = ast_malloc(MAX_CALLERID_SIZE))) {
 		if (cwcid == 0) {
-			p->cidlen = ast_callerid_generate(p->cidspill, cid->cid_name, cid->cid_num, AST_LAW(p));
+			p->cidlen = ast_callerid_generate(p->cidspill,
+				caller->id.name.str,
+				caller->id.number.str,
+				AST_LAW(p));
 		} else {
 			p->callwaitcas = 0;
 			p->cidcwexpire = 0;
-			p->cidlen = ast_callerid_callwaiting_generate(p->cidspill, cid->cid_name, cid->cid_num, AST_LAW(p));
+			p->cidlen = ast_callerid_callwaiting_generate(p->cidspill,
+				caller->id.name.str,
+				caller->id.number.str,
+				AST_LAW(p));
 			p->cidlen += READ_SIZE * 4;
 		}
 		p->cidpos = 0;
@@ -1943,7 +2021,8 @@
 				 */
 				ast_mutex_unlock(&p->lock);
 				ast_channel_unlock(ast);
-				if (ast_exists_extension(ast, target_context, "fax", 1, ast->cid.cid_num)) {
+				if (ast_exists_extension(ast, target_context, "fax", 1,
+					S_COR(ast->caller.id.number.valid, ast->caller.id.number.str, NULL))) {
 					ast_channel_lock(ast);
 					ast_mutex_lock(&p->lock);
 					ast_verb(3, "Redirecting %s to fax extension\n", ast->name);
@@ -2838,20 +2917,23 @@
 {
 	struct dahdi_pvt *p = pvt;
 
-	ast_copy_string(p->cid_num, S_OR(caller->id.number, ""), sizeof(p->cid_num));
-	ast_copy_string(p->cid_name, S_OR(caller->id.name, ""), sizeof(p->cid_name));
-	if (caller->id.subaddress.valid) {
-		ast_copy_string(p->cid_subaddr, S_OR(caller->id.subaddress.str, ""),
-			sizeof(p->cid_subaddr));
-	} else {
-		p->cid_subaddr[0] = '\0';
-	}
-	p->cid_ton = caller->id.number_type;
-	p->callingpres = caller->id.number_presentation;
+	ast_copy_string(p->cid_num,
+		S_COR(caller->id.number.valid, caller->id.number.str, ""),
+		sizeof(p->cid_num));
+	ast_copy_string(p->cid_name,
+		S_COR(caller->id.name.valid, caller->id.name.str, ""),
+		sizeof(p->cid_name));
+	ast_copy_string(p->cid_subaddr,
+		S_COR(caller->id.subaddress.valid, caller->id.subaddress.str, ""),
+		sizeof(p->cid_subaddr));
+	p->cid_ton = caller->id.number.plan;
+	p->callingpres = ast_party_id_presentation(&caller->id);
 	if (caller->id.tag) {
 		ast_copy_string(p->cid_tag, caller->id.tag, sizeof(p->cid_tag));
 	}
-	ast_copy_string(p->cid_ani, S_OR(caller->ani, ""), sizeof(p->cid_ani));
+	ast_copy_string(p->cid_ani,
+		S_COR(caller->ani.number.valid, caller->ani.number.str, ""),
+		sizeof(p->cid_ani));
 	p->cid_ani2 = caller->ani2;
 }
 #endif	/* defined(HAVE_PRI) || defined(HAVE_SS7) */
@@ -5065,7 +5147,7 @@
 			c = "";
 		}
 		if (!p->hidecallerid) {
-			l = ast->cid.cid_num;
+			l = ast->caller.id.number.valid ? ast->caller.id.number.str : NULL;
 		} else {
 			l = NULL;
 		}
@@ -7314,7 +7396,8 @@
 				 */
 				ast_mutex_unlock(&p->lock);
 				ast_channel_unlock(ast);
-				if (ast_exists_extension(ast, target_context, "fax", 1, ast->cid.cid_num)) {
+				if (ast_exists_extension(ast, target_context, "fax", 1,
+					S_COR(ast->caller.id.number.valid, ast->caller.id.number.str, NULL))) {
 					ast_channel_lock(ast);
 					ast_mutex_lock(&p->lock);
 					ast_verb(3, "Redirecting %s to fax extension\n", ast->name);
@@ -7951,10 +8034,16 @@
 					cid_num[0] = 0;
 					cid_name[0] = 0;
 					if (p->dahditrcallerid && p->owner) {
-						if (p->owner->cid.cid_num)
-							ast_copy_string(cid_num, p->owner->cid.cid_num, sizeof(cid_num));
-						if (p->owner->cid.cid_name)
-							ast_copy_string(cid_name, p->owner->cid.cid_name, sizeof(cid_name));
+						if (p->owner->caller.id.number.valid
+							&& p->owner->caller.id.number.str) {
+							ast_copy_string(cid_num, p->owner->caller.id.number.str,
+								sizeof(cid_num));
+						}
+						if (p->owner->caller.id.name.valid
+							&& p->owner->caller.id.name.str) {
+							ast_copy_string(cid_name, p->owner->caller.id.name.str,
+								sizeof(cid_name));
+						}
 					}
 					/* XXX This section needs much more error checking!!! XXX */
 					/* Start a 3-way call if feasible */
@@ -8096,8 +8185,13 @@
 		case SIG_FEATDMF_TA:
 			switch (p->whichwink) {
 			case 0:
-				ast_debug(1, "ANI2 set to '%d' and ANI is '%s'\n", p->owner->cid.cid_ani2, p->owner->cid.cid_ani);
-				snprintf(p->dop.dialstr, sizeof(p->dop.dialstr), "M*%d%s#", p->owner->cid.cid_ani2, p->owner->cid.cid_ani);
+				ast_debug(1, "ANI2 set to '%d' and ANI is '%s'\n", p->owner->caller.ani2,
+					S_COR(p->owner->caller.ani.number.valid,
+						p->owner->caller.ani.number.str, ""));
+				snprintf(p->dop.dialstr, sizeof(p->dop.dialstr), "M*%d%s#",
+					p->owner->caller.ani2,
+					S_COR(p->owner->caller.ani.number.valid,
+						p->owner->caller.ani.number.str, ""));
 				break;
 			case 1:
 				ast_copy_string(p->dop.dialstr, p->finaldial, sizeof(p->dop.dialstr));
@@ -9097,25 +9191,35 @@
 		tmp->adsicpe = AST_ADSI_UNAVAILABLE;
 	if (!ast_strlen_zero(i->exten))
 		ast_copy_string(tmp->exten, i->exten, sizeof(tmp->exten));
-	if (!ast_strlen_zero(i->rdnis))
-		tmp->redirecting.from.number = ast_strdup(i->rdnis);
-	if (!ast_strlen_zero(i->dnid))
-		tmp->cid.cid_dnid = ast_strdup(i->dnid);
+	if (!ast_strlen_zero(i->rdnis)) {
+		tmp->redirecting.from.number.valid = 1;
+		tmp->redirecting.from.number.str = ast_strdup(i->rdnis);
+	}
+	if (!ast_strlen_zero(i->dnid)) {
+		tmp->dialed.number.str = ast_strdup(i->dnid);
+	}
 
 	/* Don't use ast_set_callerid() here because it will
 	 * generate a needless NewCallerID event */
 #if defined(HAVE_PRI) || defined(HAVE_SS7)
-	if (!ast_strlen_zero(i->cid_ani))
-		tmp->cid.cid_ani = ast_strdup(i->cid_ani);
-	else
-		tmp->cid.cid_ani = ast_strdup(i->cid_num);
+	if (!ast_strlen_zero(i->cid_ani)) {
+		tmp->caller.ani.number.valid = 1;
+		tmp->caller.ani.number.str = ast_strdup(i->cid_ani);
+	} else if (!ast_strlen_zero(i->cid_num)) {
+		tmp->caller.ani.number.valid = 1;
+		tmp->caller.ani.number.str = ast_strdup(i->cid_num);
+	}
 #else
-	tmp->cid.cid_ani = ast_strdup(i->cid_num);
+	if (!ast_strlen_zero(i->cid_num)) {
+		tmp->caller.ani.number.valid = 1;
+		tmp->caller.ani.number.str = ast_strdup(i->cid_num);
+	}
 #endif	/* defined(HAVE_PRI) || defined(HAVE_SS7) */
-	tmp->cid.cid_pres = i->callingpres;
-	tmp->cid.cid_ton = i->cid_ton;
-	tmp->cid.cid_ani2 = i->cid_ani2;
-	tmp->cid.cid_tag = ast_strdup(i->cid_tag);
+	tmp->caller.id.name.presentation = i->callingpres;
+	tmp->caller.id.number.presentation = i->callingpres;
+	tmp->caller.id.number.plan = i->cid_ton;
+	tmp->caller.ani2 = i->cid_ani2;
+	tmp->caller.id.tag = ast_strdup(i->cid_tag);
 	/* clear the fake event in case we posted one before we had ast_channel */
 	i->fake_event = 0;
 	/* Assure there is no confmute on this channel */
@@ -9504,7 +9608,8 @@
 			}
 		}
 
-		if (ast_exists_extension(chan, chan->context, exten, 1, chan->cid.cid_num)) {
+		if (ast_exists_extension(chan, chan->context, exten, 1,
+			S_COR(chan->caller.id.number.valid, chan->caller.id.number.str, NULL))) {
 			ast_copy_string(chan->exten, exten, sizeof(chan->exten));
 			if (p->dsp) ast_dsp_digitreset(p->dsp);
 			res = ast_pbx_run(chan);
@@ -9655,12 +9760,10 @@
 				ast_verb(3, "Disabling Caller*ID on %s\n", chan->name);
 				/* Disable Caller*ID if enabled */
 				p->hidecallerid = 1;
-				if (chan->cid.cid_num)
-					ast_free(chan->cid.cid_num);
-				chan->cid.cid_num = NULL;
-				if (chan->cid.cid_name)
-					ast_free(chan->cid.cid_name);
-				chan->cid.cid_name = NULL;
+				ast_party_number_free(&chan->caller.id.number);
+				ast_party_number_init(&chan->caller.id.number);
+				ast_party_name_free(&chan->caller.id.name);
+				ast_party_name_init(&chan->caller.id.name);
 				res = tone_zone_play_tone(p->subs[idx].dfd, DAHDI_TONE_DIALRECALL);
 				if (res) {
 					ast_log(LOG_WARNING, "Unable to do dial recall on channel %s: %s\n",
@@ -9710,12 +9813,6 @@
 				ast_verb(3, "Enabling Caller*ID on %s\n", chan->name);
 				/* Enable Caller*ID if enabled */
 				p->hidecallerid = 0;
-				if (chan->cid.cid_num)
-					ast_free(chan->cid.cid_num);
-				chan->cid.cid_num = NULL;
-				if (chan->cid.cid_name)
-					ast_free(chan->cid.cid_name);
-				chan->cid.cid_name = NULL;
 				ast_set_callerid(chan, p->cid_num, p->cid_name, NULL);
 				res = tone_zone_play_tone(p->subs[idx].dfd, DAHDI_TONE_DIALRECALL);
 				if (res) {
@@ -9761,9 +9858,12 @@
 					ast_hangup(chan);
 					goto quit;
 				}
-			} else if (!ast_canmatch_extension(chan, chan->context, exten, 1, chan->cid.cid_num) &&
-							((exten[0] != '*') || (strlen(exten) > 2))) {
-				ast_debug(1, "Can't match %s from '%s' in context %s\n", exten, chan->cid.cid_num ? chan->cid.cid_num : "<Unknown Caller>", chan->context);
+			} else if (!ast_canmatch_extension(chan, chan->context, exten, 1,
+				S_COR(chan->caller.id.number.valid, chan->caller.id.number.str, NULL))
+				&& ((exten[0] != '*') || (strlen(exten) > 2))) {
+				ast_debug(1, "Can't match %s from '%s' in context %s\n", exten,
+					S_COR(chan->caller.id.number.valid, chan->caller.id.number.str, "<Unknown Caller>"),
+					chan->context);
 				break;
 			}
 			if (!timeout)
@@ -14769,7 +14869,8 @@
 			s.lineconfig & DAHDI_CONFIG_AMI ? "AMI" :
 			"Unk",
 			s.lineconfig & DAHDI_CONFIG_CRC4 ?
-			s.lineconfig & DAHDI_CONFIG_NOTOPEN ? "CRC4/YEL" : "CRC4" : "YEL",
+				s.lineconfig & DAHDI_CONFIG_NOTOPEN ? "CRC4/YEL" : "CRC4" :
+				s.lineconfig & DAHDI_CONFIG_NOTOPEN ? "YEL" : "",
 			lbostr[s.lbo]
 			);
 	}
@@ -15822,6 +15923,7 @@
 	ast_manager_unregister("DAHDIDNDon");
 	ast_manager_unregister("DAHDIShowChannels");
 	ast_manager_unregister("DAHDIRestart");
+	ast_data_unregister(NULL);
 	ast_channel_unregister(&dahdi_tech);
 
 	/* Hangup all interfaces if they have an owner */
@@ -16890,8 +16992,10 @@
 				confp->mfcr2.forced_release = ast_true(v->value) ? 1 : 0;
 			} else if (!strcasecmp(v->name, "mfcr2_immediate_accept")) {
 				confp->mfcr2.immediate_accept = ast_true(v->value) ? 1 : 0;
+#if defined(OR2_LIB_INTERFACE) && OR2_LIB_INTERFACE > 1
 			} else if (!strcasecmp(v->name, "mfcr2_skip_category")) {
 				confp->mfcr2.skip_category_request = ast_true(v->value) ? 1 : 0;
+#endif
 			} else if (!strcasecmp(v->name, "mfcr2_call_files")) {
 				confp->mfcr2.call_files = ast_true(v->value) ? 1 : 0;
 			} else if (!strcasecmp(v->name, "mfcr2_max_ani")) {
@@ -17042,6 +17146,7 @@
 					res = ioctl(ctlfd, DAHDI_SET_DIALPARAMS, &dps);
 					if (res < 0) {
 						ast_log(LOG_ERROR, "Invalid tone duration: %d ms at line %d: %s\n", toneduration, v->lineno, strerror(errno));
+						close(ctlfd);
 						return -1;
 					}
 				}
@@ -17398,6 +17503,163 @@
 	return res;
 }
 
+/*!
+ * \internal
+ * \brief Callback used to generate the dahdi status tree.
+ * \param[in] search The search pattern tree.
+ * \retval NULL on error.
+ * \retval non-NULL The generated tree.
+ */
+static int dahdi_status_data_provider_get(const struct ast_data_search *search,
+		struct ast_data *data_root)
+{
+	int ctl, res, span;
+	struct ast_data *data_span, *data_alarms;
+	struct dahdi_spaninfo s;
+
+	ctl = open("/dev/dahdi/ctl", O_RDWR);
+	if (ctl < 0) {
+		ast_log(LOG_ERROR, "No DAHDI found. Unable to open /dev/dahdi/ctl: %s\n", strerror(errno));
+		return -1;
+	}
+	for (span = 1; span < DAHDI_MAX_SPANS; ++span) {
+		s.spanno = span;
+		res = ioctl(ctl, DAHDI_SPANSTAT, &s);
+		if (res) {
+			continue;
+		}
+
+		data_span = ast_data_add_node(data_root, "span");
+		if (!data_span) {
+			continue;
+		}
+		ast_data_add_str(data_span, "description", s.desc);
+
+		/* insert the alarms status */
+		data_alarms = ast_data_add_node(data_span, "alarms");
+		if (!data_alarms) {
+			continue;
+		}
+
+		ast_data_add_bool(data_alarms, "BLUE", s.alarms & DAHDI_ALARM_BLUE);
+		ast_data_add_bool(data_alarms, "YELLOW", s.alarms & DAHDI_ALARM_YELLOW);
+		ast_data_add_bool(data_alarms, "RED", s.alarms & DAHDI_ALARM_RED);
+		ast_data_add_bool(data_alarms, "LOOPBACK", s.alarms & DAHDI_ALARM_LOOPBACK);
+		ast_data_add_bool(data_alarms, "RECOVER", s.alarms & DAHDI_ALARM_RECOVER);
+		ast_data_add_bool(data_alarms, "NOTOPEN", s.alarms & DAHDI_ALARM_NOTOPEN);
+
+		ast_data_add_int(data_span, "irqmisses", s.irqmisses);
+		ast_data_add_int(data_span, "bpviol", s.bpvcount);
+		ast_data_add_int(data_span, "crc4", s.crc4count);
+		ast_data_add_str(data_span, "framing",	s.lineconfig & DAHDI_CONFIG_D4 ? "D4" :
+							s.lineconfig & DAHDI_CONFIG_ESF ? "ESF" :
+							s.lineconfig & DAHDI_CONFIG_CCS ? "CCS" :
+							"CAS");
+		ast_data_add_str(data_span, "coding",	s.lineconfig & DAHDI_CONFIG_B8ZS ? "B8ZS" :
+							s.lineconfig & DAHDI_CONFIG_HDB3 ? "HDB3" :
+							s.lineconfig & DAHDI_CONFIG_AMI ? "AMI" :
+							"Unknown");
+		ast_data_add_str(data_span, "options",	s.lineconfig & DAHDI_CONFIG_CRC4 ?
+							s.lineconfig & DAHDI_CONFIG_NOTOPEN ? "CRC4/YEL" : "CRC4" :
+							s.lineconfig & DAHDI_CONFIG_NOTOPEN ? "YEL" : "");
+		ast_data_add_str(data_span, "lbo", lbostr[s.lbo]);
+
+		/* if this span doesn't match remove it. */
+		if (!ast_data_search_match(search, data_span)) {
+			ast_data_remove_node(data_root, data_span);
+		}
+	}
+	close(ctl);
+
+	return 0;
+}
+
+/*!
+ * \internal
+ * \brief Callback used to generate the dahdi channels tree.
+ * \param[in] search The search pattern tree.
+ * \retval NULL on error.
+ * \retval non-NULL The generated tree.
+ */
+static int dahdi_channels_data_provider_get(const struct ast_data_search *search,
+		struct ast_data *data_root)
+{
+	struct dahdi_pvt *tmp;
+	struct ast_data *data_channel;
+
+	ast_mutex_lock(&iflock);
+	for (tmp = iflist; tmp; tmp = tmp->next) {
+		data_channel = ast_data_add_node(data_root, "channel");
+		if (!data_channel) {
+			continue;
+		}
+
+		ast_data_add_structure(dahdi_pvt, data_channel, tmp);
+
+		/* if this channel doesn't match remove it. */
+		if (!ast_data_search_match(search, data_channel)) {
+			ast_data_remove_node(data_root, data_channel);
+		}
+	}
+	ast_mutex_unlock(&iflock);
+
+	return 0;
+}
+
+/*!
+ * \internal
+ * \brief Callback used to generate the dahdi channels tree.
+ * \param[in] search The search pattern tree.
+ * \retval NULL on error.
+ * \retval non-NULL The generated tree.
+ */
+static int dahdi_version_data_provider_get(const struct ast_data_search *search,
+		struct ast_data *data_root)
+{
+	int pseudo_fd = -1;
+	struct dahdi_versioninfo vi = {
+		.version = "Unknown",
+		.echo_canceller = "Unknown"
+	};
+
+	if ((pseudo_fd = open("/dev/dahdi/ctl", O_RDONLY)) < 0) {
+		ast_log(LOG_ERROR, "Failed to open control file to get version.\n");
+		return -1;
+	}
+
+	if (ioctl(pseudo_fd, DAHDI_GETVERSION, &vi)) {
+		ast_log(LOG_ERROR, "Failed to get DAHDI version: %s\n", strerror(errno));
+	}
+
+	close(pseudo_fd);
+
+	ast_data_add_str(data_root, "value", vi.version);
+	ast_data_add_str(data_root, "echocanceller", vi.echo_canceller);
+
+	return 0;
+}
+
+static const struct ast_data_handler dahdi_status_data_provider = {
+	.version = AST_DATA_HANDLER_VERSION,
+	.get = dahdi_status_data_provider_get
+};
+
+static const struct ast_data_handler dahdi_channels_data_provider = {
+	.version = AST_DATA_HANDLER_VERSION,
+	.get = dahdi_channels_data_provider_get
+};
+
+static const struct ast_data_handler dahdi_version_data_provider = {
+	.version = AST_DATA_HANDLER_VERSION,
+	.get = dahdi_version_data_provider_get
+};
+
+static const struct ast_data_entry dahdi_data_providers[] = {
+	AST_DATA_ENTRY("asterisk/channel/dahdi/status", &dahdi_status_data_provider),
+	AST_DATA_ENTRY("asterisk/channel/dahdi/channels", &dahdi_channels_data_provider),
+	AST_DATA_ENTRY("asterisk/channel/dahdi/version", &dahdi_version_data_provider)
+};
+
 static int load_module(void)
 {
 	int res;
@@ -17463,7 +17725,8 @@
 #endif
 
 	ast_cli_register_multiple(dahdi_cli, ARRAY_LEN(dahdi_cli));
-
+	/* register all the data providers */
+	ast_data_register_multiple(dahdi_data_providers, ARRAY_LEN(dahdi_data_providers));
 	memset(round_robin, 0, sizeof(round_robin));
 	ast_manager_register_xml("DAHDITransfer", 0, action_transfer);
 	ast_manager_register_xml("DAHDIHangup", 0, action_transferhangup);

Modified: team/loren/sdp-parser/channels/chan_gtalk.c
URL: http://svnview.digium.com/svn/asterisk/team/loren/sdp-parser/channels/chan_gtalk.c?view=diff&rev=276613&r1=276612&r2=276613
==============================================================================
--- team/loren/sdp-parser/channels/chan_gtalk.c (original)
+++ team/loren/sdp-parser/channels/chan_gtalk.c Wed Jul 14 20:47:01 2010
@@ -774,8 +774,10 @@
 	struct aji_client *c = client->connection;
 	struct gtalk_candidate *ours1 = NULL, *ours2 = NULL;
 	struct sockaddr_in sin = { 0, };
+	struct ast_sockaddr sin_tmp;
+	struct ast_sockaddr bindaddr_tmp;
 	struct sockaddr_in dest;
-	struct in_addr us;
+	struct ast_sockaddr us;
 	iks *iq, *gtalk, *candidate, *transport;
 	char user[17], pass[17], preference[5], port[7];
 	char *lowerfrom = NULL;
@@ -809,9 +811,11 @@
 		goto safeout;
 	}
 
-	ast_rtp_instance_get_local_address(p->rtp, &sin);
-	ast_find_ourip(&us, bindaddr);
-	if (!strcmp(ast_inet_ntoa(us), "127.0.0.1")) {
+	ast_rtp_instance_get_local_address(p->rtp, &sin_tmp);
+	ast_sockaddr_to_sin(&sin_tmp, &sin);
+	ast_sockaddr_from_sin(&bindaddr_tmp, &bindaddr);
+	ast_find_ourip(&us, &bindaddr_tmp);
+	if (!strcmp(ast_sockaddr_stringify_addr(&us), "127.0.0.1")) {
 		ast_log(LOG_WARNING, "Found a loopback IP on the system, check your network configuration or set the bindaddr attribute.");
 	}
 
@@ -823,7 +827,8 @@
 	snprintf(pass, sizeof(pass), "%08lx%08lx", ast_random(), ast_random());
 	ast_copy_string(ours1->username, user, sizeof(ours1->username));
 	ast_copy_string(ours1->password, pass, sizeof(ours1->password));
-	ast_copy_string(ours1->ip, ast_inet_ntoa(us), sizeof(ours1->ip));
+	ast_copy_string(ours1->ip, ast_sockaddr_stringify_addr(&us),
+			sizeof(ours1->ip));
 	ours1->protocol = AJI_PROTOCOL_UDP;
 	ours1->type = AJI_CONNECT_LOCAL;
 	ours1->generation = 0;
@@ -911,6 +916,7 @@
 	struct aji_buddy *buddy;
 	char idroster[200];
 	char *data, *exten = NULL;
+	struct ast_sockaddr bindaddr_tmp;
 
 	ast_debug(1, "The client is %s for alloc\n", client->name);
 	if (!sid && !strchr(them, '/')) {	/* I started call! */
@@ -950,7 +956,8 @@
 		tmp->initiator = 1;
 	}
 	/* clear codecs */
-	if (!(tmp->rtp = ast_rtp_instance_new("asterisk", sched, &bindaddr, NULL))) {
+	ast_sockaddr_from_sin(&bindaddr_tmp, &bindaddr);
+	if (!(tmp->rtp = ast_rtp_instance_new("asterisk", sched, &bindaddr_tmp, NULL))) {
 	  ast_log(LOG_ERROR, "Failed to create a new RTP instance (possibly an invalid bindaddr?)\n");
 	  ast_free(tmp);
 	  return NULL;
@@ -1044,7 +1051,8 @@
 
 	tmp->callgroup = client->callgroup;
 	tmp->pickupgroup = client->pickupgroup;
-	tmp->cid.cid_pres = client->callingpres;
+	tmp->caller.id.name.presentation = client->callingpres;
+	tmp->caller.id.number.presentation = client->callingpres;
 	if (!ast_strlen_zero(client->accountcode))
 		ast_string_field_set(tmp, accountcode, client->accountcode);
 	if (client->amaflags)
@@ -1060,8 +1068,9 @@
 	ast_copy_string(tmp->context, client->context, sizeof(tmp->context));
 	ast_copy_string(tmp->exten, i->exten, sizeof(tmp->exten));
 
-	if (!ast_strlen_zero(i->exten) && strcmp(i->exten, "s"))
-		tmp->cid.cid_dnid = ast_strdup(i->exten);
+	if (!ast_strlen_zero(i->exten) && strcmp(i->exten, "s")) {
+		tmp->dialed.number.str = ast_strdup(i->exten);
+	}
 	tmp->priority = 1;
 	if (i->rtp)
 		ast_jb_configure(tmp, &global_jbconf);
@@ -1263,6 +1272,8 @@
 	struct ast_hostent ahp;
 	struct sockaddr_in sin = { 0, };
 	struct sockaddr_in aux = { 0, };
+	struct ast_sockaddr sin_tmp;
+	struct ast_sockaddr aux_tmp;
 
 	if (time(NULL) == p->laststun)
 		return 0;
@@ -1281,16 +1292,17 @@
 			 p->ourcandidates->username);
 		
 		/* Find out the result of the STUN */
-		ast_rtp_instance_get_remote_address(p->rtp, &aux);
+		ast_rtp_instance_get_remote_address(p->rtp, &aux_tmp);
+		ast_sockaddr_to_sin(&aux_tmp, &aux);
 
 		/* If the STUN result is different from the IP of the hostname,
 			lock on the stun IP of the hostname advertised by the
 			remote client */
 		if (aux.sin_addr.s_addr && 
 		    aux.sin_addr.s_addr != sin.sin_addr.s_addr)
-			ast_rtp_instance_stun_request(p->rtp, &aux, username);
+			ast_rtp_instance_stun_request(p->rtp, &aux_tmp, username);
 		else 
-			ast_rtp_instance_stun_request(p->rtp, &sin, username);
+			ast_rtp_instance_stun_request(p->rtp, &sin_tmp, username);
 		
 		if (aux.sin_addr.s_addr) {
 			ast_debug(4, "Receiving RTP traffic from IP %s, matches with remote candidate's IP %s\n", ast_inet_ntoa(aux.sin_addr), tmp->ip);
@@ -2057,6 +2069,9 @@
 /*! \brief Load module into PBX, register channel */
 static int load_module(void)
 {
+	struct ast_sockaddr bindaddr_tmp;
+	struct ast_sockaddr ourip_tmp;
+
 	char *jabber_loaded = ast_module_helper("", "res_jabber.so", 0, 0, 0, 0);
 	free(jabber_loaded);
 	if (!jabber_loaded) {
@@ -2083,10 +2098,12 @@
 	if (!io) 
 		ast_log(LOG_WARNING, "Unable to create I/O context\n");
 
-	if (ast_find_ourip(&__ourip, bindaddr)) {
+	ast_sockaddr_from_sin(&bindaddr_tmp, &bindaddr);
+	if (ast_find_ourip(&ourip_tmp, &bindaddr_tmp)) {
 		ast_log(LOG_WARNING, "Unable to get own IP address, Gtalk disabled\n");
 		return 0;
 	}
+	__ourip.s_addr = htonl(ast_sockaddr_ipv4(&ourip_tmp));
 
 	ast_rtp_glue_register(&gtalk_rtp_glue);
 	ast_cli_register_multiple(gtalk_cli, ARRAY_LEN(gtalk_cli));

Modified: team/loren/sdp-parser/channels/chan_h323.c
URL: http://svnview.digium.com/svn/asterisk/team/loren/sdp-parser/channels/chan_h323.c?view=diff&rev=276613&r1=276612&r2=276613
==============================================================================
--- team/loren/sdp-parser/channels/chan_h323.c (original)
+++ team/loren/sdp-parser/channels/chan_h323.c Wed Jul 14 20:47:01 2010
@@ -609,18 +609,20 @@
 	/* make sure null terminated */
 	called_addr[sizeof(called_addr) - 1] = '\0';
 
-	if (c->connected.id.number)
-		ast_copy_string(pvt->options.cid_num, c->connected.id.number, sizeof(pvt->options.cid_num));
-
-	if (c->connected.id.name)
-		ast_copy_string(pvt->options.cid_name, c->connected.id.name, sizeof(pvt->options.cid_name));
-
-	if (c->redirecting.from.number) {
-		ast_copy_string(pvt->options.cid_rdnis, c->redirecting.from.number, sizeof(pvt->options.cid_rdnis));
-	}
-
-	pvt->options.presentation = c->connected.id.number_presentation;
-	pvt->options.type_of_number = c->connected.id.number_type;
+	if (c->connected.id.number.valid && c->connected.id.number.str) {
+		ast_copy_string(pvt->options.cid_num, c->connected.id.number.str, sizeof(pvt->options.cid_num));
+	}
+
+	if (c->connected.id.name.valid && c->connected.id.name.str) {
+		ast_copy_string(pvt->options.cid_name, c->connected.id.name.str, sizeof(pvt->options.cid_name));
+	}
+
+	if (c->redirecting.from.number.valid && c->redirecting.from.number.str) {
+		ast_copy_string(pvt->options.cid_rdnis, c->redirecting.from.number.str, sizeof(pvt->options.cid_rdnis));
+	}
+
+	pvt->options.presentation = ast_party_id_presentation(&c->connected.id);
+	pvt->options.type_of_number = c->connected.id.number.plan;
 
 	if ((addr = pbx_builtin_getvar_helper(c, "PRIREDIRECTREASON"))) {
 		if (!strcasecmp(addr, "UNKNOWN"))
@@ -954,15 +956,20 @@
 
 static int __oh323_rtp_create(struct oh323_pvt *pvt)
 {
-	struct sockaddr_in our_addr;
+	struct ast_sockaddr our_addr;
 
 	if (pvt->rtp)
 		return 0;
 
-	if (ast_find_ourip(&our_addr.sin_addr, bindaddr)) {
-		ast_mutex_unlock(&pvt->lock);
-		ast_log(LOG_ERROR, "Unable to locate local IP address for RTP stream\n");
-		return -1;
+	{
+		struct ast_sockaddr tmp;
+
+		ast_sockaddr_from_sin(&tmp, &bindaddr);
+		if (ast_find_ourip(&our_addr, &tmp)) {
+			ast_mutex_unlock(&pvt->lock);
+			ast_log(LOG_ERROR, "Unable to locate local IP address for RTP stream\n");
+			return -1;
+		}
 	}
 	pvt->rtp = ast_rtp_instance_new("asterisk", sched, &our_addr, NULL);
 	if (!pvt->rtp) {
@@ -1075,17 +1082,22 @@
 
 		/* Don't use ast_set_callerid() here because it will
 		 * generate a needless NewCallerID event */
-		ch->cid.cid_ani = ast_strdup(cid_num);
+		if (!ast_strlen_zero(cid_num)) {
+			ch->caller.ani.number.valid = 1;
+			ch->caller.ani.number.str = ast_strdup(cid_num);
+		}
 
 		if (pvt->cd.redirect_reason >= 0) {
-			ch->redirecting.from.number = ast_strdup(pvt->cd.redirect_number);
+			ch->redirecting.from.number.valid = 1;
+			ch->redirecting.from.number.str = ast_strdup(pvt->cd.redirect_number);
 			pbx_builtin_setvar_helper(ch, "PRIREDIRECTREASON", redirectingreason2str(pvt->cd.redirect_reason));
 		}
-		ch->cid.cid_pres = pvt->cd.presentation;
-		ch->cid.cid_ton = pvt->cd.type_of_number;
+		ch->caller.id.name.presentation = pvt->cd.presentation;
+		ch->caller.id.number.presentation = pvt->cd.presentation;
+		ch->caller.id.number.plan = pvt->cd.type_of_number;
 
 		if (!ast_strlen_zero(pvt->exten) && strcmp(pvt->exten, "s")) {
-			ch->cid.cid_dnid = ast_strdup(pvt->exten);
+			ch->dialed.number.str = ast_strdup(pvt->exten);
 		}
 		if (pvt->cd.transfer_capability >= 0)
 			ch->transfercapability = pvt->cd.transfer_capability;
@@ -1408,9 +1420,14 @@
 				ast_log(LOG_ERROR, "A dynamic host on a type=user does not make any sense\n");
 				ASTOBJ_UNREF(user, oh323_destroy_user);
 				return NULL;
-			} else if (ast_get_ip(&user->addr, v->value)) {
-				ASTOBJ_UNREF(user, oh323_destroy_user);
-				return NULL;
+			} else {
+				struct ast_sockaddr tmp;
+
+				if (ast_get_ip(&tmp, v->value)) {
+					ASTOBJ_UNREF(user, oh323_destroy_user);
+					return NULL;
+				}
+				ast_sockaddr_to_sin(&tmp, &user->addr);
 			}
 			/* Let us know we need to use ip authentication */
 			user->host = 1;
@@ -1522,10 +1539,15 @@
 				ASTOBJ_UNREF(peer, oh323_destroy_peer);
 				return NULL;
 			}
-			if (ast_get_ip(&peer->addr, v->value)) {
-				ast_log(LOG_ERROR, "Could not determine IP for %s\n", v->value);
-				ASTOBJ_UNREF(peer, oh323_destroy_peer);
-				return NULL;
+			{
+				struct ast_sockaddr tmp;
+
+				if (ast_get_ip(&tmp, v->value)) {
+					ast_log(LOG_ERROR, "Could not determine IP for %s\n", v->value);
+					ASTOBJ_UNREF(peer, oh323_destroy_peer);
+					return NULL;
+				}
+				ast_sockaddr_to_sin(&tmp, &peer->addr);
 			}
 		} else if (!strcasecmp(v->name, "port")) {
 			peer->addr.sin_port = htons(atoi(v->value));
@@ -1922,7 +1944,12 @@
 		return NULL;
 	}
 	/* figure out our local RTP port and tell the H.323 stack about it */
-	ast_rtp_instance_get_local_address(pvt->rtp, &us);
+	{
+		struct ast_sockaddr tmp;
+
+		ast_rtp_instance_get_local_address(pvt->rtp, &tmp);
+		ast_sockaddr_to_sin(&tmp, &us);
+	}
 	ast_mutex_unlock(&pvt->lock);
 
 	ast_copy_string(info->addr, ast_inet_ntoa(us.sin_addr), sizeof(info->addr));
@@ -1971,7 +1998,12 @@
 	them.sin_port = htons(remotePort);
 
 	if (them.sin_addr.s_addr) {
-		ast_rtp_instance_set_remote_address(pvt->rtp, &them);
+		{
+			struct ast_sockaddr tmp;
+
+			ast_sockaddr_from_sin(&tmp, &them);
+			ast_rtp_instance_set_remote_address(pvt->rtp, &tmp);
+		}
 		if (pvt->recvonly) {
 			pvt->recvonly = 0;
 			rtp_change = NEED_UNHOLD;
@@ -3204,8 +3236,14 @@
 		ast_log(LOG_ERROR, "No Private Structure, this is bad\n");
 		return -1;
 	}

[... 9419 lines stripped ...]



More information about the asterisk-commits mailing list