Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Calling remove_hf() more than once for same header malforms sip message #219

Closed
rrb3942 opened this issue May 2, 2014 · 2 comments
Closed
Assignees

Comments

@rrb3942
Copy link
Contributor

rrb3942 commented May 2, 2014

Calling remove_hf() more than once for the same header causes the resulting sip message to be malformed.

In my case I am calling remove_hf() on replies to remove custom headers.

Hopefully this pastes OK, ngrep output from calling remove_hf("^X-", "r") twice on the same 200 response:

U 2014/05/02 10:12:43.357835 192.168.122.77:5060 -> 192.168.122.192:5060
SIP/2.0 200 OK..Record-Route: sip:192.168.122.192;lr;did=108.c0119662..Via: SIP/2.0/UDP 192.168.122.192:5060;branch=z9hG4bKe7c.52cb9726.0..Via: SIP/2.0/UDP 192.168.122.1:5060;received=192.168.122.1;branch=z9hG4bK.0CPmTlXzE;rport=5
060..From: sip:test@192.168.122.192;tag=wm0dKOJVk..To: sip:55555@192.168.122.192;tag=PRSHP.25474.4577..CSeq: 20 INVITE..Call-ID: B-WyTTdMsk..Content-Type: application/sdp..Supported: timer..Allow: INVITE, ACK, CANCEL, OPTIONS, BYE
, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH..X-TEST: Test Header..Contact: sip:192.168.122.77:5060..Server: Pirate Proxy..Content-Length: 239....v=0..o=root 982256734 982256734 IN IP4 192.168.122.218..s=Asterisk PBX 11.7.0..c=IN IP4
192.168.122.218..t=0 0..m=audio 17666 RTP/AVP 0 101..a=rtpmap:0 PCMU/8000..a=rtpmap:101 telephone-event/8000..a=fmtp:101 0-16..a=ptime:20..a=sendrecv..

U 2014/05/02 10:12:43.366696 192.168.122.192:5060 -> 192.168.122.1:5060
SIP/2.0 200 OK..Record-Route: sip:192.168.122.192;lr;did=108.c0119662..Via: SIP/2.0/UDP 192.168.122.1:5060;received=192.168.122.1;branch=z9hG4bK.0CPmTlXzE;rport=5060..From: sip:test@192.168.122.192;tag=wm0dKOJVk..To: sip:55555@1
92.168.122.192;tag=PRSHP.25474.4577..CSeq: 20 INVITE..Call-ID: B-WyTTdMsk..Content-Type: application/sdp..Supported: timer..Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH...122.77:5060>..Server: Pi
rate Proxy..Content-Length: 257....v=0..o=root 982256734 982256734 IN IP4 192.168.122.192..s=Asterisk PBX 11.7.0..c=IN IP4 192.168.122.192..t=0 0..m=audio 63074 RTP/AVP 0 101..a=rtpmap:0 PCMU/8000..a=rtpmap:101 telephone-event/8000.
.a=fmtp:101 0-16..a=ptime:20..a=sendrecv..a=nortpproxy:yes..

Notice how a portion of the contact header gets removed and '122.77:5060>' is left behind.

Opensips information:
version: opensips 1.10.1-notls (x86_64/linux)
flags: STATS: On, DISABLE_NAGLE, SHM_MEM, SHM_MMAP, PKG_MALLOC, F_MALLOC, FAST_LOCK-FUTEX-ADAPTIVE_WAIT
ADAPTIVE_WAIT_LOOPS=1024, MAX_RECV_BUFFER_SIZE 262144, MAX_LISTEN 16, MAX_URI_SIZE 1024, BUF_SIZE 65535
git revision: 05f97a3
@(#) $Id$
main.c compiled on 10:47:11 Apr 30 2014 with gcc 4.7.2

@liviuchircu
Copy link
Member

Hello,

There have been similar reports, and the problem was fixed on the master branch (still in testing phase). Please cherry-pick commit f9d9654 into your 1.10 branch, and recompile everything afterwards:

git stash; git pull --rebase; git cherry-pick f9d9654; git stash pop

Liviu

@liviuchircu liviuchircu self-assigned this May 5, 2014
@rrb3942
Copy link
Contributor Author

rrb3942 commented May 5, 2014

Confirming that my testing shows that commit f9d9654 does fix this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants