Skip to content

Commit c8eb1ef

Browse files
Added support to set CallerID in Advanced Options to be able to set a 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
1 parent 9f70934 commit c8eb1ef

File tree

7 files changed

+27
-14
lines changed

7 files changed

+27
-14
lines changed

.classpath

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
<?xml version="1.0" encoding="UTF-8"?>
2-
<classpath>
3-
<classpathentry kind="src" path="src"/>
4-
<classpathentry kind="src" path="gen"/>
5-
<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
6-
<classpathentry kind="output" path="bin"/>
7-
</classpath>
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<classpath>
3+
<classpathentry kind="src" path="src"/>
4+
<classpathentry kind="src" path="gen"/>
5+
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
6+
<classpathentry kind="output" path="bin"/>
7+
</classpath>

res/layout/sipdroid.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ android:background="#736f6e"
77
xmlns:android="http://schemas.android.com/apk/res/android"
88
>
99

10-
<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>
10+
<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>
1111
<org.sipdroid.sipua.ui.InstantAutoCompleteTextView
1212
android:id="@+id/txt_callee"
1313
android:layout_width="302px"
@@ -18,7 +18,7 @@ android:singleLine="true"
1818
android:layout_y="40px"
1919
android:hint="@string/hint"
2020
android:inputType="textEmailAddress"
21-
android:imeOptions="actionSend|flagNoExtractUi"/>
21+
android:imeOptions="actionSend|flagNoExtractUi"></org.sipdroid.sipua.ui.InstantAutoCompleteTextView>
2222
<AbsoluteLayout
2323
android:id="@+id/top_box_layout"
2424
android:layout_width="fill_parent"

res/values/strings.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,4 +160,5 @@
160160

161161
<string name="ongoing">Current Call</string>
162162
<string name="onHold">On hold</string>
163+
<string name="callerid">Caller ID</string>
163164
</resources>

res/xml/preferences.xml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,7 @@
3030
android:title="@string/settings_protocol"
3131
android:entries="@array/protocol_display_values"
3232
android:entryValues="@array/protocol_values"
33-
android:dialogTitle="@string/settings_protocol" />
34-
</PreferenceCategory>
33+
android:dialogTitle="@string/settings_protocol" /></PreferenceCategory>
3534
</PreferenceScreen>
3635
<PreferenceScreen android:title="@string/settings_options">
3736
<PreferenceCategory android:title="@string/settings_options">
@@ -91,7 +90,7 @@
9190
android:entryValues="@array/eargain_values"
9291
android:defaultValue="0.25"
9392
android:dialogTitle="@string/settings_eargain" />
94-
</PreferenceCategory>
93+
<EditTextPreference android:singleLine="true" android:title="@string/callerid" android:key="callerid"></EditTextPreference></PreferenceCategory>
9594
</PreferenceScreen>
9695
<PreferenceScreen android:title="@string/settings_pbxes_options">
9796
<PreferenceCategory android:title="@string/settings_pbxes_options">

src/org/sipdroid/sipua/SipdroidEngine.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,15 +71,23 @@ public boolean StartEngine() {
7171

7272
user_profile = new UserAgentProfile(null);
7373
user_profile.username = PreferenceManager.getDefaultSharedPreferences(getUIContext()).getString("username",""); // modified
74+
user_profile.callerid = PreferenceManager.getDefaultSharedPreferences(getUIContext()).getString("callerid", "");
7475
user_profile.passwd = PreferenceManager.getDefaultSharedPreferences(getUIContext()).getString("password","");
7576
if (PreferenceManager.getDefaultSharedPreferences(getUIContext()).getString("domain","").length() == 0) {
7677
user_profile.realm = PreferenceManager.getDefaultSharedPreferences(getUIContext()).getString("server","");
7778
} else {
7879
user_profile.realm = PreferenceManager.getDefaultSharedPreferences(getUIContext()).getString("domain","");
7980
}
81+
if (user_profile.callerid == "") {
8082
user_profile.from_url = user_profile.username
8183
+ "@"
82-
+ user_profile.realm;
84+
+ user_profile.realm;
85+
}
86+
else {
87+
user_profile.from_url = user_profile.callerid
88+
+ "@"
89+
+ user_profile.realm;
90+
}
8391
user_profile.contact_url = user_profile.username
8492
+ "@"
8593
+ opt_via_addr;

src/org/sipdroid/sipua/UserAgentProfile.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,9 @@ public class UserAgentProfile extends Configure {
5454
public String realm = null;
5555
/** User's passwd. */
5656
public String passwd = null;
57+
58+
/** User's callerid. */
59+
public String callerid = null;
5760
/**
5861
* Path for the 'ua.jar' lib, used to retrive various UA media (gif, wav,
5962
* etc.) By default, it is used the "lib/ua.jar" folder

src/org/sipdroid/sipua/ui/Settings.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,8 @@ public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, Strin
110110
key.equals("protocol") ||
111111
key.equals("minedge") ||
112112
key.equals("pos") ||
113-
key.equals("posurl")) {
113+
key.equals("posurl") ||
114+
key.equals("callerid")) {
114115
if (key.equals("wlan") || key.equals("3g"))
115116
updateSleep();
116117
Receiver.engine(this).halt();
@@ -140,6 +141,7 @@ void updateSleep() {
140141
}
141142

142143
public void updateSummaries() {
144+
getPreferenceScreen().findPreference("callerid").setSummary(getPreferenceScreen().getSharedPreferences().getString("callerid",""));
143145
getPreferenceScreen().findPreference("username").setSummary(getPreferenceScreen().getSharedPreferences().getString("username", ""));
144146
getPreferenceScreen().findPreference("server").setSummary(getPreferenceScreen().getSharedPreferences().getString("server", ""));
145147
if (getPreferenceScreen().getSharedPreferences().getString("domain","").length() == 0) {

0 commit comments

Comments
 (0)