Changeset 1210


Ignore:
Timestamp:
Apr 22, 2007 12:48:30 PM (17 years ago)
Author:
bennylp
Message:

Merged changes from the trunk

Location:
pjproject/branches/split-3rd-party
Files:
20 edited
1 copied

Legend:

Unmodified
Added
Removed
  • pjproject/branches/split-3rd-party/Makefile

    r1202 r1210  
    5757        done 
    5858 
     59prefix = /usr/local 
     60install: 
     61        mkdir -p $(DESTDIR)$(prefix)/lib 
     62        cp -L $$(find . -name '*.a') $(DESTDIR)$(prefix)/lib 
     63        mkdir -p $(DESTDIR)$(prefix)/include 
     64        cp -RL $$(find  . -name include) $(DESTDIR)$(prefix) 
     65        cd $(DESTDIR)$(prefix)/lib && for i in $$(find . -name 'libpj*a'); do\ 
     66                ln -s $$i $$(echo $$i | sed -e "s/-$(TARGET_NAME)//");\ 
     67        done 
     68        mkdir -p $(DESTDIR)$(prefix)/lib/pkgconfig 
     69        sed -e "s!@PREFIX@!$(DESTDIR)$(prefix)!" libpj.pc.in > $(DESTDIR)/$(prefix)/lib/pkgconfig/libpj.pc 
  • pjproject/branches/split-3rd-party/pjlib-util/src/pjlib-util/scanner.c

    r1145 r1210  
    343343                                pj_str_t *out) 
    344344{ 
    345     pj_scan_get_quotes(scanner, (char*)&begin_quote, (char*)&end_quote, 1, out); 
     345    char beg = (char)begin_quote; 
     346    char end = (char)end_quote; 
     347    pj_scan_get_quotes(scanner, &beg, &end, 1, out); 
    346348} 
    347349 
  • pjproject/branches/split-3rd-party/pjlib/include/pj/string.h

    r974 r1210  
    519519 
    520520/** 
     521 * Convert strings to an unsigned long-integer value. 
     522 * This function stops reading the string input either when the number 
     523 * of characters has exceeded the length of the input or it has read  
     524 * the first character it cannot recognize as part of a number, that is 
     525 * a character greater than or equal to base.  
     526 * 
     527 * @param str       The input string. 
     528 * @param endptr    Optional pointer to receive the remainder/unparsed 
     529 *                  portion of the input. 
     530 * @param base      Number base to use. 
     531 * 
     532 * @return the unsigned integer number. 
     533 */ 
     534PJ_DECL(unsigned long) pj_strtoul2(const pj_str_t *str, pj_str_t *endptr, 
     535                                   unsigned base); 
     536 
     537/** 
    521538 * Utility to convert unsigned integer to string. Note that the 
    522539 * string will be NULL terminated. 
  • pjproject/branches/split-3rd-party/pjlib/src/pj/hash.c

    r974 r1210  
    134134    if (hval && *hval != 0) { 
    135135        hash = *hval; 
     136        if (keylen==PJ_HASH_KEY_STRING) { 
     137            keylen = pj_ansi_strlen((const char*)key); 
     138        } 
    136139    } else { 
    137140        /* This slightly differs with pj_hash_calc() because we need  
  • pjproject/branches/split-3rd-party/pjlib/src/pj/string.c

    r1125 r1210  
    1818 */ 
    1919#include <pj/string.h> 
     20#include <pj/assert.h> 
    2021#include <pj/pool.h> 
    2122#include <pj/ctype.h> 
     
    8485} 
    8586 
     87PJ_DEF(unsigned long) pj_strtoul2(const pj_str_t *str, pj_str_t *endptr, 
     88                                  unsigned base) 
     89{ 
     90    unsigned long value; 
     91    unsigned i; 
     92 
     93    PJ_CHECK_STACK(); 
     94 
     95    value = 0; 
     96    if (base <= 10) { 
     97        for (i=0; i<(unsigned)str->slen; ++i) { 
     98            unsigned c = (str->ptr[i] - '0'); 
     99            if (c >= base) 
     100                break; 
     101            value = value * base + c; 
     102        } 
     103    } else if (base == 16) { 
     104        for (i=0; i<(unsigned)str->slen; ++i) { 
     105            if (!pj_isxdigit(str->ptr[i])) 
     106                break; 
     107            value = value * 16 + pj_hex_digit_to_val(str->ptr[i]); 
     108        } 
     109    } else { 
     110        pj_assert(!"Unsupported base"); 
     111        i = 0; 
     112        value = 0xFFFFFFFFUL; 
     113    } 
     114 
     115    if (endptr) { 
     116        endptr->ptr = str->ptr + i; 
     117        endptr->slen = str->slen - i; 
     118    } 
     119 
     120    return value; 
     121} 
     122 
    86123PJ_DEF(int) pj_utoa(unsigned long val, char *buf) 
    87124{ 
  • pjproject/branches/split-3rd-party/pjlib/src/pjlib-test/string.c

    r974 r1210  
    4949 *  - pj_utoa() 
    5050 *  - pj_strtoul() 
     51 *  - pj_strtoul2() 
    5152 *  - pj_create_random_string() 
    5253 *  - ... and mode.. 
     
    359360        return -280; 
    360361 
     362    /* 
     363     * pj_strtoul2() 
     364     */ 
     365    s5 = pj_str("123456"); 
     366 
     367    pj_strtoul2(&s5, NULL, 10); /* Crash test */ 
     368 
     369    if (pj_strtoul2(&s5, &s4, 10) != 123456UL) 
     370        return -290; 
     371    if (s4.slen != 0) 
     372        return -291; 
     373    if (pj_strtoul2(&s5, &s4, 16) != 0x123456UL) 
     374        return -292; 
     375 
     376    s5 = pj_str("0123ABCD"); 
     377    if (pj_strtoul2(&s5, &s4, 10) != 123) 
     378        return -293; 
     379    if (s4.slen != 4) 
     380        return -294; 
     381    if (s4.ptr == NULL || *s4.ptr != 'A') 
     382        return -295; 
     383    if (pj_strtoul2(&s5, &s4, 16) != 0x123ABCDUL) 
     384        return -296; 
     385    if (s4.slen != 0) 
     386        return -297; 
     387 
    361388    /*  
    362389     * pj_create_random_string()  
  • pjproject/branches/split-3rd-party/pjmedia/include/pjmedia/alaw_ulaw.h

    r974 r1210  
    2121 
    2222#include <pjmedia/types.h> 
     23 
     24PJ_BEGIN_DECL 
    2325 
    2426#if defined(PJMEDIA_HAS_ALAW_ULAW_TABLE) && PJMEDIA_HAS_ALAW_ULAW_TABLE!=0 
     
    135137PJ_DECL(unsigned char) pjmedia_ulaw2alaw(unsigned char uval); 
    136138 
    137  
    138139#endif 
    139140 
     141PJ_END_DECL 
    140142 
    141143#endif  /* __PJMEDIA_ALAW_ULAW_H__ */ 
  • pjproject/branches/split-3rd-party/pjmedia/src/pjmedia/alaw_ulaw.c

    r838 r1210  
    155155PJ_DEF(int) 
    156156pjmedia_alaw2linear( 
    157         unsigned char   a_val) 
     157        unsigned a_val) 
    158158{ 
    159159        int             t; 
  • pjproject/branches/split-3rd-party/pjmedia/src/pjmedia/sdp.c

    r974 r1210  
    139139{ 
    140140    unsigned i; 
     141    unsigned c_pt = 0xFFFF; 
     142 
     143    if (c_fmt) 
     144        c_pt = pj_strtoul(c_fmt); 
    141145 
    142146    for (i=0; i<count; ++i) { 
     
    144148            const pjmedia_sdp_attr *a = attr_array[i]; 
    145149            if (c_fmt) { 
    146                 if (a->value.slen > c_fmt->slen && 
    147                     pj_strncmp(&a->value, c_fmt, c_fmt->slen)==0) 
    148                 { 
     150                unsigned pt = (unsigned) pj_strtoul2(&a->value, NULL, 10); 
     151                if (pt == c_pt) { 
    149152                    return (pjmedia_sdp_attr*)a; 
    150153                } 
  • pjproject/branches/split-3rd-party/pjnath/build/Makefile

    r1201 r1210  
    1111PJLIB_UTIL_LIB:=../../pjlib-util/lib/libpjlib-util-$(TARGET_NAME)$(LIBEXT) 
    1212PJNATH_LIB:=../../pjnath/lib/libpjnath-$(TARGET_NAME)$(LIBEXT) 
    13 export PJNATH_LIB:=../lib/libpjnath-$(TARGET_NAME)$(LIBEXT) 
    1413 
    1514############################################################################### 
     
    2827 
    2928############################################################################### 
    30 # Defines for building PJLIB-UTIL library 
     29# Defines for building PJNATH library 
    3130# 
    3231export PJNATH_SRCDIR = ../src/pjnath 
     
    4645 
    4746         
     47############################################################################### 
     48# Defines for building test client application 
     49# 
     50export PJSTUN_CLIENT_SRCDIR = ../src/pjstun-client 
     51export PJSTUN_CLIENT_OBJS += client_main.o 
     52export PJSTUN_CLIENT_CFLAGS += $(_CFLAGS) 
     53export PJSTUN_CLIENT_LDFLAGS += $(_LDFLAGS) 
     54export PJSTUN_CLIENT_EXE:=../bin/pjstun-client-$(TARGET_NAME)$(HOST_EXE) 
     55 
     56############################################################################### 
     57# Defines for building test server application 
     58# 
     59export PJSTUN_SRV_TEST_SRCDIR = ../src/pjstun-srv-test 
     60export PJSTUN_SRV_TEST_OBJS +=  bind_usage.o server.o turn_usage.o usage.o \ 
     61                                main.o 
     62export PJSTUN_SRV_TEST_CFLAGS += $(_CFLAGS) 
     63export PJSTUN_SRV_TEST_LDFLAGS += $(_LDFLAGS) 
     64export PJSTUN_SRV_TEST_EXE:=../bin/pjstun-srv-test-$(TARGET_NAME)$(HOST_EXE) 
     65 
     66         
     67         
    4868export CC_OUT CC AR RANLIB HOST_MV HOST_RM HOST_RMDIR HOST_MKDIR OBJEXT LD LDOUT  
    4969############################################################################### 
     
    5272# $(TARGET) is defined in os-$(OS_NAME).mak file in current directory. 
    5373# 
    54 TARGETS := pjnath pjnath-test 
     74TARGETS := pjnath pjnath-test pjstun-client pjstun-srv-test 
    5575 
    5676all: $(TARGETS) 
     
    6989pjnath-test: $(PJLIB_LIB) $(PJLIB_UTIL_LIB) $(PJNATH_LIB) 
    7090        $(MAKE) -f $(RULES_MAK) APP=PJNATH_TEST app=pjnath-test $(PJNATH_TEST_EXE) 
     91 
     92pjstun-client: $(PJLIB_LIB) $(PJLIB_UTIL_LIB) $(PJNATH_LIB) 
     93        $(MAKE) -f $(RULES_MAK) APP=PJSTUN_CLIENT app=pjstun-client $(PJSTUN_CLIENT_EXE) 
     94 
     95pjstun-srv-test: $(PJLIB_LIB) $(PJLIB_UTIL_LIB) $(PJNATH_LIB) 
     96        $(MAKE) -f $(RULES_MAK) APP=PJSTUN_SRV_TEST app=pjstun-srv-test $(PJSTUN_SRV_TEST_EXE) 
    7197 
    7298.PHONY: ../lib/pjnath.ko 
  • pjproject/branches/split-3rd-party/pjnath/src/pjnath/ice_session.c

    r1157 r1210  
    550550    char tmp[128]; 
    551551 
    552     PJ_ASSERT_RETURN(ice && comp_id && local_pref && 
     552    PJ_ASSERT_RETURN(ice && comp_id &&  
    553553                     foundation && addr && base_addr && addr_len, 
    554554                     PJ_EINVAL); 
  • pjproject/branches/split-3rd-party/pjnath/src/pjnath/ice_strans.c

    r1154 r1210  
    213213{ 
    214214    pj_ice_strans_cand *cand; 
     215    unsigned i; 
    215216 
    216217    PJ_ASSERT_RETURN(ice_st && comp && addr, PJ_EINVAL); 
    217218    PJ_ASSERT_RETURN(comp->cand_cnt < PJ_ICE_ST_MAX_CAND, PJ_ETOOMANY); 
     219 
     220    /* Check that we don't have candidate with the same 
     221     * address. 
     222     */ 
     223    for (i=0; i<comp->cand_cnt; ++i) { 
     224        if (pj_memcmp(addr, &comp->cand_list[i].addr,  
     225                      sizeof(pj_sockaddr_in))==0) 
     226        { 
     227            /* Duplicate */ 
     228            PJ_LOG(5,(ice_st->obj_name, "Duplicate candidate not added")); 
     229            return PJ_SUCCESS; 
     230        } 
     231    } 
    218232 
    219233    cand = &comp->cand_list[comp->cand_cnt]; 
     
    226240    cand->local_pref = local_pref; 
    227241    pj_ice_calc_foundation(ice_st->pool, &cand->foundation, type,  
    228                            (const pj_sockaddr*)addr); 
     242                           &comp->local_addr); 
    229243 
    230244    if (set_default)  
  • pjproject/branches/split-3rd-party/pjnath/src/pjstun-client/client_main.c

    r1152 r1210  
    6767 
    6868 
    69 static my_perror(const char *title, pj_status_t status) 
     69static void my_perror(const char *title, pj_status_t status) 
    7070{ 
    7171    char errmsg[PJ_ERR_MSG_SIZE]; 
     
    146146        if (n > 0) { 
    147147            if (PJ_FD_ISSET(g.sock, &readset)) { 
    148                 char buffer[512]; 
     148                pj_uint8_t buffer[512]; 
    149149                pj_ssize_t len; 
    150150                pj_sockaddr_in addr; 
     
    427427                                  &g.peer_addr, sizeof(g.peer_addr)); 
    428428    pj_stun_msg_add_binary_attr(tdata->pool, tdata->msg, 
    429                                 PJ_STUN_ATTR_DATA, g.data, len); 
     429                                PJ_STUN_ATTR_DATA, (pj_uint8_t*)g.data, len); 
    430430 
    431431    rc = pj_stun_session_send_msg(g.sess, PJ_FALSE,  
     
    521521    printf("Input peer address in IP:PORT format: "); 
    522522    fflush(stdout); 
    523     gets(addr); 
     523    fgets(addr, sizeof(addr), stdin); 
    524524 
    525525    if (parse_addr(addr, &g.peer_addr) != PJ_SUCCESS) { 
     
    562562        } else if (input[0]=='d' && input[1]=='t') { 
    563563            printf("Input data: "); 
    564             gets(g.data); 
     564            fgets(g.data, sizeof(g.data_buf), stdin); 
    565565             
    566566        } else if (input[0]=='p' && input[1]=='r') { 
  • pjproject/branches/split-3rd-party/pjsip-apps/src/pjsua/pjsua_app.c

    r1135 r1210  
    321321    int c; 
    322322    int option_index; 
    323     enum { OPT_CONFIG_FILE, OPT_LOG_FILE, OPT_LOG_LEVEL, OPT_APP_LOG_LEVEL,  
     323    enum { OPT_CONFIG_FILE=127, OPT_LOG_FILE, OPT_LOG_LEVEL, OPT_APP_LOG_LEVEL,  
    324324           OPT_HELP, OPT_VERSION, OPT_NULL_AUDIO,  
    325325           OPT_LOCAL_PORT, OPT_IP_ADDR, OPT_PROXY, OPT_OUTBOUND_PROXY,  
     
    880880            PJ_LOG(1,(THIS_FILE,  
    881881                      "Argument \"%s\" is not valid. Use --help to see help", 
    882                       argv[pj_optind])); 
     882                      argv[pj_optind-1])); 
    883883            return -1; 
    884884        } 
  • pjproject/branches/split-3rd-party/pjsip/include/pjsip/sip_transaction.h

    r974 r1210  
    7575 
    7676/** 
    77  * Transaction timeout timer policy, to control the UAC transaction timeout 
    78  * scheduling (see #pjsip_tsx_set_uac_timeout()). 
    79  */ 
    80 typedef enum pjsip_tsx_timeout_policy 
    81 { 
    82     PJSIP_TSX_IGNORE_100 = 1,   /**< To make the UAC transaction NOT to cancel 
    83                                      the timeout timer when 100 response is  
    84                                      received.*/ 
    85     PJSIP_TSX_IGNORE_1xx = 3    /**< To make the UAC transaction NOT to cancel 
    86                                      the timeout timer when any 1xx responses  
    87                                      are received. */ 
    88 } pjsip_tsx_timeout_policy; 
    89  
    90  
    91 /** 
    9277 * This structure describes SIP transaction object. The transaction object 
    9378 * is used to handle both UAS and UAC transaction. 
     
    146131    pj_timer_entry              timeout_timer;  /**< Timeout timer.         */ 
    147132 
    148     unsigned                    msec_timeout;   /**< User set timeout.      */ 
    149     pjsip_tsx_timeout_policy    timeout_policy; /**< Timeout policy.        */ 
    150  
    151133    /** Module specific data. */ 
    152134    void                       *mod_data[PJSIP_MAX_MODULE]; 
     
    249231                                             const pjsip_tpselector *sel); 
    250232 
    251  
    252 /** 
    253  * Set the UAC absolute transaction timeout. Normally UAC transaction will 
    254  * stop its timeout timer (timer B for INVITE and timer F for non-INVITE 
    255  * transactions) after a provisional response is received. 
    256  * 
    257  * When this timer is set, the transaction's timer B and F will use this 
    258  * value, and if the \a flag flag is set, the transaction will continue 
    259  * the scheduling of the timeout timer even when provisional response has 
    260  * been received. 
    261  * 
    262  * Note that this function MUST be called AFTER the transaction has been 
    263  * created AND BEFORE any request is transmitted. 
    264  * 
    265  * @param tsx       The client/UAC transaction. 
    266  * @param msec_time The timeout value, in miliseconds. Currently this 
    267  *                  value must be non-zero (value zero is reserved for 
    268  *                  future use). 
    269  * @param flag      Option flags to control whether the transaction should 
    270  *                  cancel the timeout timer on arrival of provisional 
    271  *                  responses (which is yes according to RFC 3261). 
    272  *                  The valid values are: 
    273  *                  - PJSIP_TSX_IGNORE_100, to make the UAC transaction 
    274  *                    NOT to cancel the timeout timer when 100 response 
    275  *                    is received. 
    276  *                  - PJSIP_TSX_IGNORE_1xx, to make the UAC transaction 
    277  *                    NOT to cancel the timeout timer when any 1xx  
    278  *                    responses are received. 
    279  * 
    280  *                  Note that regardless of the values in the \a flag  
    281  *                  argument, the provisional response would still be 
    282  *                  delivered to transaction user and it will still 
    283  *                  affect the transaction state. The \a flag flag only 
    284  *                  changes the behavior of the timeout timer of the 
    285  *                  transaction. 
    286  */ 
    287 PJ_DECL(pj_status_t) pjsip_tsx_set_uac_timeout(pjsip_transaction *tsx, 
    288                                                unsigned msec_time, 
    289                                                pjsip_tsx_timeout_policy flag); 
    290  
    291  
    292233/** 
    293234 * Call this function to manually feed a message to the transaction. 
  • pjproject/branches/split-3rd-party/pjsip/include/pjsua-lib/pjsua.h

    r1177 r1210  
    914914 
    915915    /** 
    916      * Specify STUN server to be used. 
     916     * Specify STUN server to be used, in "HOST[:PORT]" format. If port is 
     917     * not specified, default port 3478 will be used. 
    917918     */ 
    918919    pj_str_t        stun_host; 
  • pjproject/branches/split-3rd-party/pjsip/src/pjsip/sip_transaction.c

    r1079 r1210  
    133133static const pj_time_val t1_timer_val = { PJSIP_T1_TIMEOUT/1000,  
    134134                                          PJSIP_T1_TIMEOUT%1000 }; 
     135static const pj_time_val t2_timer_val = { PJSIP_T2_TIMEOUT/1000,  
     136                                          PJSIP_T2_TIMEOUT%1000 }; 
    135137static const pj_time_val t4_timer_val = { PJSIP_T4_TIMEOUT/1000,  
    136138                                          PJSIP_T4_TIMEOUT%1000 }; 
     
    13971399 
    13981400/* 
    1399  * Set the UAC absolute transaction timeout. 
    1400  */ 
    1401 PJ_DEF(pj_status_t) pjsip_tsx_set_uac_timeout(pjsip_transaction *tsx, 
    1402                                               unsigned msec_time, 
    1403                                               pjsip_tsx_timeout_policy policy) 
    1404 { 
    1405     PJ_ASSERT_RETURN(tsx && tsx->role==PJSIP_ROLE_UAC && 
    1406                      tsx->state==PJSIP_TSX_STATE_NULL, PJ_EINVALIDOP); 
    1407  
    1408     tsx->msec_timeout = msec_time; 
    1409     tsx->timeout_policy = policy; 
    1410  
    1411     return PJ_SUCCESS; 
    1412 } 
    1413  
    1414  
    1415 /* 
    14161401 * Set transaction status code and reason. 
    14171402 */ 
     
    18101795    pj_assert((tsx->transport_flag & TSX_HAS_PENDING_TRANSPORT) == 0); 
    18111796 
    1812     msec_time = (1 << (tsx->retransmit_count)) * PJSIP_T1_TIMEOUT; 
     1797    if (tsx->role==PJSIP_ROLE_UAC && tsx->status_code >= 100) 
     1798        msec_time = PJSIP_T2_TIMEOUT; 
     1799    else 
     1800        msec_time = (1 << (tsx->retransmit_count)) * PJSIP_T1_TIMEOUT; 
    18131801 
    18141802    if (tsx->role == PJSIP_ROLE_UAC) { 
     1803        pj_assert(tsx->status_code < 200); 
    18151804        /* Retransmission for non-INVITE transaction caps-off at T2 */ 
    18161805        if (msec_time>PJSIP_T2_TIMEOUT && tsx->method.id!=PJSIP_INVITE_METHOD) 
     
    19141903 
    19151904        /* Start Timer B (or called timer F for non-INVITE) for transaction  
    1916          * timeout. If user has configured the timeout value with  
    1917          * pjsip_tsx_set_uac_timeout(), use the timeout value there. 
     1905         * timeout. 
    19181906         */ 
    1919         if (tsx->msec_timeout > 0) { 
    1920             pj_time_val timeout; 
    1921  
    1922             timeout.sec = tsx->msec_timeout / 1000; 
    1923             timeout.msec = tsx->msec_timeout % 1000; 
    1924  
    1925             pjsip_endpt_schedule_timer( tsx->endpt, &tsx->timeout_timer,  
    1926                                         &timeout); 
    1927  
    1928         } else { 
    1929             pjsip_endpt_schedule_timer( tsx->endpt, &tsx->timeout_timer,  
    1930                                         &timeout_timer_val); 
    1931         } 
     1907        pjsip_endpt_schedule_timer( tsx->endpt, &tsx->timeout_timer,  
     1908                                    &timeout_timer_val); 
    19321909 
    19331910        /* Start Timer A (or timer E) for retransmission only if unreliable  
     
    20061983            return PJSIP_ENOTRESPONSEMSG; 
    20071984 
    2008         /* Cancel retransmission timer A. */ 
    2009         if (tsx->retransmit_timer._timer_id != -1) { 
    2010             pjsip_endpt_cancel_timer(tsx->endpt, &tsx->retransmit_timer); 
    2011             tsx->retransmit_timer._timer_id = -1; 
    2012         } 
     1985        code = msg->line.status.code; 
     1986 
     1987        /* If the response is final, cancel both retransmission and timeout 
     1988         * timer. 
     1989         */ 
     1990        if (code >= 200) { 
     1991            if (tsx->retransmit_timer._timer_id != -1) { 
     1992                pjsip_endpt_cancel_timer(tsx->endpt, &tsx->retransmit_timer); 
     1993                tsx->retransmit_timer._timer_id = -1; 
     1994            } 
     1995 
     1996            if (tsx->timeout_timer._timer_id != -1) { 
     1997                pjsip_endpt_cancel_timer(tsx->endpt, &tsx->timeout_timer); 
     1998                tsx->timeout_timer._timer_id = -1; 
     1999            } 
     2000 
     2001        } else { 
     2002            /* Cancel retransmit timer (for non-INVITE transaction, the 
     2003             * retransmit timer will be rescheduled at T2. 
     2004             */ 
     2005            if (tsx->retransmit_timer._timer_id != -1) { 
     2006                pjsip_endpt_cancel_timer(tsx->endpt, &tsx->retransmit_timer); 
     2007                tsx->retransmit_timer._timer_id = -1; 
     2008            } 
     2009 
     2010            /* For provisional response, only cancel retransmit when this 
     2011             * is an INVITE transaction. For non-INVITE, section 17.1.2.1 
     2012             * of RFC 3261 says that: 
     2013             *  - retransmit timer is set to T2 
     2014             *  - timeout timer F is not deleted. 
     2015             */ 
     2016            if (tsx->method.id == PJSIP_INVITE_METHOD) { 
     2017 
     2018                /* Cancel timeout timer */ 
     2019                pjsip_endpt_cancel_timer(tsx->endpt, &tsx->timeout_timer); 
     2020 
     2021            } else { 
     2022                if (!tsx->is_reliable) { 
     2023                    pjsip_endpt_schedule_timer(tsx->endpt,  
     2024                                               &tsx->retransmit_timer, 
     2025                                               &t2_timer_val); 
     2026                } 
     2027            } 
     2028        } 
     2029          
    20132030        tsx->transport_flag &= ~(TSX_HAS_PENDING_RESCHED); 
    20142031 
    2015  
    2016         /* Cancel timer B (transaction timeout) but look at the timeout policy 
    2017          * as set by pjsip_tsx_set_uac_timeout(). 
    2018          */ 
    2019         code = msg->line.status.code; 
    2020         if ((code==100 && tsx->timeout_policy==PJSIP_TSX_IGNORE_100) || 
    2021             (code<200 && tsx->timeout_policy==PJSIP_TSX_IGNORE_1xx)) 
    2022         { 
    2023             /* Don't cancel the timeout timer */ 
    2024         } 
    2025         else { 
    2026             pjsip_endpt_cancel_timer(tsx->endpt, &tsx->timeout_timer); 
    2027         } 
    20282032 
    20292033        /* Discard retransmission message if it is not INVITE. 
     
    23682372 
    23692373    } else { 
    2370         tsx_set_status_code(tsx, PJSIP_SC_TSX_TIMEOUT, NULL); 
     2374        if (event->body.timer.entry == &tsx->retransmit_timer) { 
     2375            /* Retransmit message. */ 
     2376            pj_status_t status; 
     2377 
     2378            status = tsx_retransmit( tsx, 1 ); 
     2379             
     2380            return status; 
     2381 
     2382        } else { 
     2383            tsx_set_status_code(tsx, PJSIP_SC_TSX_TIMEOUT, NULL); 
     2384        } 
    23712385    } 
    23722386 
     
    24072421                                        &timeout); 
    24082422 
     2423            /* Cancel retransmission timer */ 
     2424            if (tsx->retransmit_timer._timer_id != -1) { 
     2425                pjsip_endpt_cancel_timer(tsx->endpt, &tsx->retransmit_timer); 
     2426                tsx->retransmit_timer._timer_id = -1; 
     2427            } 
     2428 
    24092429            /* Move state to Completed, inform TU. */ 
    24102430            tsx_set_state( tsx, PJSIP_TSX_STATE_COMPLETED,  
  • pjproject/branches/split-3rd-party/pjsip/src/pjsip/sip_util_statefull.c

    r974 r1210  
    9595    PJ_ASSERT_RETURN(mod_stateful_util.id != -1, PJ_EINVALIDOP); 
    9696 
     97    PJ_UNUSED_ARG(timeout); 
    9798 
    9899    status = pjsip_tsx_create_uac(&mod_stateful_util, tdata, &tsx); 
     
    105106    tsx_data->token = token; 
    106107    tsx_data->cb = cb; 
    107  
    108     if (timeout >= 0) { 
    109         status = pjsip_tsx_set_uac_timeout(tsx, timeout, PJSIP_TSX_IGNORE_1xx); 
    110         pj_assert(status == PJ_SUCCESS); 
    111     } 
    112108 
    113109    tsx->mod_data[mod_stateful_util.id] = tsx_data; 
  • pjproject/branches/split-3rd-party/pjsip/src/pjsua-lib/pjsua_core.c

    r1179 r1210  
    679679         */ 
    680680        if (pjsua_var.ua_cfg.stun_host.slen) { 
     681            pj_str_t str_host, str_port; 
     682            int port; 
    681683            pj_hostent he; 
    682684 
    683             pjsua_var.stun_status = pj_gethostbyname(&pjsua_var.ua_cfg.stun_host, &he); 
     685            str_port.ptr = pj_strchr(&pjsua_var.ua_cfg.stun_host, ':'); 
     686            if (str_port.ptr != NULL) { 
     687                str_host.ptr = pjsua_var.ua_cfg.stun_host.ptr; 
     688                str_host.slen = (str_port.ptr - str_host.ptr); 
     689                str_port.ptr++; 
     690                str_port.slen = pjsua_var.ua_cfg.stun_host.slen -  
     691                                str_host.slen - 1; 
     692                port = (int)pj_strtoul(&str_port); 
     693                if (port < 1 || port > 65535) { 
     694                    pjsua_perror(THIS_FILE, "Invalid STUN server", PJ_EINVAL); 
     695                    pjsua_var.stun_status = PJ_EINVAL; 
     696                    return; 
     697                } 
     698            } else { 
     699                str_host = pjsua_var.ua_cfg.stun_host; 
     700                port = 3478; 
     701            } 
     702 
     703            pjsua_var.stun_status = pj_gethostbyname(&str_host, &he); 
    684704 
    685705            if (pjsua_var.stun_status == PJ_SUCCESS) { 
    686706                pj_sockaddr_in_init(&pjsua_var.stun_srv.ipv4, NULL, 0); 
    687707                pjsua_var.stun_srv.ipv4.sin_addr = *(pj_in_addr*)he.h_addr; 
    688                 pjsua_var.stun_srv.ipv4.sin_port = pj_htons((pj_uint16_t)3478); 
     708                pjsua_var.stun_srv.ipv4.sin_port = pj_htons((pj_uint16_t)port); 
    689709 
    690710                PJ_LOG(3,(THIS_FILE,  
     
    773793         */ 
    774794        else if (pjsua_var.ua_cfg.stun_host.slen) { 
     795            pj_str_t str_host, str_port; 
     796            int port; 
    775797            pj_hostent he; 
    776798 
    777             pjsua_var.stun_status = pj_gethostbyname(&pjsua_var.ua_cfg.stun_host, &he); 
     799            str_port.ptr = pj_strchr(&pjsua_var.ua_cfg.stun_host, ':'); 
     800            if (str_port.ptr != NULL) { 
     801                str_host.ptr = pjsua_var.ua_cfg.stun_host.ptr; 
     802                str_host.slen = (str_port.ptr - str_host.ptr); 
     803                str_port.ptr++; 
     804                str_port.slen = pjsua_var.ua_cfg.stun_host.slen -  
     805                                str_host.slen - 1; 
     806                port = (int)pj_strtoul(&str_port); 
     807                if (port < 1 || port > 65535) { 
     808                    pjsua_perror(THIS_FILE, "Invalid STUN server", PJ_EINVAL); 
     809                    pjsua_var.stun_status = PJ_EINVAL; 
     810                    return pjsua_var.stun_status; 
     811                } 
     812            } else { 
     813                str_host = pjsua_var.ua_cfg.stun_host; 
     814                port = 3478; 
     815            } 
     816 
     817 
     818            pjsua_var.stun_status = pj_gethostbyname(&str_host, &he); 
    778819 
    779820            if (pjsua_var.stun_status == PJ_SUCCESS) { 
    780821                pj_sockaddr_in_init(&pjsua_var.stun_srv.ipv4, NULL, 0); 
    781822                pjsua_var.stun_srv.ipv4.sin_addr = *(pj_in_addr*)he.h_addr; 
    782                 pjsua_var.stun_srv.ipv4.sin_port = pj_htons((pj_uint16_t)3478); 
     823                pjsua_var.stun_srv.ipv4.sin_port = pj_htons((pj_uint16_t)port); 
    783824 
    784825                PJ_LOG(3,(THIS_FILE,  
     
    10561097         */ 
    10571098        status = pjstun_get_mapped_addr(&pjsua_var.cp.factory, 1, &sock, 
    1058                                          &stun_srv, 3478, 
    1059                                          &stun_srv, 3478, 
     1099                                         &stun_srv, pj_ntohs(pjsua_var.stun_srv.ipv4.sin_port), 
     1100                                         &stun_srv, pj_ntohs(pjsua_var.stun_srv.ipv4.sin_port), 
    10601101                                         p_pub_addr); 
    10611102        if (status != PJ_SUCCESS) { 
  • pjproject/branches/split-3rd-party/pjsip/src/pjsua-lib/pjsua_media.c

    r1177 r1210  
    290290 
    291291            status=pjstun_get_mapped_addr(&pjsua_var.cp.factory, 2, sock, 
    292                                            &stun_srv, 3478, 
    293                                            &stun_srv, 3478, 
     292                                           &stun_srv, pj_ntohs(pjsua_var.stun_srv.ipv4.sin_port), 
     293                                           &stun_srv, pj_ntohs(pjsua_var.stun_srv.ipv4.sin_port), 
    294294                                           mapped_addr); 
    295295            if (status != PJ_SUCCESS) { 
Note: See TracChangeset for help on using the changeset viewer.