1
votes

I am developing a SIP application. When I am registering on a SIP server through my android application the default user agent displayed by android on asterisk server is SIPAUA/0.1.001. How do I change that? I have searched on the Internet couldn't find anything? Is there any method in android to change it? Resources which I use is

  1. asterisk 1.8.7.1
  2. android 2.3.3
2

2 Answers

0
votes

You have also specify which sip lib you use and consult that lib's documentation. Most probalby you just not set that field in library,as result it use default.

0
votes

You can specify that value, using User-Agent header field in your REGISTER method.

See section 20.41 of the SIP RFC.

Example body of REGISTER method, which contains User-Agent header field:

Session Initiation Protocol
    Request-Line: REGISTER sip:192.168.16.40 SIP/2.0
        Method: REGISTER
        [Resent Packet: False]
    Message Header
        Via: SIP/2.0/UDP 192.168.16.181:32262;branch=z9hG4bK-d87543-624dc77d9c1b9618-1--d87543-;rport
        Max-Forwards: 70
        Contact: <sip:[email protected]:32262;rinstance=9dd2c78e6ac0a5a5>
        To: "soft 2"<sip:[email protected]>
        From: "soft 2"<sip:[email protected]>;tag=394aa21c
        Call-ID: YjYzYTAyNzM0NGVkYmEzZWMyMzJmNzMzNDZjMzIyMjg.
        CSeq: 1 REGISTER
        Expires: 3600
        Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, NOTIFY, MESSAGE, SUBSCRIBE, INFO
        User-Agent: X-Lite release 1011s stamp 41150
        Content-Length: 0

EDIT:

This code should be in your application, not on the server.

You should implement or use a ready SIP Stack.

Popular free SIP Stack libraries are - MjSip and Doubango - a lot of open source software SIP Clients (phones) use them.

Basically in the SIP Stack you have a class for each header field (according to the RFC) - pretty much as a POJO/Simple Java Bean. Than you have a Message Factory, which supports the creation for all SIP2.0 (sometimes + extension messages for SIMPLE - that's chat and presence service) Messages - REGISTER, INVITE, ACK and so on. Than you have a Parser which offers convenient methods to extract information from a message body (supports all message types). That's roughly what the SIPStack holds.

So, when you create a message, you have collection of header fields (and collection of attributes for the SDP, if required) attached to that message (programatically, it really depends on the SIPStack implementation) and you just add in the collection the necessary header fields.