Changeset 2373 for pjproject/trunk


Ignore:
Timestamp:
Dec 10, 2008 4:54:16 PM (15 years ago)
Author:
bennylp
Message:

Ticket #672: Option to add custom parameters in the account Contact URI

Location:
pjproject/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjsip-apps/src/pjsua/pjsua_app.c

    r2371 r2373  
    178178    puts  ("  --id=url            Set the URL of local ID (used in From header)"); 
    179179    puts  ("  --contact=url       Optionally override the Contact information"); 
     180    puts  ("  --contact-params=S  Append the specified parameters S in Contact URI"); 
    180181    puts  ("  --proxy=url         Optional URL of proxy server to visit"); 
    181182    puts  ("                      May be specified multiple times"); 
     
    463464           OPT_LOCAL_PORT, OPT_IP_ADDR, OPT_PROXY, OPT_OUTBOUND_PROXY,  
    464465           OPT_REGISTRAR, OPT_REG_TIMEOUT, OPT_PUBLISH, OPT_ID, OPT_CONTACT, 
     466           OPT_CONTACT_PARAMS, 
    465467           OPT_100REL, OPT_USE_IMS, OPT_REALM, OPT_USERNAME, OPT_PASSWORD, 
    466468           OPT_NAMESERVER, OPT_STUN_DOMAIN, OPT_STUN_SRV, 
     
    518520        { "id",         1, 0, OPT_ID}, 
    519521        { "contact",    1, 0, OPT_CONTACT}, 
     522        { "contact-params",1,0, OPT_CONTACT_PARAMS}, 
    520523        { "auto-update-nat",    1, 0, OPT_AUTO_UPDATE_NAT}, 
    521524        { "use-compact-form",   0, 0, OPT_USE_COMPACT_FORM}, 
     
    827830            break; 
    828831 
     832        case OPT_CONTACT_PARAMS: 
     833            cur_acc->contact_params = pj_str(pj_optarg); 
     834            break; 
     835 
    829836        case OPT_AUTO_UPDATE_NAT:   /* OPT_AUTO_UPDATE_NAT */ 
    830837            cur_acc->allow_contact_rewrite  = pj_strtoul(pj_cstr(&tmp, pj_optarg)); 
     
    13681375                        (int)acc_cfg->force_contact.slen,  
    13691376                        acc_cfg->force_contact.ptr); 
     1377        pj_strcat2(result, line); 
     1378    } 
     1379 
     1380    /* Contact parameters */ 
     1381    if (acc_cfg->contact_params.slen) { 
     1382        pj_ansi_sprintf(line, "--contact-params %.*s\n",  
     1383                        (int)acc_cfg->contact_params.slen,  
     1384                        acc_cfg->contact_params.ptr); 
    13701385        pj_strcat2(result, line); 
    13711386    } 
  • pjproject/trunk/pjsip/include/pjsua-lib/pjsua.h

    r2371 r2373  
    21322132 
    21332133    /** 
     2134     * Additional URI parameters that will be appended in the Contact header 
     2135     * for this account. This will affect the Contact header in all SIP  
     2136     * messages sent on behalf of this account, including but not limited to 
     2137     * REGISTER, INVITE, and SUBCRIBE requests or responses. 
     2138     * 
     2139     * The parameters should be preceeded by semicolon, and all strings must 
     2140     * be properly escaped. Example: 
     2141     *   ";my-param=X;another-param=Hi%20there" 
     2142     */ 
     2143    pj_str_t        contact_params; 
     2144 
     2145    /** 
    21342146     * Specify whether support for reliable provisional response (100rel and 
    21352147     * PRACK) should be required for all sessions of this account. 
  • pjproject/trunk/pjsip/src/pjsua-lib/pjsua_acc.c

    r2351 r2373  
    682682        tmp = (char*) pj_pool_alloc(pool, PJSIP_MAX_URL_SIZE); 
    683683        len = pj_ansi_snprintf(tmp, PJSIP_MAX_URL_SIZE, 
    684                                "<sip:%.*s%s%.*s:%d;transport=%s>", 
     684                               "<sip:%.*s%s%.*s:%d;transport=%s%.*s>", 
    685685                               (int)acc->user_part.slen, 
    686686                               acc->user_part.ptr, 
     
    689689                               via_addr->ptr, 
    690690                               rport, 
    691                                tp->type_name); 
     691                               tp->type_name, 
     692                               (int)acc->cfg.contact_params.slen, 
     693                               acc->cfg.contact_params.ptr); 
    692694        if (len < 1) { 
    693695            PJ_LOG(1,(THIS_FILE, "URI too long")); 
     
    16641666    contact->ptr = (char*)pj_pool_alloc(pool, PJSIP_MAX_URL_SIZE); 
    16651667    contact->slen = pj_ansi_snprintf(contact->ptr, PJSIP_MAX_URL_SIZE, 
    1666                                      "%.*s%s<%s:%.*s%s%s%.*s%s:%d%s>", 
     1668                                     "%.*s%s<%s:%.*s%s%s%.*s%s:%d%s%.*s>", 
    16671669                                     (int)acc->display.slen, 
    16681670                                     acc->display.ptr, 
     
    16771679                                     endquote, 
    16781680                                     local_port, 
    1679                                      transport_param); 
     1681                                     transport_param, 
     1682                                     (int)acc->cfg.contact_params.slen, 
     1683                                     acc->cfg.contact_params.ptr); 
    16801684 
    16811685    return PJ_SUCCESS; 
     
    18141818    contact->ptr = (char*) pj_pool_alloc(pool, PJSIP_MAX_URL_SIZE); 
    18151819    contact->slen = pj_ansi_snprintf(contact->ptr, PJSIP_MAX_URL_SIZE, 
    1816                                      "%.*s%s<%s:%.*s%s%s%.*s%s:%d%s>", 
     1820                                     "%.*s%s<%s:%.*s%s%s%.*s%s:%d%s%.*s>", 
    18171821                                     (int)acc->display.slen, 
    18181822                                     acc->display.ptr, 
     
    18271831                                     endquote, 
    18281832                                     local_port, 
    1829                                      transport_param); 
     1833                                     transport_param, 
     1834                                     (int)acc->cfg.contact_params.slen, 
     1835                                     acc->cfg.contact_params.ptr); 
    18301836 
    18311837    return PJ_SUCCESS; 
Note: See TracChangeset for help on using the changeset viewer.