[asterisk-commits] pabelanger: branch pabelanger/issue18183 r292783 - /team/pabelanger/issue1818...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Oct 22 15:31:48 CDT 2010


Author: pabelanger
Date: Fri Oct 22 15:31:44 2010
New Revision: 292783

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=292783
Log:
new realtime option for build_peer()

Modified:
    team/pabelanger/issue18183/channels/chan_iax2.c

Modified: team/pabelanger/issue18183/channels/chan_iax2.c
URL: http://svnview.digium.com/svn/asterisk/team/pabelanger/issue18183/channels/chan_iax2.c?view=diff&rev=292783&r1=292782&r2=292783
==============================================================================
--- team/pabelanger/issue18183/channels/chan_iax2.c (original)
+++ team/pabelanger/issue18183/channels/chan_iax2.c Fri Oct 22 15:31:44 2010
@@ -1193,7 +1193,7 @@
 static int send_command_transfer(struct chan_iax2_pvt *, char, int, unsigned int, const unsigned char *, int);
 static struct ast_channel *iax2_request(const char *type, format_t format, const struct ast_channel *requestor, void *data, int *cause);
 static struct ast_frame *iax2_read(struct ast_channel *c);
-static struct iax2_peer *build_peer(const char *name, struct ast_variable *v, struct ast_variable *alt, int temponly);
+static struct iax2_peer *build_peer(const char *name, struct ast_variable *v, struct ast_variable *alt, int temponly, int realtime);
 static struct iax2_user *build_user(const char *name, struct ast_variable *v, struct ast_variable *alt, int temponly);
 static void realtime_update_peer(const char *peername, struct ast_sockaddr *sockaddr, time_t regtime);
 static void *iax2_dup_variable_datastore(void *);
@@ -4350,7 +4350,7 @@
 		return NULL;
 	}
 
-	peer = build_peer(peername, var, NULL, ast_test_flag64((&globalflags), IAX_RTCACHEFRIENDS) ? 0 : 1);
+	peer = build_peer(peername, var, NULL, ast_test_flag64((&globalflags), IAX_RTCACHEFRIENDS) ? 0 : 1, 1);
 	ast_variables_destroy(var);
 	if (!peer) {
 		return NULL;
@@ -12245,7 +12245,7 @@
 }
 
 /*! \brief Create peer structure based on configuration */
-static struct iax2_peer *build_peer(const char *name, struct ast_variable *v, struct ast_variable *alt, int temponly)
+static struct iax2_peer *build_peer(const char *name, struct ast_variable *v, struct ast_variable *alt, int temponly, int realtime)
 {
 	struct iax2_peer *peer = NULL;
 	struct ast_ha *oldha = NULL;
@@ -12412,7 +12412,7 @@
 				if (!ast_test_flag64(peer, IAX_DYNAMIC)) {
 					if (port_str2int(v->value, 0) > 0) {
 						ast_sockaddr_set_port(&peer->addr, atoi(v->value));
-					} else {
+					} else if (!realtime) {
                                                 ast_log(LOG_WARNING, "Invalid peer port configuration at line %d : %s\n", v->lineno, v->value);
 					}
 				} else {
@@ -13299,7 +13299,7 @@
 						ao2_link(users, user);
 						user = user_unref(user);
 					}
-					peer = build_peer(cat, gen, ast_variable_browse(ucfg, cat), 0);
+					peer = build_peer(cat, gen, ast_variable_browse(ucfg, cat), 0, 0);
 					if (peer) {
 						if (ast_test_flag64(peer, IAX_DYNAMIC))
 							reg_source_db(peer);
@@ -13347,7 +13347,7 @@
 					}
 				}
 				if (!strcasecmp(utype, "peer") || !strcasecmp(utype, "friend")) {
-					peer = build_peer(cat, ast_variable_browse(cfg, cat), NULL, 0);
+					peer = build_peer(cat, ast_variable_browse(cfg, cat), NULL, 0, 0);
 					if (peer) {
 						if (ast_test_flag64(peer, IAX_DYNAMIC))
 							reg_source_db(peer);
@@ -14067,7 +14067,7 @@
 	}
 
 	/* build a test peer */
-	peer = build_peer("test_peer_data_provider", NULL, NULL, 0);
+	peer = build_peer("test_peer_data_provider", NULL, NULL, 0, 0);
 	if (!peer) {
 		return AST_TEST_FAIL;
 	}




More information about the asterisk-commits mailing list