[OpenSIPS-Devel] [opensips] Calling remove_hf() more than once for same header malforms sip message (#219)

rrb3942 notifications at github.com
Fri May 2 19:21:23 CEST 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 at 192.168.122.192>;tag=wm0dKOJVk..To: sip:55555 at 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 at 192.168.122.192>;tag=wm0dKOJVk..To: sip:55555 at 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

---
Reply to this email directly or view it on GitHub:
https://github.com/OpenSIPS/opensips/issues/219
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opensips.org/pipermail/devel/attachments/20140502/c5cb84a2/attachment.htm>


More information about the Devel mailing list