[asterisk-commits] tilghman: branch tilghman/auto_preload r276770 - in /team/tilghman/auto_prelo...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Jul 15 14:48:37 CDT 2010


Author: tilghman
Date: Thu Jul 15 14:48:32 2010
New Revision: 276770

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=276770
Log:
Resolve conflict

Added:
    team/tilghman/auto_preload/res/res_crypto.exports.in
      - copied unchanged from r276653, trunk/res/res_crypto.exports.in
Removed:
    team/tilghman/auto_preload/main/adsistub.c
    team/tilghman/auto_preload/main/cryptostub.c
Modified:
    team/tilghman/auto_preload/   (props changed)
    team/tilghman/auto_preload/channels/chan_h323.c
    team/tilghman/auto_preload/channels/chan_sip.c
    team/tilghman/auto_preload/contrib/scripts/install_prereq
    team/tilghman/auto_preload/include/asterisk/adsi.h
    team/tilghman/auto_preload/include/asterisk/agi.h
    team/tilghman/auto_preload/include/asterisk/crypto.h
    team/tilghman/auto_preload/include/asterisk/optional_api.h
    team/tilghman/auto_preload/main/Makefile
    team/tilghman/auto_preload/main/acl.c
    team/tilghman/auto_preload/main/asterisk.dynamics
    team/tilghman/auto_preload/main/channel.c
    team/tilghman/auto_preload/main/dnsmgr.c
    team/tilghman/auto_preload/res/res_adsi.c
    team/tilghman/auto_preload/res/res_adsi.exports.in
    team/tilghman/auto_preload/res/res_crypto.c
    team/tilghman/auto_preload/res/res_rtp_asterisk.c
    team/tilghman/auto_preload/tests/test_utils.c

Propchange: team/tilghman/auto_preload/
------------------------------------------------------------------------------
    automerge = *

Propchange: team/tilghman/auto_preload/
------------------------------------------------------------------------------
Binary property 'branch-1.4-merged' - no diff available.

Propchange: team/tilghman/auto_preload/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Thu Jul 15 14:48:32 2010
@@ -1,1 +1,1 @@
-/trunk:1-276477
+/trunk:1-276725

Modified: team/tilghman/auto_preload/channels/chan_h323.c
URL: http://svnview.digium.com/svn/asterisk/team/tilghman/auto_preload/channels/chan_h323.c?view=diff&rev=276770&r1=276769&r2=276770
==============================================================================
--- team/tilghman/auto_preload/channels/chan_h323.c (original)
+++ team/tilghman/auto_preload/channels/chan_h323.c Thu Jul 15 14:48:32 2010
@@ -621,7 +621,7 @@
 		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.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"))) {

Modified: team/tilghman/auto_preload/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/team/tilghman/auto_preload/channels/chan_sip.c?view=diff&rev=276770&r1=276769&r2=276770
==============================================================================
--- team/tilghman/auto_preload/channels/chan_sip.c (original)
+++ team/tilghman/auto_preload/channels/chan_sip.c Thu Jul 15 14:48:32 2010
@@ -3483,7 +3483,9 @@
 		 * only wakes up every 1000ms by default, we have to poke the thread here to make
 		 * sure it successfully detects this must be retransmitted in less time than
 		 * it usually sleeps for. Otherwise it might not retransmit this packet for 1000ms. */
-		pthread_kill(monitor_thread, SIGURG);
+		if (monitor_thread != AST_PTHREADT_NULL) {
+			pthread_kill(monitor_thread, SIGURG);
+		}
 		return AST_SUCCESS;
 	}
 }
@@ -13427,8 +13429,8 @@
 					      "Cause: AUTH_SECRET_FAILED\r\n"
 					      "Address: %s\r\n"
 					      "Port: %s\r\n",
-					      name, ast_sockaddr_stringify_addr(addr),
-					      ast_sockaddr_stringify_port(addr));
+					      name, ast_strdupa(ast_sockaddr_stringify_addr(addr)),
+					      ast_strdupa(ast_sockaddr_stringify_port(addr)));
 			}
 			break;
 		case AUTH_USERNAME_MISMATCH:
@@ -13451,8 +13453,8 @@
 						      "Port: %s\r\n",
 						      name,
 						      res == AUTH_PEER_NOT_DYNAMIC ? "AUTH_PEER_NOT_DYNAMIC" : "URI_NOT_FOUND",
-						      ast_sockaddr_stringify_addr(addr),
-						      ast_sockaddr_stringify_port(addr));
+						      ast_strdupa(ast_sockaddr_stringify_addr(addr)),
+						      ast_strdupa(ast_sockaddr_stringify_port(addr)));
 				}
 			} else {
 				/* URI not found */
@@ -13467,8 +13469,8 @@
 							"Address: %s\r\n"
 							"Port: %s\r\n",
 							name,
-							ast_sockaddr_stringify_addr(addr),
-							ast_sockaddr_stringify_port(addr));
+							ast_strdupa(ast_sockaddr_stringify_addr(addr)),
+							ast_strdupa(ast_sockaddr_stringify_port(addr)));
 					}
 				} else {
 					transmit_response(p, "404 Not found", &p->initreq);
@@ -13482,8 +13484,8 @@
 							"Port: %s\r\n",
 							name,
 							(res == AUTH_USERNAME_MISMATCH) ? "AUTH_USERNAME_MISMATCH" : "URI_NOT_FOUND",
-							ast_sockaddr_stringify_addr(addr),
-							ast_sockaddr_stringify_port(addr));
+							ast_strdupa(ast_sockaddr_stringify_addr(addr)),
+							ast_strdupa(ast_sockaddr_stringify_port(addr)));
 					}
 				}
 			}
@@ -23873,14 +23875,12 @@
 	if (event) {
 		newmsgs = ast_event_get_ie_uint(event, AST_EVENT_IE_NEWMSGS);
 		oldmsgs = ast_event_get_ie_uint(event, AST_EVENT_IE_OLDMSGS);
-	} else if (!get_cached_mwi(peer, &newmsgs, &oldmsgs)) {
-		/* got it!  Don't keep looking. */
-	} else if (cache_only) {
-		return 0;
-	} else { /* Fall back to manually checking the mailbox */
+	} else if (!cache_only) { /* Fall back to manually checking the mailbox */
 		struct ast_str *mailbox_str = ast_str_alloca(512);
 		peer_mailboxes_to_str(&mailbox_str, peer);
 		ast_app_inboxcount(mailbox_str->str, &newmsgs, &oldmsgs);
+	} else {
+		get_cached_mwi(peer, &newmsgs, &oldmsgs);
 	}
 	
 	if (peer->mwipvt) {
@@ -25954,7 +25954,7 @@
 	if (ast_test_flag(&peer->flags[1], SIP_PAGE2_ALLOWSUBSCRIBE)) {
 		sip_cfg.allowsubscribe = TRUE;	/* No global ban any more */
 	}
-	if (!found && peer->host_dynamic && !peer->is_realtime) {
+	if (peer->host_dynamic && !peer->is_realtime) {
 		reg_source_db(peer);
 	}
 
@@ -26718,7 +26718,51 @@
  		if (!strcasecmp(v->name, "auth"))
  			authl = add_realm_authentication(authl, v->value, v->lineno);
  	}
-	
+
+	ast_mutex_lock(&netlock);
+	if ((sipsock > -1) && (ast_sockaddr_cmp(&old_bindaddr, &bindaddr))) {
+		close(sipsock);
+		sipsock = -1;
+	}
+	if (sipsock < 0) {
+		sipsock = socket(ast_sockaddr_is_ipv6(&bindaddr) ?
+				 AF_INET6 : AF_INET, SOCK_DGRAM, 0);
+		if (sipsock < 0) {
+			ast_log(LOG_WARNING, "Unable to create SIP socket: %s\n", strerror(errno));
+			ast_config_destroy(cfg);
+			return -1;
+		} else {
+			/* Allow SIP clients on the same host to access us: */
+			const int reuseFlag = 1;
+
+			setsockopt(sipsock, SOL_SOCKET, SO_REUSEADDR,
+				   (const char*)&reuseFlag,
+				   sizeof reuseFlag);
+
+			ast_enable_packet_fragmentation(sipsock);
+
+			if (ast_bind(sipsock, &bindaddr) < 0) {
+				ast_log(LOG_WARNING, "Failed to bind to %s: %s\n",
+					ast_sockaddr_stringify(&bindaddr), strerror(errno));
+				close(sipsock);
+				sipsock = -1;
+			} else {
+				ast_verb(2, "SIP Listening on %s\n", ast_sockaddr_stringify(&bindaddr));
+				ast_set_qos(sipsock, global_tos_sip, global_cos_sip, "SIP");
+			}
+		}
+	}
+	if (stunaddr.sin_addr.s_addr != 0) {
+		ast_debug(1, "stun to %s:%d\n",
+			ast_inet_ntoa(stunaddr.sin_addr) , ntohs(stunaddr.sin_port));
+		ast_sockaddr_to_sin(&externip, &externip_sin);
+		ast_stun_request(sipsock, &stunaddr,
+			NULL, &externip_sin);
+		ast_debug(1, "STUN sees us at %s\n",
+			ast_sockaddr_stringify(&externip));
+	}
+	ast_mutex_unlock(&netlock);
+
 	if (ucfg) {
 		struct ast_variable *gen;
 		int genhassip, genregistersip;
@@ -26836,49 +26880,6 @@
 		ast_config_destroy(cfg);
 		return 0;
 	}
-	ast_mutex_lock(&netlock);
-	if ((sipsock > -1) && (ast_sockaddr_cmp(&old_bindaddr, &bindaddr))) {
-		close(sipsock);
-		sipsock = -1;
-	}
-	if (sipsock < 0) {
-		sipsock = socket(ast_sockaddr_is_ipv6(&bindaddr) ?
-				 AF_INET6 : AF_INET, SOCK_DGRAM, 0);
-		if (sipsock < 0) {
-			ast_log(LOG_WARNING, "Unable to create SIP socket: %s\n", strerror(errno));
-			ast_config_destroy(cfg);
-			return -1;
-		} else {
-			/* Allow SIP clients on the same host to access us: */
-			const int reuseFlag = 1;
-
-			setsockopt(sipsock, SOL_SOCKET, SO_REUSEADDR,
-				   (const char*)&reuseFlag,
-				   sizeof reuseFlag);
-
-			ast_enable_packet_fragmentation(sipsock);
-
-			if (ast_bind(sipsock, &bindaddr) < 0) {
-				ast_log(LOG_WARNING, "Failed to bind to %s: %s\n",
-					ast_sockaddr_stringify(&bindaddr), strerror(errno));
-				close(sipsock);
-				sipsock = -1;
-			} else {
-				ast_verb(2, "SIP Listening on %s\n", ast_sockaddr_stringify(&bindaddr));
-				ast_set_qos(sipsock, global_tos_sip, global_cos_sip, "SIP");
-			}
-		}
-	}
-	if (stunaddr.sin_addr.s_addr != 0) {
-		ast_debug(1, "stun to %s:%d\n",
-			ast_inet_ntoa(stunaddr.sin_addr) , ntohs(stunaddr.sin_port));
-		ast_sockaddr_to_sin(&externip, &externip_sin);
-		ast_stun_request(sipsock, &stunaddr,
-			NULL, &externip_sin);
-		ast_debug(1, "STUN sees us at %s\n",
-			ast_sockaddr_stringify(&externip));
-	}
-	ast_mutex_unlock(&netlock);
 
 	/* Start TCP server */
 	if (sip_cfg.tcp_enabled) {
@@ -27009,7 +27010,7 @@
 
 	if ((res = ast_apply_ha(p->directmediaha, &them_sin)) == AST_SENSE_DENY) {
 		ast_debug(3, "Reinvite %s to %s denied by directmedia ACL on %s\n",
-			op, ast_sockaddr_stringify(&them), ast_sockaddr_stringify(&us));
+			op, ast_strdupa(ast_sockaddr_stringify(&them)), ast_strdupa(ast_sockaddr_stringify(&us)));
 	}
 
 	return res;

Modified: team/tilghman/auto_preload/contrib/scripts/install_prereq
URL: http://svnview.digium.com/svn/asterisk/team/tilghman/auto_preload/contrib/scripts/install_prereq?view=diff&rev=276770&r1=276769&r2=276770
==============================================================================
--- team/tilghman/auto_preload/contrib/scripts/install_prereq (original)
+++ team/tilghman/auto_preload/contrib/scripts/install_prereq Thu Jul 15 14:48:32 2010
@@ -24,7 +24,7 @@
 PACKAGES_DEBIAN="$PACKAGES_DEBIAN libncurses-dev libz-dev libssl-dev libxml2-dev"
 # Asterisk: for addons:
 PACKAGES_DEBIAN="$PACKAGES_DEBIAN libcurl-dev libspeex-dev libspeexdsp-dev libogg-dev libvorbis-dev libasound2-dev portaudio19-dev libcurl4-openssl-dev"
-PACKAGES_DEBIAN="$PACKAGES_DEBIAN libpq-dev unixodbc-dev libsqlite0-dev libsqlite3-dev libmysqlclient15-dev libneon27-dev libgmime-2.0-2-dev libusb-dev liblua5.1-0-dev"
+PACKAGES_DEBIAN="$PACKAGES_DEBIAN libpq-dev unixodbc-dev libsqlite0-dev libsqlite3-dev libmysqlclient15-dev libneon27-dev libgmime-2.0-2-dev libusb-dev liblua5.1-0-dev lua5.1"
 PACKAGES_DEBIAN="$PACKAGES_DEBIAN libopenh323-dev libvpb-dev libgtk2.0-dev libmysqlclient-dev libbluetooth-dev libradiusclient-ng-dev freetds-dev"
 PACKAGES_DEBIAN="$PACKAGES_DEBIAN libsnmp-dev libiksemel-dev libopenais-dev libnewt-dev libpopt-dev libical-dev libspandsp-dev libjack-dev"
 

Modified: team/tilghman/auto_preload/include/asterisk/adsi.h
URL: http://svnview.digium.com/svn/asterisk/team/tilghman/auto_preload/include/asterisk/adsi.h?view=diff&rev=276770&r1=276769&r2=276770
==============================================================================
--- team/tilghman/auto_preload/include/asterisk/adsi.h (original)
+++ team/tilghman/auto_preload/include/asterisk/adsi.h Thu Jul 15 14:48:32 2010
@@ -24,6 +24,8 @@
 #define _ASTERISK_ADSI_H
 
 #include "asterisk/callerid.h"
+#include "asterisk/optional_api.h"
+
 /*! \name ADSI parameters */
 /*@{ */
 
@@ -121,44 +123,35 @@
 
 /*@} */
 
-/*! Perform Asterisk ADSI initialization (for channel drivers that want 
- *    to support ADSI when the handset is first lifted) 
- * \param chan Channel to initialize for ADSI (if supported)
- *
- * \retval 0 on success (or adsi unavailable.
- * \retval -1 on hangup.
- */
-extern int (*ast_adsi_channel_init)(struct ast_channel *chan);
-
-extern int (*ast_adsi_begin_download)(struct ast_channel *chan, char *service, unsigned char *fdn, unsigned char *sec, int version);
-
-extern int (*ast_adsi_end_download)(struct ast_channel *chan);
-
-/*! Restore ADSI initialization (for applications that play with ADSI 
- *   and want to restore it to normal.  If you touch "INFO" then you 
- *   have to use the ast_adsi_channel_init again instead. 
+AST_OPTIONAL_API(int, ast_adsi_begin_download, (struct ast_channel *chan, char *service, unsigned char *fdn, unsigned char *sec, int version), { return 0; });
+
+AST_OPTIONAL_API(int, ast_adsi_end_download, (struct ast_channel *chan), { return 0; });
+
+/*! Restore ADSI initialization (for applications that play with ADSI
+ *   and want to restore it to normal.  If you touch "INFO" then you
+ *   have to use the ast_adsi_channel_init again instead.
  * \param chan Channel to restore
  *
  * \retval 0 on success (or adsi unavailable)
  * \retval -1 on hangup
  */
-extern int (*ast_adsi_channel_restore)(struct ast_channel *chan);
-
-/*! 
- * \brief Display some stuff on the screen 
+AST_OPTIONAL_API(int, ast_adsi_channel_restore, (struct ast_channel *chan), { return 0; });
+
+/*!
+ * \brief Display some stuff on the screen
  * \param chan Channel to display on
  * \param lines NULL-terminated list of things to print (no more than 4 recommended)
  * \param align list of alignments to use (ADSI_JUST_LEFT, ADSI_JUST_RIGHT, ADSI_JUST_CEN, etc..)
  * \param voice whether to jump into voice mode when finished
  *
- * \retval 0 on success (or adsi unavailable) 
+ * \retval 0 on success (or adsi unavailable)
  * \retval -1 on hangup
  */
-extern int (*ast_adsi_print)(struct ast_channel *chan, char **lines, int *align, int voice);
-
-/*! 
+AST_OPTIONAL_API(int, ast_adsi_print, (struct ast_channel *chan, char **lines, int *align, int voice), { return 0; });
+
+/*!
  * \brief Check if scripts for a given app are already loaded.
- * Version may be -1, if any version is okay, or 0-255 for a specific version. 
+ * Version may be -1, if any version is okay, or 0-255 for a specific version.
  * \param chan Channel to test for loaded app
  * \param app Four character app name (must be unique to your application)
  * \param ver optional version number
@@ -168,22 +161,21 @@
  * \retval -1 on hangup
  * \retval 1 if script already loaded.
  */
-extern int (*ast_adsi_load_session)(struct ast_channel *chan, unsigned char *app, int ver, int data);
-extern int (*ast_adsi_unload_session)(struct ast_channel *chan);
+AST_OPTIONAL_API(int, ast_adsi_load_session, (struct ast_channel *chan, unsigned char *app, int ver, int data), { return 0; });
+AST_OPTIONAL_API(int, ast_adsi_unload_session, (struct ast_channel *chan), { return 0; });
 
 /* ADSI Layer 2 transmission functions */
-extern int (*ast_adsi_transmit_messages)(struct ast_channel *chan, unsigned char **msg, int *msglen, int *msgtype);
-extern int (*ast_adsi_transmit_message)(struct ast_channel *chan, unsigned char *msg, int msglen, int msgtype);
-extern int (*ast_adsi_transmit_message_full)(struct ast_channel *chan, unsigned char *msg, int msglen, int msgtype, int dowait);
-/*! Read some encoded DTMF data. 
+AST_OPTIONAL_API(int, ast_adsi_transmit_message, (struct ast_channel *chan, unsigned char *msg, int msglen, int msgtype), { return 0; });
+AST_OPTIONAL_API(int, ast_adsi_transmit_message_full, (struct ast_channel *chan, unsigned char *msg, int msglen, int msgtype, int dowait), { return 0; });
+/*! Read some encoded DTMF data.
  * Returns number of bytes received
  */
-extern int (*ast_adsi_read_encoded_dtmf)(struct ast_channel *chan, unsigned char *buf, int maxlen);
+AST_OPTIONAL_API(int, ast_adsi_read_encoded_dtmf, (struct ast_channel *chan, unsigned char *buf, int maxlen), { return 0; });
 
 /* ADSI Layer 3 creation functions */
 
-/*! 
- * \brief Connects an ADSI Display Session 
+/*!
+ * \brief Connects an ADSI Display Session
  * \param buf Character buffer to create parameter in (must have at least 256 free)
  * \param fdn Optional 4 byte Feature Download Number (for loading soft keys)
  * \param ver Optional version number (0-255, or -1 to omit)
@@ -192,25 +184,25 @@
  * \retval -1 on error.
  */
 
-extern int (*ast_adsi_connect_session)(unsigned char *buf, unsigned char *fdn, int ver);
-
-/*! Build Query CPE ID of equipment. 
+AST_OPTIONAL_API(int, ast_adsi_connect_session, (unsigned char *buf, unsigned char *fdn, int ver), { return 0; });
+
+/*! Build Query CPE ID of equipment.
  *  Returns number of bytes added to message
  */
-extern int (*ast_adsi_query_cpeid)(unsigned char *buf);
-extern int (*ast_adsi_query_cpeinfo)(unsigned char *buf);
-
-/*! Get CPE ID from an attached ADSI compatible CPE. 
+AST_OPTIONAL_API(int, ast_adsi_query_cpeid, (unsigned char *buf), { return 0; });
+AST_OPTIONAL_API(int, ast_adsi_query_cpeinfo, (unsigned char *buf), { return 0; });
+
+/*! Get CPE ID from an attached ADSI compatible CPE.
  * Returns 1 on success, storing 4 bytes of CPE ID at buf
  * or -1 on hangup, or 0 if there was no hangup but it failed to find the
  * device ID.  Returns to voice mode if "voice" is non-zero.
  */
-extern int (*ast_adsi_get_cpeid)(struct ast_channel *chan, unsigned char *cpeid, int voice);
-
-extern int (*ast_adsi_get_cpeinfo)(struct ast_channel *chan, int *width, int *height, int *buttons, int voice);
-
-/*! 
- * \brief Begin an ADSI script download 
+AST_OPTIONAL_API(int, ast_adsi_get_cpeid, (struct ast_channel *chan, unsigned char *cpeid, int voice), { return 0; });
+
+AST_OPTIONAL_API(int, ast_adsi_get_cpeinfo, (struct ast_channel *chan, int *width, int *height, int *buttons, int voice), { return 0; });
+
+/*!
+ * \brief Begin an ADSI script download
  * \param buf Character buffer to create parameter in (must have at least 256 free)
  * \param service a 1-18 byte name of the feature
  * \param fdn 4 byte Feature Download Number (for loading soft keys)
@@ -221,38 +213,38 @@
  * \retval -1 on error.
  */
 
-extern int (*ast_adsi_download_connect)(unsigned char *buf, char *service, unsigned char *fdn, unsigned char *sec, int ver);
-
-/*! 
+AST_OPTIONAL_API(int, ast_adsi_download_connect, (unsigned char *buf, char *service, unsigned char *fdn, unsigned char *sec, int ver), { return 0; });
+
+/*!
  * \brief Disconnects a running session.
  * \param buf Character buffer to create parameter in (must have at least 256 free)
  *
  * \retval number of bytes added to buffer
  * \retval -1 on error.
  */
-extern int (*ast_adsi_disconnect_session)(unsigned char *buf);
-
-/*! 
- * \brief Disconnects (and hopefully saves) a downloaded script 
- * \param buf Character buffer to create parameter in (must have at least 256 free)
- *
- * \retval number of bytes added to buffer
- * \retval -1 on error.
- */
-extern int (*ast_adsi_download_disconnect)(unsigned char *buf);
-
-/*! 
+AST_OPTIONAL_API(int, ast_adsi_disconnect_session, (unsigned char *buf), { return 0; });
+
+/*!
+ * \brief Disconnects (and hopefully saves) a downloaded script
+ * \param buf Character buffer to create parameter in (must have at least 256 free)
+ *
+ * \retval number of bytes added to buffer
+ * \retval -1 on error.
+ */
+AST_OPTIONAL_API(int, ast_adsi_download_disconnect, (unsigned char *buf), { return 0; });
+
+/*!
  * \brief Puts CPE in data mode.
  * \param buf Character buffer to create parameter in (must have at least 256 free)
  *
  * \retval number of bytes added to buffer
  * \retval -1 on error.
  */
-extern int (*ast_adsi_data_mode)(unsigned char *buf);
-extern int (*ast_adsi_clear_soft_keys)(unsigned char *buf);
-extern int (*ast_adsi_clear_screen)(unsigned char *buf);
-
-/*! 
+AST_OPTIONAL_API(int, ast_adsi_data_mode, (unsigned char *buf), { return 0; });
+AST_OPTIONAL_API(int, ast_adsi_clear_soft_keys, (unsigned char *buf), { return 0; });
+AST_OPTIONAL_API(int, ast_adsi_clear_screen, (unsigned char *buf), { return 0; });
+
+/*!
  * \brief Puts CPE in voice mode.
  * \param buf Character buffer to create parameter in (must have at least 256 free)
  * \param when (a time in seconds) to make the switch
@@ -260,15 +252,15 @@
  * \retval number of bytes added to buffer
  * \retval -1 on error.
  */
-extern int (*ast_adsi_voice_mode)(unsigned char *buf, int when);
-
-/*! 
- * \brief Returns non-zero if Channel does or might support ADSI 
+AST_OPTIONAL_API(int, ast_adsi_voice_mode, (unsigned char *buf, int when), { return 0; });
+
+/*!
+ * \brief Returns non-zero if Channel does or might support ADSI
  * \param chan Channel to check
  */
-extern int (*ast_adsi_available)(struct ast_channel *chan);
-
-/*! 
+AST_OPTIONAL_API(int, ast_adsi_available, (struct ast_channel *chan), { return 0; });
+
+/*!
  * \brief Loads a line of info into the display.
  * \param buf Character buffer to create parameter in (must have at least 256 free)
  * \param page Page to load (ADSI_COMM_PAGE or ADSI_INFO_PAGE)
@@ -282,10 +274,10 @@
  * \retval -1 on error.
  */
 
-extern int (*ast_adsi_display)(unsigned char *buf, int page, int line, int just, int wrap, char *col1, char *col2);
-
-/*! 
- * \brief Sets the current line and page. 
+AST_OPTIONAL_API(int, ast_adsi_display, (unsigned char *buf, int page, int line, int just, int wrap, char *col1, char *col2), { return 0; });
+
+/*!
+ * \brief Sets the current line and page.
  * \param buf Character buffer to create parameter in (must have at least 256 free)
  * \param page Which page (ADSI_COMM_PAGE or ADSI_INFO_PAGE)
  * \param line Line number (1-33 for info page, 1-4 for comm page)
@@ -294,9 +286,9 @@
  * \retval -1 on error.
  */
 
-extern int (*ast_adsi_set_line)(unsigned char *buf, int page, int line);
-
-/*! 
+AST_OPTIONAL_API(int, ast_adsi_set_line, (unsigned char *buf, int page, int line), { return 0; });
+
+/*!
  * \brief Creates "load soft key" parameters
  * \param buf Character buffer to create parameter in (must have at least 256 free)
  * \param key Key code from 2 to 33, for which key we are loading
@@ -308,10 +300,10 @@
  * \retval number of bytes added to buffer
  * \retval -1 on error.
  */
-extern int (*ast_adsi_load_soft_key)(unsigned char *buf, int key, const char *llabel, const char *slabel, char *ret, int data);
-
-/*! 
- * \brief Set which soft keys should be displayed 
+AST_OPTIONAL_API(int, ast_adsi_load_soft_key, (unsigned char *buf, int key, const char *llabel, const char *slabel, char *ret, int data), { return 0; });
+
+/*!
+ * \brief Set which soft keys should be displayed
  * \param buf Character buffer to create parameter in (must have at least 256 free)
  * \param keys Array of 8 unsigned chars with the key numbers, may be OR'd with ADSI_KEY_HILITE
  *             But remember, the last two keys aren't real keys, they're for scrolling
@@ -319,10 +311,10 @@
  * \retval number of bytes added to buffer
  * \retval -1 on error.
  */
-extern int (*ast_adsi_set_keys)(unsigned char *buf, unsigned char *keys);
-
-/*! 
- * \brief Set input information 
+AST_OPTIONAL_API(int, ast_adsi_set_keys, (unsigned char *buf, unsigned char *keys), { return 0; });
+
+/*!
+ * \brief Set input information
  * \param buf Character buffer to create parameter in (must have at least 256 free)
  * \param page Which page to input on (ADSI_COMM_PAGE or ADSI_INFO_PAGE)
  * \param line Line number to input on
@@ -333,10 +325,10 @@
  * \retval number of bytes added to buffer
  * \retval -1 on error.
  */
-extern int (*ast_adsi_input_control)(unsigned char *buf, int page, int line, int display, int format, int just);
-
-/*! 
- * \brief Set input format 
+AST_OPTIONAL_API(int, ast_adsi_input_control, (unsigned char *buf, int page, int line, int display, int format, int just), { return 0; });
+
+/*!
+ * \brief Set input format
  * \param buf Character buffer to create parameter in (must have at least 256 free)
  * \param num Which format we are setting
  * \param dir Which direction (ADSI_DIR_FROM_LEFT or ADSI_DIR_FROM_RIGHT)
@@ -347,7 +339,7 @@
  * \retval number of bytes added to buffer
  * \retval -1 on error.
  */
-extern int (*ast_adsi_input_format)(unsigned char *buf, int num, int dir, int wrap, char *format1, char *format2);
+AST_OPTIONAL_API(int, ast_adsi_input_format, (unsigned char *buf, int num, int dir, int wrap, char *format1, char *format2), { return 0; });
 
 #endif /* _ASTERISK_ADSI_H */
 

Modified: team/tilghman/auto_preload/include/asterisk/agi.h
URL: http://svnview.digium.com/svn/asterisk/team/tilghman/auto_preload/include/asterisk/agi.h?view=diff&rev=276770&r1=276769&r2=276770
==============================================================================
--- team/tilghman/auto_preload/include/asterisk/agi.h (original)
+++ team/tilghman/auto_preload/include/asterisk/agi.h Thu Jul 15 14:48:32 2010
@@ -69,8 +69,9 @@
  *
  * \param mod Pointer to the module_info structure for the module that is registering the command
  * \param cmd Pointer to the descriptor for the command
- * \return 1 on success, 0 if the command is already registered
- *
+ * \retval 1 on success
+ * \retval 0 the command is already registered
+ * \retval AST_OPTIONAL_API_UNAVAILABLE the module is not loaded.
  */
 AST_OPTIONAL_API(int, ast_agi_register,
 		 (struct ast_module *mod, agi_command *cmd),

Modified: team/tilghman/auto_preload/include/asterisk/crypto.h
URL: http://svnview.digium.com/svn/asterisk/team/tilghman/auto_preload/include/asterisk/crypto.h?view=diff&rev=276770&r1=276769&r2=276770
==============================================================================
--- team/tilghman/auto_preload/include/asterisk/crypto.h (original)
+++ team/tilghman/auto_preload/include/asterisk/crypto.h Thu Jul 15 14:48:32 2010
@@ -1,7 +1,7 @@
 /*
  * Asterisk -- An open source telephony toolkit.
  *
- * Copyright (C) 1999 - 2005, Digium, Inc.
+ * Copyright (C) 1999 - 2010, Digium, Inc.
  *
  * Mark Spencer <markster at digium.com>
  *
@@ -27,12 +27,14 @@
 extern "C" {
 #endif
 
+#include "asterisk/optional_api.h"
+
 #define AST_KEY_PUBLIC	(1 << 0)
 #define AST_KEY_PRIVATE	(1 << 1)
 
 struct ast_key;
 
-/*! 
+/*!
  * \brief Retrieve a key
  * \param name of the key we are retrieving
  * \param int type of key (AST_KEY_PUBLIC or AST_KEY_PRIVATE)
@@ -40,9 +42,9 @@
  * \retval the key on success.
  * \retval NULL on failure.
  */
-extern struct ast_key *(*ast_key_get)(const char *key, int type);
+AST_OPTIONAL_API(struct ast_key *, ast_key_get, (const char *key, int type), { return NULL; });
 
-/*! 
+/*!
  * \brief Check the authenticity of a message signature using a given public key
  * \param key a public key to use to verify
  * \param msg the message that has been signed
@@ -52,9 +54,9 @@
  * \retval -1 otherwise.
  *
  */
-extern int (*ast_check_signature)(struct ast_key *key, const char *msg, const char *sig);
+AST_OPTIONAL_API(int, ast_check_signature, (struct ast_key *key, const char *msg, const char *sig), { return -1; });
 
-/*! 
+/*!
  * \brief Check the authenticity of a message signature using a given public key
  * \param key a public key to use to verify
  * \param msg the message that has been signed
@@ -64,7 +66,7 @@
  * \retval -1 otherwise.
  *
  */
-extern int (*ast_check_signature_bin)(struct ast_key *key, const char *msg, int msglen, const unsigned char *sig);
+AST_OPTIONAL_API(int, ast_check_signature_bin, (struct ast_key *key, const char *msg, int msglen, const unsigned char *sig), { return -1; });
 
 /*!
  * \brief Sign a message signature using a given private key
@@ -77,7 +79,7 @@
  * \retval -1 on failure.
  *
  */
-extern int (*ast_sign)(struct ast_key *key, char *msg, char *sig);
+AST_OPTIONAL_API(int, ast_sign, (struct ast_key *key, char *msg, char *sig), { return -1; });
 
 /*!
  * \brief Sign a message signature using a given private key
@@ -90,7 +92,7 @@
  * \retval -1 on failure.
  *
  */
-extern int (*ast_sign_bin)(struct ast_key *key, const char *msg, int msglen, unsigned char *sig);
+AST_OPTIONAL_API(int, ast_sign_bin, (struct ast_key *key, const char *msg, int msglen, unsigned char *sig), { return -1; });
 
 /*!
  * \brief Encrypt a message using a given private key
@@ -104,7 +106,7 @@
  * \retval -1 on failure.
  *
  */
-extern int (*ast_encrypt_bin)(unsigned char *dst, const unsigned char *src, int srclen, struct ast_key *key);
+AST_OPTIONAL_API(int, ast_encrypt_bin, (unsigned char *dst, const unsigned char *src, int srclen, struct ast_key *key), { return -1; });
 
 /*!
  * \brief Decrypt a message using a given private key
@@ -118,7 +120,10 @@
  * \retval -1 on failure.
  *
  */
-extern int (*ast_decrypt_bin)(unsigned char *dst, const unsigned char *src, int srclen, struct ast_key *key);
+AST_OPTIONAL_API(int, ast_decrypt_bin, (unsigned char *dst, const unsigned char *src, int srclen, struct ast_key *key), { return -1; });
+
+AST_OPTIONAL_API(int, ast_crypto_loaded, (void), { return 0; });
+
 #if defined(__cplusplus) || defined(c_plusplus)
 }
 #endif

Modified: team/tilghman/auto_preload/include/asterisk/optional_api.h
URL: http://svnview.digium.com/svn/asterisk/team/tilghman/auto_preload/include/asterisk/optional_api.h?view=diff&rev=276770&r1=276769&r2=276770
==============================================================================
--- team/tilghman/auto_preload/include/asterisk/optional_api.h (original)
+++ team/tilghman/auto_preload/include/asterisk/optional_api.h Thu Jul 15 14:48:32 2010
@@ -80,6 +80,13 @@
  * definition; this means that any consumers of the API functions so
  * defined will require that the provider of the API functions be
  * loaded before they can reference the symbols.
+ *
+ * WARNING WARNING WARNING WARNING WARNING
+ *
+ * You MUST add the AST_MODFLAG_GLOBAL_SYMBOLS to the module for which you
+ * are enabling optional_api functionality, or it will fail to work.
+ *
+ * WARNING WARNING WARNING WARNING WARNING
  */
 
 #define __stringify_1(x)	#x
@@ -174,11 +181,11 @@
 
 #define AST_OPTIONAL_API(result, name, proto, stub) \
 	result AST_OPTIONAL_API_NAME(name) proto; \
-	__attribute__((alias(__stringify(AST_OPTIONAL_API_NAME(name))))) typeof(AST_OPTIONAL_API_NAME(name)) name;
+	static __attribute__((alias(__stringify(AST_OPTIONAL_API_NAME(name))))) typeof(AST_OPTIONAL_API_NAME(name)) name;
 
 #define AST_OPTIONAL_API_ATTR(result, attr, name, proto, stub)	\
 	result __attribute__((attr)) AST_OPTIONAL_API_NAME(name) proto; \
-	__attribute__((alias(__stringify(AST_OPTIONAL_API_NAME(name))))) typeof(AST_OPTIONAL_API_NAME(name)) name;
+	static __attribute__((alias(__stringify(AST_OPTIONAL_API_NAME(name))))) typeof(AST_OPTIONAL_API_NAME(name)) name;
 
 #else
 

Modified: team/tilghman/auto_preload/main/Makefile
URL: http://svnview.digium.com/svn/asterisk/team/tilghman/auto_preload/main/Makefile?view=diff&rev=276770&r1=276769&r2=276770
==============================================================================
--- team/tilghman/auto_preload/main/Makefile (original)
+++ team/tilghman/auto_preload/main/Makefile Thu Jul 15 14:48:32 2010
@@ -92,7 +92,7 @@
 endif
 
 ifeq ($(GNU_LD),1)
-ASTLINK+=-Wl,--version-script,asterisk.exports
+ASTLINK+=-Wl,--version-script,asterisk.exports,--dynamic-list,asterisk.dynamics
 endif
 
 CHECK_SUBDIR:	# do nothing, just make sure that we recurse in the subdir/

Modified: team/tilghman/auto_preload/main/acl.c
URL: http://svnview.digium.com/svn/asterisk/team/tilghman/auto_preload/main/acl.c?view=diff&rev=276770&r1=276769&r2=276770
==============================================================================
--- team/tilghman/auto_preload/main/acl.c (original)
+++ team/tilghman/auto_preload/main/acl.c Thu Jul 15 14:48:32 2010
@@ -529,8 +529,8 @@
 	}
 	close(s);
 	ast_debug(3, "For destination '%s', our source address is '%s'.\n",
-		  ast_sockaddr_stringify_addr(them),
-		  ast_sockaddr_stringify_addr(us));
+		  ast_strdupa(ast_sockaddr_stringify_addr(them)),
+		  ast_strdupa(ast_sockaddr_stringify_addr(us)));
 
 	ast_sockaddr_set_port(us, port);
 

Modified: team/tilghman/auto_preload/main/asterisk.dynamics
URL: http://svnview.digium.com/svn/asterisk/team/tilghman/auto_preload/main/asterisk.dynamics?view=diff&rev=276770&r1=276769&r2=276770
==============================================================================
--- team/tilghman/auto_preload/main/asterisk.dynamics (original)
+++ team/tilghman/auto_preload/main/asterisk.dynamics Thu Jul 15 14:48:32 2010
@@ -1,6 +1,14 @@
 {
-	ast_agi_*;
-	ast_pktccops_*;
-	ast_smdi_*;
-	ast_monitor_*;
+	*ast_adsi_*;
+	*ast_agi_*;
+	*ast_pktccops_*;
+	*ast_smdi_*;
+	*ast_monitor_*;
+	*ast_key_get;
+	*ast_check_signature;
+	*ast_check_signature_bin;
+	*ast_sign;
+	*ast_sign_bin;
+	*ast_encrypt_bin;
+	*ast_decrypt_bin;
 };

Modified: team/tilghman/auto_preload/main/channel.c
URL: http://svnview.digium.com/svn/asterisk/team/tilghman/auto_preload/main/channel.c?view=diff&rev=276770&r1=276769&r2=276770
==============================================================================
--- team/tilghman/auto_preload/main/channel.c (original)
+++ team/tilghman/auto_preload/main/channel.c Thu Jul 15 14:48:32 2010
@@ -4553,7 +4553,7 @@
 		res = 0;	/* XXX explain, why 0 ? */
 		goto done;
 	}
-	if (chan->generatordata && strcasecmp(fr->src, "ast_prod")) {
+	if (chan->generatordata && (!fr->src || strcasecmp(fr->src, "ast_prod"))) {
 		if (ast_test_flag(chan, AST_FLAG_WRITE_INT)) {
 				ast_deactivate_generator(chan);
 		} else {

Modified: team/tilghman/auto_preload/main/dnsmgr.c
URL: http://svnview.digium.com/svn/asterisk/team/tilghman/auto_preload/main/dnsmgr.c?view=diff&rev=276770&r1=276769&r2=276770
==============================================================================
--- team/tilghman/auto_preload/main/dnsmgr.c (original)
+++ team/tilghman/auto_preload/main/dnsmgr.c Thu Jul 15 14:48:32 2010
@@ -161,8 +161,8 @@
 			ast_sockaddr_set_port(&tmp, ast_sockaddr_port(entry->result));
 		if (ast_sockaddr_cmp(&tmp, entry->result)) {
 			ast_log(LOG_NOTICE, "dnssrv: host '%s' changed from %s to %s\n",
-					entry->name, ast_sockaddr_stringify(entry->result),
-					ast_sockaddr_stringify(&tmp));
+					entry->name, ast_strdupa(ast_sockaddr_stringify(entry->result)),
+					ast_strdupa(ast_sockaddr_stringify(&tmp)));
 
 			ast_sockaddr_copy(entry->result, &tmp);
 			changed = entry->changed = 1;

Modified: team/tilghman/auto_preload/res/res_adsi.c
URL: http://svnview.digium.com/svn/asterisk/team/tilghman/auto_preload/res/res_adsi.c?view=diff&rev=276770&r1=276769&r2=276770
==============================================================================
--- team/tilghman/auto_preload/res/res_adsi.c (original)
+++ team/tilghman/auto_preload/res/res_adsi.c Thu Jul 15 14:48:32 2010
@@ -20,9 +20,9 @@
 
 /*! \file
  *
- * \brief ADSI support 
+ * \brief ADSI support
  *
- * \author Mark Spencer <markster at digium.com> 
+ * \author Mark Spencer <markster at digium.com>
  *
  * \note this module is required by app_voicemail and app_getcpeid
  * \todo Move app_getcpeid into this module
@@ -37,7 +37,6 @@
 #include <time.h>
 #include <math.h>
 
-#include "asterisk/adsi.h"
 #include "asterisk/ulaw.h"
 #include "asterisk/alaw.h"
 #include "asterisk/callerid.h"
@@ -47,6 +46,9 @@
 #include "asterisk/config.h"
 #include "asterisk/file.h"
 
+#define AST_API_MODULE
+#include "asterisk/adsi.h"
+
 #define DEFAULT_ADSI_MAX_RETRIES 3
 
 #define ADSI_MAX_INTRO 20
@@ -73,20 +75,22 @@
 	/* Initial carrier (imaginary) */
 	float cr = 1.0, ci = 0.0, scont = 0.0;
 
-	if (msglen > 255)
+	if (msglen > 255) {
 		msglen = 255;
+	}
 
 	/* If first message, Send 150ms of MARK's */
 	if (msgnum == 1) {
-		for (x = 0; x < 150; x++)	/* was 150 */
+		for (x = 0; x < 150; x++) { /* was 150 */
 			PUT_CLID_MARKMS;
+		}
 	}
 
 	/* Put message type */
 	PUT_CLID(msgtype);
 	sum = msgtype;
 
-	/* Put message length (plus one  for the message number) */
+	/* Put message length (plus one for the message number) */
 	PUT_CLID(msglen + 1);
 	sum += msglen + 1;
 
@@ -106,8 +110,9 @@
 #if 0
 	if (last) {
 		/* Put trailing marks */
-		for (x = 0; x < 50; x++)
+		for (x = 0; x < 50; x++) {
 			PUT_CLID_MARKMS;
+		}
 	}
 #endif
 	return bytes;
@@ -128,10 +133,11 @@
 		amt = len;
 
 		/* Send remainder if provided */
-		if (amt > *remain)
+		if (amt > *remain) {
 			amt = *remain;
-		else
+		} else {
 			*remain = *remain - amt;
+		}
 		outf.frametype = AST_FRAME_VOICE;
 		outf.subclass.codec = AST_FORMAT_ULAW;
 		outf.data.ptr = buf;
@@ -146,32 +152,35 @@
 		len -= amt;
 	}
 
-	while(len) {
+	while (len) {
 		amt = len;
 		/* If we don't get anything at all back in a second, forget
 		   about it */
-		if (ast_waitfor(chan, 1000) < 1)
+		if (ast_waitfor(chan, 1000) < 1) {
 			return -1;
+		}
 		/* Detect hangup */
-		if (!(inf = ast_read(chan)))
+		if (!(inf = ast_read(chan))) {
 			return -1;
+		}
 
 		/* Drop any frames that are not voice */
 		if (inf->frametype != AST_FRAME_VOICE) {
 			ast_frfree(inf);
 			continue;
 		}
-		
+
 		if (inf->subclass.codec != AST_FORMAT_ULAW) {
 			ast_log(LOG_WARNING, "Channel not in ulaw?\n");
 			ast_frfree(inf);
 			return -1;
 		}
 		/* Send no more than they sent us */
-		if (amt > inf->datalen)
+		if (amt > inf->datalen) {
 			amt = inf->datalen;
-		else if (remain)
+		} else if (remain) {
 			*remain = inf->datalen - amt;
+		}
 		outf.frametype = AST_FRAME_VOICE;
 		outf.subclass.codec = AST_FORMAT_ULAW;
 		outf.data.ptr = buf;
@@ -204,23 +213,25 @@
 		return -1;
 	}
 
-	while(retries < maxretries) {
+	while (retries < maxretries) {
 		if (!(chan->adsicpe & ADSI_FLAG_DATAMODE)) {
 			/* Generate CAS (no SAS) */
 			ast_gen_cas(buf, 0, 680, AST_FORMAT_ULAW);
-		
+
 			/* Send CAS */
-			if (adsi_careful_send(chan, buf, 680, NULL))
+			if (adsi_careful_send(chan, buf, 680, NULL)) {
 				ast_log(LOG_WARNING, "Unable to send CAS\n");
+			}
 
 			/* Wait For DTMF result */
 			waittime = 500;
-			for(;;) {
+			for (;;) {
 				if (((res = ast_waitfor(chan, waittime)) < 1)) {
 					/* Didn't get back DTMF A in time */
 					ast_debug(1, "No ADSI CPE detected (%d)\n", res);
-					if (!chan->adsicpe)
+					if (!chan->adsicpe) {
 						chan->adsicpe = AST_ADSI_UNAVAILABLE;
+					}
 					errno = ENOSYS;
 					return -1;
 				}
@@ -232,16 +243,19 @@
 				if (f->frametype == AST_FRAME_DTMF) {
 					if (f->subclass.integer == 'A') {
 						/* Okay, this is an ADSI CPE.  Note this for future reference, too */
-						if (!chan->adsicpe)
+						if (!chan->adsicpe) {
 							chan->adsicpe = AST_ADSI_AVAILABLE;
+						}
 						break;
 					} else {
-						if (f->subclass.integer == 'D')
+						if (f->subclass.integer == 'D') {
 							ast_debug(1, "Off-hook capable CPE only, not ADSI\n");
-						else
+						} else {
 							ast_log(LOG_WARNING, "Unknown ADSI response '%c'\n", f->subclass.integer);
-						if (!chan->adsicpe)
+						}
+						if (!chan->adsicpe) {
 							chan->adsicpe = AST_ADSI_UNAVAILABLE;
+						}
 						errno =	ENOSYS;
 						ast_frfree(f);
 						return -1;
@@ -266,36 +280,39 @@
 				return -1;
 			}
 			ast_debug(1, "Message %d, of %d input bytes, %d output bytes\n", x + 1, msglen[x], res);
-			pos += res; 
+			pos += res;
 			x++;
 		}
 
 
 		rem = 0;
-		res = adsi_careful_send(chan, buf, pos, &rem); 
-		if (!def)
+		res = adsi_careful_send(chan, buf, pos, &rem);
+		if (!def) {
 			ast_channel_undefer_dtmf(chan);
-		if (res)
+		}
+		if (res) {
 			return -1;
+		}
 
 		ast_debug(1, "Sent total spill of %d bytes\n", pos);
 
 		memset(ack, 0, sizeof(ack));
 		/* Get real result and check for hangup */
-		if ((res = ast_readstring(chan, ack, 2, 1000, 1000, "")) < 0)
+		if ((res = ast_readstring(chan, ack, 2, 1000, 1000, "")) < 0) {
 			return -1;
+		}
 		if (ack[0] == 'D') {
 			ast_debug(1, "Acked up to message %d\n", atoi(ack + 1)); start += atoi(ack + 1);
-			if (start >= x)
+			if (start >= x) {
 				break;
-			else {
+			} else {
 				retries++;
 				ast_debug(1, "Retransmitting (%d), from %d\n", retries, start + 1);
 			}
 		} else {
 			retries++;
 			ast_log(LOG_WARNING, "Unexpected response to ack: %s (retry %d)\n", ack, retries);
-		} 
+		}
 	}
 	if (retries >= maxretries) {
 		ast_log(LOG_WARNING, "Maximum ADSI Retries (%d) exceeded\n", maxretries);

[... 1450 lines stripped ...]



More information about the asterisk-commits mailing list