Skip to content

Commit

Permalink
Added support to set CallerID in Advanced Options to be able to set a…
Browse files Browse the repository at this point in the history
… custom caller id. Usefull if the used sip provider doesn't offer to set a caller id for the account.

git-svn-id: http://sipdroid.googlecode.com/svn/trunk@330 8b64e154-0f13-11de-9106-f38757f67524
  • Loading branch information
[email protected] committed Oct 7, 2009
1 parent 9f70934 commit c8eb1ef
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 14 deletions.
14 changes: 7 additions & 7 deletions .classpath
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="gen"/>
<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
<classpathentry kind="output" path="bin"/>
</classpath>
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="gen"/>
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
<classpathentry kind="output" path="bin"/>
</classpath>
4 changes: 2 additions & 2 deletions res/layout/sipdroid.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ android:background="#736f6e"
xmlns:android="http://schemas.android.com/apk/res/android"
>

<TextView android:id="@+id/txt_name" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textColor="#ffffff" android:typeface="serif" android:layout_x="12px" android:layout_y="8px" android:textSize="24px" android:text="@string/app_name"></TextView>
<TextView android:id="@+id/txt_name" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textColor="#ffffff" android:typeface="serif" android:layout_x="12px" android:layout_y="8px" android:textSize="24px" android:text='@string/app_name'></TextView>
<org.sipdroid.sipua.ui.InstantAutoCompleteTextView
android:id="@+id/txt_callee"
android:layout_width="302px"
Expand All @@ -18,7 +18,7 @@ android:singleLine="true"
android:layout_y="40px"
android:hint="@string/hint"
android:inputType="textEmailAddress"
android:imeOptions="actionSend|flagNoExtractUi"/>
android:imeOptions="actionSend|flagNoExtractUi"></org.sipdroid.sipua.ui.InstantAutoCompleteTextView>
<AbsoluteLayout
android:id="@+id/top_box_layout"
android:layout_width="fill_parent"
Expand Down
1 change: 1 addition & 0 deletions res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -160,4 +160,5 @@

<string name="ongoing">Current Call</string>
<string name="onHold">On hold</string>
<string name="callerid">Caller ID</string>
</resources>
5 changes: 2 additions & 3 deletions res/xml/preferences.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@
android:title="@string/settings_protocol"
android:entries="@array/protocol_display_values"
android:entryValues="@array/protocol_values"
android:dialogTitle="@string/settings_protocol" />
</PreferenceCategory>
android:dialogTitle="@string/settings_protocol" /></PreferenceCategory>
</PreferenceScreen>
<PreferenceScreen android:title="@string/settings_options">
<PreferenceCategory android:title="@string/settings_options">
Expand Down Expand Up @@ -91,7 +90,7 @@
android:entryValues="@array/eargain_values"
android:defaultValue="0.25"
android:dialogTitle="@string/settings_eargain" />
</PreferenceCategory>
<EditTextPreference android:singleLine="true" android:title="@string/callerid" android:key="callerid"></EditTextPreference></PreferenceCategory>
</PreferenceScreen>
<PreferenceScreen android:title="@string/settings_pbxes_options">
<PreferenceCategory android:title="@string/settings_pbxes_options">
Expand Down
10 changes: 9 additions & 1 deletion src/org/sipdroid/sipua/SipdroidEngine.java
Original file line number Diff line number Diff line change
Expand Up @@ -71,15 +71,23 @@ public boolean StartEngine() {

user_profile = new UserAgentProfile(null);
user_profile.username = PreferenceManager.getDefaultSharedPreferences(getUIContext()).getString("username",""); // modified
user_profile.callerid = PreferenceManager.getDefaultSharedPreferences(getUIContext()).getString("callerid", "");
user_profile.passwd = PreferenceManager.getDefaultSharedPreferences(getUIContext()).getString("password","");
if (PreferenceManager.getDefaultSharedPreferences(getUIContext()).getString("domain","").length() == 0) {
user_profile.realm = PreferenceManager.getDefaultSharedPreferences(getUIContext()).getString("server","");
} else {
user_profile.realm = PreferenceManager.getDefaultSharedPreferences(getUIContext()).getString("domain","");
}
if (user_profile.callerid == "") {
user_profile.from_url = user_profile.username
+ "@"
+ user_profile.realm;
+ user_profile.realm;
}
else {
user_profile.from_url = user_profile.callerid
+ "@"
+ user_profile.realm;
}
user_profile.contact_url = user_profile.username
+ "@"
+ opt_via_addr;
Expand Down
3 changes: 3 additions & 0 deletions src/org/sipdroid/sipua/UserAgentProfile.java
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ public class UserAgentProfile extends Configure {
public String realm = null;
/** User's passwd. */
public String passwd = null;

/** User's callerid. */
public String callerid = null;
/**
* Path for the 'ua.jar' lib, used to retrive various UA media (gif, wav,
* etc.) By default, it is used the "lib/ua.jar" folder
Expand Down
4 changes: 3 additions & 1 deletion src/org/sipdroid/sipua/ui/Settings.java
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,8 @@ public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, Strin
key.equals("protocol") ||
key.equals("minedge") ||
key.equals("pos") ||
key.equals("posurl")) {
key.equals("posurl") ||
key.equals("callerid")) {
if (key.equals("wlan") || key.equals("3g"))
updateSleep();
Receiver.engine(this).halt();
Expand Down Expand Up @@ -140,6 +141,7 @@ void updateSleep() {
}

public void updateSummaries() {
getPreferenceScreen().findPreference("callerid").setSummary(getPreferenceScreen().getSharedPreferences().getString("callerid",""));
getPreferenceScreen().findPreference("username").setSummary(getPreferenceScreen().getSharedPreferences().getString("username", ""));
getPreferenceScreen().findPreference("server").setSummary(getPreferenceScreen().getSharedPreferences().getString("server", ""));
if (getPreferenceScreen().getSharedPreferences().getString("domain","").length() == 0) {
Expand Down

0 comments on commit c8eb1ef

Please sign in to comment.