1

I am using CTTelephonyCenterAddObserver(ct, NULL, callback, NULL, NULL, CFNotificationSuspensionBehaviorHold); to log the phone calls.

Here is the code of call back method

static void callback(CFNotificationCenterRef center, void *observer, CFStringRef name, const void *object, CFDictionaryRef userInfo)
{

    NSString *notifyname=(NSString *)name;
    if ([notifyname isEqualToString:@"kCTCallStatusChangeNotification"])
    {

        NSDictionary *info = (NSDictionary*)userInfo;

        NSString *state=[[info objectForKey:@"kCTCallStatus"] stringValue];
        NSLog(@"Call status changed = %@",state);

        if ([state isEqualToString:@"5"]){//disconnect
            NSLog(@"unanswered:%@",state);

        }
        if ([state isEqualToString:@"3"]){//OUTGOING
            NSLog(@"Outgoing calls:%@",state);

        }


        if ([state isEqualToString:@"1"]){//connected

            //Call Connected
        }


        callState=[state intValue];


    }
}

I am receiving all call events/states without any issue in callback method. But there is problem with disconnected state (5). The problem is when already connected call is disconnected and the duration of call is more than 5/6 sec then disconnected (5) state is not received in callback method.

Has anyone else faced the same issue and found the solution of this issue?

Mayur Prajapati
  • 5,454
  • 7
  • 41
  • 70
  • have you tried changing the last parameter of the `CTTelephonyCenterAddObserver()` call to `CFNotificationSuspensionBehaviorDeliverImmediately`? – Nate Apr 19 '13 at 22:59
  • Same behaviour with CFNotificationSuspensionBehaviorDeliverImmediately – Adnan Khurshid May 06 '13 at 08:48

0 Answers0