From 6c8d273721e8ddb8dfdb2e8441603aa7b33647a3 Mon Sep 17 00:00:00 2001
From: Luka Perkov <luka@openwrt.org>
Date: Sun, 3 Jun 2012 23:37:58 +0000
Subject: [PATCH] pjsip: update to version 1.14.2

SVN-Revision: 32040
---
 package/pjsip/Makefile                        | 10 +--
 .../pjsip/patches/0001-configure-fixup.patch  | 25 +-----
 .../pjsip/patches/0002-register-tapi.patch    | 34 +++------
 ...j_status_t-pjsua_add_snd_port-int-id.patch | 76 +++++++------------
 ...004-Pulse-dialing-support-into-pjsip.patch | 34 ---------
 5 files changed, 45 insertions(+), 134 deletions(-)
 delete mode 100644 package/pjsip/patches/0004-Pulse-dialing-support-into-pjsip.patch

diff --git a/package/pjsip/Makefile b/package/pjsip/Makefile
index 97a5771557..20fb6fab73 100644
--- a/package/pjsip/Makefile
+++ b/package/pjsip/Makefile
@@ -1,5 +1,5 @@
 #
-# Copyright (C) 2010-2011 OpenWrt.org
+# Copyright (C) 2010-2012 OpenWrt.org
 #
 # This is free software, licensed under the GNU General Public License v2.
 # See /LICENSE for more information.
@@ -8,12 +8,12 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=pjsip
-PKG_VERSION:=1.12
+PKG_VERSION:=1.14.2
 PKG_RELEASE:=1
 
 PKG_SOURCE:=pjproject-$(PKG_VERSION).tar.bz2
 PKG_SOURCE_URL:=http://www.pjsip.org/release/$(PKG_VERSION)/
-PKG_MD5SUM:=1db8e5a5dd73b216409b15afa34651a4
+PKG_MD5SUM:=05428502384c16e7abd85f047e6e2f6c
 
 PKG_INSTALL:=1
 PKG_BUILD_PARALLEL:=1
@@ -96,9 +96,5 @@ define Build/InstallDev
 	$(CP) $(PKG_INSTALL_DIR)/usr/pjsip-$(BUILD_VARIANT) $(1)/usr
 endef
 
-define Package/pjsip-$(BUILD_VARIANT)/install
-	echo "foo"
-endef
-
 $(eval $(call BuildPackage,pjsip-oss))
 $(eval $(call BuildPackage,pjsip-ltq-tapi))
diff --git a/package/pjsip/patches/0001-configure-fixup.patch b/package/pjsip/patches/0001-configure-fixup.patch
index 38fcea5b18..2f8a71f5e1 100644
--- a/package/pjsip/patches/0001-configure-fixup.patch
+++ b/package/pjsip/patches/0001-configure-fixup.patch
@@ -1,15 +1,3 @@
-From 01108f66fd20dcdbb9fde0dd00924ee4e8c28a7c Mon Sep 17 00:00:00 2001
-From: John Crispin <blogic@openwrt.org>
-Date: Sat, 28 Jan 2012 21:41:18 +0100
-Subject: [PATCH 1/3] configure fixup
-
----
- pjproject-1.12/aconfigure.ac                |   13 +++++++++++--
- pjproject-1.12/pjmedia/build/os-auto.mak.in |    9 ++++++++-
- 2 files changed, 19 insertions(+), 3 deletions(-)
-
-diff --git a/aconfigure.ac b/aconfigure.ac
-index 84295b5..e34fd32 100644
 --- a/aconfigure.ac
 +++ b/aconfigure.ac
 @@ -48,9 +48,9 @@ if test -z "$CROSS_COMPILE"; then
@@ -24,10 +12,11 @@ index 84295b5..e34fd32 100644
  AC_SUBST(LD)
  if test "$LDOUT" = ""; then LDOUT="-o "; fi
  AC_SUBST(LDOUT)
-@@ -604,6 +604,15 @@ AC_ARG_ENABLE(ext_sound,
+@@ -616,6 +616,15 @@ AC_ARG_ENABLE(ext_sound,
+ 		AC_MSG_RESULT([Checking if external sound is set... yes])
  	       fi]
  	      )
- 
++
 +AC_ARG_ENABLE(ltq_tapi,
 +	      AC_HELP_STRING([--enable-ltq-tapi],
 +			     [PJMEDIA will use ltq tapi backend]),
@@ -36,12 +25,9 @@ index 84295b5..e34fd32 100644
 +		AC_MSG_RESULT([Checking if external sound is set... yes])
 +	       fi]
 +	      )
-+
+ 
  dnl # Include resampling small filter
  AC_SUBST(ac_no_small_filter)
- AC_ARG_ENABLE(small-filter,
-diff --git a/pjmedia/build/os-auto.mak.in b/pjmedia/build/os-auto.mak.in
-index 145f1d5..be38aeb 100644
 --- a/pjmedia/build/os-auto.mak.in
 +++ b/pjmedia/build/os-auto.mak.in
 @@ -125,4 +125,11 @@ ifeq ($(AC_PJMEDIA_SND),external)
@@ -57,6 +43,3 @@ index 145f1d5..be38aeb 100644
 +export PJMEDIA_AUDIODEV_OBJS += tapi_dev.o
 +export CFLAGS += -DPJMEDIA_AUDIO_DEV_HAS_TAPI_DEVICE=1
 +endif
--- 
-1.7.7.1
-
diff --git a/package/pjsip/patches/0002-register-tapi.patch b/package/pjsip/patches/0002-register-tapi.patch
index 56f50cb2ca..4363bc7ff8 100644
--- a/package/pjsip/patches/0002-register-tapi.patch
+++ b/package/pjsip/patches/0002-register-tapi.patch
@@ -1,19 +1,6 @@
-From 455f6f2234a36aeeb97d3e05e9cbe3afad147341 Mon Sep 17 00:00:00 2001
-From: John Crispin <blogic@openwrt.org>
-Date: Sat, 28 Jan 2012 21:43:49 +0100
-Subject: [PATCH 2/3] register tapi
-
----
- .../pjmedia/src/pjmedia-audiodev/audiodev.c        |    7 +
- .../pjmedia/src/pjmedia-audiodev/tapi_dev.c        | 1300 ++++++++++++++++++++
- 2 files changed, 1307 insertions(+), 0 deletions(-)
- create mode 100644 pjproject-1.12/pjmedia/src/pjmedia-audiodev/tapi_dev.c
-
-diff --git a/pjmedia/src/pjmedia-audiodev/audiodev.c b/pjmedia/src/pjmedia-audiodev/audiodev.c
-index 3b7e121..82b364c 100644
 --- a/pjmedia/src/pjmedia-audiodev/audiodev.c
 +++ b/pjmedia/src/pjmedia-audiodev/audiodev.c
-@@ -98,6 +98,10 @@ pjmedia_aud_dev_factory* pjmedia_symb_mda_factory(pj_pool_factory *pf);
+@@ -98,6 +98,10 @@ pjmedia_aud_dev_factory* pjmedia_symb_md
  pjmedia_aud_dev_factory* pjmedia_null_audio_factory(pj_pool_factory *pf);
  #endif
  
@@ -24,7 +11,7 @@ index 3b7e121..82b364c 100644
  #define MAX_DRIVERS	16
  #define MAX_DEVS	64
  
-@@ -409,6 +413,9 @@ PJ_DEF(pj_status_t) pjmedia_aud_subsys_init(pj_pool_factory *pf)
+@@ -409,6 +413,9 @@ PJ_DEF(pj_status_t) pjmedia_aud_subsys_i
  #if PJMEDIA_AUDIO_DEV_HAS_NULL_AUDIO
      aud_subsys.drv[aud_subsys.drv_cnt++].create = &pjmedia_null_audio_factory;
  #endif
@@ -34,12 +21,9 @@ index 3b7e121..82b364c 100644
  
      /* Initialize each factory and build the device ID list */
      for (i=0; i<aud_subsys.drv_cnt; ++i) {
-diff --git a/pjmedia/src/pjmedia-audiodev/tapi_dev.c b/pjmedia/src/pjmedia-audiodev/tapi_dev.c
-new file mode 100644
-index 0000000..2c65a0d
 --- /dev/null
 +++ b/pjmedia/src/pjmedia-audiodev/tapi_dev.c
-@@ -0,0 +1,1300 @@
+@@ -0,0 +1,1307 @@
 +/******************************************************************************
 +
 +                               Copyright (c) 2010
@@ -237,7 +221,7 @@ index 0000000..2c65a0d
 +	} else if (!stricmp(cid, "kpn_dtmf_fsk")) {
 +		tapi_cid_type = IFX_TAPI_CID_STD_KPN_DTMF_FSK;
 +		PJ_LOG(3, (THIS_FILE, "using KPN DTMF FSK configuration for TAPI CID"));
-+	} 
++	}
 +}
 +
 +void tapi_locale_select(char *country)
@@ -875,6 +859,13 @@ index 0000000..2c65a0d
 +				if(tapi_digit_callback)
 +					tapi_digit_callback(i, tapiEvent.data.dtmf.ascii);
 +				break;
++			case IFX_TAPI_EVENT_PULSE_DIGIT:
++				if(tapi_digit_callback)
++					if(tapiEvent.data.pulse.digit == 0xB)
++						tapi_digit_callback(i, '0');
++					else
++						tapi_digit_callback(i, '0' + tapiEvent.data.pulse.digit);
++				break;
 +			case IFX_TAPI_EVENT_COD_DEC_CHG:
 +			case IFX_TAPI_EVENT_TONE_GEN_END:
 +			case IFX_TAPI_EVENT_CID_TX_SEQ_END:
@@ -1340,6 +1331,3 @@ index 0000000..2c65a0d
 +}
 +
 +#endif /* PJMEDIA_AUDIO_DEV_HAS_TAPI_DEVICE */
--- 
-1.7.7.1
-
diff --git a/package/pjsip/patches/0003-adds-PJ_DEF-pj_status_t-pjsua_add_snd_port-int-id.patch b/package/pjsip/patches/0003-adds-PJ_DEF-pj_status_t-pjsua_add_snd_port-int-id.patch
index 8e9b604147..3331c84828 100644
--- a/package/pjsip/patches/0003-adds-PJ_DEF-pj_status_t-pjsua_add_snd_port-int-id.patch
+++ b/package/pjsip/patches/0003-adds-PJ_DEF-pj_status_t-pjsua_add_snd_port-int-id.patch
@@ -1,19 +1,6 @@
-From 1e0d5dbf8b7714dfd490add0e2b507fd513414f3 Mon Sep 17 00:00:00 2001
-From: John Crispin <blogic@openwrt.org>
-Date: Fri, 3 Feb 2012 21:45:08 +0100
-Subject: [PATCH 3/3] adds PJ_DEF(pj_status_t) pjsua_add_snd_port(int id)
-
----
- pjproject-1.12/pjsip/include/pjsua-lib/pjsua.h     |    2 +
- .../pjsip/include/pjsua-lib/pjsua_internal.h       |    4 +-
- pjproject-1.12/pjsip/src/pjsua-lib/pjsua_media.c   |   69 ++++++++++++++------
- 3 files changed, 54 insertions(+), 21 deletions(-)
-
-diff --git a/pjsip/include/pjsua-lib/pjsua.h b/pjsip/include/pjsua-lib/pjsua.h
-index 85dbbbb..ad3e020 100644
 --- a/pjsip/include/pjsua-lib/pjsua.h
 +++ b/pjsip/include/pjsua-lib/pjsua.h
-@@ -1543,6 +1543,8 @@ PJ_DECL(pjmedia_endpt*) pjsua_get_pjmedia_endpt(void);
+@@ -1543,6 +1543,8 @@ PJ_DECL(pjmedia_endpt*) pjsua_get_pjmedi
  PJ_DECL(pj_pool_factory*) pjsua_get_pool_factory(void);
  
  
@@ -22,8 +9,6 @@ index 85dbbbb..ad3e020 100644
  
  /*****************************************************************************
   * Utilities.
-diff --git a/pjsip/include/pjsua-lib/pjsua_internal.h b/pjsip/include/pjsua-lib/pjsua_internal.h
-index 6c27826..4ba91ed 100644
 --- a/pjsip/include/pjsua-lib/pjsua_internal.h
 +++ b/pjsip/include/pjsua-lib/pjsua_internal.h
 @@ -261,6 +261,8 @@ typedef struct pjsua_stun_resolve
@@ -44,8 +29,6 @@ index 6c27826..4ba91ed 100644
      pj_timer_entry	 snd_idle_timer;/**< Sound device idle timer.	*/
      pjmedia_master_port	*null_snd;  /**< Master port for null sound.	*/
      pjmedia_port	*null_port; /**< Null port.			*/
-diff --git a/pjsip/src/pjsua-lib/pjsua_media.c b/pjsip/src/pjsua-lib/pjsua_media.c
-index 7d53cad..8a882f3 100644
 --- a/pjsip/src/pjsua-lib/pjsua_media.c
 +++ b/pjsip/src/pjsua-lib/pjsua_media.c
 @@ -588,7 +588,7 @@ static void check_snd_dev_idle()
@@ -53,29 +36,29 @@ index 7d53cad..8a882f3 100644
       * there is no active call.
       */
 -    if ((pjsua_var.snd_port!=NULL || pjsua_var.null_snd!=NULL) && 
-+    if ((pjsua_var.snd_port[0]!=NULL || pjsua_var.null_snd!=NULL) && 
++    if ((pjsua_var.snd_port[0]!=NULL || pjsua_var.null_snd!=NULL) &&
  	pjsua_var.snd_idle_timer.id == PJ_FALSE &&
  	pjmedia_conf_get_connect_count(pjsua_var.mconf) == 0 &&
  	call_cnt == 0 &&
-@@ -2009,7 +2009,7 @@ PJ_DEF(pj_status_t) pjsua_conf_connect( pjsua_conf_port_id source,
+@@ -2008,7 +2008,7 @@ PJ_DEF(pj_status_t) pjsua_conf_connect(
  	pj_assert(status == PJ_SUCCESS);
  
  	/* Check if sound device is instantiated. */
 -	need_reopen = (pjsua_var.snd_port==NULL && pjsua_var.null_snd==NULL && 
-+	need_reopen = (pjsua_var.snd_port[0]==NULL && pjsua_var.null_snd==NULL && 
++	need_reopen = (pjsua_var.snd_port[0]==NULL && pjsua_var.null_snd==NULL &&
  		      !pjsua_var.no_snd);
  
  	/* Check if sound device need to reopen because it needs to modify 
-@@ -2067,7 +2067,7 @@ PJ_DEF(pj_status_t) pjsua_conf_connect( pjsua_conf_port_id source,
+@@ -2072,7 +2072,7 @@ PJ_DEF(pj_status_t) pjsua_conf_connect(
  	/* The bridge version */
  
  	/* Create sound port if none is instantiated */
 -	if (pjsua_var.snd_port==NULL && pjsua_var.null_snd==NULL && 
-+	if (pjsua_var.snd_port[0]==NULL && pjsua_var.null_snd==NULL && 
++	if (pjsua_var.snd_port[0]==NULL && pjsua_var.null_snd==NULL &&
  	    !pjsua_var.no_snd) 
  	{
  	    pj_status_t status;
-@@ -2679,9 +2679,9 @@ static pj_status_t update_initial_aud_param()
+@@ -2686,9 +2686,9 @@ static pj_status_t update_initial_aud_pa
      pjmedia_aud_param param;
      pj_status_t status;
  
@@ -87,7 +70,7 @@ index 7d53cad..8a882f3 100644
  
      status = pjmedia_aud_stream_get_param(strm, &param);
      if (status != PJ_SUCCESS) {
-@@ -2747,7 +2747,7 @@ static pj_status_t open_snd_dev(pjmedia_snd_port_param *param)
+@@ -2754,7 +2754,7 @@ static pj_status_t open_snd_dev(pjmedia_
  	      1000 / param->base.clock_rate));
  
      status = pjmedia_snd_port_create2( pjsua_var.snd_pool, 
@@ -96,24 +79,24 @@ index 7d53cad..8a882f3 100644
      if (status != PJ_SUCCESS)
  	return status;
  
-@@ -2805,13 +2805,13 @@ static pj_status_t open_snd_dev(pjmedia_snd_port_param *param)
+@@ -2812,13 +2812,13 @@ static pj_status_t open_snd_dev(pjmedia_
      }
  
      /* Connect sound port to the bridge */
 -    status = pjmedia_snd_port_connect(pjsua_var.snd_port, 	 
-+    status = pjmedia_snd_port_connect(pjsua_var.snd_port[0], 	 
++    status = pjmedia_snd_port_connect(pjsua_var.snd_port[0],
  				      conf_port ); 	 
      if (status != PJ_SUCCESS) { 	 
  	pjsua_perror(THIS_FILE, "Unable to connect conference port to "
  			        "sound device", status); 	 
 -	pjmedia_snd_port_destroy(pjsua_var.snd_port); 	 
 -	pjsua_var.snd_port = NULL; 	 
-+	pjmedia_snd_port_destroy(pjsua_var.snd_port[0]); 	 
-+	pjsua_var.snd_port[0] = NULL; 	 
++	pjmedia_snd_port_destroy(pjsua_var.snd_port[0]);
++	pjsua_var.snd_port[0] = NULL;
  	return status; 	 
      }
  
-@@ -2826,7 +2826,7 @@ static pj_status_t open_snd_dev(pjmedia_snd_port_param *param)
+@@ -2833,7 +2833,7 @@ static pj_status_t open_snd_dev(pjmedia_
  	pjmedia_aud_param si;
          pj_str_t tmp;
  
@@ -122,7 +105,7 @@ index 7d53cad..8a882f3 100644
  	status = pjmedia_aud_stream_get_param(strm, &si);
  	if (status == PJ_SUCCESS)
  	    status = pjmedia_aud_dev_get_info(si.rec_id, &rec_info);
-@@ -2869,12 +2869,12 @@ static pj_status_t open_snd_dev(pjmedia_snd_port_param *param)
+@@ -2876,12 +2876,12 @@ static pj_status_t open_snd_dev(pjmedia_
  static void close_snd_dev(void)
  {
      /* Close sound device */
@@ -137,7 +120,7 @@ index 7d53cad..8a882f3 100644
  	pjmedia_aud_stream_get_param(strm, &param);
  
  	if (pjmedia_aud_dev_get_info(param.rec_id, &cap_info) != PJ_SUCCESS)
-@@ -2886,9 +2886,9 @@ static void close_snd_dev(void)
+@@ -2893,9 +2893,9 @@ static void close_snd_dev(void)
  			     "%s sound capture device",
  			     play_info.name, cap_info.name));
  
@@ -150,7 +133,7 @@ index 7d53cad..8a882f3 100644
      }
  
      /* Close null sound device */
-@@ -2968,6 +2968,35 @@ PJ_DEF(pj_status_t) pjsua_set_snd_dev( int capture_dev,
+@@ -2984,6 +2984,35 @@ PJ_DEF(pj_status_t) pjsua_set_snd_dev( i
      return PJ_SUCCESS;
  }
  
@@ -186,18 +169,16 @@ index 7d53cad..8a882f3 100644
  
  /*
   * Get currently active sound devices. If sound devices has not been created
-@@ -3054,8 +3083,8 @@ PJ_DEF(pj_status_t) pjsua_set_ec(unsigned tail_ms, unsigned options)
- {
-     pjsua_var.media_cfg.ec_tail_len = tail_ms;
+@@ -3088,7 +3117,7 @@ PJ_DEF(pj_status_t) pjsua_set_ec(unsigne
+     pjsua_var.media_cfg.ec_options = options;
  
--    if (pjsua_var.snd_port)
--	return pjmedia_snd_port_set_ec( pjsua_var.snd_port, pjsua_var.pool,
-+    if (pjsua_var.snd_port[0])
-+	return pjmedia_snd_port_set_ec( pjsua_var.snd_port[0], pjsua_var.pool,
- 					tail_ms, options);
+     if (pjsua_var.snd_port)
+-	status = pjmedia_snd_port_set_ec(pjsua_var.snd_port, pjsua_var.pool,
++	status = pjmedia_snd_port_set_ec(pjsua_var.snd_port[0], pjsua_var.pool,
+ 					 tail_ms, options);
      
-     return PJ_SUCCESS;
-@@ -3077,7 +3106,7 @@ PJ_DEF(pj_status_t) pjsua_get_ec_tail(unsigned *p_tail_ms)
+     PJSUA_UNLOCK();
+@@ -3111,7 +3140,7 @@ PJ_DEF(pj_status_t) pjsua_get_ec_tail(un
   */
  PJ_DEF(pj_bool_t) pjsua_snd_is_active(void)
  {
@@ -206,7 +187,7 @@ index 7d53cad..8a882f3 100644
  }
  
  
-@@ -3099,7 +3128,7 @@ PJ_DEF(pj_status_t) pjsua_snd_set_setting( pjmedia_aud_dev_cap cap,
+@@ -3135,7 +3164,7 @@ PJ_DEF(pj_status_t) pjsua_snd_set_settin
      if (pjsua_snd_is_active()) {
  	pjmedia_aud_stream *strm;
  	
@@ -215,15 +196,12 @@ index 7d53cad..8a882f3 100644
  	status = pjmedia_aud_stream_set_cap(strm, cap, pval);
      } else {
  	status = PJ_SUCCESS;
-@@ -3137,7 +3166,7 @@ PJ_DEF(pj_status_t) pjsua_snd_get_setting( pjmedia_aud_dev_cap cap,
+@@ -3181,7 +3210,7 @@ PJ_DEF(pj_status_t) pjsua_snd_get_settin
  	/* Sound is active, retrieve from device directly */
  	pjmedia_aud_stream *strm;
  	
 -	strm = pjmedia_snd_port_get_snd_stream(pjsua_var.snd_port);
 +	strm = pjmedia_snd_port_get_snd_stream(pjsua_var.snd_port[0]);
- 	return pjmedia_aud_stream_get_cap(strm, cap, pval);
+ 	status = pjmedia_aud_stream_get_cap(strm, cap, pval);
      } else {
  	/* Otherwise retrieve from internal param */
--- 
-1.7.7.1
-
diff --git a/package/pjsip/patches/0004-Pulse-dialing-support-into-pjsip.patch b/package/pjsip/patches/0004-Pulse-dialing-support-into-pjsip.patch
deleted file mode 100644
index 125d472302..0000000000
--- a/package/pjsip/patches/0004-Pulse-dialing-support-into-pjsip.patch
+++ /dev/null
@@ -1,34 +0,0 @@
-From 347ac23bded2fecf8f4f6daa20da4083206ae977 Mon Sep 17 00:00:00 2001
-From: John Crispin <blogic@openwrt.org>
-Date: Mon, 19 Mar 2012 14:55:47 +0100
-Subject: [PATCH 4/4] Pulse dialing support into pjsip.
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-Signed-off-by: Andrej Vlašić <andrej.vlasic0@gmail.com>
----
- .../pjmedia/src/pjmedia-audiodev/tapi_dev.c        |    7 +++++++
- 1 files changed, 7 insertions(+), 0 deletions(-)
-
-diff --git a/pjmedia/src/pjmedia-audiodev/tapi_dev.c b/pjmedia/src/pjmedia-audiodev/tapi_dev.c
-index 2c65a0d..f650a3e 100644
---- a/pjmedia/src/pjmedia-audiodev/tapi_dev.c
-+++ b/pjmedia/src/pjmedia-audiodev/tapi_dev.c
-@@ -833,6 +833,13 @@ tapi_dev_event_handler(tapi_aud_stream_t *stream)
- 				if(tapi_digit_callback)
- 					tapi_digit_callback(i, tapiEvent.data.dtmf.ascii);
- 				break;
-+			case IFX_TAPI_EVENT_PULSE_DIGIT:
-+				if(tapi_digit_callback)
-+					if(tapiEvent.data.pulse.digit == 0xB)
-+						tapi_digit_callback(i, '0');
-+					else
-+						tapi_digit_callback(i, '0' + tapiEvent.data.pulse.digit);
-+				break;
- 			case IFX_TAPI_EVENT_COD_DEC_CHG:
- 			case IFX_TAPI_EVENT_TONE_GEN_END:
- 			case IFX_TAPI_EVENT_CID_TX_SEQ_END:
--- 
-1.7.7.1
-
-- 
2.30.2