taresip 0.1.1

taresip 0.1.1

测试已测试
Lang语言 Obj-CObjective C
许可证 BSD
发布最后发布2016年6月

Michel Atucha 维护。



taresip 0.1.1

  • Michel Atucha

TareSIP

Cocoapod for baresip.

安装

手动构建

  1. 下载项目并运行 build.sh 脚本。
  2. 将生成的库和头文件拖入您的 XCode 项目中。
  3. 请确保您的 XCode 项目包含以下框架: CFNetworkAudioToolboxAVFoundationSystemConfigurationCoreMedia
  4. 请确保您的 XCode 项目包含以下库:libstdc++.tbdlibresolv.9.tbd

使用方法

请参阅 baresip 文档

Swift

在您的 -Bridging_Header.h 中导入头文件。

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

示例呼叫流程

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()
}