Changeset 1735


Ignore:
Timestamp:
Jan 23, 2008 8:39:07 PM (16 years ago)
Author:
bennylp
Message:

Ticket #61: Implement SRTP support in PJMEDIA and PJSUA-LIB, and updated applications because of the changes. This is a major modification back ported from SRTP branch. See ticket #61 for changelog detail of this commit

Location:
pjproject/trunk
Files:
25 edited
2 copied

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/build.mak.in

    r1573 r1735  
    99 
    1010# Determine which party libraries to use 
    11 export APP_THIRD_PARTY_LIBS := -lresample-$(TARGET_NAME) -lmilenage-$(TARGET_NAME) 
     11export APP_THIRD_PARTY_LIBS := -lresample-$(TARGET_NAME) -lmilenage-$(TARGET_NAME) -lsrtp-$(TARGET_NAME) 
    1212 
    1313ifneq (@ac_no_gsm_codec@,1) 
  • pjproject/trunk/pjmedia/build/Makefile

    r1664 r1735  
    33THIRD_PARTY:=$(PJDIR)/third_party 
    44PA_DIR := $(THIRD_PARTY)/build/portaudio/src 
     5 
     6SRTP_INC=$(CC_INC)$(THIRD_PARTY)/build/srtp \ 
     7         $(CC_INC)$(THIRD_PARTY)/srtp/crypto/include \ 
     8         $(CC_INC)$(THIRD_PARTY)/srtp/include 
    59 
    610include $(PJDIR)/build/common.mak 
     
    2630                   $(CC_INC)../../pjlib-util/include \ 
    2731                   $(CC_INC)../../pjnath/include \ 
    28                    $(CC_INC)../.. 
     32                   $(CC_INC)../.. \ 
     33                   $(SRTP_INC)  
    2934export _CXXFLAGS:= $(_CFLAGS) $(CC_CXXFLAGS) $(OS_CXXFLAGS) $(M_CXXFLAGS) \ 
    3035                   $(HOST_CXXFLAGS) $(CXXFLAGS) 
     
    4954                        resample_port.o rtcp.o rtp.o sdp.o sdp_cmp.o sdp_neg.o \ 
    5055                        session.o silencedet.o sound_port.o stream.o \ 
    51                         tonegen.o transport_ice.o transport_udp.o \ 
     56                        tonegen.o transport_ice.o transport_srtp.o \ 
     57                        transport_udp.o \ 
    5258                        wav_player.o wav_playlist.o wav_writer.o wave.o \ 
    5359                        $(SOUND_OBJS) $(NULLSOUND_OBJS) 
  • pjproject/trunk/pjmedia/build/pjmedia.dsp

    r1664 r1735  
    4343F90=df.exe 
    4444# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c 
    45 # ADD CPP /nologo /MD /W4 /GX /Zi /O2 /I "../include" /I "../../pjlib/include" /I "../../pjlib-util/include" /I "../../pjnath/include" /I "../../third_party/portaudio/include" /I "../../third_party/speex/include" /I "../.." /D "NDEBUG" /D "WIN32" /D "_MBCS" /D "_LIB" /D PJ_WIN32=1 /D PJ_M_I386=1 /FR /FD /c 
     45# ADD CPP /nologo /MD /W4 /GX /Zi /O2 /I "../include" /I "../../pjlib/include" /I "../../pjlib-util/include" /I "../../pjnath/include" /I "../../third_party/portaudio/include" /I "../../third_party/speex/include" /I "../../third_party/build/srtp" /I "../../third_party/srtp/crypto/include" /I "../../third_party/srtp/include" /I "../.." /D "NDEBUG" /D "WIN32" /D "_MBCS" /D "_LIB" /D PJ_WIN32=1 /D PJ_M_I386=1 /FR /FD /c 
    4646# SUBTRACT CPP /YX 
    4747# ADD BASE RSC /l 0x409 /d "NDEBUG" 
     
    6868F90=df.exe 
    6969# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c 
    70 # ADD CPP /nologo /MTd /W4 /Gm /GX /ZI /Od /I "../include" /I "../../pjlib/include" /I "../../pjlib-util/include" /I "../../pjnath/include" /I "../../third_party/portaudio/include" /I "../../third_party/speex/include" /I "../.." /D "_DEBUG" /D "WIN32" /D "_MBCS" /D "_LIB" /D PJ_WIN32=1 /D PJ_M_I386=1 /FR /FD /GZ /c 
     70# ADD CPP /nologo /MTd /W4 /Gm /GX /ZI /Od /I "../include" /I "../../pjlib/include" /I "../../pjlib-util/include" /I "../../pjnath/include" /I "../../third_party/portaudio/include" /I "../../third_party/speex/include" /I "../../third_party/build/srtp" /I "../../third_party/srtp/crypto/include" /I "../../third_party/srtp/include" /I "../.." /D "_DEBUG" /D "WIN32" /D "_MBCS" /D "_LIB" /D PJ_WIN32=1 /D PJ_M_I386=1 /FR /FD /GZ /c 
    7171# SUBTRACT CPP /YX 
    7272# ADD BASE RSC /l 0x409 /d "_DEBUG" 
     
    250250# Begin Source File 
    251251 
     252SOURCE=..\src\pjmedia\transport_srtp.c 
     253# End Source File 
     254# Begin Source File 
     255 
    252256SOURCE=..\src\pjmedia\transport_udp.c 
    253257# End Source File 
     
    407411 
    408412SOURCE=..\include\pjmedia\transport_ice.h 
     413# End Source File 
     414# Begin Source File 
     415 
     416SOURCE=..\include\pjmedia\transport_srtp.h 
    409417# End Source File 
    410418# Begin Source File 
  • pjproject/trunk/pjmedia/build/pjmedia.vcproj

    r1664 r1735  
    4444                                Optimization="2" 
    4545                                InlineFunctionExpansion="1" 
    46                                 AdditionalIncludeDirectories="../include,../../pjlib/include,../../pjlib-util/include,../../pjnath/include,../../third_party/portaudio/include,../../third_party/speex/include,../.." 
     46                                AdditionalIncludeDirectories="../include;../../pjlib/include;"../../pjlib-util/include";../../pjnath/include;../../third_party/portaudio/include;../../third_party/speex/include;../../third_party/build/srtp;../../third_party/srtp/include;../../third_party/srtp/crypto/include;../.." 
    4747                                PreprocessorDefinitions="NDEBUG;WIN32;_LIB;PJ_WIN32=1;PJ_M_I386=1" 
    4848                                StringPooling="true" 
     
    120120                                Name="VCCLCompilerTool" 
    121121                                Optimization="0" 
    122                                 AdditionalIncludeDirectories="../include,../../pjlib/include,../../pjlib-util/include,../../pjnath/include,../../third_party/portaudio/include,../../third_party/speex/include,../.." 
     122                                AdditionalIncludeDirectories="../include;../../pjlib/include;"../../pjlib-util/include";../../pjnath/include;../../third_party/portaudio/include;../../third_party/speex/include;../../third_party/build/srtp;../../third_party/srtp/include;../../third_party/srtp/crypto/include;../.." 
    123123                                PreprocessorDefinitions="_DEBUG;WIN32;_LIB;PJ_WIN32=1;PJ_M_I386=1" 
    124124                                MinimalRebuild="true" 
     
    967967                        </File> 
    968968                        <File 
     969                                RelativePath="..\src\pjmedia\transport_srtp.c" 
     970                                > 
     971                        </File> 
     972                        <File 
    969973                                RelativePath="..\src\pjmedia\transport_udp.c" 
    970974                                > 
     
    12181222                        </File> 
    12191223                        <File 
     1224                                RelativePath="..\include\pjmedia\transport_srtp.h" 
     1225                                > 
     1226                        </File> 
     1227                        <File 
    12201228                                RelativePath="..\include\pjmedia\transport_udp.h" 
    12211229                                > 
  • pjproject/trunk/pjmedia/include/pjmedia.h

    r1177 r1735  
    5555#include <pjmedia/transport.h> 
    5656#include <pjmedia/transport_ice.h> 
     57#include <pjmedia/transport_srtp.h> 
    5758#include <pjmedia/transport_udp.h> 
    5859#include <pjmedia/wav_playlist.h> 
  • pjproject/trunk/pjmedia/include/pjmedia/config.h

    r1715 r1735  
    485485 
    486486 
     487/** 
     488 * SRTP Transport 
     489 * By default it is enabled. 
     490 */ 
     491#ifndef PJMEDIA_HAS_SRTP 
     492#   define PJMEDIA_HAS_SRTP                         1 
     493#endif 
     494 
    487495 
    488496/** 
  • pjproject/trunk/pjmedia/include/pjmedia/errno.h

    r1639 r1735  
    4343 */ 
    4444#define PJMEDIA_ERRNO_START       (PJ_ERRNO_START_USER + PJ_ERRNO_SPACE_SIZE) 
     45#define PJMEDIA_ERRNO_END         (PJMEDIA_ERRNO_START + PJ_ERRNO_SPACE_SIZE - 1) 
    4546 
    4647 
     
    4849 * Mapping from PortAudio error codes to pjmedia error space. 
    4950 */ 
    50 #define PJMEDIA_PORTAUDIO_ERRNO_START (PJMEDIA_ERRNO_START+PJ_ERRNO_SPACE_SIZE-1000) 
    51  
     51#define PJMEDIA_PORTAUDIO_ERRNO_START (PJMEDIA_ERRNO_END-10000) 
     52#define PJMEDIA_PORTAUDIO_ERRNO_END   (PJMEDIA_PORTAUDIO_ERRNO_START + 10000 -1) 
    5253/** 
    5354 * Convert PortAudio error code to PJMEDIA error code. 
    54  */ 
    55 #define PJMEDIA_ERRNO_FROM_PORTAUDIO(err)   (err+PJMEDIA_PORTAUDIO_ERRNO_START) 
    56  
     55 * PortAudio error code range: 0 >= err >= -10000 
     56 */ 
     57#define PJMEDIA_ERRNO_FROM_PORTAUDIO(err)   ((int)PJMEDIA_PORTAUDIO_ERRNO_START-err) 
     58 
     59 
     60#if defined(PJMEDIA_HAS_SRTP) && (PJMEDIA_HAS_SRTP != 0) 
     61 
     62 /** 
     63 * Mapping from LibSRTP error codes to pjmedia error space. 
     64 */ 
     65#define PJMEDIA_LIBSRTP_ERRNO_START (PJMEDIA_ERRNO_END-10200) 
     66#define PJMEDIA_LIBSRTP_ERRNO_END   (PJMEDIA_LIBSRTP_ERRNO_START + 200 - 1) 
     67/** 
     68 * Convert LibSRTP error code to PJMEDIA error code. 
     69 * LibSRTP error code range: 0 <= err < 200 
     70 */ 
     71#define PJMEDIA_ERRNO_FROM_LIBSRTP(err)   (PJMEDIA_LIBSRTP_ERRNO_START+err) 
     72 
     73#endif 
    5774 
    5875/************************************************************ 
     
    525542 */ 
    526543#define PJMEDIA_ESNDINSAMPLEFMT     (PJMEDIA_ERRNO_START+203)    /* 220203 */ 
     544 
     545 
     546#if defined(PJMEDIA_HAS_SRTP) && (PJMEDIA_HAS_SRTP != 0) 
     547/************************************************************ 
     548 * SRTP TRANSPORT ERRORS 
     549 ***********************************************************/ 
     550/** 
     551 * @hideinitializer 
     552 * SRTP crypto-suite name not match the offerer tag. 
     553 */ 
     554#define PJMEDIA_SRTP_ECRYPTONOTMATCH (PJMEDIA_ERRNO_START+220)   /* 220220 */ 
     555/** 
     556 * @hideinitializer 
     557 * Invalid SRTP key length for specific crypto. 
     558 */ 
     559#define PJMEDIA_SRTP_EINKEYLEN      (PJMEDIA_ERRNO_START+221)    /* 220221 */ 
     560/** 
     561 * @hideinitializer 
     562 * Unsupported SRTP crypto-suite. 
     563 */ 
     564#define PJMEDIA_SRTP_ENOTSUPCRYPTO  (PJMEDIA_ERRNO_START+222)    /* 220222 */ 
     565/** 
     566 * @hideinitializer 
     567 * SRTP SDP contains ambigue answer. 
     568 */ 
     569#define PJMEDIA_SRTP_ESDPAMBIGUEANS (PJMEDIA_ERRNO_START+223)    /* 220223 */ 
     570/** 
     571 * @hideinitializer 
     572 * Duplicated crypto tag. 
     573 */ 
     574#define PJMEDIA_SRTP_ESDPDUPCRYPTOTAG (PJMEDIA_ERRNO_START+224)  /* 220224 */ 
     575/** 
     576 * @hideinitializer 
     577 * Invalid crypto attribute. 
     578 */ 
     579#define PJMEDIA_SRTP_ESDPINCRYPTO   (PJMEDIA_ERRNO_START+225)    /* 220225 */ 
     580/** 
     581 * @hideinitializer 
     582 * Invalid crypto tag. 
     583 */ 
     584#define PJMEDIA_SRTP_ESDPINCRYPTOTAG (PJMEDIA_ERRNO_START+226)   /* 220226 */ 
     585/** 
     586 * @hideinitializer 
     587 * Invalid SDP media transport for SRTP. 
     588 */ 
     589#define PJMEDIA_SRTP_ESDPINTRANSPORT (PJMEDIA_ERRNO_START+227)   /* 220227 */ 
     590/** 
     591 * @hideinitializer 
     592 * SRTP crypto attribute required in SDP. 
     593 */ 
     594#define PJMEDIA_SRTP_ESDPREQCRYPTO  (PJMEDIA_ERRNO_START+228)    /* 220228 */ 
     595/** 
     596 * @hideinitializer 
     597 * Secure transport required in SDP media descriptor. 
     598 */ 
     599#define PJMEDIA_SRTP_ESDPREQSECTP   (PJMEDIA_ERRNO_START+229)    /* 220229 */ 
     600 
     601#endif /* PJMEDIA_HAS_SRTP */ 
    527602 
    528603 
  • pjproject/trunk/pjmedia/include/pjmedia/transport.h

    r1098 r1735  
    167167PJ_BEGIN_DECL 
    168168 
     169#include <pjmedia/sdp.h> 
    169170 
    170171/* 
     
    243244                             const void *pkt, 
    244245                             pj_size_t size); 
     246 
     247    /** 
     248     * This function is called by application to generate the SDP parts 
     249     * related to transport type, e.g: ICE, SRTP. 
     250     * 
     251     * Application should call #pjmedia_transport_media_create() instead of  
     252     * calling this function directly. 
     253     */ 
     254    pj_status_t (*media_create)(pjmedia_transport *tp, 
     255                                pj_pool_t *pool, 
     256                                pjmedia_sdp_session *sdp_local, 
     257                                const pjmedia_sdp_session *sdp_remote, 
     258                                unsigned media_index); 
     259 
     260    /** 
     261     * This function is called by application to start the transport 
     262     * based on SDP negotiation result. 
     263     * 
     264     * Application should call #pjmedia_transport_media_start() instead of  
     265     * calling this function directly. 
     266     */ 
     267    pj_status_t (*media_start) (pjmedia_transport *tp, 
     268                                pj_pool_t *pool, 
     269                                pjmedia_sdp_session *sdp_local, 
     270                                const pjmedia_sdp_session *sdp_remote, 
     271                                unsigned media_index); 
     272 
     273    /** 
     274     * This function is called by application to stop the transport. 
     275     * 
     276     * Application should call #pjmedia_transport_media_stop() instead of  
     277     * calling this function directly. 
     278     */ 
     279    pj_status_t (*media_stop)  (pjmedia_transport *tp); 
     280 
     281    /** 
     282     * This function can be called to simulate packet lost. 
     283     * 
     284     * Application should call #pjmedia_transport_simulate_lost() instead of  
     285     * calling this function directly. 
     286     */ 
     287    pj_status_t (*simulate_lost)(pjmedia_transport *tp, 
     288                                 pjmedia_dir dir, 
     289                                 unsigned pct_lost); 
    245290 
    246291    /** 
     
    411456 
    412457/** 
     458 * Generate local SDP parts that are related to the specified media transport. 
     459 * Remote SDP might be needed as reference when application is in deciding 
     460 * side of negotiation (callee side), otherwise it should be NULL. 
     461 * This is just a simple wrapper which calls <tt>media_create()</tt> member  
     462 * of the transport. 
     463 * 
     464 * @param tp            The media transport. 
     465 * @param pool          The memory pool. 
     466 * @param sdp_local     Local SDP. 
     467 * @param sdp_remote    Remote SDP. 
     468 * 
     469 * @return              PJ_SUCCESS on success, or the appropriate error code. 
     470 */ 
     471PJ_INLINE(pj_status_t) pjmedia_transport_media_create(pjmedia_transport *tp, 
     472                                    pj_pool_t *pool, 
     473                                    pjmedia_sdp_session *sdp_local, 
     474                                    const pjmedia_sdp_session *sdp_remote, 
     475                                    unsigned media_index) 
     476{ 
     477    return (*tp->op->media_create)(tp, pool, sdp_local, sdp_remote,  
     478                                   media_index); 
     479} 
     480 
     481/** 
     482 * Start the transport with regards to SDP negotiation result.  
     483 * This is just a simple wrapper which calls <tt>media_start()</tt> member  
     484 * of the transport. 
     485 * 
     486 * @param tp            The media transport. 
     487 * @param pool          The memory pool. 
     488 * @param sdp_local     Local SDP. 
     489 * @param sdp_remote    Remote SDP. 
     490 * @param media_index   Media index to start. 
     491 * 
     492 * @return              PJ_SUCCESS on success, or the appropriate error code. 
     493 */ 
     494PJ_INLINE(pj_status_t) pjmedia_transport_media_start(pjmedia_transport *tp, 
     495                                    pj_pool_t *pool, 
     496                                    pjmedia_sdp_session *sdp_local, 
     497                                    const pjmedia_sdp_session *sdp_remote, 
     498                                    unsigned media_index) 
     499{ 
     500    return (*tp->op->media_start)(tp, pool, sdp_local, sdp_remote, media_index); 
     501} 
     502 
     503 
     504/** 
     505 * Stop the transport.  
     506 * This is just a simple wrapper which calls <tt>media_stop()</tt> member  
     507 * of the transport. 
     508 * 
     509 * @param tp            The media transport. 
     510 * 
     511 * @return              PJ_SUCCESS on success, or the appropriate error code. 
     512 */ 
     513PJ_INLINE(pj_status_t) pjmedia_transport_media_stop(pjmedia_transport *tp) 
     514{ 
     515    return (*tp->op->media_stop)(tp); 
     516} 
     517 
     518/** 
    413519 * Close media transport. This is just a simple wrapper which calls  
    414520 * <tt>destroy()</tt> member of the transport. This function will free 
     
    427533} 
    428534 
     535/** 
     536 * Simulate packet lost in the specified direction (for testing purposes). 
     537 * When enabled, the transport will randomly drop packets to the specified 
     538 * direction. 
     539 * 
     540 * @param tp        The media transport. 
     541 * @param dir       Media direction to which packets will be randomly dropped. 
     542 * @param pct_lost  Percent lost (0-100). Set to zero to disable packet 
     543 *                  lost simulation. 
     544 * 
     545 * @return          PJ_SUCCESS on success. 
     546 */ 
     547PJ_INLINE(pj_status_t) pjmedia_transport_simulate_lost(pjmedia_transport *tp, 
     548                                                       pjmedia_dir dir, 
     549                                                       unsigned pct_lost) 
     550{ 
     551    return (*tp->op->simulate_lost)(tp, dir, pct_lost); 
     552} 
     553 
    429554 
    430555PJ_END_DECL 
  • pjproject/trunk/pjmedia/include/pjmedia/transport_ice.h

    r1436 r1735  
    1717 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA  
    1818 */ 
    19 #ifndef __pjmedia_ice_H__ 
    20 #define __pjmedia_ice_H__ 
     19#ifndef __PJMEDIA_TRANSPORT_ICE_H__ 
     20#define __PJMEDIA_TRANSPORT_ICE_H__ 
    2121 
    2222 
     
    7575                                        const pjmedia_ice_cb *cb, 
    7676                                        pjmedia_transport **p_tp); 
    77  
    78 /** 
    79  * Destroy the media transport. 
    80  * 
    81  * @param tp            The media transport. 
    82  * 
    83  * @return              PJ_SUCCESS. 
    84  */ 
    85 PJ_DECL(pj_status_t) pjmedia_ice_destroy(pjmedia_transport *tp); 
    8677 
    8778 
     
    170161                                          const pj_str_t *local_passwd); 
    171162 
    172 /** 
    173  * Modify the SDP to add ICE specific SDP attributes before sending 
    174  * the SDP to remote host. 
    175  * 
    176  * @param tp            The media transport. 
    177  * @param pool          Pool to allocate memory for the SDP elements. 
    178  * @param sdp           The SDP descriptor to be modified. 
    179  * 
    180  * @return              PJ_SUCCESS, or the appropriate error code. 
    181  */ 
    182 PJ_DECL(pj_status_t) pjmedia_ice_modify_sdp(pjmedia_transport *tp, 
    183                                             pj_pool_t *pool, 
    184                                             pjmedia_sdp_session *sdp); 
    185  
    186 /** 
    187  * Start ICE connectivity checks. 
    188  * 
    189  * This function will pair the local and remote candidates to create  
    190  * check list. Once the check list is created and sorted based on the 
    191  * priority, ICE periodic checks will be started. This function will  
    192  * return immediately, and application will be notified about the  
    193  * connectivity check status in the callback. 
    194  * 
    195  * @param tp            The media transport. 
    196  * @param pool          Memory pool to parse the SDP. 
    197  * @param rem_sdp       The SDP received from remote agent. 
    198  * @param media_index   The media index (in SDP) to process. 
    199  * 
    200  * @return              PJ_SUCCESS, or the appropriate error code. 
    201  */ 
    202 PJ_DECL(pj_status_t) pjmedia_ice_start_ice(pjmedia_transport *tp, 
    203                                            pj_pool_t *pool, 
    204                                            const pjmedia_sdp_session *rem_sdp, 
    205                                            unsigned media_index); 
    206  
    207 /** 
    208  * Stop the ICE session (typically when the call is terminated). Application 
    209  * may restart the ICE session again by calling #pjmedia_ice_init_ice(), 
    210  * for example to use this media transport for the next call. 
    211  * 
    212  * @param tp            The media transport. 
    213  * 
    214  * @return              PJ_SUCCESS, or the appropriate error code. 
    215  */ 
    216 PJ_DECL(pj_status_t) pjmedia_ice_stop_ice(pjmedia_transport *tp); 
    217  
    218  
    219 /** 
    220  * Simulate packet lost in the specified direction (for testing purposes). 
    221  * When enabled, the transport will randomly drop packets to the specified 
    222  * direction. 
    223  * 
    224  * @param tp        The ICE media transport. 
    225  * @param dir       Media direction to which packets will be randomly dropped. 
    226  * @param pct_lost  Percent lost (0-100). Set to zero to disable packet 
    227  *                  lost simulation. 
    228  * 
    229  * @return          PJ_SUCCESS on success. 
    230  */ 
    231 PJ_DECL(pj_status_t) pjmedia_ice_simulate_lost(pjmedia_transport *tp, 
    232                                                pjmedia_dir dir, 
    233                                                unsigned pct_lost); 
    234  
    235  
    236  
    237163 
    238164PJ_END_DECL 
     
    244170 
    245171 
    246 #endif  /* __pjmedia_ice_H__ */ 
     172#endif  /* __PJMEDIA_TRANSPORT_ICE_H__ */ 
    247173 
    248174 
  • pjproject/trunk/pjmedia/include/pjmedia/transport_udp.h

    r1615 r1735  
    5454    PJMEDIA_UDP_NO_SRC_ADDR_CHECKING = 1 
    5555}; 
    56  
    57  
    58 /** 
    59  * UDP transport info. 
    60  */ 
    61 typedef struct pjmedia_transport_udp_info 
    62 { 
    63     /** 
    64      * Media socket info. 
    65      */ 
    66     pjmedia_sock_info   skinfo; 
    67  
    68 } pjmedia_transport_udp_info; 
    6956 
    7057 
     
    138125                                                   pjmedia_transport **p_tp); 
    139126 
    140 /** 
    141  * Get media socket info from the specified UDP transport. 
    142  * 
    143  * @param tp        The UDP transport interface. 
    144  * @param info      Media socket info to be initialized. 
    145  * 
    146  * @return          PJ_SUCCESS on success. 
    147  */ 
    148 PJ_DECL(pj_status_t)  
    149 pjmedia_transport_udp_get_info( pjmedia_transport *tp, 
    150                                 pjmedia_transport_udp_info *info); 
    151  
    152127 
    153128/** 
     
    170145 
    171146 
    172 /** 
    173  * Simulate packet lost in the specified direction (for testing purposes). 
    174  * When enabled, the transport will randomly drop packets to the specified 
    175  * direction. 
    176  * 
    177  * @param tp        The UDP media transport. 
    178  * @param dir       Media direction to which packets will be randomly dropped. 
    179  * @param pct_lost  Percent lost (0-100). Set to zero to disable packet 
    180  *                  lost simulation. 
    181  * 
    182  * @return          PJ_SUCCESS on success. 
    183  */ 
    184 PJ_DECL(pj_status_t) pjmedia_transport_udp_simulate_lost(pjmedia_transport *tp, 
    185                                                          pjmedia_dir dir, 
    186                                                          unsigned pct_lost); 
    187  
    188  
    189  
    190 /** 
    191  * Close UDP transport. Application can also use the "destroy" member of 
    192  * media transport interface to close the UDP transport. 
    193  * 
    194  * @param tp        The UDP media transport. 
    195  * 
    196  * @return          PJ_SUCCESS on success. 
    197  */ 
    198 PJ_DECL(pj_status_t) pjmedia_transport_udp_close(pjmedia_transport *tp); 
    199  
    200  
    201  
    202147PJ_END_DECL 
    203148 
  • pjproject/trunk/pjmedia/src/pjmedia/errno.c

    r1639 r1735  
    2424#endif 
    2525 
     26#if defined(PJMEDIA_HAS_SRTP) && (PJMEDIA_HAS_SRTP != 0) 
     27    const char* get_libsrtp_errstr(int err); 
     28#endif 
    2629 
    2730 
     
    142145    PJ_BUILD_ERR( PJMEDIA_ESNDINDEVID,      "Invalid sound device ID" ), 
    143146    PJ_BUILD_ERR( PJMEDIA_ESNDINSAMPLEFMT,  "Invalid sample format for sound device" ), 
     147 
     148#if defined(PJMEDIA_HAS_SRTP) && (PJMEDIA_HAS_SRTP != 0) 
     149    /* SRTP transport errors: */ 
     150    PJ_BUILD_ERR( PJMEDIA_SRTP_ECRYPTONOTMATCH, "SRTP crypto-suite name not match the offerer tag" ), 
     151    PJ_BUILD_ERR( PJMEDIA_SRTP_EINKEYLEN,       "Invalid SRTP key length for specific crypto" ), 
     152    PJ_BUILD_ERR( PJMEDIA_SRTP_ENOTSUPCRYPTO,   "Unsupported SRTP crypto-suite" ), 
     153    PJ_BUILD_ERR( PJMEDIA_SRTP_ESDPAMBIGUEANS,  "SRTP SDP contains ambigue answer" ), 
     154    PJ_BUILD_ERR( PJMEDIA_SRTP_ESDPDUPCRYPTOTAG,"Duplicated SRTP crypto tag" ), 
     155    PJ_BUILD_ERR( PJMEDIA_SRTP_ESDPINCRYPTO,    "Invalid SRTP crypto attribute" ), 
     156    PJ_BUILD_ERR( PJMEDIA_SRTP_ESDPINCRYPTOTAG, "Invalid SRTP crypto tag" ), 
     157    PJ_BUILD_ERR( PJMEDIA_SRTP_ESDPINTRANSPORT, "Invalid SDP media transport for SRTP" ), 
     158    PJ_BUILD_ERR( PJMEDIA_SRTP_ESDPREQCRYPTO,   "SRTP crypto attribute required" ), 
     159    PJ_BUILD_ERR( PJMEDIA_SRTP_ESDPREQSECTP,    "Secure transport required in SDP media descriptor" ) 
     160#endif 
     161 
    144162}; 
    145163 
     
    160178    /* See if the error comes from PortAudio. */ 
    161179#if PJMEDIA_SOUND_IMPLEMENTATION==PJMEDIA_SOUND_PORTAUDIO_SOUND 
    162     if (statcode >= PJMEDIA_ERRNO_FROM_PORTAUDIO(paNotInitialized) && 
    163         statcode <  PJMEDIA_ERRNO_FROM_PORTAUDIO(paNotInitialized + 10000)) 
     180    if (statcode >= PJMEDIA_PORTAUDIO_ERRNO_START && 
     181        statcode <= PJMEDIA_PORTAUDIO_ERRNO_END) 
    164182    { 
    165183 
    166         int pa_err = statcode - PJMEDIA_ERRNO_FROM_PORTAUDIO(0); 
     184        //int pa_err = statcode - PJMEDIA_ERRNO_FROM_PORTAUDIO(0); 
     185        int pa_err = PJMEDIA_PORTAUDIO_ERRNO_START - statcode; 
    167186        pj_str_t msg; 
    168187         
     
    176195    } else  
    177196#endif  /* PJMEDIA_SOUND_IMPLEMENTATION */ 
     197 
     198#if defined(PJMEDIA_HAS_SRTP) && (PJMEDIA_HAS_SRTP != 0) 
     199    /* LIBSRTP error */ 
     200    if (statcode >= PJMEDIA_LIBSRTP_ERRNO_START && 
     201        statcode <  PJMEDIA_LIBSRTP_ERRNO_END) 
     202    { 
     203        int err = statcode - PJMEDIA_PORTAUDIO_ERRNO_START; 
     204        pj_str_t msg; 
     205         
     206        msg = pj_str((char*)get_libsrtp_errstr(err)); 
     207 
     208        pj_strncpy_with_null(&errstr, &msg, bufsize); 
     209        return errstr; 
     210     
     211    } else 
     212#endif 
     213     
     214    /* PJMEDIA error */ 
    178215    if (statcode >= PJMEDIA_ERRNO_START &&  
    179                statcode < PJMEDIA_ERRNO_START + PJ_ERRNO_SPACE_SIZE) 
     216               statcode < PJMEDIA_ERRNO_END) 
    180217    { 
    181218        /* Find the error in the table. 
     
    212249 
    213250        }  
    214     } 
    215  
     251    }  
    216252#endif  /* PJ_HAS_ERROR_STRING */ 
    217253 
  • pjproject/trunk/pjmedia/src/pjmedia/transport_ice.c

    r1656 r1735  
    5252 * These are media transport operations. 
    5353 */ 
    54 static pj_status_t tp_get_info(pjmedia_transport *tp, 
    55                                pjmedia_sock_info *info); 
    56 static pj_status_t tp_attach( pjmedia_transport *tp, 
    57                               void *stream, 
    58                               const pj_sockaddr_t *rem_addr, 
    59                               const pj_sockaddr_t *rem_rtcp, 
    60                               unsigned addr_len, 
    61                               void (*rtp_cb)(void*, 
    62                                              const void*, 
    63                                              pj_ssize_t), 
    64                               void (*rtcp_cb)(void*, 
    65                                               const void*, 
    66                                               pj_ssize_t)); 
    67 static void        tp_detach( pjmedia_transport *tp, 
    68                               void *strm); 
    69 static pj_status_t tp_send_rtp( pjmedia_transport *tp, 
    70                                 const void *pkt, 
    71                                 pj_size_t size); 
    72 static pj_status_t tp_send_rtcp( pjmedia_transport *tp, 
    73                                  const void *pkt, 
    74                                  pj_size_t size); 
     54static pj_status_t transport_get_info (pjmedia_transport *tp, 
     55                                       pjmedia_sock_info *info); 
     56static pj_status_t transport_attach   (pjmedia_transport *tp, 
     57                                       void *user_data, 
     58                                       const pj_sockaddr_t *rem_addr, 
     59                                       const pj_sockaddr_t *rem_rtcp, 
     60                                       unsigned addr_len, 
     61                                       void (*rtp_cb)(void*, 
     62                                                      const void*, 
     63                                                      pj_ssize_t), 
     64                                       void (*rtcp_cb)(void*, 
     65                                                       const void*, 
     66                                                       pj_ssize_t)); 
     67static void        transport_detach   (pjmedia_transport *tp, 
     68                                       void *strm); 
     69static pj_status_t transport_send_rtp( pjmedia_transport *tp, 
     70                                       const void *pkt, 
     71                                       pj_size_t size); 
     72static pj_status_t transport_send_rtcp(pjmedia_transport *tp, 
     73                                       const void *pkt, 
     74                                       pj_size_t size); 
     75static pj_status_t transport_media_create(pjmedia_transport *tp, 
     76                                       pj_pool_t *pool, 
     77                                       pjmedia_sdp_session *sdp_local, 
     78                                       const pjmedia_sdp_session *sdp_remote, 
     79                                       unsigned media_index); 
     80static pj_status_t transport_media_start (pjmedia_transport *tp, 
     81                                       pj_pool_t *pool, 
     82                                       pjmedia_sdp_session *sdp_local, 
     83                                       const pjmedia_sdp_session *sdp_remote, 
     84                                       unsigned media_index); 
     85static pj_status_t transport_media_stop(pjmedia_transport *tp); 
     86static pj_status_t transport_simulate_lost(pjmedia_transport *tp, 
     87                                       pjmedia_dir dir, 
     88                                       unsigned pct_lost); 
     89static pj_status_t transport_destroy  (pjmedia_transport *tp); 
    7590 
    7691/* 
     
    85100 
    86101 
    87 static pjmedia_transport_op tp_ice_op =  
    88 { 
    89     &tp_get_info, 
    90     &tp_attach, 
    91     &tp_detach, 
    92     &tp_send_rtp, 
    93     &tp_send_rtcp, 
    94     &pjmedia_ice_destroy 
     102static pjmedia_transport_op transport_ice_op =  
     103{ 
     104    &transport_get_info, 
     105    &transport_attach, 
     106    &transport_detach, 
     107    &transport_send_rtp, 
     108    &transport_send_rtcp, 
     109    &transport_media_create, 
     110    &transport_media_start, 
     111    &transport_media_stop, 
     112    &transport_simulate_lost, 
     113    &transport_destroy 
    95114}; 
    96115 
     
    133152    tp_ice->ice_st = ice_st; 
    134153    pj_ansi_strcpy(tp_ice->base.name, ice_st->obj_name); 
    135     tp_ice->base.op = &tp_ice_op; 
     154    tp_ice->base.op = &transport_ice_op; 
    136155    tp_ice->base.type = PJMEDIA_TRANSPORT_TYPE_ICE; 
    137156 
     
    144163    if (p_tp) 
    145164        *p_tp = &tp_ice->base; 
    146  
    147     return PJ_SUCCESS; 
    148 } 
    149  
    150  
    151 /* 
    152  * Destroy ICE media transport. 
    153  */ 
    154 PJ_DEF(pj_status_t) pjmedia_ice_destroy(pjmedia_transport *tp) 
    155 { 
    156     struct transport_ice *tp_ice = (struct transport_ice*)tp; 
    157  
    158     if (tp_ice->ice_st) { 
    159         pj_ice_strans_destroy(tp_ice->ice_st); 
    160         /*Must not touch tp_ice after ice_st is destroyed! 
    161          (it has the pool) 
    162          tp_ice->ice_st = NULL; 
    163          */ 
    164     } 
    165165 
    166166    return PJ_SUCCESS; 
     
    231231                     comp, PJ_EINVAL); 
    232232 
    233     pj_memcpy(comp, tp_ice->ice_st->comp[comp_id-1], sizeof(pj_ice_strans_comp)); 
     233    pj_memcpy(comp, tp_ice->ice_st->comp[comp_id-1],  
     234              sizeof(pj_ice_strans_comp)); 
    234235    return PJ_SUCCESS;               
    235236} 
     
    247248{ 
    248249    struct transport_ice *tp_ice = (struct transport_ice*)tp; 
    249     return pj_ice_strans_init_ice(tp_ice->ice_st, role, local_ufrag, local_passwd); 
     250    return pj_ice_strans_init_ice(tp_ice->ice_st, role, local_ufrag,  
     251                                  local_passwd); 
    250252} 
    251253 
     
    255257 * This will add ICE attributes to the SDP. 
    256258 */ 
    257 PJ_DEF(pj_status_t) pjmedia_ice_modify_sdp(pjmedia_transport *tp, 
    258                                            pj_pool_t *pool, 
    259                                            pjmedia_sdp_session *sdp) 
    260 { 
    261     struct transport_ice *tp_ice = (struct transport_ice*)tp; 
     259static pj_status_t transport_media_create(pjmedia_transport *tp, 
     260                                       pj_pool_t *pool, 
     261                                       pjmedia_sdp_session *sdp_local, 
     262                                       const pjmedia_sdp_session *sdp_remote, 
     263                                       unsigned media_index) 
     264{ 
     265    struct transport_ice *tp_ice = (struct transport_ice*)tp; 
     266    pj_ice_sess_role ice_role; 
    262267    enum { MAXLEN = 256 }; 
    263268    char *buffer; 
    264269    pjmedia_sdp_attr *attr; 
    265270    unsigned i, cand_cnt; 
     271    pj_status_t status; 
     272 
     273    /* Init ICE */ 
     274    ice_role = (sdp_remote==NULL ? PJ_ICE_SESS_ROLE_CONTROLLING :  
     275                                   PJ_ICE_SESS_ROLE_CONTROLLED); 
     276 
     277    status = pjmedia_ice_init_ice(tp, ice_role, NULL, NULL); 
     278    if (status != PJ_SUCCESS) 
     279        return status; 
     280 
    266281 
    267282    buffer = (char*) pj_pool_alloc(pool, MAXLEN); 
     
    270285    attr = pjmedia_sdp_attr_create(pool, "ice-ufrag",  
    271286                                   &tp_ice->ice_st->ice->rx_ufrag); 
    272     sdp->attr[sdp->attr_count++] = attr; 
     287    sdp_local->attr[sdp_local->attr_count++] = attr; 
    273288 
    274289    /* Create ice-pwd attribute */ 
    275290    attr = pjmedia_sdp_attr_create(pool, "ice-pwd",  
    276291                                   &tp_ice->ice_st->ice->rx_pass); 
    277     sdp->attr[sdp->attr_count++] = attr; 
     292    sdp_local->attr[sdp_local->attr_count++] = attr; 
    278293 
    279294    /* Add all candidates (to media level) */ 
     
    281296    for (i=0; i<cand_cnt; ++i) { 
    282297        pj_ice_sess_cand *cand; 
     298        pjmedia_sdp_media *m; 
    283299        pj_str_t value; 
    284300        int len; 
     
    330346        value = pj_str(buffer); 
    331347        attr = pjmedia_sdp_attr_create(pool, "candidate", &value); 
    332         sdp->media[0]->attr[sdp->media[0]->attr_count++] = attr; 
     348        m = sdp_local->media[media_index]; 
     349        m->attr[m->attr_count++] = attr; 
    333350    } 
    334351 
     
    457474    PJ_LOG(4,(tp_ice->ice_st->obj_name,  
    458475              "Disabling local ICE, reason=%s", reason)); 
    459     pjmedia_ice_stop_ice(&tp_ice->base); 
     476    transport_media_stop(&tp_ice->base); 
    460477} 
    461478 
     
    464481 * Start ICE checks when both offer and answer are available. 
    465482 */ 
    466 PJ_DEF(pj_status_t) pjmedia_ice_start_ice(pjmedia_transport *tp, 
    467                                           pj_pool_t *pool, 
    468                                           const pjmedia_sdp_session *rem_sdp, 
    469                                           unsigned media_index) 
     483static pj_status_t transport_media_start(pjmedia_transport *tp, 
     484                                         pj_pool_t *pool, 
     485                                         pjmedia_sdp_session *sdp_local, 
     486                                         const pjmedia_sdp_session *sdp_remote, 
     487                                         unsigned media_index) 
    470488{ 
    471489    struct transport_ice *tp_ice = (struct transport_ice*)tp; 
     
    482500    pj_status_t status; 
    483501 
    484     PJ_ASSERT_RETURN(tp && pool && rem_sdp, PJ_EINVAL); 
    485     PJ_ASSERT_RETURN(media_index < rem_sdp->media_count, PJ_EINVAL); 
    486  
    487     sdp_med = rem_sdp->media[media_index]; 
     502    PJ_UNUSED_ARG(sdp_local); 
     503 
     504    PJ_ASSERT_RETURN(tp && pool && sdp_remote, PJ_EINVAL); 
     505    PJ_ASSERT_RETURN(media_index < sdp_remote->media_count, PJ_EINVAL); 
     506 
     507    sdp_med = sdp_remote->media[media_index]; 
    488508 
    489509    /* Get the SDP connection for the media stream. 
     
    493513    conn = sdp_med->conn; 
    494514    if (conn == NULL) 
    495         conn = rem_sdp->conn; 
     515        conn = sdp_remote->conn; 
    496516 
    497517    if (conn == NULL) { 
     
    508528    if (attr == NULL) { 
    509529        /* Find ice-ufrag attribute in session descriptor */ 
    510         attr = pjmedia_sdp_attr_find2(rem_sdp->attr_count, rem_sdp->attr, 
     530        attr = pjmedia_sdp_attr_find2(sdp_remote->attr_count, sdp_remote->attr, 
    511531                                      "ice-ufrag", NULL); 
    512532        if (attr == NULL) { 
     
    522542    if (attr == NULL) { 
    523543        /* Find ice-pwd attribute in session descriptor */ 
    524         attr = pjmedia_sdp_attr_find2(rem_sdp->attr_count, rem_sdp->attr, 
     544        attr = pjmedia_sdp_attr_find2(sdp_remote->attr_count, sdp_remote->attr, 
    525545                                      "ice-pwd", NULL); 
    526546        if (attr == NULL) { 
     
    609629 
    610630 
    611 PJ_DEF(pj_status_t) pjmedia_ice_stop_ice(pjmedia_transport *tp) 
     631static pj_status_t transport_media_stop(pjmedia_transport *tp) 
    612632{ 
    613633    struct transport_ice *tp_ice = (struct transport_ice*)tp; 
     
    616636 
    617637 
    618 static pj_status_t tp_get_info(pjmedia_transport *tp, 
    619                                pjmedia_sock_info *info) 
     638static pj_status_t transport_get_info(pjmedia_transport *tp, 
     639                                      pjmedia_sock_info *info) 
    620640{ 
    621641    struct transport_ice *tp_ice = (struct transport_ice*)tp; 
     
    649669 
    650670 
    651 static pj_status_t tp_attach( pjmedia_transport *tp, 
    652                               void *stream, 
    653                               const pj_sockaddr_t *rem_addr, 
    654                               const pj_sockaddr_t *rem_rtcp, 
    655                               unsigned addr_len, 
    656                               void (*rtp_cb)(void*, 
    657                                              const void*, 
    658                                              pj_ssize_t), 
    659                               void (*rtcp_cb)(void*, 
    660                                               const void*, 
    661                                               pj_ssize_t)) 
     671static pj_status_t transport_attach  (pjmedia_transport *tp, 
     672                                      void *stream, 
     673                                      const pj_sockaddr_t *rem_addr, 
     674                                      const pj_sockaddr_t *rem_rtcp, 
     675                                      unsigned addr_len, 
     676                                      void (*rtp_cb)(void*, 
     677                                                     const void*, 
     678                                                     pj_ssize_t), 
     679                                      void (*rtcp_cb)(void*, 
     680                                                      const void*, 
     681                                                      pj_ssize_t)) 
    662682{ 
    663683    struct transport_ice *tp_ice = (struct transport_ice*)tp; 
     
    674694 
    675695 
    676 static void tp_detach(pjmedia_transport *tp, 
    677                       void *strm) 
     696static void transport_detach(pjmedia_transport *tp, 
     697                             void *strm) 
    678698{ 
    679699    struct transport_ice *tp_ice = (struct transport_ice*)tp; 
     
    687707 
    688708 
    689 static pj_status_t tp_send_rtp(pjmedia_transport *tp, 
    690                                const void *pkt, 
    691                                pj_size_t size) 
     709static pj_status_t transport_send_rtp(pjmedia_transport *tp, 
     710                                      const void *pkt, 
     711                                      pj_size_t size) 
    692712{ 
    693713    struct transport_ice *tp_ice = (struct transport_ice*)tp; 
     
    709729 
    710730 
    711 static pj_status_t tp_send_rtcp(pjmedia_transport *tp, 
    712                                 const void *pkt, 
    713                                 pj_size_t size) 
     731static pj_status_t transport_send_rtcp(pjmedia_transport *tp, 
     732                                       const void *pkt, 
     733                                       pj_size_t size) 
    714734{ 
    715735    struct transport_ice *tp_ice = (struct transport_ice*)tp; 
     
    799819 
    800820/* Simulate lost */ 
    801 PJ_DEF(pj_status_t) pjmedia_ice_simulate_lost( pjmedia_transport *tp, 
    802                                                pjmedia_dir dir, 
    803                                                unsigned pct_lost) 
     821static pj_status_t transport_simulate_lost(pjmedia_transport *tp, 
     822                                           pjmedia_dir dir, 
     823                                           unsigned pct_lost) 
    804824{ 
    805825    struct transport_ice *ice = (struct transport_ice*) tp; 
     
    816836} 
    817837 
     838 
     839/* 
     840 * Destroy ICE media transport. 
     841 */ 
     842static pj_status_t transport_destroy(pjmedia_transport *tp) 
     843{ 
     844    struct transport_ice *tp_ice = (struct transport_ice*)tp; 
     845 
     846    if (tp_ice->ice_st) { 
     847        pj_ice_strans_destroy(tp_ice->ice_st); 
     848        /*Must not touch tp_ice after ice_st is destroyed! 
     849         (it has the pool) 
     850         tp_ice->ice_st = NULL; 
     851         */ 
     852    } 
     853 
     854    return PJ_SUCCESS; 
     855} 
     856 
  • pjproject/trunk/pjmedia/src/pjmedia/transport_udp.c

    r1630 r1735  
    9595                       pj_ssize_t bytes_read); 
    9696 
    97 static pj_status_t transport_get_info(pjmedia_transport *tp, 
    98                                       pjmedia_sock_info *info); 
    99 static pj_status_t transport_attach(   pjmedia_transport *tp, 
     97/* 
     98 * These are media transport operations. 
     99 */ 
     100static pj_status_t transport_get_info (pjmedia_transport *tp, 
     101                                       pjmedia_sock_info *info); 
     102static pj_status_t transport_attach   (pjmedia_transport *tp, 
    100103                                       void *user_data, 
    101104                                       const pj_sockaddr_t *rem_addr, 
     
    108111                                                       const void*, 
    109112                                                       pj_ssize_t)); 
    110 static void        transport_detach(   pjmedia_transport *tp, 
     113static void        transport_detach   (pjmedia_transport *tp, 
    111114                                       void *strm); 
    112115static pj_status_t transport_send_rtp( pjmedia_transport *tp, 
     
    116119                                       const void *pkt, 
    117120                                       pj_size_t size); 
     121static pj_status_t transport_media_create(pjmedia_transport *tp, 
     122                                       pj_pool_t *pool, 
     123                                       pjmedia_sdp_session *sdp_local, 
     124                                       const pjmedia_sdp_session *sdp_remote, 
     125                                       unsigned media_index); 
     126static pj_status_t transport_media_start (pjmedia_transport *tp, 
     127                                       pj_pool_t *pool, 
     128                                       pjmedia_sdp_session *sdp_local, 
     129                                       const pjmedia_sdp_session *sdp_remote, 
     130                                       unsigned media_index); 
     131static pj_status_t transport_media_stop(pjmedia_transport *tp); 
     132static pj_status_t transport_simulate_lost(pjmedia_transport *tp, 
     133                                       pjmedia_dir dir, 
     134                                       unsigned pct_lost); 
     135static pj_status_t transport_destroy  (pjmedia_transport *tp); 
    118136 
    119137 
     
    125143    &transport_send_rtp, 
    126144    &transport_send_rtcp, 
    127     &pjmedia_transport_udp_close 
     145    &transport_media_create, 
     146    &transport_media_start, 
     147    &transport_media_stop, 
     148    &transport_simulate_lost, 
     149    &transport_destroy 
    128150}; 
    129151 
     
    342364 
    343365on_error: 
    344     pjmedia_transport_udp_close(&tp->base); 
     366    transport_destroy(&tp->base); 
    345367    return status; 
    346 } 
    347  
    348  
    349 /* 
    350  * Get media socket info. 
    351  */ 
    352 PJ_DEF(pj_status_t) pjmedia_transport_udp_get_info( pjmedia_transport *tp, 
    353                                 pjmedia_transport_udp_info *inf) 
    354 { 
    355     return transport_get_info(tp, &inf->skinfo); 
    356368} 
    357369 
     
    360372 * Close UDP transport. 
    361373 */ 
    362 PJ_DEF(pj_status_t) pjmedia_transport_udp_close(pjmedia_transport *tp) 
     374static pj_status_t transport_destroy(pjmedia_transport *tp) 
    363375{ 
    364376    struct transport_udp *udp = (struct transport_udp*) tp; 
     
    727739 
    728740 
    729 PJ_DEF(pj_status_t) pjmedia_transport_udp_simulate_lost(pjmedia_transport *tp, 
    730                                                         pjmedia_dir dir, 
    731                                                         unsigned pct_lost) 
     741static pj_status_t transport_media_create(pjmedia_transport *tp, 
     742                                  pj_pool_t *pool, 
     743                                  pjmedia_sdp_session *sdp_local, 
     744                                  const pjmedia_sdp_session *sdp_remote, 
     745                                  unsigned media_index) 
     746{ 
     747    PJ_UNUSED_ARG(tp); 
     748    PJ_UNUSED_ARG(pool); 
     749    PJ_UNUSED_ARG(sdp_local); 
     750    PJ_UNUSED_ARG(sdp_remote); 
     751 
     752    return PJ_SUCCESS; 
     753} 
     754 
     755static pj_status_t transport_media_start(pjmedia_transport *tp, 
     756                                  pj_pool_t *pool, 
     757                                  pjmedia_sdp_session *sdp_local, 
     758                                  const pjmedia_sdp_session *sdp_remote, 
     759                                  unsigned media_index) 
     760{ 
     761    PJ_UNUSED_ARG(tp); 
     762    PJ_UNUSED_ARG(pool); 
     763    PJ_UNUSED_ARG(sdp_local); 
     764    PJ_UNUSED_ARG(sdp_remote); 
     765    PJ_UNUSED_ARG(media_index); 
     766 
     767    return PJ_SUCCESS; 
     768} 
     769 
     770static pj_status_t transport_media_stop(pjmedia_transport *tp) 
     771{ 
     772    PJ_UNUSED_ARG(tp); 
     773 
     774    return PJ_SUCCESS; 
     775} 
     776 
     777static pj_status_t transport_simulate_lost(pjmedia_transport *tp, 
     778                                           pjmedia_dir dir, 
     779                                           unsigned pct_lost) 
    732780{ 
    733781    struct transport_udp *udp = (struct transport_udp*)tp; 
  • pjproject/trunk/pjproject-vs8.sln

    r1488 r1735  
    11 
    22Microsoft Visual Studio Solution File, Format Version 9.00 
    3 # Visual C++ Express 2005 
     3# Visual Studio 2005 
    44Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pjlib", "pjlib\build\pjlib.vcproj", "{DA0E03ED-53A7-4050-8A85-90541C5509F8}" 
    55EndProject 
     
    1313Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pjlib_util_test", "pjlib-util\build\pjlib_util_test.vcproj", "{ED02BE13-8297-4770-8097-27DC2CCABF9A}" 
    1414        ProjectSection(ProjectDependencies) = postProject 
    15                 {DA0E03ED-53A7-4050-8A85-90541C5509F8} = {DA0E03ED-53A7-4050-8A85-90541C5509F8} 
    16                 {FE07F272-AE7F-4549-9E9F-EF9B80CB1693} = {FE07F272-AE7F-4549-9E9F-EF9B80CB1693} 
     15                {FE07F272-AE7F-4549-9E9F-EF9B80CB1693} = {FE07F272-AE7F-4549-9E9F-EF9B80CB1693} 
     16                {DA0E03ED-53A7-4050-8A85-90541C5509F8} = {DA0E03ED-53A7-4050-8A85-90541C5509F8} 
    1717        EndProjectSection 
    1818EndProject 
     
    2929Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pjsua", "pjsip-apps\build\pjsua.vcproj", "{8310649E-A25E-4AF0-91E8-9E3CC659BB89}" 
    3030        ProjectSection(ProjectDependencies) = postProject 
     31                {F0DBAA03-1BA3-4E3B-A2CA-727E3D3AB858} = {F0DBAA03-1BA3-4E3B-A2CA-727E3D3AB858} 
    3132                {2BB84911-C1B4-4747-B93D-36AA82CC5031} = {2BB84911-C1B4-4747-B93D-36AA82CC5031} 
    3233                {4BF51C21-5A30-423B-82FE-1ED410E5769D} = {4BF51C21-5A30-423B-82FE-1ED410E5769D} 
     34                {A5D9AA24-08ED-48B9-BD65-F0A25E96BFC4} = {A5D9AA24-08ED-48B9-BD65-F0A25E96BFC4} 
     35                {FE07F272-AE7F-4549-9E9F-EF9B80CB1693} = {FE07F272-AE7F-4549-9E9F-EF9B80CB1693} 
     36                {6794B975-4E84-4F49-B2DC-C31F2224E03E} = {6794B975-4E84-4F49-B2DC-C31F2224E03E} 
     37                {7FDE3880-A4AB-49E3-B439-EBEF0A0C7A65} = {7FDE3880-A4AB-49E3-B439-EBEF0A0C7A65} 
     38                {3CF9FFA9-8387-4635-9D1B-E7944CBEFEAA} = {3CF9FFA9-8387-4635-9D1B-E7944CBEFEAA} 
     39                {4B059DBA-CD9C-4D0F-BE8C-FFB4EFD498E9} = {4B059DBA-CD9C-4D0F-BE8C-FFB4EFD498E9} 
     40                {855DC8C0-D3E9-4A2E-AE47-116605A7BC9B} = {855DC8C0-D3E9-4A2E-AE47-116605A7BC9B} 
     41                {4B5945CD-0CB3-49AA-A7FF-7612D93F82C0} = {4B5945CD-0CB3-49AA-A7FF-7612D93F82C0} 
     42                {B8719FD5-E8A6-4A36-943C-891D07F5DD21} = {B8719FD5-E8A6-4A36-943C-891D07F5DD21} 
     43                {DA0E03ED-53A7-4050-8A85-90541C5509F8} = {DA0E03ED-53A7-4050-8A85-90541C5509F8} 
     44                {B5FE16F8-3EDB-4110-BD80-B4238CC01E8D} = {B5FE16F8-3EDB-4110-BD80-B4238CC01E8D} 
     45                {9CA0FDFB-2172-41FC-B7F1-5CE915EDCB37} = {9CA0FDFB-2172-41FC-B7F1-5CE915EDCB37} 
    3346                {E53AA5FF-B737-40AA-BD13-387EFA99023D} = {E53AA5FF-B737-40AA-BD13-387EFA99023D} 
    34                 {9CA0FDFB-2172-41FC-B7F1-5CE915EDCB37} = {9CA0FDFB-2172-41FC-B7F1-5CE915EDCB37} 
     47        EndProjectSection 
     48EndProject 
     49Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pjsua_lib", "pjsip\build\pjsua_lib.vcproj", "{9CA0FDFB-2172-41FC-B7F1-5CE915EDCB37}" 
     50EndProject 
     51Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sample_debug", "pjsip-apps\build\sample_debug.vcproj", "{A0F1AA62-0F6F-420D-B09A-AC04B6862821}" 
     52        ProjectSection(ProjectDependencies) = postProject 
     53                {A5D9AA24-08ED-48B9-BD65-F0A25E96BFC4} = {A5D9AA24-08ED-48B9-BD65-F0A25E96BFC4} 
     54                {FE07F272-AE7F-4549-9E9F-EF9B80CB1693} = {FE07F272-AE7F-4549-9E9F-EF9B80CB1693} 
     55                {6794B975-4E84-4F49-B2DC-C31F2224E03E} = {6794B975-4E84-4F49-B2DC-C31F2224E03E} 
     56                {7FDE3880-A4AB-49E3-B439-EBEF0A0C7A65} = {7FDE3880-A4AB-49E3-B439-EBEF0A0C7A65} 
     57                {3CF9FFA9-8387-4635-9D1B-E7944CBEFEAA} = {3CF9FFA9-8387-4635-9D1B-E7944CBEFEAA} 
     58                {4B059DBA-CD9C-4D0F-BE8C-FFB4EFD498E9} = {4B059DBA-CD9C-4D0F-BE8C-FFB4EFD498E9} 
     59                {855DC8C0-D3E9-4A2E-AE47-116605A7BC9B} = {855DC8C0-D3E9-4A2E-AE47-116605A7BC9B} 
     60                {4B5945CD-0CB3-49AA-A7FF-7612D93F82C0} = {4B5945CD-0CB3-49AA-A7FF-7612D93F82C0} 
     61                {B8719FD5-E8A6-4A36-943C-891D07F5DD21} = {B8719FD5-E8A6-4A36-943C-891D07F5DD21} 
     62                {DA0E03ED-53A7-4050-8A85-90541C5509F8} = {DA0E03ED-53A7-4050-8A85-90541C5509F8} 
    3563                {B5FE16F8-3EDB-4110-BD80-B4238CC01E8D} = {B5FE16F8-3EDB-4110-BD80-B4238CC01E8D} 
    36                 {DA0E03ED-53A7-4050-8A85-90541C5509F8} = {DA0E03ED-53A7-4050-8A85-90541C5509F8} 
    37                 {B8719FD5-E8A6-4A36-943C-891D07F5DD21} = {B8719FD5-E8A6-4A36-943C-891D07F5DD21} 
    38                 {4B5945CD-0CB3-49AA-A7FF-7612D93F82C0} = {4B5945CD-0CB3-49AA-A7FF-7612D93F82C0} 
    39                 {855DC8C0-D3E9-4A2E-AE47-116605A7BC9B} = {855DC8C0-D3E9-4A2E-AE47-116605A7BC9B} 
    40                 {4B059DBA-CD9C-4D0F-BE8C-FFB4EFD498E9} = {4B059DBA-CD9C-4D0F-BE8C-FFB4EFD498E9} 
    41                 {3CF9FFA9-8387-4635-9D1B-E7944CBEFEAA} = {3CF9FFA9-8387-4635-9D1B-E7944CBEFEAA} 
    42                 {7FDE3880-A4AB-49E3-B439-EBEF0A0C7A65} = {7FDE3880-A4AB-49E3-B439-EBEF0A0C7A65} 
    43                 {6794B975-4E84-4F49-B2DC-C31F2224E03E} = {6794B975-4E84-4F49-B2DC-C31F2224E03E} 
    44                 {FE07F272-AE7F-4549-9E9F-EF9B80CB1693} = {FE07F272-AE7F-4549-9E9F-EF9B80CB1693} 
    45                 {A5D9AA24-08ED-48B9-BD65-F0A25E96BFC4} = {A5D9AA24-08ED-48B9-BD65-F0A25E96BFC4} 
    46         EndProjectSection 
    47 EndProject 
    48 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pjsua_lib", "pjsip\build\pjsua_lib.vcproj", "{9CA0FDFB-2172-41FC-B7F1-5CE915EDCB37}" 
    49 EndProject 
    50 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sample_debug", "pjsip-apps\build\sample_debug.vcproj", "{A0F1AA62-0F6F-420D-B09A-AC04B6862821}" 
    51         ProjectSection(ProjectDependencies) = postProject 
     64                {9CA0FDFB-2172-41FC-B7F1-5CE915EDCB37} = {9CA0FDFB-2172-41FC-B7F1-5CE915EDCB37} 
    5265                {E53AA5FF-B737-40AA-BD13-387EFA99023D} = {E53AA5FF-B737-40AA-BD13-387EFA99023D} 
    53                 {9CA0FDFB-2172-41FC-B7F1-5CE915EDCB37} = {9CA0FDFB-2172-41FC-B7F1-5CE915EDCB37} 
    54                 {B5FE16F8-3EDB-4110-BD80-B4238CC01E8D} = {B5FE16F8-3EDB-4110-BD80-B4238CC01E8D} 
    55                 {DA0E03ED-53A7-4050-8A85-90541C5509F8} = {DA0E03ED-53A7-4050-8A85-90541C5509F8} 
    56                 {B8719FD5-E8A6-4A36-943C-891D07F5DD21} = {B8719FD5-E8A6-4A36-943C-891D07F5DD21} 
    57                 {4B5945CD-0CB3-49AA-A7FF-7612D93F82C0} = {4B5945CD-0CB3-49AA-A7FF-7612D93F82C0} 
    58                 {855DC8C0-D3E9-4A2E-AE47-116605A7BC9B} = {855DC8C0-D3E9-4A2E-AE47-116605A7BC9B} 
    59                 {4B059DBA-CD9C-4D0F-BE8C-FFB4EFD498E9} = {4B059DBA-CD9C-4D0F-BE8C-FFB4EFD498E9} 
    60                 {3CF9FFA9-8387-4635-9D1B-E7944CBEFEAA} = {3CF9FFA9-8387-4635-9D1B-E7944CBEFEAA} 
    61                 {7FDE3880-A4AB-49E3-B439-EBEF0A0C7A65} = {7FDE3880-A4AB-49E3-B439-EBEF0A0C7A65} 
    62                 {6794B975-4E84-4F49-B2DC-C31F2224E03E} = {6794B975-4E84-4F49-B2DC-C31F2224E03E} 
    63                 {FE07F272-AE7F-4549-9E9F-EF9B80CB1693} = {FE07F272-AE7F-4549-9E9F-EF9B80CB1693} 
    64                 {A5D9AA24-08ED-48B9-BD65-F0A25E96BFC4} = {A5D9AA24-08ED-48B9-BD65-F0A25E96BFC4} 
    65                 {2BB84911-C1B4-4747-B93D-36AA82CC5031} = {2BB84911-C1B4-4747-B93D-36AA82CC5031} 
     66                {2BB84911-C1B4-4747-B93D-36AA82CC5031} = {2BB84911-C1B4-4747-B93D-36AA82CC5031} 
     67                {F0DBAA03-1BA3-4E3B-A2CA-727E3D3AB858} = {F0DBAA03-1BA3-4E3B-A2CA-727E3D3AB858} 
    6668        EndProjectSection 
    6769EndProject 
    6870Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "samples", "pjsip-apps\build\samples.vcproj", "{E378A1FC-0C9C-4462-860F-7E60BC1BF84E}" 
    6971        ProjectSection(ProjectDependencies) = postProject 
    70                 {9CA0FDFB-2172-41FC-B7F1-5CE915EDCB37} = {9CA0FDFB-2172-41FC-B7F1-5CE915EDCB37} 
    71                 {DA0E03ED-53A7-4050-8A85-90541C5509F8} = {DA0E03ED-53A7-4050-8A85-90541C5509F8} 
    72                 {B8719FD5-E8A6-4A36-943C-891D07F5DD21} = {B8719FD5-E8A6-4A36-943C-891D07F5DD21} 
    73                 {4B5945CD-0CB3-49AA-A7FF-7612D93F82C0} = {4B5945CD-0CB3-49AA-A7FF-7612D93F82C0} 
    74                 {855DC8C0-D3E9-4A2E-AE47-116605A7BC9B} = {855DC8C0-D3E9-4A2E-AE47-116605A7BC9B} 
    75                 {7FDE3880-A4AB-49E3-B439-EBEF0A0C7A65} = {7FDE3880-A4AB-49E3-B439-EBEF0A0C7A65} 
    76                 {FE07F272-AE7F-4549-9E9F-EF9B80CB1693} = {FE07F272-AE7F-4549-9E9F-EF9B80CB1693} 
    77                 {2BB84911-C1B4-4747-B93D-36AA82CC5031} = {2BB84911-C1B4-4747-B93D-36AA82CC5031} 
     72                {2BB84911-C1B4-4747-B93D-36AA82CC5031} = {2BB84911-C1B4-4747-B93D-36AA82CC5031} 
     73                {FE07F272-AE7F-4549-9E9F-EF9B80CB1693} = {FE07F272-AE7F-4549-9E9F-EF9B80CB1693} 
     74                {7FDE3880-A4AB-49E3-B439-EBEF0A0C7A65} = {7FDE3880-A4AB-49E3-B439-EBEF0A0C7A65} 
     75                {855DC8C0-D3E9-4A2E-AE47-116605A7BC9B} = {855DC8C0-D3E9-4A2E-AE47-116605A7BC9B} 
     76                {4B5945CD-0CB3-49AA-A7FF-7612D93F82C0} = {4B5945CD-0CB3-49AA-A7FF-7612D93F82C0} 
     77                {B8719FD5-E8A6-4A36-943C-891D07F5DD21} = {B8719FD5-E8A6-4A36-943C-891D07F5DD21} 
     78                {DA0E03ED-53A7-4050-8A85-90541C5509F8} = {DA0E03ED-53A7-4050-8A85-90541C5509F8} 
     79                {9CA0FDFB-2172-41FC-B7F1-5CE915EDCB37} = {9CA0FDFB-2172-41FC-B7F1-5CE915EDCB37} 
    7880        EndProjectSection 
    7981EndProject 
    8082Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "test_pjsip", "pjsip\build\test_pjsip.vcproj", "{B3F7D4E9-702F-4EB4-ADA8-098D0A83D770}" 
    8183        ProjectSection(ProjectDependencies) = postProject 
    82                 {9CA0FDFB-2172-41FC-B7F1-5CE915EDCB37} = {9CA0FDFB-2172-41FC-B7F1-5CE915EDCB37} 
    83                 {DA0E03ED-53A7-4050-8A85-90541C5509F8} = {DA0E03ED-53A7-4050-8A85-90541C5509F8} 
    84                 {B8719FD5-E8A6-4A36-943C-891D07F5DD21} = {B8719FD5-E8A6-4A36-943C-891D07F5DD21} 
    85                 {4B5945CD-0CB3-49AA-A7FF-7612D93F82C0} = {4B5945CD-0CB3-49AA-A7FF-7612D93F82C0} 
    86                 {855DC8C0-D3E9-4A2E-AE47-116605A7BC9B} = {855DC8C0-D3E9-4A2E-AE47-116605A7BC9B} 
    87                 {7FDE3880-A4AB-49E3-B439-EBEF0A0C7A65} = {7FDE3880-A4AB-49E3-B439-EBEF0A0C7A65} 
    88                 {FE07F272-AE7F-4549-9E9F-EF9B80CB1693} = {FE07F272-AE7F-4549-9E9F-EF9B80CB1693} 
    89                 {2BB84911-C1B4-4747-B93D-36AA82CC5031} = {2BB84911-C1B4-4747-B93D-36AA82CC5031} 
     84                {2BB84911-C1B4-4747-B93D-36AA82CC5031} = {2BB84911-C1B4-4747-B93D-36AA82CC5031} 
     85                {FE07F272-AE7F-4549-9E9F-EF9B80CB1693} = {FE07F272-AE7F-4549-9E9F-EF9B80CB1693} 
     86                {7FDE3880-A4AB-49E3-B439-EBEF0A0C7A65} = {7FDE3880-A4AB-49E3-B439-EBEF0A0C7A65} 
     87                {855DC8C0-D3E9-4A2E-AE47-116605A7BC9B} = {855DC8C0-D3E9-4A2E-AE47-116605A7BC9B} 
     88                {4B5945CD-0CB3-49AA-A7FF-7612D93F82C0} = {4B5945CD-0CB3-49AA-A7FF-7612D93F82C0} 
     89                {B8719FD5-E8A6-4A36-943C-891D07F5DD21} = {B8719FD5-E8A6-4A36-943C-891D07F5DD21} 
     90                {DA0E03ED-53A7-4050-8A85-90541C5509F8} = {DA0E03ED-53A7-4050-8A85-90541C5509F8} 
     91                {9CA0FDFB-2172-41FC-B7F1-5CE915EDCB37} = {9CA0FDFB-2172-41FC-B7F1-5CE915EDCB37} 
    9092        EndProjectSection 
    9193EndProject 
     
    105107EndProject 
    106108Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libmilenage", "third_party\build\milenage\libmilenage.vcproj", "{4BF51C21-5A30-423B-82FE-1ED410E5769D}" 
     109EndProject 
     110Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libsrtp", "third_party\build\srtp\libsrtp.vcproj", "{F0DBAA03-1BA3-4E3B-A2CA-727E3D3AB858}" 
    107111EndProject 
    108112Global 
     
    200204                {4BF51C21-5A30-423B-82FE-1ED410E5769D}.Release|Win32.ActiveCfg = Release|Win32 
    201205                {4BF51C21-5A30-423B-82FE-1ED410E5769D}.Release|Win32.Build.0 = Release|Win32 
     206                {F0DBAA03-1BA3-4E3B-A2CA-727E3D3AB858}.Debug|Win32.ActiveCfg = Debug|Win32 
     207                {F0DBAA03-1BA3-4E3B-A2CA-727E3D3AB858}.Debug|Win32.Build.0 = Debug|Win32 
     208                {F0DBAA03-1BA3-4E3B-A2CA-727E3D3AB858}.Release|Win32.ActiveCfg = Release|Win32 
     209                {F0DBAA03-1BA3-4E3B-A2CA-727E3D3AB858}.Release|Win32.Build.0 = Release|Win32 
    202210        EndGlobalSection 
    203211        GlobalSection(SolutionProperties) = preSolution 
  • pjproject/trunk/pjproject.dsw

    r1488 r1735  
    44############################################################################### 
    55 
    6 Project: "libgsmcodec"=.\THIRD_PARTY\BUILD\GSM\libgsmcodec.dsp - Package Owner=<4> 
    7  
    8 Package=<5> 
    9 {{{ 
    10 }}} 
    11  
    12 Package=<4> 
    13 {{{ 
    14 }}} 
    15  
    16 ############################################################################### 
    17  
    18 Project: "libilbccodec"=.\THIRD_PARTY\BUILD\ILBC\libilbccodec.dsp - Package Owner=<4> 
    19  
    20 Package=<5> 
    21 {{{ 
    22 }}} 
    23  
    24 Package=<4> 
    25 {{{ 
    26 }}} 
    27  
    28 ############################################################################### 
    29  
    30 Project: "libmilenage"=.\third_party\build\milenage\libmilenage.dsp - Package Owner=<4> 
    31  
    32 Package=<5> 
    33 {{{ 
    34 }}} 
    35  
    36 Package=<4> 
    37 {{{ 
    38 }}} 
    39  
    40 ############################################################################### 
    41  
    42 Project: "libportaudio"=.\THIRD_PARTY\BUILD\PORTAUDIO\libportaudio.dsp - Package Owner=<4> 
    43  
    44 Package=<5> 
    45 {{{ 
    46 }}} 
    47  
    48 Package=<4> 
    49 {{{ 
    50 }}} 
    51  
    52 ############################################################################### 
    53  
    54 Project: "libresample"=.\THIRD_PARTY\BUILD\RESAMPLE\libresample.dsp - Package Owner=<4> 
    55  
    56 Package=<5> 
    57 {{{ 
    58 }}} 
    59  
    60 Package=<4> 
    61 {{{ 
    62 }}} 
    63  
    64 ############################################################################### 
    65  
    66 Project: "libresample_dll"=.\THIRD_PARTY\BUILD\RESAMPLE\libresample_dll.dsp - Package Owner=<4> 
    67  
    68 Package=<5> 
    69 {{{ 
    70 }}} 
    71  
    72 Package=<4> 
    73 {{{ 
    74 }}} 
    75  
    76 ############################################################################### 
    77  
    78 Project: "libspeex"=.\third_party\build\speex\libspeex.dsp - Package Owner=<4> 
    79  
    80 Package=<5> 
    81 {{{ 
    82 }}} 
    83  
    84 Package=<4> 
    85 {{{ 
    86 }}} 
    87  
    88 ############################################################################### 
    89  
    90 Project: "pjlib"=.\pjlib\build\pjlib.dsp - Package Owner=<4> 
    91  
    92 Package=<5> 
    93 {{{ 
    94 }}} 
    95  
    96 Package=<4> 
    97 {{{ 
    98 }}} 
    99  
    100 ############################################################################### 
    101  
    102 Project: "pjlib_test"=.\pjlib\build\pjlib_test.dsp - Package Owner=<4> 
     6Project: "libgsmcodec"=".\THIRD_PARTY\BUILD\GSM\libgsmcodec.dsp" - Package Owner=<4> 
     7 
     8Package=<5> 
     9{{{ 
     10}}} 
     11 
     12Package=<4> 
     13{{{ 
     14}}} 
     15 
     16############################################################################### 
     17 
     18Project: "libilbccodec"=".\THIRD_PARTY\BUILD\ILBC\libilbccodec.dsp" - Package Owner=<4> 
     19 
     20Package=<5> 
     21{{{ 
     22}}} 
     23 
     24Package=<4> 
     25{{{ 
     26}}} 
     27 
     28############################################################################### 
     29 
     30Project: "libmilenage"=".\third_party\build\milenage\libmilenage.dsp" - Package Owner=<4> 
     31 
     32Package=<5> 
     33{{{ 
     34}}} 
     35 
     36Package=<4> 
     37{{{ 
     38}}} 
     39 
     40############################################################################### 
     41 
     42Project: "libportaudio"=".\THIRD_PARTY\BUILD\PORTAUDIO\libportaudio.dsp" - Package Owner=<4> 
     43 
     44Package=<5> 
     45{{{ 
     46}}} 
     47 
     48Package=<4> 
     49{{{ 
     50}}} 
     51 
     52############################################################################### 
     53 
     54Project: "libresample"=".\THIRD_PARTY\BUILD\RESAMPLE\libresample.dsp" - Package Owner=<4> 
     55 
     56Package=<5> 
     57{{{ 
     58}}} 
     59 
     60Package=<4> 
     61{{{ 
     62}}} 
     63 
     64############################################################################### 
     65 
     66Project: "libresample_dll"=".\THIRD_PARTY\BUILD\RESAMPLE\libresample_dll.dsp" - Package Owner=<4> 
     67 
     68Package=<5> 
     69{{{ 
     70}}} 
     71 
     72Package=<4> 
     73{{{ 
     74}}} 
     75 
     76############################################################################### 
     77 
     78Project: "libspeex"=".\third_party\build\speex\libspeex.dsp" - Package Owner=<4> 
     79 
     80Package=<5> 
     81{{{ 
     82}}} 
     83 
     84Package=<4> 
     85{{{ 
     86}}} 
     87 
     88############################################################################### 
     89 
     90Project: "libsrtp"=".\third_party\build\srtp\libsrtp.dsp" - Package Owner=<4> 
     91 
     92Package=<5> 
     93{{{ 
     94}}} 
     95 
     96Package=<4> 
     97{{{ 
     98}}} 
     99 
     100############################################################################### 
     101 
     102Project: "pjlib"=".\pjlib\build\pjlib.dsp" - Package Owner=<4> 
     103 
     104Package=<5> 
     105{{{ 
     106}}} 
     107 
     108Package=<4> 
     109{{{ 
     110}}} 
     111 
     112############################################################################### 
     113 
     114Project: "pjlib_test"=".\pjlib\build\pjlib_test.dsp" - Package Owner=<4> 
    103115 
    104116Package=<5> 
     
    145157############################################################################### 
    146158 
    147 Project: "pjmedia"=.\pjmedia\build\pjmedia.dsp - Package Owner=<4> 
    148  
    149 Package=<5> 
    150 {{{ 
    151 }}} 
    152  
    153 Package=<4> 
    154 {{{ 
    155 }}} 
    156  
    157 ############################################################################### 
    158  
    159 Project: "pjmedia_codec"=.\pjmedia\build\pjmedia_codec.dsp - Package Owner=<4> 
    160  
    161 Package=<5> 
    162 {{{ 
    163 }}} 
    164  
    165 Package=<4> 
    166 {{{ 
    167 }}} 
    168  
    169 ############################################################################### 
    170  
    171 Project: "pjnath"=.\pjnath\build\pjnath.dsp - Package Owner=<4> 
    172  
    173 Package=<5> 
    174 {{{ 
    175 }}} 
    176  
    177 Package=<4> 
    178 {{{ 
    179 }}} 
    180  
    181 ############################################################################### 
    182  
    183 Project: "pjsip_core"=.\pjsip\build\pjsip_core.dsp - Package Owner=<4> 
    184  
    185 Package=<5> 
    186 {{{ 
    187 }}} 
    188  
    189 Package=<4> 
    190 {{{ 
    191 }}} 
    192  
    193 ############################################################################### 
    194  
    195 Project: "pjsip_simple"=.\pjsip\build\pjsip_simple.dsp - Package Owner=<4> 
    196  
    197 Package=<5> 
    198 {{{ 
    199 }}} 
    200  
    201 Package=<4> 
    202 {{{ 
    203 }}} 
    204  
    205 ############################################################################### 
    206  
    207 Project: "pjsip_ua"=.\pjsip\build\pjsip_ua.dsp - Package Owner=<4> 
     159Project: "pjmedia"=".\pjmedia\build\pjmedia.dsp" - Package Owner=<4> 
     160 
     161Package=<5> 
     162{{{ 
     163}}} 
     164 
     165Package=<4> 
     166{{{ 
     167}}} 
     168 
     169############################################################################### 
     170 
     171Project: "pjmedia_codec"=".\pjmedia\build\pjmedia_codec.dsp" - Package Owner=<4> 
     172 
     173Package=<5> 
     174{{{ 
     175}}} 
     176 
     177Package=<4> 
     178{{{ 
     179}}} 
     180 
     181############################################################################### 
     182 
     183Project: "pjnath"=".\pjnath\build\pjnath.dsp" - Package Owner=<4> 
     184 
     185Package=<5> 
     186{{{ 
     187}}} 
     188 
     189Package=<4> 
     190{{{ 
     191}}} 
     192 
     193############################################################################### 
     194 
     195Project: "pjsip_core"=".\pjsip\build\pjsip_core.dsp" - Package Owner=<4> 
     196 
     197Package=<5> 
     198{{{ 
     199}}} 
     200 
     201Package=<4> 
     202{{{ 
     203}}} 
     204 
     205############################################################################### 
     206 
     207Project: "pjsip_simple"=".\pjsip\build\pjsip_simple.dsp" - Package Owner=<4> 
     208 
     209Package=<5> 
     210{{{ 
     211}}} 
     212 
     213Package=<4> 
     214{{{ 
     215}}} 
     216 
     217############################################################################### 
     218 
     219Project: "pjsip_ua"=".\pjsip\build\pjsip_ua.dsp" - Package Owner=<4> 
    208220 
    209221Package=<5> 
     
    270282    Project_Dep_Name libmilenage 
    271283    End Project Dependency 
    272 }}} 
    273  
    274 ############################################################################### 
    275  
    276 Project: "pjsua_lib"=.\pjsip\build\pjsua_lib.dsp - Package Owner=<4> 
     284    Begin Project Dependency 
     285    Project_Dep_Name libsrtp 
     286    End Project Dependency 
     287}}} 
     288 
     289############################################################################### 
     290 
     291Project: "pjsua_lib"=".\pjsip\build\pjsua_lib.dsp" - Package Owner=<4> 
    277292 
    278293Package=<5> 
     
    394409############################################################################### 
    395410 
    396 Project: "test_pjsip"=.\pjsip\build\test_pjsip.dsp - Package Owner=<4> 
     411Project: "test_pjsip"=".\pjsip\build\test_pjsip.dsp" - Package Owner=<4> 
    397412 
    398413Package=<5> 
  • pjproject/trunk/pjsip-apps/build/Samples-vc.mak

    r1681 r1735  
    2424RESAMPLE_LIB = ..\..\third_party\lib\libresample-$(TARGET)$(LIBEXT) 
    2525SPEEX_LIB = ..\..\third_party\lib\libspeex-$(TARGET)$(LIBEXT) 
     26SRTP_LIB = ..\..\third_party\lib\libsrtp-$(TARGET)$(LIBEXT) 
    2627 
    2728THIRD_PARTY_LIBS = $(GSM_LIB) $(ILBC_LIB) $(PORTAUDIO_LIB) $(RESAMPLE_LIB) \ 
    28                                    $(SPEEX_LIB) 
     29                                   $(SPEEX_LIB) $(SRTP_LIB) 
    2930 
    3031LIBS = $(PJSUA_LIB_LIB) $(PJSIP_UA_LIB) $(PJSIP_SIMPLE_LIB) \ 
  • pjproject/trunk/pjsip-apps/src/pjsua/pjsua_app.c

    r1626 r1735  
    121121    puts  ("SIP Account options:"); 
    122122    puts  ("  --use-ims           Enable 3GPP/IMS related settings on this account"); 
     123#if defined(PJMEDIA_HAS_SRTP) && (PJMEDIA_HAS_SRTP != 0) 
     124    puts  ("  --use-srtp=N        Use SRTP N= 0: disabled, 1: optional, 2: mandatory"); 
     125#endif 
    123126    puts  ("  --registrar=url     Set the URL of registrar server"); 
    124127    puts  ("  --id=url            Set the URL of local ID (used in From header)"); 
     
    383386           OPT_ADD_BUDDY, OPT_OFFER_X_MS_MSG, OPT_NO_PRESENCE, 
    384387           OPT_AUTO_ANSWER, OPT_AUTO_HANGUP, OPT_AUTO_PLAY, OPT_AUTO_LOOP, 
    385            OPT_AUTO_CONF, OPT_CLOCK_RATE, OPT_USE_ICE, 
     388           OPT_AUTO_CONF, OPT_CLOCK_RATE, OPT_USE_ICE, OPT_USE_SRTP, 
    386389           OPT_PLAY_FILE, OPT_PLAY_TONE, OPT_RTP_PORT, OPT_ADD_CODEC,  
    387390           OPT_ILBC_MODE, OPT_REC_FILE, OPT_AUTO_REC, 
     
    442445        { "rtp-port",   1, 0, OPT_RTP_PORT}, 
    443446        { "use-ice",    0, 0, OPT_USE_ICE}, 
     447#if defined(PJMEDIA_HAS_SRTP) && (PJMEDIA_HAS_SRTP != 0) 
     448        { "use-srtp",   1, 0, OPT_USE_SRTP}, 
     449#endif 
    444450        { "add-codec",  1, 0, OPT_ADD_CODEC}, 
    445451        { "dis-codec",  1, 0, OPT_DIS_CODEC}, 
     
    797803            break; 
    798804 
     805#if defined(PJMEDIA_HAS_SRTP) && (PJMEDIA_HAS_SRTP != 0) 
     806        case OPT_USE_SRTP: 
     807            app_config.cfg.use_srtp = my_atoi(pj_optarg); 
     808            if (!pj_isdigit(*pj_optarg) || app_config.cfg.use_srtp > 2) { 
     809                PJ_LOG(1,(THIS_FILE, "Invalid value for --use-srtp option")); 
     810                return -1; 
     811            } 
     812            break; 
     813#endif 
     814 
    799815        case OPT_RTP_PORT: 
    800816            cfg->rtp_cfg.port = my_atoi(pj_optarg); 
     
    11111127        pj_strcat2(result, line); 
    11121128    } 
     1129 
     1130#if defined(PJMEDIA_HAS_SRTP) && (PJMEDIA_HAS_SRTP != 0) 
     1131    /* SRTP */ 
     1132    if (acc_cfg->use_srtp) { 
     1133        pj_ansi_sprintf(line, "--use-srtp %i\n", 
     1134                        (int)acc_cfg->use_srtp); 
     1135        pj_strcat2(result, line); 
     1136    } 
     1137#endif 
    11131138 
    11141139    /* Proxy */ 
  • pjproject/trunk/pjsip-apps/src/samples/simpleua.c

    r1530 r1735  
    286286     * the SDP). 
    287287     */ 
    288     { 
    289         pjmedia_transport_udp_info udp_info; 
    290  
    291         pjmedia_transport_udp_get_info(g_med_transport, &udp_info); 
    292         pj_memcpy(&g_med_skinfo, &udp_info.skinfo,  
    293                   sizeof(pjmedia_sock_info)); 
    294     } 
     288    pjmedia_transport_get_info(g_med_transport, &g_med_skinfo); 
    295289 
    296290 
  • pjproject/trunk/pjsip-apps/src/samples/siprtp.c

    r1670 r1735  
    10061006    pjmedia_sdp_media *m; 
    10071007    pjmedia_sdp_attr *attr; 
    1008     pjmedia_transport_udp_info tpinfo; 
     1008    pjmedia_sock_info tpinfo; 
    10091009    struct media_stream *audio = &call->media[0]; 
    10101010 
     
    10131013 
    10141014    /* Get transport info */ 
    1015     pjmedia_transport_udp_get_info(audio->transport, &tpinfo); 
     1015    pjmedia_transport_get_info(audio->transport, &tpinfo); 
    10161016 
    10171017    /* Create and initialize basic SDP session */ 
     
    10471047    /* Standard media info: */ 
    10481048    m->desc.media = pj_str("audio"); 
    1049     m->desc.port = pj_ntohs(tpinfo.skinfo.rtp_addr_name.ipv4.sin_port); 
     1049    m->desc.port = pj_ntohs(tpinfo.rtp_addr_name.ipv4.sin_port); 
    10501050    m->desc.port_count = 1; 
    10511051    m->desc.transport = pj_str("RTP/AVP"); 
  • pjproject/trunk/pjsip-apps/src/samples/streamutil.c

    r1666 r1735  
    5656 "  --send-only           Set stream direction to send only             \n" 
    5757 "  --recv-only           Set stream direction to recv only (default)   \n" 
     58 
     59#if defined(PJMEDIA_HAS_SRTP) && (PJMEDIA_HAS_SRTP != 0) 
     60 "  --use-srtp[=NAME]     Enable SRTP with crypto suite NAME            \n" 
     61 "                        e.g: AES_CM_128_HMAC_SHA1_80 (default),       \n" 
     62 "                             AES_CM_128_HMAC_SHA1_32                  \n" 
     63 "                        Use this option along with the TX & RX keys,  \n" 
     64 "                        formated of 60 hex digits (e.g: E148DA..)      \n" 
     65 "  --srtp-tx-key         SRTP key for transmiting                      \n" 
     66 "  --srtp-rx-key         SRTP key for receiving                        \n" 
     67#endif 
     68 
    5869 "\n" 
    5970; 
     
    6576#include <pjmedia.h> 
    6677#include <pjmedia-codec.h> 
     78#include <pjmedia/transport_srtp.h> 
    6779 
    6880#include <stdlib.h>     /* atoi() */ 
     
    7991static void print_stream_stat(pjmedia_stream *stream); 
    8092 
     93/* Prototype for LIBSRTP utility in file datatypes.c */ 
     94int hex_string_to_octet_string(char *raw, char *hex, int len); 
    8195 
    8296/*  
     
    123137                                  pj_uint16_t local_port, 
    124138                                  const pj_sockaddr_in *rem_addr, 
     139#if defined(PJMEDIA_HAS_SRTP) && (PJMEDIA_HAS_SRTP != 0) 
     140                                  pj_bool_t use_srtp, 
     141                                  const pj_str_t *crypto_suite, 
     142                                  const pj_str_t *srtp_tx_key, 
     143                                  const pj_str_t *srtp_rx_key, 
     144#endif 
    125145                                  pjmedia_stream **p_stream ) 
    126146{ 
    127147    pjmedia_stream_info info; 
    128     pjmedia_transport *transport; 
     148    pjmedia_transport *transport = NULL; 
    129149    pj_status_t status; 
     150#if defined(PJMEDIA_HAS_SRTP) && (PJMEDIA_HAS_SRTP != 0) 
     151    pjmedia_transport *srtp_tp = NULL; 
     152#endif 
    130153 
    131154 
     
    159182        return status; 
    160183 
     184#if defined(PJMEDIA_HAS_SRTP) && (PJMEDIA_HAS_SRTP != 0) 
     185    /* Check if SRTP enabled */ 
     186    if (use_srtp) { 
     187        pjmedia_srtp_crypto tx_plc, rx_plc; 
     188 
     189        status = pjmedia_transport_srtp_create(med_endpt, transport,  
     190                                               NULL, &srtp_tp); 
     191        if (status != PJ_SUCCESS) 
     192            return status; 
     193 
     194        pj_bzero(&tx_plc, sizeof(pjmedia_srtp_crypto)); 
     195        pj_bzero(&rx_plc, sizeof(pjmedia_srtp_crypto)); 
     196 
     197        tx_plc.key = *srtp_tx_key; 
     198        tx_plc.name = *crypto_suite; 
     199        rx_plc.key = *srtp_rx_key; 
     200        rx_plc.name = *crypto_suite; 
     201         
     202        status = pjmedia_transport_srtp_start(srtp_tp, &tx_plc, &rx_plc); 
     203        if (status != PJ_SUCCESS) 
     204            return status; 
     205 
     206        transport = srtp_tp; 
     207    } 
     208#endif 
    161209 
    162210    /* Now that the stream info is initialized, we can create the  
     
    165213 
    166214    status = pjmedia_stream_create( med_endpt, pool, &info,  
    167                                     transport, NULL, p_stream); 
     215                                    transport,  
     216                                    NULL, p_stream); 
    168217 
    169218    if (status != PJ_SUCCESS) { 
    170219        app_perror(THIS_FILE, "Error creating stream", status); 
    171         pjmedia_transport_udp_close(transport); 
     220        pjmedia_transport_close(transport); 
    172221        return status; 
    173222    } 
     
    202251    pj_status_t status;  
    203252 
     253#if defined(PJMEDIA_HAS_SRTP) && (PJMEDIA_HAS_SRTP != 0) 
     254    /* SRTP variables */ 
     255    pj_bool_t use_srtp = PJ_FALSE; 
     256    char tmp_tx_key[64]; 
     257    char tmp_rx_key[64]; 
     258    pj_str_t  srtp_tx_key = {NULL, 0}; 
     259    pj_str_t  srtp_rx_key = {NULL, 0}; 
     260    pj_str_t  srtp_crypto_suite = {NULL, 0}; 
     261    int tmp_key_len; 
     262#endif 
    204263 
    205264    /* Default values */ 
     
    221280        OPT_SEND_ONLY   = 's', 
    222281        OPT_RECV_ONLY   = 'i', 
     282#if defined(PJMEDIA_HAS_SRTP) && (PJMEDIA_HAS_SRTP != 0) 
     283        OPT_USE_SRTP    = 'S', 
     284#endif 
     285        OPT_SRTP_TX_KEY = 'x', 
     286        OPT_SRTP_RX_KEY = 'y', 
    223287        OPT_HELP        = 'h', 
    224288    }; 
     
    233297        { "send-only",      0, 0, OPT_SEND_ONLY }, 
    234298        { "recv-only",      0, 0, OPT_RECV_ONLY }, 
     299#if defined(PJMEDIA_HAS_SRTP) && (PJMEDIA_HAS_SRTP != 0) 
     300        { "use-srtp",       2, 0, OPT_USE_SRTP }, 
     301        { "srtp-tx-key",    1, 0, OPT_SRTP_TX_KEY }, 
     302        { "srtp-rx-key",    1, 0, OPT_SRTP_RX_KEY }, 
     303#endif 
    235304        { "help",           0, 0, OPT_HELP }, 
    236305        { NULL, 0, 0, 0 }, 
     
    299368            break; 
    300369 
     370#if defined(PJMEDIA_HAS_SRTP) && (PJMEDIA_HAS_SRTP != 0) 
     371        case OPT_USE_SRTP: 
     372            use_srtp = PJ_TRUE; 
     373            if (pj_optarg) { 
     374                pj_strset(&srtp_crypto_suite, pj_optarg, strlen(pj_optarg)); 
     375            } else { 
     376                srtp_crypto_suite = pj_str("AES_CM_128_HMAC_SHA1_80"); 
     377            } 
     378            break; 
     379 
     380        case OPT_SRTP_TX_KEY: 
     381            tmp_key_len = hex_string_to_octet_string(tmp_tx_key, pj_optarg, strlen(pj_optarg)); 
     382            pj_strset(&srtp_tx_key, tmp_tx_key, tmp_key_len/2); 
     383            break; 
     384 
     385        case OPT_SRTP_RX_KEY: 
     386            tmp_key_len = hex_string_to_octet_string(tmp_rx_key, pj_optarg, strlen(pj_optarg)); 
     387            pj_strset(&srtp_rx_key, tmp_rx_key, tmp_key_len/2); 
     388            break; 
     389#endif 
     390 
    301391        case OPT_HELP: 
    302392            usage(); 
     
    324414    } 
    325415 
     416#if defined(PJMEDIA_HAS_SRTP) && (PJMEDIA_HAS_SRTP != 0) 
     417    /* SRTP validation */ 
     418    if (use_srtp) { 
     419        if (!srtp_tx_key.slen || !srtp_rx_key.slen) 
     420        { 
     421            printf("Error: Key for each SRTP stream direction must be set\n"); 
     422            return 1; 
     423        } 
     424    } 
     425#endif 
    326426 
    327427    /* Must create a pool factory before we can allocate any memory. */ 
     
    369469    /* Create stream based on program arguments */ 
    370470    status = create_stream(pool, med_endpt, codec_info, dir, local_port,  
    371                            &remote_addr, &stream); 
     471                           &remote_addr,  
     472#if defined(PJMEDIA_HAS_SRTP) && (PJMEDIA_HAS_SRTP != 0) 
     473                           use_srtp, &srtp_crypto_suite,  
     474                           &srtp_tx_key, &srtp_rx_key, 
     475#endif 
     476                           &stream); 
    372477    if (status != PJ_SUCCESS) 
    373478        goto on_exit; 
     
    538643        tp = pjmedia_stream_get_transport(stream); 
    539644        pjmedia_stream_destroy(stream); 
    540         pjmedia_transport_udp_close(tp); 
     645         
     646        pjmedia_transport_close(tp); 
    541647    } 
    542648 
  • pjproject/trunk/pjsip/include/pjsua-lib/pjsua.h

    r1703 r1735  
    404404#endif 
    405405 
    406  
     406#if defined(PJMEDIA_HAS_SRTP) && (PJMEDIA_HAS_SRTP != 0) 
     407 
     408/** 
     409 * Default value of SRTP mode usage. Valid values are PJMEDIA_SRTP_DISABLED,  
     410 * PJMEDIA_SRTP_OPTIONAL, and PJMEDIA_SRTP_MANDATORY. 
     411 */ 
     412#ifndef PJSUA_DEFAULT_USE_SRTP 
     413    #define PJSUA_DEFAULT_USE_SRTP  PJMEDIA_SRTP_DISABLED 
     414#endif 
     415 
     416/** 
     417 * Default value of secure signaling requirement for SRTP. 
     418 * Valid values are: 
     419 *      0: SRTP does not require secure signaling 
     420 *      1: SRTP requires secure transport such as TLS 
     421 *      2: SRTP requires secure end-to-end transport (SIPS) 
     422 */ 
     423#ifndef PJSUA_DEFAULT_SRTP_SECURE_SIGNALING 
     424    #define PJSUA_DEFAULT_SRTP_SECURE_SIGNALING 1 
     425#endif 
     426 
     427#endif 
    407428 
    408429/** 
     
    10351056    pj_str_t        user_agent; 
    10361057 
     1058#if defined(PJMEDIA_HAS_SRTP) && (PJMEDIA_HAS_SRTP != 0) 
     1059    /** 
     1060     * Specify default value of secure media transport usage.  
     1061     * Valid values are PJMEDIA_SRTP_DISABLED, PJMEDIA_SRTP_OPTIONAL, and 
     1062     * PJMEDIA_SRTP_MANDATORY. 
     1063     * 
     1064     * Note that this setting can be further customized in account  
     1065     * configuration (#pjsua_acc_config). 
     1066     * 
     1067     * Default: #PJSUA_DEFAULT_USE_SRTP 
     1068     */ 
     1069    pjmedia_srtp_use    use_srtp; 
     1070 
     1071    /** 
     1072     * Specify whether SRTP requires secure signaling to be used. This option 
     1073     * is only used when \a use_srtp option above is non-zero. 
     1074     * 
     1075     * Valid values are: 
     1076     *  0: SRTP does not require secure signaling 
     1077     *  1: SRTP requires secure transport such as TLS 
     1078     *  2: SRTP requires secure end-to-end transport (SIPS) 
     1079     * 
     1080     * Note that this setting can be further customized in account  
     1081     * configuration (#pjsua_acc_config). 
     1082     * 
     1083     * Default: #PJSUA_DEFAULT_SRTP_SECURE_SIGNALING 
     1084     */ 
     1085    int              srtp_secure_signaling; 
     1086#endif 
     1087 
    10371088} pjsua_config; 
    10381089 
     
    19712022     */ 
    19722023    pj_str_t         ka_data; 
     2024 
     2025#if defined(PJMEDIA_HAS_SRTP) && (PJMEDIA_HAS_SRTP != 0) 
     2026    /** 
     2027     * Specify whether secure media transport should be used for this account. 
     2028     * Valid values are PJMEDIA_SRTP_DISABLED, PJMEDIA_SRTP_OPTIONAL, and 
     2029     * PJMEDIA_SRTP_MANDATORY. 
     2030     * 
     2031     * Default: #PJSUA_DEFAULT_USE_SRTP 
     2032     */ 
     2033    pjmedia_srtp_use    use_srtp; 
     2034 
     2035    /** 
     2036     * Specify whether SRTP requires secure signaling to be used. This option 
     2037     * is only used when \a use_srtp option above is non-zero. 
     2038     * 
     2039     * Valid values are: 
     2040     *  0: SRTP does not require secure signaling 
     2041     *  1: SRTP requires secure transport such as TLS 
     2042     *  2: SRTP requires secure end-to-end transport (SIPS) 
     2043     * 
     2044     * Default: #PJSUA_DEFAULT_SRTP_SECURE_SIGNALING 
     2045     */ 
     2046    int              srtp_secure_signaling; 
     2047#endif 
    19732048 
    19742049} pjsua_acc_config; 
  • pjproject/trunk/pjsip/include/pjsua-lib/pjsua_internal.h

    r1717 r1735  
    5151    pjsip_evsub         *xfer_sub;  /**< Xfer server subscription, if this 
    5252                                         call was triggered by xfer.        */ 
    53     pjmedia_transport   *med_tp;    /**< Media transport.                   */ 
     53    pjmedia_transport   *med_tp;    /**< Current media transport.           */ 
     54    pjmedia_transport   *med_orig;  /**< Original media transport           */ 
    5455    pj_timer_entry       refresh_tm;/**< Timer to send re-INVITE.           */ 
    5556    pj_timer_entry       hangup_tm; /**< Timer to hangup call.              */ 
     
    314315 */ 
    315316pj_status_t pjsua_media_channel_init(pjsua_call_id call_id, 
    316                                     pjsip_role_e role); 
     317                                     pjsip_role_e role, 
     318                                     int security_level); 
    317319pj_status_t pjsua_media_channel_create_sdp(pjsua_call_id call_id,  
    318320                                           pj_pool_t *pool, 
     321                                           const pjmedia_sdp_session *rem_sdp, 
    319322                                           pjmedia_sdp_session **p_sdp); 
    320323pj_status_t pjsua_media_channel_update(pjsua_call_id call_id, 
    321                                        const pjmedia_sdp_session *local_sdp, 
     324                                       pjmedia_sdp_session *local_sdp, 
    322325                                       const pjmedia_sdp_session *remote_sdp); 
    323326pj_status_t pjsua_media_channel_deinit(pjsua_call_id call_id); 
  • pjproject/trunk/pjsip/src/pjsua-lib/pjsua_call.c

    r1717 r1735  
    256256} 
    257257 
     258static pj_bool_t pj_stristr(const pj_str_t *str, const pj_str_t *substr) 
     259{ 
     260    int i; 
     261 
     262    for (i=0; i<(str->slen-substr->slen); ++i) { 
     263        pj_str_t s; 
     264        s.ptr = str->ptr+i; 
     265        s.slen = substr->slen; 
     266 
     267        if (pj_stricmp(&s, substr)==0) 
     268            return PJ_TRUE; 
     269    } 
     270    return PJ_FALSE; 
     271} 
     272 
     273/* Get signaling secure level. 
     274 * Return: 
     275 *  0: if signaling is not secure 
     276 *  1: if TLS transport is used for immediate hop 
     277 *  2: if end-to-end signaling is secure. 
     278 * 
     279 * NOTE: 
     280 *  THIS IS WRONG. It should take into account the route-set. 
     281 */ 
     282static int get_secure_level(const pj_str_t *dst_uri) 
     283{ 
     284    const pj_str_t tls = pj_str(";transport=tls"); 
     285    const pj_str_t sips = pj_str("sips:"); 
     286 
     287    PJ_TODO(Fix_get_secure_level); 
     288 
     289    if (pj_stristr(dst_uri, &sips)) 
     290        return 2; 
     291    if (pj_stristr(dst_uri, &tls)) 
     292        return 1; 
     293    return 0; 
     294} 
     295 
    258296/* 
    259297 * Make outgoing call to the specified URI using the specified account. 
     
    363401 
    364402    /* Init media channel */ 
    365     status = pjsua_media_channel_init(call->index, PJSIP_ROLE_UAC); 
     403    status = pjsua_media_channel_init(call->index, PJSIP_ROLE_UAC,  
     404                                      get_secure_level(dest_uri)); 
    366405    if (status != PJ_SUCCESS) { 
    367406        pjsua_perror(THIS_FILE, "Error initializing media channel", status); 
     
    373412    offer = NULL; 
    374413#else 
    375     status = pjsua_media_channel_create_sdp(call->index, dlg->pool, &offer); 
     414    status = pjsua_media_channel_create_sdp(call->index, dlg->pool, NULL, &offer); 
    376415    if (status != PJ_SUCCESS) { 
    377416        pjsua_perror(THIS_FILE, "pjmedia unable to create SDP", status); 
     
    520559    pjsua_call *call; 
    521560    int call_id = -1; 
    522     pjmedia_sdp_session *answer; 
     561    int secure_level; 
     562    pjmedia_sdp_session *offer, *answer; 
    523563    pj_status_t status; 
    524564 
     
    615655    } 
    616656 
    617  
    618     /* Init media channel */ 
    619     status = pjsua_media_channel_init(call->index, PJSIP_ROLE_UAS); 
    620     if (status != PJ_SUCCESS) { 
    621         pjsip_endpt_respond_stateless(pjsua_var.endpt, rdata, 500, NULL, 
    622                                       NULL, NULL); 
    623         PJSUA_UNLOCK(); 
    624         return PJ_TRUE; 
    625     } 
    626  
    627  
    628     /* Get media capability from media endpoint: */ 
    629     status = pjsua_media_channel_create_sdp(call->index, rdata->tp_info.pool, &answer); 
    630     if (status != PJ_SUCCESS) { 
    631         pjsip_endpt_respond_stateless(pjsua_var.endpt, rdata, 500, NULL, 
    632                                       NULL, NULL); 
    633         pjsua_media_channel_deinit(call->index); 
    634         PJSUA_UNLOCK(); 
    635         return PJ_TRUE; 
    636     } 
    637  
    638657    /*  
    639658     * Get which account is most likely to be associated with this incoming 
     
    643662    acc_id = call->acc_id = pjsua_acc_find_for_incoming(rdata); 
    644663 
     664#if defined(PJMEDIA_HAS_SRTP) && (PJMEDIA_HAS_SRTP != 0) 
     665    /* Get signaling security level, only when required by SRTP */ 
     666    if (pjsua_var.acc[acc_id].cfg.srtp_secure_signaling < 2) { 
     667        secure_level = PJSIP_TRANSPORT_IS_SECURE(rdata->tp_info.transport)!=0; 
     668    } else  
     669#endif 
     670 
     671    { 
     672        char *uri; 
     673        int uri_len; 
     674        pj_str_t dst; 
     675 
     676        uri = pj_pool_alloc(rdata->tp_info.pool, PJSIP_MAX_URL_SIZE); 
     677        uri_len = pjsip_uri_print(PJSIP_URI_IN_REQ_URI, 
     678                                  rdata->msg_info.msg->line.req.uri, 
     679                                  uri, PJSIP_MAX_URL_SIZE); 
     680        if (uri_len < 1) { 
     681            pjsua_perror(THIS_FILE, "Error analyzing dst URI",  
     682                         PJSIP_EURITOOLONG); 
     683            uri_len = 0; 
     684        } 
     685 
     686        dst.ptr = uri; 
     687        dst.slen = uri_len; 
     688 
     689        secure_level = get_secure_level(&dst); 
     690    } 
     691 
     692    /* Init media channel */ 
     693    status = pjsua_media_channel_init(call->index, PJSIP_ROLE_UAS,  
     694                                      secure_level); 
     695    if (status != PJ_SUCCESS) { 
     696        pjsip_endpt_respond_stateless(pjsua_var.endpt, rdata, 500, NULL, 
     697                                      NULL, NULL); 
     698        PJSUA_UNLOCK(); 
     699        return PJ_TRUE; 
     700    } 
     701 
     702    /* Parse SDP from incoming request */ 
     703    if (rdata->msg_info.msg->body) { 
     704        status = pjmedia_sdp_parse(rdata->tp_info.pool,  
     705                                   rdata->msg_info.msg->body->data, 
     706                                   rdata->msg_info.msg->body->len, &offer); 
     707        if (status != PJ_SUCCESS) { 
     708            pjsua_perror(THIS_FILE, "Error parsing SDP in incoming INVITE", status); 
     709            pjsip_endpt_respond_stateless(pjsua_var.endpt, rdata, 400, NULL, 
     710                                          NULL, NULL); 
     711            pjsua_media_channel_deinit(call->index); 
     712            PJSUA_UNLOCK(); 
     713            return PJ_TRUE; 
     714        } 
     715    } else { 
     716        offer = NULL; 
     717    } 
     718 
     719    /* Get media capability from media endpoint: */ 
     720    status = pjsua_media_channel_create_sdp(call->index, rdata->tp_info.pool,  
     721                                            offer, &answer); 
     722    if (status != PJ_SUCCESS) { 
     723        pjsip_endpt_respond_stateless(pjsua_var.endpt, rdata, 500, NULL, 
     724                                      NULL, NULL); 
     725        pjsua_media_channel_deinit(call->index); 
     726        PJSUA_UNLOCK(); 
     727        return PJ_TRUE; 
     728    } 
     729 
    645730    /* Verify that we can handle the request. */ 
    646731    options |= PJSIP_INV_SUPPORT_100REL; 
     
    648733        options |= PJSIP_INV_REQUIRE_100REL; 
    649734 
    650     status = pjsip_inv_verify_request(rdata, &options, answer, NULL, 
    651                                       pjsua_var.endpt, &response); 
     735    status = pjsip_inv_verify_request2(rdata, &options, offer, answer, NULL, 
     736                                       pjsua_var.endpt, &response); 
    652737    if (status != PJ_SUCCESS) { 
    653738 
     
    13391424 
    13401425    /* Init media channel */ 
    1341     status = pjsua_media_channel_init(call->index, PJSIP_ROLE_UAC); 
     1426    status = pjsua_media_channel_init(call->index, PJSIP_ROLE_UAC, 
     1427                                      get_secure_level(&dlg->remote.info_str)); 
    13421428    if (status != PJ_SUCCESS) { 
    13431429        pjsua_perror(THIS_FILE, "Error initializing media channel", status); 
     
    13491435    PJ_UNUSED_ARG(unhold); 
    13501436    PJ_TODO(create_active_inactive_sdp_based_on_unhold_arg); 
    1351     status = pjsua_media_channel_create_sdp(call->index, call->inv->pool, &sdp); 
     1437    status = pjsua_media_channel_create_sdp(call->index, call->inv->pool,  
     1438                                            NULL, &sdp); 
    13521439    if (status != PJ_SUCCESS) { 
    13531440        pjsua_perror(THIS_FILE, "Unable to get SDP from media endpoint",  
     
    14071494 
    14081495    /* Init media channel */ 
    1409     status = pjsua_media_channel_init(call->index, PJSIP_ROLE_UAC); 
     1496    status = pjsua_media_channel_init(call->index, PJSIP_ROLE_UAC, 
     1497                                      get_secure_level(&dlg->remote.info_str)); 
    14101498    if (status != PJ_SUCCESS) { 
    14111499        pjsua_perror(THIS_FILE, "Error initializing media channel", status); 
     
    14151503 
    14161504    /* Create SDP */ 
    1417     status = pjsua_media_channel_create_sdp(call->index, call->inv->pool, &sdp); 
     1505    status = pjsua_media_channel_create_sdp(call->index, call->inv->pool,  
     1506                                            NULL, &sdp); 
    14181507    if (status != PJ_SUCCESS) { 
    14191508        pjsua_perror(THIS_FILE, "Unable to get SDP from media endpoint",  
     
    23562445{ 
    23572446    pjsua_call *call; 
    2358     const pjmedia_sdp_session *local_sdp; 
     2447    const pjmedia_sdp_session *c_local; 
     2448    pjmedia_sdp_session *local_sdp; 
    23592449    const pjmedia_sdp_session *remote_sdp; 
    23602450 
     
    23852475 
    23862476    /* Get local and remote SDP */ 
    2387     status = pjmedia_sdp_neg_get_active_local(call->inv->neg, &local_sdp); 
     2477    status = pjmedia_sdp_neg_get_active_local(call->inv->neg, &c_local); 
    23882478    if (status != PJ_SUCCESS) { 
    23892479        pjsua_perror(THIS_FILE,  
     
    23942484        return; 
    23952485    } 
     2486    local_sdp = (pjmedia_sdp_session*) c_local; 
    23962487 
    23972488    status = pjmedia_sdp_neg_get_active_remote(call->inv->neg, &remote_sdp); 
     
    25252616        status = create_inactive_sdp( call, &answer ); 
    25262617    } else { 
     2618        int secure_level; 
    25272619 
    25282620        PJ_LOG(4,(THIS_FILE, "Call %d: received updated media offer", 
     
    25302622 
    25312623        /* Init media channel */ 
    2532         status = pjsua_media_channel_init(call->index, PJSIP_ROLE_UAS); 
     2624        secure_level = get_secure_level(&call->inv->dlg->remote.info_str); 
     2625        status = pjsua_media_channel_init(call->index, PJSIP_ROLE_UAS, 
     2626                                          secure_level); 
    25332627        if (status != PJ_SUCCESS) { 
    25342628            pjsua_perror(THIS_FILE, "Error initializing media channel", status); 
     
    25372631        } 
    25382632 
    2539         status = pjsua_media_channel_create_sdp(call->index, call->inv->pool, &answer); 
     2633        status = pjsua_media_channel_create_sdp(call->index, call->inv->pool,  
     2634                                                offer, &answer); 
    25402635    } 
    25412636 
     
    25772672        status = create_inactive_sdp( call, offer ); 
    25782673    } else { 
     2674        int secure_level; 
    25792675 
    25802676        PJ_LOG(4,(THIS_FILE, "Call %d: asked to send a new offer", 
     
    25822678 
    25832679        /* Init media channel */ 
    2584         status = pjsua_media_channel_init(call->index, PJSIP_ROLE_UAC); 
     2680        secure_level = get_secure_level(&call->inv->dlg->remote.info_str); 
     2681        status = pjsua_media_channel_init(call->index, PJSIP_ROLE_UAC, 
     2682                                          secure_level); 
    25852683        if (status != PJ_SUCCESS) { 
    25862684            pjsua_perror(THIS_FILE, "Error initializing media channel", status); 
     
    25892687        } 
    25902688 
    2591         status = pjsua_media_channel_create_sdp(call->index, call->inv->pool, offer); 
     2689        status = pjsua_media_channel_create_sdp(call->index, call->inv->pool,  
     2690                                                NULL, offer); 
    25922691    } 
    25932692 
  • pjproject/trunk/pjsip/src/pjsua-lib/pjsua_core.c

    r1705 r1735  
    8888    cfg->thread_cnt = 1; 
    8989    cfg->nat_type_in_sdp = 1; 
     90#if defined(PJMEDIA_HAS_SRTP) && (PJMEDIA_HAS_SRTP != 0) 
     91    cfg->use_srtp = PJSUA_DEFAULT_USE_SRTP; 
     92    cfg->srtp_secure_signaling = PJSUA_DEFAULT_SRTP_SECURE_SIGNALING; 
     93#endif 
    9094} 
    9195 
     
    143147    cfg->ka_interval = 15; 
    144148    cfg->ka_data = pj_str("\r\n"); 
     149#if defined(PJMEDIA_HAS_SRTP) && (PJMEDIA_HAS_SRTP != 0) 
     150    cfg->use_srtp = pjsua_var.ua_cfg.use_srtp; 
     151    cfg->srtp_secure_signaling = pjsua_var.ua_cfg.srtp_secure_signaling; 
     152#endif 
    145153} 
    146154 
  • pjproject/trunk/pjsip/src/pjsua-lib/pjsua_media.c

    r1704 r1735  
    535535            goto on_error; 
    536536        } 
     537 
    537538        status = pjmedia_transport_udp_attach(pjsua_var.med_endpt, NULL, 
    538539                                              &skinfo, 0, 
     
    544545        } 
    545546 
    546         pjmedia_transport_udp_simulate_lost(pjsua_var.calls[i].med_tp, 
    547                                             PJMEDIA_DIR_ENCODING, 
    548                                             pjsua_var.media_cfg.tx_drop_pct); 
    549  
    550         pjmedia_transport_udp_simulate_lost(pjsua_var.calls[i].med_tp, 
    551                                             PJMEDIA_DIR_DECODING, 
    552                                             pjsua_var.media_cfg.rx_drop_pct); 
     547        pjmedia_transport_simulate_lost(pjsua_var.calls[i].med_tp, 
     548                                        PJMEDIA_DIR_ENCODING, 
     549                                        pjsua_var.media_cfg.tx_drop_pct); 
     550 
     551        pjmedia_transport_simulate_lost(pjsua_var.calls[i].med_tp, 
     552                                        PJMEDIA_DIR_DECODING, 
     553                                        pjsua_var.media_cfg.rx_drop_pct); 
    553554 
    554555    } 
     
    646647        } 
    647648 
    648         pjmedia_ice_simulate_lost(pjsua_var.calls[i].med_tp, 
    649                                   PJMEDIA_DIR_ENCODING, 
    650                                   pjsua_var.media_cfg.tx_drop_pct); 
    651  
    652         pjmedia_ice_simulate_lost(pjsua_var.calls[i].med_tp, 
    653                                   PJMEDIA_DIR_DECODING, 
    654                                   pjsua_var.media_cfg.rx_drop_pct); 
     649        pjmedia_transport_simulate_lost(pjsua_var.calls[i].med_tp, 
     650                                        PJMEDIA_DIR_ENCODING, 
     651                                        pjsua_var.media_cfg.tx_drop_pct); 
     652 
     653        pjmedia_transport_simulate_lost(pjsua_var.calls[i].med_tp, 
     654                                        PJMEDIA_DIR_DECODING, 
     655                                        pjsua_var.media_cfg.rx_drop_pct); 
    655656 
    656657        status = pjmedia_ice_start_init(pjsua_var.calls[i].med_tp, 0, &addr, 
     
    745746 
    746747pj_status_t pjsua_media_channel_init(pjsua_call_id call_id, 
    747                                      pjsip_role_e role) 
     748                                     pjsip_role_e role, 
     749                                     int security_level) 
    748750{ 
    749751    pjsua_call *call = &pjsua_var.calls[call_id]; 
    750752 
    751     if (pjsua_var.media_cfg.enable_ice) { 
    752         pj_ice_sess_role ice_role; 
    753         pj_status_t status; 
    754  
    755         ice_role = (role==PJSIP_ROLE_UAC ? PJ_ICE_SESS_ROLE_CONTROLLING :  
    756                                            PJ_ICE_SESS_ROLE_CONTROLLED); 
    757  
    758         /* Restart ICE */ 
    759         pjmedia_ice_stop_ice(call->med_tp); 
    760  
    761         status = pjmedia_ice_init_ice(call->med_tp, ice_role, NULL, NULL); 
    762         if (status != PJ_SUCCESS) 
    763             return status; 
    764     } 
    765  
    766     return PJ_SUCCESS; 
    767 } 
    768  
    769 pj_status_t pjsua_media_channel_create_sdp(pjsua_call_id call_id,  
    770                                            pj_pool_t *pool, 
    771                                            pjmedia_sdp_session **p_sdp) 
    772 { 
    773     pjmedia_sdp_session *sdp; 
    774     pjmedia_sock_info skinfo; 
    775     pjsua_call *call = &pjsua_var.calls[call_id]; 
     753#if defined(PJMEDIA_HAS_SRTP) && (PJMEDIA_HAS_SRTP != 0) 
     754    pjsua_acc *acc = &pjsua_var.acc[call->acc_id]; 
     755    pjmedia_srtp_setting srtp_opt; 
     756    pjmedia_transport *srtp; 
    776757    pj_status_t status; 
     758#endif 
     759 
     760    PJ_UNUSED_ARG(role); 
    777761 
    778762    /* Return error if media transport has not been created yet 
     
    783767    } 
    784768 
     769    /* Stop media transport (for good measure!) */ 
     770    pjmedia_transport_media_stop(call->med_tp); 
     771 
     772#if defined(PJMEDIA_HAS_SRTP) && (PJMEDIA_HAS_SRTP != 0) 
     773    /* Check if SRTP requires secure signaling */ 
     774    if (acc->cfg.use_srtp != PJMEDIA_SRTP_DISABLED) { 
     775        if (security_level < acc->cfg.srtp_secure_signaling) { 
     776            return PJSIP_ESESSIONINSECURE; 
     777        } 
     778    } 
     779 
     780    /* Always create SRTP adapter */ 
     781    pjmedia_srtp_setting_default(&srtp_opt); 
     782    srtp_opt.close_member_tp = PJ_FALSE; 
     783    srtp_opt.use = acc->cfg.use_srtp; 
     784    status = pjmedia_transport_srtp_create(pjsua_var.med_endpt,  
     785                                           call->med_tp, 
     786                                           &srtp_opt, &srtp); 
     787    if (status != PJ_SUCCESS) 
     788        return status; 
     789 
     790    /* Set SRTP as current media transport */ 
     791    call->med_orig = call->med_tp; 
     792    call->med_tp = srtp; 
     793#else 
     794    call->med_orig = call->med_tp; 
     795    PJ_UNUSED_ARG(security_level); 
     796#endif 
     797 
     798    return PJ_SUCCESS; 
     799} 
     800 
     801pj_status_t pjsua_media_channel_create_sdp(pjsua_call_id call_id,  
     802                                           pj_pool_t *pool, 
     803                                           const pjmedia_sdp_session *rem_sdp, 
     804                                           pjmedia_sdp_session **p_sdp) 
     805{ 
     806    enum { MAX_MEDIA = 1, MEDIA_IDX = 0 }; 
     807    pjmedia_sdp_session *sdp; 
     808    pjmedia_sock_info skinfo; 
     809    pjsua_call *call = &pjsua_var.calls[call_id]; 
     810    pj_status_t status; 
     811 
     812    /* Return error if media transport has not been created yet 
     813     * (e.g. application is starting) 
     814     */ 
     815    if (call->med_tp == NULL) { 
     816        return PJ_EBUSY; 
     817    } 
     818 
    785819    /* Get media socket info */ 
    786820    pjmedia_transport_get_info(call->med_tp, &skinfo); 
    787821 
    788822    /* Create SDP */ 
    789     status = pjmedia_endpt_create_sdp(pjsua_var.med_endpt, pool, 1, 
     823    status = pjmedia_endpt_create_sdp(pjsua_var.med_endpt, pool, MAX_MEDIA, 
    790824                                      &skinfo, &sdp); 
    791825    if (status != PJ_SUCCESS) 
     
    816850    } 
    817851 
    818     if (pjsua_var.media_cfg.enable_ice) { 
    819         status = pjmedia_ice_modify_sdp(call->med_tp, pool, sdp); 
    820         if (status != PJ_SUCCESS) 
    821             goto on_error; 
    822     } 
     852    /* Give the SDP to media transport */ 
     853    status = pjmedia_transport_media_create(call->med_tp, pool,  
     854                                            sdp, rem_sdp, MEDIA_IDX); 
     855    if (status != PJ_SUCCESS) 
     856        goto on_error; 
    823857 
    824858    *p_sdp = sdp; 
     
    859893    stop_media_session(call_id); 
    860894 
    861     if (pjsua_var.media_cfg.enable_ice) { 
    862         pjmedia_ice_stop_ice(call->med_tp); 
    863     } 
    864  
     895    pjmedia_transport_media_stop(call->med_tp); 
     896 
     897    if (call->med_tp != call->med_orig) { 
     898        pjmedia_transport_close(call->med_tp); 
     899        call->med_tp = call->med_orig; 
     900    } 
    865901    return PJ_SUCCESS; 
    866902} 
     
    878914        pjsua_call_id call_id; 
    879915 
    880         call_id = (pjsua_call_id)user_data; 
     916        call_id = (pjsua_call_id)(long)user_data; 
    881917        pjsua_var.ua_cfg.cb.on_dtmf_digit(call_id, digit); 
    882918    } 
     
    885921 
    886922pj_status_t pjsua_media_channel_update(pjsua_call_id call_id, 
    887                                        const pjmedia_sdp_session *local_sdp, 
     923                                       pjmedia_sdp_session *local_sdp, 
    888924                                       const pjmedia_sdp_session *remote_sdp) 
    889925{ 
     
    912948    for (i=0; i < sess_info.stream_cnt; ++i) { 
    913949        if (sess_info.stream_info[i].type == PJMEDIA_TYPE_AUDIO && 
    914             sess_info.stream_info[i].proto == PJMEDIA_TP_PROTO_RTP_AVP) 
     950            (sess_info.stream_info[i].proto == PJMEDIA_TP_PROTO_RTP_AVP || 
     951             sess_info.stream_info[i].proto == PJMEDIA_TP_PROTO_RTP_SAVP)) 
    915952        { 
    916953            si = &sess_info.stream_info[i]; 
     
    946983        call->media_dir = PJMEDIA_DIR_NONE; 
    947984 
    948         /* Shutdown ICE session */ 
    949         if (pjsua_var.media_cfg.enable_ice) { 
    950             pjmedia_ice_stop_ice(call->med_tp); 
    951         } 
     985        /* Shutdown transport's session */ 
     986        pjmedia_transport_media_stop(call->med_tp); 
    952987 
    953988        /* No need because we need keepalive? */ 
    954989 
    955990    } else { 
    956         /* Start ICE */ 
    957         if (pjsua_var.media_cfg.enable_ice) { 
    958             status = pjmedia_ice_start_ice(call->med_tp, call->inv->pool,  
    959                                            remote_sdp, 0); 
    960             if (status != PJ_SUCCESS) 
    961                 return status; 
    962         } 
     991        /* Start media transport */ 
     992        status = pjmedia_transport_media_start(call->med_tp,  
     993                                               call->inv->pool, 
     994                                               local_sdp, remote_sdp, 0); 
     995        if (status != PJ_SUCCESS) 
     996            return status; 
    963997 
    964998        /* Override ptime, if this option is specified. */ 
     
    10011035            pjmedia_session_set_dtmf_callback(call->session, 0,  
    10021036                                              &dtmf_callback,  
    1003                                               (void*)(call->index)); 
     1037                                              (void*)(long)(call->index)); 
    10041038        } 
    10051039 
Note: See TracChangeset for help on using the changeset viewer.