When doing rport, remove the ";rport" before adding ";rport=5060"

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@3388 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Mark Spencer 2004-07-08 07:21:52 +00:00
parent fd9b6d13e6
commit 18844270c3
1 changed files with 13 additions and 3 deletions

View File

@ -2843,14 +2843,24 @@ static int copy_all_header(struct sip_request *req, struct sip_request *orig, ch
/*--- copy_via_headers: Copy SIP VIA Headers from one request to another ---*/
static int copy_via_headers(struct sip_pvt *p, struct sip_request *req, struct sip_request *orig, char *field)
{
char *tmp;
char tmp[256]="", *oh, *end;
int start = 0;
int copied = 0;
char new[256];
char iabuf[INET_ADDRSTRLEN];
for (;;) {
tmp = __get_header(orig, field, &start);
if (!ast_strlen_zero(tmp)) {
oh = __get_header(orig, field, &start);
if (!ast_strlen_zero(oh)) {
/* Strip ;rport */
strncpy(tmp, oh, sizeof(tmp) - 1);
oh = strstr(tmp, ";rport");
if (oh) {
end = strchr(oh + 1, ';');
if (end)
memmove(oh, end, strlen(end) + 1);
else
*oh = '\0';
}
if (!copied && (p->nat == SIP_NAT_ALWAYS)) {
/* Whoo hoo! Now we can indicate port address translation too! Just
another RFC (RFC3581). I'll leave the original comments in for