Skip to content

Commit

Permalink
nat_traversal: set via branch according to "z9hG4bK..." format (inste…
Browse files Browse the repository at this point in the history
…ad of "branch=0")

(cherry picked from commit 5261c1d)
  • Loading branch information
snen authored and miconda committed Jun 27, 2016
1 parent ffd5b68 commit 2e82a8b
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion modules/nat_traversal/nat_traversal.c
Expand Up @@ -1508,6 +1508,8 @@ ClientNatTest(struct sip_msg *msg, unsigned int tests)


#define FROM_PREFIX "sip:keepalive@"
#define MAX_BRANCHID 9999999
#define MIN_BRANCHID 1000000

static void
send_keepalive(NAT_Contact *contact)
Expand Down Expand Up @@ -1536,7 +1538,7 @@ send_keepalive(NAT_Contact *contact)

len = snprintf(buffer, sizeof(buffer),
"%s %s SIP/2.0\r\n"
"Via: SIP/2.0/UDP %.*s:%d;branch=0\r\n"
"Via: SIP/2.0/UDP %.*s:%d;branch=z9hG4bK%ld\r\n"
"From: %s;tag=%x\r\n"
"To: %s\r\n"
"Call-ID: %s-%x-%x@%.*s\r\n"
Expand All @@ -1546,6 +1548,7 @@ send_keepalive(NAT_Contact *contact)
keepalive_params.method, contact->uri,
contact->socket->address_str.len,
contact->socket->address_str.s, contact->socket->port_no,
(long)(rand()/(float)RAND_MAX * (MAX_BRANCHID-MIN_BRANCHID) + MIN_BRANCHID),
from_uri, keepalive_params.from_tag++,
contact->uri, keepalive_params.callid_prefix,
keepalive_params.callid_counter++, get_ticks(),
Expand Down

0 comments on commit 2e82a8b

Please sign in to comment.