miconda / sipexer

Modern and flexible SIP/VoIP cli tool
GNU General Public License v3.0
293 stars 37 forks source link

Support repeated extra-header #7

Closed hnimminh closed 2 years ago

hnimminh commented 2 years ago

Thanks to @miconda for awesome tool,

I just found a minor issue with the sipexer use the map to store the extra-header via -xh, that cause for only the latest one can be processed. Example:


[info] [sipexer.go:1260] main.SIPExerDialogLoop(): local socket address: 127.0.0.1:53256 (udp)
[info] [sipexer.go:1261] main.SIPExerDialogLoop(): local via address: 127.0.0.1:53256
[info] [sipexer.go:1262] main.SIPExerDialogLoop(): sending to udp 127.0.0.1:5060: [[---
INVITE sip:127.0.0.1:5060 SIP/2.0
Via: SIP/2.0/UDP 127.0.0.1:53256;rport;branch=z9hG4bKSG.256b7e98-b824-47ae-bac8-a2c3aadf9281
From: <sip:+9876543210@localhost>;tag=d3107dc4-7f35-481c-b58f-e351e2704027
To: <sip:alice@localhost>
Call-ID: f5ccddd4-da36-48d7-b218-63cff5cdca0c
CSeq: 275785 INVITE
Date: Wed, 25 May 2022 16:23:20 +07
User-Agent: SIPExer v1.0.0
Content-Length: 208
Diversion: <john@example.com>
Content-Type: application/sdp

v=0
o=sipexer 1653470600 1653470600 IN IP4 127.0.0.1
s=call
c=IN IP4 127.0.0.1
t=0 0
m=audio 37009 RTP 0 8 101
a=rtpmap:0 pcmu/8000
a=rtpmap:8 pcma/8000
a=rtpmap:101 telephone-event/8000
a=sendrecv

[info] [sipexer.go:1264] main.SIPExerDialogLoop(): ---]]

only the john@example.com is processed. We expected that the message would be:

...
Diversion: <alice@kamailio.io>
Diversion: <john@example.com>
...

Reference: https://datatracker.ietf.org/doc/html/rfc3261#section-7.3.1

miconda commented 2 years ago

Thanks, PR merged!