diff --git a/deps/update_pjsip_210/patches/sipsimple_core.patch b/deps/update_pjsip_210/patches/sipsimple_core.patch index a3f520e4..4f1ebf60 100644 --- a/deps/update_pjsip_210/patches/sipsimple_core.patch +++ b/deps/update_pjsip_210/patches/sipsimple_core.patch @@ -1,242 +1,355 @@ -diff -u setup_pjsip.py setup_pjsip.py ---- setup_pjsip.py 2021-03-10 05:41:58.052700196 +0100 -+++ setup_pjsip.py 2021-03-10 05:49:35.309917472 +0100 -@@ -196,7 +196,7 @@ - extension.libraries = self.get_opts_from_string(build_mak_vars["PJ_LDLIBS"], "-l") - extension.define_macros = [tuple(define.split("=", 1)) for define in self.get_opts_from_string(build_mak_vars["PJ_CFLAGS"], "-D")] - extension.define_macros.append(("PJ_SVN_REVISION", open(os.path.join(self.build_dir, "base_rev"), "r").read().strip())) -- extension.define_macros.append(("__PYX_FORCE_INIT_THREADS", 1)) -+ #extension.define_macros.append(("__PYX_FORCE_INIT_THREADS", 1)) - extension.extra_compile_args.append("-Wno-unused-function") # silence warning - - if sys_platform == "darwin": diff -ruN sipsimple/configuration/settings.py sipsimple/configuration/settings.py --- sipsimple/configuration/settings.py 2021-02-18 22:20:23.927865045 +0100 +++ sipsimple/configuration/settings.py 2021-02-06 20:08:25.900660619 +0100 @@ -69,7 +69,7 @@ port_range = Setting(type=PortRange, default=PortRange(50000, 50500)) timeout = Setting(type=NonNegativeInteger, default=30) audio_codec_list = Setting(type=AudioCodecList, default=AudioCodecList(('opus', 'G722', 'PCMU', 'PCMA'))) - video_codec_list = Setting(type=VideoCodecList, default=VideoCodecList(('H264', 'VP8'))) + video_codec_list = Setting(type=VideoCodecList, default=VideoCodecList(('H264', 'VP8', 'VP9'))) def sip_port_validator(port, sibling_port): diff -ruN sipsimple/configuration/datatypes.py sipsimple/configuration/datatypes.py --- sipsimple/configuration/datatypes.py 2021-02-18 22:20:23.927865045 +0100 +++ sipsimple/configuration/datatypes.py 2021-02-06 20:08:25.900660619 +0100 @@ -269,7 +269,7 @@ class VideoCodecList(CodecList): - available_values = {'H264', 'VP8'} + available_values = {'H264', 'VP8', 'VP9'} # Address and transport datatypes diff -ruN sipsimple/core/_core.lib.pxi sipsimple/core/_core.lib.pxi --- sipsimple/core/_core.lib.pxi 2021-02-18 22:20:23.927865045 +0100 +++ sipsimple/core/_core.lib.pxi 2021-02-06 20:08:25.900660619 +0100 @@ -269,7 +269,7 @@ if status != 0: raise PJSIPError("Could not initialize ffmpeg video codecs", status) self._has_ffmpeg_video = 1 - status = pjmedia_codec_vpx_init(NULL, &caching_pool._obj.factory) + status = pjmedia_codec_vpx_vid_init(NULL, &caching_pool._obj.factory) if status != 0: raise PJSIPError("Could not initialize vpx video codecs", status) self._has_vpx = 1 @@ -284,7 +284,7 @@ if self._has_ffmpeg_video: pjmedia_codec_ffmpeg_vid_deinit() if self._has_vpx: - pjmedia_codec_vpx_deinit() + pjmedia_codec_vpx_vid_deinit() if pjmedia_vid_codec_mgr_instance() != NULL: pjmedia_vid_codec_mgr_destroy(NULL) if pjmedia_event_mgr_instance() != NULL: @@ -298,7 +298,6 @@ cdef unsigned int count = PJMEDIA_CODEC_MGR_MAX_CODECS cdef pjmedia_codec_info info[PJMEDIA_CODEC_MGR_MAX_CODECS] cdef unsigned int prio[PJMEDIA_CODEC_MGR_MAX_CODECS] - cdef int i cdef list retval cdef int status status = pjmedia_codec_mgr_enum_codecs(pjmedia_endpt_get_codec_mgr(self._obj), &count, info, prio) @@ -343,7 +342,7 @@ all_codecs = set(self._get_all_codecs()) codec_set = new_codecs.difference(all_codecs) if len(codec_set) > 0: - raise SIPCoreError("Unknown codec(s): %s" % ", ".join(codec_set)) + raise SIPCoreError("Unknown codec(s): %s" % ", ".join(cdc.decode() for cdc in codec_set)) # reverse the codec data tuples so that we can easily sort on sample rate # to make sure that bigger sample rates get higher priority codecs = [list(reversed(codec_data)) for codec_data in self._get_codecs()] @@ -372,7 +371,6 @@ cdef unsigned int count = PJMEDIA_VID_CODEC_MGR_MAX_CODECS cdef pjmedia_vid_codec_info info[PJMEDIA_VID_CODEC_MGR_MAX_CODECS] cdef unsigned int prio[PJMEDIA_VID_CODEC_MGR_MAX_CODECS] - cdef int i cdef list retval cdef int status status = pjmedia_vid_codec_mgr_enum_codecs(NULL, &count, info, prio) @@ -415,7 +413,7 @@ raise ValueError("Requested video codec list contains doubles") codec_set = new_codecs.difference(set(self._get_all_video_codecs())) if len(codec_set) > 0: - raise SIPCoreError("Unknown video codec(s): %s" % ", ".join(codec_set)) + raise SIPCoreError("Unknown video codec(s): %s" % ", ".join(cdc.decode() for cdc in codec_set)) codecs = self._get_video_codecs() codec_prio = list() for codec in req_codecs: @@ -443,7 +441,6 @@ cdef pjmedia_vid_codec_info info[PJMEDIA_VID_CODEC_MGR_MAX_CODECS] cdef pjmedia_vid_codec_param vparam cdef unsigned int prio[PJMEDIA_VID_CODEC_MGR_MAX_CODECS] - cdef int i cdef int status cdef PJSTR h264_profile_level_id_value cdef PJSTR h264_packetization_mode_value = PJSTR(b"1") # TODO; make it configurable? @@ -482,7 +479,6 @@ cdef pjmedia_vid_codec_info info[PJMEDIA_VID_CODEC_MGR_MAX_CODECS] cdef pjmedia_vid_codec_param vparam cdef unsigned int prio[PJMEDIA_VID_CODEC_MGR_MAX_CODECS] - cdef int i cdef int status max_width, max_height = max_resolution diff -ruN sipsimple/core/_core.mediatransport.pxi sipsimple/core/_core.mediatransport.pxi --- sipsimple/core/_core.mediatransport.pxi 2021-02-18 22:20:23.931865157 +0100 +++ sipsimple/core/_core.mediatransport.pxi 2021-02-16 02:49:03.872618274 +0100 @@ -397,7 +397,7 @@ pj_remote_sdp = NULL if sdp_index < 0: raise ValueError("sdp_index argument cannot be negative") - if sdp_index >= pj_local_sdp.media_count: + if sdp_index >= pj_local_sdp.media_count: raise ValueError("sdp_index argument out of range") with nogil: status = pjmedia_transport_media_create(transport, pool, 0, pj_remote_sdp, sdp_index) @@ -488,7 +488,6 @@ def set_INIT(self): global _ice_cb cdef int af - cdef int i cdef int status cdef int port cdef pj_caching_pool *caching_pool @@ -882,7 +881,7 @@ pj_remote_sdp = NULL if sdp_index < 0: raise ValueError("sdp_index argument cannot be negative") - if sdp_index >= pj_local_sdp.media_count: + if sdp_index >= pj_local_sdp.media_count: raise ValueError("sdp_index argument out of range") # Remove ICE and SRTP/ZRTP related attributes from SDP, they will be added by pjmedia_transport_encode_sdp local_media = local_sdp.media[sdp_index] diff -ruN sipsimple/core/_core.pxd sipsimple/core/_core.pxd --- sipsimple/core/_core.pxd 2021-02-18 22:20:23.935865270 +0100 +++ sipsimple/core/_core.pxd 2021-02-06 20:02:57.495316125 +0100 @@ -906,8 +906,8 @@ int pjmedia_codec_register_audio_codecs(pjmedia_endpt *endpt, const pjmedia_audio_codec_config *c) nogil int pjmedia_codec_ffmpeg_vid_init(pjmedia_vid_codec_mgr *mgr, pj_pool_factory *pf) nogil int pjmedia_codec_ffmpeg_vid_deinit() nogil - int pjmedia_codec_vpx_init(pjmedia_vid_codec_mgr *mgr, pj_pool_factory *pf) nogil - int pjmedia_codec_vpx_deinit() nogil + int pjmedia_codec_vpx_vid_init(pjmedia_vid_codec_mgr *mgr, pj_pool_factory *pf) nogil + int pjmedia_codec_vpx_vid_deinit() nogil cdef extern from "pjsip.h": diff -ruN sipsimple/core/_core.sdp.pxi sipsimple/core/_core.sdp.pxi --- sipsimple/core/_core.sdp.pxi 2021-02-18 22:20:23.995866960 +0100 +++ sipsimple/core/_core.sdp.pxi 2021-02-06 19:30:28.787506745 +0100 @@ -966,7 +966,6 @@ cdef SDPSession SDPSession_create(pjmedia_sdp_session_ptr_const pj_session): cdef SDPConnection connection = None - cdef int i if pj_session.conn != NULL: connection = SDPConnection_create(pj_session.conn) return SDPSession(_pj_str_to_bytes(pj_session.origin.addr), @@ -985,7 +984,6 @@ cdef FrozenSDPSession FrozenSDPSession_create(pjmedia_sdp_session_ptr_const pj_session): cdef FrozenSDPConnection connection = None - cdef int i if pj_session.conn != NULL: connection = FrozenSDPConnection_create(pj_session.conn) return FrozenSDPSession(_pj_str_to_bytes(pj_session.origin.addr), @@ -1004,7 +1002,6 @@ cdef SDPMediaStream SDPMediaStream_create(pjmedia_sdp_media *pj_media): cdef SDPConnection connection = None - cdef int i if pj_media.conn != NULL: connection = SDPConnection_create(pj_media.conn) return SDPMediaStream(_pj_str_to_bytes(pj_media.desc.media), @@ -1018,7 +1015,6 @@ cdef FrozenSDPMediaStream FrozenSDPMediaStream_create(pjmedia_sdp_media *pj_media): cdef FrozenSDPConnection connection = None - cdef int i if pj_media.conn != NULL: connection = FrozenSDPConnection_create(pj_media.conn) return FrozenSDPMediaStream(_pj_str_to_bytes(pj_media.desc.media), diff -ruN sipsimple/core/_core.ua.pxi sipsimple/core/_core.ua.pxi --- sipsimple/core/_core.ua.pxi 2021-02-18 22:20:24.003867185 +0100 +++ sipsimple/core/_core.ua.pxi 2021-02-06 19:30:46.520008320 +0100 @@ -1075,8 +1075,6 @@ cdef pjmedia_sdp_session *sdp cdef pjmedia_sdp_media *media cdef pjmedia_sdp_attr *attr - cdef int i - cdef int j cdef pj_str_t new_value try: ua = _get_ua() diff -ruN sipsimple/core/_core.util.pxi sipsimple/core/_core.util.pxi --- sipsimple/core/_core.util.pxi 2021-02-18 22:20:24.051868537 +0100 +++ sipsimple/core/_core.util.pxi 2021-02-06 20:14:30.530825814 +0100 @@ -219,7 +219,7 @@ cdef pjsip_ctype_hdr *ctype_header cdef pjsip_cseq_hdr *cseq_header cdef char *buf - cdef int buf_len, i, status + cdef int buf_len, status headers = {} header = ( &msg.hdr).next while header != &msg.hdr: +@@ -229,8 +229,9 @@ + if header_name in ("Accept", "Allow", "Require", "Supported", "Unsupported", "Allow-Events"): + array_header = header + header_data = [] +- for i from 0 <= i < array_header.count: +- header_data.append(_pj_str_to_bytes(array_header.values[i])) ++ if array_header.count < 128: ++ for i from 0 <= i < array_header.count: ++ header_data.append(_pj_str_to_bytes(array_header.values[i])) + elif header_name == "Contact": + multi_header = True + header_data = FrozenContactHeader_create( header) --- sipsimple/core/_core.pyx 2021-03-19 03:05:47.796725137 +0100 +++ sipsimple/core/_core.pyx 2021-03-11 10:29:24.029286901 +0100 @@ -21,7 +21,7 @@ PJ_VERSION = pj_get_version() PJ_SVN_REVISION = int(PJ_SVN_REV) -CORE_REVISION = 183 +CORE_REVISION = 210 # exports --- sipsimple/core/__init__.py 2021-03-19 02:52:29.930211280 +0100 +++ sipsimple/core/__init__.py 2021-03-11 10:29:24.021286694 +0100 @@ -4,7 +4,7 @@ from sipsimple.core._helpers import * from sipsimple.core._primitives import * -required_revision = 183 +required_revision = 210 if CORE_REVISION != required_revision: raise ImportError("Wrong SIP core revision %d (expected %d)" % (CORE_REVISION, required_revision)) del required_revision --- sipsimple/__info__.py 2021-04-10 16:18:54.429724067 +0200 +++ sipsimple/__info__.py 2021-04-10 16:19:16.690349803 +0200 @@ -5,7 +5,7 @@ __summary__ = "SIP SIMPLE implementation for Python" __webpage__ = "https://sipsimpleclient.org" -__version__ = "4.0.2" +__version__ = "5.0.0" __author__ = "AG Projects" __email__ = "support@ag-projects.com" +--- sipsimple/core/_core.lib.pxi ++++ sipsimple/core/_core.lib.pxi +@@ -146,7 +146,7 @@ cdef class PJSIPEndpoint: + self._make_local_addr(&local_addr, self._local_ip_used, port) + pjsip_tls_setting_default(&tls_setting) + # The following value needs to be reasonably low, as TLS negotiation hogs the PJSIP polling loop +- tls_setting.timeout.sec = self._tls_timeout / 1000 ++ tls_setting.timeout.sec = (self._tls_timeout / 1000) + tls_setting.timeout.msec = self._tls_timeout % 1000 + if self._tls_ca_file is not None: + tls_setting.ca_list_file = self._tls_ca_file.pj_str +--- sipsimple/core/_core.pxd ++++ sipsimple/core/_core.pxd +@@ -1,4 +1,4 @@ +-# cython: language_level=2 ++# cython: language_level=3 + + cdef extern from *: + ctypedef char *char_ptr_const "const char *" +--- sipsimple/core/_core.sound.pxi ++++ sipsimple/core/_core.sound.pxi +@@ -48,12 +48,12 @@ cdef class AudioMixer: + self._snd_pool = snd_pool + with nogil: + status = pjmedia_conf_create(conf_pool, slot_count+1, sample_rate, 1, +- sample_rate / 50, 16, PJMEDIA_CONF_NO_DEVICE, conf_bridge_address) ++ (sample_rate / 50), 16, PJMEDIA_CONF_NO_DEVICE, conf_bridge_address) + if status != 0: + raise PJSIPError("Could not create audio mixer", status) + with nogil: + status = pjmedia_null_port_create(conf_pool, sample_rate, 1, +- sample_rate / 50, 16, null_port_address) ++ (sample_rate / 50), 16, null_port_address) + if status != 0: + raise PJSIPError("Could not create null audio port", status) + self._start_sound_device(ua, input_device, output_device, ec_tail_length) +@@ -377,7 +377,7 @@ cdef class AudioMixer: + port_param.base.rec_id = input_device_i + port_param.base.channel_count = 1 + port_param.base.clock_rate = sample_rate +- port_param.base.samples_per_frame = sample_rate / 50 ++ port_param.base.samples_per_frame = (sample_rate / 50) + port_param.base.bits_per_sample = 16 + port_param.base.flags |= (PJMEDIA_AUD_DEV_CAP_EC | PJMEDIA_AUD_DEV_CAP_EC_TAIL) + port_param.base.ec_enabled = 1 +@@ -672,7 +672,7 @@ cdef class ToneGenerator: + self.mixer = mixer + with nogil: + status = pjmedia_tonegen_create(pool, sample_rate, 1, +- sample_rate / 50, 16, 0, port_address) ++ (sample_rate / 50), 16, 0, port_address) + if status != 0: + raise PJSIPError("Could not create tone generator", status) + +@@ -949,7 +949,7 @@ cdef class RecordingWaveFile: + with nogil: + status = pjmedia_wav_writer_port_create(pool, filename, + sample_rate, 1, +- sample_rate / 50, 16, ++ (sample_rate / 50), 16, + PJMEDIA_FILE_WRITE_PCM, 0, port_address) + if status != 0: + raise PJSIPError("Could not create WAV file", status) +@@ -1290,7 +1290,7 @@ cdef class MixerPort: + self._pool = pool + try: + with nogil: +- status = pjmedia_mixer_port_create(pool, sample_rate, 1, sample_rate / 50, 16, port_address) ++ status = pjmedia_mixer_port_create(pool, sample_rate, 1, (sample_rate / 50), 16, port_address) + if status != 0: + raise PJSIPError("Could not create WAV file", status) + self._slot = self.mixer._add_port(ua, self._pool, self._port) +--- sipsimple/core/_core.ua.pxi ++++ sipsimple/core/_core.ua.pxi +@@ -1131,10 +1131,10 @@ cdef int _cb_opus_fix_rx(pjsip_rx_data *rdata) with gil: + if pos1 != -1: + pos2 = body_str.find("opus/48000/2") + if pos2 != -1: +- memcpy(body_ptr + pos2 + 11, '1', 1) ++ memcpy(body_ptr + pos2 + 11, b'1', 1) + else: + # old opus, we must make it fail +- memcpy(body_ptr + pos1 + 5, 'XXXXX', 5) ++ memcpy(body_ptr + pos1 + 5, b'XXXXX', 5) + except: + ua._handle_exception(0) + return 0 +--- sipsimple/util/_sha1.pyx ++++ sipsimple/util/_sha1.pyx +@@ -1,4 +1,4 @@ +-# cython: language_level=2 ++# cython: language_level=3 + + __all__ = ['sha1'] + +@@ -17,7 +17,7 @@ cdef extern from "_sha1.h": + SHA1_DIGEST_SIZE = 20 + + ctypedef struct sha1_context: +- uint32_t state[SHA1_DIGEST_SIZE/4] # state variables ++ uint32_t state[(SHA1_DIGEST_SIZE/4)] # state variables + uint64_t count # 64-bit block count + uint8_t block[SHA1_BLOCK_SIZE] # data block buffer + uint32_t index # index into buffer +@@ -49,7 +49,7 @@ cdef class sha1(object): + return SHA1_DIGEST_SIZE + + def __reduce__(self): +- state_variables = [self.context.state[i] for i in range(sizeof(self.context.state)/4)] ++ state_variables = [self.context.state[i] for i in range(sizeof(self.context.state)/4)] + block = PyBytes_FromStringAndSize(self.context.block, self.context.index) + return self.__class__, (), (state_variables, self.context.count, block) +