Permalink
Browse files

Added call waiting option.

Call waiting can be enabled or disabled in preferences. Previously it was always turned on.

Fixes issue 396.
  • Loading branch information...
1 parent 73a5805 commit a2feb1b3176db9bdadd0241437c3baa206d97455 @eofster eofster committed Jan 3, 2011
View
@@ -194,6 +194,9 @@ extern NSString * const AKSIPCallTransferStatusDidChangeNotification;
// Replies with 480 Temporarily Unavailable.
- (void)replyWithTemporarilyUnavailable;
+// Replies with 486 Busy Here.
+- (void)replyWithBusyHere;
+
// Starts local ringback sound.
- (void)ringbackStart;
View
@@ -301,6 +301,14 @@ - (void)replyWithTemporarilyUnavailable {
NSLog(@"Error replying with 480 Temporarily Unavailable");
}
+- (void)replyWithBusyHere {
+ pj_status_t status = pjsua_call_answer([self identifier], PJSIP_SC_BUSY_HERE,
+ NULL, NULL);
+ if (status != PJ_SUCCESS) {
+ NSLog(@"Error replying with 486 Busy Here");
+ }
+}
+
- (void)ringbackStart {
AKSIPUserAgent *userAgent = [AKSIPUserAgent sharedUserAgent];
View
@@ -852,11 +852,22 @@ - (void)callWindowWillClose:(NSNotification *)notification {
#pragma mark AKSIPAccountDelegate protocol
- (void)SIPAccountDidReceiveCall:(AKSIPCall *)aCall {
- // Just reply with 480 Temporarily Unavailable if the user selected
- // Unavailable account state.
if ([self isAccountUnavailable]) {
+ // Reply with 480 Temporarily Unavailable if the user selected Unavailable
+ // account state.
[aCall replyWithTemporarilyUnavailable];
+
return;
+
+ } else if (![[NSUserDefaults standardUserDefaults] boolForKey:kCallWaiting]) {
+ // Reply with 486 Busy Here if needed.
+ for (CallController *callController in [self callControllers]) {
+ if ([callController isCallActive]) {
+ [aCall replyWithBusyHere];
+
+ return;
+ }
+ }
}
[[NSApp delegate] pauseITunes];
View
@@ -281,6 +281,7 @@ + (void)initialize {
forKey:kAutoCloseCallWindow];
[defaultsDict setObject:[NSNumber numberWithBool:NO]
forKey:kAutoCloseMissedCallWindow];
+ [defaultsDict setObject:[NSNumber numberWithBool:YES] forKey:kCallWaiting];
NSString *preferredLocalization
= [[[NSBundle mainBundle] preferredLocalizations] objectAtIndex:0];
@@ -2,15 +2,17 @@
<archive type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="8.00">
<data>
<int key="IBDocument.SystemTarget">1060</int>
- <string key="IBDocument.SystemVersion">10B504</string>
- <string key="IBDocument.InterfaceBuilderVersion">732</string>
- <string key="IBDocument.AppKitVersion">1038.2</string>
- <string key="IBDocument.HIToolboxVersion">437.00</string>
+ <string key="IBDocument.SystemVersion">10H574</string>
+ <string key="IBDocument.InterfaceBuilderVersion">823</string>
+ <string key="IBDocument.AppKitVersion">1038.35</string>
+ <string key="IBDocument.HIToolboxVersion">461.00</string>
<object class="NSMutableDictionary" key="IBDocument.PluginVersions">
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string key="NS.object.0">732</string>
+ <string key="NS.object.0">823</string>
</object>
- <array class="NSMutableArray" key="IBDocument.EditedObjectIDs"/>
+ <array class="NSMutableArray" key="IBDocument.EditedObjectIDs">
+ <integer value="150"/>
+ </array>
<array key="IBDocument.PluginDependencies">
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
</array>
@@ -26,31 +28,34 @@
<string key="NSClassName">NSApplication</string>
</object>
<object class="NSUserDefaultsController" id="456522789">
+ <array class="NSMutableArray" key="NSDeclaredKeys">
+ <string>CallWaiting</string>
+ </array>
<bool key="NSSharedInstance">YES</bool>
</object>
<object class="NSCustomView" id="544735637">
- <nil key="NSNextResponder"/>
+ <reference key="NSNextResponder"/>
<int key="NSvFlags">268</int>
<array class="NSMutableArray" key="NSSubviews">
- <object class="NSButton" id="623880427">
+ <object class="NSButton" id="564615667">
<reference key="NSNextResponder" ref="544735637"/>
<int key="NSvFlags">268</int>
- <string key="NSFrame">{{83, 78}, {258, 18}}</string>
+ <string key="NSFrame">{{83, 18}, {96, 18}}</string>
<reference key="NSSuperview" ref="544735637"/>
<bool key="NSEnabled">YES</bool>
- <object class="NSButtonCell" key="NSCell" id="575335877">
+ <object class="NSButtonCell" key="NSCell" id="454468671">
<int key="NSCellFlags">-2080244224</int>
<int key="NSCellFlags2">0</int>
- <string key="NSContents">Automatically format phone numbers</string>
+ <string key="NSContents">Call waiting</string>
<object class="NSFont" key="NSSupport" id="632429488">
<string key="NSName">LucidaGrande</string>
<double key="NSSize">13</double>
<int key="NSfFlags">1044</int>
</object>
- <reference key="NSControlView" ref="623880427"/>
+ <reference key="NSControlView" ref="564615667"/>
<int key="NSButtonFlags">1211912703</int>
<int key="NSButtonFlags2">2</int>
- <object class="NSCustomResource" key="NSNormalImage" id="878572023">
+ <object class="NSCustomResource" key="NSNormalImage" id="828364283">
<string key="NSClassName">NSImage</string>
<string key="NSResourceName">NSSwitch</string>
</object>
@@ -63,10 +68,32 @@
<int key="NSPeriodicInterval">25</int>
</object>
</object>
+ <object class="NSButton" id="623880427">
+ <reference key="NSNextResponder" ref="544735637"/>
+ <int key="NSvFlags">268</int>
+ <string key="NSFrame">{{83, 98}, {258, 18}}</string>
+ <reference key="NSSuperview" ref="544735637"/>
+ <bool key="NSEnabled">YES</bool>
+ <object class="NSButtonCell" key="NSCell" id="575335877">
+ <int key="NSCellFlags">-2080244224</int>
+ <int key="NSCellFlags2">0</int>
+ <string key="NSContents">Automatically format phone numbers</string>
+ <reference key="NSSupport" ref="632429488"/>
+ <reference key="NSControlView" ref="623880427"/>
+ <int key="NSButtonFlags">1211912703</int>
+ <int key="NSButtonFlags2">2</int>
+ <reference key="NSNormalImage" ref="828364283"/>
+ <reference key="NSAlternateImage" ref="90334372"/>
+ <string key="NSAlternateContents"/>
+ <string key="NSKeyEquivalent"/>
+ <int key="NSPeriodicDelay">200</int>
+ <int key="NSPeriodicInterval">25</int>
+ </object>
+ </object>
<object class="NSButton" id="374192320">
<reference key="NSNextResponder" ref="544735637"/>
<int key="NSvFlags">268</int>
- <string key="NSFrame">{{103, 58}, {197, 18}}</string>
+ <string key="NSFrame">{{103, 78}, {197, 18}}</string>
<reference key="NSSuperview" ref="544735637"/>
<bool key="NSEnabled">YES</bool>
<object class="NSButtonCell" key="NSCell" id="588255250">
@@ -77,7 +104,7 @@
<reference key="NSControlView" ref="374192320"/>
<int key="NSButtonFlags">1211912703</int>
<int key="NSButtonFlags2">2</int>
- <reference key="NSNormalImage" ref="878572023"/>
+ <reference key="NSNormalImage" ref="828364283"/>
<reference key="NSAlternateImage" ref="90334372"/>
<string key="NSAlternateContents"/>
<string key="NSKeyEquivalent"/>
@@ -88,7 +115,7 @@
<object class="NSButton" id="195739532">
<reference key="NSNextResponder" ref="544735637"/>
<int key="NSvFlags">268</int>
- <string key="NSFrame">{{83, 38}, {176, 18}}</string>
+ <string key="NSFrame">{{83, 58}, {176, 18}}</string>
<reference key="NSSuperview" ref="544735637"/>
<bool key="NSEnabled">YES</bool>
<object class="NSButtonCell" key="NSCell" id="730421258">
@@ -99,7 +126,7 @@
<reference key="NSControlView" ref="195739532"/>
<int key="NSButtonFlags">1211912703</int>
<int key="NSButtonFlags2">2</int>
- <reference key="NSNormalImage" ref="878572023"/>
+ <reference key="NSNormalImage" ref="828364283"/>
<reference key="NSAlternateImage" ref="90334372"/>
<string key="NSAlternateContents"/>
<string key="NSKeyEquivalent"/>
@@ -110,7 +137,7 @@
<object class="NSButton" id="340144577">
<reference key="NSNextResponder" ref="544735637"/>
<int key="NSvFlags">268</int>
- <string key="NSFrame">{{83, 18}, {229, 18}}</string>
+ <string key="NSFrame">{{83, 38}, {229, 18}}</string>
<reference key="NSSuperview" ref="544735637"/>
<bool key="NSEnabled">YES</bool>
<object class="NSButtonCell" key="NSCell" id="492749651">
@@ -121,7 +148,7 @@
<reference key="NSControlView" ref="340144577"/>
<int key="NSButtonFlags">1211912703</int>
<int key="NSButtonFlags2">2</int>
- <reference key="NSNormalImage" ref="878572023"/>
+ <reference key="NSNormalImage" ref="828364283"/>
<reference key="NSAlternateImage" ref="90334372"/>
<string key="NSAlternateContents"/>
<string key="NSKeyEquivalent"/>
@@ -130,7 +157,8 @@
</object>
</object>
</array>
- <string key="NSFrameSize">{508, 108}</string>
+ <string key="NSFrameSize">{508, 128}</string>
+ <reference key="NSSuperview"/>
<string key="NSClassName">NSView</string>
</object>
</array>
@@ -224,6 +252,22 @@
</object>
<int key="connectionID">528</int>
</object>
+ <object class="IBConnectionRecord">
+ <object class="IBBindingConnection" key="connection">
+ <string key="label">value: values.CallWaiting</string>
+ <reference key="source" ref="564615667"/>
+ <reference key="destination" ref="456522789"/>
+ <object class="NSNibBindingConnector" key="connector">
+ <reference key="NSSource" ref="564615667"/>
+ <reference key="NSDestination" ref="456522789"/>
+ <string key="NSLabel">value: values.CallWaiting</string>
+ <string key="NSBinding">value</string>
+ <string key="NSKeyPath">values.CallWaiting</string>
+ <int key="NSNibBindingConnectorVersion">2</int>
+ </object>
+ </object>
+ <int key="connectionID">532</int>
+ </object>
</array>
<object class="IBMutableOrderedSet" key="objectRecords">
<array key="orderedObjects">
@@ -264,6 +308,7 @@
<reference ref="195739532"/>
<reference ref="374192320"/>
<reference ref="623880427"/>
+ <reference ref="564615667"/>
</array>
<reference key="parent" ref="0"/>
<string key="objectName">General</string>
@@ -320,11 +365,24 @@
<reference key="object" ref="492749651"/>
<reference key="parent" ref="340144577"/>
</object>
+ <object class="IBObjectRecord">
+ <int key="objectID">529</int>
+ <reference key="object" ref="564615667"/>
+ <array class="NSMutableArray" key="children">
+ <reference ref="454468671"/>
+ </array>
+ <reference key="parent" ref="544735637"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">530</int>
+ <reference key="object" ref="454468671"/>
+ <reference key="parent" ref="564615667"/>
+ </object>
</array>
</object>
<dictionary class="NSMutableDictionary" key="flattenedProperties">
<string key="-3.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string key="150.IBEditorWindowLastContentRect">{{287, 404}, {508, 108}}</string>
+ <string key="150.IBEditorWindowLastContentRect">{{263, 414}, {508, 128}}</string>
<string key="150.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<array class="NSMutableArray" key="150.IBUserGuides"/>
<string key="201.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
@@ -336,12 +394,17 @@
<string key="521.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="524.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="525.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <string key="529.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <object class="NSAffineTransform" key="529.IBViewBoundsToFrameTransform">
+ <bytes key="NSTransformStruct">P4AAAL+AAABCpgAAwggAAA</bytes>
+ </object>
+ <string key="530.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
</dictionary>
<dictionary class="NSMutableDictionary" key="unlocalizedProperties"/>
<nil key="activeLocalization"/>
<dictionary class="NSMutableDictionary" key="localizations"/>
<nil key="sourceID"/>
- <int key="maxID">528</int>
+ <int key="maxID">532</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes">
<array class="NSMutableArray" key="referencedPartialClassDescriptions">
@@ -721,20 +784,6 @@
</object>
</object>
<object class="IBPartialClassDescription">
- <string key="className">NSObject</string>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBFrameworkSource</string>
- <string key="minorKey">Sparkle.framework/Headers/SUAppcast.h</string>
- </object>
- </object>
- <object class="IBPartialClassDescription">
- <string key="className">NSObject</string>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBFrameworkSource</string>
- <string key="minorKey">Sparkle.framework/Headers/SUUpdater.h</string>
- </object>
- </object>
- <object class="IBPartialClassDescription">
<string key="className">NSResponder</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
@@ -790,6 +839,13 @@
<string key="NS.key.0">view</string>
<string key="NS.object.0">NSView</string>
</object>
+ <object class="NSMutableDictionary" key="toOneOutletInfosByName">
+ <string key="NS.key.0">view</string>
+ <object class="IBToOneOutletInfo" key="NS.object.0">
+ <string key="name">view</string>
+ <string key="candidateClassName">NSView</string>
+ </object>
+ </object>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">AppKit.framework/Headers/NSViewController.h</string>
@@ -798,12 +854,17 @@
</array>
</object>
<int key="IBDocument.localizationMode">0</int>
+ <string key="IBDocument.TargetRuntimeIdentifier">IBCocoaFramework</string>
<object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDependencyDefaults">
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin.macosx</string>
<integer value="1060" key="NS.object.0"/>
</object>
<bool key="IBDocument.PluginDeclaredDependenciesTrackSystemTargetVersion">YES</bool>
- <string key="IBDocument.LastKnownRelativeProjectPath">Telephone.xcodeproj</string>
+ <string key="IBDocument.LastKnownRelativeProjectPath">../Telephone.xcodeproj</string>
<int key="IBDocument.defaultPropertyAccessControl">3</int>
+ <object class="NSMutableDictionary" key="IBDocument.LastKnownImageSizes">
+ <string key="NS.key.0">NSSwitch</string>
+ <string key="NS.object.0">{15, 15}</string>
+ </object>
</data>
</archive>
Oops, something went wrong.

0 comments on commit a2feb1b

Please sign in to comment.