[OpenSIPS-Devel] [opensips] Via branch non RFC 3261 compliant (#145)

Varun notifications at github.com
Mon Dec 2 16:47:13 CET 2013


Since this is an options packet it will not need to be re-transmitted so i generated a random 7 digit number for each option packet and appended it to the RFC 3261 string "z9hG4bK". My C skills are not great but this is what i did to fix this for myself, if someone can come up with a better method and commit to the code that will be great.

In modules/nathelper/sip_pinger.h

Line 31:

```
#include<string.h>
```

Line 145:
````       
const long MAX_BRANCHID = 9999999;
const long MIN_BRANCHID = 1000000;
long result=(long)(rand()/(float)2147483647 * (MAX_BRANCHID-MIN_BRANCHID) + MIN_BRANCHID);
char branch_id[7];
sprintf(branch_id, "%ld", result);
char branch[22]=";branch=z9hG4bK";
strcat(branch,branch_id);
if ( sipping_method.len + 1 + curi->len + s_len(" SIP/2.0"CRLF) +
    s_len("Via: SIP/2.0/") + st.len + s->address_str.len +
    1 + s->port_no_str.len + strlen(branch) +
```

Line 180:

```
append_fix( p, branch);
append_fix( p, CRLF"Route: ");
```

Line 185:

```
append_fix( p, branch);
append_fix( p, CRLF"From: ");
```


---
Reply to this email directly or view it on GitHub:
https://github.com/OpenSIPS/opensips/issues/145#issuecomment-29628210
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opensips.org/pipermail/devel/attachments/20131202/8c2b3090/attachment.htm>


More information about the Devel mailing list