mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-05 12:16:00 +00:00
Trim down gateway names with []'s in them
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@850 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -448,7 +448,7 @@ static int mgcp_audit_endpoint(int fd, int argc, char *argv[])
|
|||||||
struct mgcp_gateway *g;
|
struct mgcp_gateway *g;
|
||||||
struct mgcp_endpoint *e;
|
struct mgcp_endpoint *e;
|
||||||
int found = 0;
|
int found = 0;
|
||||||
char *ename,*gname;
|
char *ename,*gname, *c;
|
||||||
if (!mgcpdebug) {
|
if (!mgcpdebug) {
|
||||||
return RESULT_SHOWUSAGE;
|
return RESULT_SHOWUSAGE;
|
||||||
}
|
}
|
||||||
@@ -465,7 +465,10 @@ static int mgcp_audit_endpoint(int fd, int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
gname++;
|
gname++;
|
||||||
}
|
}
|
||||||
|
if (gname[0] == '[')
|
||||||
|
gname++;
|
||||||
|
if ((c = strrchr(gname, ']')))
|
||||||
|
*c = '\0';
|
||||||
ast_pthread_mutex_lock(&gatelock);
|
ast_pthread_mutex_lock(&gatelock);
|
||||||
g = gateways;
|
g = gateways;
|
||||||
while(g) {
|
while(g) {
|
||||||
@@ -778,7 +781,7 @@ static struct mgcp_endpoint *find_endpoint(char *name, int msgid, struct sockadd
|
|||||||
struct mgcp_endpoint *p = NULL;
|
struct mgcp_endpoint *p = NULL;
|
||||||
struct mgcp_gateway *g;
|
struct mgcp_gateway *g;
|
||||||
char tmp[256] = "";
|
char tmp[256] = "";
|
||||||
char *at = NULL;
|
char *at = NULL, *c;
|
||||||
if (name) {
|
if (name) {
|
||||||
strncpy(tmp, name, sizeof(tmp) - 1);
|
strncpy(tmp, name, sizeof(tmp) - 1);
|
||||||
at = strchr(tmp, '@');
|
at = strchr(tmp, '@');
|
||||||
@@ -790,6 +793,12 @@ static struct mgcp_endpoint *find_endpoint(char *name, int msgid, struct sockadd
|
|||||||
at++;
|
at++;
|
||||||
}
|
}
|
||||||
ast_pthread_mutex_lock(&gatelock);
|
ast_pthread_mutex_lock(&gatelock);
|
||||||
|
if (at && (at[0] == '[')) {
|
||||||
|
at++;
|
||||||
|
c = strrchr(at, ']');
|
||||||
|
if (c)
|
||||||
|
*c = '\0';
|
||||||
|
}
|
||||||
g = gateways;
|
g = gateways;
|
||||||
while(g) {
|
while(g) {
|
||||||
if ((!name || !strcasecmp(g->name, at)) &&
|
if ((!name || !strcasecmp(g->name, at)) &&
|
||||||
|
27
rtp.c
27
rtp.c
@@ -891,6 +891,9 @@ int ast_rtp_bridge(struct ast_channel *c0, struct ast_channel *c1, int flags, st
|
|||||||
struct ast_channel *who, *cs[3];
|
struct ast_channel *who, *cs[3];
|
||||||
struct ast_rtp *p0, *p1;
|
struct ast_rtp *p0, *p1;
|
||||||
struct ast_rtp_protocol *pr0, *pr1;
|
struct ast_rtp_protocol *pr0, *pr1;
|
||||||
|
struct sockaddr_in ac0, ac1;
|
||||||
|
struct sockaddr_in t0, t1;
|
||||||
|
|
||||||
void *pvt0, *pvt1;
|
void *pvt0, *pvt1;
|
||||||
int to;
|
int to;
|
||||||
|
|
||||||
@@ -933,8 +936,16 @@ int ast_rtp_bridge(struct ast_channel *c0, struct ast_channel *c1, int flags, st
|
|||||||
}
|
}
|
||||||
if (pr0->set_rtp_peer(c0, p1))
|
if (pr0->set_rtp_peer(c0, p1))
|
||||||
ast_log(LOG_WARNING, "Channel '%s' failed to talk to '%s'\n", c0->name, c1->name);
|
ast_log(LOG_WARNING, "Channel '%s' failed to talk to '%s'\n", c0->name, c1->name);
|
||||||
if (pr1->set_rtp_peer(c1, p0))
|
else {
|
||||||
|
/* Store RTP peer */
|
||||||
|
ast_rtp_get_peer(p1, &ac1);
|
||||||
|
}
|
||||||
|
if (pr1->set_rtp_peer(c1, p0))
|
||||||
ast_log(LOG_WARNING, "Channel '%s' failed to talk back to '%s'\n", c1->name, c0->name);
|
ast_log(LOG_WARNING, "Channel '%s' failed to talk back to '%s'\n", c1->name, c0->name);
|
||||||
|
else {
|
||||||
|
/* Store RTP peer */
|
||||||
|
ast_rtp_get_peer(p0, &ac0);
|
||||||
|
}
|
||||||
ast_pthread_mutex_unlock(&c0->lock);
|
ast_pthread_mutex_unlock(&c0->lock);
|
||||||
ast_pthread_mutex_unlock(&c1->lock);
|
ast_pthread_mutex_unlock(&c1->lock);
|
||||||
cs[0] = c0;
|
cs[0] = c0;
|
||||||
@@ -957,6 +968,20 @@ int ast_rtp_bridge(struct ast_channel *c0, struct ast_channel *c1, int flags, st
|
|||||||
return -3;
|
return -3;
|
||||||
}
|
}
|
||||||
to = -1;
|
to = -1;
|
||||||
|
ast_rtp_get_peer(p1, &t1);
|
||||||
|
ast_rtp_get_peer(p0, &t0);
|
||||||
|
if (inaddrcmp(&t1, &ac1)) {
|
||||||
|
ast_log(LOG_DEBUG, "Oooh, '%s' changed end address\n", c1->name);
|
||||||
|
if (pr0->set_rtp_peer(c0, p1))
|
||||||
|
ast_log(LOG_WARNING, "Channel '%s' failed to update to '%s'\n", c0->name, c1->name);
|
||||||
|
memcpy(&ac1, &t1, sizeof(ac1));
|
||||||
|
}
|
||||||
|
if (inaddrcmp(&t0, &ac0)) {
|
||||||
|
ast_log(LOG_DEBUG, "Oooh, '%s' changed end address\n", c0->name);
|
||||||
|
if (pr1->set_rtp_peer(c1, p0))
|
||||||
|
ast_log(LOG_WARNING, "Channel '%s' failed to update to '%s'\n", c1->name, c0->name);
|
||||||
|
memcpy(&ac0, &t0, sizeof(ac0));
|
||||||
|
}
|
||||||
who = ast_waitfor_n(cs, 2, &to);
|
who = ast_waitfor_n(cs, 2, &to);
|
||||||
if (!who) {
|
if (!who) {
|
||||||
ast_log(LOG_DEBUG, "Ooh, empty read...\n");
|
ast_log(LOG_DEBUG, "Ooh, empty read...\n");
|
||||||
|
Reference in New Issue
Block a user