Modifying ContactHeader using Android.Net.Sip

Hello everyone,

currently I'm working on an Android App for sending and receiving VoIP Calls and we are using the Android.Net.Sip Package to register at our SIP Server.
Now we are wondering if there is a way to modify the Contact header in the register package which is sent as an request to our SIP Server.

This is an example SIP Package:

REGISTER sip:example.com SIP/2.0
Via: SIP/2.0/UDP pc34.example.com;branch=z9hG4bKnaaff
From: sip:[email protected];tag=99a8s
To: sip:[email protected]
Call-ID: [email protected]
CSeq: 9976 REGISTER
Contact: sip:[email protected]

And we need to change the Contact header, so our SIP Server knows where to send a push notification if the target user is not registered at the moment.

From reading the Android.Net.Sip code, I found out that the ContactHeader is generated using the UserName, Domain, Transport protocol and the DisplayName. When I am setting the DisplayName to some sample string, it however does not get into the ContactHeader.

We are using Xamarin.Android.

Hoping for some useful solutions on this.

Sincerly,

Tagged:

Answers

  • dxmanndxmann ITMember ✭✭

    Hy,
    in my code I specify the sip number and domain in the builder constructor: in my case the domain (or realm) is an uri that is not connected to a phisical address.
    Server's address and port are specified with builderInstance.SetOutboundProxy() and builderInstance.SetPort(). Furter login informations, like authentication name and password are specified with builderInstance.SetAuthUserName(), builderInstance.SetPassword(), builderInstance.SetProtocol().

    Here is my code:

    SipProfile.Builder profile1Builder = new SipProfile.Builder("007", "domain.dom");
    profile1Builder.SetDisplayName("dxmann");
    profile1Builder.SetOutboundProxy("192.168.1.1");
    profile1Builder.SetPort(5060);
    profile1Builder.SetAuthUserName("007");
    profile1Builder.SetPassword("mypassw");
    profile1Builder.SetProtocol("UDP");
    profile1Builder.SetAutoRegistration(true);
    //profile1Builder.SetSendKeepAlive(true);
    SipProfile profile1 = profile1Builder.Build();
    localProfiles.Add(profile1);

Sign In or Register to comment.