[Home]

Summary:ASTERISK-28287: Pjsip rewrite port in from/to headers on reply
Reporter:Aleksandr Khomutov (axyi)Labels:pjsip
Date Opened:2019-02-13 07:18:01.000-0600Date Closed:2019-02-13 08:13:36.000-0600
Priority:MinorRegression?
Status:Closed/CompleteComponents:Channels/chan_pjsip
Versions:16.0.0 Frequency of
Occurrence
Constant
Related
Issues:
Environment:CentOS Linux release 7.5.1804 (Core) Asterisk 16.0.0 PJPROJECT version currently running against: 2.7.2Attachments:
Description:Hello! I have problems configuring chan_pjsip. In response to requests from my softswitch, the asterisk rewrites the headers from and to the port, removes the port from there. Tell me how to make it so that the asterisk does not do this? This problem is not observed for the chan_sip driver.
```
2019/02/13 10:31:09.351381 85.12.217.3:5060 -> 10.227.228.4:5061
INVITE sip:73432875561@10.227.228.4:5061;user=phone SIP/2.0
Via: SIP/2.0/UDP 85.12.217.3:5060;rport;branch=z9hG4bK-8ae2b6262f5011e99bf22c44fd84c5e0;sig=35ee398c
Via: SIP/2.0/UDP 85.12.217.3:5060;rport;branch=z9hG4bK-8ae2b0362f5011e99bf22c44fd84c5e0;sig=e4f91997
Via: SIP/2.0/UDP 85.12.217.3:5062;rport=5062;branch=z9hG4bK-8ae293762f5011e99bf22c44fd84c5e0
From: <sip:73432786060@85.12.217.3:5062;user=phone>;tag=8ae26efa2f5011e99bf22c44fd84c5e0
To: <sip:73432875561@10.227.228.4:5061;user=phone>
Call-ID: 8ae26f222f5011e99bf22c44fd84c5e0@85.12.217.3
CSeq: 1 INVITE
Contact: <sip:73432786060@85.12.217.3:5062;user=phone>
Content-Type: application/sdp
Allow: ACK, BYE, CANCEL, INFO, INVITE, OPTIONS, REFER, REGISTER, UPDATE
Max-Forwards: 69
User-Agent: TS-v4.6.0-07a
Cisco-Guid: 2329864784-793776617-2616339524-4253337056
Content-Length:   312
Record-Route: <sip:AQEAEOAgaLvZEqxL3Z9L9avyD5MDAAQ6GnBx@85.12.217.3;lr>
Record-Route: <sip:AQEAEEiS5FS8Xjpm4lEkLYOwprwDAARDhHft@85.12.217.3;lr>

v=0
o=- 1550035858 1550035858 IN IP4 85.12.217.17
s=-
c=IN IP4 85.12.217.17
t=0 0
m=audio 27044 RTP/AVP 0 8 18 101
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:18 G729/8000
a=fmtp:18 annexb=no
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-15
a=ptime:20
a=sendrecv
a=silenceSupp:off - - - -

2019/02/13 10:31:09.352290 10.227.228.4:5061 -> 85.12.217.3:5060
SIP/2.0 401 Unauthorized
Via: SIP/2.0/UDP 85.12.217.3:5060;rport=5060;received=85.12.217.3;branch=z9hG4bK-8ae2b6262f5011e99bf22c44fd84c5e0;sig=35ee398c
Via: SIP/2.0/UDP 85.12.217.3:5060;rport;branch=z9hG4bK-8ae2b0362f5011e99bf22c44fd84c5e0;sig=e4f91997
Via: SIP/2.0/UDP 85.12.217.3:5062;rport=5062;branch=z9hG4bK-8ae293762f5011e99bf22c44fd84c5e0
Record-Route: <sip:AQEAEOAgaLvZEqxL3Z9L9avyD5MDAAQ6GnBx@85.12.217.3;lr>
Record-Route: <sip:AQEAEEiS5FS8Xjpm4lEkLYOwprwDAARDhHft@85.12.217.3;lr>
Call-ID: 8ae26f222f5011e99bf22c44fd84c5e0@85.12.217.3
From: <sip:73432786060@85.12.217.3;user=phone>;tag=8ae26efa2f5011e99bf22c44fd84c5e0
To: <sip:73432875561@10.227.228.4;user=phone>;tag=z9hG4bK-8ae2b6262f5011e99bf22c44fd84c5e0
CSeq: 1 INVITE
WWW-Authenticate: Digest  realm="centrex",nonce="1550035869/1ef0271eb3e86940bce3fc40fc143ef5",opaque="6f75f93b26037d9b",algorithm=md5,qop="auth"
Server: centrex
Content-Length:  0
```


Full config:
```
[global]
type=global
user_agent=centrex
default_from_user=centrex
default_realm=centrex

[transport-udp]
type=transport
protocol=udp    ;udp,tcp,tls,ws,wss
bind=0.0.0.0:5061

[opensips-endpoint](!)
type=endpoint
send_pai=no
send_rpid=no
;send_rpid=yes
rpid_immediate=no
trust_id_outbound=no
trust_id_inbound=no
context=from_opensips
from_domain=sbc.profintel.ru
sdp_session=Centrex v.1.0
disallow=all
allow=alaw
allow=ulaw
t38_udptl_maxdatagram=20
t38_udptl=yes
;---nat
rtp_symmetric=yes
force_rport=yes
rewrite_contact=yes

[opensips-auth](!)
type=auth
auth_type=userpass
realm=centrex

[opensips-aor](!)
type=aor
max_contacts=1


[opensips_sbc1](opensips-aor)
[opensips_sbc1](opensips-auth)
password=oemae8angoc4utoh2aeP
username=opensips_sbc1
[opensips_sbc1](opensips-endpoint)
auth=opensips_sbc1
aors=opensips_sbc1
accountcode = opensips_sbc1

[opensips_sbc2](opensips-aor)
[opensips_sbc2](opensips-auth)
password=oemae8angoc4utoh2aeP
username=opensips_sbc2
[opensips_sbc2](opensips-endpoint)
auth=opensips_sbc2
aors=opensips_sbc2
accountcode = opensips_sbc2

[opensips_sbc2]
type=identify
endpoint=opensips_sbc2
match=10.227.228.18

[opensips_sbc1]
type=identify
endpoint=opensips_sbc1
match=10.227.228.169
```
Comments:By: Asterisk Team (asteriskteam) 2019-02-13 07:18:02.100-0600

Thanks for creating a report! The issue has entered the triage process. That means the issue will wait in this status until a Bug Marshal has an opportunity to review the issue. Once the issue has been reviewed you will receive comments regarding the next steps towards resolution.

A good first step is for you to review the [Asterisk Issue Guidelines|https://wiki.asterisk.org/wiki/display/AST/Asterisk+Issue+Guidelines] if you haven't already. The guidelines detail what is expected from an Asterisk issue report.

Then, if you are submitting a patch, please review the [Patch Contribution Process|https://wiki.asterisk.org/wiki/display/AST/Patch+Contribution+Process].

Please note that once your issue enters an open state it has been accepted. As Asterisk is an open source project there is no guarantee or timeframe on when your issue will be looked into. If you need expedient resolution you will need to find and pay a suitable developer. Asking for an update on your issue will not yield any progress on it and will not result in a response. All updates are posted to the issue when they occur.

By: Joshua C. Colp (jcolp) 2019-02-13 08:13:36.177-0600

A helpful individual on the community forum pointed out that according to RFC3261 (19.1.1 and 19.1.2) a port is not allowed in To or From headers, so the parser likely doesn't store such information and strips them out instead.