[asterisk-commits] may: branch may/chan_ooh323_evo r357050 - in /team/may/chan_ooh323_evo: ./ ap...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Feb 27 11:31:32 CST 2012


Author: may
Date: Mon Feb 27 11:31:21 2012
New Revision: 357050

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=357050
Log:
Multiple revisions 356965-356966,356987,357005,357013-357014

........
  r356965 | twilson | 2012-02-27 20:08:28 +0400 (Mon, 27 Feb 2012) | 14 lines
  
  Copy CDR variables when set during a bridge
  
  This patch makes sure amaflags, accountcode, and userfield get copied
  to the bridge CDR when set during a bridge (like via a custom feature).
  
  (closes issue ASTERISK-16990)
  Review: https://reviewboard.asterisk.org/r/1721/
  ........
  
  Merged revisions 356963 from http://svn.asterisk.org/svn/asterisk/branches/1.8
  ........
  
  Merged revisions 356964 from http://svn.asterisk.org/svn/asterisk/branches/10
........
  r356966 | seanbright | 2012-02-27 20:12:51 +0400 (Mon, 27 Feb 2012) | 2 lines
  
  There isn't much point in saving off and restoring a value that we never use again.
........
  r356987 | jrose | 2012-02-27 20:24:17 +0400 (Mon, 27 Feb 2012) | 10 lines
  
  Adds an option to sip.conf that prevents diversion headers from being added.
  
  send_diversion=no will prevent Diversion headers from being added to SIP
  requests. This doesn't prevent Diversion from being added with dialplan
  such as with SIPAddHeader.
  
  (closes issue ASTERISK-16862)
  Reported by: rsw686
  Review: https://reviewboard.asterisk.org/r/1769/
........
  r357005 | seanbright | 2012-02-27 20:31:24 +0400 (Mon, 27 Feb 2012) | 6 lines
  
  Convert netsock.h over to use ast_sockaddrs rather than sockaddr_in and update
  chan_iax2 to pass in the correct types.
  
  chan_iax2 is the only consumer for the various ast_netsock_* functions in trunk
  at this point, so this feels like a safe change to make.
........
  r357013 | kmoore | 2012-02-27 20:50:19 +0400 (Mon, 27 Feb 2012) | 9 lines
  
  Deprecated macro usage for connected line, redirecting, and CCSS
  
  This commit adds GoSub alternatives to connected line, redirecting, and CCSS
  macro hooks so that macro can finally be deprecated.  This also adds
  deprecation warnings for those features when used and in documentation.
  
  Review: https://reviewboard.asterisk.org/r/1760/
  (closes issue SWP-4256)
........
  r357014 | seanbright | 2012-02-27 21:03:46 +0400 (Mon, 27 Feb 2012) | 1 line
  
  Address comments from Mark Michelson
........

Merged revisions 356965-356966,356987,357005,357013-357014 from http://svn.asterisk.org/svn/asterisk/trunk

Modified:
    team/may/chan_ooh323_evo/   (props changed)
    team/may/chan_ooh323_evo/CHANGES
    team/may/chan_ooh323_evo/UPGRADE.txt
    team/may/chan_ooh323_evo/apps/app_dial.c
    team/may/chan_ooh323_evo/apps/app_followme.c
    team/may/chan_ooh323_evo/apps/app_queue.c
    team/may/chan_ooh323_evo/channels/chan_iax2.c
    team/may/chan_ooh323_evo/channels/chan_sip.c
    team/may/chan_ooh323_evo/channels/sip/include/sip.h
    team/may/chan_ooh323_evo/configs/ccss.conf.sample
    team/may/chan_ooh323_evo/configs/sip.conf.sample
    team/may/chan_ooh323_evo/include/asterisk/app.h
    team/may/chan_ooh323_evo/include/asterisk/ccss.h
    team/may/chan_ooh323_evo/include/asterisk/channel.h
    team/may/chan_ooh323_evo/include/asterisk/netsock.h
    team/may/chan_ooh323_evo/main/app.c
    team/may/chan_ooh323_evo/main/ccss.c
    team/may/chan_ooh323_evo/main/channel.c
    team/may/chan_ooh323_evo/main/dial.c
    team/may/chan_ooh323_evo/main/features.c
    team/may/chan_ooh323_evo/main/netsock.c
    team/may/chan_ooh323_evo/main/rtp_engine.c

Propchange: team/may/chan_ooh323_evo/
------------------------------------------------------------------------------
Binary property 'branch-10-merged' - no diff available.

Propchange: team/may/chan_ooh323_evo/
------------------------------------------------------------------------------
    svn:mergeinfo = /trunk:356965-357014

Propchange: team/may/chan_ooh323_evo/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Mon Feb 27 11:31:21 2012
@@ -1,1 +1,1 @@
-/trunk:1-356929,356962
+/trunk:1-357045

Modified: team/may/chan_ooh323_evo/CHANGES
URL: http://svnview.digium.com/svn/asterisk/team/may/chan_ooh323_evo/CHANGES?view=diff&rev=357050&r1=357049&r2=357050
==============================================================================
--- team/may/chan_ooh323_evo/CHANGES (original)
+++ team/may/chan_ooh323_evo/CHANGES Mon Feb 27 11:31:21 2012
@@ -65,6 +65,8 @@
    which set the force_rport and comedia options automatically if Asterisk
    detects that an incoming SIP request crossed a NAT after being sent by
    the remote endpoint.
+ * Adds an option send_diversion which can be disabled to prevent
+   diversion headers from automatically being added to invites.
 
 Chan_local changes
 ------------------

Modified: team/may/chan_ooh323_evo/UPGRADE.txt
URL: http://svnview.digium.com/svn/asterisk/team/may/chan_ooh323_evo/UPGRADE.txt?view=diff&rev=357050&r1=357049&r2=357050
==============================================================================
--- team/may/chan_ooh323_evo/UPGRADE.txt (original)
+++ team/may/chan_ooh323_evo/UPGRADE.txt Mon Feb 27 11:31:21 2012
@@ -35,6 +35,11 @@
 Dialplan Functions:
  - MAILBOX_EXISTS has been deprecated. Use VM_INFO with the 'exists' parameter
    instead.
+ - Macro has been deprecated in favor of GoSub.  For redirecting and connected
+   line purposes use the following variables instead of their macro equivalents:
+   REDIRECTING_SEND_SUB, REDIRECTING_SEND_SUB_ARGS,
+   CONNECTED_LINE_SEND_SUB, CONNECTED_LINE_SEND_SUB_ARGS.
+
 
 func_enum:
  - ENUM query functions now return a count of -1 on lookup error to
@@ -61,6 +66,10 @@
 AMI:
   - DBDelTree now correctly returns an error when 0 rows are deleted just as
     the DBDel action does.
+
+CCSS:
+ - Macro is deprecated. Use cc_callback_sub instead of cc_callback_macro
+   in channel configurations.
 
 app_meetme:
   - The 'c' option (announce user count) will now work even if the 'q' (quiet)

Modified: team/may/chan_ooh323_evo/apps/app_dial.c
URL: http://svnview.digium.com/svn/asterisk/team/may/chan_ooh323_evo/apps/app_dial.c?view=diff&rev=357050&r1=357049&r2=357050
==============================================================================
--- team/may/chan_ooh323_evo/apps/app_dial.c (original)
+++ team/may/chan_ooh323_evo/apps/app_dial.c Mon Feb 27 11:31:21 2012
@@ -956,7 +956,8 @@
 		ast_party_redirecting_init(&redirecting);
 		ast_party_redirecting_copy(&redirecting, &c->redirecting);
 		ast_channel_unlock(c);
-		if (ast_channel_redirecting_macro(c, in, &redirecting, 1, 0)) {
+		if (ast_channel_redirecting_sub(c, in, &redirecting, 0) &&
+			ast_channel_redirecting_macro(c, in, &redirecting, 1, 0)) {
 			ast_channel_update_redirecting(in, &redirecting, NULL);
 		}
 		ast_party_redirecting_free(&redirecting);
@@ -1105,7 +1106,8 @@
 					ast_verb(3, "%s answered %s\n", ast_channel_name(c), ast_channel_name(in));
 					if (!single && !ast_test_flag64(peerflags, OPT_IGNORE_CONNECTEDLINE)) {
 						if (o->pending_connected_update) {
-							if (ast_channel_connected_line_macro(c, in, &o->connected, 1, 0)) {
+							if (ast_channel_connected_line_sub(c, in, &o->connected, 0) &&
+								ast_channel_connected_line_macro(c, in, &o->connected, 1, 0)) {
 								ast_channel_update_connected_line(in, &o->connected, NULL);
 							}
 						} else if (!ast_test_flag64(o, DIAL_CALLERID_ABSENT)) {
@@ -1175,7 +1177,8 @@
 						ast_verb(3, "%s answered %s\n", ast_channel_name(c), ast_channel_name(in));
 						if (!single && !ast_test_flag64(peerflags, OPT_IGNORE_CONNECTEDLINE)) {
 							if (o->pending_connected_update) {
-								if (ast_channel_connected_line_macro(c, in, &o->connected, 1, 0)) {
+								if (ast_channel_connected_line_sub(c, in, &o->connected, 0) &&
+									ast_channel_connected_line_macro(c, in, &o->connected, 1, 0)) {
 									ast_channel_update_connected_line(in, &o->connected, NULL);
 								}
 							} else if (!ast_test_flag64(o, DIAL_CALLERID_ABSENT)) {
@@ -1308,7 +1311,8 @@
 						ast_party_connected_line_free(&connected);
 						o->pending_connected_update = 1;
 					} else {
-						if (ast_channel_connected_line_macro(c, in, f, 1, 1)) {
+						if (ast_channel_connected_line_sub(c, in, f, 1) &&
+							ast_channel_connected_line_macro(c, in, f, 1, 1)) {
 							ast_indicate_data(in, AST_CONTROL_CONNECTED_LINE, f->data.ptr, f->datalen);
 						}
 					}
@@ -1329,7 +1333,8 @@
 						ast_verb(3, "Redirecting update to %s prevented.\n", ast_channel_name(in));
 					} else if (single) {
 						ast_verb(3, "%s redirecting info has changed, passing it to %s\n", ast_channel_name(c), ast_channel_name(in));
-						if (ast_channel_redirecting_macro(c, in, f, 1, 1)) {
+						if (ast_channel_redirecting_sub(c, in, f, 1) &&
+							ast_channel_redirecting_macro(c, in, f, 1, 1)) {
 							ast_indicate_data(in, AST_CONTROL_REDIRECTING, f->data.ptr, f->datalen);
 						}
 						pa->sentringing = 0;
@@ -1488,12 +1493,14 @@
 						ast_indicate_data(o->chan, f->subclass.integer, f->data.ptr, f->datalen);
 						break;
 					case AST_CONTROL_CONNECTED_LINE:
-						if (ast_channel_connected_line_macro(in, o->chan, f, 0, 1)) {
+						if (ast_channel_connected_line_sub(in, o->chan, f, 1) &&
+							ast_channel_connected_line_macro(in, o->chan, f, 0, 1)) {
 							ast_indicate_data(o->chan, f->subclass.integer, f->data.ptr, f->datalen);
 						}
 						break;
 					case AST_CONTROL_REDIRECTING:
-						if (ast_channel_redirecting_macro(in, o->chan, f, 0, 1)) {
+						if (ast_channel_redirecting_sub(in, o->chan, f, 1) &&
+							ast_channel_redirecting_macro(in, o->chan, f, 0, 1)) {
 							ast_indicate_data(o->chan, f->subclass.integer, f->data.ptr, f->datalen);
 						}
 						break;

Modified: team/may/chan_ooh323_evo/apps/app_followme.c
URL: http://svnview.digium.com/svn/asterisk/team/may/chan_ooh323_evo/apps/app_followme.c?view=diff&rev=357050&r1=357049&r2=357050
==============================================================================
--- team/may/chan_ooh323_evo/apps/app_followme.c (original)
+++ team/may/chan_ooh323_evo/apps/app_followme.c Mon Feb 27 11:31:21 2012
@@ -1304,7 +1304,8 @@
 
 		/* Update connected line to caller if available. */
 		if (targs.pending_out_connected_update) {
-			if (ast_channel_connected_line_macro(outbound, caller, &targs.connected_out, 1, 0)) {
+			if (ast_channel_connected_line_sub(outbound, caller, &targs.connected_out, 0) &&
+				ast_channel_connected_line_macro(outbound, caller, &targs.connected_out, 1, 0)) {
 				ast_channel_update_connected_line(caller, &targs.connected_out, NULL);
 			}
 		}
@@ -1329,7 +1330,8 @@
 
 		/* Update connected line to winner if changed. */
 		if (targs.pending_in_connected_update) {
-			if (ast_channel_connected_line_macro(caller, outbound, &targs.connected_in, 0, 0)) {
+			if (ast_channel_connected_line_sub(caller, outbound, &targs.connected_in, 0) &&
+				ast_channel_connected_line_macro(caller, outbound, &targs.connected_in, 0, 0)) {
 				ast_channel_update_connected_line(outbound, &targs.connected_in, NULL);
 			}
 		}

Modified: team/may/chan_ooh323_evo/apps/app_queue.c
URL: http://svnview.digium.com/svn/asterisk/team/may/chan_ooh323_evo/apps/app_queue.c?view=diff&rev=357050&r1=357049&r2=357050
==============================================================================
--- team/may/chan_ooh323_evo/apps/app_queue.c (original)
+++ team/may/chan_ooh323_evo/apps/app_queue.c Mon Feb 27 11:31:21 2012
@@ -3645,7 +3645,8 @@
 					ast_verb(3, "%s answered %s\n", ochan_name, inchan_name);
 					if (update_connectedline) {
 						if (o->pending_connected_update) {
-							if (ast_channel_connected_line_macro(o->chan, in, &o->connected, 1, 0)) {
+							if (ast_channel_connected_line_sub(o->chan, in, &o->connected, 0) &&
+								ast_channel_connected_line_macro(o->chan, in, &o->connected, 1, 0)) {
 								ast_channel_update_connected_line(in, &o->connected, NULL);
 							}
 						} else if (!o->dial_callerid_absent) {
@@ -3744,8 +3745,8 @@
 						ast_party_redirecting_init(&redirecting);
 						ast_party_redirecting_copy(&redirecting, &o->chan->redirecting);
 						ast_channel_unlock(o->chan);
-						res = ast_channel_redirecting_macro(o->chan, in, &redirecting, 1, 0);
-						if (res) {
+						if ((res = ast_channel_redirecting_sub(o->chan, in, &redirecting, 0)) &&
+							(res = ast_channel_redirecting_macro(o->chan, in, &redirecting, 1, 0))) {
 							ast_channel_update_redirecting(in, &redirecting, NULL);
 						}
 						ast_party_redirecting_free(&redirecting);
@@ -3774,7 +3775,8 @@
 								ast_verb(3, "%s answered %s\n", ochan_name, inchan_name);
 								if (update_connectedline) {
 									if (o->pending_connected_update) {
-										if (ast_channel_connected_line_macro(o->chan, in, &o->connected, 1, 0)) {
+										if (ast_channel_connected_line_sub(o->chan, in, &o->connected, 0) &&
+											ast_channel_connected_line_macro(o->chan, in, &o->connected, 1, 0)) {
 											ast_channel_update_connected_line(in, &o->connected, NULL);
 										}
 									} else if (!o->dial_callerid_absent) {
@@ -3858,7 +3860,8 @@
 								ast_party_connected_line_free(&connected);
 								o->pending_connected_update = 1;
 							} else {
-								if (ast_channel_connected_line_macro(o->chan, in, f, 1, 1)) {
+								if (ast_channel_connected_line_sub(o->chan, in, f, 1) &&
+									ast_channel_connected_line_macro(o->chan, in, f, 1, 1)) {
 									ast_indicate_data(in, AST_CONTROL_CONNECTED_LINE, f->data.ptr, f->datalen);
 								}
 							}
@@ -3879,7 +3882,8 @@
 								ast_verb(3, "Redirecting update to %s prevented\n", inchan_name);
 							} else if (qe->parent->strategy != QUEUE_STRATEGY_RINGALL) {
 								ast_verb(3, "%s redirecting info has changed, passing it to %s\n", ochan_name, inchan_name);
-								if (ast_channel_redirecting_macro(o->chan, in, f, 1, 1)) {
+								if (ast_channel_redirecting_sub(o->chan, in, f, 1) &&
+									ast_channel_redirecting_macro(o->chan, in, f, 1, 1)) {
 									ast_indicate_data(in, AST_CONTROL_REDIRECTING, f->data.ptr, f->datalen);
 								}
 							}

Modified: team/may/chan_ooh323_evo/channels/chan_iax2.c
URL: http://svnview.digium.com/svn/asterisk/team/may/chan_ooh323_evo/channels/chan_iax2.c?view=diff&rev=357050&r1=357049&r2=357050
==============================================================================
--- team/may/chan_ooh323_evo/channels/chan_iax2.c (original)
+++ team/may/chan_ooh323_evo/channels/chan_iax2.c Mon Feb 27 11:31:21 2012
@@ -12266,19 +12266,17 @@
 /*! \brief Check if address can be used as packet source.
  \return 0  address available, 1  address unavailable, -1  error
 */
-static int check_srcaddr(struct sockaddr *sa, socklen_t salen)
+static int check_srcaddr(struct ast_sockaddr *addr)
 {
 	int sd;
-	int res;
-
-	sd = socket(AF_INET, SOCK_DGRAM, 0);
+
+	sd = socket(addr->ss.ss_family, SOCK_DGRAM, 0);
 	if (sd < 0) {
 		ast_log(LOG_ERROR, "Socket: %s\n", strerror(errno));
 		return -1;
 	}
 
-	res = bind(sd, sa, salen);
-	if (res < 0) {
+	if (ast_bind(sd, addr) < 0) {
 		ast_debug(1, "Can't bind: %s\n", strerror(errno));
 		close(sd);
 		return 1;
@@ -12293,20 +12291,18 @@
   not found. */
 static int peer_set_srcaddr(struct iax2_peer *peer, const char *srcaddr)
 {
-	struct sockaddr_in sin;
-	struct ast_sockaddr sin_tmp;
+	struct ast_sockaddr addr;
 	int nonlocal = 1;
 	int port = IAX_DEFAULT_PORTNO;
 	int sockfd = defaultsockfd;
 	char *tmp;
-	char *addr;
+	char *host;
 	char *portstr;
 
 	if (!(tmp = ast_strdupa(srcaddr)))
 		return -1;
 
-	addr = strsep(&tmp, ":");
-	portstr = tmp;
+	ast_sockaddr_split_hostport(tmp, &host, &portstr, 0);
 
 	if (portstr) {
 		port = atoi(portstr);
@@ -12314,29 +12310,25 @@
 			port = IAX_DEFAULT_PORTNO;
 	}
 
-	sin_tmp.ss.ss_family = AF_INET;
-	if (!ast_get_ip(&sin_tmp, addr)) {
+	addr.ss.ss_family = AF_INET;
+
+	if (!ast_get_ip(&addr, host)) {
 		struct ast_netsock *sock;
-		int res;
-
-		ast_sockaddr_to_sin(&sin_tmp, &sin);
-		sin.sin_port = 0;
-		sin.sin_family = AF_INET;
-		res = check_srcaddr((struct sockaddr *) &sin, sizeof(sin));
-		if (res == 0) {
+
+		if (check_srcaddr(&addr) == 0) {
 			/* ip address valid. */
-			sin.sin_port = htons(port);
-			if (!(sock = ast_netsock_find(netsock, &sin)))
-				sock = ast_netsock_find(outsock, &sin);
+			ast_sockaddr_set_port(&addr, port);
+
+			if (!(sock = ast_netsock_find(netsock, &addr)))
+				sock = ast_netsock_find(outsock, &addr);
 			if (sock) {
 				sockfd = ast_netsock_sockfd(sock);
 				nonlocal = 0;
 			} else {
-				unsigned int orig_saddr = sin.sin_addr.s_addr;
 				/* INADDR_ANY matches anyway! */
-				sin.sin_addr.s_addr = INADDR_ANY;
-				if (ast_netsock_find(netsock, &sin)) {
-					sin.sin_addr.s_addr = orig_saddr;
+				ast_sockaddr_parse(&addr, "0.0.0.0", 0);
+				ast_sockaddr_set_port(&addr, port);
+				if (ast_netsock_find(netsock, &addr)) {
 					sock = ast_netsock_bind(outsock, io, srcaddr, port, qos.tos, qos.cos, socket_read, NULL);
 					if (sock) {
 						sockfd = ast_netsock_sockfd(sock);
@@ -12353,13 +12345,17 @@
 	peer->sockfd = sockfd;
 
 	if (nonlocal == 1) {
-		ast_log(LOG_WARNING, "Non-local or unbound address specified (%s) in sourceaddress for '%s', reverting to default\n",
-			srcaddr, peer->name);
+		ast_log(LOG_WARNING,
+			"Non-local or unbound address specified (%s) in sourceaddress for '%s', reverting to default\n",
+			srcaddr,
+			peer->name);
 		return -1;
-        } else if (nonlocal == 2) {
-		ast_log(LOG_WARNING, "Unable to bind to sourceaddress '%s' for '%s', reverting to default\n",
-			srcaddr, peer->name);
-			return -1;
+	} else if (nonlocal == 2) {
+		ast_log(LOG_WARNING,
+			"Unable to bind to sourceaddress '%s' for '%s', reverting to default\n",
+			srcaddr,
+			peer->name);
+		return -1;
 	} else {
 		ast_debug(1, "Using sourceaddress %s for '%s'\n", srcaddr, peer->name);
 		return 0;

Modified: team/may/chan_ooh323_evo/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/team/may/chan_ooh323_evo/channels/chan_sip.c?view=diff&rev=357050&r1=357049&r2=357050
==============================================================================
--- team/may/chan_ooh323_evo/channels/chan_sip.c (original)
+++ team/may/chan_ooh323_evo/channels/chan_sip.c Mon Feb 27 11:31:21 2012
@@ -12542,6 +12542,11 @@
 	const char *reason;
 	char header_text[256];
 
+	/* We skip this entirely if the configuration doesn't allow diversion headers */
+	if (!sip_cfg.send_diversion) {
+		return;
+	}
+
 	if (!pvt->owner) {
 		return;
 	}
@@ -18827,6 +18832,7 @@
 	ast_cli(a->fd, "  Trust RPID:             %s\n", AST_CLI_YESNO(ast_test_flag(&global_flags[0], SIP_TRUSTRPID)));
 	ast_cli(a->fd, "  Send RPID:              %s\n", AST_CLI_YESNO(ast_test_flag(&global_flags[0], SIP_SENDRPID)));
 	ast_cli(a->fd, "  Legacy userfield parse: %s\n", AST_CLI_YESNO(sip_cfg.legacy_useroption_parsing));
+	ast_cli(a->fd, "  Send Diversion:         %s\n", AST_CLI_YESNO(sip_cfg.send_diversion));
 	ast_cli(a->fd, "  Caller ID:              %s\n", default_callerid);
 	if ((default_fromdomainport) && (default_fromdomainport != STANDARD_SIP_PORT)) {
 		ast_cli(a->fd, "  From: Domain:           %s:%d\n", default_fromdomain, default_fromdomainport);
@@ -29166,6 +29172,7 @@
 	sip_set_default_format_capabilities(sip_cfg.caps);
 	sip_cfg.regextenonqualify = DEFAULT_REGEXTENONQUALIFY;
 	sip_cfg.legacy_useroption_parsing = DEFAULT_LEGACY_USEROPTION_PARSING;
+	sip_cfg.send_diversion = DEFAULT_SEND_DIVERSION;
 	sip_cfg.notifyringing = DEFAULT_NOTIFYRINGING;
 	sip_cfg.notifycid = DEFAULT_NOTIFYCID;
 	sip_cfg.notifyhold = FALSE;		/*!< Keep track of hold status for a peer */
@@ -29467,6 +29474,8 @@
 			sip_cfg.regextenonqualify = ast_true(v->value);
 		} else if (!strcasecmp(v->name, "legacy_useroption_parsing")) {
 			sip_cfg.legacy_useroption_parsing = ast_true(v->value);
+		} else if (!strcasecmp(v->name, "send_diversion")) {
+			sip_cfg.send_diversion = ast_true(v->value);
 		} else if (!strcasecmp(v->name, "callerid")) {
 			ast_copy_string(default_callerid, v->value, sizeof(default_callerid));
 		} else if (!strcasecmp(v->name, "mwi_from")) {

Modified: team/may/chan_ooh323_evo/channels/sip/include/sip.h
URL: http://svnview.digium.com/svn/asterisk/team/may/chan_ooh323_evo/channels/sip/include/sip.h?view=diff&rev=357050&r1=357049&r2=357050
==============================================================================
--- team/may/chan_ooh323_evo/channels/sip/include/sip.h (original)
+++ team/may/chan_ooh323_evo/channels/sip/include/sip.h Mon Feb 27 11:31:21 2012
@@ -219,6 +219,7 @@
 #define DEFAULT_ACCEPT_OUTOFCALL_MESSAGE TRUE
 #define DEFAULT_REGEXTENONQUALIFY FALSE
 #define DEFAULT_LEGACY_USEROPTION_PARSING FALSE
+#define DEFAULT_SEND_DIVERSION TRUE
 #define DEFAULT_T1MIN             100   /*!< 100 MS for minimal roundtrip time */
 #define DEFAULT_MAX_CALL_BITRATE (384)  /*!< Max bitrate for video */
 #ifndef DEFAULT_USERAGENT
@@ -733,6 +734,7 @@
 	int callevents;             /*!< Whether we send manager events or not */
 	int regextenonqualify;      /*!< Whether to add/remove regexten when qualifying peers */
 	int legacy_useroption_parsing; /*!< Whether to strip useroptions in URI via semicolons */
+	int send_diversion;	        /*!< Whether to Send SIP Diversion headers */
 	int matchexternaddrlocally;   /*!< Match externaddr/externhost setting against localnet setting */
 	char regcontext[AST_MAX_CONTEXT];  /*!< Context for auto-extensions */
 	char messagecontext[AST_MAX_CONTEXT];  /*!< Default context for out of dialog msgs. */

Modified: team/may/chan_ooh323_evo/configs/ccss.conf.sample
URL: http://svnview.digium.com/svn/asterisk/team/may/chan_ooh323_evo/configs/ccss.conf.sample?view=diff&rev=357050&r1=357049&r2=357050
==============================================================================
--- team/may/chan_ooh323_evo/configs/ccss.conf.sample (original)
+++ team/may/chan_ooh323_evo/configs/ccss.conf.sample Mon Feb 27 11:31:21 2012
@@ -187,6 +187,12 @@
 ;
 ;cc_callback_macro=
 ;
+; Alternatively, the administrator may run a subroutine. By default
+; there is no callback subroutine configured.  The subroutine should
+; be specified in the format: [[context,]exten,]priority
+;
+;cc_callback_sub=
+;
 ; When using an ISDN phone and a generic CC agent, Asterisk is unable
 ; to determine the dialstring that should be used when calling back
 ; the original caller. Furthermore, if you desire to use any dialstring-

Modified: team/may/chan_ooh323_evo/configs/sip.conf.sample
URL: http://svnview.digium.com/svn/asterisk/team/may/chan_ooh323_evo/configs/sip.conf.sample?view=diff&rev=357050&r1=357049&r2=357050
==============================================================================
--- team/may/chan_ooh323_evo/configs/sip.conf.sample (original)
+++ team/may/chan_ooh323_evo/configs/sip.conf.sample Mon Feb 27 11:31:21 2012
@@ -475,6 +475,11 @@
                                                     ; for improving compatability with devices that like to use
                                                     ; user options for whatever reason.  The behavior is similar to
                                                     ; how SIP URI's were typically handled in 1.6.2, hence the name.
+
+;send_diversion=no              ; Default "yes"     ; Asterisk normally sends Diversion headers with certain SIP
+                                                    ; invites to relay data about forwarded calls. If this option
+                                                    ; is disabled, Asterisk won't send Diversion headers unless
+                                                    ; they are added manually.
 
 ; The shrinkcallerid function removes '(', ' ', ')', non-trailing '.', and '-' not
 ; in square brackets.  For example, the caller id value 555.5555 becomes 5555555

Modified: team/may/chan_ooh323_evo/include/asterisk/app.h
URL: http://svnview.digium.com/svn/asterisk/team/may/chan_ooh323_evo/include/asterisk/app.h?view=diff&rev=357050&r1=357049&r2=357050
==============================================================================
--- team/may/chan_ooh323_evo/include/asterisk/app.h (original)
+++ team/may/chan_ooh323_evo/include/asterisk/app.h Mon Feb 27 11:31:21 2012
@@ -131,8 +131,28 @@
  * \retval 0 success
  * \retval -1 failure
  */
-int ast_app_run_macro(struct ast_channel *autoservice_chan, struct ast_channel 
+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);
+
+/*!
+ * \since 11
+ * \brief Run a subroutine on a channel, placing a second channel into autoservice.
+ *
+ * This is a shorthand method that makes it very easy to run a subroutine 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_sub. A
+ * deadlock could result, otherwise.
+ *
+ * \param autoservice_chan A channel to place into autoservice while the subroutine is run
+ * \param sub_chan The channel to run the subroutine on
+ * \param name The name of the subroutine to run
+ * \param args The arguments to pass to the subroutien
+ * \retval 0 success
+ * \retval -1 failure
+ */
+int ast_app_run_sub(struct ast_channel *autoservice_chan, struct ast_channel
+		*sub_chan, const char * const name, const char * const args);
 
 /*!
  * \brief Set voicemail function callbacks

Modified: team/may/chan_ooh323_evo/include/asterisk/ccss.h
URL: http://svnview.digium.com/svn/asterisk/team/may/chan_ooh323_evo/include/asterisk/ccss.h?view=diff&rev=357050&r1=357049&r2=357050
==============================================================================
--- team/may/chan_ooh323_evo/include/asterisk/ccss.h (original)
+++ team/may/chan_ooh323_evo/include/asterisk/ccss.h Mon Feb 27 11:31:21 2012
@@ -386,10 +386,27 @@
  * \since 1.8
  * \brief Set the callback_macro name
  * \param config The configuration to set the callback_macro on
- * \param value The new callback macro  we want to change to
+ * \param value The new callback macro we want to change to
  * \retval void
  */
 void ast_set_cc_callback_macro(struct ast_cc_config_params *config, const char * const value);
+
+/*!
+ * \since 11
+ * \brief Get the name of the callback subroutine
+ * \param config The configuration to retrieve the callback_sub from
+ * \return The callback_sub name
+ */
+const char *ast_get_cc_callback_sub(struct ast_cc_config_params *config);
+
+/*!
+ * \since 11
+ * \brief Set the callback subroutine name
+ * \param config The configuration to set the callback_sub on
+ * \param value The new callback subroutine we want to change to
+ * \retval void
+ */
+void ast_set_cc_callback_sub(struct ast_cc_config_params *config, const char * const value);
 
 /* END CONFIGURATION FUNCTIONS */
 

Modified: team/may/chan_ooh323_evo/include/asterisk/channel.h
URL: http://svnview.digium.com/svn/asterisk/team/may/chan_ooh323_evo/include/asterisk/channel.h?view=diff&rev=357050&r1=357049&r2=357050
==============================================================================
--- team/may/chan_ooh323_evo/include/asterisk/channel.h (original)
+++ team/may/chan_ooh323_evo/include/asterisk/channel.h Mon Feb 27 11:31:21 2012
@@ -3418,30 +3418,56 @@
  * \since 1.8
  * \brief Run a connected line interception macro and update a channel's connected line
  * information
+ * \deprecated You should use the ast_channel_connected_line_sub() function instead.
  *
  * 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
+ * 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.
+ * 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
+ * AST_CONTROL_CONNECTED_LINE
+ * \param is_caller If true, then run CONNECTED_LINE_CALLER_SEND_MACRO with arguments from
+ * CONNECTED_LINE_CALLER_SEND_MACRO_ARGS, otherwise run CONNECTED_LINE_CALLEE_SEND_MACRO
+ * with arguments from CONNECTED_LINE_CALLEE_SEND_MACRO_ARGS
  * \param frame If true, then connected_info is an ast_frame pointer, otherwise it is an
- * 	ast_party_connected_line pointer.
+ * 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
+ * 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);
+ * '0'
+ */
+int ast_channel_connected_line_macro(struct ast_channel *autoservice_chan, struct ast_channel *macro_chan, const void *connected_info, int is_caller, int frame);
+
+/*!
+ * \since 11
+ * \brief Run a connected line interception subroutine 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 subroutine so that an administrator can manipulate the information before sending it
+ * out. This function both runs the subroutine specified by CONNECTED_LINE_SEND_SUB and
+ * sends the update to the channel.
+ *
+ * \param autoservice_chan Channel to place into autoservice while the sub is running.
+ * It is perfectly safe for this to be NULL
+ * \param sub_chan The channel to run the subroutine on. Also the channel from which we
+ * determine which subroutine we need to run.
+ * \param connected_info Either an ast_party_connected_line or ast_frame pointer of type
+ * AST_CONTROL_CONNECTED_LINE
+ * \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 subroutine does not exist, or there was an error while attempting to
+ * run the subroutine
+ */
+int ast_channel_connected_line_sub(struct ast_channel *autoservice_chan, struct ast_channel *sub_chan, const void *connected_info, int frame);
 
 /*!
  * \brief Insert into an astdata tree, the channel structure.
@@ -3467,6 +3493,7 @@
 /*!
  * \since 1.8
  * \brief Run a redirecting interception macro and update a channel's redirecting information
+ * \deprecated You should use the ast_channel_redirecting_sub() function instead.
  *
  * \details
  * Whenever we want to update a channel's redirecting information, we may need to run
@@ -3479,8 +3506,9 @@
  * determine which macro we need to run.
  * \param redirecting_info Either an ast_party_redirecting or ast_frame pointer of type
  * AST_CONTROL_REDIRECTING
- * \param is_caller If true, then run REDIRECTING_CALLER_SEND_MACRO, otherwise run
- * REDIRECTING_CALLEE_SEND_MACRO
+ * \param is_caller If true, then run REDIRECTING_CALLER_SEND_MACRO with arguments from
+ * REDIRECTING_CALLER_SEND_MACRO_ARGS, otherwise run REDIRECTING_CALLEE_SEND_MACRO with
+ * arguments from REDIRECTING_CALLEE_SEND_MACRO_ARGS
  * \param is_frame If true, then redirecting_info is an ast_frame pointer, otherwise it is an
  * ast_party_redirecting pointer.
  *
@@ -3493,6 +3521,31 @@
  * '0'
  */
 int ast_channel_redirecting_macro(struct ast_channel *autoservice_chan, struct ast_channel *macro_chan, const void *redirecting_info, int is_caller, int is_frame);
+
+/*!
+ * \since 11
+ * \brief Run a redirecting interception subroutine and update a channel's redirecting information
+ *
+ * \details
+ * Whenever we want to update a channel's redirecting information, we may need to run
+ * a subroutine so that an administrator can manipulate the information before sending it
+ * out. This function both runs the subroutine specified by REDIRECTING_SEND_SUB and
+ * sends the update to the channel.
+ *
+ * \param autoservice_chan Channel to place into autoservice while the subroutine is running.
+ * It is perfectly safe for this to be NULL
+ * \param sub_chan The channel to run the subroutine on. Also the channel from which we
+ * determine which subroutine we need to run.
+ * \param redirecting_info Either an ast_party_redirecting or ast_frame pointer of type
+ * AST_CONTROL_REDIRECTING
+ * \param is_frame If true, then redirecting_info is an ast_frame pointer, otherwise it is an
+ * ast_party_redirecting pointer.
+ *
+ * \retval 0 Success
+ * \retval -1 Either the subroutine does not exist, or there was an error while attempting to
+ * run the subroutine
+ */
+int ast_channel_redirecting_sub(struct ast_channel *autoservice_chan, struct ast_channel *sub_chan, const void *redirecting_info, int is_frame);
 
 #include "asterisk/ccss.h"
 

Modified: team/may/chan_ooh323_evo/include/asterisk/netsock.h
URL: http://svnview.digium.com/svn/asterisk/team/may/chan_ooh323_evo/include/asterisk/netsock.h?view=diff&rev=357050&r1=357049&r2=357050
==============================================================================
--- team/may/chan_ooh323_evo/include/asterisk/netsock.h (original)
+++ team/may/chan_ooh323_evo/include/asterisk/netsock.h Mon Feb 27 11:31:21 2012
@@ -30,6 +30,7 @@
 
 #include "asterisk/network.h"
 #include "asterisk/io.h"
+#include "asterisk/netsock2.h"
 
 struct ast_netsock;
 
@@ -43,12 +44,12 @@
 				     const char *bindinfo, int defaultport, int tos, int cos, ast_io_cb callback, void *data);
 
 struct ast_netsock *ast_netsock_bindaddr(struct ast_netsock_list *list, struct io_context *ioc,
-					 struct sockaddr_in *bindaddr, int tos, int cos, ast_io_cb callback, void *data);
+					 struct ast_sockaddr *bindaddr, int tos, int cos, ast_io_cb callback, void *data);
 
 int ast_netsock_release(struct ast_netsock_list *list);
 
 struct ast_netsock *ast_netsock_find(struct ast_netsock_list *list,
-				     struct sockaddr_in *sa);
+				     struct ast_sockaddr *addr);
 
 /*!
  * \deprecated Use ast_seq_qos in netsock2.h which properly handles IPv4 and IPv6
@@ -58,7 +59,7 @@
 
 int ast_netsock_sockfd(const struct ast_netsock *ns);
 
-const struct sockaddr_in *ast_netsock_boundaddr(const struct ast_netsock *ns);
+const struct ast_sockaddr *ast_netsock_boundaddr(const struct ast_netsock *ns);
 
 void *ast_netsock_data(const struct ast_netsock *ns);
 

Modified: team/may/chan_ooh323_evo/main/app.c
URL: http://svnview.digium.com/svn/asterisk/team/may/chan_ooh323_evo/main/app.c?view=diff&rev=357050&r1=357049&r2=357050
==============================================================================
--- team/may/chan_ooh323_evo/main/app.c (original)
+++ team/may/chan_ooh323_evo/main/app.c Mon Feb 27 11:31:21 2012
@@ -247,26 +247,77 @@
 	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;
+static int app_exec_dialplan(struct ast_channel *autoservice_chan, struct ast_channel *exec_chan, const char * const args, int use_gosub)
+{
+
+	struct ast_app *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);
+	char * app_type = use_gosub ? "GoSub" : "Macro";
+
+	app = pbx_findapp(app_type);
+	if (!app) {
+		ast_log(LOG_WARNING, "Cannot run '%s' because the '%s' application is not available\n", args, app_type);
 		return -1;
 	}
-	snprintf(buf, sizeof(buf), "%s%s%s", macro_name, ast_strlen_zero(macro_args) ? "" : ",", S_OR(macro_args, ""));
 	if (autoservice_chan) {
 		ast_autoservice_start(autoservice_chan);
 	}
-	res = pbx_exec(macro_chan, macro_app, buf);
+	res = pbx_exec(exec_chan, app, args);
+	if (use_gosub && !res) {
+		struct ast_pbx_args gosub_args = {{0}};
+		struct ast_pbx *pbx = ast_channel_pbx(exec_chan);
+		/* supress warning about a pbx already being on the channel */
+		ast_channel_pbx_set(exec_chan, NULL);
+		gosub_args.no_hangup_chan = 1;
+		ast_pbx_run_args(exec_chan, &gosub_args);
+		if (ast_channel_pbx(exec_chan)) {
+			ast_free(ast_channel_pbx(exec_chan));
+		}
+		ast_channel_pbx_set(exec_chan, pbx);
+	}
 	if (autoservice_chan) {
 		ast_autoservice_stop(autoservice_chan);
 	}
 	return res;
+}
+
+int ast_app_run_macro(struct ast_channel *autoservice_chan, struct ast_channel *macro_chan, const char * const name, const char * const args)
+{
+	char buf[1024];
+	snprintf(buf, sizeof(buf), "%s%s%s", name, ast_strlen_zero(args) ? "" : ",", S_OR(args, ""));
+	return app_exec_dialplan(autoservice_chan, macro_chan, buf, 0);
+}
+
+int ast_app_run_sub(struct ast_channel *autoservice_chan, struct ast_channel *sub_chan, const char * const location, const char * const args)
+{
+	char buf[1024];
+	size_t offset = snprintf(buf, sizeof(buf), "%s", location);
+	/* need to bump the priority by one if we already have a pbx */
+	if (ast_channel_pbx(sub_chan)) {
+		int iprio;
+		const char * priority = location;
+		const char * next = strchr(priority,',');
+		/* jump to the priority portion of the location */
+		if (next) {
+			priority = next + 1;
+		}
+		next = strchr(priority,',');
+		if (next) {
+			priority = next + 1;
+		}
+		/* if the priority isn't numeric, it's as if we never took this branch... */
+		if (sscanf(priority, "%d", &iprio)) {
+			offset = priority - location;
+			iprio++;
+			if (offset < sizeof(buf)) {
+				offset += snprintf(buf + offset, sizeof(buf) - offset, "%d", iprio);
+			}
+		}
+	}
+	if (offset < sizeof(buf)) {
+		snprintf(buf + offset, sizeof(buf) - offset, "%s%s%s", ast_strlen_zero(args) ? "" : "(", S_OR(args, ""), ast_strlen_zero(args) ? "" : ")");
+	}
+	return app_exec_dialplan(autoservice_chan, sub_chan, buf, 1);
 }
 
 static int (*ast_has_voicemail_func)(const char *mailbox, const char *folder) = NULL;

Modified: team/may/chan_ooh323_evo/main/ccss.c
URL: http://svnview.digium.com/svn/asterisk/team/may/chan_ooh323_evo/main/ccss.c?view=diff&rev=357050&r1=357049&r2=357050
==============================================================================
--- team/may/chan_ooh323_evo/main/ccss.c (original)
+++ team/may/chan_ooh323_evo/main/ccss.c Mon Feb 27 11:31:21 2012
@@ -156,6 +156,7 @@
 	unsigned int cc_max_agents;
 	unsigned int cc_max_monitors;
 	char cc_callback_macro[AST_MAX_EXTENSION];
+	char cc_callback_sub[AST_MAX_EXTENSION];
 	char cc_agent_dialstring[AST_MAX_EXTENSION];
 };
 
@@ -654,6 +655,7 @@
 	.cc_max_agents = CC_MAX_AGENTS_DEFAULT,
 	.cc_max_monitors = CC_MAX_MONITORS_DEFAULT,
 	.cc_callback_macro = "",
+	.cc_callback_sub = "",
 	.cc_agent_dialstring = "",
 };
 
@@ -751,6 +753,8 @@
 
 	if (!strcasecmp(name, "cc_callback_macro")) {
 		value = ast_get_cc_callback_macro(params);
+	} else if (!strcasecmp(name, "cc_callback_sub")) {
+		value = ast_get_cc_callback_sub(params);
 	} else if (!strcasecmp(name, "cc_agent_policy")) {
 		value = agent_policy_to_str(ast_get_cc_agent_policy(params));
 	} else if (!strcasecmp(name, "cc_monitor_policy")) {
@@ -800,6 +804,9 @@
 	} else if (!strcasecmp(name, "cc_callback_macro")) {
 		ast_set_cc_callback_macro(params, value);
 		return 0;
+	} else if (!strcasecmp(name, "cc_callback_sub")) {
+		ast_set_cc_callback_sub(params, value);
+		return 0;
 	}
 
 	if (!sscanf(value, "%30u", &value_as_uint) == 1) {
@@ -836,6 +843,7 @@

[... 532 lines stripped ...]



More information about the asterisk-commits mailing list