public void SaveProfileSIP() {
// TODO Auto-generated method stub
// We do some VERY basic thing here (minimal), a real app should probably manage input differently
ArrayList<HashMap<String, String>> list=sp.GetSIPDetails(chatActivityContext);
Log.w("sipppp", list.toString());
String username=list.get(0).get("SIPID");
String sipserver=sp.GetSipServerAddress(chatActivityContext);
String sipproxy=list.get(0).get("SIPPROXY")+":"+list.get(0).get("SIPPROXYPORT");
String pwd=list.get(0).get("SIPPASS");
String fullUser=username+"@"+list.get(0).get("SIPSERVER");
SipProfile builtProfile = new SipProfile();
builtProfile.display_name = username;
builtProfile.id = 1;
builtProfile.acc_id = "<sip:"+fullUser+">";
builtProfile.reg_uri = "sip:"+sipserver;
builtProfile.realm = "*";
builtProfile.username = username;
builtProfile.data = pwd;
builtProfile.proxies = new String[] {"sip:"+sipproxy};
ContentValues builtValues = builtProfile.getDbContentValues();
if(existingProfileId != SipProfile.INVALID_ID) {
getContentResolver().update(ContentUris.withAppendedId(SipProfile.ACCOUNT_ID_URI_BASE, existingProfileId), builtValues, null, null);
}else {
Uri savedUri = getContentResolver().insert(SipProfile.ACCOUNT_URI, builtValues);
if(savedUri != null) {
existingProfileId = ContentUris.parseId(savedUri);
}
}
}
// TODO Auto-generated method stub
// We do some VERY basic thing here (minimal), a real app should probably manage input differently
ArrayList<HashMap<String, String>> list=sp.GetSIPDetails(chatActivityContext);
Log.w("sipppp", list.toString());
String username=list.get(0).get("SIPID");
String sipserver=sp.GetSipServerAddress(chatActivityContext);
String sipproxy=list.get(0).get("SIPPROXY")+":"+list.get(0).get("SIPPROXYPORT");
String pwd=list.get(0).get("SIPPASS");
String fullUser=username+"@"+list.get(0).get("SIPSERVER");
SipProfile builtProfile = new SipProfile();
builtProfile.display_name = username;
builtProfile.id = 1;
builtProfile.acc_id = "<sip:"+fullUser+">";
builtProfile.reg_uri = "sip:"+sipserver;
builtProfile.realm = "*";
builtProfile.username = username;
builtProfile.data = pwd;
builtProfile.proxies = new String[] {"sip:"+sipproxy};
ContentValues builtValues = builtProfile.getDbContentValues();
if(existingProfileId != SipProfile.INVALID_ID) {
getContentResolver().update(ContentUris.withAppendedId(SipProfile.ACCOUNT_ID_URI_BASE, existingProfileId), builtValues, null, null);
}else {
Uri savedUri = getContentResolver().insert(SipProfile.ACCOUNT_URI, builtValues);
if(savedUri != null) {
existingProfileId = ContentUris.parseId(savedUri);
}
}
}
Comments
Post a Comment