Browse Source

baresip 0.4.10

next
Alfred E. Heggestad 8 years ago
parent
commit
98bf08bdcf
285 changed files with 44401 additions and 0 deletions
  1. +241
    -0
      Makefile
  2. +83
    -0
      debian/changelog
  3. +1
    -0
      debian/compat
  4. +21
    -0
      debian/control
  5. +9
    -0
      debian/copyright
  6. +3
    -0
      debian/dirs
  7. +2
    -0
      debian/docs
  8. +79
    -0
      debian/rules
  9. +31
    -0
      docs/COPYING
  10. +544
    -0
      docs/ChangeLog
  11. +199
    -0
      docs/README
  12. +28
    -0
      docs/TODO
  13. +902
    -0
      include/baresip.h
  14. +240
    -0
      mk/Doxyfile
  15. +93
    -0
      mk/mod.mk
  16. +346
    -0
      mk/modules.mk
  17. +87
    -0
      mk/symbian/baresip.mmp
  18. +24
    -0
      mk/symbian/baresip_gcce.pkg
  19. +16
    -0
      mk/symbian/baresip_reg.rss
  20. +14
    -0
      mk/symbian/baresip_thumb.pkg
  21. +12
    -0
      mk/symbian/bld.inf
  22. +31
    -0
      mk/symbian/ecrt.cpp
  23. +19
    -0
      mk/symbian/mod.cpp
  24. +14
    -0
      mk/symbian/static.c
  25. +259
    -0
      mk/win32/baresip.vcproj
  26. +14
    -0
      mk/win32/static.c
  27. +155
    -0
      modules/account/account.c
  28. +10
    -0
      modules/account/module.mk
  29. +164
    -0
      modules/alsa/alsa.c
  30. +18
    -0
      modules/alsa/alsa.h
  31. +155
    -0
      modules/alsa/alsa_play.c
  32. +156
    -0
      modules/alsa/alsa_src.c
  33. +11
    -0
      modules/alsa/module.mk
  34. +340
    -0
      modules/amr/amr.c
  35. +64
    -0
      modules/amr/module.mk
  36. +48
    -0
      modules/aubridge/aubridge.c
  37. +41
    -0
      modules/aubridge/aubridge.h
  38. +178
    -0
      modules/aubridge/device.c
  39. +11
    -0
      modules/aubridge/module.mk
  40. +52
    -0
      modules/aubridge/play.c
  41. +55
    -0
      modules/aubridge/src.c
  42. +88
    -0
      modules/audiounit/audiounit.c
  43. +27
    -0
      modules/audiounit/audiounit.h
  44. +14
    -0
      modules/audiounit/module.mk
  45. +189
    -0
      modules/audiounit/player.c
  46. +194
    -0
      modules/audiounit/recorder.c
  47. +174
    -0
      modules/audiounit/sess.c
  48. +370
    -0
      modules/auloop/auloop.c
  49. +10
    -0
      modules/auloop/module.mk
  50. +399
    -0
      modules/avcapture/avcapture.m
  51. +11
    -0
      modules/avcapture/module.mk
  52. +176
    -0
      modules/avcodec/avcodec.c
  53. +62
    -0
      modules/avcodec/avcodec.h
  54. +346
    -0
      modules/avcodec/decode.c
  55. +646
    -0
      modules/avcodec/encode.c
  56. +176
    -0
      modules/avcodec/h263.c
  57. +188
    -0
      modules/avcodec/h264.c
  58. +165
    -0
      modules/avcodec/h26x.h
  59. +20
    -0
      modules/avcodec/module.mk
  60. +365
    -0
      modules/avformat/avf.c
  61. +11
    -0
      modules/avformat/module.mk
  62. +180
    -0
      modules/bv32/bv32.c
  63. +11
    -0
      modules/bv32/module.mk
  64. +231
    -0
      modules/cairo/cairo.c
  65. +12
    -0
      modules/cairo/module.mk
  66. +417
    -0
      modules/celt/celt.c
  67. +11
    -0
      modules/celt/module.mk
  68. +185
    -0
      modules/cons/cons.c
  69. +10
    -0
      modules/cons/module.mk
  70. +214
    -0
      modules/contact/contact.c
  71. +10
    -0
      modules/contact/module.mk
  72. +128
    -0
      modules/coreaudio/coreaudio.c
  73. +20
    -0
      modules/coreaudio/coreaudio.h
  74. +13
    -0
      modules/coreaudio/module.mk
  75. +167
    -0
      modules/coreaudio/player.c
  76. +199
    -0
      modules/coreaudio/recorder.c
  77. +191
    -0
      modules/directfb/directfb.c
  78. +13
    -0
      modules/directfb/module.mk
  79. +511
    -0
      modules/dshow/dshow.cpp
  80. +11
    -0
      modules/dshow/module.mk
  81. +234
    -0
      modules/dtls_srtp/dtls.c
  82. +403
    -0
      modules/dtls_srtp/dtls_srtp.c
  83. +59
    -0
      modules/dtls_srtp/dtls_srtp.h
  84. +11
    -0
      modules/dtls_srtp/module.mk
  85. +232
    -0
      modules/dtls_srtp/srtp.c
  86. +391
    -0
      modules/dtls_srtp/tls_udp.c
  87. +348
    -0
      modules/evdev/evdev.c
  88. +12
    -0
      modules/evdev/module.mk
  89. +518
    -0
      modules/evdev/print.c
  90. +11
    -0
      modules/evdev/print.h
  91. +126
    -0
      modules/g711/g711.c
  92. +10
    -0
      modules/g711/module.mk
  93. +196
    -0
      modules/g722/g722.c
  94. +11
    -0
      modules/g722/module.mk
  95. +67
    -0
      modules/g7221/decode.c
  96. +68
    -0
      modules/g7221/encode.c
  97. +49
    -0
      modules/g7221/g7221.c
  98. +29
    -0
      modules/g7221/g7221.h
  99. +14
    -0
      modules/g7221/module.mk
  100. +54
    -0
      modules/g7221/sdp.c

+ 241
- 0
Makefile View File

@ -0,0 +1,241 @@
#
# Makefile
#
# Copyright (C) 2010 Creytiv.com
#
#
# Internal features:
#
# USE_TLS Enable SIP over TLS transport
# USE_VIDEO Enable Video-support
#
USE_VIDEO := 1
PROJECT := baresip
VERSION := 0.4.10
ifndef LIBRE_MK
LIBRE_MK := $(shell [ -f ../re/mk/re.mk ] && \
echo "../re/mk/re.mk")
ifeq ($(LIBRE_MK),)
LIBRE_MK := $(shell [ -f ../re-$(VERSION)/mk/re.mk ] && \
echo "../re-$(VERSION)/mk/re.mk")
endif
ifeq ($(LIBRE_MK),)
LIBRE_MK := $(shell [ -f /usr/share/re/re.mk ] && \
echo "/usr/share/re/re.mk")
endif
ifeq ($(LIBRE_MK),)
LIBRE_MK := $(shell [ -f /usr/local/share/re/re.mk ] && \
echo "/usr/local/share/re/re.mk")
endif
endif
include $(LIBRE_MK)
include mk/modules.mk
ifndef LIBREM_PATH
LIBREM_PATH := $(shell [ -d ../rem ] && echo "../rem")
endif
CFLAGS += -I. -Iinclude -I$(LIBRE_INC) -I$(SYSROOT)/include
CFLAGS += -I$(LIBREM_PATH)/include
CFLAGS += -I$(SYSROOT)/local/include/rem -I$(SYSROOT)/include/rem
CXXFLAGS += -I. -Iinclude -I$(LIBRE_INC)
CXXFLAGS += -I$(LIBREM_PATH)/include
CXXFLAGS += -I$(SYSROOT)/local/include/rem -I$(SYSROOT)/include/rem
CXXFLAGS += $(EXTRA_CXXFLAGS)
ifneq ($(LIBREM_PATH),)
SPLINT_OPTIONS += -I$(LIBREM_PATH)/include
CLANG_OPTIONS += -I$(LIBREM_PATH)/include
endif
ifeq ($(OS),win32)
STATIC := yes
endif
# Optional dependencies
ifneq ($(USE_VIDEO),)
CFLAGS += -DUSE_VIDEO=1
endif
ifneq ($(STATIC),)
CFLAGS += -DSTATIC=1
CXXFLAGS += -DSTATIC=1
endif
CFLAGS += -DMODULE_CONF
INSTALL := install
ifeq ($(DESTDIR),)
PREFIX := /usr/local
else
PREFIX := /usr
endif
BINDIR := $(PREFIX)/bin
INCDIR := $(PREFIX)/include
BIN := $(PROJECT)$(BIN_SUFFIX)
SHARED := lib$(PROJECT)$(LIB_SUFFIX)
STATICLIB := libbaresip.a
ifeq ($(STATIC),)
MOD_BINS:= $(patsubst %,%$(MOD_SUFFIX),$(MODULES))
endif
APP_MK := src/srcs.mk
MOD_MK := $(patsubst %,modules/%/module.mk,$(MODULES))
MOD_BLD := $(patsubst %,$(BUILD)/modules/%,$(MODULES))
LIBDIR := $(PREFIX)/lib
MOD_PATH := $(LIBDIR)/$(PROJECT)/modules
SHARE_PATH := $(PREFIX)/share/$(PROJECT)
CFLAGS += -DPREFIX=\"$(PREFIX)\"
all: sanity $(MOD_BINS) $(BIN)
.PHONY: modules
modules: $(MOD_BINS)
include $(APP_MK)
include $(MOD_MK)
OBJS := $(patsubst %.c,$(BUILD)/src/%.o,$(filter %.c,$(SRCS)))
OBJS += $(patsubst %.m,$(BUILD)/src/%.o,$(filter %.m,$(SRCS)))
OBJS += $(patsubst %.S,$(BUILD)/src/%.o,$(filter %.S,$(SRCS)))
APP_OBJS := $(OBJS) $(patsubst %.c,$(BUILD)/src/%.o,$(APP_SRCS)) $(MOD_OBJS)
ifneq ($(LIBREM_PATH),)
LIBS += -L$(LIBREM_PATH)
endif
# Static build: include module linker-flags in binary
ifneq ($(STATIC),)
LIBS += $(MOD_LFLAGS)
else
LIBS += -L$(SYSROOT)/local/lib
MOD_LFLAGS += -L$(SYSROOT)/local/lib
endif
LIBS += -lrem -lm
-include $(APP_OBJS:.o=.d)
sanity:
ifeq ($(LIBRE_MK),)
@echo "ERROR: Missing common makefile for libre. Check LIBRE_MK"
@exit 2
endif
ifeq ($(LIBRE_INC),)
@echo "ERROR: Missing header files for libre. Check LIBRE_INC"
@exit 2
endif
ifeq ($(LIBRE_SO),)
@echo "ERROR: Missing library files for libre. Check LIBRE_SO"
@exit 2
endif
Makefile: mk/*.mk $(MOD_MK) $(LIBRE_MK)
$(SHARED): $(APP_OBJS)
@echo " LD $@"
@$(LD) $(LFLAGS) $(SH_LFLAGS) $^ -L$(LIBRE_SO) -lre $(LIBS) -o $@
$(STATICLIB): $(APP_OBJS)
@echo " AR $@"
@rm -f $@; $(AR) $(AFLAGS) $@ $^
ifneq ($(RANLIB),)
@echo " RANLIB $@"
@$(RANLIB) $@
endif
# GPROF requires static linking
$(BIN): $(APP_OBJS)
@echo " LD $@"
ifneq ($(GPROF),)
@$(LD) $(LFLAGS) $(APP_LFLAGS) $^ ../re/libre.a $(LIBS) -o $@
else
@$(LD) $(LFLAGS) $(APP_LFLAGS) $^ -L$(LIBRE_SO) -lre $(LIBS) -o $@
endif
$(BUILD)/%.o: %.c $(BUILD) Makefile $(APP_MK)
@echo " CC $@"
@$(CC) $(CFLAGS) -c $< -o $@ $(DFLAGS)
$(BUILD)/%.o: %.m $(BUILD) Makefile $(APP_MK)
@echo " OC $@"
@$(CC) $(CFLAGS) $(OBJCFLAGS) -c $< -o $@ $(DFLAGS)
$(BUILD)/%.o: %.S $(BUILD) Makefile $(APP_MK)
@echo " AS $@"
@$(CC) $(CFLAGS) -c $< -o $@ $(DFLAGS)
$(BUILD): Makefile
@mkdir -p $(BUILD)/src $(MOD_BLD)
@touch $@
install: $(BIN) $(MOD_BINS)
@mkdir -p $(DESTDIR)$(BINDIR)
$(INSTALL) -m 0755 $(BIN) $(DESTDIR)$(BINDIR)
@mkdir -p $(DESTDIR)$(MOD_PATH)
$(INSTALL) -m 0644 $(MOD_BINS) $(DESTDIR)$(MOD_PATH)
@mkdir -p $(DESTDIR)$(SHARE_PATH)
$(INSTALL) -m 0644 share/* $(DESTDIR)$(SHARE_PATH)
install-dev: install-shared install-static
install-shared: $(SHARED)
@mkdir -p $(DESTDIR)$(INCDIR)
$(INSTALL) -Cm 0644 include/baresip.h $(DESTDIR)$(INCDIR)
@mkdir -p $(DESTDIR)$(LIBDIR)
$(INSTALL) -m 0644 $(SHARED) $(DESTDIR)$(LIBDIR)
install-static: $(STATICLIB)
@mkdir -p $(DESTDIR)$(INCDIR)
$(INSTALL) -Cm 0644 include/baresip.h $(DESTDIR)$(INCDIR)
@mkdir -p $(DESTDIR)$(LIBDIR)
$(INSTALL) -m 0644 $(STATICLIB) $(DESTDIR)$(LIBDIR)
uninstall:
@rm -f $(DESTDIR)$(PREFIX)/bin/$(BIN)
@rm -rf $(DESTDIR)$(MOD_PATH)
.PHONY: clean
clean:
@rm -rf $(BIN) $(MOD_BINS) $(SHARED) $(BUILD)
@rm -f *stamp \
`find . -name "*.[od]"` \
`find . -name "*~"` \
`find . -name "\.\#*"`
.PHONY: ccheck
ccheck:
@ccheck.pl > /dev/null
version:
@perl -pi -e 's/BARESIP_VERSION.*/BARESIP_VERSION \"$(VERSION)"/' \
include/baresip.h
@perl -pi -e "s/PROJECT_NUMBER = .*/\
PROJECT_NUMBER = $(VERSION)/" \
mk/Doxyfile
@echo "updating version number to $(VERSION)"
src/static.c: $(BUILD) Makefile $(APP_MK) $(MOD_MK)
@echo " SH $@"
@echo "/* static.c - autogenerated by makefile */" > $@
@echo "#include <re_types.h>" >> $@
@echo "#include <re_mod.h>" >> $@
@echo "" >> $@
@for n in $(MODULES); do \
echo "extern const struct mod_export exports_$${n};" >> $@ ; \
done
@echo "" >> $@
@echo "const struct mod_export *mod_table[] = {" >> $@
@for n in $(MODULES); do \
echo " &exports_$${n}," >> $@ ; \
done
@echo " NULL" >> $@
@echo "};" >> $@

+ 83
- 0
debian/changelog View File

@ -0,0 +1,83 @@
baresip (0.4.10) unstable; urgency=low
* version 0.4.10
-- Alfred E. Heggestad <aeh@db.org> Thu, 23 Jan 2014 16:00:00 +0100
baresip (0.4.9) unstable; urgency=low
* version 0.4.9
-- Alfred E. Heggestad <aeh@db.org> Mon, 6 Jan 2014 16:00:00 +0100
baresip (0.4.8) unstable; urgency=low
* version 0.4.8
-- Alfred E. Heggestad <aeh@db.org> Fri, 6 Dec 2013 23:00:00 +0100
baresip (0.4.7) unstable; urgency=low
* version 0.4.7
-- Alfred E. Heggestad <aeh@db.org> Tue, 12 Nov 2013 22:00:00 +0100
baresip (0.4.6) unstable; urgency=low
* version 0.4.6
-- Alfred E. Heggestad <aeh@db.org> Fri, 11 Oct 2013 20:00:00 +0100
baresip (0.4.5) unstable; urgency=low
* version 0.4.5
-- Alfred E. Heggestad <aeh@db.org> Sat, 31 Aug 2013 18:00:00 +0100
baresip (0.4.4) unstable; urgency=low
* version 0.4.4
-- Alfred E. Heggestad <aeh@db.org> Sat, 18 May 2013 10:00:00 +0100
baresip (0.4.3) unstable; urgency=low
* version 0.4.3
-- Alfred E. Heggestad <aeh@db.org> Tue, 1 Jan 2013 01:01:00 +0100
baresip (0.4.2) unstable; urgency=low
* version 0.4.2
-- Alfred E. Heggestad <aeh@db.org> Sun, 9 Sept 2012 09:09:00 +0100
baresip (0.4.1) unstable; urgency=low
* version 0.4.1
-- Alfred E. Heggestad <aeh@db.org> Sat, 21 Apr 2012 21:04:00 +0100
baresip (0.4.0) unstable; urgency=low
* version 0.4.0
-- Alfred E. Heggestad <aeh@db.org> Sun, 25 Dec 2011 12:25:00 +0100
baresip (0.3.0) unstable; urgency=low
* version 0.3.0
-- Alfred E. Heggestad <aeh@db.org> Wed, 7 Sept 2011 07:11:00 +0100
baresip (0.2.0) unstable; urgency=low
* version 0.2.0
-- Alfred E. Heggestad <aeh@db.org> Fri, 20 May 2011 20:05:00 +0100
baresip (0.1.0) unstable; urgency=low
* version 0.1.0
-- Alfred E. Heggestad <aeh@db.org> Fri, 5 Nov 2010 05:11:10 +0100

+ 1
- 0
debian/compat View File

@ -0,0 +1 @@
8

+ 21
- 0
debian/control View File

@ -0,0 +1,21 @@
Source: baresip
Section: comm
Priority: optional
Maintainer: Alfred E. Heggestad <aeh@db.org>
Build-Depends: debhelper (>= 4.0.0), librem-dev (>= 0.4.5), libre-dev (>= 0.4.5), libasound2-dev, libavformat-dev, libavdevice-dev
Standards-Version: 3.6.2
Homepage: http://www.creytiv.com/baresip.html
Package: baresip
Architecture: any
Depends: ${shlibs:Depends}, librem (>= 0.4.5), libre (>= 0.4.5)
Description: Modular SIP User-Agent with audio and video support
.
Design goals:
.
- Minimalistic and modular VoIP client
- SIP, SDP, RTP/RTCP, STUN/TURN/ICE
- IPv4 and IPv6 support
- RFC compliant
- Robust, fast, low footprint
- Portable C89 and C99 source code

+ 9
- 0
debian/copyright View File

@ -0,0 +1,9 @@
This package was debianized by Alfred E. Heggestad <aeh@db.org>
It was downloaded from www.creytiv.com
Copyright Holder: Creytiv.com
License:
Distributed under BSD license

+ 3
- 0
debian/dirs View File

@ -0,0 +1,3 @@
usr/bin
usr/lib/baresip/modules
usr/share/baresip

+ 2
- 0
debian/docs View File

@ -0,0 +1,2 @@
docs/README
docs/TODO

+ 79
- 0
debian/rules View File

@ -0,0 +1,79 @@
#!/usr/bin/make -f
# -*- makefile -*-
# Sample debian/rules that uses debhelper.
# This file was originally written by Joey Hess and Craig Small.
# As a special exception, when this file is copied by dh-make into a
# dh-make output file, you may use that output file without restriction.
# This special exception was added by Craig Small in version 0.37 of dh-make.
# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1
BARESIP_FLAGS := MOD_AUTODETECT=1
configure: configure-stamp
configure-stamp:
dh_testdir
touch configure-stamp
build: build-stamp
build-stamp: configure-stamp
dh_testdir
$(MAKE) RELEASE=1 $(BARESIP_FLAGS) DESTDIR=$(CURDIR)/debian/baresip
touch build-stamp
clean:
dh_testdir
dh_testroot
rm -f build-stamp configure-stamp
-$(MAKE) clean
dh_clean
install: build
dh_testdir
dh_testroot
dh_prep
dh_installdirs
$(MAKE) RELEASE=1 $(BARESIP_FLAGS) install DESTDIR=$(CURDIR)/debian/baresip
# Build architecture-independent files here.
binary-indep: build install
# We have nothing to do by default.
# Build architecture-dependent files here.
binary-arch: build install
dh_testdir
dh_testroot
dh_installchangelogs
dh_installdocs
dh_installexamples
# dh_install
# dh_installmenu
# dh_installdebconf
# dh_installlogrotate
# dh_installemacsen
# dh_installpam
# dh_installmime
# dh_installinit
# dh_installcron
# dh_installinfo
dh_installman
dh_link
dh_strip
dh_compress
dh_fixperms
# dh_perl
# dh_python
# dh_makeshlibs
dh_installdeb
dh_shlibdeps
dh_gencontrol
dh_md5sums
dh_builddeb
binary: binary-indep binary-arch
.PHONY: build clean binary-indep binary-arch binary install configure

+ 31
- 0
docs/COPYING View File

@ -0,0 +1,31 @@
Copyright (c) 2010 - 2014, Alfred E. Heggestad
Copyright (c) 2010 - 2014, Richard Aas
Copyright (c) 2010 - 2014, Creytiv.com
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

+ 544
- 0
docs/ChangeLog View File

@ -0,0 +1,544 @@
2014-01-23 Alfred E. Heggestad <aeh@db.org>
* Version 0.4.10
* baresip:
- account: add account_set_display_name() -- thanks Dimitris
- audio: use both srate/channels to check if resampler is needed
- aufilt: change from frame_size to ptime
- auplay: change from frame_size to ptime
- ausrc: change from frame_size to ptime
- config: add optional ausrc_channels and auplay_channels
- config: create config dir with mode 0700 (suggested by Jann Horn)
- play: update auplay usage with ptime
* alsa: update to new ausrc/auplay API with ptime
fix bug when snd_pcm_readi() returns -EPIPE (thanks Remik)
open device from main thread instead of alsa-thread (thanks EL)
(caused problems with Sennheiser Century SC 660 + USB adapter)
* auloop: minor cleanups and improvements
* coreaudio: update to new ausrc/auplay API with ptime
* gst: update to new ausrc/auplay API with ptime
* l16: fix a bug with sample count
* opus: fix a memory corruption error in opus_decode_pkloss()
* oss: update to new ausrc/auplay API with ptime
* plc: update to new aufilt API with ptime
* portaudio: update to new ausrc/auplay API with ptime
fix bugs when using channels=2 (stereo)
configure device index using "device" parameter
* rst: update to new ausrc/auplay API with ptime
* speex_aec: update to new aufilt API with ptime
* speex_pp: update to new aufilt API with ptime
* winwave: update to new ausrc/auplay API with ptime
* zrtp: update to use libzrtp from Travis Cross' github
use config dir to store ZRTP cache-file (thanks Juha Heinanen)
2014-01-06 Alfred E. Heggestad <aeh@db.org>
* Version 0.4.9
* new modules:
- zrtp Media Path Key Agreement for Unicast Secure RTP
* build:
- added support for LLVM clang compiler
* baresip:
- account: add account_laddr()
- audio: upgrade to new librem auresamp API
- config: use oss,/dev/dsp as default device for FreeBSD
- log: added new logging framework
- main: added new verbose debug argument (-v)
- net: added sanity check for HAVE_INET6 build flag
- play: added play_set_path() -- thanks to Dimitris P.
- ua: added uag_find_param()
- ua: fix param-bug in ua_connect() -- thanks to Juha Heinanen
* aubridge: upgrade to new librem auresamp API
* avcodec: use new av_frame_alloc() api
* celt: deprecate CELT-module, use OPUS instead
* opengles: fix warnings (thanks to Dimitris P.)
* opensles: fix bugs in player and recorder
* opus: encode/decode sdp parameters as of I-D
* speex_resamp: module removed, replaced by librem's resampler
* zrtp: new module for ZRTP media encryption (use ;mediaenc=zrtp)
2013-12-06 Alfred E. Heggestad <aeh@db.org>
* Version 0.4.8
* new modules:
- dtls_srtp DTLS-SRTP media encryption module (RFC 5763,5764)
- aubridge Audio Bridge to connect auplay->ausrc
- vidbridge Video Bridge module to connect vidisp->vidsrc
* baresip:
- added RFC 5576 Source-Specific Media Attributes in SDP
- audio: set SDP bandwidth only if "rtp_bandwidth" config set
- play: do not store a copy of global config
- stream: save RTCP statistics from Sender-reports
- stream: add SDP ssrc attribute
- stream: added metrics for packets/bytes transmit/receive
- ua: added uag_current()/_set() to get/set current User-Agent
- video: set maximum RTP packet-size to 1024 bytes
* config:
- added "video_display module,device" for Video Display
- added "rtp_stats {off,on}" for RTP Statistics after Call
- default RTP bandwidth is now 0-0
* contact: dynamic command description for "Message" handling
dial from current UA (thanks to Simon Liebold)
* isac: upgrade to draft-ietf-avt-rtp-isac-04
* srtp: added auto-negotiation of RTP-profile for incoming calls
(RTP/AVP, RTP/AVPF, RTP/SAVP, RTP/SAVPF)
* vidloop: fix memory leak
2013-11-12 Alfred E. Heggestad <aeh@db.org>
* Version 0.4.7
* new modules:
- httpd HTTP webserver UI module
* baresip:
- added RFC 5506 Support for Reduced-Size RTCP
- audio: minor cleanups
- cmd: ignore RELEASE key in editor mode
- conf: add conf_get_sa()
- mnat: add address family (af) to session handler
- realtime: fixes for iOS (thanks Dimitris)
- ua: make ua_register() public
- ua: add ua_calls() to get list of calls
- ua: only create register client if regint > 0
* debian: update dependencies (thanks Juha Heinanen)
* rpm: added RPM package spec file
* alsa: open device from thread to avoid blocking re-main loop
* avcodec: build fixes for Debian Testing
* avformat: use sys_msleep()
* contact: improve matching logic (thanks EJC Lindner)
* dshow: initialize variables (found with cppcheck)
* evdev: fix formatted printing (found with cppcheck)
* ice: use address family (AF) from call
* ilbc: update to separate encoder/decoder states (thanks Dimitris)
* snapshot: initialize variables (found with cppcheck)
* stun: use address family (AF) from call
* turn: use address family (AF) from call
* uuid: fix usage of strncat()
2013-10-11 Alfred E. Heggestad <aeh@db.org>
* Version 0.4.6
* new modules:
- directfb DirectFB video display module (thanks Andreas Shimokawa)
- dshow Windows DirectShow vidsrc (thanks Dusan Stevanovic)
- wincons Console input driver for Windows
* baresip:
- audio: print audio-pipelines in console/debug
- aufilt: split into separate encoder+decoder states
- call: add local uri/name, dtmf-handler
- call: fix decoding of DTMF/SIP-INFO for '*' and '#'
- export CALL_EVENT_* in public API
- fix various clang warnings
- sipreq: use outbound proxy if specified (thanks EJC Lindner)
- ua: add possibility to specify 'struct call' for hangup/answer
- ua: move SIP extensions into a dynamic vector container
- ua: move playing of tones from call.c to ua.c
- vidfilt: split into separate encoder+decoder states
- vidisp: remove input handler
* menu: improve call-transfer handling
* plc: update to separate encoder/decoder states
* selfview: update to separate encoder/decoder states
* snapshot: remove state which was not needed
* sndfile: update to separate encoder/decoder states
print unique timestamp to saved files
* speex_aec: update to separate encoder/decoder states
* speex_pp: update to separate encoder/decoder states
* vidloop: update to separate encoder/decoder vidfilt states
* vumeter: update to separate encoder/decoder states
* wincons: new module for Console input on Win32
2013-08-31 Alfred E. Heggestad <aeh@db.org>
* Version 0.4.5
* new modules:
- account Account loader module
- natpmp NAT-PMP client (RFC 6886)
- sdl2 Video display using libSDL2
* baresip:
- account: added SIP account parser and container
- config: split conf.c into conf.c and config.c
- config: move enum audio_mode to struct config
- config: move uuid to struct config
- more usage of the #ifdef USE_VIDEO macro
- message: add handling of SIP MESSAGE send/recv
- mediaenc: added rtp_sock parameter to media-handler
- ua: cleanup public struct ua API
- vidisp api: remove unused 'parent' parameter
- call: handle incoming DTMF in SIP INFO (application/dtmf-relay)
- sdp: added sdp_decode_multipart()
- net: fix bug on IP-refresh when 'net_interface' is used
- video: minor cleanups
handle incoming RTCP_RTPFB_GNACK
* isac: fix encode_update() signature
* menu: move dialbuffer here from ua.c
added command 'g' to print current config
* mwi: multiple MWIs for multiple UAs
* presence: include supported methods in SIP messages
* srtp: improved interop and debugging
handle incoming RTP/RTCP-demultiplexing
* uuid: write loaded UUID directly to struct config
* vidloop: added video-filters
2013-05-18 Alfred E. Heggestad <aeh@db.org>
* Version 0.4.4
* new modules:
- g726 G.726 audio codec
- mwi Message Waiting Indication
- snapshot Save video-stream as PNG images
* config:
- added 'sip_certificate' to use a Certificate for SIP/TLS
- added 'ausrc_srate' and 'auplay_srate' to force DSP samplerate
* baresip:
- added a simple BFCP client
- aufilt: improved API
- mediaenc: improved API with session state
- ua: added event handler framework
- aucodec: improved API with separate encode/decode state
- vidcodec: improved API with separate encode/decode state
- sdp.c: added SDP helper functions
- ua: move registration client to reg.c
- audio: added internal resampler
* auloop: added config option 'auloop_codec' for setting codec
* ice: remove old 'ice_interface' config option
* menu: move handling of status-mode here
* selfview: added config option 'selfview_size'
* vp8: upgrade to draft-ietf-payload-vp8-08
* winwave: cleanup and minor fixes
2013-01-01 Alfred E. Heggestad <aeh@db.org>
* Version 0.4.3
* new modules:
- selfview Video selfview as video-filter module
- vumeter Audio-filter module to display recording/playback level
* config:
- added 'net_interface" to bind to a specific network interface
- added accounts 'regq' parameter for SIP Register client
* baresip:
- added video-filter plugin API (vidfilt)
- audio.c: cleanups, split into transmit/receive part
- ua: added SIP Allow-header (thanks Juha Heinanen)
- ua: added Register q-value (thanks Juha Heinanen)
- ua: fix DTMF end event bug
* avcodec: fix x264 fps bug (thanks Trevor Jim)
* ice: only include ufrag/pwd in session SDP (thanks Juha Heinanen)
2012-09-09 Alfred E. Heggestad <aeh@db.org>
* Version 0.4.2
* new modules:
- auloop Audio-loop test module
- contact Contacts module
- isac iSAC audio codec
- menu Interactive menu
- opengles OpenGLES video output
- presence Presence module
- syslog Syslog module
- vidloop Video-loop test module
* baresip:
- added support for call transfer
- added support for call waiting
- added multiple calls per user-agent
- added multiple registrations per user-agent
- cmd: added new command interface
- ua: handle SIP Require header for incoming calls
- ui: cleanup, use dynamic interactive menu
* config:
- added 'audio_alert' for ringtones etc.
- added 'outboundX=proxy' for multiple outbound proxies
- added 'module_tmp' for temporary module loading
- added 'module_app' for application modules
* avcodec: upgrade to latest FFmpeg and fix pts bug
* natbd: register command 'z' for status
* srtp: fix memleak on close
* uuid: added UUID loader
2012-04-21 Alfred E. Heggestad <aeh@db.org>
* Version 0.4.1
* baresip: do not include rem.h from baresip.h
rename struct conf to struct config
vidsrc API: move size to alloc handler
aucodec API: change fmtp type to 'const char *'
add SDP fmtp compare handler
vidcodec API: added enqueue and packetizer handlers
remove size from vidcodec_prm
remove decoder parameters from alloc
change fmtp type to 'const char *'
add SDP fmtp compare handler
remove aufile.c, use librem instead
audio: fix Telev timestamp (thanks Paulo Vicentini)
configurable order of playback/source start
ua_find: match AOR for interop (thanks Tomasz Ostrowski)
ua: more robust parsing for incoming MESSAGE
ua: password prompt (thanks to Juha Heinanen)
* build: detect amr, cairo, rst, silk modules
* config: split 'audio_dev' parameter into 'audio_player/audio_source'
order of audio_player/audio_source decide opening order
rename 'video_dev' parameter to 'video_source'
added optional 'auth_user=NAME' account parameter
(idea was suggested by Juha Heinanen)
* alsa: play: no need to call snd_pcm_start(), explictly started when
writing data to the device. (thanks to Christof Meerwald)
* amr: more portable AMR codec
* avcodec: automatic size from encoded frames
detect packetization-mode from SDP format
use enqueue handler
* avformat: update to latest versions of ffmpeg
* cairo: new experimental video source module
* cons: added support for TCP
* evdev: added KEY_KPx (thanks to ccwufu on OpenWRT forum)
* g7221: use bitrate from decoded SDP format
added optional G722_PCM_SHIFT for 14-bit compat
* rst: thread-based video source
* silk: fix crash, init encoder, bitrate=64000 and complexity=2
(reported by Juha Heinanen)
* srtp: decode SDES lifetime and MKI
* v4l, v4l2: better module detection for FreeBSD 9
do not include malloc.h
(thanks to Matthias Apitz)
* vpx: auto init of encoder
* winwave: fix memory leak (thanks to Tomasz Ostrowski)
* x11: add support for 16-bit graphics
2011-12-25 Alfred E. Heggestad <aeh@db.org>
* Version 0.4.0
* updated doxygen comments (thanks to Olle E. Johansson)
* docs: added modules description
* baresip: add ua_set_aumode(), configurable audio-tx mode
vidsrc API: added media_ctx shared with ausrc
ausrc API: add media_ctx shared with vidsrc
audio_encoder_set() - stop audio source first
audio_decoder_set() - include SDP format parameters
aufile: add PREFIX to share path (thanks to Juha Heinanen)
natbd.c: move code to a new module 'natbd'
get_login_name: check both LOGNAME and USER
ua.c: unique contact-user with address of struct ua
ua.c: find correct UA for incoming SIP Requests
ua_connect: param is optional (thanks to Juha Heinanen)
video: add video_set_source()
* amr: minor improvements
* audiounit: new module for MacOSX/iOS audio driver
* avcapture: new module for iOS video source
* avcodec: fixes for newer versions of libavcodec
* gsm: handle packet-loss
* natbd: move to separate module from core
* opengl: fix building on MacOSX 10.7
(thanks to David Jedda and Atle Samuelsen)
* opus: upgrade to opus v0.9.8
* rst: use media_ctx for shared audio/video stream
* sndfile: fix stereo mode
2011-09-07 Alfred E. Heggestad <aeh@db.org>
* Version 0.3.0
* baresip: use librem for media processing
added support for video selfview
aubuf, autone, vutil: moved to librem
ua: improved API
conf: use internal parser instead of fscanf()
vidloop: cleanup, use librem for processing
* config: add video_selfview={pip,window} parameter
* amr: new module for AMR and AMR-WB audio codecs (RFC 4867)
* avcodec, avformat: update to latest version of FFmpeg
* coreaudio: fix building on MacOSX 10.5 (thanks David Jedda)
* ice: fix building on MacOSX 10.5 (thanks David Jedda)
* opengl: remove deps to libswscale
* opensles: new module OpenSLES audio driver
* opus: new module for OPUS audio codec
* qtcapture: remove deps to libswscale
* rst: new module for mp3 audio streaming
* silk: new module for SILK audio codec
* v4l, v4l2: remove deps to libswscale
* x11: remove deps to libswscale, use librem vidconv instead
* x11grab: remove deps to libswscale
2011-05-20 Alfred E. Heggestad <aeh@db.org>
* Version 0.2.0
* baresip: Added support for SIP Outbound (RFC 5626)
The SDP Content Attribute (RFC 4796)
RTP/RTCP Multiplexing (RFC 5761)
RTP Keepalive (draft-ietf-avt-app-rtp-keepalive-09)
* config: add 'outbound' to sipnat parameter (remove stun, turn)
add rtpkeep={zero,stun,dyna,rtcp} parameter
audio_codecs parameter can now specify samplerate
add rtcp_mux for RTP/RTCP multiplexing on/off
* alsa: set buffersize and fix samplesize (thanks to Luigi Rizzo)
* avcodec: added support for MPEG4 video codec (RFC 3016)
wait for keyframe before decoding
* celt: upgrade libcelt version and cleanups
* coreaudio: fix buffering in recorder
* ice: several improvements and fixes
added new config options
* ilbc: handle asymmetric modes
* opengl: enable vertical sync
* sdl: upgrade to latest version of libSDL from mercurial
* vpx: added support for draft-westin-payload-vp8-02
* x11: handle remote display with optional shared memory
* x11grab: new video-source module (thanks to Luigi Rizzo)
* docs: updated doxygen comments

+ 199
- 0
docs/README View File

@ -0,0 +1,199 @@
README
------
Baresip is a portable and modular SIP User-Agent with audio and video support
Copyright (c) 2010 - 2014 Creytiv.com
Distributed under BSD license
Design goals:
* Minimalistic and modular VoIP client
* SIP, SDP, RTP/RTCP, STUN/TURN/ICE
* IPv4 and IPv6 support
* RFC-compliancy
* Robust, fast, low footprint
* Portable C89 and C99 source code
Modular Plugin Architecture:
account Account loader
alsa ALSA audio driver
amr Adaptive Multi-Rate (AMR) audio codec
aubridge Audio bridge module
audiounit AudioUnit audio driver for MacOSX/iOS
auloop Audio-loop test module
avcapture Video source using iOS AVFoundation video capture
avcodec Video codec using FFmpeg
avformat Video source using FFmpeg libavformat
bv32 BroadVoice32 audio codec
cairo Cairo video source
celt CELT audio codec (obsolete, use opus instead)
cons UDP/TCP console UI driver
contact Contacts module
coreaudio Apple Coreaudio driver
directfb DirectFB video display module
dshow Windows DirectShow video source
dtls_srtp DTLS-SRTP end-to-end encryption
evdev Linux input driver
g711 G.711 audio codec
g722 G.722 audio codec
g7221 G.722.1 audio codec
g726 G.726 audio codec
gsm GSM audio codec
gst Gstreamer audio source
httpd HTTP webserver UI-module
ice ICE protocol for NAT Traversal
ilbc iLBC audio codec
isac iSAC audio codec
l16 L16 audio codec
mda Symbian Mediaserver audio driver (now deprecated)
menu Interactive menu
mwi Message Waiting Indication
natbd NAT Behavior Discovery Module
natpmp NAT Port Mapping Protocol (NAT-PMP) module
opengl OpenGL video output
opengles OpenGLES video output
opensles OpenSLES audio driver
opus OPUS Interactive audio codec
oss Open Sound System (OSS) audio driver
plc Packet Loss Concealment (PLC) using spandsp
portaudio Portaudio driver
presence Presence module
qtcapture Apple QTCapture video source driver
quicktime Apple Quicktime video source driver
rst Radio streamer using mpg123
sdl Simple DirectMedia Layer (SDL) video output driver
sdl2 Simple DirectMedia Layer v2 (SDL2) video output driver
selfview Video selfview module
silk SILK audio codec
snapshot Save video-stream as PNG images
sndfile Audio dumper using libsndfile
speex Speex audio codec
speex_aec Acoustic Echo Cancellation (AEC) using libspeexdsp
speex_pp Audio pre-processor using libspeexdsp
srtp Secure RTP encryption
stdio Standard input/output UI driver
stun Session Traversal Utilities for NAT (STUN) module
syslog Syslog module
turn Obtaining Relay Addresses from STUN (TURN) module
uuid UUID generator and loader
v4l Video4Linux video source
v4l2 Video4Linux2 video source
vidbridge Video bridge module
vidloop Video-loop test module
vpx VP8/VPX video codec
vumeter Display audio levels in console
wincons Console input driver for Windows
winwave Audio driver for Windows
x11 X11 video output driver
x11grab X11 grabber video source
zrtp ZRTP media encryption module
IETF RFC/I-Ds:
* RFC 2190 RTP Payload Format for H.263 Video Streams (Historic)
* RFC 2429 RTP Payload Format for 1998 ver of ITU-T Rec. H.263 Video (H.263+)
* RFC 3016 RTP Payload Format for MPEG-4 Audio/Visual Streams
* RFC 3428 SIP Extension for Instant Messaging
* RFC 3711 The Secure Real-time Transport Protocol (SRTP)
* RFC 3856 A Presence Event Package for SIP
* RFC 3863 Presence Information Data Format (PIDF)
* RFC 3951 Internet Low Bit Rate Codec (iLBC)
* RFC 3952 RTP Payload Format for iLBC Speech
* RFC 3984 RTP Payload Format for H.264 Video
* RFC 4145 TCP-Based Media Transport in SDP
* RFC 4240 Basic Network Media Services with SIP (partly)
* RFC 4298 Broadvoice Speech Codecs
* RFC 4347 Datagram Transport Layer Security
* RFC 4568 SDP Security Descriptions for Media Streams
* RFC 4572 Connection-Oriented Media Transport over TLS Protocol in SDP
* RFC 4574 The SDP Label Attribute
* RFC 4585 Extended RTP Profile for RTCP-Based Feedback (RTP/AVPF)
* RFC 4587 RTP Payload Format for H.261 Video Streams
* RFC 4629 RTP Payload Format for ITU-T Rec. H.263 Video
* RFC 4796 The SDP Content Attribute
* RFC 4867 RTP Payload Format for the AMR and AMR-WB Audio Codecs
* RFC 4961 Symmetric RTP / RTP Control Protocol (RTCP)
* RFC 5168 XML Schema for Media Control
* RFC 5506 Support for Reduced-Size RTCP
* RFC 5574 RTP Payload Format for the Speex Codec
* RFC 5576 Source-Specific Media Attributes in SDP
* RFC 5577 RTP Payload Format for ITU-T Recommendation G.722.1
* RFC 5626 Managing Client-Initiated Connections in SIP
* RFC 5761 Multiplexing RTP Data and Control Packets on a Single Port
* RFC 5763 Framework for Establishing a SRTP Security Context Using DTLS
* RFC 5764 DTLS Extension to Establish Keys for SRTP
* RFC 5780 NAT Behaviour Discovery Using STUN
* RFC 6263 App. Mechanism for Keeping Alive NAT Associated with RTP / RTCP
* RFC 6716 Definition of the Opus Audio Codec
* RFC 6886 NAT Port Mapping Protocol (NAT-PMP)
* draft-ietf-avt-rtp-isac-04
* draft-ietf-payload-vp8-08
* draft-spittka-payload-rtp-opus-00
Architecture:
.------.
|Video |
_ |Stream|\
/|'------' \ 1
/ \
/ _\|
.--. N .----. M .------. 1 .-------. 1 .-----.
|UA|--->|Call|--->|Audio |--->|Generic|--->|Media|
'--' '----' |Stream| |Stream | | NAT |
|1 '------' '-------' '-----'
| C| 1| |
\|/ .-----. .----. |
.-------. |Codec| |Jbuf| |1
| SIP | '-----' '----' |
|Session| 1| /|\ |
'-------' .---. | \|/
|DSP| .--------.
'---' |RTP/RTCP|
'--------'
| SRTP |
'--------'
A User-Agent (UA) has 0-N SIP Calls
A SIP Call has 0-M Media Streams
Supported platforms:
* Linux
* FreeBSD
* OpenBSD
* NetBSD
* Symbian OS
* Solaris
* Windows
* Apple Mac OS X and iOS
* Android
Supported compilers:
* gcc (v2.9x to v4.x)
* gcce
* llvm clang
* ms vc2003 compiler
* codewarrior
External dependencies:
libre
librem
Feedback:
- Please send feedback to <libre@creytiv.com>

+ 28
- 0
docs/TODO View File

@ -0,0 +1,28 @@
TODO:
-------------------------------------------------------------------------------
Version v0.x.y:
ua: add support for SIP GRUU
conf: move generation of config template to a module ('config.so')
improve first-time user experience, add a new module that will
prompt the user for a SIP uri and (optionally) a password.
video rate-control, the outgoing video-stream bandwidth should be
configurable and the encoder should limit the rate to the configured
range. possibly also add a FPS throttler for fast vidsrc modules
improve gui and multi-UA and multi-call interaction
avcodec-audio.so -- create a new audio-codec module that will use
audio codecs from FFmpeg libavcodec, as a supplement to existing codecs.
-------------------------------------------------------------------------------
BUGS:
S605th: no DNS-server IP
sdl: crashes in virtualbox/linux
-------------------------------------------------------------------------------

+ 902
- 0
include/baresip.h View File

@ -0,0 +1,902 @@
/**
* @file baresip.h Public Interface to Baresip
*
* Copyright (C) 2010 Creytiv.com
*/
#ifndef BARESIP_H__
#define BARESIP_H__
#ifdef __cplusplus
extern "C" {
#endif
/** Defines the Baresip version string */
#define BARESIP_VERSION "0.4.10"
/* forward declarations */
struct sa;
struct sdp_media;
struct sdp_session;
struct sip_msg;
struct ua;
struct vidframe;
struct vidrect;
struct vidsz;
/*
* Account
*/
struct account;
int account_alloc(struct account **accp, const char *sipaddr);
int account_debug(struct re_printf *pf, const struct account *acc);
int account_set_display_name(struct account *acc, const char *dname);
int account_auth(const struct account *acc, char **username, char **password,
const char *realm);
struct list *account_aucodecl(const struct account *acc);
struct list *account_vidcodecl(const struct account *acc);
struct sip_addr *account_laddr(const struct account *acc);
/*
* Call
*/
enum call_event {
CALL_EVENT_INCOMING,
CALL_EVENT_RINGING,
CALL_EVENT_PROGRESS,
CALL_EVENT_ESTABLISHED,
CALL_EVENT_CLOSED,
CALL_EVENT_TRANSFER,
};
struct call;
typedef void (call_event_h)(struct call *call, enum call_event ev,
const char *str, void *arg);
typedef void (call_dtmf_h)(struct call *call, char key, void *arg);
int call_modify(struct call *call);
int call_hold(struct call *call, bool hold);
int call_send_digit(struct call *call, char key);
bool call_has_audio(const struct call *call);
bool call_has_video(const struct call *call);
int call_transfer(struct call *call, const char *uri);
int call_status(struct re_printf *pf, const struct call *call);
int call_debug(struct re_printf *pf, const struct call *call);
void call_set_handlers(struct call *call, call_event_h *eh,
call_dtmf_h *dtmfh, void *arg);
uint16_t call_scode(const struct call *call);
uint32_t call_duration(const struct call *call);
const char *call_peeruri(const struct call *call);
const char *call_peername(const struct call *call);
const char *call_localuri(const struct call *call);
struct audio *call_audio(const struct call *call);
struct video *call_video(const struct call *call);
struct list *call_streaml(const struct call *call);
struct ua *call_get_ua(const struct call *call);
/*
* Conf (utils)
*/
/** Defines the configuration line handler */
typedef int (confline_h)(const struct pl *addr);
int conf_configure(void);
int conf_modules(void);
void conf_path_set(const char *path);
int conf_path_get(char *path, size_t sz);
int conf_parse(const char *filename, confline_h *ch);
int conf_get_vidsz(const struct conf *conf, const char *name,
struct vidsz *sz);
int conf_get_sa(const struct conf *conf, const char *name, struct sa *sa);
bool conf_fileexist(const char *path);
struct conf *conf_cur(void);
/*
* Config (core configuration)
*/
/** A range of numbers */
struct range {
uint32_t min; /**< Minimum number */
uint32_t max; /**< Maximum number */
};
static inline bool in_range(const struct range *rng, uint32_t val)
{
return rng ? (val >= rng->min && val <= rng->max) : false;
}
/** Audio transmit mode */
enum audio_mode {
AUDIO_MODE_POLL = 0, /**< Polling mode */
AUDIO_MODE_THREAD, /**< Use dedicated thread */
AUDIO_MODE_THREAD_REALTIME, /**< Use dedicated realtime-thread */
AUDIO_MODE_TMR /**< Use timer */
};
/** Core configuration */
struct config {
/** Input */
struct config_input {
char device[64]; /**< Input device name */
uint32_t port; /**< Input port number */
} input;
/** SIP User-Agent */
struct config_sip {
uint32_t trans_bsize; /**< SIP Transaction bucket size */
char uuid[64]; /**< Universally Unique Identifier */
char local[64]; /**< Local SIP Address */
char cert[256]; /**< SIP Certificate */
} sip;
/** Audio */
struct config_audio {
char src_mod[16]; /**< Audio source module */
char src_dev[128]; /**< Audio source device */
char play_mod[16]; /**< Audio playback module */
char play_dev[128]; /**< Audio playback device */
char alert_mod[16]; /**< Audio alert module */
char alert_dev[128]; /**< Audio alert device */
struct range srate; /**< Audio sampling rate in [Hz] */
struct range channels; /**< Nr. of audio channels (1=mono) */
uint32_t srate_play; /**< Opt. sampling rate for player */
uint32_t srate_src; /**< Opt. sampling rate for source */
uint32_t channels_play; /**< Opt. channels for player */
uint32_t channels_src; /**< Opt. channels for source */
bool src_first; /**< Audio source opened first */
enum audio_mode txmode; /**< Audio transmit mode */
} audio;
#ifdef USE_VIDEO
/** Video */
struct config_video {
char src_mod[16]; /**< Video source module */
char src_dev[128]; /**< Video source device */
char disp_mod[16]; /**< Video display module */
char disp_dev[128]; /**< Video display device */
unsigned width, height; /**< Video resolution */
uint32_t bitrate; /**< Encoder bitrate in [bit/s] */
uint32_t fps; /**< Video framerate */
} video;
#endif
/** Audio/Video Transport */
struct config_avt {
uint8_t rtp_tos; /**< Type-of-Service for outg. RTP */
struct range rtp_ports; /**< RTP port range */
struct range rtp_bw; /**< RTP Bandwidth range [bit/s] */
bool rtcp_enable; /**< RTCP is enabled */
bool rtcp_mux; /**< RTP/RTCP multiplexing */
struct range jbuf_del; /**< Delay, number of frames */
bool rtp_stats; /**< Enable RTP statistics */
} avt;
/* Network */
struct config_net {
char ifname[16]; /**< Bind to interface (optional) */
} net;
#ifdef USE_VIDEO
/* BFCP */
struct config_bfcp {
char proto[16]; /**< BFCP Transport (optional) */
} bfcp;
#endif
};
int config_parse_conf(struct config *cfg, const struct conf *conf);
int config_print(struct re_printf *pf, const struct config *cfg);
int config_write_template(const char *file, const struct config *cfg);
struct config *conf_config(void);
/*
* Contact
*/
enum presence_status {
PRESENCE_UNKNOWN,
PRESENCE_OPEN,
PRESENCE_CLOSED,
PRESENCE_BUSY
};
struct contact;
int contact_add(struct contact **contactp, const struct pl *addr);
int contacts_print(struct re_printf *pf, void *unused);
void contact_set_presence(struct contact *c, enum presence_status status);
struct sip_addr *contact_addr(const struct contact *c);
struct list *contact_list(void);
const char *contact_str(const struct contact *c);
const char *contact_presence_str(enum presence_status status);
/*
* Media Context
*/
/** Media Context */
struct media_ctx {
const char *id; /**< Media Context identifier */
};
/*
* Message
*/
typedef void (message_recv_h)(const struct pl *peer, const struct pl *ctype,
struct mbuf *body, void *arg);
int message_init(message_recv_h *recvh, void *arg);
void message_close(void);
int message_send(struct ua *ua, const char *peer, const char *msg);
/*
* Audio Source
*/
struct ausrc;
struct ausrc_st;
/** Audio Source parameters */
struct ausrc_prm {
int fmt; /**< Audio format (enum aufmt) */
uint32_t srate; /**< Sampling rate in [Hz] */
uint8_t ch; /**< Number of channels */
uint32_t ptime; /**< Wanted packet-time in [ms] */
};
typedef void (ausrc_read_h)(const uint8_t *buf, size_t sz, void *arg);
typedef void (ausrc_error_h)(int err, const char *str, void *arg);
typedef int (ausrc_alloc_h)(struct ausrc_st **stp, struct ausrc *ausrc,
struct media_ctx **ctx,
struct ausrc_prm *prm, const char *device,
ausrc_read_h *rh, ausrc_error_h *errh, void *arg);
int ausrc_register(struct ausrc **asp, const char *name,
ausrc_alloc_h *alloch);
const struct ausrc *ausrc_find(const char *name);
int ausrc_alloc(struct ausrc_st **stp, struct media_ctx **ctx,
const char *name,
struct ausrc_prm *prm, const char *device,
ausrc_read_h *rh, ausrc_error_h *errh, void *arg);
/*
* Audio Player
*/
struct auplay;
struct auplay_st;
/** Audio Player parameters */
struct auplay_prm {
int fmt; /**< Audio format (enum aufmt) */
uint32_t srate; /**< Sampling rate in [Hz] */
uint8_t ch; /**< Number of channels */
uint32_t ptime; /**< Wanted packet-time in [ms] */
};
typedef bool (auplay_write_h)(uint8_t *buf, size_t sz, void *arg);
typedef int (auplay_alloc_h)(struct auplay_st **stp, struct auplay *ap,
struct auplay_prm *prm, const char *device,
auplay_write_h *wh, void *arg);
int auplay_register(struct auplay **pp, const char *name,
auplay_alloc_h *alloch);
const struct auplay *auplay_find(const char *name);
int auplay_alloc(struct auplay_st **stp, const char *name,
struct auplay_prm *prm, const char *device,
auplay_write_h *wh, void *arg);
/*
* Audio Filter
*/
struct aufilt;
/* Base class */
struct aufilt_enc_st {
const struct aufilt *af;
struct le le;
};
struct aufilt_dec_st {
const struct aufilt *af;
struct le le;
};
/** Audio Filter Parameters */
struct aufilt_prm {
uint32_t srate; /**< Sampling rate in [Hz] */
uint8_t ch; /**< Number of channels */
uint32_t ptime; /**< Wanted packet-time in [ms] */
};
typedef int (aufilt_encupd_h)(struct aufilt_enc_st **stp, void **ctx,
const struct aufilt *af, struct aufilt_prm *prm);
typedef int (aufilt_encode_h)(struct aufilt_enc_st *st,
int16_t *sampv, size_t *sampc);
typedef int (aufilt_decupd_h)(struct aufilt_dec_st **stp, void **ctx,
const struct aufilt *af, struct aufilt_prm *prm);
typedef int (aufilt_decode_h)(struct aufilt_dec_st *st,
int16_t *sampv, size_t *sampc);
struct aufilt {
struct le le;
const char *name;
aufilt_encupd_h *encupdh;
aufilt_encode_h *ench;
aufilt_decupd_h *decupdh;
aufilt_decode_h *dech;
};
void aufilt_register(struct aufilt *af);
void aufilt_unregister(struct aufilt *af);
struct list *aufilt_list(void);
/*
* Log
*/
enum log_level {
DEBUG = 0,
INFO,
WARN,
#undef ERROR
ERROR,
};
typedef void (log_h)(uint32_t level, const char *msg);
struct log {
struct le le;
log_h *h;
};
void log_register_handler(struct log *log);
void log_unregister_handler(struct log *log);
void log_enable_debug(bool enable);
void log_enable_stderr(bool enable);
void vlog(enum log_level level, const char *fmt, va_list ap);
void loglv(enum log_level level, const char *fmt, ...);
void debug(const char *fmt, ...);
void info(const char *fmt, ...);
void warning(const char *fmt, ...);
void error(const char *fmt, ...);
/*
* Menc - Media encryption (for RTP)
*/
struct menc;
struct menc_sess;
struct menc_media;
typedef void (menc_error_h)(int err, void *arg);
typedef int (menc_sess_h)(struct menc_sess **sessp, struct sdp_session *sdp,
bool offerer, menc_error_h *errorh, void *arg);
typedef int (menc_media_h)(struct menc_media **mp, struct menc_sess *sess,
struct rtp_sock *rtp, int proto,
void *rtpsock, void *rtcpsock,
struct sdp_media *sdpm);
struct menc {
struct le le;
const char *id;
const char *sdp_proto;
menc_sess_h *sessh;
menc_media_h *mediah;
};
void menc_register(struct menc *menc);
void menc_unregister(struct menc *menc);
const struct menc *menc_find(const char *id);
/*
* Net - Networking
*/
typedef void (net_change_h)(void *arg);
int net_init(const struct config_net *cfg, int af);
void net_close(void);
int net_dnssrv_add(const struct sa *sa);
void net_change(uint32_t interval, net_change_h *ch, void *arg);
bool net_check(void);
int net_af(void);
int net_debug(struct re_printf *pf, void *unused);
const struct sa *net_laddr_af(int af);
const char *net_domain(void);
struct dnsc *net_dnsc(void);
/*
* Play - audio file player
*/
struct play;
int play_file(struct play **playp, const char *filename, int repeat);
int play_tone(struct play **playp, struct mbuf *tone,
uint32_t srate, uint8_t ch, int repeat);
void play_init(void);
void play_close(void);
void play_set_path(const char *path);
/*
* User Agent
*/
struct ua;
/** Events from User-Agent */
enum ua_event {
UA_EVENT_REGISTERING = 0,
UA_EVENT_REGISTER_OK,
UA_EVENT_REGISTER_FAIL,
UA_EVENT_UNREGISTERING,
UA_EVENT_CALL_INCOMING,
UA_EVENT_CALL_RINGING,
UA_EVENT_CALL_PROGRESS,
UA_EVENT_CALL_ESTABLISHED,
UA_EVENT_CALL_CLOSED,
UA_EVENT_MAX,
};
/** Video mode */
enum vidmode {
VIDMODE_OFF = 0, /**< Video disabled */
VIDMODE_ON, /**< Video enabled */
};
/** Defines the User-Agent event handler */
typedef void (ua_event_h)(struct ua *ua, enum ua_event ev,
struct call *call, const char *prm, void *arg);
typedef void (options_resp_h)(int err, const struct sip_msg *msg, void *arg);
/* Multiple instances */
int ua_alloc(struct ua **uap, const char *aor);
int ua_connect(struct ua *ua, struct call **callp,
const char *from_uri, const char *uri,
const char *params, enum vidmode vmode);
void ua_hangup(struct ua *ua, struct call *call,
uint16_t scode, const char *reason);
int ua_answer(struct ua *ua, struct call *call);
int ua_options_send(struct ua *ua, const char *uri,
options_resp_h *resph, void *arg);
int ua_sipfd(const struct ua *ua);
int ua_debug(struct re_printf *pf, const struct ua *ua);
int ua_print_calls(struct re_printf *pf, const struct ua *ua);
int ua_print_status(struct re_printf *pf, const struct ua *ua);
int ua_print_supported(struct re_printf *pf, const struct ua *ua);
int ua_register(struct ua *ua);
bool ua_isregistered(const struct ua *ua);
const char *ua_aor(const struct ua *ua);
const char *ua_cuser(const struct ua *ua);
const char *ua_outbound(const struct ua *ua);
struct call *ua_call(const struct ua *ua);
struct account *ua_prm(const struct ua *ua);
struct list *ua_calls(const struct ua *ua);
/* One instance */
int ua_init(const char *software, bool udp, bool tcp, bool tls,
bool prefer_ipv6);
void ua_close(void);
void ua_stop_all(bool forced);
int uag_reset_transp(bool reg, bool reinvite);
int uag_event_register(ua_event_h *eh, void *arg);
void uag_event_unregister(ua_event_h *eh);
int ua_print_sip_status(struct re_printf *pf, void *unused);
struct ua *uag_find(const struct pl *cuser);
struct ua *uag_find_aor(const char *aor);
struct ua *uag_find_param(const char *name, const char *val);
struct sip *uag_sip(void);
const char *uag_event_str(enum ua_event ev);
struct list *uag_list(void);
void uag_current_set(struct ua *ua);
struct ua *uag_current(void);
struct sipsess_sock *uag_sipsess_sock(void);
struct sipevent_sock *uag_sipevent_sock(void);
/*