You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
DNS to resolve destination FQDN is very slow in Android API . It takes 4 seconds per DNS attempt (either success of failure), so 8 seconds if IPV6 is supported.
Deactivating IPV6 cut the delay by half, but it's still very slow.
Counting all DNS requests, between clicking "Start Library" and the actual TX REGISTER is 20 seconds. (all are due to DNS delay caused by getaddrinfo)
Setting Macro PJ_SOCK_HAS_GETADDRINFO is not satisfying because it doesn't support IPV6 (only V4)
Debugging the code brought me to the file addr_resolv_sock.c and specifically to the getaddrinfo (inside pj_getaddrinfo) which is taking 4 seconds to fulfill either the answer is good (A) or empty (AAAA).
I found in Android documentation they introduced new DNS lookup functions android_res_nquery and android_res_nresult, and I tested them successfully.
Steps to reproduce
Compile on Ubuntu PJSIP release 2.15.1 for Android with openSSL 3.4.1, IPv6 and NDK 27c
Get the jni libraries and put them inside the pjsua2 folder of the Android samples
Modify the sample app-kotlin with ACC_DOMAIN, ACC_REGISTRAR and ACC_PROXY pointing to an FQDN (and not IP address)
For example : I put my local PBX (Cisco CUCM) with fqdn cucm15.mylab.local
Run the app-kotlin and click on "Start library"
5a. Tested on (huge delay/fail) :
Xiaomi Mi 9T with LineageOS (Android API 35) ARM64-V8A
Emulated Pixel 6 Pro with (Android API 35) X86_64
Emulated Pixel 6 Pro with (Android API 34) X86_64
20 seconds delay and then REGISTER OK
Emulated Pixel 6 Pro with (Android API 32) X86_64 and the DNS lookup fails altogether and doesn't register.
5b. Tested on Emulated Pixel 6 Pro with (Android API 31) X86_64 works good.
PJSIP version
2.15.1
Context
Compiled for Android on Ubuntu 24.04
Used this script to build all 4 processor variants
Put the 4 resulting folders inside android\pjsua2\src\main\jniLibs
Using Android Studio on Windows and connect to Android smartphone with ADB, or create an emulated device through the built-in Emulator by selecting the device and the image
Load android sample apps, and launch app-kotlin
Log, call stack, etc
Emulated Pixel 6 Pro with (Android API 35) X86_64 (20 seconds delay)
I 23:28:22.289 pjsua_core.c .1 SIP worker threads created
I 23:28:22.289 pjsua_core.c .pjsua version 2.15.1 for Linux-6.6.50/x86_64 initialized
I 23:28:22.289 pjsua_core.c .PJSUA state changed: CREATED --> INIT
I 23:28:22.300 tlstp:5061 SIP TLS listener is ready for incoming connections at 10.0.2.16:5061
I 23:28:22.316 pjsua_acc.c Adding account: id=Kotlin <sip:[email protected]>
I 23:28:22.316 pjsua_acc.c .Account Kotlin <sip:[email protected]> added with id 0
I 23:28:22.317 pjsua_acc.c .Acc 0: setting registration..
D app_time_stats: avg=16.33ms min=4.02ms max=21.44ms count=61
D app_time_stats: avg=16.58ms min=14.54ms max=19.81ms count=60
D app_time_stats: avg=16.56ms min=14.01ms max=19.67ms count=60
D app_time_stats: avg=16.60ms min=14.36ms max=19.17ms count=60
D app_time_stats: avg=16.52ms min=10.80ms max=20.29ms count=61
D app_time_stats: avg=16.61ms min=13.88ms max=19.33ms count=60
I 23:28:30.384 tlsc0x718e2be6c198 ..TLS client transport created
I 23:28:30.388 tlsc0x718e2be6c198 ..TLS transport 10.0.2.16:45271 is connecting to cucm15.mylab.local:5061...
I 23:28:30.388 pjsua_acc.c ..Contact for acc 0 updated: "Kotlin"<sip:[email protected]:45271;transport=TLS;ob>;reg-id=1;+sip.instance="<urn:uuid:00000000-0000-0000-0000-0000e922f243>"
I 23:28:30.393 ssl_sock_ossl.c !OpenSSL version : 269488255
I 23:28:30.396 ssl0x718f1be6ef50 Certificate chain loaded from buffer
I 23:28:30.399 ssl0x718f1be6ef50 Private key loaded from buffer
I 23:28:30.415 tlsc0x718e2be6c198 TLS transport 10.0.2.16:45271 is connected to cucm15.mylab.local:5061
I 23:28:42.492 pjsua_core.c ...TX 741 bytes Request msg REGISTER/cseq=50761 (tdta0x718e1beefa78) to TLS 192.168.1.156:5061:
I REGISTER sip:cucm15.mylab.local:5061;transport=TLS SIP/2.0
I Via: SIP/2.0/TLS 10.0.2.16:45271;rport;branch=z9hG4bKPjdf15f9bb-21b8-4d9d-85e4-9a85c4f4fe82;alias
I Route: <sip:cucm15.mylab.local:5061;transport=tls;lr>
I Max-Forwards: 70
I From: "Kotlin"<sip:[email protected]>;tag=b171dfd2-1736-43b0-8ca1-122212134e83
I To: "Kotlin"<sip:[email protected]>
I Call-ID: 07654c69-001f-4950-bf95-26de264b9841
I CSeq: 50761 REGISTER
I Supported: outbound, path
I Contact: "Kotlin"<sip:[email protected]:45271;transport=TLS;ob>;reg-id=1;+sip.instance="<urn:uuid:00000000-0000-0000-0000-0000e922f243>"
I Expires: 300
I Allow: PRACK, INVITE, ACK, BYE, CANCEL, UPDATE, INFO, SUBSCRIBE, NOTIFY, REFER, MESSAGE, OPTIONS
I Content-Length: 0
I
I
I --end msg--
I 23:28:42.497 pjsua_acc.c ..Acc 0: Registration sent
I 23:28:42.498 pjsua_core.c PJSUA state changed: INIT --> STARTING
I 23:28:42.499 sip_endpoint.c .Module "mod-unsolicited-mwi" registered
I 23:28:42.500 pjsua_core.c .PJSUA state changed: STARTING --> RUNNING
I 23:28:42.511 pjsua_core.c .RX 405 bytes Response msg 100/REGISTER/cseq=50761 (rdata0x718e2be6c490) from TLS 192.168.1.156:5061:
I SIP/2.0 100 Trying
I Via: SIP/2.0/TLS 10.0.2.16:45271;rport;branch=z9hG4bKPjdf15f9bb-21b8-4d9d-85e4-9a85c4f4fe82;alias;received=192.168.1.50
I From: "Kotlin"<sip:[email protected]>;tag=b171dfd2-1736-43b0-8ca1-122212134e83
I To: "Kotlin"<sip:[email protected]>
I Date: Mon, 03 Mar 2025 22:28:42 GMT
I Call-ID: 07654c69-001f-4950-bf95-26de264b9841
I CSeq: 50761 REGISTER
I Content-Length: 0
I
I
I --end msg--
I Skipped 1234 frames! The application may be doing too much work on its main thread.
D app_time_stats: avg=247.66ms min=12.80ms max=13648.99ms count=59
I Davey! duration=20600ms; Flags=0, FrameTimelineVsyncId=25796, IntendedVsync=146536556954, Vsync=167103222798, InputEventId=185752232, HandleInputStart=167118634000, AnimationStart=167118650100, PerformTraversalsStart=167120910200, DrawStart=167123066400, FrameDeadline=153519890008, FrameInterval=167118086300, FrameStartTime=16666666, SyncQueued=167123521100, SyncStart=167123678700, IssueDrawCommandsStart=167123741400, SwapBuffers=167124651100, FrameCompleted=167137687400, DequeueBufferDuration=20000, QueueBufferDuration=278500, GpuCompleted=167137687400, SwapBuffersCompleted=167125613700, DisplayPresentTime=0, CommandSubmissionCompleted=167124651100,
I 23:28:42.622 pjsua_core.c .RX 527 bytes Response msg 401/REGISTER/cseq=50761 (rdata0x718e2be6c490) from TLS 192.168.1.156:5061:
I SIP/2.0 401 Unauthorized
I Via: SIP/2.0/TLS 10.0.2.16:45271;rport;branch=z9hG4bKPjdf15f9bb-21b8-4d9d-85e4-9a85c4f4fe82;alias;received=192.168.1.50
I From: "Kotlin"<sip:[email protected]>;tag=b171dfd2-1736-43b0-8ca1-122212134e83
I To: "Kotlin"<sip:[email protected]>;tag=267963812
I Date: Mon, 03 Mar 2025 22:28:42 GMT
I Call-ID: 07654c69-001f-4950-bf95-26de264b9841
I CSeq: 50761 REGISTER
I WWW-Authenticate: Digest realm="ccmsipline", nonce="Nxg8gjqn1+bnZZFUL++ObWywbceqR/c4", algorithm=MD5
I Content-Length: 0
I
I
I --end msg--
I 23:28:42.624 pjsua_acc.c ....IP address change detected for account 0 (10.0.2.16:45271 --> 192.168.1.50:45271). Updating registration (using method 4)
I 23:28:42.624 pjsua_acc.c ....Contact for acc 0 updated: <sip:[email protected]:45271;transport=TLS;ob>;reg-id=1;+sip.instance="<urn:uuid:00000000-0000-0000-0000-0000e922f243>"
I 23:28:42.625 pjsua_core.c ....TX 951 bytes Request msg REGISTER/cseq=50762 (tdta0x718e1beefa78) to TLS 192.168.1.156:5061:
I REGISTER sip:cucm15.mylab.local:5061;transport=TLS SIP/2.0
I Via: SIP/2.0/TLS 192.168.1.50:45271;rport;branch=z9hG4bKPjb2e9904b-838a-40c1-b0fa-38bf05f480e6;alias
I Route: <sip:cucm15.mylab.local:5061;transport=tls;lr>
I Max-Forwards: 70
I From: "Kotlin"<sip:[email protected]>;tag=b171dfd2-1736-43b0-8ca1-122212134e83
I To: "Kotlin"<sip:[email protected]>
I Call-ID: 07654c69-001f-4950-bf95-26de264b9841
I CSeq: 50762 REGISTER
I Supported: outbound, path
I Contact: <sip:[email protected]:45271;transport=TLS;ob>;reg-id=1;+sip.instance="<urn:uuid:00000000-0000-0000-0000-0000e922f243>"
I Expires: 300
I Allow: PRACK, INVITE, ACK, BYE, CANCEL, UPDATE, INFO, SUBSCRIBE, NOTIFY, REFER, MESSAGE, OPTIONS
I Authorization: Digest username="1000", realm="ccmsipline", nonce="Nxg8gjqn1+bnZZFUL++ObWywbceqR/c4", uri="sip:cucm15.mylab.local:5061;transport=TLS", response="74487e212532abcf1cd80a4485b168ab", algorithm=MD5
I Content-Length: 0
I
I
I --end msg--
I 23:28:42.634 pjsua_core.c .RX 386 bytes Response msg 100/REGISTER/cseq=50762 (rdata0x718e2be6c490) from TLS 192.168.1.156:5061:
I SIP/2.0 100 Trying
I Via: SIP/2.0/TLS 192.168.1.50:45271;rport;branch=z9hG4bKPjb2e9904b-838a-40c1-b0fa-38bf05f480e6;alias
I From: "Kotlin"<sip:[email protected]>;tag=b171dfd2-1736-43b0-8ca1-122212134e83
I To: "Kotlin"<sip:[email protected]>
I Date: Mon, 03 Mar 2025 22:28:42 GMT
I Call-ID: 07654c69-001f-4950-bf95-26de264b9841
I CSeq: 50762 REGISTER
I Content-Length: 0
I
I
I --end msg--
I 23:28:42.648 pjsua_core.c .RX 611 bytes Response msg 200/REGISTER/cseq=50762 (rdata0x718e2be6c490) from TLS 192.168.1.156:5061:
I SIP/2.0 200 OK
I Via: SIP/2.0/TLS 192.168.1.50:45271;rport;branch=z9hG4bKPjb2e9904b-838a-40c1-b0fa-38bf05f480e6;alias
I From: "Kotlin"<sip:[email protected]>;tag=b171dfd2-1736-43b0-8ca1-122212134e83
I To: "Kotlin"<sip:[email protected]>;tag=1634883379
I Date: Mon, 03 Mar 2025 22:28:42 GMT
I Call-ID: 07654c69-001f-4950-bf95-26de264b9841
I Server: Cisco-CUCM15.0
I CSeq: 50762 REGISTER
I Expires: 120
I Contact: <sip:[email protected]:45271;transport=TLS;ob>;reg-id=1;+sip.instance="<urn:uuid:00000000-0000-0000-0000-0000e922f243>";x-cisco-newreg
I Supported: X-cisco-sis-10.0.0
I Content-Length: 0
I
I
I --end msg--
I 23:28:42.653 pjsua_acc.c ....SIP outbound status for acc 0 is not active
I 23:28:42.653 pjsua_acc.c ....Service-Route updated for acc 0 with 0 URI(s)
I 23:28:42.654 pjsua_acc.c ....Kotlin <sip:[email protected]>: registration success, status=200 (OK), will re-register in 120 seconds
I 23:28:42.671 tlsc0x718e2be6c198 TLS connection closed
Emulated Pixel 6 Pro with (Android API 32) X86_64 (DNS fails)
I 23:34:31.549 pjsua_core.c .1 SIP worker threads created
I 23:34:31.550 pjsua_core.c .pjsua version 2.15.1 for Linux-5.10.101/x86_64 initialized
I 23:34:31.550 pjsua_core.c .PJSUA state changed: CREATED --> INIT
I 23:34:31.564 tlstp:5061 SIP TLS listener is ready for incoming connections at 10.0.2.16:5061
I 23:34:31.572 pjsua_acc.c Adding account: id=Kotlin <sip:[email protected]>
I 23:34:31.574 pjsua_acc.c .Account Kotlin <sip:[email protected]> added with id 0
I 23:34:31.574 pjsua_acc.c .Acc 0: setting registration..
D app_time_stats: avg=3.51ms min=2.19ms max=4.94ms count=61
D app_time_stats: avg=3.55ms min=2.23ms max=5.44ms count=61
D app_time_stats: avg=3.44ms min=2.28ms max=5.89ms count=60
D app_time_stats: avg=3.51ms min=2.09ms max=5.36ms count=61
D app_time_stats: avg=3.52ms min=2.01ms max=5.91ms count=60
I 23:34:39.617 pjsua_acc.c ..Unable to resolve host to generate Contact address
I 23:34:39.617 pjsua_acc.c ..Contact for acc 0 updated: "Kotlin"<sip:[email protected]:5061;transport=TLS;ob>;reg-id=1;+sip.instance="<urn:uuid:00000000-0000-0000-0000-0000e922f243>"
I 23:34:47.672 pjsua_acc.c ..Unable to resolve host to generate Contact address
I 23:34:51.695 sip_resolve.c ...Failed to resolve 'cucm15.mylab.local.local': Unknown pjlib error 70018
I 23:34:51.696 tsx0x72b352469188 ...Failed to send Request msg REGISTER/cseq=8370 (tdta0x72b3824d5988)! err=70018 (Unknown pjlib error 70018)
I 23:34:51.697 pjsua_acc.c .....SIP registration failed, status=502 (Unknown pjlib error 70018)
I 23:34:51.697 pjsua_acc.c .....Service-Route updated for acc 0 with 0 URI(s)
I 23:34:51.698 pjsua_acc.c .....Scheduling re-registration retry foracc 0in 1 seconds..
I 23:34:51.698 sip_reg.c ..Error sending request: Unknown pjlib error 70018
I 23:34:51.699 pjsua_core.c PJSUA state changed: INIT --> STARTING
I 23:34:51.699 sip_endpoint.c .Module "mod-unsolicited-mwi" registered
I 23:34:51.700 pjsua_core.c .PJSUA state changed: STARTING --> RUNNING
I Skipped 1274 frames! The application may be doing too much work on its main thread.
D app_time_stats: avg=253.92ms min=2.11ms max=14263.78ms count=57
Emulated Pixel 6 Pro Android API 31 X86_64 (Works good)
I 23:56:38.999 pjsua_core.c .1 SIP worker threads created
I 23:56:39.000 pjsua_core.c .pjsua version 2.15.1 for Linux-5.10.185/x86_64 initialized
I 23:56:39.001 pjsua_core.c .PJSUA state changed: CREATED --> INIT
I 23:56:39.022 tlstp:5061 SIP TLS listener is ready for incoming connections at 10.0.2.16:5061
I 23:56:39.056 pjsua_acc.c Adding account: id=Kotlin <sip:[email protected]>
I 23:56:39.058 pjsua_acc.c .Account Kotlin <sip:[email protected]> added with id 0
I 23:56:39.059 pjsua_acc.c .Acc 0: setting registration..
I 23:56:39.164 tlsc0x6ffb8cbbd938 ..TLS client transport created
I 23:56:39.166 tlsc0x6ffb8cbbd938 ..TLS transport 10.0.2.16:55671 is connecting to cucm15.mylab.local.local:5061...
I 23:56:39.166 pjsua_acc.c ..Contact for acc 0 updated: "Kotlin"<sip:[email protected]:55671;transport=TLS;ob>;reg-id=1;+sip.instance="<urn:uuid:00000000-0000-0000-0000-0000e922f243>"
I 23:56:39.176 ssl_sock_ossl.c !OpenSSL version : 269488255
I 23:56:39.177 ssl0x6ffadcbb0480 Certificate chain loaded from buffer
I 23:56:39.178 ssl0x6ffadcbb0480 Private key loaded from buffer
I 23:56:39.261 tlsc0x6ffb8cbbd938 !TLS transport 10.0.2.16:55671 is connected to cucm15.mylab.local.local:5061
I 23:56:39.300 pjsua_core.c ...TX 741 bytes Request msg REGISTER/cseq=26412 (tdta0x6ffb4cc27a08) to TLS 192.168.1.156:5061:
I REGISTER sip:cucm15.mylab.local.local:5061;transport=TLS SIP/2.0
I Via: SIP/2.0/TLS 10.0.2.16:55671;rport;branch=z9hG4bKPjd38852e0-9da1-4c5b-954d-571b123494e0;alias
I Route: <sip:cucm15.mylab.local.local:5061;transport=tls;lr>
I Max-Forwards: 70
I From: "Kotlin"<sip:[email protected]>;tag=cd6e9210-ae10-4fbd-91c4-f8b5d55344b8
I To: "Kotlin"<sip:[email protected]>
I Call-ID: 4ac8f855-c37b-4f92-a526-a61af5727081
I CSeq: 26412 REGISTER
I Supported: outbound, path
I Contact: "Kotlin"<sip:[email protected]:55671;transport=TLS;ob>;reg-id=1;+sip.instance="<urn:uuid:00000000-0000-0000-0000-0000e922f243>"
I Expires: 300
I Allow: PRACK, INVITE, ACK, BYE, CANCEL, UPDATE, INFO, SUBSCRIBE, NOTIFY, REFER, MESSAGE, OPTIONS
I Content-Length: 0
I
I
I --end msg--
I 23:56:39.302 pjsua_acc.c ..Acc 0: Registration sent
I 23:56:39.302 pjsua_core.c PJSUA state changed: INIT --> STARTING
I 23:56:39.302 sip_endpoint.c .Module "mod-unsolicited-mwi" registered
I 23:56:39.302 pjsua_core.c .PJSUA state changed: STARTING --> RUNNING
I 23:56:39.315 pjsua_core.c .RX 405 bytes Response msg 100/REGISTER/cseq=26412 (rdata0x6ffb8cbbdc30) from TLS 192.168.1.156:5061:
I SIP/2.0 100 Trying
I Via: SIP/2.0/TLS 10.0.2.16:55671;rport;branch=z9hG4bKPjd38852e0-9da1-4c5b-954d-571b123494e0;alias;received=192.168.1.50
I From: "Kotlin"<sip:[email protected]>;tag=cd6e9210-ae10-4fbd-91c4-f8b5d55344b8
I To: "Kotlin"<sip:[email protected]>
I Date: Mon, 03 Mar 2025 22:56:39 GMT
I Call-ID: 4ac8f855-c37b-4f92-a526-a61af5727081
I CSeq: 26412 REGISTER
I Content-Length: 0
I
I
I --end msg--
I Skipped 44 frames! The application may be doing too much work on its main thread.
I 23:56:39.465 pjsua_core.c .RX 528 bytes Response msg 401/REGISTER/cseq=26412 (rdata0x6ffb8cbbdc30) from TLS 192.168.1.156:5061:
I SIP/2.0 401 Unauthorized
I Via: SIP/2.0/TLS 10.0.2.16:55671;rport;branch=z9hG4bKPjd38852e0-9da1-4c5b-954d-571b123494e0;alias;received=192.168.1.50
I From: "Kotlin"<sip:[email protected]>;tag=cd6e9210-ae10-4fbd-91c4-f8b5d55344b8
I To: "Kotlin"<sip:[email protected]>;tag=1554244053
I Date: Mon, 03 Mar 2025 22:56:39 GMT
I Call-ID: 4ac8f855-c37b-4f92-a526-a61af5727081
I CSeq: 26412 REGISTER
I WWW-Authenticate: Digest realm="ccmsipline", nonce="goJEPFjwr0iAtvwHqH94rw27iys/0XF9", algorithm=MD5
I Content-Length: 0
I
I
I --end msg--
I 23:56:39.481 pjsua_acc.c ....IP address change detected for account 0 (10.0.2.16:55671 --> 192.168.1.50:55671). Updating registration (using method 4)
I 23:56:39.485 pjsua_acc.c ....Contact for acc 0 updated: <sip:[email protected]:55671;transport=TLS;ob>;reg-id=1;+sip.instance="<urn:uuid:00000000-0000-0000-0000-0000e922f243>"
I 23:56:39.488 pjsua_core.c ....TX 951 bytes Request msg REGISTER/cseq=26413 (tdta0x6ffb4cc27a08) to TLS 192.168.1.156:5061:
I REGISTER sip:cucm15.mylab.local.local:5061;transport=TLS SIP/2.0
I Via: SIP/2.0/TLS 192.168.1.50:55671;rport;branch=z9hG4bKPj1e3f9d8b-90aa-40b4-b1bf-5556a373a320;alias
I Route: <sip:cucm15.mylab.local.local:5061;transport=tls;lr>
I Max-Forwards: 70
I From: "Kotlin"<sip:[email protected]>;tag=cd6e9210-ae10-4fbd-91c4-f8b5d55344b8
I To: "Kotlin"<sip:[email protected]>
I Call-ID: 4ac8f855-c37b-4f92-a526-a61af5727081
I CSeq: 26413 REGISTER
I Supported: outbound, path
I Contact: <sip:[email protected]:55671;transport=TLS;ob>;reg-id=1;+sip.instance="<urn:uuid:00000000-0000-0000-0000-0000e922f243>"
I Expires: 300
I Allow: PRACK, INVITE, ACK, BYE, CANCEL, UPDATE, INFO, SUBSCRIBE, NOTIFY, REFER, MESSAGE, OPTIONS
I Authorization: Digest username="1000", realm="ccmsipline", nonce="goJEPFjwr0iAtvwHqH94rw27iys/0XF9", uri="sip:cucm15.mylab.local.local:5061;transport=TLS", response="f83d2053cbb09743e6ff2466381b266b", algorithm=MD5
I Content-Length: 0
I
I
I --end msg--
I 23:56:39.498 pjsua_core.c .RX 386 bytes Response msg 100/REGISTER/cseq=26413 (rdata0x6ffb8cbbdc30) from TLS 192.168.1.156:5061:
I SIP/2.0 100 Trying
I Via: SIP/2.0/TLS 192.168.1.50:55671;rport;branch=z9hG4bKPj1e3f9d8b-90aa-40b4-b1bf-5556a373a320;alias
I From: "Kotlin"<sip:[email protected]>;tag=cd6e9210-ae10-4fbd-91c4-f8b5d55344b8
I To: "Kotlin"<sip:[email protected]>
I Date: Mon, 03 Mar 2025 22:56:40 GMT
I Call-ID: 4ac8f855-c37b-4f92-a526-a61af5727081
I CSeq: 26413 REGISTER
I Content-Length: 0
I
I
I --end msg--
D app_time_stats: avg=12.10ms min=2.35ms max=27.45ms count=58
I 23:56:39.743 pjsua_core.c .RX 611 bytes Response msg 200/REGISTER/cseq=26413 (rdata0x6ffb8cbbdc30) from TLS 192.168.1.156:5061:
I SIP/2.0 200 OK
I Via: SIP/2.0/TLS 192.168.1.50:55671;rport;branch=z9hG4bKPj1e3f9d8b-90aa-40b4-b1bf-5556a373a320;alias
I From: "Kotlin"<sip:[email protected]>;tag=cd6e9210-ae10-4fbd-91c4-f8b5d55344b8
I To: "Kotlin"<sip:[email protected]>;tag=1748907749
I Date: Mon, 03 Mar 2025 22:56:40 GMT
I Call-ID: 4ac8f855-c37b-4f92-a526-a61af5727081
I Server: Cisco-CUCM15.0
I CSeq: 26413 REGISTER
I Expires: 120
I Contact: <sip:[email protected]:55671;transport=TLS;ob>;reg-id=1;+sip.instance="<urn:uuid:00000000-0000-0000-0000-0000e922f243>";x-cisco-newreg
I Supported: X-cisco-sis-10.0.0
I Content-Length: 0
I
I
I --end msg--
The text was updated successfully, but these errors were encountered:
#4333 PR to implement faster DNS resolution in Android
micha102
changed the title
Slow destination DNS resolution in Android API 32+ (fail for API 32)
Slow destination DNS resolution in Android API 32+ (fail for Emulated API 32)
Mar 3, 2025
Describe the bug
DNS to resolve destination FQDN is very slow in Android API . It takes 4 seconds per DNS attempt (either success of failure), so 8 seconds if IPV6 is supported.
Deactivating IPV6 cut the delay by half, but it's still very slow.
Counting all DNS requests, between clicking "Start Library" and the actual TX REGISTER is 20 seconds. (all are due to DNS delay caused by getaddrinfo)
Setting Macro PJ_SOCK_HAS_GETADDRINFO is not satisfying because it doesn't support IPV6 (only V4)
Debugging the code brought me to the file addr_resolv_sock.c and specifically to the getaddrinfo (inside pj_getaddrinfo) which is taking 4 seconds to fulfill either the answer is good (A) or empty (AAAA).
I found in Android documentation they introduced new DNS lookup functions android_res_nquery and android_res_nresult, and I tested them successfully.
Steps to reproduce
For example : I put my local PBX (Cisco CUCM) with fqdn cucm15.mylab.local
5a. Tested on (huge delay/fail) :
Xiaomi Mi 9T with LineageOS (Android API 35) ARM64-V8A
Emulated Pixel 6 Pro with (Android API 35) X86_64
Emulated Pixel 6 Pro with (Android API 34) X86_64
20 seconds delay and then REGISTER OK
Emulated Pixel 6 Pro with (Android API 32) X86_64 and the DNS lookup fails altogether and doesn't register.
5b. Tested on Emulated Pixel 6 Pro with (Android API 31) X86_64 works good.
PJSIP version
2.15.1
Context
Log, call stack, etc
The text was updated successfully, but these errors were encountered: