[asterisk-commits] dlee: branch dlee/performance r399529 - in /team/dlee/performance: ./ bridges...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Fri Sep 20 10:45:43 CDT 2013
Author: dlee
Date: Fri Sep 20 10:45:42 2013
New Revision: 399529
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=399529
Log:
Merged revisions 399339-399514 from http://svn.asterisk.org/svn/asterisk/branches/12
Modified:
team/dlee/performance/ (props changed)
team/dlee/performance/bridges/bridge_softmix.c
team/dlee/performance/build_tools/prep_tarball
team/dlee/performance/channels/chan_sip.c
team/dlee/performance/main/abstract_jb.c
team/dlee/performance/main/logger.c
team/dlee/performance/main/optional_api.c
team/dlee/performance/res/res_pjsip_messaging.c
Propchange: team/dlee/performance/
------------------------------------------------------------------------------
Binary property 'branch-11-merged' - no diff available.
Propchange: team/dlee/performance/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Fri Sep 20 10:45:42 2013
@@ -1,1 +1,1 @@
-/branches/12:1-399337
+/branches/12:1-399528
Modified: team/dlee/performance/bridges/bridge_softmix.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/performance/bridges/bridge_softmix.c?view=diff&rev=399529&r1=399528&r2=399529
==============================================================================
--- team/dlee/performance/bridges/bridge_softmix.c (original)
+++ team/dlee/performance/bridges/bridge_softmix.c Fri Sep 20 10:45:42 2013
@@ -1044,6 +1044,7 @@
ast_mutex_init(&softmix_data->lock);
softmix_data->timer = ast_timer_open();
if (!softmix_data->timer) {
+ ast_log(AST_LOG_WARNING, "Failed to open timer for softmix bridge\n");
softmix_bridge_data_destroy(softmix_data);
return -1;
}
Modified: team/dlee/performance/build_tools/prep_tarball
URL: http://svnview.digium.com/svn/asterisk/team/dlee/performance/build_tools/prep_tarball?view=diff&rev=399529&r1=399528&r2=399529
==============================================================================
--- team/dlee/performance/build_tools/prep_tarball (original)
+++ team/dlee/performance/build_tools/prep_tarball Fri Sep 20 10:45:42 2013
@@ -19,11 +19,11 @@
cd doc
echo "Downloading the PDF and HTML documentation from the Asterisk wiki (this will take a minute) ..."
-wget https://wiki.asterisk.org/wiki/download/attachments/19005471/Asterisk-Admin-Guide-$branch.pdf
+wget https://wiki.asterisk.org/wiki/download/attachments/19005471/Asterisk-$branch-Reference.pdf
+wget https://wiki.asterisk.org/wiki/download/attachments/19005471/Asterisk-Admin-Guide.pdf
wget https://wiki.asterisk.org/wiki/download/attachments/19005471/Asterisk-Admin-Guide-$branch.html.zip
echo "Extracting HTML Admin Guide"
unzip Asterisk-Admin-Guide-$branch.html.zip
mv AST/ Asterisk-Admin-Guide/
-mv Asterisk-Admin-Guide-$branch.pdf Asterisk-Admin-Guide.pdf
rm -f Asterisk-Admin-Guide-$branch.html.zip
echo "Documentation downloaded. Goodbye!"
Modified: team/dlee/performance/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/performance/channels/chan_sip.c?view=diff&rev=399529&r1=399528&r2=399529
==============================================================================
--- team/dlee/performance/channels/chan_sip.c (original)
+++ team/dlee/performance/channels/chan_sip.c Fri Sep 20 10:45:42 2013
@@ -13438,13 +13438,9 @@
/* Our T.38 end is */
ast_udptl_get_us(p->udptl, &udptladdr);
- /* Determine T.38 UDPTL destination */
- if (!ast_sockaddr_isnull(&p->udptlredirip)) {
- ast_sockaddr_copy(&udptldest, &p->udptlredirip);
- } else {
- ast_sockaddr_copy(&udptldest, &p->ourip);
- ast_sockaddr_set_port(&udptldest, ast_sockaddr_port(&udptladdr));
- }
+ /* We don't use directmedia for T.38, so keep the destination the same as our IP address. */
+ ast_sockaddr_copy(&udptldest, &p->ourip);
+ ast_sockaddr_set_port(&udptldest, ast_sockaddr_port(&udptladdr));
if (debug) {
ast_debug(1, "T.38 UDPTL is at %s port %d\n", ast_sockaddr_stringify_addr(&p->ourip), ast_sockaddr_port(&udptladdr));
@@ -13455,9 +13451,9 @@
ast_str_append(&m_modem, 0, "m=image %d udptl t38\r\n", ast_sockaddr_port(&udptldest));
- if (!ast_sockaddr_cmp(&udptldest, &dest)) {
+ if (ast_sockaddr_cmp(&udptldest, &dest)) {
ast_str_append(&m_modem, 0, "c=IN %s %s\r\n",
- (ast_sockaddr_is_ipv6(&dest) && !ast_sockaddr_is_ipv4_mapped(&dest)) ?
+ (ast_sockaddr_is_ipv6(&udptldest) && !ast_sockaddr_is_ipv4_mapped(&udptldest)) ?
"IP6" : "IP4", ast_sockaddr_stringify_addr_remote(&udptldest));
}
Modified: team/dlee/performance/main/abstract_jb.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/performance/main/abstract_jb.c?view=diff&rev=399529&r1=399528&r2=399529
==============================================================================
--- team/dlee/performance/main/abstract_jb.c (original)
+++ team/dlee/performance/main/abstract_jb.c Fri Sep 20 10:45:42 2013
@@ -446,7 +446,7 @@
int safe_fd;
snprintf(name2, sizeof(name2), "%s", ast_channel_name(chan));
- if ((tmp = strchr(name2, '/'))) {
+ while ((tmp = strchr(name2, '/'))) {
*tmp = '#';
}
@@ -454,7 +454,7 @@
ast_assert(bridged != NULL);
snprintf(name1, sizeof(name1), "%s", ast_channel_name(bridged));
- if ((tmp = strchr(name1, '/'))) {
+ while ((tmp = strchr(name1, '/'))) {
*tmp = '#';
}
Modified: team/dlee/performance/main/logger.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/performance/main/logger.c?view=diff&rev=399529&r1=399528&r2=399529
==============================================================================
--- team/dlee/performance/main/logger.c (original)
+++ team/dlee/performance/main/logger.c Fri Sep 20 10:45:42 2013
@@ -1632,6 +1632,7 @@
res = ast_str_set_va(&buf, 0, fmt, ap);
/* If the build failed then we can drop this allocated message */
if (res == AST_DYNSTR_BUILD_FAILED) {
+ ast_free(buf);
return;
}
@@ -1659,6 +1660,7 @@
} while (p && *p);
ast_log_callid(__LOG_VERBOSE, file, line, func, callid, "%s", ast_str_buffer(prefixed));
+ ast_free(buf);
}
void __ast_verbose(const char *file, int line, const char *func, int level, const char *fmt, ...)
Modified: team/dlee/performance/main/optional_api.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/performance/main/optional_api.c?view=diff&rev=399529&r1=399528&r2=399529
==============================================================================
--- team/dlee/performance/main/optional_api.c (original)
+++ team/dlee/performance/main/optional_api.c Fri Sep 20 10:45:42 2013
@@ -76,7 +76,7 @@
static void optional_api_user_destroy(struct optional_api_user *user)
{
*user->optional_ref = user->stub;
- free(user);
+ ast_std_free(user);
}
/*!
@@ -95,7 +95,7 @@
struct optional_api_user *user;
size_t size = sizeof(*user) + strlen(module) + 1;
- user = calloc(1, size);
+ user = ast_std_calloc(1, size);
if (!user) {
return NULL;
}
@@ -117,10 +117,10 @@
while (api->users_len--) {
optional_api_user_destroy(api->users[api->users_len]);
}
- free(api->users);
+ ast_std_free(api->users);
api->users = NULL;
api->users_maxlen = 0;
- free(api);
+ ast_std_free(api);
}
/*!
@@ -137,7 +137,7 @@
ast_verb(6, "%s: building api object\n", symname);
size = sizeof(*api) + strlen(symname) + 1;
- api = calloc(1, size);
+ api = ast_std_calloc(1, size);
if (!api) {
ast_log(LOG_ERROR, "Failed to allocate api\n");
return NULL;
@@ -181,13 +181,16 @@
/* API not found. Build one */
api = optional_api_create(symname);
+ if (!api) {
+ return NULL;
+ }
/* Grow the list, if needed */
if (apis.len + 1 > apis.maxlen) {
size_t new_maxlen = apis.maxlen ? 2 * apis.maxlen : 1;
- struct optional_api **new_list =
- realloc(apis.list, new_maxlen * sizeof(*new_list));
-
+ struct optional_api **new_list;
+
+ new_list = ast_std_realloc(apis.list, new_maxlen * sizeof(*new_list));
if (!new_list) {
optional_api_destroy(api);
ast_log(LOG_ERROR, "Failed to allocate api list\n");
@@ -300,11 +303,10 @@
/* Add user to the API */
if (api->users_len + 1 > api->users_maxlen) {
- size_t new_maxlen = api->users_maxlen ?
- 2 * api->users_maxlen : 1;
- struct optional_api_user **new_list =
- realloc(api->users, new_maxlen * sizeof(*new_list));
-
+ size_t new_maxlen = api->users_maxlen ? 2 * api->users_maxlen : 1;
+ struct optional_api_user **new_list;
+
+ new_list = ast_std_realloc(api->users, new_maxlen * sizeof(*new_list));
if (!new_list) {
optional_api_user_destroy(user);
ast_log(LOG_ERROR, "Failed to allocate api list\n");
@@ -336,6 +338,7 @@
for (i = 0; i < api->users_len; ++i) {
struct optional_api_user *user = api->users[i];
+
if (user->optional_ref == optional_ref) {
if (*user->optional_ref != user->stub) {
ast_verb(4, "%s: stubbing for %s\n", symname,
Modified: team/dlee/performance/res/res_pjsip_messaging.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/performance/res/res_pjsip_messaging.c?view=diff&rev=399529&r1=399528&r2=399529
==============================================================================
--- team/dlee/performance/res/res_pjsip_messaging.c (original)
+++ team/dlee/performance/res/res_pjsip_messaging.c Fri Sep 20 10:45:42 2013
@@ -135,6 +135,8 @@
if ((*uri = strchr(name, '/'))) {
*(*uri)++ = '\0';
+ } else if ((*uri = strchr(name, '@'))) {
+ *(*uri) = '\0';
}
/* endpoint is required */
@@ -163,7 +165,6 @@
*/
static void update_from(pjsip_tx_data *tdata, const char *from)
{
- /* static const pj_str_t hname = { "From", 4 }; */
pjsip_name_addr *from_name_addr;
pjsip_sip_uri *from_uri;
pjsip_uri *parsed;
@@ -206,6 +207,49 @@
}
pj_strdup2(tdata->pool, &from_uri->user, uri);
}
+}
+
+static char *scheme_sip_to_pjsip(pjsip_rx_data *rdata, char *buf, unsigned int size)
+{
+ char *res = buf;
+ pjsip_name_addr *name_addr = (pjsip_name_addr *)rdata->msg_info.to->uri;
+ pjsip_sip_uri *sip_uri = pjsip_uri_get_uri(name_addr->uri);
+
+ const pj_str_t *scheme = pjsip_uri_get_scheme(rdata->msg_info.to->uri);
+ size_t size_scheme = pj_strlen(scheme);
+ size_t size_user = pj_strlen(&sip_uri->user);
+ size_t size_host = pj_strlen(&sip_uri->host);
+
+ /* 5 = count of 'p' 'j' ':' '@' '\0' */
+ if (size < size_scheme + size_user + size_host + 5) {
+ /* won't fit */
+ ast_log(LOG_WARNING, "Unable to handle MESSAGE- incoming uri "
+ "too large for given buffer\n");
+ return NULL;
+ }
+
+ *buf++ = 'p';
+ *buf++ = 'j';
+
+ memcpy(buf, pj_strbuf(scheme), size_scheme);
+ buf += size_scheme;
+ *buf++ = ':';
+
+ memcpy(buf, pj_strbuf(&sip_uri->user), size_user);
+ buf += size_user;
+ *buf++ = '@';
+
+ memcpy(buf, pj_strbuf(&sip_uri->host), size_host);
+ buf += size_host;
+ *buf = '\0';
+
+ return res;
+}
+
+static char *scheme_pjsip_to_sip(const char *uri)
+{
+ ast_assert(!strncmp(uri, "pjsip", 5));
+ return ast_strdup(uri + 2);
}
/*!
@@ -273,8 +317,13 @@
}
sprintf((char*)value, "%d", max_forwards);
ast_sip_add_header(tdata, name, value);
- }
- else if (!is_msg_var_blocked(name)) {
+ } else if (!strcasecmp(name, "To")) {
+ char *to = scheme_pjsip_to_sip(value);
+ if (to) {
+ ast_sip_add_header(tdata, name, to);
+ ast_free(to);
+ }
+ } else if (!is_msg_var_blocked(name)) {
ast_sip_add_header(tdata, name, value);
}
ast_msg_var_unref_current(i);
@@ -283,7 +332,7 @@
}
/*!
- * \internal
+ * \internal
* \brief Copies any other request header data over to ast_msg structure.
*
* \param rdata The SIP request
@@ -373,11 +422,7 @@
CHECK_RES(ast_msg_set_exten(msg, "%s", buf));
/* to header */
- name_addr = (pjsip_name_addr *)rdata->msg_info.to->uri;
- if ((size = pjsip_uri_print(PJSIP_URI_IN_FROMTO_HDR, name_addr, buf, sizeof(buf)-1)) > 0) {
- buf[size] = '\0';
- CHECK_RES(ast_msg_set_to(msg, "%s", buf));
- }
+ CHECK_RES(ast_msg_set_to(msg, "%s", scheme_sip_to_pjsip(rdata, buf, sizeof(buf))));
/* from header */
name_addr = (pjsip_name_addr *)rdata->msg_info.from->uri;
@@ -439,7 +484,7 @@
/* typecast to suppress const warning */
mdata->msg = ast_msg_ref((struct ast_msg*)msg);
- mdata->to = ast_strdup(to);
+ mdata->to = scheme_pjsip_to_sip(to);
mdata->from = ast_strdup(from);
/* sometimes from can still contain the tag at this point, so remove it */
@@ -509,7 +554,7 @@
}
static const struct ast_msg_tech msg_tech = {
- .name = "sip",
+ .name = "pjsip",
.msg_send = sip_msg_send,
};
More information about the asterisk-commits
mailing list