steps to make TLS call

1,241 views
Skip to first unread message

arkut tony

unread,
Sep 4, 2012, 3:22:21 AM9/4/12
to csipsim...@googlegroups.com
Hi,

how to make TLS call?

i got this error  :

1.Unable to generate suitable Contact header for registration: Unsupported transport (PJSIP_EUNSUPTRANSPORT) [status=171060]

2.pjsua_acc.c !.Unable to create/send REGISTER: Unsupported transport (PJSIP_EUNSUPTRANSPORT) [status=171060]

thanks

arkut tony

unread,
Sep 4, 2012, 3:30:07 AM9/4/12
to csipsim...@googlegroups.com
Sorry ,i forgot to tell that i am modifying SampleCSipsimpleApplication source code so that it can support TLS call.

Régis Montoya

unread,
Sep 4, 2012, 7:55:02 AM9/4/12
to csipsim...@googlegroups.com
You need to activate the global setting to enable the TLS transport.
See the javadoc to find this setting.

To have tls you need the account configured to use TLS, apparently that's correctly already done... but you also need to activate (and optionally configure) TLS transport using SipConfigManager.

Best regards,
Régis

2012/9/4 arkut tony

arkut tony

unread,
Sep 4, 2012, 9:33:48 AM9/4/12
to csipsim...@googlegroups.com
hi

thanks regis for reply my post.

sorry firstly,regarding to your reply.

 i do not need to do modification on csipsimple.i do not need to rewrite makefile or etc and recompile it.

what i need to do is to modify only on samplecsipsimpleapplication only.is that right?

second ,when you said global configuration for TLS,do you mean the configuration on SipProfile?or is there any

other configuration?

third,when you said enable tls on sipconfigmanager,is it this is right way to enable it?

i have paste my source code,just wonder is it the right way to enable it.


it is already working on tcp.

/**********************  code  *********************/

Intent it = new Intent(SipManager.INTENT_SIP_SERVICE);
      
this.getActivity().stopService(it);

this.getActivity().startService(it);      

SipConfigManager configmanager = new SipConfigManager();

configmanager.ENABLE_TLS    =    true;

SipProfile builtProfile = new SipProfile();      

builtProfile.display_name     = "xxxx";

builtProfile.id             =  SipProfile.INVALID_ID;      

builtProfile.acc_id         = "<sip:xxxx@ip_server>";       
     
builtProfile.realm             = "ip_server";
     
builtProfile.username         = "xxxx";

builtProfile.data             = "1234";

builtProfile.allow_contact_rewrite    =    true;

builtProfile.datatype        = SipProfile.CRED_DATA_PLAIN_PASSWD;

builtProfile.scheme            = "Digest";  

builtProfile.transport        = SipProfile.TRANSPORT_TLS;         

builtProfile.proxies         = new String[] {"sip:ip_server;transport=tls"};

builtProfile.reg_use_proxy    = 1;

builtProfile.wizard            = "kkkk";      

builtProfile.reg_uri        = "sip:ip_server;transport=tls";

builtProfile.reg_timeout    =    30;

ContentValues builtValues = builtProfile.getDbContentValues();



if(existingProfileId != SipProfile.INVALID_ID)
{
   this.getActivity().getContentResolver().update(ContentUris.withAppendedId(SipProfile.ACCOUNT_ID_URI_BASE, existingProfileId), builtValues, null, null);
   Toast.makeText(getActivity()," Update ", Toast.LENGTH_LONG).show();
 
}
else
{
   Uri savedUri =  this.getActivity().getContentResolver().insert(SipProfile.ACCOUNT_URI, builtValues);
   Toast.makeText(getActivity()," Insert ", Toast.LENGTH_LONG).show();
 
   if(savedUri != null)
   {
       existingProfileId = ContentUris.parseId(savedUri);             
   }
}

thanks a lot regis ...

arkut tony

unread,
Sep 4, 2012, 9:53:27 AM9/4/12
to csipsim...@googlegroups.com
slight modification on the code ..

i use setPreferenceBooleanValue for sipconfigmanager.so is it true the way i configure?or is there anything else that i miss or the way i configure is not right?


Intent it = new Intent(SipManager.INTENT_SIP_SERVICE);
      
this.getActivity().stopService(it);

this.getActivity().startService(it);      

SipConfigManager configmanager = new SipConfigManager();

SipConfigManager.setPreferenceBooleanValue(this.getActivity(),SipConfigManager.ENABLE_TLS,true);

Régis Montoya

unread,
Sep 5, 2012, 3:27:07 PM9/5/12
to csipsim...@googlegroups.com
Yes.

It's static however. So no need to instantiate it.

What is important to understand is that you have two concepts :
* Global configuration that is global and are settings that apply
independently of the account.
* Account configuration that is per account settings and only apply the
account.

For the Account configuration you use the SipProfile class
http://r3gis3r.github.com/SampleCSipSimpleApp/javadoc/com/csipsimple/api/SipProfile.html
that can be used to retrieve / abstract field of the database of accounts.
For Global settings configuration you use the SipConfigManager
http://r3gis3r.github.com/SampleCSipSimpleApp/javadoc/com/csipsimple/api/SipConfigManager.html
to retrieve fields and insert into global settings database.

I HIGHLY recommend you to get things working on csipsimple first. The
distinction between global and account settings is obvious in the user
interface. Once you have set in csipsimple everything as you want in
csipsimple ui, you will just have to find the matching settings and
apply it your app using the account settings and the global settings.

arkut tony

unread,
Sep 8, 2012, 12:29:49 PM9/8/12
to csipsim...@googlegroups.com
hi regis,

thanks for your reply.

i successfully do sip registration and  make call .both through TLS.

here are my codes.

/**************    Codes for registeration *******************/


          Intent it = new Intent(SipManager.INTENT_SIP_SERVICE);

this.getActivity().stopService(it);

this.getActivity().startService(it);


/*************  codes end  ****************/

/**************    Codes for call *******************/

        Intent it = new Intent(Intent.ACTION_CALL);
       
        it.setData(SipUri.forgeSipUri("sip","xxxx@ip_server;transport=TLS"));
       
        it.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); 
       
        it.putExtra(SipProfile.FIELD_ACC_ID, caller);
       
        it.putExtra(SipProfile.FIELD_REALM, "ip_server");       
        
        it.putExtra(SipProfile.FIELD_TRANSPORT, SipProfile.TRANSPORT_TLS);
       
        it.putExtra(SipProfile.FIELD_REG_USE_PROXY, 1);
       
        it.putExtra(SipProfile.FIELD_PROXY, "sip:ip_server;transport=TLS");
       
        it.putExtra("profile", (int)existingProfileId);
       
        startActivity(it);

/*************  codes end ****************/

one more thing.

1. i just wonder, if i want to make 3g call in and call out,i just need to enable settings like this right ?

 SipConfigManager.setPreferenceBooleanValue(this.getActivity(), SipConfigManager.USE_3G_IN, true);
           
 SipConfigManager.setPreferenceBooleanValue(this.getActivity(), SipConfigManager.USE_3G_OUT, true);

2.And for tls,the default port is 5061.let say i want to use port 400 as my tls port.
how do i configure it?

3.Just wonder,how to enable SRTP?

thanks regis ....






Régis Montoya

unread,
Sep 8, 2012, 12:49:29 PM9/8/12
to csipsim...@googlegroups.com
Hi,

Great :).
My comments inline :


/**************    Codes for call *******************/

        Intent it = new Intent(Intent.ACTION_CALL);
       
If you want to force the use of csipsimple you can use "csip" scheme instead of "sip".
If you really configure properly the extra for the account, no need to add ip_server;transport=TLS since your account has proxy setup properly.

        it.setData(SipUri.forgeSipUri("sip","xxxx@ip_server;transport=TLS"));
        it.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);                 

The following part is useless, not taken into account and partially wrong (it doesn't tell to use the account you configured previously.. it will use local account instead).
        it.putExtra(SipProfile.FIELD_ACC_ID, caller);
        it.putExtra(SipProfile.FIELD_REALM, "ip_server");       
        it.putExtra(SipProfile.FIELD_TRANSPORT, SipProfile.TRANSPORT_TLS);
        it.putExtra(SipProfile.FIELD_REG_USE_PROXY, 1);
        it.putExtra(SipProfile.FIELD_PROXY, "sip:ip_server;transport=TLS");      
Fixed code (as you can find everywhere in csipsimple code) :

                Intent it = new Intent(Intent.ACTION_CALL);
                it.setData(SipUri.forgeSipUri(SipManager.PROTOCOL_CSIP, nbrToCall));
                it.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
                it.putExtra(SipProfile.FIELD_ACC_ID, existingProfileId);
                startActivity(it);


If you are looking for sample use of the api the best place is the csipsimple "ui" package. Most things here rely on the public api ;)


one more thing.

1. i just wonder, if i want to make 3g call in and call out,i just need to enable settings like this right ?

 SipConfigManager.setPreferenceBooleanValue(this.getActivity(), SipConfigManager.USE_3G_IN, true);
 SipConfigManager.setPreferenceBooleanValue(this.getActivity(), SipConfigManager.USE_3G_OUT, true);

Yes absolutely :)


2.And for tls,the default port is 5061.let say i want to use port 400 as my tls port.
how do i configure it?
I don't know what you mean by default port so I'll explain for the two possible way to interprete the question :

 * If you are asking for the local binding port of the app (the port where the app listens for incoming calls)
=> http://r3gis3r.github.com/SampleCSipSimpleApp/javadoc/com/csipsimple/api/SipConfigManager.html#TLS_TRANSPORT_PORT
 * If you are asking for the remote port where your sip server listens, it's just about the sip server/proxy cfg :)
as everywhere when you want to put a port in a uri :
for the registrar : sip:registrar_ip_domain:400;transport=TLS
for the proxy : sip:proxy_ip_domain:400;transport=TLS


3.Just wonder,how to enable SRTP?

RajaReddy PolamReddy

unread,
Sep 10, 2012, 12:37:13 AM9/10/12
to csipsim...@googlegroups.com

Can you help me on this,
i am unable to register to a particular account and un-register it also.

1. i was able register and un-register using csipsimple application. but i don't want to show all the accounts 
    no need to show account details 
   i want to add those information static and when i click on button i want to register and one more button unregister..
   
please help me on this ..
--
 

Thanks & regards?

RajaReddy PolamReddy

Android Developer

COLORS Software Pvt. Ltd. | 09620 468 345
 సంతోషాన్ని ఎవ్వరైనా భరిస్తారు కానీ భాదను పంచుకోవటానికి ఎవరు ముందుకు రారు .... !!!!! "

Reply all
Reply to author
Forward
0 new messages