VoiSmart / pjsip-android

SIP Service for Android based on PJSIP
http://www.pjsip.org/
Apache License 2.0
290 stars 140 forks source link

[Contact Header] Contact header gets duplicated #203

Open AAlier opened 8 months ago

AAlier commented 8 months ago

Describe the bug Screenshot 2024-01-23 at 22 29 51 Adding expire to the contact header as a parameter and when changing network from WIFI -> 3G/4G -> WIFI contact headers gets duplicated with first one expire=500 and second one is expire=0

Lib version Latest

*Configuration NA

Changes NA

Smartphone (please complete the following information):

Additional context Add any other context about the problem here.

AAlier commented 8 months ago
pjsua_acc.c ....IP address change detected for account 0 (171.16.7.9:32531 --> 216.49.151.35:34531). Updating registration (using method 4)
2024-02-08 14:18:21.676 15498-16410 PJSIP pjsua_0           online.voip.cloud.feature            D             pjsua_acc.c ....Contact for acc 0 updated: <sip:779890@216.49.151.35:34531;transport=TLS;ob;pn-provider=fcm;pn-param=theapp-e6725;pn-prid=f7SUB30ETv6a9TyE9XoDv7:APA91bHnpI1deZZwLT4bXKUr0xeVi5hgLkG9574Sy0JT3Bp__ZSuTDfOfivJSTyYCHPpooe5yA75AjmWME6ElfVIbn-cZvS8M3s1bK__QX4a1NI3BNY8hxl-XhM6f2tw-6NQZcohugAX>
2024-02-08 14:18:21.676 15498-16410 PJSIP pjsua_0           online.voip.cloud.feature            D       sip_auth_client.c ...Digest algorithm is "MD5"
2024-02-08 14:18:21.678 15498-16410 PJSIP pjsua_0           online.voip.cloud.feature            D            pjsua_core.c ....TX 1625 bytes Request msg REGISTER/cseq=63818 (tdta0x773ba3c0a8) to TLS 123.102.102.101:7061:
                                                                                                    REGISTER sip:dev:7061 SIP/2.0
                                                                                                    Via: SIP/2.0/TLS 216.49.151.35:34531;rport;branch=z9hG4bKPj3fec128f-1613-48b0-8955-959ebda08c24;alias
                                                                                                    Route: <sip:dev:7061;transport=tls;lr>
                                                                                                    Max-Forwards: 70
                                                                                                    From: <sip:231890@dev>;tag=d484bc84-8b4d-4f44-9776-f9887bd4a21c
                                                                                                    To: <sip:232890@dev>
                                                                                                    Call-ID: 2084a9bb-33c1-4e5c-859d-1bad44805e0e
                                                                                                    CSeq: 63818 REGISTER
                                                                                                    User-Agent: AndroidSipService
                                                                                                    Supported: outbound, path
                                                                                                    Contact: <sip:23512@216.49.151.35:34531;transport=TLS;ob;pn-provider=fcm;pn-param=theapp-e6725;pn-prid=f7SUB30ETv6a9TyE9XoDv7:APA91bHnpI1deZZwLT4bXKUr0xeVi5hgLkG9574Sy0JT3Bp__ZSuTDfOfivJSTyYCHPpooe5yA75AjmWME6ElfVIbn-cZvS8M3s1bK__QX4a1NI3BNY8hxl-XhM6f2tw-6NQZcohugAX>
                                                                                                    Contact: <sip:23512@212.41.117.45:32142;transport=TLS;ob;pn-provider=fcm;pn-param=theapp-e6725;pn-prid=f7SUB30ETv6a9TyE9XoDv7:APA91bHnpI1deZZwLT4bXKUr0xeVi5hgLkG9574Sy0JT3Bp__ZSuTDfOfivJSTyYCHPpooe5yA75AjmWME6ElfVIbn-cZvS8M3s1bK__QX4a1NI3BNY8hxl-XhM6f2tw-6NQZcohugAX>;expires=0;reg-id=1;+sip.instance="<urn:uuid:00000000-0000-0000-0000-0000e922f243>"
                                                                                                    Expires: 300
                                                                                                    Allow: PRACK, INVITE, ACK, BYE, CANCEL, UPDATE, INFO, SUBSCRIBE, NOTIFY, REFER, MESSAGE, OPTIONS
                                                                                                    Authorization: Digest username=“23123”, realm="dev", nonce="1CJrq5F2yaz9UZlho3TdwEsw1mc5MtN1Si7WPcpOdoQAa”v, uri="sip:dev:7061", response="6ea3858a99857a6b187837fe0bba979ac”, algorithm=MD5, cnonce="8b551763561744ba834c84b72c130c94", qop=auth, nc=00000001
                                                                                                    Content-Length:  0

                                                                                                    --end msg--
2024-02-08 14:18:23.509 15498-16410 PJSIP pjsua_0           online.voip.cloud.feature            D            pjsua_core.c .RX 503 bytes Response msg 400/REGISTER/cseq=63818 (rdata0x773bac0318) from TLS 101.236.151.105:7061:
                                                                                                    SIP/2.0 400 Bad Request
                                                                                                    Via: SIP/2.0/TLS 216.49.151.35:34531;received=212.41.101.41;rport=34531;branch=z9hG4bKPj3fec128f-1613-48b0-8955-959ebda08c24;alias
                                                                                                    To: <sip:239890@dev>;tag=b8d0-c19ddf94fea15c49f7b2b47d3630a42a
                                                                                                    From: <sip:32512@dev>;tag=d484bc84-8b4d-4f44-9776-f9887bd4a21c
                                                                                                    Call-ID: 2084a9bb-33c1-4e5c-859d-1bad44805e0e
                                                                                                    CSeq: 63818 REGISTER
                                                                                                    P-Registrar-Error: Contact/received too long
                                                                                                    Server: OS-RGS1-v0.80
                                                                                                    Content-Length: 0

                                                                                                    --end msg--
2024-02-08 14:18:23.512 15498-16410 PJSIP pjsua_0           online.voip.cloud.feature            W             pjsua_acc.c ....SIP registration failed, status=400 (Bad Request)
aenonGit commented 7 months ago

why would you set the expire time manually?

AAlier commented 6 months ago

Because server requested to add contact header to all requests which should contain expire time. By default sip does not add on all requests