From 7b3a5f99e74366319c44ca841961a00f28743ba9 Mon Sep 17 00:00:00 2001 From: JuS Date: Tue, 27 Aug 2019 20:04:03 +0200 Subject: [PATCH 01/17] Added installation instructions, .gitignore and changed zsrtp/getzrtp.sh file permissions to be executable. --- .gitignore | 3 ++- INSTALL.txt | 23 +++++++++++++++++++++++ zsrtp/getzrtp.sh | 0 3 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 INSTALL.txt mode change 100644 => 100755 zsrtp/getzrtp.sh diff --git a/.gitignore b/.gitignore index d98b38f..6a04dfc 100644 --- a/.gitignore +++ b/.gitignore @@ -8,4 +8,5 @@ build.mak build/zsrtp/docs/html zrtp/ - +.DS_Store +ZRTP4J.xcodeproj/ diff --git a/INSTALL.txt b/INSTALL.txt new file mode 100644 index 0000000..e4cf8e7 --- /dev/null +++ b/INSTALL.txt @@ -0,0 +1,23 @@ +How to use ZRTP4PJ +=================================================== + +This is how the file tree structure looks like: + +ZRTP4PJ +|----build/ +|----example/ +|----lib/ (may not exist or be empty, that's totally fine) +|----zsrtp/ +|----Makefile +|----README.md +|----ZRTP4PJ.xcodeproj +|----INSTALL.txt + +You need to take the following steps in order to use ZRTP within PJSIP: + +1. Ensure that the latest version of SRTP is loaded; execute './zsrtp/getzrtp.sh'. + +You need to move/copy the following folders: + +2. Copy the content of the 'build' directory (another dir called 'zsrtp') to 'pjsip/third_party/build/'. That's how pjsip knows what third-party libraries it needs to build. +3. Copy the 'zsrtp' directory to 'pjsip/third_party/'. That's where the sources for the build are located. \ No newline at end of file diff --git a/zsrtp/getzrtp.sh b/zsrtp/getzrtp.sh old mode 100644 new mode 100755 From fcc9ac6e4853ebb6d5f4556ed5d401c83ed167c3 Mon Sep 17 00:00:00 2001 From: welljsjs Date: Tue, 27 Aug 2019 23:41:50 +0200 Subject: [PATCH 02/17] PJDIR path in Makefile seems to be exported by pjsip. Relative paths don't require us to modify the file when automatically (by a script) integrating ZRTP4PJ to projects. --- build/zsrtp/Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/build/zsrtp/Makefile b/build/zsrtp/Makefile index 866f93e..e50cd67 100644 --- a/build/zsrtp/Makefile +++ b/build/zsrtp/Makefile @@ -1,9 +1,9 @@ # Adapt this path to your pjproject path -export PJDIR := ~/devhome/pjproject.git +# export PJDIR := ~/devhome/pjproject.git -include $(PJDIR)/build.mak -include $(PJDIR)/build/common.mak +include ../../../build.mak +include ../../../build/common.mak export LIBDIR := ../../lib From 0ab9f6eb17fc118a1b76a5192d16ab9d478473a0 Mon Sep 17 00:00:00 2001 From: JuS Date: Thu, 29 Aug 2019 21:44:39 +0200 Subject: [PATCH 03/17] Made paths relative to PJDIR --- build/zsrtp/Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/build/zsrtp/Makefile b/build/zsrtp/Makefile index e50cd67..88dfa46 100644 --- a/build/zsrtp/Makefile +++ b/build/zsrtp/Makefile @@ -2,8 +2,8 @@ # export PJDIR := ~/devhome/pjproject.git -include ../../../build.mak -include ../../../build/common.mak +include $(PJDIR)/build.mak +include $(PJDIR)/build/common.mak export LIBDIR := ../../lib @@ -126,7 +126,7 @@ $(ZSRTP_LIB): clean: $(MAKE) -f $(RULES_MAK) APP=ZSRTP app=libzsrtp $@ - rm -f $(ZSRTP_LIB) + rm -f $(LIBDIR)/$(ZSRTP_LIB) print_lib: $(MAKE) -f $(RULES_MAK) APP=ZSRTP app=libzsrtp $@ From 9a646ea52977a318444475e7da830ae141759437 Mon Sep 17 00:00:00 2001 From: JuS Date: Thu, 26 Sep 2019 13:16:01 +0200 Subject: [PATCH 04/17] Debug mode --- zsrtp/transport_zrtp.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/zsrtp/transport_zrtp.c b/zsrtp/transport_zrtp.c index c7557c7..d015443 100644 --- a/zsrtp/transport_zrtp.c +++ b/zsrtp/transport_zrtp.c @@ -981,8 +981,12 @@ static void transport_rtp_cb(void *user_data, void *pkt, pj_ssize_t size) int32_t newLen = 0; pj_status_t rc = PJ_SUCCESS; + PJ_LOG(4, (THIS_FILE, "0: Before pj_assert")); + pj_assert(zrtp && zrtp->stream_rtcp_cb && pkt); + PJ_LOG(4, (THIS_FILE, "1: After pj_assert")); + // check if this could be a real RTP/SRTP packet. if ((*buffer & 0xf0) != 0x10) { @@ -993,6 +997,7 @@ static void transport_rtp_cb(void *user_data, void *pkt, pj_ssize_t size) } else { + PJ_LOG(4, (THIS_FILE, "2: Phase")); rc = zsrtp_unprotect(zrtp->srtpReceive, (pj_uint8_t*)pkt, size, &newLen); if (rc == 1) { @@ -1006,11 +1011,13 @@ static void transport_rtp_cb(void *user_data, void *pkt, pj_ssize_t size) if (zrtp->userCallback.zrtp_showMessage != NULL) { if (rc == -1) { + PJ_LOG(4, (THIS_FILE, "3: Phase")); zrtp->userCallback.zrtp_showMessage(zrtp->userCallback.userData, zrtp_Warning, zrtp_WarningSRTPauthError); } else { + PJ_LOG(4, (THIS_FILE, "4: Phase")); zrtp->userCallback.zrtp_showMessage(zrtp->userCallback.userData, zrtp_Warning, zrtp_WarningSRTPreplayError); @@ -1019,12 +1026,16 @@ static void transport_rtp_cb(void *user_data, void *pkt, pj_ssize_t size) zrtp->unprotect_err = rc; } } + PJ_LOG(4, (THIS_FILE, "5: Phase")); if (!zrtp->started && zrtp->enableZrtp) pjmedia_transport_zrtp_startZrtp((pjmedia_transport *)zrtp); + PJ_LOG(4, (THIS_FILE, "6: Phase")); return; } + PJ_LOG(4, (THIS_FILE, "7: Before ZRTP processing")); + // We assume all other packets are ZRTP packets here. Process // if ZRTP processing is enabled. Because valid RTP packets are // already handled we delete any packets here after processing. @@ -1038,6 +1049,8 @@ static void transport_rtp_cb(void *user_data, void *pkt, pj_ssize_t size) pj_uint32_t crc = *(uint32_t*)(buffer + temp); crc = pj_ntohl(crc); + PJ_LOG(4, (THIS_FILE, "8: Phase")); + if (!zrtp_CheckCksum(buffer, temp, crc)) { if (zrtp->userCallback.zrtp_showMessage != NULL) @@ -1046,6 +1059,8 @@ static void transport_rtp_cb(void *user_data, void *pkt, pj_ssize_t size) } magic = pj_ntohl(magic); + PJ_LOG(4, (THIS_FILE, "9: Phase")); + // Check if it is really a ZRTP packet, return, no further processing if (magic != ZRTP_MAGIC || zrtp->zrtpCtx == NULL) { @@ -1055,16 +1070,21 @@ static void transport_rtp_cb(void *user_data, void *pkt, pj_ssize_t size) // beginning of a session. Start ZRTP in this case as well. if (!zrtp->started) { + PJ_LOG(4, (THIS_FILE, "10: Phase")); pjmedia_transport_zrtp_startZrtp((pjmedia_transport *)zrtp); } // this now points beyond the undefined and length field. // We need them, thus adjust zrtpMsg = (buffer + 12); + PJ_LOG(4, (THIS_FILE, "11: Phase")); + // store peer's SSRC in host order, used when creating the CryptoContext zrtp->peerSSRC = *(pj_uint32_t*)(buffer + 8); zrtp->peerSSRC = pj_ntohl(zrtp->peerSSRC); zrtp_processZrtpMessage(zrtp->zrtpCtx, zrtpMsg, zrtp->peerSSRC, size); + + PJ_LOG(4, (THIS_FILE, "12: Phase")); } } From 3d5fa10e7583ad2f1732031f2e817d7679e5ff8e Mon Sep 17 00:00:00 2001 From: JuS Date: Thu, 26 Sep 2019 14:08:21 +0200 Subject: [PATCH 05/17] More debugging output --- zsrtp/transport_zrtp.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/zsrtp/transport_zrtp.c b/zsrtp/transport_zrtp.c index d015443..fb7928a 100644 --- a/zsrtp/transport_zrtp.c +++ b/zsrtp/transport_zrtp.c @@ -990,9 +990,12 @@ static void transport_rtp_cb(void *user_data, void *pkt, pj_ssize_t size) // check if this could be a real RTP/SRTP packet. if ((*buffer & 0xf0) != 0x10) { + PJ_LOG(4, (THIS_FILE, "1.1: Phase")); // Could be real RTP, check if we are in secure mode if (zrtp->srtpReceive == NULL || size < 0) { + PJ_LOG(4, (THIS_FILE, "1.2: Phase")); + PJ_LOG(4, (THIS_FILE, "stream_rtp_cb %p", zrtp->stream_rtp_cb)) zrtp->stream_rtp_cb(zrtp->stream_user_data, pkt, size); } else From 5fc1cb3f9d3f9f4f50c8486fabe137bc7ca33627 Mon Sep 17 00:00:00 2001 From: JuS Date: Thu, 26 Sep 2019 16:24:15 +0200 Subject: [PATCH 06/17] Added missing semicolon --- zsrtp/transport_zrtp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zsrtp/transport_zrtp.c b/zsrtp/transport_zrtp.c index fb7928a..25c5f2d 100644 --- a/zsrtp/transport_zrtp.c +++ b/zsrtp/transport_zrtp.c @@ -995,7 +995,7 @@ static void transport_rtp_cb(void *user_data, void *pkt, pj_ssize_t size) if (zrtp->srtpReceive == NULL || size < 0) { PJ_LOG(4, (THIS_FILE, "1.2: Phase")); - PJ_LOG(4, (THIS_FILE, "stream_rtp_cb %p", zrtp->stream_rtp_cb)) + PJ_LOG(4, (THIS_FILE, "stream_rtp_cb %p", zrtp->stream_rtp_cb)); zrtp->stream_rtp_cb(zrtp->stream_user_data, pkt, size); } else From 69b50ee21146979216d0585c54076cce43a866c6 Mon Sep 17 00:00:00 2001 From: JuS Date: Thu, 26 Sep 2019 17:11:34 +0200 Subject: [PATCH 07/17] Further debug outputs... --- zsrtp/transport_zrtp.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/zsrtp/transport_zrtp.c b/zsrtp/transport_zrtp.c index 25c5f2d..786f834 100644 --- a/zsrtp/transport_zrtp.c +++ b/zsrtp/transport_zrtp.c @@ -995,7 +995,7 @@ static void transport_rtp_cb(void *user_data, void *pkt, pj_ssize_t size) if (zrtp->srtpReceive == NULL || size < 0) { PJ_LOG(4, (THIS_FILE, "1.2: Phase")); - PJ_LOG(4, (THIS_FILE, "stream_rtp_cb %p", zrtp->stream_rtp_cb)); + PJ_LOG(4, (THIS_FILE, "stream_rtp_cb %p", zrtp->stream_rtp_cb)); //! zrtp->stream_rtp_cb is 0x0 here zrtp->stream_rtp_cb(zrtp->stream_user_data, pkt, size); } else @@ -1154,11 +1154,14 @@ static pj_status_t transport_attach(pjmedia_transport *tp, zrtp->stream_rtp_cb = rtp_cb; zrtp->stream_rtcp_cb = rtcp_cb; + PJ_LOG(4, (THIS_FILE, "Assigned within transport_attach to zrtp->stream_rtp_cb: %p", zrtp->stream_rtp_cb)); + status = pjmedia_transport_attach(zrtp->slave_tp, zrtp, rem_addr, rem_rtcp, addr_len, &transport_rtp_cb, &transport_rtcp_cb); if (status != PJ_SUCCESS) { + PJ_LOG(4, (THIS_FILE, "zrtp error: pjmedia_transport_attach() failed")); zrtp->stream_user_data = NULL; zrtp->stream_rtp_cb = NULL; zrtp->stream_rtcp_cb = NULL; @@ -1513,6 +1516,8 @@ static pj_status_t transport_attach2(pjmedia_transport *tp, pjmedia_transport_at zrtp->stream_rtp_cb = att_param->rtp_cb; zrtp->stream_rtcp_cb = att_param->rtcp_cb; + PJ_LOG(4, (THIS_FILE, "Assigned within transport_attach2 to zrtp->stream_rtp_cb: %p", zrtp->stream_rtp_cb)); + pjmedia_transport_attach_param param = {NULL, PJMEDIA_TYPE_AUDIO, //Video calls later? att_param->rem_addr, @@ -1527,6 +1532,7 @@ static pj_status_t transport_attach2(pjmedia_transport *tp, pjmedia_transport_at status = pjmedia_transport_attach2(zrtp->slave_tp, ¶m); if (status != PJ_SUCCESS) { + PJ_LOG(4, (THIS_FILE, "zrtp error: pjmedia_transport_attach2 failed")); zrtp->stream_user_data = NULL; zrtp->stream_rtp_cb = NULL; zrtp->stream_rtcp_cb = NULL; From f8155ccd1a30a27b042ef0e43d41c1703c6cb09b Mon Sep 17 00:00:00 2001 From: JuS Date: Sat, 28 Sep 2019 12:13:04 +0200 Subject: [PATCH 08/17] Possible fix for 0x0 memory read --- zsrtp/transport_zrtp.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/zsrtp/transport_zrtp.c b/zsrtp/transport_zrtp.c index 786f834..4d19b19 100644 --- a/zsrtp/transport_zrtp.c +++ b/zsrtp/transport_zrtp.c @@ -1513,9 +1513,11 @@ static pj_status_t transport_attach2(pjmedia_transport *tp, pjmedia_transport_at */ pj_assert(zrtp->stream_user_data == NULL); zrtp->stream_user_data = att_param->user_data; - zrtp->stream_rtp_cb = att_param->rtp_cb; + zrtp->stream_rtp_cb = att_param->rtb_cb2; + // zrtp->stream_rtp_cb = att_param->rtp_cb; //! att_param->rtp_cb is NULL zrtp->stream_rtcp_cb = att_param->rtcp_cb; + //! zrtp->stream_rtp_cb is NULL here PJ_LOG(4, (THIS_FILE, "Assigned within transport_attach2 to zrtp->stream_rtp_cb: %p", zrtp->stream_rtp_cb)); pjmedia_transport_attach_param param = {NULL, From 887f6cb53cd34e7ee07096a40e8583ad29241e51 Mon Sep 17 00:00:00 2001 From: JuS Date: Sat, 28 Sep 2019 12:28:50 +0200 Subject: [PATCH 09/17] Fixed a silly typo. --- zsrtp/transport_zrtp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zsrtp/transport_zrtp.c b/zsrtp/transport_zrtp.c index 4d19b19..e4cb7f8 100644 --- a/zsrtp/transport_zrtp.c +++ b/zsrtp/transport_zrtp.c @@ -1513,7 +1513,7 @@ static pj_status_t transport_attach2(pjmedia_transport *tp, pjmedia_transport_at */ pj_assert(zrtp->stream_user_data == NULL); zrtp->stream_user_data = att_param->user_data; - zrtp->stream_rtp_cb = att_param->rtb_cb2; + zrtp->stream_rtp_cb = att_param->rtp_cb2; // zrtp->stream_rtp_cb = att_param->rtp_cb; //! att_param->rtp_cb is NULL zrtp->stream_rtcp_cb = att_param->rtcp_cb; From b66d1a005b7eb2edba5f1d23a89eba5c6ea66608 Mon Sep 17 00:00:00 2001 From: JuS Date: Sat, 28 Sep 2019 13:32:15 +0200 Subject: [PATCH 10/17] Added transport_rtp_cb2 custom callback - transport_rtp_cb2 calls zrtp->stream_rtp_cb2 which is received by transport_attach2 if available (otherwise, transport_rtp_cb is called which calls zrtp->stream_rtp_cb) - Registered new callback within transport_attach2 - We probably don't need to register transport_rtp_cb2 within the old transport_attach function as transport_rtp_cb2 likely didn't exist then --- zsrtp/transport_zrtp.c | 136 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 133 insertions(+), 3 deletions(-) diff --git a/zsrtp/transport_zrtp.c b/zsrtp/transport_zrtp.c index e4cb7f8..c410814 100644 --- a/zsrtp/transport_zrtp.c +++ b/zsrtp/transport_zrtp.c @@ -108,6 +108,9 @@ struct tp_zrtp void (*stream_rtp_cb)(void *user_data, void *pkt, pj_ssize_t); + // TODO: We should check if rtp_cb2 is available by checking for the version with specified macros + // https://www.pjsip.org/pjlib/docs/html/config_8h.htm PJ_VERSION_NUM_MINOR + void (*stream_rtp_cb2)(pjmedia_tp_cb_param *param); void (*stream_rtcp_cb)(void *user_data, void *pkt, pj_ssize_t); @@ -1091,6 +1094,128 @@ static void transport_rtp_cb(void *user_data, void *pkt, pj_ssize_t size) } } +static void transport_rtp_cb2(pjmedia_tp_cb_param *param) +{ + struct tp_zrtp *zrtp = (struct tp_zrtp*)param->user_data; + + pj_uint8_t* buffer = (pj_uint8_t*)param->pkt; + int32_t newLen = 0; + pj_ssize_t size = param->size; + pj_status_t rc = PJ_SUCCESS; + + PJ_LOG(4, (THIS_FILE, "0: Before pj_assert")); + + pj_assert(zrtp && zrtp->stream_rtcp_cb2 && pkt); + + PJ_LOG(4, (THIS_FILE, "1: After pj_assert")); + + // check if this could be a real RTP/SRTP packet. + if ((*buffer & 0xf0) != 0x10) + { + PJ_LOG(4, (THIS_FILE, "1.1: Phase")); + // Could be real RTP, check if we are in secure mode + if (zrtp->srtpReceive == NULL || size < 0) + { + PJ_LOG(4, (THIS_FILE, "1.2: Phase")); + PJ_LOG(4, (THIS_FILE, "stream_rtp_cb2 %p", zrtp->stream_rtp_cb2)); //! zrtp->stream_rtp_cb is 0x0 here + struct pjmedia_tp_cb_param tp = { zrtp->stream_user_data, pkt, size, NULL, PJ_FALSE }; + zrtp->stream_rtp_cb2(&tp); + } + else + { + PJ_LOG(4, (THIS_FILE, "2: Phase")); + rc = zsrtp_unprotect(zrtp->srtpReceive, (pj_uint8_t*)pkt, size, &newLen); + if (rc == 1) + { + zrtp->unprotect++; + struct pjmedia_tp_cb_param tp = { zrtp->stream_user_data, pkt, newLen, NULL, PJ_FALSE }; + zrtp->stream_rtp_cb2(&tp); + // zrtp->stream_rtp_cb2(zrtp->stream_user_data, pkt, + // newLen); + zrtp->unprotect_err = 0; + } + else + { + if (zrtp->userCallback.zrtp_showMessage != NULL) + { + if (rc == -1) { + PJ_LOG(4, (THIS_FILE, "3: Phase")); + zrtp->userCallback.zrtp_showMessage(zrtp->userCallback.userData, + zrtp_Warning, + zrtp_WarningSRTPauthError); + } + else { + PJ_LOG(4, (THIS_FILE, "4: Phase")); + zrtp->userCallback.zrtp_showMessage(zrtp->userCallback.userData, + zrtp_Warning, + zrtp_WarningSRTPreplayError); + } + } + zrtp->unprotect_err = rc; + } + } + PJ_LOG(4, (THIS_FILE, "5: Phase")); + if (!zrtp->started && zrtp->enableZrtp) + pjmedia_transport_zrtp_startZrtp((pjmedia_transport *)zrtp); + + PJ_LOG(4, (THIS_FILE, "6: Phase")); + return; + } + + PJ_LOG(4, (THIS_FILE, "7: Before ZRTP processing")); + + // We assume all other packets are ZRTP packets here. Process + // if ZRTP processing is enabled. Because valid RTP packets are + // already handled we delete any packets here after processing. + if (zrtp->enableZrtp && zrtp->zrtpCtx != NULL) + { + unsigned char* zrtpMsg = NULL; + pj_uint32_t magic = *(pj_uint32_t*)(buffer + 4); + + // Get CRC value into crc (see above how to compute the offset) + pj_uint16_t temp = (pj_uint16_t)(size - CRC_SIZE); + pj_uint32_t crc = *(uint32_t*)(buffer + temp); + crc = pj_ntohl(crc); + + PJ_LOG(4, (THIS_FILE, "8: Phase")); + + if (!zrtp_CheckCksum(buffer, temp, crc)) + { + if (zrtp->userCallback.zrtp_showMessage != NULL) + zrtp->userCallback.zrtp_showMessage(zrtp->userCallback.userData, zrtp_Warning, zrtp_WarningCRCmismatch); + return; + } + magic = pj_ntohl(magic); + + PJ_LOG(4, (THIS_FILE, "9: Phase")); + + // Check if it is really a ZRTP packet, return, no further processing + if (magic != ZRTP_MAGIC || zrtp->zrtpCtx == NULL) + { + return; + } + // cover the case if the other party sends _only_ ZRTP packets at the + // beginning of a session. Start ZRTP in this case as well. + if (!zrtp->started) + { + PJ_LOG(4, (THIS_FILE, "10: Phase")); + pjmedia_transport_zrtp_startZrtp((pjmedia_transport *)zrtp); + } + // this now points beyond the undefined and length field. + // We need them, thus adjust + zrtpMsg = (buffer + 12); + + PJ_LOG(4, (THIS_FILE, "11: Phase")); + + // store peer's SSRC in host order, used when creating the CryptoContext + zrtp->peerSSRC = *(pj_uint32_t*)(buffer + 8); + zrtp->peerSSRC = pj_ntohl(zrtp->peerSSRC); + zrtp_processZrtpMessage(zrtp->zrtpCtx, zrtpMsg, zrtp->peerSSRC, size); + + PJ_LOG(4, (THIS_FILE, "12: Phase")); + } +} + /* This is our RTCP callback, that is called by the slave transport when it * receives RTCP packet. @@ -1513,12 +1638,15 @@ static pj_status_t transport_attach2(pjmedia_transport *tp, pjmedia_transport_at */ pj_assert(zrtp->stream_user_data == NULL); zrtp->stream_user_data = att_param->user_data; - zrtp->stream_rtp_cb = att_param->rtp_cb2; + zrtp->stream_rtp_cb = att_param->rtp_cb; + // TODO: We should check if rtp_cb2 is available by checking for the version with specified macros + // https://www.pjsip.org/pjlib/docs/html/config_8h.htm PJ_VERSION_NUM_MINOR + zrtp->stream_rtp_cb2 = att_param->rtp_cb2; // zrtp->stream_rtp_cb = att_param->rtp_cb; //! att_param->rtp_cb is NULL zrtp->stream_rtcp_cb = att_param->rtcp_cb; //! zrtp->stream_rtp_cb is NULL here - PJ_LOG(4, (THIS_FILE, "Assigned within transport_attach2 to zrtp->stream_rtp_cb: %p", zrtp->stream_rtp_cb)); + PJ_LOG(4, (THIS_FILE, "Assigned within transport_attach2 to zrtp->stream_rtp_cb2: %p", zrtp->stream_rtp_cb2)); pjmedia_transport_attach_param param = {NULL, PJMEDIA_TYPE_AUDIO, //Video calls later? @@ -1527,7 +1655,8 @@ static pj_status_t transport_attach2(pjmedia_transport *tp, pjmedia_transport_at att_param->addr_len, zrtp, &transport_rtp_cb, - &transport_rtcp_cb}; + &transport_rtcp_cb, + &transport_rtp_cb2}; @@ -1537,6 +1666,7 @@ static pj_status_t transport_attach2(pjmedia_transport *tp, pjmedia_transport_at PJ_LOG(4, (THIS_FILE, "zrtp error: pjmedia_transport_attach2 failed")); zrtp->stream_user_data = NULL; zrtp->stream_rtp_cb = NULL; + zrtp->stream_rtp_cb2 = NULL; zrtp->stream_rtcp_cb = NULL; return status; } From 0dcbde12303f5b60ca4b1b0d6c77efd261ecf588 Mon Sep 17 00:00:00 2001 From: JuS Date: Sat, 28 Sep 2019 13:34:36 +0200 Subject: [PATCH 11/17] Fixed a typo (There's no "stream_rtcp_cb2") --- zsrtp/transport_zrtp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zsrtp/transport_zrtp.c b/zsrtp/transport_zrtp.c index c410814..f29c759 100644 --- a/zsrtp/transport_zrtp.c +++ b/zsrtp/transport_zrtp.c @@ -1105,7 +1105,7 @@ static void transport_rtp_cb2(pjmedia_tp_cb_param *param) PJ_LOG(4, (THIS_FILE, "0: Before pj_assert")); - pj_assert(zrtp && zrtp->stream_rtcp_cb2 && pkt); + pj_assert(zrtp && zrtp->stream_rtcp_cb && pkt); PJ_LOG(4, (THIS_FILE, "1: After pj_assert")); From 4ebfb05ddf52159fdd8683afa9c89e55fa487d6a Mon Sep 17 00:00:00 2001 From: JuS Date: Sat, 28 Sep 2019 13:37:08 +0200 Subject: [PATCH 12/17] Added missing variable "pkt" --- zsrtp/transport_zrtp.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/zsrtp/transport_zrtp.c b/zsrtp/transport_zrtp.c index f29c759..4a11d7c 100644 --- a/zsrtp/transport_zrtp.c +++ b/zsrtp/transport_zrtp.c @@ -1098,7 +1098,8 @@ static void transport_rtp_cb2(pjmedia_tp_cb_param *param) { struct tp_zrtp *zrtp = (struct tp_zrtp*)param->user_data; - pj_uint8_t* buffer = (pj_uint8_t*)param->pkt; + void *pkt = param->pkt; + pj_uint8_t* buffer = (pj_uint8_t*)pkt; int32_t newLen = 0; pj_ssize_t size = param->size; pj_status_t rc = PJ_SUCCESS; From 31a8f3e1968ae59fecc78b653aa4f412947359ab Mon Sep 17 00:00:00 2001 From: JuS Date: Sat, 28 Sep 2019 16:58:42 +0200 Subject: [PATCH 13/17] Changed zid file name Changed zid file name from "simple.zip" to "/tmp/simple.zip" to avoid conflicts with iOS permissions (sandboxed apps are not allowed to create files within the app folder but probably are allowed to create files within "/tmp") --- example/simple_pjsua.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/example/simple_pjsua.c b/example/simple_pjsua.c index de37cdc..bffbee9 100644 --- a/example/simple_pjsua.c +++ b/example/simple_pjsua.c @@ -209,7 +209,7 @@ pjmedia_transport* on_create_media_transport(pjsua_call_id call_id, * our partners ZID, shared data etc. If the files does not exists it will * be created an initialized. */ - pjmedia_transport_zrtp_initialize(zrtp_tp, "simple.zid", PJ_TRUE); + pjmedia_transport_zrtp_initialize(zrtp_tp, "/tmp/simple.zid", PJ_TRUE); return zrtp_tp; } From 1321e4a1f5fffe2fa851bf6cbace54a151a03fc5 Mon Sep 17 00:00:00 2001 From: JuS Date: Sat, 28 Sep 2019 18:17:51 +0200 Subject: [PATCH 14/17] Added macro ifdefs... ...to ensure that rtp_cb2 is not used before pjsip v2.8 --- zsrtp/transport_zrtp.c | 36 +++++++++++++++++++++++++++++------- 1 file changed, 29 insertions(+), 7 deletions(-) diff --git a/zsrtp/transport_zrtp.c b/zsrtp/transport_zrtp.c index 4a11d7c..875ca1b 100644 --- a/zsrtp/transport_zrtp.c +++ b/zsrtp/transport_zrtp.c @@ -108,9 +108,11 @@ struct tp_zrtp void (*stream_rtp_cb)(void *user_data, void *pkt, pj_ssize_t); - // TODO: We should check if rtp_cb2 is available by checking for the version with specified macros - // https://www.pjsip.org/pjlib/docs/html/config_8h.htm PJ_VERSION_NUM_MINOR - void (*stream_rtp_cb2)(pjmedia_tp_cb_param *param); +#if defined(PJ_VERSION_NUM_MAJOR) && defined(PJ_VERSION_NUM_MINOR) + #if (PJ_VERSION_NUM_MAJOR >= 2) && (PJ_VERSION_NUM_MINOR >= 8) + void (*stream_rtp_cb2)(pjmedia_tp_cb_param *param); + #endif +#endif void (*stream_rtcp_cb)(void *user_data, void *pkt, pj_ssize_t); @@ -1094,6 +1096,8 @@ static void transport_rtp_cb(void *user_data, void *pkt, pj_ssize_t size) } } +#if defined(PJ_VERSION_NUM_MAJOR) && defined(PJ_VERSION_NUM_MINOR) + #if (PJ_VERSION_NUM_MAJOR >= 2) && (PJ_VERSION_NUM_MINOR >= 8) static void transport_rtp_cb2(pjmedia_tp_cb_param *param) { struct tp_zrtp *zrtp = (struct tp_zrtp*)param->user_data; @@ -1216,6 +1220,8 @@ static void transport_rtp_cb2(pjmedia_tp_cb_param *param) PJ_LOG(4, (THIS_FILE, "12: Phase")); } } + #endif +#endif /* This is our RTCP callback, that is called by the slave transport when it @@ -1313,6 +1319,11 @@ static void transport_detach(pjmedia_transport *tp, void *strm) pjmedia_transport_detach(zrtp->slave_tp, zrtp); zrtp->stream_user_data = NULL; zrtp->stream_rtp_cb = NULL; +#if defined(PJ_VERSION_NUM_MAJOR) && defined(PJ_VERSION_NUM_MINOR) + #if (PJ_VERSION_NUM_MAJOR >= 2) && (PJ_VERSION_NUM_MINOR >= 8) + zrtp->stream_rtp_cb2 = NULL; + #endif +#endif zrtp->stream_rtcp_cb = NULL; } } @@ -1640,9 +1651,11 @@ static pj_status_t transport_attach2(pjmedia_transport *tp, pjmedia_transport_at pj_assert(zrtp->stream_user_data == NULL); zrtp->stream_user_data = att_param->user_data; zrtp->stream_rtp_cb = att_param->rtp_cb; - // TODO: We should check if rtp_cb2 is available by checking for the version with specified macros - // https://www.pjsip.org/pjlib/docs/html/config_8h.htm PJ_VERSION_NUM_MINOR +#if defined(PJ_VERSION_NUM_MAJOR) && defined(PJ_VERSION_NUM_MINOR) + #if (PJ_VERSION_NUM_MAJOR >= 2) && (PJ_VERSION_NUM_MINOR >= 8) zrtp->stream_rtp_cb2 = att_param->rtp_cb2; + #endif +#endif // zrtp->stream_rtp_cb = att_param->rtp_cb; //! att_param->rtp_cb is NULL zrtp->stream_rtcp_cb = att_param->rtcp_cb; @@ -1656,8 +1669,13 @@ static pj_status_t transport_attach2(pjmedia_transport *tp, pjmedia_transport_at att_param->addr_len, zrtp, &transport_rtp_cb, - &transport_rtcp_cb, - &transport_rtp_cb2}; + &transport_rtcp_cb +#if defined(PJ_VERSION_NUM_MAJOR) && defined(PJ_VERSION_NUM_MINOR) + #if (PJ_VERSION_NUM_MAJOR >= 2) && (PJ_VERSION_NUM_MINOR >= 8) + , &transport_rtp_cb2 + #endif +#endif + }; @@ -1667,7 +1685,11 @@ static pj_status_t transport_attach2(pjmedia_transport *tp, pjmedia_transport_at PJ_LOG(4, (THIS_FILE, "zrtp error: pjmedia_transport_attach2 failed")); zrtp->stream_user_data = NULL; zrtp->stream_rtp_cb = NULL; +#if defined(PJ_VERSION_NUM_MAJOR) && defined(PJ_VERSION_NUM_MINOR) + #if (PJ_VERSION_NUM_MAJOR >= 2) && (PJ_VERSION_NUM_MINOR >= 8) zrtp->stream_rtp_cb2 = NULL; + #endif +#endif zrtp->stream_rtcp_cb = NULL; return status; } From 53b44042672a4e847180b5babb8e95d789eb17a1 Mon Sep 17 00:00:00 2001 From: JuS Date: Sat, 28 Sep 2019 18:20:50 +0200 Subject: [PATCH 15/17] Removed debug output --- zsrtp/transport_zrtp.c | 52 ------------------------------------------ 1 file changed, 52 deletions(-) diff --git a/zsrtp/transport_zrtp.c b/zsrtp/transport_zrtp.c index 875ca1b..eda02e1 100644 --- a/zsrtp/transport_zrtp.c +++ b/zsrtp/transport_zrtp.c @@ -986,26 +986,18 @@ static void transport_rtp_cb(void *user_data, void *pkt, pj_ssize_t size) int32_t newLen = 0; pj_status_t rc = PJ_SUCCESS; - PJ_LOG(4, (THIS_FILE, "0: Before pj_assert")); - pj_assert(zrtp && zrtp->stream_rtcp_cb && pkt); - PJ_LOG(4, (THIS_FILE, "1: After pj_assert")); - // check if this could be a real RTP/SRTP packet. if ((*buffer & 0xf0) != 0x10) { - PJ_LOG(4, (THIS_FILE, "1.1: Phase")); // Could be real RTP, check if we are in secure mode if (zrtp->srtpReceive == NULL || size < 0) { - PJ_LOG(4, (THIS_FILE, "1.2: Phase")); - PJ_LOG(4, (THIS_FILE, "stream_rtp_cb %p", zrtp->stream_rtp_cb)); //! zrtp->stream_rtp_cb is 0x0 here zrtp->stream_rtp_cb(zrtp->stream_user_data, pkt, size); } else { - PJ_LOG(4, (THIS_FILE, "2: Phase")); rc = zsrtp_unprotect(zrtp->srtpReceive, (pj_uint8_t*)pkt, size, &newLen); if (rc == 1) { @@ -1019,13 +1011,11 @@ static void transport_rtp_cb(void *user_data, void *pkt, pj_ssize_t size) if (zrtp->userCallback.zrtp_showMessage != NULL) { if (rc == -1) { - PJ_LOG(4, (THIS_FILE, "3: Phase")); zrtp->userCallback.zrtp_showMessage(zrtp->userCallback.userData, zrtp_Warning, zrtp_WarningSRTPauthError); } else { - PJ_LOG(4, (THIS_FILE, "4: Phase")); zrtp->userCallback.zrtp_showMessage(zrtp->userCallback.userData, zrtp_Warning, zrtp_WarningSRTPreplayError); @@ -1034,16 +1024,11 @@ static void transport_rtp_cb(void *user_data, void *pkt, pj_ssize_t size) zrtp->unprotect_err = rc; } } - PJ_LOG(4, (THIS_FILE, "5: Phase")); if (!zrtp->started && zrtp->enableZrtp) pjmedia_transport_zrtp_startZrtp((pjmedia_transport *)zrtp); - - PJ_LOG(4, (THIS_FILE, "6: Phase")); return; } - PJ_LOG(4, (THIS_FILE, "7: Before ZRTP processing")); - // We assume all other packets are ZRTP packets here. Process // if ZRTP processing is enabled. Because valid RTP packets are // already handled we delete any packets here after processing. @@ -1057,8 +1042,6 @@ static void transport_rtp_cb(void *user_data, void *pkt, pj_ssize_t size) pj_uint32_t crc = *(uint32_t*)(buffer + temp); crc = pj_ntohl(crc); - PJ_LOG(4, (THIS_FILE, "8: Phase")); - if (!zrtp_CheckCksum(buffer, temp, crc)) { if (zrtp->userCallback.zrtp_showMessage != NULL) @@ -1067,8 +1050,6 @@ static void transport_rtp_cb(void *user_data, void *pkt, pj_ssize_t size) } magic = pj_ntohl(magic); - PJ_LOG(4, (THIS_FILE, "9: Phase")); - // Check if it is really a ZRTP packet, return, no further processing if (magic != ZRTP_MAGIC || zrtp->zrtpCtx == NULL) { @@ -1078,21 +1059,16 @@ static void transport_rtp_cb(void *user_data, void *pkt, pj_ssize_t size) // beginning of a session. Start ZRTP in this case as well. if (!zrtp->started) { - PJ_LOG(4, (THIS_FILE, "10: Phase")); pjmedia_transport_zrtp_startZrtp((pjmedia_transport *)zrtp); } // this now points beyond the undefined and length field. // We need them, thus adjust zrtpMsg = (buffer + 12); - PJ_LOG(4, (THIS_FILE, "11: Phase")); - // store peer's SSRC in host order, used when creating the CryptoContext zrtp->peerSSRC = *(pj_uint32_t*)(buffer + 8); zrtp->peerSSRC = pj_ntohl(zrtp->peerSSRC); zrtp_processZrtpMessage(zrtp->zrtpCtx, zrtpMsg, zrtp->peerSSRC, size); - - PJ_LOG(4, (THIS_FILE, "12: Phase")); } } @@ -1108,27 +1084,19 @@ static void transport_rtp_cb2(pjmedia_tp_cb_param *param) pj_ssize_t size = param->size; pj_status_t rc = PJ_SUCCESS; - PJ_LOG(4, (THIS_FILE, "0: Before pj_assert")); - pj_assert(zrtp && zrtp->stream_rtcp_cb && pkt); - PJ_LOG(4, (THIS_FILE, "1: After pj_assert")); - // check if this could be a real RTP/SRTP packet. if ((*buffer & 0xf0) != 0x10) { - PJ_LOG(4, (THIS_FILE, "1.1: Phase")); // Could be real RTP, check if we are in secure mode if (zrtp->srtpReceive == NULL || size < 0) { - PJ_LOG(4, (THIS_FILE, "1.2: Phase")); - PJ_LOG(4, (THIS_FILE, "stream_rtp_cb2 %p", zrtp->stream_rtp_cb2)); //! zrtp->stream_rtp_cb is 0x0 here struct pjmedia_tp_cb_param tp = { zrtp->stream_user_data, pkt, size, NULL, PJ_FALSE }; zrtp->stream_rtp_cb2(&tp); } else { - PJ_LOG(4, (THIS_FILE, "2: Phase")); rc = zsrtp_unprotect(zrtp->srtpReceive, (pj_uint8_t*)pkt, size, &newLen); if (rc == 1) { @@ -1144,13 +1112,11 @@ static void transport_rtp_cb2(pjmedia_tp_cb_param *param) if (zrtp->userCallback.zrtp_showMessage != NULL) { if (rc == -1) { - PJ_LOG(4, (THIS_FILE, "3: Phase")); zrtp->userCallback.zrtp_showMessage(zrtp->userCallback.userData, zrtp_Warning, zrtp_WarningSRTPauthError); } else { - PJ_LOG(4, (THIS_FILE, "4: Phase")); zrtp->userCallback.zrtp_showMessage(zrtp->userCallback.userData, zrtp_Warning, zrtp_WarningSRTPreplayError); @@ -1159,16 +1125,11 @@ static void transport_rtp_cb2(pjmedia_tp_cb_param *param) zrtp->unprotect_err = rc; } } - PJ_LOG(4, (THIS_FILE, "5: Phase")); if (!zrtp->started && zrtp->enableZrtp) pjmedia_transport_zrtp_startZrtp((pjmedia_transport *)zrtp); - - PJ_LOG(4, (THIS_FILE, "6: Phase")); return; } - PJ_LOG(4, (THIS_FILE, "7: Before ZRTP processing")); - // We assume all other packets are ZRTP packets here. Process // if ZRTP processing is enabled. Because valid RTP packets are // already handled we delete any packets here after processing. @@ -1182,8 +1143,6 @@ static void transport_rtp_cb2(pjmedia_tp_cb_param *param) pj_uint32_t crc = *(uint32_t*)(buffer + temp); crc = pj_ntohl(crc); - PJ_LOG(4, (THIS_FILE, "8: Phase")); - if (!zrtp_CheckCksum(buffer, temp, crc)) { if (zrtp->userCallback.zrtp_showMessage != NULL) @@ -1192,8 +1151,6 @@ static void transport_rtp_cb2(pjmedia_tp_cb_param *param) } magic = pj_ntohl(magic); - PJ_LOG(4, (THIS_FILE, "9: Phase")); - // Check if it is really a ZRTP packet, return, no further processing if (magic != ZRTP_MAGIC || zrtp->zrtpCtx == NULL) { @@ -1203,21 +1160,16 @@ static void transport_rtp_cb2(pjmedia_tp_cb_param *param) // beginning of a session. Start ZRTP in this case as well. if (!zrtp->started) { - PJ_LOG(4, (THIS_FILE, "10: Phase")); pjmedia_transport_zrtp_startZrtp((pjmedia_transport *)zrtp); } // this now points beyond the undefined and length field. // We need them, thus adjust zrtpMsg = (buffer + 12); - PJ_LOG(4, (THIS_FILE, "11: Phase")); - // store peer's SSRC in host order, used when creating the CryptoContext zrtp->peerSSRC = *(pj_uint32_t*)(buffer + 8); zrtp->peerSSRC = pj_ntohl(zrtp->peerSSRC); zrtp_processZrtpMessage(zrtp->zrtpCtx, zrtpMsg, zrtp->peerSSRC, size); - - PJ_LOG(4, (THIS_FILE, "12: Phase")); } } #endif @@ -1286,14 +1238,11 @@ static pj_status_t transport_attach(pjmedia_transport *tp, zrtp->stream_rtp_cb = rtp_cb; zrtp->stream_rtcp_cb = rtcp_cb; - PJ_LOG(4, (THIS_FILE, "Assigned within transport_attach to zrtp->stream_rtp_cb: %p", zrtp->stream_rtp_cb)); - status = pjmedia_transport_attach(zrtp->slave_tp, zrtp, rem_addr, rem_rtcp, addr_len, &transport_rtp_cb, &transport_rtcp_cb); if (status != PJ_SUCCESS) { - PJ_LOG(4, (THIS_FILE, "zrtp error: pjmedia_transport_attach() failed")); zrtp->stream_user_data = NULL; zrtp->stream_rtp_cb = NULL; zrtp->stream_rtcp_cb = NULL; @@ -1682,7 +1631,6 @@ static pj_status_t transport_attach2(pjmedia_transport *tp, pjmedia_transport_at status = pjmedia_transport_attach2(zrtp->slave_tp, ¶m); if (status != PJ_SUCCESS) { - PJ_LOG(4, (THIS_FILE, "zrtp error: pjmedia_transport_attach2 failed")); zrtp->stream_user_data = NULL; zrtp->stream_rtp_cb = NULL; #if defined(PJ_VERSION_NUM_MAJOR) && defined(PJ_VERSION_NUM_MINOR) From bc4798d2da2d1801e3fd971a78a0cb00629e006c Mon Sep 17 00:00:00 2001 From: JuS Date: Sat, 28 Sep 2019 18:50:03 +0200 Subject: [PATCH 16/17] Removed outdated patch file --- zrtp_patch_1.10.patch | 131 ------------------------------------------ 1 file changed, 131 deletions(-) delete mode 100644 zrtp_patch_1.10.patch diff --git a/zrtp_patch_1.10.patch b/zrtp_patch_1.10.patch deleted file mode 100644 index a472ef5..0000000 --- a/zrtp_patch_1.10.patch +++ /dev/null @@ -1,131 +0,0 @@ -diff --git a/pjsip/include/pjsua-lib/pjsua.h b/pjsip/include/pjsua-lib/pjsua.h -index 0a6cbdd..394c893 100644 ---- a/pjsip/include/pjsua-lib/pjsua.h -+++ b/pjsip/include/pjsua-lib/pjsua.h -@@ -420,6 +420,18 @@ typedef struct pjsua_reg_info - } pjsua_reg_info; - - -+typedef enum pjsua_create_media_transport_flag -+{ -+ /** -+ * This flag indicates that the media transport must also close its -+ * "member" or "child" transport when pjmedia_transport_close() is -+ * called. If this flag is not specified, then the media transport -+ * must not call pjmedia_transport_close() of its member transport. -+ */ -+ PJSUA_MED_TP_CLOSE_MEMBER = 1 -+ -+} pjsua_create_media_transport_flag; -+ - /** - * This structure describes application callback to receive various event - * notification from PJSUA-API. All of these callbacks are OPTIONAL, -@@ -918,6 +930,31 @@ typedef struct pjsua_callback - void (*on_ice_transport_error)(int index, pj_ice_strans_op op, - pj_status_t status, void *param); - -+ /** -+ * This callback can be used by application to implement custom media -+ * transport adapter for the call, or to replace the media transport -+ * with something completely new altogether. -+ * -+ * This callback is called when a new call is created. The library has -+ * created a media transport for the call, and it is provided as the -+ * \a base_tp argument of this callback. Upon returning, the callback -+ * must return an instance of media transport to be used by the call. -+ * -+ * @param call_id Call ID -+ * @param media_idx The media index in the SDP for which this media -+ * transport will be used. -+ * @param base_tp The media transport which otherwise will be -+ * used by the call has this callback not been -+ * implemented. -+ * @param flags Bitmask from pjsua_create_media_transport_flag. -+ * -+ * @return The callback must return an instance of media -+ * transport to be used by the call. -+ */ -+ pjmedia_transport* (*on_create_media_transport)(pjsua_call_id call_id, -+ unsigned media_idx, -+ pjmedia_transport *base_tp, -+ unsigned flags); - } pjsua_callback; - - -diff --git a/pjsip/src/pjsua-lib/pjsua_media.c b/pjsip/src/pjsua-lib/pjsua_media.c -index 47cf1e7..57f9f27 100644 ---- a/pjsip/src/pjsua-lib/pjsua_media.c -+++ b/pjsip/src/pjsua-lib/pjsua_media.c -@@ -1174,7 +1174,8 @@ pj_status_t pjsua_media_channel_init(pjsua_call_id call_id, - { - pjsua_call *call = &pjsua_var.calls[call_id]; - pj_status_t status; -- -+ pjmedia_transport *app_tp = NULL; -+ - #if defined(PJMEDIA_HAS_SRTP) && (PJMEDIA_HAS_SRTP != 0) - pjsua_acc *acc = &pjsua_var.acc[call->acc_id]; - pjmedia_srtp_setting srtp_opt; -@@ -1232,7 +1233,8 @@ pj_status_t pjsua_media_channel_init(pjsua_call_id call_id, - call->med_tp = srtp; - } - #else -- call->med_orig = call->med_tp; -+ if (!call->media_orig) -+ call->med_orig = call->med_tp; - PJ_UNUSED_ARG(security_level); - #endif - -@@ -1258,6 +1260,48 @@ pj_status_t pjsua_media_channel_init(pjsua_call_id call_id, - call->audio_idx = find_audio_index(rem_sdp, srtp_active); - } - -+ /* -+ * Check if applicaton wnats a callback on media transport creation. -+ * -+ * Similar to check to create SRTP above: -+ * Call the application's callback only on first channel_init, not on -+ * a re-invite that does not change the channel setup. -+ * -+ * If SRTP was compiled pjsua always creates the SRTP transport. In this -+ * case check if the current transport is SRTP transport. If yes then -+ * call the callback. -+ * -+ * If SRTP was not compiled then check if med_orig and med_tp are the same. -+ * If yes call the callback. -+ */ -+ if (pjsua_var.ua_cfg.cb.on_create_media_transport) -+ { -+ pjsua_create_media_transport_flag flag = 0; -+ -+#if defined(PJMEDIA_HAS_SRTP) && (PJMEDIA_HAS_SRTP != 0) -+ if (call->med_tp == srtp) -+ { -+ -+ /* If the current transport is SRTP then the application's -+ * transport shall close SRTP (SRTP itself will not close -+ * it's slave transport, see above). -+ */ -+ flag = PJSUA_MED_TP_CLOSE_MEMBER; -+#else -+ if (call->med_tp == call->med_orig) -+ { -+#endif -+ app_tp = pjsua_var.ua_cfg.cb.on_create_media_transport(call_id, -+ call->audio_idx, -+ call->med_tp, -+ flag); -+ if (app_tp != NULL && app_tp != call->med_tp) -+ { -+ call->med_tp = app_tp; -+ } -+ } -+ } -+ - /* Reject offer if we couldn't find a good m=audio line in offer */ - if (call->audio_idx < 0) { - if (sip_err_code) *sip_err_code = PJSIP_SC_NOT_ACCEPTABLE_HERE; --- -1.7.3.4 - From dea9d47b00d09d15bf5d18aded3c51f34e469af3 Mon Sep 17 00:00:00 2001 From: JuS Date: Sat, 28 Sep 2019 18:52:11 +0200 Subject: [PATCH 17/17] Removed INSTALL.txt --- INSTALL.txt | 23 ----------------------- 1 file changed, 23 deletions(-) delete mode 100644 INSTALL.txt diff --git a/INSTALL.txt b/INSTALL.txt deleted file mode 100644 index e4cf8e7..0000000 --- a/INSTALL.txt +++ /dev/null @@ -1,23 +0,0 @@ -How to use ZRTP4PJ -=================================================== - -This is how the file tree structure looks like: - -ZRTP4PJ -|----build/ -|----example/ -|----lib/ (may not exist or be empty, that's totally fine) -|----zsrtp/ -|----Makefile -|----README.md -|----ZRTP4PJ.xcodeproj -|----INSTALL.txt - -You need to take the following steps in order to use ZRTP within PJSIP: - -1. Ensure that the latest version of SRTP is loaded; execute './zsrtp/getzrtp.sh'. - -You need to move/copy the following folders: - -2. Copy the content of the 'build' directory (another dir called 'zsrtp') to 'pjsip/third_party/build/'. That's how pjsip knows what third-party libraries it needs to build. -3. Copy the 'zsrtp' directory to 'pjsip/third_party/'. That's where the sources for the build are located. \ No newline at end of file