taresip 0.1.1

taresip 0.1.1

TestsTested
LangLanguage Obj-CObjective C
License BSD
ReleasedLast Release Jun 2016

Maintained by Michel Atucha.



taresip 0.1.1

  • By
  • Michel Atucha

TareSIP

Cocoapod for baresip.

Installation

Build manually

  1. Download project and run build.sh script.
  2. Drag generated libraries and headers files into your XCode project.
  3. Check your XCode project has the following frameworks: CFNetwork, AudioToolbox, AVFoundation, SystemConfiguration and CoreMedia.
  4. Check your XCode project has the follwing libraries: libstdc++.tbd and libresolv.9.tbd.

Usage

Please also refer to baresip docs.

Swift

Import headers on your -Bridging_Header.h.

#import <re.h>
#import <baresip.h>

Sample call flow

var agent: COpaquePointer = COpaquePointer(nilLiteral: ())
sip(&agent)
sipClose(agent)

func sip(inout agent: COpaquePointer)
{
    var error = libre_init()
    if error != 0
    {
        return
    }

    // Initialize dynamic modules.
    mod_init()

    // Make configure file.
    let mainBundle = NSBundle.mainBundle()
    if let path = mainBundle.resourcePath
    {
        conf_path_set(getCString(path))
    }
    error = conf_configure()
    if error != 0
    {
        return
    }

    // Initialize the SIP stack.
    error = ua_init("SIP", 1, 1, 1, 0)
    if error != 0
    {
        return
    }

    // Load modules.
    error = conf_modules()
    if error != 0
    {
        return
    }

    let addr: String = "sip:user:[email protected]:port;transport=udp;answermode=auto"

    // Start user agent.
    error = ua_alloc(&agent, getCString(addr))
    if error != 0
    {
        return
    }

    // Make an outgoing call.
    error = ua_connect(agent, nil, nil, "sip:[email protected]:port", nil, VIDMODE_OFF);
    if error != 0
    {
        return
    }

    // Start the main loop.
    re_main(nil)
}

private func sipClose(agent: COpaquePointer)
{
    mem_deref(UnsafeMutablePointer(agent))
    ua_close()
    mod_close()

    // Close and check for memory leaks.
    libre_close()
    tmr_debug()
    mem_debug()
}