Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Contact header is not set by natPolicy or manually for register #397

Open
nigeldaniels opened this issue Apr 29, 2024 · 0 comments
Open
Labels
bug Something isn't working

Comments

@nigeldaniels
Copy link

nigeldaniels commented Apr 29, 2024

Context

I use the linphone-sdk ( kotlin) for android. When attempting to register the Contact header field is automatically generated and not the correct one that should be discovered by my natPolicy

    private fun register(username: String, password: String, domain: String) {
        val mynatpolicy = core.createNatPolicy()
        mynatpolicy.isStunEnabled = true
        mynatpolicy.stunServer = "stun.gmx.net:3478"
        core.natPolicy = mynatpolicy

        val identity = Factory.instance().createAddress("sip:$username@$domain") 
        val accountParams = core.createAccountParams()
        accountParams.identityAddress = identity


        accountParams.natPolicy = mynatpolicy

        val authInfo = Factory.instance().createAuthInfo(username, null, password, null, null, domain)

        val proxyAddress = Factory.instance().createAddress("sip:$domain")
        proxyAddress?.transport = TransportType.Udp
        accountParams.serverAddress = proxyAddress
        accountParams.isRegisterEnabled = true
        accountParams.natPolicy = mynatpolicy
        val account = core.createAccount(accountParams)

        core.addAuthInfo(authInfo)
        account.contactAddress = Factory.instance().createAddress("sip:[email protected]")
        core.addAccount(account)
        core.defaultAccount = account
    }

In the above code you can see I try to use both nat policy as well as manually setting contact address neither seems to work I am trying to understand what I am doing incorrectly

logs of the register msg that is generated is provided bellow

024-04-28 17:57:43.920 15201-15201 LinphoneDebug           com.trap.trapfone                    I  Linphone core [0xb400007b0b583400] notified [registration_state_changed]
2024-04-28 17:57:43.920 15201-15201 LinphoneDebug           com.trap.trapfone                    I  resolver_process_data dns_res_check() in progress
2024-04-28 17:57:43.921 15201-15201 LinphoneDebug           com.trap.trapfone                    I  stun.gmx.net resolved to 212.227.67.33
2024-04-28 17:57:43.921 15201-15201 LinphoneDebug           com.trap.trapfone                    I  stun.gmx.net resolved to 212.227.67.34
2024-04-28 17:57:43.921 15201-15201 LinphoneDebug           com.trap.trapfone                    I  resolver[0xb4000079db56be30]: starting aaaa timeout since A response is received.
2024-04-28 17:57:43.921 15201-15201 LinphoneDebug           com.trap.trapfone                    I  Stun server resolution successful.
2024-04-28 17:57:43.921 15201-15201 LinphoneDebug           com.trap.trapfone                    I  Ending background task [17190] with name: [Core startup until registration]
2024-04-28 17:57:43.922 15201-15201 LinphoneDebug           com.trap.trapfone                    I  bellesip_wake_lock_release(): Android wake lock released [ref=0x4326]
2024-04-28 17:57:43.933 15201-15201 LinphoneDebug           com.trap.trapfone                    I  Stun server resolution successful.
2024-04-28 17:57:44.023 15201-15201 LinphoneDebug           com.trap.trapfone                    I  sip.opensettlenet.net resolved to 34.168.241.151
2024-04-28 17:57:44.024 15201-15201 LinphoneDebug           com.trap.trapfone                    I  resolver[0xb4000079db5752b0]: starting SRV timer since A/AAAA fallback response is received.
2024-04-28 17:57:44.024 15201-15201 LinphoneDebug           com.trap.trapfone                    I  channel[0xb400007bf7ec2e00]: entering state RES_DONE
2024-04-28 17:57:44.024 15201-15201 LinphoneDebug           com.trap.trapfone                    I  transaction [0xb400007a0b5c8190] channel state changed to [RES_DONE]
2024-04-28 17:57:44.024 15201-15201 LinphoneDebug           com.trap.trapfone                    I  channel[0xb400007bf7ec2e00]: entering state CONNECTING
2024-04-28 17:57:44.026 15201-15201 LinphoneDebug           com.trap.trapfone                    I  transaction [0xb400007a0b5c8190] channel state changed to [CONNECTING]
2024-04-28 17:57:44.026 15201-15201 LinphoneDebug           com.trap.trapfone                    I  Trying to connect to [UDP:https://::ffff:34.168.241.151:5060]
2024-04-28 17:57:44.026 15201-15201 LinphoneDebug           com.trap.trapfone                    I  Channel has local address 10.0.2.16:39295
2024-04-28 17:57:44.026 15201-15201 LinphoneDebug           com.trap.trapfone                    I  channel[0xb400007bf7ec2e00]: entering state READY
2024-04-28 17:57:44.027 15201-15201 LinphoneDebug           com.trap.trapfone                    I  transaction [0xb400007a0b5c8190] channel state changed to [READY]
2024-04-28 17:57:44.027 15201-15201 LinphoneDebug           com.trap.trapfone                    I  Changing [client] [REGISTER] transaction [0xb400007a0b5c8190], from state [INIT] to [TRYING]
2024-04-28 17:57:44.027 15201-15201 LinphoneDebug           com.trap.trapfone                    I  channel [0xb400007bf7ec2e00]: message sent to [UDP:https://sip.opensettlenet.net:5060], size: [544] bytes
2024-04-28 17:57:44.028 15201-15201 LinphoneDebug           com.trap.trapfone                    I  REGISTER sip:sip.opensettlenet.net SIP/2.0
2024-04-28 17:57:44.028 15201-15201 LinphoneDebug           com.trap.trapfone                    I  Via: SIP/2.0/UDP 10.0.2.16:39295;branch=z9hG4bK.CNr2HDEs6;rport
2024-04-28 17:57:44.028 15201-15201 LinphoneDebug           com.trap.trapfone                    I  From: <sip:[email protected]>;tag=0En1EBH-S
2024-04-28 17:57:44.028 15201-15201 LinphoneDebug           com.trap.trapfone                    I  To: sip:[email protected]
2024-04-28 17:57:44.028 15201-15201 LinphoneDebug           com.trap.trapfone                    I  CSeq: 20 REGISTER
2024-04-28 17:57:44.028 15201-15201 LinphoneDebug           com.trap.trapfone                    I  Call-ID: wprGwD9CO~
2024-04-28 17:57:44.028 15201-15201 LinphoneDebug           com.trap.trapfone                    I  Max-Forwards: 70
2024-04-28 17:57:44.028 15201-15201 LinphoneDebug           com.trap.trapfone                    I  Supported: replaces, outbound, gruu, path
2024-04-28 17:57:44.028 15201-15201 LinphoneDebug           com.trap.trapfone                    I  Accept: application/sdp
2024-04-28 17:57:44.028 15201-15201 LinphoneDebug           com.trap.trapfone                    I  Accept: text/plain
2024-04-28 17:57:44.028 15201-15201 LinphoneDebug           com.trap.trapfone                    I  Accept: application/vnd.gsma.rcs-ft-http+xml
2024-04-28 17:57:44.028 15201-15201 LinphoneDebug           com.trap.trapfone                    I  Contact: <sip:[email protected]:39295;transport=udp>;+sip.instance="<urn:uuid:e6e4e521-31e2-005d-a2ca-06efaf69e670>"
2024-04-28 17:57:44.028 15201-15201 LinphoneDebug           com.trap.trapfone                    I  Expires: 3600
2024-04-28 17:57:44.028 15201-15201 LinphoneDebug           com.trap.trapfone                    I  User-Agent: Unknown
2024-04-28 17:57:44.028 15201-15201 LinphoneDebug           com.trap.trapfone                    I  

General information

  • Device: pixel 5
  • OS: android
  • Version of the App: N/A
  • Version of the SDK: latest

Expected behaviour

I would have expected that the contact header either be discovered by stun or use the value I set on the account object.

To Reproduce

The code I used is provided above

Additional context

Add any other context about the problem here.

SDK logs URL

Logs are pasted Above.

@nigeldaniels nigeldaniels added the bug Something isn't working label Apr 29, 2024
@nigeldaniels nigeldaniels changed the title [Bug]: [Bug]: Contact header is not set by natPolicy or manually for register Apr 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant