Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

SIP call on iOS devices can be made both from a browser, and using the iOS SDKOverview.

Operation flowchart

1: SIP server as a proxy server to transfer calls and RTP media

...

1. For the test we use:

  • two SIP accounts;
  • the Phone application to make a call;
  • a software phone to answer the call.

2. Install the Phone app to the iOS device. Start the app, enter the URL of the WCS server to connect to it via Secure Websocket and the data of the SIP account making a call:

Image Added

3. Run the softphone, enter the data of the SIP account that receives the call:

...

4. Tap the Connect button in the app, a connection will be established to the server. Then enter the identifier of the SIP account that receives the call and click the Call button:

Image RemovedImage Added

5. Answer the call in the softphone by clicking the answer button:

...

6. To terminate the call, tap the Hangup button in the application, or click the end call button in the softphone.

Receving an outgoing call from a SIP device to

...

iOS

1. For the test we use:

  • two SIP accounts;
  • a softphone to make a call;
  • the Phone application to answer the call.

2. Install the Phone app the Phone app to the Android iOS device. Start the app, enter the URL of the WCS server to connect via Secure Websocket and the data of the SIP account that receives the call:

Image RemovedImage Added

3. Run the software phone and enter the data of the SIP account making the call:

...

5. Answer the call in the application by tapping Answer:

Image RemovedImage Added

Image Removed

6. In the softphone make sure the call has started:

...

Below is the call flow when using the Phone-min example to create a call

PhoneMinActivity.javaView class for the main view of the application: ViewController (header file ViewController.h; implementation file ViewController.m)


1. Creating a call:

session.FPWCSApi2Session createCall(), call.call() code, FPWCSApi2Call call code

The next parameters are passed to createCall() method:

  • callee SIP username
  • additional SIP INVITE parameters from string set by user
Code Block
languagejavacpp
themeRDark
- (FPWCSApi2Call *)call {
                 CallOptions callOptions = new CallOptions(mCalleeView.getText().toString())FPWCSApi2Session *session = [FPWCSApi2 getSessions][0];
    FPWCSApi2CallOptions *options = [[FPWCSApi2CallOptions alloc] init];
    NSString       AudioConstraints audioConstraints = callOptions.getConstraints().getAudioConstraints()*parameters = _inviteParameters.input.text;
    if (parameters && [parameters length] > 0) {
        NSError* MediaConstraints mediaConstraintserr = audioConstraints.getMediaConstraints()nil;
        parameters = [parameters stringByReplacingOccurrencesOfString:@""" withString:@"\""];
        ...
       NSMutableDictionary *dictionary = [NSJSONSerialization JSONObjectWithData:[parameters dataUsingEncoding:NSUTF8StringEncoding] options:0 error:&err];
        if (err) {
   call = session.createCall(callOptions);
       NSLog(@"Error converting JSON Invite parameters to dictionary %@, JSON %@",    call.on(callStatusEventerr, parameters);
        } else {
          /**
  options.inviteParameters = dictionary;
        }
    }
    options.callee * Make the outgoing call= _callee.input.text;
    //used for only recv audio
//    options.localConstraints = [[FPWCSApi2MediaConstraints alloc]      */
initWithAudio:NO video:NO];
//    options.remoteConstraints = [[FPWCSApi2MediaConstraints alloc] initWithAudio:YES video:NO];
           call.call()NSError *error;
    call = [session createCall:options error:&error];
    ...
    [call call];
   Log.i(TAG, "Permission has been granted by user"); return call;
}

2. Establishing a connection with the SIP server

...

7. The caller and the callee exchange audio and video streams

8. Terminating the call

call.hangup() FPWCSApi2Call hangup code

Code Block
languagejavacpp
themeRDark
- (void)callButton:(UIButton *)button {
    [self changeViewState:button enabled:NO];
       if (mCallButton.getTag() == null || Integer.valueOf(R.string.action_call).equals(mCallButton.getTag())) {
           [button.titleLabel.text isEqualToString:@"HANGUP"]) {
         if ("".equals(mCalleeView.getText().toString()))[FPWCSApi2 getSessions].count) {
                        return;
                    }
                    ...
      [call hangup];
          } else {
                    mCallButton.setEnabled(false)[self toCallState];
        }
            call.hangup();...
                    call = null;
                }
}

9. Sending the command to the SIP server

10. Sending the command to the SIP device

...