Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
objects = {

/* Begin PBXBuildFile section */
3AEC29312995BF1400F59EA0 /* VideoToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3AEC29302995BF1400F59EA0 /* VideoToolbox.framework */; };
3AEC29332995BF4C00F59EA0 /* CoreMedia.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3AEC29322995BF4C00F59EA0 /* CoreMedia.framework */; };
C337417325BADEEE007785D7 /* Model.swift in Sources */ = {isa = PBXBuildFile; fileRef = C337417225BADEEE007785D7 /* Model.swift */; };
C351398125A5F70D00A090AA /* libg7221codec.a in Frameworks */ = {isa = PBXBuildFile; fileRef = C3B8521F25A5EC380037A8AB /* libg7221codec.a */; };
C351398225A5F70D00A090AA /* libgsmcodec.a in Frameworks */ = {isa = PBXBuildFile; fileRef = C3B8521A25A5EC380037A8AB /* libgsmcodec.a */; };
Expand Down Expand Up @@ -37,14 +39,15 @@
C3B8520325A5EA6C0037A8AB /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = C3B8520225A5EA6C0037A8AB /* ViewController.swift */; };
C3B8520625A5EA6C0037A8AB /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = C3B8520425A5EA6C0037A8AB /* Main.storyboard */; };
C3B8520825A5EA6D0037A8AB /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = C3B8520725A5EA6D0037A8AB /* Assets.xcassets */; };
C3B8520B25A5EA6D0037A8AB /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = C3B8520925A5EA6D0037A8AB /* LaunchScreen.storyboard */; };
C3B8524325A5EC940037A8AB /* AVFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C3B8524125A5EC940037A8AB /* AVFoundation.framework */; };
C3B8524425A5EC940037A8AB /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C3B8524225A5EC940037A8AB /* Foundation.framework */; };
C3B8524725A5ED6D0037A8AB /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C3B8524625A5ED6D0037A8AB /* AudioToolbox.framework */; };
C3C4082E25B9A547002C19EB /* ActiveViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = C3C4082D25B9A547002C19EB /* ActiveViewController.swift */; };
/* End PBXBuildFile section */

/* Begin PBXFileReference section */
3AEC29302995BF1400F59EA0 /* VideoToolbox.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = VideoToolbox.framework; path = System/Library/Frameworks/VideoToolbox.framework; sourceTree = SDKROOT; };
3AEC29322995BF4C00F59EA0 /* CoreMedia.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreMedia.framework; path = System/Library/Frameworks/CoreMedia.framework; sourceTree = SDKROOT; };
C337417225BADEEE007785D7 /* Model.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Model.swift; sourceTree = "<group>"; };
C374860725B84FA100FBE972 /* OutgoingViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OutgoingViewController.swift; sourceTree = "<group>"; };
C399A57025AF2721000F742A /* IncomingViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = IncomingViewController.swift; sourceTree = "<group>"; };
Expand All @@ -58,7 +61,6 @@
C3B8520225A5EA6C0037A8AB /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = "<group>"; };
C3B8520525A5EA6C0037A8AB /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };
C3B8520725A5EA6D0037A8AB /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
C3B8520A25A5EA6D0037A8AB /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
C3B8520C25A5EA6D0037A8AB /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
C3B8521325A5EBF00037A8AB /* ios-swift-pjsua2-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "ios-swift-pjsua2-Bridging-Header.h"; sourceTree = "<group>"; };
C3B8521825A5EC380037A8AB /* libpjmedia-videodev.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = "libpjmedia-videodev.a"; path = "../PJSip-Build/pjproject/pjmedia/lib/libpjmedia-videodev.a"; sourceTree = "<group>"; };
Expand Down Expand Up @@ -100,11 +102,13 @@
C351398625A5F70D00A090AA /* libpjmedia-audiodev.a in Frameworks */,
C351398725A5F70D00A090AA /* libpjmedia-codec.a in Frameworks */,
C351398825A5F70D00A090AA /* libpjmedia-videodev.a in Frameworks */,
3AEC29312995BF1400F59EA0 /* VideoToolbox.framework in Frameworks */,
C351398925A5F70D00A090AA /* libpjmedia.a in Frameworks */,
C351398A25A5F70D00A090AA /* libpjnath.a in Frameworks */,
C351398B25A5F70D00A090AA /* libpjsip-simple.a in Frameworks */,
C351398C25A5F70D00A090AA /* libpjsip-ua.a in Frameworks */,
C351398D25A5F70D00A090AA /* libpjsip.a in Frameworks */,
3AEC29332995BF4C00F59EA0 /* CoreMedia.framework in Frameworks */,
C351398E25A5F70D00A090AA /* libpjsua.a in Frameworks */,
C351398F25A5F70D00A090AA /* libpjsua2.a in Frameworks */,
C351399025A5F70D00A090AA /* libresample.a in Frameworks */,
Expand Down Expand Up @@ -144,7 +148,6 @@
isa = PBXGroup;
children = (
C3B8520425A5EA6C0037A8AB /* Main.storyboard */,
C3B8520925A5EA6D0037A8AB /* LaunchScreen.storyboard */,
);
path = View;
sourceTree = "<group>";
Expand Down Expand Up @@ -185,6 +188,8 @@
C3B8521725A5EC380037A8AB /* Frameworks */ = {
isa = PBXGroup;
children = (
3AEC29322995BF4C00F59EA0 /* CoreMedia.framework */,
3AEC29302995BF1400F59EA0 /* VideoToolbox.framework */,
C3B8524625A5ED6D0037A8AB /* AudioToolbox.framework */,
C3B8524125A5EC940037A8AB /* AVFoundation.framework */,
C3B8524225A5EC940037A8AB /* Foundation.framework */,
Expand Down Expand Up @@ -281,7 +286,6 @@
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
C3B8520B25A5EA6D0037A8AB /* LaunchScreen.storyboard in Resources */,
C3B8520825A5EA6D0037A8AB /* Assets.xcassets in Resources */,
C3B8520625A5EA6C0037A8AB /* Main.storyboard in Resources */,
);
Expand Down Expand Up @@ -317,14 +321,6 @@
name = Main.storyboard;
sourceTree = "<group>";
};
C3B8520925A5EA6D0037A8AB /* LaunchScreen.storyboard */ = {
isa = PBXVariantGroup;
children = (
C3B8520A25A5EA6D0037A8AB /* Base */,
);
name = LaunchScreen.storyboard;
sourceTree = "<group>";
};
/* End PBXVariantGroup section */

/* Begin XCBuildConfiguration section */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
enableGPUValidationMode = "1"
allowLocationSimulation = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,20 @@ import UIKit
@main
class AppDelegate: UIResponder, UIApplicationDelegate {



func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.

//Create Lib
CPPWrapper().createLibWrapper()

//Listen incoming call via function pointer
CPPWrapper().incoming_call_wrapper(incoming_call_swift)

//Listen incoming call via function pointer
CPPWrapper().acc_listener_wrapper(acc_listener_swift)

CPPWrapper().update_video_wrapper(update_video_swift)

return true
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,23 +19,30 @@

import UIKit


class ActiveViewController: UIViewController {

var activeCallId : String = ""
@IBOutlet weak var holdButton: UIButton!

var holdFlag : Bool = false
@IBOutlet weak var activeCallTitle: UILabel!

@IBOutlet weak var videoView: UIView!

override func viewDidLoad() {
super.viewDidLoad()
activeCallTitle.text = activeCallId
}

override func viewDidDisappear(_ animated: Bool) {
CPPWrapper().hangupCall();
call_status_listener_swift(call_answer_code: 1);
}

func updateVideo(vid_win: UIView!) {
videoView.addSubview(vid_win);
vid_win.center = videoView.center;
vid_win.frame = videoView.bounds;
vid_win.contentMode = .scaleAspectFit;

}

@IBAction func hangupClick(_ sender: UIButton) {
Expand All @@ -57,6 +64,5 @@ class ActiveViewController: UIViewController {
holdFlag = !holdFlag

}


}
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class IncomingViewController: UIViewController {

override func viewDidLoad() {
super.viewDidLoad()
title = "Gelen Arama"
title = "Incoming Call"
callTitle.text = incomingCallId

CPPWrapper().call_listener_wrapper(call_status_listener_swift)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,13 @@

import UIKit

var vc_inst: ViewController! = nil;

func acc_listener_swift(status: Bool) {
DispatchQueue.main.async () {
vc_inst.updateAccStatus(status: status);
}
}

class ViewController: UIViewController {

Expand All @@ -31,57 +37,67 @@ class ViewController: UIViewController {
@IBOutlet weak var sipPortTField: UITextField!
@IBOutlet weak var sipUsernameTField: UITextField!
@IBOutlet weak var sipPasswordTField: UITextField!


@IBOutlet weak var loginButton: UIButton!
@IBOutlet weak var logoutButton: UIButton!

//Destination Uri to Making outgoing call
@IBOutlet weak var sipDestinationUriTField: UITextField!

var accStatus: Bool!

func updateAccStatus(status: Bool) {
accStatus = status;
if (status) {
statusLabel.text = "Reg Status: REGISTERED"
loginButton.isEnabled = false;
logoutButton.isEnabled = true;
} else {
statusLabel.text = "Reg Status: NOT REGISTERED"
loginButton.isEnabled = true;
logoutButton.isEnabled = false;
}
}

override func viewDidLoad() {
super.viewDidLoad()

//Create Lib
CPPWrapper().createLibWrapper()

//Listen incoming call via function pointer
CPPWrapper().incoming_call_wrapper(incoming_call_swift)

vc_inst = self;

CPPWrapper().createAccountWrapper(sipUsernameTField.text,
sipPasswordTField.text,
sipIpTField.text,
sipPortTField.text)

//Done button to the keyboard
sipIpTField.addDoneButtonOnKeyboard()
sipPortTField.addDoneButtonOnKeyboard()
sipUsernameTField.addDoneButtonOnKeyboard()
sipPasswordTField.addDoneButtonOnKeyboard()
sipDestinationUriTField.addDoneButtonOnKeyboard()
}



//Refresh Button
@IBAction func refreshStatus(_ sender: UIButton) {
if (CPPWrapper().registerStateInfoWrapper()){
statusLabel.text = "Sip Status: REGISTERED"
}else {
statusLabel.text = "Sip Status: NOT REGISTERED"
}
}


//Login Button
@IBAction func loginClick(_ sender: UIButton) {

//Check user already logged in. && Form is filled
if (CPPWrapper().registerStateInfoWrapper() == false
&& !sipUsernameTField.text!.isEmpty
&& !sipPasswordTField.text!.isEmpty
&& !sipIpTField.text!.isEmpty
&& !sipPortTField.text!.isEmpty){
if (//CPPWrapper().registerStateInfoWrapper() == false &&
!sipUsernameTField.text!.isEmpty &&
!sipPasswordTField.text!.isEmpty &&
!sipIpTField.text!.isEmpty &&
!sipPortTField.text!.isEmpty)
{
//Register to the user
CPPWrapper().createAccountWrapper(
sipUsernameTField.text,
sipPasswordTField.text,
sipIpTField.text,
sipPortTField.text)


} else {
let alert = UIAlertController(title: "SIP SETTINGS ERROR", message: "Please fill the form / Logout", preferredStyle: .alert)
alert.addAction(UIAlertAction(title: "OK", style: .default, handler: { action in
Expand All @@ -101,43 +117,25 @@ class ViewController: UIViewController {
}))
self.present(alert, animated: true, completion: nil)
}

//Wait until register/unregister
sleep(2)
if (CPPWrapper().registerStateInfoWrapper()){
statusLabel.text = "Sip Status: REGISTERED"
} else {
statusLabel.text = "Sip Status: NOT REGISTERED"
}

}

//Logout Button
@IBAction func logoutClick(_ sender: UIButton) {

/**
Only unregister from an account.
*/
//Unregister
CPPWrapper().unregisterAccountWrapper()

//Wait until register/unregister
sleep(2)
if (CPPWrapper().registerStateInfoWrapper()){
statusLabel.text = "Sip Status: REGISTERED"
} else {
statusLabel.text = "Sip Status: NOT REGISTERED"
}
}

//Call Button
@IBAction func callClick(_ sender: UIButton) {

if(CPPWrapper().registerStateInfoWrapper() != false){
if (accStatus) {
let vcToPresent = self.storyboard!.instantiateViewController(withIdentifier: "outgoingCallVC") as! OutgoingViewController
vcToPresent.outgoingCallId = sipDestinationUriTField.text ?? "<SIP-NUMBER>"
self.present(vcToPresent, animated: true, completion: nil)
}else {
} else {
let alert = UIAlertController(title: "Outgoing Call Error", message: "Please register to be able to make call", preferredStyle: .alert)
alert.addAction(UIAlertAction(title: "OK", style: .default, handler: { action in
switch action.style{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>NSCameraUsageDescription</key>
<string>Video Call</string>
<key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleExecutable</key>
Expand Down Expand Up @@ -47,6 +49,7 @@
<string>Main</string>
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>video-camera</string>
<string>armv7</string>
</array>
<key>UISupportedInterfaceOrientations</key>
Expand Down
Loading