How to modify Contact Header Field

457 views
Skip to first unread message

Rushikesh

unread,
May 2, 2021, 12:08:23 PM5/2/21
to SIP.js
When I register a user, the contact header is set to user...@randomString.invalid  . But I want to change it after registration. After registration is successfull server sends the IP and port to the client. I want to use that IP value in contact header- for next client-server communication. How should I move to solve this?

Slavik Bialik

unread,
May 3, 2021, 12:07:40 PM5/3/21
to SIP.js
Hi!
It is very easy, just set "contactName" in the UserAgentOptions object you're passing to the register command.
Here's an example from my code:

const userAgentOptions: UserAgentOptions = {
authorizationPassword: password,
authorizationUsername: username,
contactName: username,
viaHost: userDomain,
transportOptions,
uri,
delegate: {
onInvite: (invitation) => this.onCallRecieve(invitation, self)
}
};


Reply all
Reply to author
Forward
0 new messages