sipsorcery-org / sipsorcery

A WebRTC, SIP and VoIP library for C# and .NET. Designed for real-time communications apps.
https://sipsorcery-org.github.io/sipsorcery
Other
1.47k stars 442 forks source link

Change Contact Header in SIP INVITE (always anonymous) #1026

Closed mani9876 closed 12 months ago

mani9876 commented 1 year ago

Hello!

I am using the UserAgentClient Example with a few modification on the FROM Header, but I am not able to change the Contact Header.

It is always "anonymous@...." I could find out, that I can change the host part, with sipTransport.ContactHost = "siptrunk.example.net"; but not the User Part.

I need to change it, to another value, because my SIP Trunk Provider checks the Contact Header.

Is there a possibility to change that?

I am using this calldescriptor:

                // Start the thread that places the call.
                SIPCallDescriptor callDescriptor = new SIPCallDescriptor(
                SIPConstants.SIP_DEFAULT_USERNAME,
                DEFAULT_PASSWORD,
                callUri.ToString(),
                "sip:+4xxxxxxxxxx@siptrunk.example.net",
                callUri.CanonicalAddress,
                null, null, SIPConstants.SIP_DEFAULT_USERNAME, 
                SIPCallDirection.Out,
                SDP.SDP_MIME_CONTENTTYPE,
                offerSDP.ToString(),
                null);

                uac.Call(callDescriptor, null);

Thanks!