OMICALL SDK FOR Flutter

The OmiKit exposes the omicall_flutter_plugin library.

The most important part of the framework is :

  • Help to easy integrate with Omicall.
  • Easy custom Call UI/UX.
  • Optimize codec voip for you.
  • Full inteface to interactive with core function like sound/ringtone/codec.

Status

Currently active maintained

Running

Install via pubspec.yaml:

omicall_flutter_plugin: ^1.0.9

Configuration

Android:

  • Add this setting in build.gradle:
jcenter() // Warning: this repository is going to shut down soon
maven {
    url("https://vihat.jfrog.io/artifactory/vihat-local-repo")
    credentials {
        username = "anonymous"
    }
}
classpath 'com.google.gms:google-services:4.3.13' //in dependencies
  • Add this setting In app/build.gradle:
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'com.google.gms.google-services'

Push Notification:

iOS:

  • Set up environment and library:
#import <omicall_flutter_plugin/omicall_flutter_plugin-Swift.h>

[self registerOmicallWithEnviroment:KEY_OMI_APP_ENVIROMENT_SANDBOX supportVideoCall:supportForVideo];
We have 2 environment variables:
- KEY_OMI_APP_ENVIROMENT_SANDBOX //Support for testing
- KEY_OMI_APP_ENVIROMENT_PRODUCTION //Supprt for production
//supportForVideo is TRUE, if you need to support video call or else.
  • Save token for OmiClient:
- (void)application:(UIApplication*)app didRegisterForRemoteNotificationsWithDeviceToken:(NSData*)devToken
{
    // parse token bytes to string
    const char *data = [devToken bytes];
    NSMutableString *token = [NSMutableString string];
    for (NSUInteger i = 0; i < [devToken length]; i++)
    {
        [token appendFormat:@"%02.2hhX", data[i]];
    }
    
    // print the token in the console.
    NSLog(@"Push Notification Token: %@", [token copy]);
    [OmiClient setUserPushNotificationToken:[token copy]];
}

Push Notification: Omicall need 2 certificate: VOIP Push Certificate & User Push Notification Certificate

Implement

  • Set up for Firebase:
await Firebase.initializeApp();
//if you use only on Android. Add this line `if (Platform.isAndroid)`
//because we use APNS to push notification on iOS so you don't need add Firebase for iOS.
  • Init OmiChannel:
final omiChannel = OmiChannel();
//You need init OmiChannel with a global variable
  • Call actions: We definded OmiAction to call functions. For more information, you can search omicall.dart, all actions are in there.
final action = OmiAction.initCall(
  userName.text,
  password.text,
  'thaonguyennguyen1197',
);
omiChannel.action(action: action);
  • Action list:

    • OmiAction.initCall : register and init OmiCall
    • OmiAction.updateToken : update token for Android
    • OmiAction.startCall : start Call
    • OmiAction.endCall : end Call
    • OmiAction.toggleMute : toggle the microphone status
    • OmiAction.toggleSpeaker : toggle the voice status
    • OmiAction.sendDTMF : send DTMF for call server
  • You can init action with another way.

final action = ActionModel(
    actionName: ActionName.SEND_DTMF,
    data: {"character": value},
);
omiChannel.action(action: action);
  • Event listener:
omiChannel.listerEvent((action) {
  
});
  • Event List: We support 5 events
    • OmiEventList.onCallEnd: Trigger when end the call.
    • OmiEventList.onCallEstablished: Trigger when we created the call.
    • OmiEventList.onRinging: Trigger when the phone is ringing.
    • OmiEventList.onHold: Trigger when user hold the call. From parameters, you can reviceved correct status from server through isHold
    • OmiEventList.onMuted: Trigger when user muted the call. From parameters, you can reviceved correct status from server through isMuted