Working Castel Commands

This commit is contained in:
Yann Diorcet 2012-07-26 13:36:34 +02:00
parent b160ec47cb
commit ecf36ea72e
3 changed files with 51 additions and 6 deletions

View file

@ -351,7 +351,7 @@ static void linphone_iphone_registration_state(LinphoneCore *lc, LinphoneProxyCo
castelCommands = nil;
}
if(commands != nil && [commands count]) {
OrderedDictionary *tempDict = [OrderedDictionary dictionaryWithCapacity:[commands count]];
OrderedDictionary *tempDict = [[OrderedDictionary alloc ] initWithCapacity:[commands count]];
castelCommands = tempDict;
for(GDataXMLElement *element in commands) {
GDataXMLNode *code = [element attributeForName:@"Code"];

View file

@ -423,7 +423,7 @@
}
}
- (void)hideOptions{
- (void)hideOptions {
[optionsButton setOff];
if(![optionsView isHidden]) {
CGRect frame = [optionsView frame];
@ -451,6 +451,12 @@
}
}
- (void)sendCastelCommand:(NSString *)command {
static const NSString *CASTEL_COMMAND_PREFIX = @"MediaCommand";
if(command && [command hasPrefix:@"MediaCommand"] && [command length] > [CASTEL_COMMAND_PREFIX length]) {
linphone_core_send_dtmf([LinphoneManager getLc], [command characterAtIndex:[CASTEL_COMMAND_PREFIX length]]);
}
}
#pragma mark - Action Functions
@ -493,15 +499,27 @@
}
- (IBAction)onOption1Click:(id)sender {
NSDictionary *dict = [[LinphoneManager instance] castelCommands];
if(dict) {
NSString *command = [dict objectForKey:[option1Button titleForState:UIControlStateNormal]];
[self sendCastelCommand:command];
}
}
- (IBAction)onOption2Click:(id)sender {
NSDictionary *dict = [[LinphoneManager instance] castelCommands];
if(dict) {
NSString *command = [dict objectForKey:[option2Button titleForState:UIControlStateNormal]];
[self sendCastelCommand:command];
}
}
- (IBAction)onOption3Click:(id)sender {
NSDictionary *dict = [[LinphoneManager instance] castelCommands];
if(dict) {
NSString *command = [dict objectForKey:[option3Button titleForState:UIControlStateNormal]];
[self sendCastelCommand:command];
}
}
- (IBAction)onConferenceClick:(id)sender {

View file

@ -1758,6 +1758,33 @@
</object>
<int key="connectionID">136</int>
</object>
<object class="IBConnectionRecord">
<object class="IBCocoaTouchEventConnection" key="connection">
<string key="label">onOption1Click:</string>
<reference key="source" ref="785108977"/>
<reference key="destination" ref="372490531"/>
<int key="IBEventType">7</int>
</object>
<int key="connectionID">154</int>
</object>
<object class="IBConnectionRecord">
<object class="IBCocoaTouchEventConnection" key="connection">
<string key="label">onOption2Click:</string>
<reference key="source" ref="447196686"/>
<reference key="destination" ref="372490531"/>
<int key="IBEventType">7</int>
</object>
<int key="connectionID">155</int>
</object>
<object class="IBConnectionRecord">
<object class="IBCocoaTouchEventConnection" key="connection">
<string key="label">onOption3Click:</string>
<reference key="source" ref="788831181"/>
<reference key="destination" ref="372490531"/>
<int key="IBEventType">7</int>
</object>
<int key="connectionID">156</int>
</object>
</array>
<object class="IBMutableOrderedSet" key="objectRecords">
<array key="orderedObjects">
@ -2355,7 +2382,7 @@
<nil key="activeLocalization"/>
<dictionary class="NSMutableDictionary" key="localizations"/>
<nil key="sourceID"/>
<int key="maxID">153</int>
<int key="maxID">156</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes">
<array class="NSMutableArray" key="referencedPartialClassDescriptions">