Add call adapter ip feature

This commit is contained in:
Pierre-Eric Pelloux-Prayer 2012-02-01 12:17:37 +01:00
parent 7fb4602222
commit c2aaf37a9f
3 changed files with 31 additions and 6 deletions

View file

@ -18,6 +18,7 @@
*/
#import "BuschJaegerMainView.h"
#include "linphonecore.h"
@implementation BuschJaegerMainView
@ -77,7 +78,6 @@
[LinphoneManager set:mute hidden:NO withName:"MUTE_BTN" andReason:__FUNCTION__];
// [LinphoneManager set:imageView hidden:NO withName:"IMAGE_VIEW" andReason:__FUNCTION__];
[startCall setEnabled:NO];
[[UIApplication sharedApplication] setIdleTimerDisabled:NO];
}
@ -93,7 +93,7 @@
if (notif)
{
notif.repeatInterval = 0;
notif.alertBody = NSLocalizedString(@" Ding Dong ! Guess who's at the door ?",nil);
notif.alertBody = NSLocalizedString(@" Ding Dong !",nil);
notif.alertAction = @"See the answer";
notif.soundName = @"oldphone-mono-30s.caf";
NSData *callData = [NSData dataWithBytes:&call length:sizeof(call)];
@ -110,8 +110,6 @@
[LinphoneManager set:mute hidden:YES withName:"MUTE_BTN" andReason:__FUNCTION__];
linphone_call_enable_camera(call, FALSE);
[startCall setEnabled:YES];
}
- (void) displayVideoCall:(LinphoneCall *)call FromUI:(UIViewController *)viewCtrl forUser:(NSString *)username withDisplayName:(NSString *)displayName {
@ -153,10 +151,24 @@
LinphoneCall* c = (LinphoneCall*) calls->data;
if (linphone_call_get_state(c) == LinphoneCallIncoming || linphone_call_get_state(c) == LinphoneCallIncomingEarlyMedia) {
linphone_core_accept_call([LinphoneManager getLc], c);
return;
}
calls = calls->next;
}
// no pending call, call adapter
NSString* s = [NSString stringWithFormat:@"sip:100000001@%@", [[NSUserDefaults standardUserDefaults] stringForKey:@"adapter_ip_preference"]];
const char* adapter = [s cStringUsingEncoding:[NSString defaultCStringEncoding]];
ms_message("Calling ADAPTER '%s'", adapter);
LinphoneCallParams* lcallParams = linphone_core_create_default_call_parameters([LinphoneManager getLc]);
linphone_call_params_enable_video(lcallParams, true);
LinphoneCall* lc = linphone_core_invite_with_params([LinphoneManager getLc], adapter,lcallParams);
if (!lc) {
ms_error("Failed to start a new call");
return;
}
linphone_call_enable_camera(lc, false);
linphone_call_params_destroy(lcallParams);
}
@end

View file

@ -86,7 +86,6 @@
</object>
<bool key="IBUIOpaque">NO</bool>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
<bool key="IBUIEnabled">NO</bool>
<int key="IBUIContentHorizontalAlignment">0</int>
<int key="IBUIContentVerticalAlignment">0</int>
<object class="NSColor" key="IBUIHighlightedTitleColor" id="684165454">
@ -1003,7 +1002,7 @@
<string key="icon2.png">{155, 96}</string>
<string key="icon3.png">{155, 96}</string>
<string key="icon4.png">{155, 96}</string>
<string key="icon5.png">{16, 16}</string>
<string key="icon5.png">{153, 96}</string>
<string key="icon6.png">{153, 96}</string>
<string key="icon7.png">{153, 96}</string>
</dictionary>

View file

@ -84,6 +84,20 @@
<key>Type</key>
<string>PSTextFieldSpecifier</string>
</dict>
<dict>
<key>Type</key>
<string>PSTextFieldSpecifier</string>
<key>Title</key>
<string>Adapter IP</string>
<key>Key</key>
<string>adapter_ip_preference</string>
<key>DefaultValue</key>
<string></string>
<key>IsSecure</key>
<false/>
<key>KeyboardType</key>
<string>NumbersAndPunctuation</string>
</dict>
</array>
<key>StringsTable</key>
<string>Root</string>