Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package osmo-sip-connector for 
openSUSE:Factory checked in at 2021-11-21 23:51:58
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/osmo-sip-connector (Old)
 and      /work/SRC/openSUSE:Factory/.osmo-sip-connector.new.1895 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "osmo-sip-connector"

Sun Nov 21 23:51:58 2021 rev:4 rq:932637 version:1.6.0

Changes:
--------
--- /work/SRC/openSUSE:Factory/osmo-sip-connector/osmo-sip-connector.changes    
2021-10-15 23:03:53.942094701 +0200
+++ 
/work/SRC/openSUSE:Factory/.osmo-sip-connector.new.1895/osmo-sip-connector.changes
  2021-11-21 23:52:25.734205194 +0100
@@ -1,0 +2,6 @@
+Fri Nov 19 11:24:05 UTC 2021 - Martin Hauke <mar...@gmx.de>
+
+- Update to new upstream release 1.6.0
+  * https://git.osmocom.org/osmo-sip-connector/plain/debian/changelog?h=1.6.0
+
+-------------------------------------------------------------------

Old:
----
  osmo-sip-connector-1.4.0.tar.xz

New:
----
  osmo-sip-connector-1.6.0.tar.xz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ osmo-sip-connector.spec ++++++
--- /var/tmp/diff_new_pack.HuHATu/_old  2021-11-21 23:52:26.214203647 +0100
+++ /var/tmp/diff_new_pack.HuHATu/_new  2021-11-21 23:52:26.214203647 +0100
@@ -2,7 +2,7 @@
 # spec file for package osmo-sip-connector
 #
 # Copyright (c) 2021 SUSE LLC
-# Copyright (c) 2016-2020, Martin Hauke <mar...@gmx.de>
+# Copyright (c) 2016-2021, Martin Hauke <mar...@gmx.de>
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -18,7 +18,7 @@
 
 
 Name:           osmo-sip-connector
-Version:        1.4.0
+Version:        1.6.0
 Release:        0
 Summary:        MNCC to SIP bridge for osmo-nitb
 License:        AGPL-3.0-or-later AND GPL-2.0-or-later
@@ -31,9 +31,9 @@
 BuildRequires:  libtool
 BuildRequires:  pkgconfig >= 0.20
 BuildRequires:  systemd-rpm-macros
-BuildRequires:  pkgconfig(libosmocore) >= 1.0.0
-BuildRequires:  pkgconfig(libosmogsm) >= 1.0.0
-BuildRequires:  pkgconfig(libosmovty) >= 1.0.0
+BuildRequires:  pkgconfig(libosmocore) >= 1.5.0
+BuildRequires:  pkgconfig(libosmogsm) >= 1.5.0
+BuildRequires:  pkgconfig(libosmovty) >= 1.5.0
 BuildRequires:  pkgconfig(sofia-sip-ua-glib) >= 1.12.0
 %{?systemd_requires}
 

++++++ _service ++++++
--- /var/tmp/diff_new_pack.HuHATu/_old  2021-11-21 23:52:26.238203570 +0100
+++ /var/tmp/diff_new_pack.HuHATu/_new  2021-11-21 23:52:26.238203570 +0100
@@ -2,8 +2,8 @@
        <service name="tar_scm" mode="disabled">
                <param name="scm">git</param>
                <param 
name="url">git://git.osmocom.org/osmo-sip-connector</param>
-               <param name="revision">1.4.0</param>
-               <param name="versionformat">1.4.0</param>
+               <param name="revision">1.6.0</param>
+               <param name="versionformat">1.6.0</param>
        </service>
        <service name="recompress" mode="disabled">
                <param name="file">*.tar</param>

++++++ osmo-sip-connector-1.4.0.tar.xz -> osmo-sip-connector-1.6.0.tar.xz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/osmo-sip-connector-1.4.0/.gitignore 
new/osmo-sip-connector-1.6.0/.gitignore
--- old/osmo-sip-connector-1.4.0/.gitignore     1970-01-01 01:00:00.000000000 
+0100
+++ new/osmo-sip-connector-1.6.0/.gitignore     2021-11-16 14:52:09.000000000 
+0100
@@ -0,0 +1,38 @@
+*.o
+*.a
+Makefile.in
+Makefile
+.deps
+*.sw?
+.version
+*~
+
+aclocal.m4
+autom4te.cache
+config.log
+config.status
+config.guess
+config.sub
+configure
+compile
+depcomp
+install-sh
+missing
+stamp-h1
+
+osmo-sip-connector
+.tarball-version
+.version
+
+# manuals
+doc/manuals/*.html
+doc/manuals/*.svg
+doc/manuals/*.pdf
+doc/manuals/*__*.png
+doc/manuals/*.check
+doc/manuals/generated/
+doc/manuals/osmomsc-usermanual.xml
+doc/manuals/common
+doc/manuals/build
+
+contrib/osmo-sip-connector.spec
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/osmo-sip-connector-1.4.0/Makefile.am 
new/osmo-sip-connector-1.6.0/Makefile.am
--- old/osmo-sip-connector-1.4.0/Makefile.am    2020-01-02 21:35:01.000000000 
+0100
+++ new/osmo-sip-connector-1.6.0/Makefile.am    2021-11-16 14:52:09.000000000 
+0100
@@ -3,7 +3,13 @@
 SUBDIRS = src tests contrib doc
 
 BUILT_SOURCES = $(top_srcdir)/.version
-EXTRA_DIST = git-version-gen osmoappdesc.py .version
+EXTRA_DIST = \
+            .version \
+            contrib/osmo-sip-connector.spec.in \
+            debian \
+            git-version-gen \
+            osmoappdesc.py \
+            $(NULL)
 
 AM_DISTCHECK_CONFIGURE_FLAGS = \
        --with-systemdsystemunitdir=$$dc_install_base/$(systemdsystemunitdir)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/osmo-sip-connector-1.4.0/configure.ac 
new/osmo-sip-connector-1.6.0/configure.ac
--- old/osmo-sip-connector-1.4.0/configure.ac   2020-01-02 21:35:01.000000000 
+0100
+++ new/osmo-sip-connector-1.6.0/configure.ac   2021-11-16 14:52:09.000000000 
+0100
@@ -18,13 +18,15 @@
 RELMAKE='-include osmo-release.mk'
 AC_SUBST([RELMAKE])
 
+CFLAGS="$CFLAGS -std=gnu11"
+
 dnl kernel style compile messages
 m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
 AC_PROG_CC
 
-PKG_CHECK_MODULES(LIBOSMOCORE, libosmocore >= 1.0.0)
-PKG_CHECK_MODULES(LIBOSMOGSM, libosmogsm >= 1.0.0)
-PKG_CHECK_MODULES(LIBOSMOVTY, libosmovty >= 1.0.0)
+PKG_CHECK_MODULES(LIBOSMOCORE, libosmocore >= 1.5.0)
+PKG_CHECK_MODULES(LIBOSMOGSM, libosmogsm >= 1.5.0)
+PKG_CHECK_MODULES(LIBOSMOVTY, libosmovty >= 1.5.0)
 PKG_CHECK_MODULES(SOFIASIP, sofia-sip-ua-glib >= 1.12.0)
 
 AC_ARG_ENABLE(sanitize,
@@ -146,6 +148,7 @@
        doc/manuals/Makefile
        contrib/Makefile
        contrib/systemd/Makefile
+       contrib/osmo-sip-connector.spec
        doc/Makefile
        doc/examples/Makefile
        Makefile)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/osmo-sip-connector-1.4.0/contrib/jenkins.sh 
new/osmo-sip-connector-1.6.0/contrib/jenkins.sh
--- old/osmo-sip-connector-1.4.0/contrib/jenkins.sh     2020-01-02 
21:35:01.000000000 +0100
+++ new/osmo-sip-connector-1.6.0/contrib/jenkins.sh     2021-11-16 
14:52:09.000000000 +0100
@@ -28,7 +28,6 @@
 # Additional configure options and depends
 CONFIG=""
 if [ "$WITH_MANUALS" = "1" ]; then
-       osmo-build-dep.sh osmo-gsm-manuals
        CONFIG="--enable-manuals"
 fi
 
@@ -45,12 +44,12 @@
 $MAKE $PARALLEL_MAKE
 $MAKE check \
   || cat-testlogs.sh
-DISTCHECK_CONFIGURE_FLAGS="$CONFIG" $MAKE distcheck \
+DISTCHECK_CONFIGURE_FLAGS="$CONFIG" $MAKE $PARALLEL_MAKE distcheck \
   || cat-testlogs.sh
 
 if [ "$WITH_MANUALS" = "1" ] && [ "$PUBLISH" = "1" ]; then
        make -C "$base/doc/manuals" publish
 fi
 
-$MAKE maintainer-clean
+$MAKE $PARALLEL_MAKE maintainer-clean
 osmo-clean-workspace.sh
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/osmo-sip-connector-1.4.0/contrib/osmo-sip-connector.spec.in 
new/osmo-sip-connector-1.6.0/contrib/osmo-sip-connector.spec.in
--- old/osmo-sip-connector-1.4.0/contrib/osmo-sip-connector.spec.in     
1970-01-01 01:00:00.000000000 +0100
+++ new/osmo-sip-connector-1.6.0/contrib/osmo-sip-connector.spec.in     
2021-11-16 14:52:09.000000000 +0100
@@ -0,0 +1,79 @@
+#
+# spec file for package osmo-sip-connector
+#
+# Copyright (c) 2016, Martin Hauke <mar...@gmx.de>
+#
+# All modifications and additions to the file contributed by third parties
+# remain the property of their copyright owners, unless otherwise agreed
+# upon. The license for this file, and modifications and additions to the
+# file, is the same license as for the pristine package itself (unless the
+# license for the pristine package is not an Open Source License, in which
+# case the license is the MIT License). An "Open Source License" is a
+# license that conforms to the Open Source Definition (Version 1.9)
+# published by the Open Source Initiative.
+
+Name:           osmo-sip-connector
+Version:        @VERSION@
+Release:        0
+Summary:        MNCC to SIP bridge for osmo-nitb
+License:        AGPL-3.0-or-later AND GPL-2.0-or-later
+Group:          Productivity/Telephony/Servers
+URL:            https://osmocom.org/projects/osmo-sip-conector
+Source:         %{name}-%{version}.tar.xz
+BuildRequires:  autoconf
+BuildRequires:  automake
+BuildRequires:  libtool
+BuildRequires:  pkgconfig >= 0.20
+%if 0%{?suse_version}
+BuildRequires:  systemd-rpm-macros
+%endif
+BuildRequires:  pkgconfig(libosmocore) >= 1.5.0
+BuildRequires:  pkgconfig(libosmogsm) >= 1.5.0
+BuildRequires:  pkgconfig(libosmovty) >= 1.5.0
+BuildRequires:  pkgconfig(sofia-sip-ua-glib) >= 1.12.0
+%{?systemd_requires}
+
+%description
+Use the osmo-nitb MNCC interface and bridge it to SIP.
+
+%prep
+%setup -q
+
+%build
+echo "%{version}" >.tarball-version
+autoreconf -fi
+%configure \
+  --docdir="%{_docdir}/%{name}" \
+  --with-systemdsystemunitdir=%{_unitdir}
+make %{?_smp_mflags}
+
+%install
+%make_install
+
+%if 0%{?suse_version}
+%preun
+%service_del_preun %{name}.service
+
+%postun
+%service_del_postun %{name}.service
+
+%pre
+%service_add_pre %{name}.service
+
+%post
+%service_add_post %{name}.service
+%endif
+
+%check
+make %{?_smp_mflags} check || (find . -name testsuite.log -exec cat {} +)
+
+%files
+%license COPYING
+%doc README.asciidoc
+%doc %{_docdir}/%{name}/examples
+%{_bindir}/osmo-sip-connector
+%dir %{_sysconfdir}/osmocom
+%config(noreplace) %{_sysconfdir}/osmocom/osmo-sip-connector.cfg
+%{_unitdir}/%{name}.service
+
+%changelog
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/osmo-sip-connector-1.4.0/debian/changelog 
new/osmo-sip-connector-1.6.0/debian/changelog
--- old/osmo-sip-connector-1.4.0/debian/changelog       2020-01-02 
21:35:01.000000000 +0100
+++ new/osmo-sip-connector-1.6.0/debian/changelog       2021-11-16 
14:52:09.000000000 +0100
@@ -1,3 +1,61 @@
+osmo-sip-connector (1.6.0) unstable; urgency=medium
+
+  [ Neels Hofmeyr ]
+  * fix use-after-free in SIP re-INVITE
+  * SIP re-INVITE: fix media connection change detection
+  * SIP re-INVITE: log media connection
+
+  [ Oliver Smith ]
+  * debian/control: remove dh-systemd build-depend
+
+  [ Keith ]
+  * MNCC v8: Implement Basic Support for Global Call Reference.
+
+  [ Vadim Yanitskiy ]
+  * sip: fix memory leak (x_gcr) in send_invite()
+  * sip: use osmo_{enc,dec}_gcr() from libosmocore
+  * mncc: rework passing GCR over the MNCC interface
+
+ -- Pau Espin Pedrol <pes...@sysmocom.de>  Tue, 16 Nov 2021 14:52:09 +0100
+
+osmo-sip-connector (1.5.0) unstable; urgency=medium
+
+  [ Vadim Yanitskiy ]
+  * debian/control: change maintainer to the Osmocom team / mailing list
+
+  [ Matt Johnson ]
+  * sip: Specify invite contact tag
+
+  [ Alexander Couzens ]
+  * Revert "sip: Specify invite contact tag"
+  * mncc: remove callref argument from mncc_write()
+  * mncc: add return code for write/send function
+  * mncc: Introduce mncc_rtp_write similiar to mncc_write
+  * mncc: mncc_create_remote_leg: use mncc_write instead of write direct to 
the fd
+
+  [ Pau Espin Pedrol ]
+  * mncc: Support IPv6 addresses (new version mncc 7)
+  * sdp: Don't select addresses failing to parse
+  * contrib/jenkins: Enable parallel make in make distcheck
+  * mncc: Log write error code
+  * .gitignore: Get rid of new autofoo tmp files
+  * mncc: Fix write len
+
+  [ Oliver Smith ]
+  * contrib/jenkins: don't build osmo-gsm-manuals
+  * configure.ac: set -std=gnu11
+
+ -- Pau Espin Pedrol <pes...@espeweb.net>  Tue, 23 Feb 2021 13:42:08 +0100
+
+osmo-sip-connector (1.4.1) unstable; urgency=medium
+
+  [ Oliver Smith ]
+  * contrib: import RPM spec
+  * contrib: integrate RPM spec
+  * Makefile.am: EXTRA_DIST: debian, contrib/*.spec.in
+
+ -- Harald Welte <lafo...@osmocom.org>  Thu, 13 Aug 2020 12:38:16 +0200
+
 osmo-sip-connector (1.4.0) unstable; urgency=medium
 
   [ Keith ]
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/osmo-sip-connector-1.4.0/debian/control 
new/osmo-sip-connector-1.6.0/debian/control
--- old/osmo-sip-connector-1.4.0/debian/control 2020-01-02 21:35:01.000000000 
+0100
+++ new/osmo-sip-connector-1.6.0/debian/control 2021-11-16 14:52:09.000000000 
+0100
@@ -1,15 +1,14 @@
 Source: osmo-sip-connector
 Section: net
 Priority: optional
-Maintainer: Holger Hans Peter Freyther <hol...@moiji-mobile.com>
+Maintainer: Osmocom team <open...@lists.osmocom.org>
 Build-Depends: debhelper (>= 7.0.0~),
                autotools-dev,
                pkg-config,
                libsofia-sip-ua-glib-dev,
                libsofia-sip-ua-dev,
-               dh-systemd (>= 1.5),
                dh-autoreconf,
-               libosmocore-dev (>= 1.0.0),
+               libosmocore-dev (>= 1.5.0),
                osmo-gsm-manuals-dev
 Standards-Version: 3.8.4
 Homepage: https://osmocom.org/projects/osmo-sip-conector/wiki
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/osmo-sip-connector-1.4.0/src/call.h 
new/osmo-sip-connector-1.6.0/src/call.h
--- old/osmo-sip-connector-1.4.0/src/call.h     2020-01-02 21:35:01.000000000 
+0100
+++ new/osmo-sip-connector-1.6.0/src/call.h     2021-11-16 14:52:09.000000000 
+0100
@@ -5,8 +5,10 @@
 #include <osmocom/core/linuxlist.h>
 #include <osmocom/core/timer.h>
 #include <osmocom/core/utils.h>
+#include <osmocom/gsm/gsm29205.h>
 
 #include <stdbool.h>
+#include <netinet/in.h>
 
 struct sip_agent;
 struct mncc_connection;
@@ -30,6 +32,10 @@
 
        const char *source;
        const char *dest;
+
+       /* Global Call Reference */
+       struct osmo_gcr_parsed gcr;
+       bool gcr_present;
 };
 
 enum {
@@ -49,8 +55,7 @@
        /**
         * RTP data
         */
-       uint32_t        ip;
-       uint16_t        port;
+       struct sockaddr_storage addr;
        uint32_t        payload_type;
        uint32_t        payload_msg_type;
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/osmo-sip-connector-1.4.0/src/mncc.c 
new/osmo-sip-connector-1.6.0/src/mncc.c
--- old/osmo-sip-connector-1.4.0/src/mncc.c     2020-01-02 21:35:01.000000000 
+0100
+++ new/osmo-sip-connector-1.6.0/src/mncc.c     2021-11-16 14:52:09.000000000 
+0100
@@ -130,7 +130,7 @@
        }
 }
 
-static void mncc_write(struct mncc_connection *conn, struct gsm_mncc *mncc, 
uint32_t callref)
+static int mncc_write(struct mncc_connection *conn, struct gsm_mncc *mncc)
 {
        int rc;
 
@@ -141,32 +141,43 @@
        rc = write(conn->fd.fd, mncc, sizeof(*mncc));
        LOGP(DMNCC, LOGL_DEBUG, "MNCC sent message type: %s\n", 
osmo_mncc_name(mncc->msg_type));
        if (rc != sizeof(*mncc)) {
-               LOGP(DMNCC, LOGL_ERROR, "Failed to send message for 
call(%u)\n", callref);
+               LOGP(DMNCC, LOGL_ERROR, "Failed to send message for 
call(%u)\n", mncc->callref);
                close_connection(conn);
        }
+
+       return rc;
 }
 
-static void mncc_send(struct mncc_connection *conn, uint32_t msg_type, 
uint32_t callref)
+static int mncc_send(struct mncc_connection *conn, uint32_t msg_type, uint32_t 
callref)
 {
        struct gsm_mncc mncc = { 0, };
 
        mncc_fill_header(&mncc, msg_type, callref);
-       mncc_write(conn, &mncc, callref);
+       return mncc_write(conn, &mncc);
 }
 
-static void mncc_rtp_send(struct mncc_connection *conn, uint32_t msg_type, 
uint32_t callref)
+static int mncc_rtp_write(struct mncc_connection *conn, struct gsm_mncc_rtp 
*rtp)
 {
        int rc;
+
+       rc = write(conn->fd.fd, rtp, sizeof(*rtp));
+       LOGP(DMNCC, LOGL_DEBUG, "MNCC sent message type: %s\n", 
osmo_mncc_name(rtp->msg_type));
+       if (rc != sizeof(*rtp)) {
+               LOGP(DMNCC, LOGL_ERROR, "Failed to send message for call(%u): 
%d\n", rtp->callref, rc);
+               close_connection(conn);
+       }
+
+       return rc;
+}
+
+static int mncc_rtp_send(struct mncc_connection *conn, uint32_t msg_type, 
uint32_t callref)
+{
        struct gsm_mncc_rtp mncc = { 0, };
 
        mncc.msg_type = msg_type;
        mncc.callref = callref;
 
-       rc = write(conn->fd.fd, &mncc, sizeof(mncc));
-       if (rc != sizeof(mncc)) {
-               LOGP(DMNCC, LOGL_ERROR, "Failed to send message for 
call(%u)\n", callref);
-               close_connection(conn);
-       }
+       return mncc_rtp_write(conn, &mncc);
 }
 
 /* Send a MNCC_RTP_CONNECT to the MSC for the given call legs */
@@ -174,7 +185,7 @@
 {
        struct gsm_mncc_rtp mncc = { 0, };
        int rc;
-       char ip_addr[INET_ADDRSTRLEN];
+       char ip_addr[INET6_ADDRSTRLEN];
 
        /*
         * Send RTP CONNECT and we handle the general failure of it by
@@ -182,17 +193,16 @@
         */
        mncc.msg_type = MNCC_RTP_CONNECT;
        mncc.callref = leg->callref;
-       mncc.ip = ntohl(other->ip);
-       mncc.port = other->port;
+       mncc.addr = other->addr;
        mncc.payload_type = other->payload_type;
        /*
         * FIXME: mncc.payload_msg_type should already be compatible.. but
         * payload_type should be different..
         */
-       struct in_addr net = { .s_addr = other->ip };
-       inet_ntop(AF_INET, &net, ip_addr, sizeof(ip_addr));
-       LOGP(DMNCC, LOGL_DEBUG, "SEND rtp_connect: IP=(%s) PORT=(%u)\n", 
ip_addr, mncc.port);
-       rc = write(leg->conn->fd.fd, &mncc, sizeof(mncc));
+       LOGP(DMNCC, LOGL_DEBUG, "SEND rtp_connect: IP=(%s) PORT=(%u)\n",
+            osmo_sockaddr_ntop((const struct sockaddr*)&other->addr, ip_addr),
+            osmo_sockaddr_port((const struct sockaddr*)&other->addr));
+       rc = mncc_rtp_write(leg->conn, &mncc);
        if (rc != sizeof(mncc)) {
                LOGP(DMNCC, LOGL_ERROR, "Failed to send message for call(%u)\n",
                        leg->callref);
@@ -265,14 +275,15 @@
        out_mncc.progress.location = GSM48_CAUSE_LOC_PRN_S_LU; /* Private 
network serving the local user */
        out_mncc.progress.descr = GSM48_PROGR_IN_BAND_AVAIL; /* In-band 
information or appropriate pattern now available */
 
-       mncc_write(leg->conn, &out_mncc, leg->callref);
+       mncc_write(leg->conn, &out_mncc);
 
        /*
         * If we have remote IP/port let's connect it already.
         * FIXME: We would like to keep this as recvonly...
         */
        other_leg = call_leg_other(&leg->base);
-       if (other_leg && other_leg->port != 0 && other_leg->ip != 0)
+       if (other_leg && other_leg->addr.ss_family != AF_UNSPEC &&
+           osmo_sockaddr_port((const struct sockaddr *)&other_leg->addr) != 0)
                send_rtp_connect(leg, other_leg);
 }
 
@@ -393,11 +404,14 @@
        leg = mncc_find_leg_not_released(rtp->callref);
        if (!leg) {
                LOGP(DMNCC, LOGL_ERROR, "leg(%u) can not be found\n", 
rtp->callref);
-               return mncc_send(conn, MNCC_REJ_REQ, rtp->callref);
+               mncc_send(conn, MNCC_REJ_REQ, rtp->callref);
+               return;
        }
 
        /* extract information about where the RTP is */
-       if (rtp->ip != 0 || rtp->port != 0 || rtp->payload_type != 0)
+       if (rtp->addr.ss_family != AF_UNSPEC ||
+           osmo_sockaddr_port((const struct sockaddr *)&rtp->addr) != 0 ||
+           rtp->payload_type != 0)
                return;
 
        LOGP(DMNCC, LOGL_ERROR, "leg(%u) rtp connect failed\n", rtp->callref);
@@ -412,7 +426,7 @@
 {
        const struct gsm_mncc_rtp *rtp;
        struct mncc_call_leg *leg;
-       char ip_addr[INET_ADDRSTRLEN];
+       char ip_addr[INET6_ADDRSTRLEN];
 
        if (rc < sizeof(*rtp)) {
                LOGP(DMNCC, LOGL_ERROR, "gsm_mncc_rtp of wrong size %d < %zu\n",
@@ -424,21 +438,21 @@
        leg = mncc_find_leg_not_released(rtp->callref);
        if (!leg) {
                LOGP(DMNCC, LOGL_ERROR, "call(%u) can not be found\n", 
rtp->callref);
-               return mncc_send(conn, MNCC_REJ_REQ, rtp->callref);
+               mncc_send(conn, MNCC_REJ_REQ, rtp->callref);
+               return;
        }
 
        /* extract information about where the RTP is */
-       leg->base.ip = htonl(rtp->ip);
-       leg->base.port = rtp->port;
+       leg->base.addr = rtp->addr;
        leg->base.payload_type = rtp->payload_type;
        leg->base.payload_msg_type = rtp->payload_msg_type;
 
        /* TODO.. now we can continue with the call */
-       struct in_addr net = { .s_addr = leg->base.ip };
-       inet_ntop(AF_INET, &net, ip_addr, sizeof(ip_addr));
        LOGP(DMNCC, LOGL_INFO,
                "RTP continue leg(%u) ip(%s), port(%u) pt(%u) ptm(%u)\n",
-               leg->callref, ip_addr, leg->base.port,
+               leg->callref,
+               osmo_sockaddr_ntop((const struct sockaddr*)&leg->base.addr, 
ip_addr),
+               osmo_sockaddr_port((const struct sockaddr*)&leg->base.addr),
                leg->base.payload_type, leg->base.payload_msg_type);
        stop_cmd_timer(leg, MNCC_RTP_CREATE);
        continue_call(leg);
@@ -471,6 +485,7 @@
        const struct gsm_mncc_number *called;
        struct call *call;
        struct mncc_call_leg *leg;
+       struct osmo_gcr_parsed gcr;
 
        if (rc < sizeof(*data)) {
                LOGP(DMNCC, LOGL_ERROR, "gsm_mncc of wrong size %d vs. %zu\n",
@@ -487,7 +502,8 @@
                        LOGP(DMNCC, LOGL_ERROR,
                                "MNCC leg(%u) without called addr fields(%u)\n",
                                data->callref, data->fields);
-                       return mncc_send(conn, MNCC_REJ_REQ, data->callref);
+                       mncc_send(conn, MNCC_REJ_REQ, data->callref);
+                       return;
                }
 
                /* Emergency without a called number present. Use the standard 
"emergency" number. */
@@ -498,14 +514,26 @@
                LOGP(DMNCC, LOGL_ERROR,
                        "MNCC leg(%u) without calling addr fields(%u)\n",
                        data->callref, data->fields);
-               return mncc_send(conn, MNCC_REJ_REQ, data->callref);
+               mncc_send(conn, MNCC_REJ_REQ, data->callref);
+               return;
        }
 
        /* TODO.. bearer caps and better audio handling */
        if (!continue_setup(conn, data)) {
                LOGP(DMNCC, LOGL_ERROR,
                        "MNCC screening parameters failed leg(%u)\n", 
data->callref);
-               return mncc_send(conn, MNCC_REJ_REQ, data->callref);
+               mncc_send(conn, MNCC_REJ_REQ, data->callref);
+               return;
+       }
+
+       /* Decode the Global Call Reference (if present) */
+       if (data->fields & MNCC_F_GCR) {
+               if (osmo_dec_gcr(&gcr, data->gcr, sizeof(data->gcr)) < 0) {
+                       LOGP(DMNCC, LOGL_ERROR,
+                               "MNCC leg(%u) failed to parse GCR\n", 
data->callref);
+                       mncc_send(conn, MNCC_REJ_REQ, data->callref);
+                       return;
+               }
        }
 
        /* Create an RTP port and then allocate a call */
@@ -513,7 +541,8 @@
        if (!call) {
                LOGP(DMNCC, LOGL_ERROR,
                        "MNCC leg(%u) failed to allocate call\n", 
data->callref);
-               return mncc_send(conn, MNCC_REJ_REQ, data->callref);
+               mncc_send(conn, MNCC_REJ_REQ, data->callref);
+               return;
        }
 
        leg = (struct mncc_call_leg *) call->initial;
@@ -529,6 +558,11 @@
        memcpy(&leg->calling, &data->calling, sizeof(leg->calling));
        memcpy(&leg->imsi, data->imsi, sizeof(leg->imsi));
 
+       if (data->fields & MNCC_F_GCR) {
+               leg->base.call->gcr_present = true;
+               leg->base.call->gcr = gcr;
+       }
+
        LOGP(DMNCC, LOGL_INFO,
                "Created call(%u) with MNCC leg(%u) IMSI(%.16s)\n",
                call->id, leg->callref, data->imsi);
@@ -806,7 +840,7 @@
        mncc_fill_header(&out_mncc, MNCC_START_DTMF_RSP, leg->callref);
        out_mncc.fields |= MNCC_F_KEYPAD;
        out_mncc.keypad = data->keypad;
-       mncc_write(conn, &out_mncc, leg->callref);
+       mncc_write(conn, &out_mncc);
 }
 
 static void check_dtmf_stop(struct mncc_connection *conn, const char *buf, int 
rc)
@@ -824,7 +858,7 @@
        mncc_fill_header(&out_mncc, MNCC_STOP_DTMF_RSP, leg->callref);
        out_mncc.fields |= MNCC_F_KEYPAD;
        out_mncc.keypad = data->keypad;
-       mncc_write(conn, &out_mncc, leg->callref);
+       mncc_write(conn, &out_mncc);
 }
 
 static void check_hello(struct mncc_connection *conn, const char *buf, int rc)
@@ -853,6 +887,7 @@
 {
        struct mncc_call_leg *leg;
        struct gsm_mncc mncc = { 0, };
+       struct msgb *msg;
        int rc;
 
        leg = talloc_zero(call, struct mncc_call_leg);
@@ -898,17 +933,26 @@
                OSMO_STRLCPY_ARRAY(mncc.called.number, call->dest);
        }
 
+       /* Encode the Global Call Reference (if present) */
+       if (call->gcr_present) {
+               msg = msgb_alloc(sizeof(mncc.gcr), "MNCC GCR");
+               if (msg == NULL || (rc = osmo_enc_gcr(msg, &call->gcr)) == 0)
+                       LOGP(DMNCC, LOGL_ERROR, "MNCC leg(%u) failed to encode 
GCR\n", call->id);
+               else
+                       memcpy(&mncc.gcr[0], msg->data, rc);
+               msgb_free(msg);
+       }
+
        /*
         * TODO/FIXME:
         *  - Determine/request channel based on offered audio codecs
         *  - Screening, redirect?
         *  - Synth. the bearer caps based on codecs?
         */
-       rc = write(conn->fd.fd, &mncc, sizeof(mncc));
+       rc = mncc_write(conn, &mncc);
        if (rc != sizeof(mncc)) {
                LOGP(DMNCC, LOGL_ERROR, "Failed to send message leg(%u)\n",
                        leg->callref);
-               close_connection(conn);
                talloc_free(leg);
                return -1;
        }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/osmo-sip-connector-1.4.0/src/mncc_protocol.h 
new/osmo-sip-connector-1.6.0/src/mncc_protocol.h
--- old/osmo-sip-connector-1.4.0/src/mncc_protocol.h    2020-01-02 
21:35:01.000000000 +0100
+++ new/osmo-sip-connector-1.6.0/src/mncc_protocol.h    2021-11-16 
14:52:09.000000000 +0100
@@ -1,4 +1,4 @@
-/* GSM Mobile Radio Interface Layer 3 messages on the A-bis interface 
+/* GSM Mobile Radio Interface Layer 3 messages on the A-bis interface
  * 3GPP TS 04.08 version 7.21.0 Release 1998 / ETSI TS 100 940 V7.21.0 */
 
 /* (C) 2008-2009 by Harald Welte <lafo...@gnumonks.org>
@@ -28,6 +28,7 @@
 #include <osmocom/gsm/mncc.h>
 
 #include <stdint.h>
+#include <netinet/in.h>
 
 struct gsm_network;
 struct msgb;
@@ -122,6 +123,7 @@
 #define MNCC_F_CCCAP           0x0800
 #define MNCC_F_KEYPAD          0x1000
 #define MNCC_F_SIGNAL          0x2000
+#define MNCC_F_GCR             0x4000
 
 struct gsm_mncc {
        /* context based information */
@@ -159,6 +161,9 @@
        unsigned char   lchan_type;
        unsigned char   lchan_mode;
 
+       /* Global Call Reference (encoded as per 3GPP TS 29.205) */
+       uint8_t         gcr[16];
+
        /* A buffer to contain SDP ('\0' terminated) */
        char            sdp[1024];
 };
@@ -169,7 +174,7 @@
        unsigned char   data[0];
 };
 
-#define MNCC_SOCK_VERSION      6
+#define MNCC_SOCK_VERSION      8
 struct gsm_mncc_hello {
        uint32_t        msg_type;
        uint32_t        version;
@@ -188,8 +193,7 @@
 struct gsm_mncc_rtp {
        uint32_t        msg_type;
        uint32_t        callref;
-       uint32_t        ip;
-       uint16_t        port;
+       struct sockaddr_storage addr;
        uint32_t        payload_type;
        uint32_t        payload_msg_type;
        char            sdp[1024];
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/osmo-sip-connector-1.4.0/src/sdp.c 
new/osmo-sip-connector-1.6.0/src/sdp.c
--- old/osmo-sip-connector-1.4.0/src/sdp.c      2020-01-02 21:35:01.000000000 
+0100
+++ new/osmo-sip-connector-1.6.0/src/sdp.c      2021-11-16 14:52:09.000000000 
+0100
@@ -32,6 +32,8 @@
 
 #include <string.h>
 
+#include <osmocom/core/socket.h>
+
 /*
  * Check if the media mode attribute exists in SDP, in this
  * case update the passed pointer with the media mode
@@ -66,8 +68,8 @@
                return sdp_sendrecv;
        }
 
-       sdp_parser_free(parser);
        *mode = sdp->sdp_media->m_mode;
+       sdp_parser_free(parser);
        return true;
 }
 
@@ -136,6 +138,7 @@
        sdp_parser_t *parser;
        sdp_media_t *media;
        const char *sdp_data;
+       uint16_t port;
        bool found_conn = false, found_map = false;
 
        if (!sip->sip_payload || !sip->sip_payload->pl_data) {
@@ -159,12 +162,22 @@
        }
 
        for (conn = sdp->sdp_connection; conn; conn = conn->c_next) {
-               struct in_addr addr;
-
-               if (conn->c_addrtype != sdp_addr_ip4)
+               switch (conn->c_addrtype) {
+               case sdp_addr_ip4:
+                       if (inet_pton(AF_INET, conn->c_address,
+                                     &((struct 
sockaddr_in*)&leg->base.addr)->sin_addr) != 1)
+                               continue;
+                       leg->base.addr.ss_family = AF_INET;
+                       break;
+               case sdp_addr_ip6:
+                       if (inet_pton(AF_INET6, conn->c_address,
+                                     &((struct 
sockaddr_in6*)&leg->base.addr)->sin6_addr) != 1)
+                               continue;
+                       leg->base.addr.ss_family = AF_INET6;
+                       break;
+               default:
                        continue;
-               inet_aton(conn->c_address, &addr);
-               leg->base.ip = addr.s_addr;
+               }
                found_conn = true;
                break;
        }
@@ -181,7 +194,7 @@
                        if (!any_codec && strcasecmp(map->rm_encoding, 
leg->wanted_codec) != 0)
                                continue;
 
-                       leg->base.port = media->m_port;
+                       port = media->m_port;
                        leg->base.payload_type = map->rm_pt;
                        found_map = true;
                        break;
@@ -198,18 +211,30 @@
                return false;
        }
 
+       switch (leg->base.addr.ss_family) {
+       case AF_INET:
+               ((struct sockaddr_in*)&leg->base.addr)->sin_port = htons(port);
+               break;
+       case AF_INET6:
+               ((struct sockaddr_in6*)&leg->base.addr)->sin6_port = 
htons(port);
+               break;
+       default:
+               OSMO_ASSERT(0);
+       }
+
        sdp_parser_free(parser);
        return true;
 }
 
 char *sdp_create_file(struct sip_call_leg *leg, struct call_leg *other, 
sdp_mode_t mode)
 {
-       struct in_addr net = { .s_addr = other->ip };
        char *fmtp_str = NULL, *sdp;
        char *mode_attribute;
-       char ip_addr[INET_ADDRSTRLEN];
+       char ip_addr[INET6_ADDRSTRLEN];
+       char ipv;
 
-       inet_ntop(AF_INET, &net, ip_addr, sizeof(ip_addr));
+       osmo_sockaddr_ntop((const struct sockaddr*)&other->addr, ip_addr);
+       ipv = other->addr.ss_family == AF_INET6 ? '6' : '4';
        leg->wanted_codec = app_media_name(other->payload_msg_type);
 
        if (strcmp(leg->wanted_codec, "AMR") == 0)
@@ -235,16 +260,17 @@
 
        sdp = talloc_asprintf(leg,
                                "v=0\r\n"
-                               "o=Osmocom 0 0 IN IP4 %s\r\n"
+                               "o=Osmocom 0 0 IN IP%c %s\r\n"
                                "s=GSM Call\r\n"
-                               "c=IN IP4 %s\r\n"
+                               "c=IN IP%c %s\r\n"
                                "t=0 0\r\n"
                                "m=audio %d RTP/AVP %d\r\n"
                                "%s"
                                "a=rtpmap:%d %s/8000\r\n"
                                "%s",
-                               ip_addr, ip_addr,
-                               other->port, other->payload_type,
+                               ipv, ip_addr, ipv, ip_addr,
+                               osmo_sockaddr_port((const struct sockaddr 
*)&other->addr),
+                               other->payload_type,
                                fmtp_str ? fmtp_str : "",
                                other->payload_type,
                                leg->wanted_codec,
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/osmo-sip-connector-1.4.0/src/sip.c 
new/osmo-sip-connector-1.6.0/src/sip.c
--- old/osmo-sip-connector-1.4.0/src/sip.c      2020-01-02 21:35:01.000000000 
+0100
+++ new/osmo-sip-connector-1.6.0/src/sip.c      2021-11-16 14:52:09.000000000 
+0100
@@ -25,6 +25,8 @@
 #include "sdp.h"
 
 #include <osmocom/core/utils.h>
+#include <osmocom/core/socket.h>
+#include <osmocom/gsm/tlv.h>
 
 #include <sofia-sip/sip_status.h>
 #include <sofia-sip/su_log.h>
@@ -33,6 +35,7 @@
 #include <talloc.h>
 
 #include <string.h>
+#include <netinet/in.h>
 
 extern void *tall_mncc_ctx;
 
@@ -110,10 +113,22 @@
        struct call *call;
        struct sip_call_leg *leg;
        const char *from = NULL, *to = NULL;
-       char ip_addr[INET_ADDRSTRLEN];
+       char ip_addr[INET6_ADDRSTRLEN];
+       bool xgcr_hdr_present = false;
+       uint8_t xgcr_hdr[28] = { 0 };
 
        LOGP(DSIP, LOGL_INFO, "Incoming call(%s) handle(%p)\n", 
sip->sip_call_id->i_id, nh);
 
+       sip_unknown_t *unknown_header = sip->sip_unknown;
+       while (unknown_header != NULL) {
+               if (!strcmp("X-Global-Call-Ref", unknown_header->un_name)) {
+                       osmo_hexparse(unknown_header->un_value, xgcr_hdr, 
sizeof(xgcr_hdr));
+                       xgcr_hdr_present = true;
+                       break;
+               }
+               unknown_header = unknown_header->un_next;
+       }
+
        if (!sdp_screen_sdp(sip)) {
                LOGP(DSIP, LOGL_ERROR, "No supported codec.\n");
                nua_respond(nh, SIP_406_NOT_ACCEPTABLE, TAG_END());
@@ -129,6 +144,17 @@
                return;
        }
 
+       /* Decode Decode the Global Call Reference (if present) */
+       if (xgcr_hdr_present) {
+               if (osmo_dec_gcr(&call->gcr, xgcr_hdr, sizeof(xgcr_hdr)) < 0) {
+                       LOGP(DSIP, LOGL_ERROR, "Failed to parse 
X-Global-Call-Ref.\n");
+                       nua_respond(nh, SIP_406_NOT_ACCEPTABLE, TAG_END());
+                       nua_handle_destroy(nh);
+                       return;
+               }
+               call->gcr_present = true;
+       }
+
        if (sip->sip_to)
                to = sip->sip_to->a_url->url_user;
        if (sip->sip_from)
@@ -159,11 +185,9 @@
                call_leg_release(&leg->base);
                return;
        }
-       struct in_addr net = { .s_addr = leg->base.ip };
-       inet_ntop(AF_INET, &net, ip_addr, sizeof(ip_addr));
        LOGP(DSIP, LOGL_INFO, "SDP Extracted: IP=(%s) PORT=(%u) 
PAYLOAD=(%u).\n",
-                              ip_addr,
-                              leg->base.port,
+                              osmo_sockaddr_ntop((const struct sockaddr 
*)&leg->base.addr, ip_addr),
+                              osmo_sockaddr_port((const struct sockaddr 
*)&leg->base.addr),
                               leg->base.payload_type);
 
        leg->base.release_call = sip_release_call;
@@ -186,9 +210,8 @@
 
        char *sdp;
        sdp_mode_t mode = sdp_sendrecv;
-       uint32_t ip = leg->base.ip;
-       uint16_t port = leg->base.port;
-       char ip_addr[INET_ADDRSTRLEN];
+       char ip_addr[INET6_ADDRSTRLEN];
+       struct sockaddr_storage prev_addr = leg->base.addr;
 
        LOGP(DSIP, LOGL_INFO, "re-INVITE for call %s\n", 
sip->sip_call_id->i_id);
 
@@ -214,9 +237,9 @@
                return;
        }
 
-       struct in_addr net = { .s_addr = leg->base.ip };
-       inet_ntop(AF_INET, &net, ip_addr, sizeof(ip_addr));
-       LOGP(DSIP, LOGL_DEBUG, "pre re-INVITE have IP:port (%s:%u)\n", ip_addr, 
leg->base.port);
+       LOGP(DSIP, LOGL_DEBUG, "pre re-INVITE have IP:port (%s:%u)\n",
+            osmo_sockaddr_ntop((struct sockaddr*)&prev_addr, ip_addr),
+            osmo_sockaddr_port((struct sockaddr*)&prev_addr));
 
        if (mode == sdp_sendonly) {
                /* SIP side places call on HOLD */
@@ -231,13 +254,20 @@
                        call_leg_release(&leg->base);
                        return;
                }
-               struct in_addr net = { .s_addr = leg->base.ip };
-               inet_ntop(AF_INET, &net, ip_addr, sizeof(ip_addr));
-               LOGP(DSIP, LOGL_DEBUG, "Media IP:port in re-INVITE: (%s:%u)\n", 
ip_addr, leg->base.port);
-               if (ip != leg->base.ip || port != leg->base.port) {
-                       LOGP(DSIP, LOGL_INFO, "re-INVITE changes media 
connection.\n");
+               LOGP(DSIP, LOGL_DEBUG, "Media IP:port in re-INVITE: (%s:%u)\n",
+                    osmo_sockaddr_ntop((struct sockaddr*)&leg->base.addr, 
ip_addr),
+                    osmo_sockaddr_port((struct sockaddr*)&leg->base.addr));
+               if (osmo_sockaddr_cmp((struct osmo_sockaddr *)&prev_addr,
+                                     (struct osmo_sockaddr *)&leg->base.addr)) 
{
+                       LOGP(DSIP, LOGL_INFO, "re-INVITE changes media 
connection to %s:%u\n",
+                            osmo_sockaddr_ntop((struct 
sockaddr*)&leg->base.addr, ip_addr),
+                            osmo_sockaddr_port((struct 
sockaddr*)&leg->base.addr));
                        if (other->update_rtp)
                                other->update_rtp(leg->base.call->remote);
+               } else {
+                       LOGP(DSIP, LOGL_INFO, "re-INVITE does not change media 
connection (%s:%u)\n",
+                            osmo_sockaddr_ntop((struct sockaddr*)&prev_addr, 
ip_addr),
+                            osmo_sockaddr_port((struct sockaddr*)&prev_addr));
                }
                sdp = sdp_create_file(leg, other, sdp_sendrecv);
        }
@@ -599,6 +629,19 @@
                                agent->app->sip.remote_port);
        char *sdp = sdp_create_file(leg, other, sdp_sendrecv);
 
+       /* Encode the Global Call Reference (if present) */
+       char *x_gcr = NULL;
+
+       if (leg->base.call->gcr_present) {
+               struct msgb *msg = msgb_alloc(16, "SIP GCR");
+
+               if (msg != NULL && osmo_enc_gcr(msg, &leg->base.call->gcr) > 0)
+                       x_gcr = talloc_asprintf(leg, "X-Global-Call-Ref: %s", 
msgb_hexdump(msg));
+               else
+                       LOGP(DSIP, LOGL_ERROR, "Failed to encode GCR for 
leg(%p)\n", leg);
+               msgb_free(msg);
+       }
+
        leg->state = SIP_CC_INITIAL;
        leg->dir = SIP_DIR_MT;
        nua_invite(leg->nua_handle,
@@ -606,6 +649,7 @@
                        SIPTAG_TO_STR(to),
                        NUTAG_MEDIA_ENABLE(0),
                        SIPTAG_CONTENT_TYPE_STR("application/sdp"),
+                       TAG_IF(x_gcr, SIPTAG_HEADER_STR(x_gcr)),
                        SIPTAG_PAYLOAD_STR(sdp),
                        TAG_END());
 
@@ -613,6 +657,7 @@
        talloc_free(from);
        talloc_free(to);
        talloc_free(sdp);
+       talloc_free(x_gcr);
        return 0;
 }
 

Reply via email to