|
@@ -116,6 +116,9 @@ static inline char* build_sipping(str *curi, struct socket_info* s, str *path,
|
|
|
str *ruid, unsigned int aorhash, int *len_p)
|
|
|
{
|
|
|
#define s_len(_s) (sizeof(_s)-1)
|
|
|
+#define MAX_BRANCHID 9999999
|
|
|
+#define MIN_BRANCHID 1000000
|
|
|
+#define LEN_BRANCHID 7 /* NOTE: this must be sync with the MX and MIN values !! */
|
|
|
static char buf[MAX_SIPPING_SIZE];
|
|
|
char *p;
|
|
|
int len;
|
|
@@ -135,7 +138,7 @@ static inline char* build_sipping(str *curi, struct socket_info* s, str *path,
|
|
|
if ( sipping_method.len + 1 + curi->len + s_len(" SIP/2.0"CRLF) +
|
|
|
s_len("Via: SIP/2.0/UDP ") + vaddr.len +
|
|
|
((s->address.af==AF_INET6)?2:0) +
|
|
|
- 1 + vport.len + s_len(";branch=0") +
|
|
|
+ 1 + vport.len + s_len(";branch=z9hG4bK") + LEN_BRANCHID +
|
|
|
(path->len ? (s_len(CRLF"Route: ") + path->len) : 0) +
|
|
|
s_len(CRLF"From: ") + sipping_from.len + s_len(";tag=") +
|
|
|
ruid->len + 1 + 8 + 1 + 8 +
|
|
@@ -164,13 +167,16 @@ static inline char* build_sipping(str *curi, struct socket_info* s, str *path,
|
|
|
}
|
|
|
*(p++) = ':';
|
|
|
append_str( p, vport.s, vport.len);
|
|
|
+ append_fix( p, ";branch=z9hG4bK");
|
|
|
+ int2bstr(
|
|
|
+ (long)(rand()/(float)RAND_MAX * (MAX_BRANCHID-MIN_BRANCHID) + MIN_BRANCHID),
|
|
|
+ p+LEN_BRANCHID-INT2STR_MAX_LEN+1, NULL);
|
|
|
+ p += LEN_BRANCHID;
|
|
|
if (path->len) {
|
|
|
- append_fix( p, ";branch=0"CRLF"Route: ");
|
|
|
+ append_fix( p, CRLF"Route: ");
|
|
|
append_str( p, path->s, path->len);
|
|
|
- append_fix( p, CRLF"From: ");
|
|
|
- } else {
|
|
|
- append_fix( p, ";branch=0"CRLF"From: ");
|
|
|
}
|
|
|
+ append_fix( p, CRLF"From: ");
|
|
|
append_str( p, sipping_from.s, sipping_from.len);
|
|
|
append_fix( p, ";tag=");
|
|
|
append_str( p, ruid->s, ruid->len);
|