[svn-commits] mjordan: branch mjordan/12-messaging r418442 - in /team/mjordan/12-messaging:...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Sat Jul 12 16:07:49 CDT 2014


Author: mjordan
Date: Sat Jul 12 16:07:44 2014
New Revision: 418442

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=418442
Log:
fix chan_iax2; update unit tests with tech/endpoint

Modified:
    team/mjordan/12-messaging/channels/chan_iax2.c
    team/mjordan/12-messaging/include/asterisk/message.h
    team/mjordan/12-messaging/tests/test_message.c

Modified: team/mjordan/12-messaging/channels/chan_iax2.c
URL: http://svnview.digium.com/svn/asterisk/team/mjordan/12-messaging/channels/chan_iax2.c?view=diff&rev=418442&r1=418441&r2=418442
==============================================================================
--- team/mjordan/12-messaging/channels/chan_iax2.c (original)
+++ team/mjordan/12-messaging/channels/chan_iax2.c Sat Jul 12 16:07:44 2014
@@ -5792,6 +5792,8 @@
 
 	if (!ast_strlen_zero(i->peer)) {
 		peer_name = ast_strdupa(i->peer);
+	} else if (!ast_strlen_zero(i->host)) {
+		peer_name = ast_strdupa(i->host);
 	}
 
 	/* Don't hold call lock while making a channel or looking up a peer */

Modified: team/mjordan/12-messaging/include/asterisk/message.h
URL: http://svnview.digium.com/svn/asterisk/team/mjordan/12-messaging/include/asterisk/message.h?view=diff&rev=418442&r1=418441&r2=418442
==============================================================================
--- team/mjordan/12-messaging/include/asterisk/message.h (original)
+++ team/mjordan/12-messaging/include/asterisk/message.h Sat Jul 12 16:07:44 2014
@@ -222,9 +222,25 @@
 int __attribute__((format(printf, 2, 3)))
 		ast_msg_set_exten(struct ast_msg *msg, const char *fmt, ...);
 
+/*!
+ * \brief Set the technology associated with this message
+ *
+ * \since 12.5.0
+ *
+ * \retval 0 success
+ * \retval -1 failure
+ */
 int __attribute__((format(printf, 2, 3)))
 		ast_msg_set_tech(struct ast_msg *msg, const char *fmt, ...);
 
+/*!
+ * \brief Set the technology's endpoint associated with this message
+ *
+ * \since 12.5.0
+ *
+ * \retval 0 success
+ * \retval -1 failure
+ */
 int __attribute__((format(printf, 2, 3)))
 		ast_msg_set_endpoint(struct ast_msg *msg, const char *fmt, ...);
 	
@@ -275,6 +291,7 @@
 
 /*!
  * \brief Retrieve the source of this message
+ *
  * \since 12.5.0
  *
  * \param msg The message to get the soure from
@@ -286,6 +303,7 @@
 
 /*!
  * \brief Retrieve the destination of this message
+ *
  * \since 12.5.0
  *
  * \param msg The message to get the destination from
@@ -295,11 +313,33 @@
  */
 const char *ast_msg_get_to(const struct ast_msg *msg);
 
+/*!
+ * \brief Retrieve the technology associated with this message
+ *
+ * \since 12.5.0
+ *
+ * \param msg The message to get the technology from
+ *
+ * \retval The technology of the message
+ * \retval NULL or empty string if the message has no associated technology
+ */
 const char *ast_msg_get_tech(const struct ast_msg *msg);
+
+/*!
+ * \brief Retrieve the endpoint associated with this message
+ *
+ * \since 12.5.0
+ *
+ * \param msg The message to get the endpoint from
+ *
+ * \retval The endpoint associated with the message
+ * \retval NULL or empty string if the message has no associated endpoint
+ */
 const char *ast_msg_get_endpoint(const struct ast_msg *msg);
 
 /*!
  * \brief Determine if a particular message has a destination via some handler
+ *
  * \since 12.5.0
  *
  * \param msg The message to check

Modified: team/mjordan/12-messaging/tests/test_message.c
URL: http://svnview.digium.com/svn/asterisk/team/mjordan/12-messaging/tests/test_message.c?view=diff&rev=418442&r1=418441&r2=418442
==============================================================================
--- team/mjordan/12-messaging/tests/test_message.c (original)
+++ team/mjordan/12-messaging/tests/test_message.c Sat Jul 12 16:07:44 2014
@@ -90,6 +90,7 @@
 static int test_msg_handle_msg_cb(struct ast_msg *msg);
 static int test_msg_has_destination_cb(const struct ast_msg *msg);
 
+/*! \brief Our test message handler */
 static struct ast_msg_handler test_msg_handler = {
 	.name = "testmsg",
 	.handle_msg = test_msg_handle_msg_cb,
@@ -98,6 +99,7 @@
 
 static int user_event_hook_cb(int category, const char *event, char *body);
 
+/*! \brief AMI event hook that verifies whether or not we've gotten our user events */
 static struct manager_custom_hook user_event_hook = {
 	.file = AST_MODULE,
 	.helper = user_event_hook_cb,
@@ -415,6 +417,18 @@
 	ast_test_validate(test, result == 0);
 	actual = ast_msg_get_body(msg);
 	ast_test_validate(test, !strcmp(actual, "BodyTest: foo"));
+
+	/* Test setting/getting technology */
+	result = ast_msg_set_tech(msg, "%s", "my_tech");
+	ast_test_validate(test, result == 0);
+	actual = ast_msg_get_tech(msg);
+	ast_test_validate(test, !strcmp(actual, "my_tech"));
+
+	/* Test setting/getting endpoint */
+	result = ast_msg_set_endpoint(msg, "%s", "terminus");
+	ast_test_validate(test, result == 0);
+	actual = ast_msg_get_tech(msg);
+	ast_test_validate(test, !strcmp(actual, "terminus"));
 
 	/* Test setting/getting non-outbound variable */
 	result = ast_msg_set_var(msg, "foo", "bar");




More information about the svn-commits mailing list