Changeset 119


Ignore:
Timestamp:
Jan 10, 2006 1:31:40 PM (18 years ago)
Author:
bennylp
Message:

Renamed pjsip_url to pjsip_sip_uri

Location:
pjproject/trunk/pjsip
Files:
1 deleted
16 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjsip/build/pjsip_core.dsp

    r109 r119  
    125125 
    126126SOURCE=..\src\pjsip\sip_transaction.c 
    127  
    128 !IF  "$(CFG)" == "pjsip_core - Win32 Release" 
    129  
    130 !ELSEIF  "$(CFG)" == "pjsip_core - Win32 Debug" 
    131  
    132 !ENDIF  
    133  
    134127# End Source File 
    135128# Begin Source File 
     
    258251 
    259252# PROP Default_Filter "" 
    260 # Begin Source File 
    261  
    262 SOURCE=..\include\pjsip\sip_msg_i.h 
    263 # End Source File 
    264253# End Group 
    265254# Begin Source File 
  • pjproject/trunk/pjsip/include/pjsip/sip_msg.h

    r109 r119  
    717717 *      other list (or message). Otherwise Real Bad Thing will happen. 
    718718 */ 
    719 PJ_IDECL(void) pjsip_msg_add_hdr( pjsip_msg *msg, pjsip_hdr *hdr ); 
     719PJ_INLINE(void) pjsip_msg_add_hdr( pjsip_msg *msg, pjsip_hdr *hdr ) 
     720{ 
     721    pj_list_insert_before(&msg->hdr, hdr); 
     722} 
    720723 
    721724/**  
     
    728731 *      other list (or message). Otherwise Real Bad Thing will happen. 
    729732 */ 
    730 PJ_IDECL(void) pjsip_msg_insert_first_hdr( pjsip_msg *msg, pjsip_hdr *hdr ); 
     733PJ_INLINE(void) pjsip_msg_insert_first_hdr( pjsip_msg *msg, pjsip_hdr *hdr ) 
     734{ 
     735    pj_list_insert_after(&msg->hdr, hdr); 
     736} 
    731737 
    732738/**  
     
    15521558 */ 
    15531559 
    1554 /* 
    1555  * Include inline definitions. 
    1556  */ 
    1557 #if PJ_FUNCTIONS_ARE_INLINED 
    1558 #  include <pjsip/sip_msg_i.h> 
    1559 #endif 
    1560  
    15611560 
    15621561PJ_END_DECL 
  • pjproject/trunk/pjsip/include/pjsip/sip_uri.h

    r82 r119  
    106106 * @param pname_unres   Specification of allowed characters in pname. 
    107107 * @param pvalue_unres  Specification of allowed characters in pvalue. 
    108  * @param sep           Separator character (either ';' or ','). 
     108 * @param sep           Separator character (either ';', ',', or '?'). 
     109 *                      When separator is set to '?', this function will 
     110 *                      automatically adjust the separator character to 
     111 *                      '&' after the first parameter is printed. 
    109112 * 
    110113 * @return              The number of bytes printed, or -1 on errr. 
     
    222225 * SIP and SIPS URL scheme. 
    223226 */ 
    224 typedef struct pjsip_url 
     227typedef struct pjsip_sip_uri 
    225228{ 
    226229    pjsip_uri_vptr *vptr;               /**< Pointer to virtual function table.*/ 
     
    237240    pjsip_param     other_param;        /**< Other parameters grouped together. */ 
    238241    pjsip_param     header_param;       /**< Optional header parameter. */ 
    239 } pjsip_url; 
     242} pjsip_sip_uri; 
    240243 
    241244 
     
    330333 * @return SIP URL. 
    331334 */ 
    332 PJ_DECL(pjsip_url*) pjsip_url_create( pj_pool_t *pool, int secure ); 
     335PJ_DECL(pjsip_sip_uri*) pjsip_url_create( pj_pool_t *pool, int secure ); 
    333336 
    334337/** 
     
    337340 * @return          SIPS URL. 
    338341 */ 
    339 PJ_DECL(pjsip_url*) pjsips_url_create( pj_pool_t *pool ); 
     342PJ_DECL(pjsip_sip_uri*) pjsips_url_create( pj_pool_t *pool ); 
    340343 
    341344/** 
     
    343346 * @param url       The URL. 
    344347 */ 
    345 PJ_DECL(void)  pjsip_url_init(pjsip_url *url, int secure); 
     348PJ_DECL(void)  pjsip_url_init(pjsip_sip_uri *url, int secure); 
    346349 
    347350/** 
     
    351354 * @param rhs       The source URL. 
    352355 */ 
    353 PJ_DECL(void)  pjsip_url_assign(pj_pool_t *pool, pjsip_url *url, const pjsip_url *rhs); 
     356PJ_DECL(void)  pjsip_url_assign(pj_pool_t *pool, pjsip_sip_uri *url,  
     357                                const pjsip_sip_uri *rhs); 
    354358 
    355359/** 
  • pjproject/trunk/pjsip/src/pjsip-ua/sip_dialog.c

    r74 r119  
    413413    pjsip_contact_hdr *contact; 
    414414    pjsip_name_addr *name_addr; 
    415     pjsip_url *url; 
     415    pjsip_sip_uri *url; 
    416416    unsigned flag; 
    417417    pjsip_event event; 
     
    446446    name_addr = (pjsip_name_addr *)dlg->local.info->uri; 
    447447    dlg->local.contact->uri = (pjsip_uri*) name_addr; 
    448     url = (pjsip_url*) name_addr->uri; 
     448    url = (pjsip_sip_uri*) name_addr->uri; 
    449449    //url->port = rdata->via->sent_by.port; 
    450450    //url->port = pj_sockaddr_get_port( pjsip_transport_get_local_addr(rdata->transport) ); 
  • pjproject/trunk/pjsip/src/pjsip/sip_msg.c

    r109 r119  
    2424#include <pj/pool.h> 
    2525#include <pj/assert.h> 
    26  
    27 /* 
    28  * Include inline definitions here if functions are NOT inlined. 
    29  */ 
    30 #if PJ_FUNCTIONS_ARE_INLINED==0 
    31 #  include <pjsip/sip_msg_i.h> 
    32 #endif 
    3326 
    3427const pjsip_method  
  • pjproject/trunk/pjsip/src/pjsip/sip_parser.c

    r106 r119  
    155155                                                pj_pool_t *pool,  
    156156                                                unsigned option); 
    157 static pjsip_url * int_parse_sip_url( pj_scanner *scanner,  
    158                                        pj_pool_t *pool, 
    159                                        pj_bool_t parse_params); 
     157static pjsip_sip_uri* int_parse_sip_url( pj_scanner *scanner,  
     158                                         pj_pool_t *pool, 
     159                                         pj_bool_t parse_params); 
    160160static pjsip_name_addr * 
    161161                    int_parse_name_addr( pj_scanner *scanner,  
     
    954954    *pname = pj_str_unescape(pool, pname); 
    955955 
     956    /* init pvalue */ 
     957    pvalue->ptr = NULL; 
     958    pvalue->slen = 0; 
     959 
    956960    /* pvalue, if any */ 
    957961    if (*scanner->curptr == '=') { 
    958962        pj_scan_get_char(scanner); 
    959         /* pvalue can be a quoted string. */ 
    960         if (*scanner->curptr == '"') { 
    961             pj_scan_get_quote( scanner, '"', '"', pvalue); 
    962             if (option & PJSIP_PARSE_REMOVE_QUOTE) { 
    963                 pvalue->ptr++; 
    964                 pvalue->slen -= 2; 
     963        if (!pj_scan_is_eof(scanner)) { 
     964            /* pvalue can be a quoted string. */ 
     965            if (*scanner->curptr == '"') { 
     966                pj_scan_get_quote( scanner, '"', '"', pvalue); 
     967                if (option & PJSIP_PARSE_REMOVE_QUOTE) { 
     968                    pvalue->ptr++; 
     969                    pvalue->slen -= 2; 
     970                } 
     971            } else if(pj_cis_match(&pjsip_PARAM_CHAR_SPEC, *scanner->curptr)) { 
     972                pj_scan_get(scanner, &pjsip_PARAM_CHAR_SPEC, pvalue); 
     973                *pvalue = pj_str_unescape(pool, pvalue); 
    965974            } 
    966         } else { 
    967             pj_scan_get(scanner, &pjsip_PARAM_CHAR_SPEC, pvalue); 
    968             *pvalue = pj_str_unescape(pool, pvalue); 
    969         } 
    970     } else { 
    971         pvalue->ptr = NULL; 
    972         pvalue->slen = 0; 
     975        } 
    973976    } 
    974977} 
     
    9971000    *hname = pj_str_unescape(pool, hname); 
    9981001 
     1002    /* Init hvalue */ 
     1003    hvalue->ptr = NULL; 
     1004    hvalue->slen = 0; 
     1005 
    9991006    /* pvalue, if any */ 
    10001007    if (*scanner->curptr == '=') { 
    10011008        pj_scan_get_char(scanner); 
    1002         pj_scan_get(scanner, &pjsip_HDR_CHAR_SPEC, hvalue); 
    1003         *hvalue = pj_str_unescape(pool, hvalue); 
    1004     } else { 
    1005         hvalue->ptr = NULL; 
    1006         hvalue->slen = 0; 
     1009        if (!pj_scan_is_eof(scanner) &&  
     1010            pj_cis_match(&pjsip_HDR_CHAR_SPEC, *scanner->curptr)) 
     1011        { 
     1012            pj_scan_get(scanner, &pjsip_HDR_CHAR_SPEC, hvalue); 
     1013            *hvalue = pj_str_unescape(pool, hvalue); 
     1014        } 
    10071015    } 
    10081016} 
     
    11431151 
    11441152/* Parse "sip:" and "sips:" URI. */ 
    1145 static pjsip_url *int_parse_sip_url( pj_scanner *scanner,  
    1146                                     pj_pool_t *pool, 
    1147                                     pj_bool_t parse_params) 
     1153static pjsip_sip_uri *int_parse_sip_url( pj_scanner *scanner,  
     1154                                        pj_pool_t *pool, 
     1155                                        pj_bool_t parse_params) 
    11481156{ 
    11491157    pj_str_t scheme; 
    1150     pjsip_url *url = NULL; 
     1158    pjsip_sip_uri *url = NULL; 
    11511159    int colon; 
    11521160    int skip_ws = scanner->skip_ws; 
  • pjproject/trunk/pjsip/src/pjsip/sip_transaction.c

    r115 r119  
    500500 * Register the transaction to the hash table. 
    501501 */ 
    502 static void mod_tsx_layer_register_tsx( pjsip_transaction *tsx) 
     502static pj_status_t mod_tsx_layer_register_tsx( pjsip_transaction *tsx) 
    503503{ 
    504504    pj_assert(tsx->transaction_key.slen != 0); 
    505     //pj_assert(tsx->state != PJSIP_TSX_STATE_NULL); 
    506505 
    507506    /* Lock hash table mutex. */ 
    508507    pj_mutex_lock(mod_tsx_layer.mutex); 
     508 
     509    /* Check if no transaction with the same key exists. */ 
     510    if (pj_hash_get( mod_tsx_layer.htable, &tsx->transaction_key.ptr, 
     511                     tsx->transaction_key.slen) != NULL) 
     512    { 
     513        pj_mutex_unlock(mod_tsx_layer.mutex); 
     514        return PJ_EEXISTS; 
     515    } 
    509516 
    510517    /* Register the transaction to the hash table. */ 
     
    514521    /* Unlock mutex. */ 
    515522    pj_mutex_unlock(mod_tsx_layer.mutex); 
     523 
     524    return PJ_SUCCESS; 
    516525} 
    517526 
     
    10511060 
    10521061    /* Register transaction to hash table. */ 
    1053     mod_tsx_layer_register_tsx(tsx); 
     1062    status = mod_tsx_layer_register_tsx(tsx); 
     1063    if (status != PJ_SUCCESS) { 
     1064        pj_assert(!"Bug in branch_param generator (i.e. not unique)"); 
     1065        tsx_destroy(tsx); 
     1066        return status; 
     1067    } 
    10541068 
    10551069 
     
    11601174 
    11611175    /* Register the transaction. */ 
    1162     mod_tsx_layer_register_tsx(tsx); 
    1163  
     1176    status = mod_tsx_layer_register_tsx(tsx); 
     1177    if (status != PJ_SUCCESS) { 
     1178        tsx_destroy(tsx); 
     1179        return status; 
     1180    } 
    11641181 
    11651182    /* Unlock transaction and return. */ 
     
    15411558    msec_time = (1 << (tsx->retransmit_count)) * PJSIP_T1_TIMEOUT; 
    15421559 
    1543     if (msec_time>PJSIP_T2_TIMEOUT && tsx->method.id!=PJSIP_INVITE_METHOD) 
    1544         msec_time = PJSIP_T2_TIMEOUT; 
     1560    if (tsx->role == PJSIP_ROLE_UAC) { 
     1561        /* Retransmission for non-INVITE transaction caps-off at T2 */ 
     1562        if (msec_time>PJSIP_T2_TIMEOUT && tsx->method.id!=PJSIP_INVITE_METHOD) 
     1563            msec_time = PJSIP_T2_TIMEOUT; 
     1564    } else { 
     1565        /* Retransmission of INVITE final response also caps-off at T2 */ 
     1566        pj_assert(tsx->status_code >= 200); 
     1567        if (msec_time>PJSIP_T2_TIMEOUT) 
     1568            msec_time = PJSIP_T2_TIMEOUT; 
     1569    } 
    15451570 
    15461571    timeout.sec = msec_time / 1000; 
  • pjproject/trunk/pjsip/src/pjsip/sip_transport.c

    r109 r119  
    348348{ 
    349349 
    350     PJ_ASSERT_RETURN(tdata && tdata->msg, "INVALID MSG"); 
     350    if (tdata==NULL || tdata->msg==NULL) 
     351        return "INVALID MSG"; 
    351352 
    352353    if (tdata->info) 
  • pjproject/trunk/pjsip/src/pjsip/sip_uri.c

    r82 r119  
    112112        } 
    113113        p = p->next; 
     114        if (sep == '?') sep = '&'; 
    114115    } while (p != param_list); 
    115116 
     
    123124#define IS_SIPS(url)    ((url)->vptr==&sips_url_vptr) 
    124125 
    125 static const pj_str_t *pjsip_url_get_scheme( const pjsip_url* ); 
    126 static const pj_str_t *pjsips_url_get_scheme( const pjsip_url* ); 
     126static const pj_str_t *pjsip_url_get_scheme( const pjsip_sip_uri* ); 
     127static const pj_str_t *pjsips_url_get_scheme( const pjsip_sip_uri* ); 
    127128static const pj_str_t *pjsip_name_addr_get_scheme( const pjsip_name_addr * ); 
    128129static void *pjsip_get_uri( pjsip_uri *uri ); 
     
    147148                                     const pjsip_name_addr *naddr2); 
    148149static int pjsip_url_print(  pjsip_uri_context_e context, 
    149                              const pjsip_url *url,  
     150                             const pjsip_sip_uri *url,  
    150151                             char *buf, pj_size_t size); 
    151152static int pjsip_url_compare( pjsip_uri_context_e context, 
    152                               const pjsip_url *url1, const pjsip_url *url2); 
    153 static pjsip_url* pjsip_url_clone(pj_pool_t *pool, const pjsip_url *rhs); 
     153                              const pjsip_sip_uri *url1,  
     154                              const pjsip_sip_uri *url2); 
     155static pjsip_sip_uri* pjsip_url_clone(pj_pool_t *pool,  
     156                                      const pjsip_sip_uri *rhs); 
    154157 
    155158static pjsip_uri_vptr sip_url_vptr =  
     
    180183}; 
    181184 
    182 static const pj_str_t *pjsip_url_get_scheme(const pjsip_url *url) 
     185static const pj_str_t *pjsip_url_get_scheme(const pjsip_sip_uri *url) 
    183186{ 
    184187    PJ_UNUSED_ARG(url); 
     
    186189} 
    187190 
    188 static const pj_str_t *pjsips_url_get_scheme(const pjsip_url *url) 
     191static const pj_str_t *pjsips_url_get_scheme(const pjsip_sip_uri *url) 
    189192{ 
    190193    PJ_UNUSED_ARG(url); 
     
    202205} 
    203206 
    204 PJ_DEF(void) pjsip_url_init(pjsip_url *url, int secure) 
     207PJ_DEF(void) pjsip_url_init(pjsip_sip_uri *url, int secure) 
    205208{ 
    206209    pj_memset(url, 0, sizeof(*url)); 
     
    211214} 
    212215 
    213 PJ_DEF(pjsip_url*) pjsip_url_create( pj_pool_t *pool, int secure ) 
    214 { 
    215     pjsip_url *url = pj_pool_alloc(pool, sizeof(pjsip_url)); 
     216PJ_DEF(pjsip_sip_uri*) pjsip_url_create( pj_pool_t *pool, int secure ) 
     217{ 
     218    pjsip_sip_uri *url = pj_pool_alloc(pool, sizeof(pjsip_sip_uri)); 
    216219    pjsip_url_init(url, secure); 
    217220    return url; 
     
    219222 
    220223static int pjsip_url_print(  pjsip_uri_context_e context, 
    221                              const pjsip_url *url,  
     224                             const pjsip_sip_uri *url,  
    222225                             char *buf, pj_size_t size) 
    223226{ 
     
    226229    char *endbuf = buf+size; 
    227230    const pj_str_t *scheme; 
    228     pjsip_param *param; 
    229     char hparam_char = '?'; 
    230231 
    231232    *buf = '\0'; 
     
    318319    buf += printed; 
    319320 
    320     /* Header param. */ 
    321     param = url->header_param.next; 
    322     while (param != &url->header_param) { 
    323         if (endbuf - buf < param->name.slen+2) 
     321    /* Header param.  
     322     * Header param is only allowed in these contexts: 
     323     *  - PJSIP_URI_IN_CONTACT_HDR 
     324     *  - PJSIP_URI_IN_OTHER 
     325     */ 
     326    if (context == PJSIP_URI_IN_CONTACT_HDR || context == PJSIP_URI_IN_OTHER) { 
     327        printed = pjsip_param_print_on(&url->header_param, buf, endbuf-buf, 
     328                                       &pjsip_HDR_CHAR_SPEC,  
     329                                       &pjsip_HDR_CHAR_SPEC, '?'); 
     330        if (printed < 0) 
    324331            return -1; 
    325         *buf++ = hparam_char; 
    326         copy_advance_escape(buf, param->name, pjsip_HDR_CHAR_SPEC); 
    327         if (param->value.slen) { 
    328             *buf++ = '='; 
    329             copy_advance_escape(buf, param->value, pjsip_HDR_CHAR_SPEC); 
    330         } 
    331         param = param->next; 
    332         hparam_char = '&'; 
     332        buf += printed; 
    333333    } 
    334334 
     
    338338 
    339339static pj_status_t pjsip_url_compare( pjsip_uri_context_e context, 
    340                                       const pjsip_url *url1,  
    341                                       const pjsip_url *url2) 
     340                                      const pjsip_sip_uri *url1,  
     341                                      const pjsip_sip_uri *url2) 
    342342{ 
    343343    const pjsip_param *p1; 
     
    466466 
    467467 
    468 PJ_DEF(void) pjsip_url_assign(pj_pool_t *pool, pjsip_url *url,  
    469                               const pjsip_url *rhs) 
     468PJ_DEF(void) pjsip_url_assign(pj_pool_t *pool, pjsip_sip_uri *url,  
     469                              const pjsip_sip_uri *rhs) 
    470470{ 
    471471    pj_strdup( pool, &url->user, &rhs->user); 
     
    483483} 
    484484 
    485 static pjsip_url* pjsip_url_clone(pj_pool_t *pool, const pjsip_url *rhs) 
    486 { 
    487     pjsip_url *url = pj_pool_alloc(pool, sizeof(pjsip_url)); 
     485static pjsip_sip_uri* pjsip_url_clone(pj_pool_t *pool, const pjsip_sip_uri *rhs) 
     486{ 
     487    pjsip_sip_uri *url = pj_pool_alloc(pool, sizeof(pjsip_sip_uri)); 
    488488    if (!url) 
    489489        return NULL; 
  • pjproject/trunk/pjsip/src/pjsip/sip_util.c

    r109 r119  
    113113    pjsip_msg_add_hdr(msg, (void*)param_cseq); 
    114114 
    115     /* Add a blank Via header. */ 
     115    /* Add a blank Via header in the front of the message. */ 
    116116    via = pjsip_via_hdr_create(tdata->pool); 
    117117    via->rport_param = 0; 
    118118    pjsip_msg_insert_first_hdr(msg, (void*)via); 
     119 
     120    /* Add header params as request headers */ 
     121    if (PJSIP_URI_SCHEME_IS_SIP(param_target) ||  
     122        PJSIP_URI_SCHEME_IS_SIPS(param_target))  
     123    { 
     124        pjsip_sip_uri *uri = (pjsip_sip_uri*) pjsip_uri_get_uri(param_target); 
     125        pjsip_param *hparam; 
     126 
     127        hparam = uri->header_param.next; 
     128        while (hparam != &uri->header_param) { 
     129            pjsip_generic_string_hdr *hdr; 
     130 
     131            hdr = pjsip_generic_string_hdr_create_with_text(tdata->pool,  
     132                                                            &hparam->name, 
     133                                                            &hparam->value); 
     134            pjsip_msg_add_hdr(msg, (pjsip_hdr*)hdr); 
     135            hparam = hparam->next; 
     136        } 
     137    } 
    119138 
    120139    /* Create message body. */ 
     
    637656            PJSIP_URI_SCHEME_IS_SIPS(topmost_route_uri)) 
    638657        { 
    639             const pjsip_url *url = pjsip_uri_get_uri((void*)topmost_route_uri); 
     658            const pjsip_sip_uri *url =  
     659                pjsip_uri_get_uri((void*)topmost_route_uri); 
    640660            has_lr_param = url->lr_param; 
    641661        } else { 
     
    674694    if (PJSIP_URI_SCHEME_IS_SIPS(target_uri)) { 
    675695        pjsip_uri *uri = (pjsip_uri*) target_uri; 
    676         const pjsip_url *url = (const pjsip_url*)pjsip_uri_get_uri(uri); 
     696        const pjsip_sip_uri *url=(const pjsip_sip_uri*)pjsip_uri_get_uri(uri); 
    677697        dest_info->flag |= (PJSIP_TRANSPORT_SECURE | PJSIP_TRANSPORT_RELIABLE); 
    678698        pj_strdup(tdata->pool, &dest_info->addr.host, &url->host); 
     
    683703    } else if (PJSIP_URI_SCHEME_IS_SIP(target_uri)) { 
    684704        pjsip_uri *uri = (pjsip_uri*) target_uri; 
    685         const pjsip_url *url = (const pjsip_url*)pjsip_uri_get_uri(uri); 
     705        const pjsip_sip_uri *url=(const pjsip_sip_uri*)pjsip_uri_get_uri(uri); 
    686706        pj_strdup(tdata->pool, &dest_info->addr.host, &url->host); 
    687707        dest_info->addr.port = url->port; 
  • pjproject/trunk/pjsip/src/pjsua/main.c

    r65 r119  
    11091109        if (uri) { 
    11101110            if (pj_stricmp2(pjsip_uri_get_scheme(uri), "sip")==0) { 
    1111                 pjsip_url *url = (pjsip_url*)pjsip_uri_get_uri(uri); 
     1111                pjsip_sip_uri *url = (pjsip_sip_uri*)pjsip_uri_get_uri(uri); 
    11121112                if (url->user.slen) 
    11131113                    strncpy(global.user_id, url->user.ptr, url->user.slen); 
  • pjproject/trunk/pjsip/src/test-pjsip/msg_test.c

    r109 r119  
    333333    pjsip_msg *msg; 
    334334    pjsip_name_addr *name_addr; 
    335     pjsip_url *url; 
     335    pjsip_sip_uri *url; 
    336336    pjsip_fromto_hdr *fromto; 
    337337    pjsip_cid_hdr *cid; 
     
    538538    pjsip_route_hdr *route; 
    539539    pjsip_name_addr *name_addr; 
    540     pjsip_url *url; 
     540    pjsip_sip_uri *url; 
    541541    pjsip_max_forwards_hdr *max_fwd; 
    542542    pjsip_to_hdr *to; 
  • pjproject/trunk/pjsip/src/test-pjsip/tsx_uas_test.c

    r117 r119  
    4646 ** TEST4_BRANCH_ID 
    4747 **     Transaction retransmits last response (if any) without notifying  
    48  **     transaction user upon receiving request  retransmissions on: 
    49  **         a. TRYING state. 
    50  **         a. PROCEEDING state. 
    51  **         b. COMPLETED state. 
     48 **     transaction user upon receiving request  retransmissions on TRYING 
     49 **     state 
    5250 ** 
    5351 ** TEST5_BRANCH_ID 
    54  **     INVITE transaction MUST retransmit final response. (Note: PJSIP also 
    55  **     retransmit 2xx final response until it's terminated by user). 
     52 **     As above, in PROCEEDING state. 
    5653 ** 
    5754 ** TEST6_BRANCH_ID 
     55 **     As above, in COMPLETED state, with first sending provisional response. 
     56 ** 
     57 ** TEST7_BRANCH_ID 
     58 **     INVITE transaction MUST retransmit non-2xx final response. 
     59 ** 
     60 ** TEST8_BRANCH_ID 
     61 **     As above, for INVITE's 2xx final response (this is PJSIP specific). 
     62 ** 
     63 ** TEST9_BRANCH_ID 
    5864 **     INVITE transaction MUST cease retransmission of final response when 
    59  *      ACK is received. (Note: PJSIP also retransmit 2xx final response  
    60  *      until it's terminated by user). 
    61  ** 
    62  ** TEST7_BRANCH_ID 
     65 **     ACK is received. (Note: PJSIP also retransmit 2xx final response  
     66 **     until it's terminated by user). 
     67 **     Transaction also MUST terminate in T4 seconds. 
     68 ** 
     69 ** TEST10_BRANCH_ID 
    6370 **     Test where INVITE UAS transaction never receives ACK 
    6471 ** 
    65  ** TEST8_BRANCH_ID 
     72 ** TEST11_BRANCH_ID 
    6673 **     When UAS failed to deliver the response with the selected transport, 
    6774 **     it should try contacting the client with other transport or begin 
     
    7380 **         c. COMPLETED state. 
    7481 ** 
    75  ** TEST9_BRANCH_ID 
     82 ** TEST12_BRANCH_ID 
    7683 **     Variant of previous test, where transaction fails to deliver the  
    7784 **     response using any kind of transports. Transaction should report 
     
    8794static char *TEST6_BRANCH_ID = PJSIP_RFC3261_BRANCH_ID "-UAS-Test6"; 
    8895static char *TEST7_BRANCH_ID = PJSIP_RFC3261_BRANCH_ID "-UAS-Test7"; 
     96static char *TEST8_BRANCH_ID = PJSIP_RFC3261_BRANCH_ID "-UAS-Test8"; 
     97static char *TEST9_BRANCH_ID = PJSIP_RFC3261_BRANCH_ID "-UAS-Test9"; 
     98static char *TEST10_BRANCH_ID = PJSIP_RFC3261_BRANCH_ID "-UAS-Test10"; 
     99static char *TEST11_BRANCH_ID = PJSIP_RFC3261_BRANCH_ID "-UAS-Test11"; 
     100static char *TEST12_BRANCH_ID = PJSIP_RFC3261_BRANCH_ID "-UAS-Test12"; 
    89101 
    90102#define TEST1_STATUS_CODE       200 
     
    92104#define TEST3_PROVISIONAL_CODE  PJSIP_SC_QUEUED 
    93105#define TEST3_STATUS_CODE       202 
    94  
     106#define TEST4_STATUS_CODE       200 
     107#define TEST4_REQUEST_COUNT     2 
     108#define TEST5_PROVISIONAL_CODE  100 
     109#define TEST5_STATUS_CODE       200      
     110#define TEST5_REQUEST_COUNT     2 
     111#define TEST5_RESPONSE_COUNT    2 
     112#define TEST6_PROVISIONAL_CODE  100 
     113#define TEST6_STATUS_CODE       200     /* Must be final */ 
     114#define TEST6_REQUEST_COUNT     2 
     115#define TEST6_RESPONSE_COUNT    3 
     116#define TEST7_STATUS_CODE       301 
     117#define TEST8_STATUS_CODE       302 
     118 
     119 
     120#define TEST4_TITLE "test4: absorbing request retransmission" 
     121#define TEST5_TITLE "test5: retransmit last response in PROCEEDING state" 
     122#define TEST6_TITLE "test6: retransmit last response in COMPLETED state" 
     123 
     124 
     125#define TEST_TIMEOUT_ERROR      -30 
     126#define MAX_ALLOWED_DIFF        150 
    95127 
    96128static void tsx_user_on_tsx_state(pjsip_transaction *tsx, pjsip_event *e); 
     
    162194}; 
    163195 
     196/* Timer callback to send response. */ 
    164197static void send_response_timer( pj_timer_heap_t *timer_heap, 
    165198                                 struct pj_timer_entry *entry) 
     
    180213        PJ_LOG(3,(THIS_FILE,"    error: timer unable to send response")); 
    181214        pjsip_tx_data_dec_ref(r->tdata); 
     215        return; 
     216    } 
     217} 
     218 
     219/* Utility to send response. */ 
     220static void send_response( pjsip_rx_data *rdata, 
     221                           pjsip_transaction *tsx, 
     222                           int status_code ) 
     223{ 
     224    pj_status_t status; 
     225    pjsip_tx_data *tdata; 
     226 
     227    status = pjsip_endpt_create_response( endpt, rdata, status_code, NULL,  
     228                                          &tdata); 
     229    if (status != PJ_SUCCESS) { 
     230        app_perror("    error: unable to create response", status); 
     231        test_complete = -196; 
     232        return; 
     233    } 
     234 
     235    status = pjsip_tsx_send_msg(tsx, tdata); 
     236    if (status != PJ_SUCCESS) { 
     237        app_perror("    error: unable to send response", status); 
     238        pjsip_tx_data_dec_ref(tdata); 
     239        test_complete = -197; 
    182240        return; 
    183241    } 
     
    222280    } 
    223281} 
     282 
     283 
     284/* Find and terminate tsx with the specified key. */ 
     285static void terminate_our_tsx(int status_code) 
     286{ 
     287    pjsip_transaction *tsx; 
     288 
     289    tsx = pjsip_tsx_layer_find_tsx(&tsx_key, PJ_TRUE); 
     290    if (!tsx) { 
     291        PJ_LOG(3,(THIS_FILE,"    error: timer unable to find transaction")); 
     292        return; 
     293    } 
     294 
     295    pjsip_tsx_terminate(tsx, status_code); 
     296    pj_mutex_unlock(tsx->mutex); 
     297} 
     298 
     299/* Timer callback to terminate transaction. */ 
     300static void terminate_tsx_timer( pj_timer_heap_t *timer_heap, 
     301                                 struct pj_timer_entry *entry) 
     302{ 
     303    terminate_our_tsx(entry->id); 
     304} 
     305 
     306 
     307/* Schedule timer to terminate transaction. */ 
     308static void schedule_terminate_tsx( pjsip_transaction *tsx, 
     309                                    int status_code, 
     310                                    int msec_delay ) 
     311{ 
     312    pj_time_val delay; 
     313 
     314    delay.sec = 0; 
     315    delay.msec = msec_delay; 
     316    pj_time_val_normalize(&delay); 
     317 
     318    pj_assert(pj_strcmp(&tsx->transaction_key, &tsx_key)==0); 
     319    timer.user_data = NULL; 
     320    timer.id = status_code; 
     321    timer.cb = &terminate_tsx_timer; 
     322    pjsip_endpt_schedule_timer(endpt, &timer, &delay); 
     323} 
     324 
    224325 
    225326/* 
     
    332433        } 
    333434 
     435    } else 
     436    if (pj_strcmp2(&tsx->branch, TEST4_BRANCH_ID)==0) { 
     437        /* 
     438         * TEST4_BRANCH_ID tests receiving retransmissions in TRYING state. 
     439         */ 
     440        if (tsx->state == PJSIP_TSX_STATE_TERMINATED) { 
     441 
     442            /* Check that status code is status_code. */ 
     443            if (tsx->status_code != TEST4_STATUS_CODE) { 
     444                PJ_LOG(3,(THIS_FILE, "    error: incorrect status code")); 
     445                test_complete = -120; 
     446            } 
     447             
     448            /* Previous state. */ 
     449            if (e->body.tsx_state.prev_state != PJSIP_TSX_STATE_TRYING) { 
     450                PJ_LOG(3,(THIS_FILE, "    error: incorrect prev_state")); 
     451                test_complete = -121; 
     452            } 
     453 
     454        } else if (tsx->state != PJSIP_TSX_STATE_DESTROYED)  
     455        { 
     456            PJ_LOG(3,(THIS_FILE, "    error: unexpected state")); 
     457            test_complete = -122; 
     458 
     459        } 
     460 
     461 
     462    } else 
     463    if (pj_strcmp2(&tsx->branch, TEST5_BRANCH_ID)==0) { 
     464        /* 
     465         * TEST5_BRANCH_ID tests receiving retransmissions in PROCEEDING state 
     466         */ 
     467        if (tsx->state == PJSIP_TSX_STATE_TERMINATED) { 
     468 
     469            /* Check that status code is status_code. */ 
     470            if (tsx->status_code != TEST5_STATUS_CODE) { 
     471                PJ_LOG(3,(THIS_FILE, "    error: incorrect status code")); 
     472                test_complete = -130; 
     473            } 
     474             
     475            /* Previous state. */ 
     476            if (e->body.tsx_state.prev_state != PJSIP_TSX_STATE_PROCEEDING) { 
     477                PJ_LOG(3,(THIS_FILE, "    error: incorrect prev_state")); 
     478                test_complete = -131; 
     479            } 
     480 
     481        } else if (tsx->state == PJSIP_TSX_STATE_PROCEEDING) { 
     482 
     483            /* Check status code. */ 
     484            if (tsx->status_code != TEST5_PROVISIONAL_CODE) { 
     485                PJ_LOG(3,(THIS_FILE, "    error: incorrect status code")); 
     486                test_complete = -132; 
     487            } 
     488 
     489        } else if (tsx->state != PJSIP_TSX_STATE_DESTROYED) { 
     490            PJ_LOG(3,(THIS_FILE, "    error: unexpected state")); 
     491            test_complete = -133; 
     492 
     493        } 
     494 
     495    } else 
     496    if (pj_strcmp2(&tsx->branch, TEST6_BRANCH_ID)==0) { 
     497        /* 
     498         * TEST6_BRANCH_ID tests receiving retransmissions in COMPLETED state 
     499         */ 
     500        if (tsx->state == PJSIP_TSX_STATE_TERMINATED) { 
     501 
     502            /* Check that status code is status_code. */ 
     503            if (tsx->status_code != TEST6_STATUS_CODE) { 
     504                PJ_LOG(3,(THIS_FILE, "    error: incorrect status code")); 
     505                test_complete = -140; 
     506            } 
     507             
     508            /* Previous state. */ 
     509            if (e->body.tsx_state.prev_state != PJSIP_TSX_STATE_COMPLETED) { 
     510                PJ_LOG(3,(THIS_FILE, "    error: incorrect prev_state")); 
     511                test_complete = -141; 
     512            } 
     513 
     514        } else if (tsx->state != PJSIP_TSX_STATE_PROCEEDING && 
     515                   tsx->state != PJSIP_TSX_STATE_COMPLETED && 
     516                   tsx->state != PJSIP_TSX_STATE_DESTROYED)  
     517        { 
     518            PJ_LOG(3,(THIS_FILE, "    error: unexpected state")); 
     519            test_complete = -142; 
     520 
     521        } 
     522 
     523 
     524    } else 
     525    if (pj_strcmp2(&tsx->branch, TEST7_BRANCH_ID)==0 || 
     526        pj_strcmp2(&tsx->branch, TEST8_BRANCH_ID)==0)  
     527    { 
     528        /* 
     529         * TEST7_BRANCH_ID and TEST8_BRANCH_ID test retransmission of 
     530         * INVITE final response 
     531         */ 
     532        int code; 
     533 
     534        if (pj_strcmp2(&tsx->branch, TEST7_BRANCH_ID) == 0) 
     535            code = TEST7_STATUS_CODE; 
     536        else 
     537            code = TEST8_STATUS_CODE; 
     538 
     539        if (tsx->state == PJSIP_TSX_STATE_TERMINATED) { 
     540 
     541            if (test_complete == 0) 
     542                test_complete = 1; 
     543 
     544            /* Check status code. */ 
     545            if (tsx->status_code != PJSIP_SC_TSX_TIMEOUT) { 
     546                PJ_LOG(3,(THIS_FILE, "    error: incorrect status code")); 
     547                test_complete = -150; 
     548            } 
     549             
     550            /* Previous state. */ 
     551            if (e->body.tsx_state.prev_state != PJSIP_TSX_STATE_COMPLETED) { 
     552                PJ_LOG(3,(THIS_FILE, "    error: incorrect prev_state")); 
     553                test_complete = -151; 
     554            } 
     555 
     556        } else if (tsx->state == PJSIP_TSX_STATE_COMPLETED) { 
     557 
     558            /* Check that status code is status_code. */ 
     559            if (tsx->status_code != code) { 
     560                PJ_LOG(3,(THIS_FILE, "    error: incorrect status code")); 
     561                test_complete = -152; 
     562            } 
     563             
     564            /* Previous state. */ 
     565            if (e->body.tsx_state.prev_state != PJSIP_TSX_STATE_TRYING) { 
     566                PJ_LOG(3,(THIS_FILE, "    error: incorrect prev_state")); 
     567                test_complete = -153; 
     568            } 
     569 
     570        } else if (tsx->state != PJSIP_TSX_STATE_DESTROYED)  { 
     571 
     572            PJ_LOG(3,(THIS_FILE, "    error: unexpected state")); 
     573            test_complete = -154; 
     574 
     575        } 
     576 
    334577    } 
    335578 
     
    344587    pj_strcpy(&tsx_key, &key); 
    345588} 
     589 
     590#define DIFF(a,b)   ((a<b) ? (b-a) : (a-b)) 
    346591 
    347592/* 
     
    372617             */ 
    373618            pjsip_transaction *tsx; 
    374             pjsip_tx_data *tdata; 
    375619 
    376620            status = pjsip_tsx_create_uas(&tsx_user, rdata, &tsx); 
     
    382626 
    383627            save_key(tsx); 
    384  
    385             status = pjsip_endpt_create_response(endpt, rdata,  
    386                                                  status_code, NULL, 
    387                                                  &tdata); 
    388             if (status != PJ_SUCCESS) { 
    389                 app_perror("    error: unable to create response", status); 
    390                 test_complete = -111; 
    391                 return PJ_TRUE; 
    392             } 
    393  
    394             status = pjsip_tsx_send_msg(tsx, tdata); 
    395             if (status != PJ_SUCCESS) { 
    396                 app_perror("    error: unable to send response", status); 
    397                 test_complete = -112; 
    398                 return PJ_TRUE; 
    399             } 
     628            send_response(rdata, tsx, status_code); 
    400629 
    401630        } else { 
     
    428657             */ 
    429658            pjsip_transaction *tsx; 
    430             pjsip_tx_data *tdata; 
    431659 
    432660            status = pjsip_tsx_create_uas(&tsx_user, rdata, &tsx); 
     
    439667            save_key(tsx); 
    440668 
    441             status = pjsip_endpt_create_response(endpt, rdata,  
    442                                                  TEST3_PROVISIONAL_CODE, NULL, 
    443                                                  &tdata); 
    444             if (status != PJ_SUCCESS) { 
    445                 app_perror("    error: unable to create response", status); 
    446                 test_complete = -121; 
    447                 return PJ_TRUE; 
    448             } 
    449  
    450             status = pjsip_tsx_send_msg(tsx, tdata); 
    451             if (status != PJ_SUCCESS) { 
    452                 app_perror("    error: unable to send response", status); 
    453                 test_complete = -122; 
    454                 return PJ_TRUE; 
    455             } 
    456  
     669            send_response(rdata, tsx, TEST3_PROVISIONAL_CODE); 
    457670            schedule_send_response(rdata, &tsx->transaction_key,  
    458671                                   TEST3_STATUS_CODE, 2000); 
     
    483696        return PJ_TRUE; 
    484697 
     698    } else if (pj_strcmp2(&branch_param, TEST4_BRANCH_ID) == 0 || 
     699               pj_strcmp2(&branch_param, TEST5_BRANCH_ID) == 0 || 
     700               pj_strcmp2(&branch_param, TEST6_BRANCH_ID) == 0)  
     701    { 
     702 
     703        /* TEST4_BRANCH_ID: absorbs retransmissions in TRYING state. */ 
     704        /* TEST5_BRANCH_ID: retransmit last response in PROCEEDING state. */ 
     705        /* TEST6_BRANCH_ID: retransmit last response in COMPLETED state. */ 
     706 
     707        if (msg->type == PJSIP_REQUEST_MSG) { 
     708            /* On received response, create UAS. */ 
     709            pjsip_transaction *tsx; 
     710 
     711            status = pjsip_tsx_create_uas(&tsx_user, rdata, &tsx); 
     712            if (status != PJ_SUCCESS) { 
     713                app_perror("    error: unable to create transaction", status); 
     714                test_complete = -130; 
     715                return PJ_TRUE; 
     716            } 
     717 
     718            save_key(tsx); 
     719 
     720            if (pj_strcmp2(&branch_param, TEST4_BRANCH_ID) == 0) { 
     721 
     722            } else if (pj_strcmp2(&branch_param, TEST5_BRANCH_ID) == 0) { 
     723                send_response(rdata, tsx, TEST5_PROVISIONAL_CODE); 
     724 
     725            } else if (pj_strcmp2(&branch_param, TEST6_BRANCH_ID) == 0) { 
     726                send_response(rdata, tsx, TEST6_PROVISIONAL_CODE); 
     727                send_response(rdata, tsx, TEST6_STATUS_CODE); 
     728            } 
     729 
     730        } else { 
     731            /* Verify the response received. */ 
     732             
     733            ++recv_count; 
     734 
     735            if (pj_strcmp2(&branch_param, TEST4_BRANCH_ID) == 0) { 
     736                PJ_LOG(3,(THIS_FILE, "    error: not expecting response!")); 
     737                test_complete = -132; 
     738 
     739            } else if (pj_strcmp2(&branch_param, TEST5_BRANCH_ID) == 0) { 
     740 
     741                if (rdata->msg_info.msg->line.status.code!=TEST5_PROVISIONAL_CODE) { 
     742                    PJ_LOG(3,(THIS_FILE, "    error: incorrect status code!")); 
     743                    test_complete = -133; 
     744 
     745                }  
     746                if (recv_count > TEST5_RESPONSE_COUNT) { 
     747                    PJ_LOG(3,(THIS_FILE, "    error: not expecting response!")); 
     748                    test_complete = -134; 
     749                } 
     750 
     751            } else if (pj_strcmp2(&branch_param, TEST6_BRANCH_ID) == 0) { 
     752 
     753                int code = rdata->msg_info.msg->line.status.code; 
     754 
     755                switch (recv_count) { 
     756                case 1: 
     757                    if (code != TEST6_PROVISIONAL_CODE) { 
     758                        PJ_LOG(3,(THIS_FILE, "    error: invalid code!")); 
     759                        test_complete = -135; 
     760                    } 
     761                    break; 
     762                case 2: 
     763                case 3: 
     764                    if (code != TEST6_STATUS_CODE) { 
     765                        PJ_LOG(3,(THIS_FILE, "    error: invalid code!")); 
     766                        test_complete = -136; 
     767                    } 
     768                    break; 
     769                default: 
     770                    PJ_LOG(3,(THIS_FILE, "    error: not expecting response")); 
     771                    test_complete = -137; 
     772                    break; 
     773                } 
     774            } 
     775        } 
     776        return PJ_TRUE; 
     777 
     778 
     779    } else if (pj_strcmp2(&branch_param, TEST7_BRANCH_ID) == 0 || 
     780               pj_strcmp2(&branch_param, TEST8_BRANCH_ID) == 0)  
     781    { 
     782 
     783        /* 
     784         * TEST7_BRANCH_ID and TEST8_BRANCH_ID test the retransmission 
     785         * of INVITE final response 
     786         */ 
     787        if (msg->type == PJSIP_REQUEST_MSG) { 
     788 
     789            /* On received response, create UAS. */ 
     790            pjsip_transaction *tsx; 
     791 
     792            status = pjsip_tsx_create_uas(&tsx_user, rdata, &tsx); 
     793            if (status != PJ_SUCCESS) { 
     794                app_perror("    error: unable to create transaction", status); 
     795                test_complete = -140; 
     796                return PJ_TRUE; 
     797            } 
     798 
     799            save_key(tsx); 
     800 
     801            if (pj_strcmp2(&branch_param, TEST7_BRANCH_ID) == 0) { 
     802 
     803                send_response(rdata, tsx, TEST7_STATUS_CODE); 
     804 
     805            } else { 
     806 
     807                send_response(rdata, tsx, TEST8_STATUS_CODE); 
     808 
     809            } 
     810 
     811        } else { 
     812            int code; 
     813 
     814            ++recv_count; 
     815 
     816            if (pj_strcmp2(&branch_param, TEST7_BRANCH_ID) == 0) 
     817                code = TEST7_STATUS_CODE; 
     818            else 
     819                code = TEST8_STATUS_CODE; 
     820 
     821            if (recv_count==1) { 
     822                 
     823                if (rdata->msg_info.msg->line.status.code != code) { 
     824                    PJ_LOG(3,(THIS_FILE,"    error: invalid status code")); 
     825                    test_complete = -141; 
     826                } 
     827 
     828                recv_last = rdata->pkt_info.timestamp; 
     829 
     830            } else { 
     831 
     832                pj_time_val now; 
     833                unsigned msec, msec_expected; 
     834 
     835                now = rdata->pkt_info.timestamp; 
     836 
     837                PJ_TIME_VAL_SUB(now, recv_last); 
     838             
     839                msec = now.sec*1000 + now.msec; 
     840                msec_expected = (1 << (recv_count-2)) * PJSIP_T1_TIMEOUT; 
     841                if (msec_expected > PJSIP_T2_TIMEOUT) 
     842                    msec_expected = PJSIP_T2_TIMEOUT; 
     843 
     844                if (DIFF(msec, msec_expected) > MAX_ALLOWED_DIFF) { 
     845                    PJ_LOG(3,(THIS_FILE, 
     846                              "    error: incorrect retransmission " 
     847                              "time (%d ms expected, %d ms received", 
     848                              msec_expected, msec)); 
     849                    test_complete = -142; 
     850                } 
     851 
     852                if (recv_count > 11) { 
     853                    PJ_LOG(3,(THIS_FILE,"    error: too many responses (%d)", 
     854                                        recv_count)); 
     855                    test_complete = -143; 
     856                } 
     857 
     858                recv_last = rdata->pkt_info.timestamp; 
     859            } 
     860 
     861        } 
     862        return PJ_TRUE; 
     863 
     864    } else if (pj_strcmp2(&branch_param, TEST9_BRANCH_ID)) { 
     865 
     866        /* 
     867         * TEST9_BRANCH_ID tests that the retransmission of INVITE final  
     868         * response should cease when ACK is received. Transaction also MUST 
     869         * terminate in T4 seconds. 
     870         */ 
     871        if (msg->type == PJSIP_REQUEST_MSG) { 
     872 
     873            /* On received response, create UAS. */ 
     874            pjsip_transaction *tsx; 
     875 
     876            status = pjsip_tsx_create_uas(&tsx_user, rdata, &tsx); 
     877            if (status != PJ_SUCCESS) { 
     878                app_perror("    error: unable to create transaction", status); 
     879                test_complete = -140; 
     880                return PJ_TRUE; 
     881            } 
     882 
     883            save_key(tsx); 
     884 
     885            if (pj_strcmp2(&branch_param, TEST7_BRANCH_ID) == 0) { 
     886 
     887                send_response(rdata, tsx, TEST7_STATUS_CODE); 
     888 
     889            } else { 
     890 
     891                send_response(rdata, tsx, TEST8_STATUS_CODE); 
     892 
     893            } 
     894 
     895        } else { 
     896            int code; 
     897 
     898            ++recv_count; 
     899 
     900            if (pj_strcmp2(&branch_param, TEST7_BRANCH_ID) == 0) 
     901                code = TEST7_STATUS_CODE; 
     902            else 
     903                code = TEST8_STATUS_CODE; 
     904 
     905            if (recv_count==1) { 
     906                 
     907                if (rdata->msg_info.msg->line.status.code != code) { 
     908                    PJ_LOG(3,(THIS_FILE,"    error: invalid status code")); 
     909                    test_complete = -141; 
     910                } 
     911 
     912                recv_last = rdata->pkt_info.timestamp; 
     913 
     914            } else { 
     915 
     916                pj_time_val now; 
     917                unsigned msec, msec_expected; 
     918 
     919                now = rdata->pkt_info.timestamp; 
     920 
     921                PJ_TIME_VAL_SUB(now, recv_last); 
     922             
     923                msec = now.sec*1000 + now.msec; 
     924                msec_expected = (1 << (recv_count-2)) * PJSIP_T1_TIMEOUT; 
     925                if (msec_expected > PJSIP_T2_TIMEOUT) 
     926                    msec_expected = PJSIP_T2_TIMEOUT; 
     927 
     928                if (DIFF(msec, msec_expected) > MAX_ALLOWED_DIFF) { 
     929                    PJ_LOG(3,(THIS_FILE, 
     930                              "    error: incorrect retransmission " 
     931                              "time (%d ms expected, %d ms received", 
     932                              msec_expected, msec)); 
     933                    test_complete = -142; 
     934                } 
     935 
     936                if (recv_count > 11) { 
     937                    PJ_LOG(3,(THIS_FILE,"    error: too many responses (%d)", 
     938                                        recv_count)); 
     939                    test_complete = -143; 
     940                } 
     941 
     942                recv_last = rdata->pkt_info.timestamp; 
     943            } 
     944 
     945        } 
     946        return PJ_TRUE; 
    485947    } 
    486948 
     
    493955static int perform_test( char *target_uri, char *from_uri,  
    494956                         char *branch_param, int test_time,  
    495                          const pjsip_method *method ) 
     957                         const pjsip_method *method, 
     958                         int request_cnt, int request_interval_msec, 
     959                         int expecting_timeout) 
    496960{ 
    497961    pjsip_tx_data *tdata; 
    498962    pj_str_t target, from; 
    499963    pjsip_via_hdr *via; 
    500     pj_time_val timeout; 
     964    pj_time_val timeout, next_send; 
     965    int sent_cnt; 
    501966    pj_status_t status; 
    502967 
     
    527992    via->branch_param = pj_str(branch_param); 
    528993 
    529     /* Add additional reference to tdata to prevent transaction from 
    530      * deleting it. 
    531      */ 
    532     pjsip_tx_data_add_ref(tdata); 
    533  
    534     /* Send the first message. */ 
    535     status = pjsip_endpt_send_request_stateless(endpt, tdata, NULL, NULL); 
    536     if (status != PJ_SUCCESS) { 
    537         app_perror("   Error: unable to send request", status); 
    538         return -20; 
    539     } 
     994    /* Schedule first send. */ 
     995    sent_cnt = 0; 
     996    pj_gettimeofday(&next_send); 
     997    pj_time_val_normalize(&next_send); 
    540998 
    541999    /* Set test completion time. */ 
     
    5501008 
    5511009        pj_gettimeofday(&now); 
     1010 
     1011        if (sent_cnt < request_cnt && PJ_TIME_VAL_GTE(now, next_send)) { 
     1012            /* Add additional reference to tdata to prevent transaction from 
     1013             * deleting it. 
     1014             */ 
     1015            pjsip_tx_data_add_ref(tdata); 
     1016 
     1017            /* (Re)Send the request. */ 
     1018            status = pjsip_endpt_send_request_stateless(endpt, tdata, 0, 0); 
     1019            if (status != PJ_SUCCESS) { 
     1020                app_perror("   Error: unable to send request", status); 
     1021                pjsip_tx_data_dec_ref(tdata); 
     1022                return -20; 
     1023            } 
     1024 
     1025            /* Schedule next send, if any. */ 
     1026            sent_cnt++; 
     1027            if (sent_cnt < request_cnt) { 
     1028                pj_gettimeofday(&next_send); 
     1029                next_send.msec += request_interval_msec; 
     1030                pj_time_val_normalize(&next_send); 
     1031            } 
     1032        } 
     1033 
    5521034        if (now.sec > timeout.sec) { 
    553             PJ_LOG(3,(THIS_FILE, "   Error: test has timed out")); 
     1035            if (!expecting_timeout) 
     1036                PJ_LOG(3,(THIS_FILE, "   Error: test has timed out")); 
    5541037            pjsip_tx_data_dec_ref(tdata); 
    555             return -30; 
     1038            return TEST_TIMEOUT_ERROR; 
    5561039        } 
    5571040    } 
     
    6131096                          TEST1_BRANCH_ID, 
    6141097                          33, /* Test duration must be greater than 32 secs */ 
    615                           &pjsip_options_method); 
     1098                          &pjsip_options_method, 1, 0, 0); 
    6161099    if (status != 0) 
    6171100        return status; 
     
    6231106                          TEST2_BRANCH_ID, 
    6241107                          33, /* Test duration must be greater than 32 secs */ 
    625                           &pjsip_options_method); 
     1108                          &pjsip_options_method, 1, 0, 0); 
    6261109    if (status != 0) 
    6271110        return status; 
     
    6471130                          TEST3_BRANCH_ID, 
    6481131                          35, 
    649                           &pjsip_options_method); 
     1132                          &pjsip_options_method, 1, 0, 0); 
     1133 
    6501134    return status; 
    6511135} 
     1136 
     1137 
     1138/***************************************************************************** 
     1139 ** 
     1140 ** TEST4_BRANCH_ID: Absorbs retransmissions in TRYING state 
     1141 ** TEST5_BRANCH_ID: Absorbs retransmissions in PROCEEDING state 
     1142 ** TEST6_BRANCH_ID: Absorbs retransmissions in COMPLETED state 
     1143 ** 
     1144 ***************************************************************************** 
     1145 */ 
     1146static int tsx_retransmit_last_response_test(const char *title, 
     1147                                             char *branch_id, 
     1148                                             int request_cnt, 
     1149                                             int status_code) 
     1150{ 
     1151    int status; 
     1152 
     1153    PJ_LOG(3,(THIS_FILE,"  %s", title)); 
     1154 
     1155    status = perform_test("sip:129.0.0.1;transport=loop-dgram", 
     1156                          "sip:129.0.0.1;transport=loop-dgram", 
     1157                          branch_id, 
     1158                          5, 
     1159                          &pjsip_options_method,  
     1160                          request_cnt, 1000, 1); 
     1161    if (status && status != TEST_TIMEOUT_ERROR) 
     1162        return status; 
     1163    if (!status) { 
     1164        PJ_LOG(3,(THIS_FILE, "   error: expecting timeout")); 
     1165        return -31; 
     1166    } 
     1167 
     1168    terminate_our_tsx(status_code); 
     1169    flush_events(100); 
     1170 
     1171    if (test_complete != 1) 
     1172        return test_complete; 
     1173 
     1174    flush_events(100); 
     1175    return 0; 
     1176} 
     1177 
     1178/***************************************************************************** 
     1179 ** 
     1180 ** TEST7_BRANCH_ID: INVITE non-2xx final response retransmission test 
     1181 ** TEST8_BRANCH_ID: INVITE 2xx final response retransmission test 
     1182 ** 
     1183 ***************************************************************************** 
     1184 */ 
     1185static int tsx_final_response_retransmission_test(void) 
     1186{ 
     1187    int status; 
     1188 
     1189    PJ_LOG(3,(THIS_FILE, 
     1190              "  test7: INVITE non-2xx final response retransmission")); 
     1191 
     1192    status = perform_test("sip:129.0.0.1;transport=loop-dgram", 
     1193                          "sip:129.0.0.1;transport=loop-dgram", 
     1194                          TEST7_BRANCH_ID, 
     1195                          33, /* Test duration must be greater than 32 secs */ 
     1196                          &pjsip_invite_method, 1, 0, 0); 
     1197    if (status != 0) 
     1198        return status; 
     1199 
     1200    PJ_LOG(3,(THIS_FILE, 
     1201              "  test8: INVITE 2xx final response retransmission")); 
     1202 
     1203    status = perform_test("sip:129.0.0.1;transport=loop-dgram", 
     1204                          "sip:129.0.0.1;transport=loop-dgram", 
     1205                          TEST8_BRANCH_ID, 
     1206                          33, /* Test duration must be greater than 32 secs */ 
     1207                          &pjsip_invite_method, 1, 0, 0); 
     1208    if (status != 0) 
     1209        return status; 
     1210 
     1211    return 0; 
     1212} 
     1213 
    6521214 
    6531215 
     
    6901252    if (status != 0) 
    6911253        return status; 
    692 #endif 
    6931254 
    6941255    /* TEST3_BRANCH_ID: with provisional response 
     
    6981259        return status; 
    6991260 
     1261    /* TEST4_BRANCH_ID: absorbs retransmissions in TRYING state 
     1262     */ 
     1263    status = tsx_retransmit_last_response_test(TEST4_TITLE, 
     1264                                               TEST4_BRANCH_ID,  
     1265                                               TEST4_REQUEST_COUNT, 
     1266                                               TEST4_STATUS_CODE); 
     1267    if (status != 0) 
     1268        return status; 
     1269 
     1270    /* TEST5_BRANCH_ID: retransmit last response in PROCEEDING state 
     1271     */ 
     1272    status = tsx_retransmit_last_response_test(TEST5_TITLE, 
     1273                                               TEST5_BRANCH_ID,  
     1274                                               TEST5_REQUEST_COUNT, 
     1275                                               TEST5_STATUS_CODE); 
     1276    if (status != 0) 
     1277        return status; 
     1278 
     1279    /* TEST6_BRANCH_ID: retransmit last response in PROCEEDING state 
     1280     */ 
     1281    status = tsx_retransmit_last_response_test(TEST6_TITLE, 
     1282                                               TEST6_BRANCH_ID,  
     1283                                               TEST6_REQUEST_COUNT, 
     1284                                               TEST6_STATUS_CODE); 
     1285    if (status != 0) 
     1286        return status; 
     1287 
     1288    /* TEST7_BRANCH_ID: INVITE non-2xx final response retransmission test 
     1289     * TEST8_BRANCH_ID: INVITE 2xx final response retransmission test 
     1290     */ 
     1291 
     1292    status = tsx_final_response_retransmission_test(); 
     1293    if (status != 0) 
     1294        return status; 
     1295 
     1296#endif 
    7001297 
    7011298    pjsip_transport_dec_ref(loop); 
  • pjproject/trunk/pjsip/src/test-pjsip/txdata_test.c

    r109 r119  
    3030 * This tests various core message creation functions.  
    3131 */ 
    32 int txdata_test(void) 
     32static int core_txdata_test(void) 
    3333{ 
    3434    pj_status_t status; 
     
    3636    pjsip_rx_data dummy_rdata; 
    3737    pjsip_tx_data *invite, *invite2, *cancel, *response, *ack; 
     38 
     39    PJ_LOG(3,(THIS_FILE, "   core transmit data test")); 
    3840 
    3941    /* Create INVITE request. */ 
     
    322324} 
    323325 
     326/* This tests the request creating functions against the following 
     327 * requirements: 
     328 *  - header params in URI creates header in the request. 
     329 *  - method and headers params are correctly shown or hidden in 
     330 *    request URI, From, To, and Contact header. 
     331 */ 
     332static int txdata_test_uri_params(void) 
     333{ 
     334    char msgbuf[512]; 
     335    pj_str_t target = pj_str("sip:alice@wonderland:5061;x-param=param%201" 
     336                             "?X-Hdr-1=Header%201" 
     337                             "&X-Empty-Hdr="); 
     338    pj_str_t pname = pj_str("x-param"); 
     339    pj_str_t hname = pj_str("X-Hdr-1"); 
     340    pj_str_t hemptyname = pj_str("X-Empty-Hdr"); 
     341    pjsip_from_hdr *from_hdr; 
     342    pjsip_to_hdr *to_hdr; 
     343    pjsip_contact_hdr *contact_hdr; 
     344    pjsip_generic_string_hdr *hdr; 
     345    pjsip_tx_data *tdata; 
     346    pjsip_sip_uri *uri; 
     347    pjsip_param *param; 
     348    pjsip_msg *msg; 
     349    int len; 
     350    pj_status_t status; 
     351 
     352    PJ_LOG(3,(THIS_FILE, "   header param in URI to create request")); 
     353 
     354    /* Create request with header param in target URI. */ 
     355    status = pjsip_endpt_create_request(endpt, &pjsip_invite_method, &target, 
     356                                        &target, &target, &target, NULL, -1, 
     357                                        NULL, &tdata); 
     358    if (status != 0) { 
     359        app_perror("   error: Unable to create request", status); 
     360        return -200; 
     361    } 
     362 
     363    /* Print and parse the request. 
     364     * We'll check that header params are not present in 
     365     */ 
     366    len = pjsip_msg_print(tdata->msg, msgbuf, sizeof(msgbuf)); 
     367    if (len < 1) { 
     368        PJ_LOG(3,(THIS_FILE, "   error: printing message")); 
     369        pjsip_tx_data_dec_ref(tdata); 
     370        return -250; 
     371    } 
     372    msgbuf[len] = '\0'; 
     373 
     374    PJ_LOG(5,(THIS_FILE, "%d bytes request created:--begin-msg--\n" 
     375                         "%s\n" 
     376                         "--end-msg--", len, msgbuf)); 
     377 
     378    /* Now parse the message. */ 
     379    msg = pjsip_parse_msg( tdata->pool, msgbuf, len, NULL); 
     380    if (msg == NULL) { 
     381        app_perror("   error: parsing message message", status); 
     382        pjsip_tx_data_dec_ref(tdata); 
     383        return -250; 
     384    } 
     385 
     386    /* Check the existence of port, other_param, and header param. 
     387     * Port is now allowed in To and From header. 
     388     */ 
     389    /* Port in request URI. */ 
     390    uri = (pjsip_sip_uri*) pjsip_uri_get_uri(msg->line.req.uri); 
     391    if (uri->port != 5061) { 
     392        PJ_LOG(3,(THIS_FILE, "   error: port not present in request URI")); 
     393        pjsip_tx_data_dec_ref(tdata); 
     394        return -260; 
     395    } 
     396    /* other_param in request_uri */ 
     397    param = pjsip_param_find(&uri->other_param, &pname); 
     398    if (param == NULL || pj_strcmp2(&param->value, "param 1") != 0) { 
     399        PJ_LOG(3,(THIS_FILE, "   error: x-param not present in request URI")); 
     400        pjsip_tx_data_dec_ref(tdata); 
     401        return -261; 
     402    } 
     403    /* header param in request uri. */ 
     404    if (!pj_list_empty(&uri->header_param)) { 
     405        PJ_LOG(3,(THIS_FILE, "   error: hparam in request URI")); 
     406        pjsip_tx_data_dec_ref(tdata); 
     407        return -262; 
     408    } 
     409 
     410    /* Port in From header. */ 
     411    from_hdr = (pjsip_from_hdr*) pjsip_msg_find_hdr(msg, PJSIP_H_FROM, NULL); 
     412    uri = (pjsip_sip_uri*) pjsip_uri_get_uri(from_hdr->uri); 
     413    if (uri->port != 0) { 
     414        PJ_LOG(3,(THIS_FILE, "   error: port most not exist in From header")); 
     415        pjsip_tx_data_dec_ref(tdata); 
     416        return -270; 
     417    } 
     418    /* other_param in From header */ 
     419    param = pjsip_param_find(&uri->other_param, &pname); 
     420    if (param == NULL || pj_strcmp2(&param->value, "param 1") != 0) { 
     421        PJ_LOG(3,(THIS_FILE, "   error: x-param not present in From header")); 
     422        pjsip_tx_data_dec_ref(tdata); 
     423        return -271; 
     424    } 
     425    /* header param in From header. */ 
     426    if (!pj_list_empty(&uri->header_param)) { 
     427        PJ_LOG(3,(THIS_FILE, "   error: hparam in From header")); 
     428        pjsip_tx_data_dec_ref(tdata); 
     429        return -272; 
     430    } 
     431 
     432 
     433    /* Port in To header. */ 
     434    to_hdr = (pjsip_to_hdr*) pjsip_msg_find_hdr(msg, PJSIP_H_TO, NULL); 
     435    uri = (pjsip_sip_uri*) pjsip_uri_get_uri(to_hdr->uri); 
     436    if (uri->port != 0) { 
     437        PJ_LOG(3,(THIS_FILE, "   error: port most not exist in To header")); 
     438        pjsip_tx_data_dec_ref(tdata); 
     439        return -280; 
     440    } 
     441    /* other_param in To header */ 
     442    param = pjsip_param_find(&uri->other_param, &pname); 
     443    if (param == NULL || pj_strcmp2(&param->value, "param 1") != 0) { 
     444        PJ_LOG(3,(THIS_FILE, "   error: x-param not present in To header")); 
     445        pjsip_tx_data_dec_ref(tdata); 
     446        return -281; 
     447    } 
     448    /* header param in From header. */ 
     449    if (!pj_list_empty(&uri->header_param)) { 
     450        PJ_LOG(3,(THIS_FILE, "   error: hparam in To header")); 
     451        pjsip_tx_data_dec_ref(tdata); 
     452        return -282; 
     453    } 
     454 
     455 
     456 
     457    /* Port in Contact header. */ 
     458    contact_hdr = (pjsip_contact_hdr*) pjsip_msg_find_hdr(msg, PJSIP_H_CONTACT, NULL); 
     459    uri = (pjsip_sip_uri*) pjsip_uri_get_uri(contact_hdr->uri); 
     460    if (uri->port != 5061) { 
     461        PJ_LOG(3,(THIS_FILE, "   error: port not present in Contact header")); 
     462        pjsip_tx_data_dec_ref(tdata); 
     463        return -290; 
     464    } 
     465    /* other_param in Contact header */ 
     466    param = pjsip_param_find(&uri->other_param, &pname); 
     467    if (param == NULL || pj_strcmp2(&param->value, "param 1") != 0) { 
     468        PJ_LOG(3,(THIS_FILE, "   error: x-param not present in Contact header")); 
     469        pjsip_tx_data_dec_ref(tdata); 
     470        return -291; 
     471    } 
     472    /* header param in Contact header. */ 
     473    if (pj_list_empty(&uri->header_param)) { 
     474        PJ_LOG(3,(THIS_FILE, "   error: hparam is missing in Contact header")); 
     475        pjsip_tx_data_dec_ref(tdata); 
     476        return -292; 
     477    } 
     478    /* Check for X-Hdr-1 */ 
     479    param = pjsip_param_find(&uri->header_param, &hname); 
     480    if (param == NULL || pj_strcmp2(&param->value, "Header 1")!=0) { 
     481        PJ_LOG(3,(THIS_FILE, "   error: hparam is missing in Contact header")); 
     482        pjsip_tx_data_dec_ref(tdata); 
     483        return -293; 
     484    } 
     485    /* Check for X-Empty-Hdr */ 
     486    param = pjsip_param_find(&uri->header_param, &hemptyname); 
     487    if (param == NULL || pj_strcmp2(&param->value, "")!=0) { 
     488        PJ_LOG(3,(THIS_FILE, "   error: hparam is missing in Contact header")); 
     489        pjsip_tx_data_dec_ref(tdata); 
     490        return -294; 
     491    } 
     492 
     493 
     494    /* Check that headers are present in the request. */ 
     495    hdr = (pjsip_generic_string_hdr*)  
     496        pjsip_msg_find_hdr_by_name(msg, &hname, NULL); 
     497    if (hdr == NULL || pj_strcmp2(&hdr->hvalue, "Header 1")!=0) { 
     498        PJ_LOG(3,(THIS_FILE, "   error: header X-Hdr-1 not created")); 
     499        pjsip_tx_data_dec_ref(tdata); 
     500        return -300; 
     501    } 
     502 
     503    hdr = (pjsip_generic_string_hdr*)  
     504        pjsip_msg_find_hdr_by_name(msg, &hemptyname, NULL); 
     505    if (hdr == NULL || pj_strcmp2(&param->value, "")!=0) { 
     506        PJ_LOG(3,(THIS_FILE, "   error: header X-Empty-Hdr not created")); 
     507        pjsip_tx_data_dec_ref(tdata); 
     508        return -330; 
     509    } 
     510 
     511    pjsip_tx_data_dec_ref(tdata); 
     512    return 0; 
     513} 
     514 
     515int txdata_test(void) 
     516{ 
     517    int status; 
     518 
     519    status = core_txdata_test(); 
     520    if (status  != 0) 
     521        return status; 
     522 
     523 
     524    status = txdata_test_uri_params(); 
     525    if (status != 0) 
     526        return status; 
     527 
     528    return 0; 
     529} 
  • pjproject/trunk/pjsip/src/test-pjsip/uri_test.c

    r109 r119  
    318318{ 
    319319    /* "sip:localhost" */ 
    320     pjsip_url *url = pjsip_url_create(pool, 0); 
     320    pjsip_sip_uri *url = pjsip_url_create(pool, 0); 
    321321 
    322322    pj_strdup2(pool, &url->host, "localhost"); 
     
    327327{ 
    328328    /* "sip:user@localhost" */ 
    329     pjsip_url *url = pjsip_url_create(pool, 0); 
     329    pjsip_sip_uri *url = pjsip_url_create(pool, 0); 
    330330 
    331331    pj_strdup2( pool, &url->user, "user"); 
     
    338338{ 
    339339    /* "sip:user:password@localhost:5060" */ 
    340     pjsip_url *url = pjsip_url_create(pool, 0); 
     340    pjsip_sip_uri *url = pjsip_url_create(pool, 0); 
    341341 
    342342    pj_strdup2( pool, &url->user, "user"); 
     
    351351{ 
    352352    /* Like: "sip:localhost:5060", but without the port. */ 
    353     pjsip_url *url = pjsip_url_create(pool, 0); 
     353    pjsip_sip_uri *url = pjsip_url_create(pool, 0); 
    354354 
    355355    pj_strdup2(pool, &url->host, "localhost"); 
     
    360360{ 
    361361    /* "sip:localhost;transport=tcp;user=ip;ttl=255;lr;maddr=127.0.0.1;method=ACK" */ 
    362     pjsip_url *url = pjsip_url_create(pool, 0); 
     362    pjsip_sip_uri *url = pjsip_url_create(pool, 0); 
    363363 
    364364    pj_strdup2(pool, &url->host, "localhost"); 
     
    387387       "?Subject=Hello%20There&Server=SIP%20Server"  
    388388     */ 
    389     pjsip_url *url = pjsip_url_create(pool, 0); 
     389    pjsip_sip_uri *url = pjsip_url_create(pool, 0); 
    390390 
    391391    pj_strdup2(pool, &url->host, "localhost"); 
     
    406406{ 
    407407    /* "sips:localhost" */ 
    408     pjsip_url *url = pjsip_url_create(pool, 1); 
     408    pjsip_sip_uri *url = pjsip_url_create(pool, 1); 
    409409 
    410410    pj_strdup2(pool, &url->host, "localhost"); 
     
    416416    /* "<sip:localhost>" */ 
    417417    pjsip_name_addr *name_addr = pjsip_name_addr_create(pool); 
    418     pjsip_url *url; 
     418    pjsip_sip_uri *url; 
    419419 
    420420    url = pjsip_url_create(pool, 0); 
     
    429429    /* "  Power Administrator <sips:localhost>" */ 
    430430    pjsip_name_addr *name_addr = pjsip_name_addr_create(pool); 
    431     pjsip_url *url; 
     431    pjsip_sip_uri *url; 
    432432 
    433433    url = pjsip_url_create(pool, 1); 
     
    443443    /* " \"User\" <sip:user@localhost:5071>" */ 
    444444    pjsip_name_addr *name_addr = pjsip_name_addr_create(pool); 
    445     pjsip_url *url; 
     445    pjsip_sip_uri *url; 
    446446 
    447447    url = pjsip_url_create(pool, 0); 
     
    459459    /* " \"Strange User\\\"\\\\\\\"\" <sip:localhost>" */ 
    460460    pjsip_name_addr *name_addr = pjsip_name_addr_create(pool); 
    461     pjsip_url *url; 
     461    pjsip_sip_uri *url; 
    462462 
    463463    url = pjsip_url_create(pool, 0); 
     
    473473    /* " \"Rogue User\\\" <sip:localhost>" */ 
    474474    pjsip_name_addr *name_addr = pjsip_name_addr_create(pool); 
    475     pjsip_url *url; 
     475    pjsip_sip_uri *url; 
    476476 
    477477    url = pjsip_url_create(pool, 0); 
     
    487487    /* "Strange User\" <sip:localhost>" */ 
    488488    pjsip_name_addr *name_addr = pjsip_name_addr_create(pool); 
    489     pjsip_url *url; 
     489    pjsip_sip_uri *url; 
    490490 
    491491    url = pjsip_url_create(pool, 0); 
     
    500500{ 
    501501    /* "sip:localhost;pvalue=\"hello world\"" */ 
    502     pjsip_url *url; 
     502    pjsip_sip_uri *url; 
    503503    url = pjsip_url_create(pool, 0); 
    504504    pj_strdup2(pool, &url->host, "localhost"); 
     
    512512    /* "This is -. !% *_+`'~ me <sip:a19A&=+$,;?/%2c:%40a&Zz=+$,@my_proxy09.my-domain.com:9801>" */ 
    513513    pjsip_name_addr *name_addr = pjsip_name_addr_create(pool); 
    514     pjsip_url *url; 
     514    pjsip_sip_uri *url; 
    515515 
    516516    url = pjsip_url_create(pool, 0); 
     
    528528{ 
    529529    /* "sip:abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-_.com" */ 
    530     pjsip_url *url; 
     530    pjsip_sip_uri *url; 
    531531    url = pjsip_url_create(pool, 0); 
    532532    pj_strdup2(pool, &url->host, ALPHANUM "-_.com"); 
     
    537537{ 
    538538    /* "sip:" USER_CHAR ":" PASS_CHAR "@host" */ 
    539     pjsip_url *url; 
     539    pjsip_sip_uri *url; 
    540540    url = pjsip_url_create(pool, 0); 
    541541    pj_strdup2(pool, &url->user, USER_CHAR); 
     
    548548{ 
    549549    /* "sip:host;user=ip;" PARAM_CHAR "%21=" PARAM_CHAR "%21;lr;other=1;transport=sctp;other2" */ 
    550     pjsip_url *url; 
     550    pjsip_sip_uri *url; 
    551551    url = pjsip_url_create(pool, 0); 
    552552    pj_strdup2(pool, &url->host, "host"); 
Note: See TracChangeset for help on using the changeset viewer.