¿Cómo configurar un agente de usuario SIP personalizado en Android?

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. asterisco 1.8.7.1
  2. Android 2.3.3

preguntado el 09 de marzo de 12 a las 13:03

2 Respuestas

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:11@192.168.16.181:32262;rinstance=9dd2c78e6ac0a5a5>
        To: "soft 2"<sip:11@192.168.16.40>
        From: "soft 2"<sip:11@192.168.16.40>;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.

Debes implementar or use a ready SIP Stack.

Popular free SIP Stack libraries are - MjSip y 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.

Respondido 07 Oct 21, 07:10

thanks for your answer.but where do i find this method? in my android code or in Asterisk configuration files.please specify in which file and where should i implement this this code? thanks in advance - junio

thanks for your nice explanation. but i am not using any SIP library like MjSip and Doubango i am using a built in library of android.in this case is it possible to change the name of user-agent? - junio

in the case if i want to implement those libraries(MjSip or Doubango) then how to do that? is there any supporting document and link for that? please let me know. - junio

you listed, that you used android 2.3.3, the Android SIPStack is provided in Android 4.0 I think... - hovanessyan

AFAIK the Android SIPStack offers very limited options (I have not used it though). According to those libs above - they both have extensive docu on their sites. You need to check-out the libs and incorporate the packages in your project. But you'll probably have to begin from the start. Take a look at sipDroid for example (which uses MjSIP) to see how the libs are used. - hovanessyan

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.

respondido 10 mar '12, 07:03

thanks for you answer but i am not using any SIP library like MjSip and Doubango i am using a built in library of android.in this case is it possible to change the name of user-agent? - junio

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.