A
A
akimovpro2012-02-14 11:44:18
Objective-C
akimovpro, 2012-02-14 11:44:18

Modifying the program Telephone (Objective-c)?

There is such an application: github.com/eofster/Telephone
It is necessary to show a message like “Calling: -phone number-” on an
incoming call Here is the code that is supposedly executed on an incoming call.
In place of the comment, you need code that shows this message.
How to do it?
The Objective-C language has never dealt with it and the head is already swelling.

pjsua_call_info callInfo;
  pj_status_t status = pjsua_call_get_info(anIdentifier, &callInfo);
  if (status == PJ_SUCCESS) {
    [self setState:callInfo.state];
    [self setStateText:[NSString stringWithPJString:callInfo.state_text]];
    [self setLastStatus:callInfo.last_status];
    [self setLastStatusText:
     [NSString stringWithPJString:callInfo.last_status_text]];
    [self setRemoteURI:[AKSIPURI SIPURIWithString:
                        [NSString stringWithPJString:callInfo.remote_info]]];
    [self setLocalURI:[AKSIPURI SIPURIWithString:
                       [NSString stringWithPJString:callInfo.local_info]]];
    NSString *string1 = @"Звонит: ";

    //Здесь нужно показать сообщение вида "звонит: номер" 
    
    if (callInfo.state == kAKSIPCallIncomingState) {
      [self setIncoming:YES];
    } else {
      [self setIncoming:NO];
    }

Answer the question

In order to leave comments, you need to log in

2 answer(s)
J
Jumbo, 2012-02-14
@Jumbo

UIAlertView *alert = [[UIAlertView alloc] init];
[alert setTitle: @"Error"];
[alert setMessage: @"Network is unavailable"];
[alert setDelegate: nil];
[alert addButtonWithTitle:@"OK"];
[alert show];
[alert release];

A
An, 2012-02-14
@Flanker_4

If you want a message box, then

 UIAlertView *av = [[[UIAlertView alloc] initWithTitle:@"Заголовок сообщения"
                                                     message:@"Текст сообщения с номером, в данном случае переменная string1"
                                                    delegate:nil
                                           cancelButtonTitle:@"Ok"
                                           otherButtonTitles: nil] autorelease];

        [av show];

If ARC is enabled, then remove autorelease and the brackets ([]) that match it.
Clarification: You asked "How to display a message" or "How to get a phone number and display it in a message."
The answer is above for the first option.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question