Changeset 5455
- Timestamp:
- Oct 7, 2016 7:42:22 AM (8 years ago)
- Location:
- pjproject/trunk/pjsip
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjsip/include/pjsua-lib/pjsua.h
r5417 r5455 2954 2954 pjsip_hdr reg_hdr_list; 2955 2955 2956 /** 2957 * Additional parameters that will be appended in the Contact header 2958 * for this account. This will only affect REGISTER requests and 2959 * will be appended after \a contact_params; 2960 * 2961 * The parameters should be preceeded by semicolon, and all strings must 2962 * be properly escaped. Example: 2963 * ";my-param=X;another-param=Hi%20there" 2964 */ 2965 pj_str_t reg_contact_params; 2966 2956 2967 /** 2957 2968 * The optional custom SIP headers to be put in the presence -
pjproject/trunk/pjsip/include/pjsua2/account.hpp
r5410 r5455 71 71 72 72 /** 73 * Additional parameters that will be appended in the Contact header 74 * of the registration requests. This will be appended after 75 * \a AccountSipConfig.contactParams; 76 * 77 * The parameters should be preceeded by semicolon, and all strings must 78 * be properly escaped. Example: 79 * ";my-param=X;another-param=Hi%20there" 80 */ 81 string contactParams; 82 83 /** 73 84 * Optional interval for registration, in seconds. If the value is zero, 74 85 * default interval will be used (PJSUA_REG_INTERVAL, 300 seconds). -
pjproject/trunk/pjsip/src/pjsua-lib/pjsua_acc.c
r5366 r5455 88 88 pj_strdup_with_null(pool, &dst->reg_uri, &src->reg_uri); 89 89 pj_strdup_with_null(pool, &dst->force_contact, &src->force_contact); 90 pj_strdup_with_null(pool, &dst->reg_contact_params, 91 &src->reg_contact_params); 90 92 pj_strdup_with_null(pool, &dst->contact_params, &src->contact_params); 91 93 pj_strdup_with_null(pool, &dst->contact_uri_params, … … 993 995 update_reg = PJ_TRUE; 994 996 unreg_first = PJ_TRUE; 997 } 998 999 /* Register contact params */ 1000 if (pj_strcmp(&acc->cfg.reg_contact_params, &cfg->reg_contact_params)) { 1001 pj_strdup_with_null(acc->pool, &acc->cfg.reg_contact_params, 1002 &cfg->reg_contact_params); 1003 update_reg = PJ_TRUE; 995 1004 } 996 1005 … … 1478 1487 1479 1488 done: 1480 if (!need_outbound) { 1481 /* Outbound is not needed/wanted for the account. acc->reg_contact 1482 * is set to the same as acc->contact. 1483 */ 1484 acc->reg_contact = acc->contact; 1485 acc->rfc5626_status = OUTBOUND_NA; 1486 } else { 1487 /* Need to use outbound, append the contact with +sip.instance and 1488 * reg-id parameters. 1489 */ 1489 { 1490 1490 pj_ssize_t len; 1491 1491 pj_str_t reg_contact; 1492 1492 1493 1493 acc->rfc5626_status = OUTBOUND_WANTED; 1494 len = acc->contact.slen + acc->rfc5626_instprm.slen + 1495 acc->rfc5626_regprm.slen; 1496 reg_contact.ptr = (char*) pj_pool_alloc(acc->pool, len); 1497 1498 pj_strcpy(®_contact, &acc->contact); 1499 pj_strcat(®_contact, &acc->rfc5626_regprm); 1500 pj_strcat(®_contact, &acc->rfc5626_instprm); 1501 1502 acc->reg_contact = reg_contact; 1503 1504 PJ_LOG(4,(THIS_FILE, 1505 "Contact for acc %d updated for SIP outbound: %.*s", 1506 acc->index, 1507 (int)acc->reg_contact.slen, 1508 acc->reg_contact.ptr)); 1494 len = acc->contact.slen + acc->cfg.reg_contact_params.slen + 1495 (need_outbound? 1496 (acc->rfc5626_instprm.slen + acc->rfc5626_regprm.slen): 0); 1497 if (len > acc->contact.slen) { 1498 reg_contact.ptr = (char*) pj_pool_alloc(acc->pool, len); 1499 1500 pj_strcpy(®_contact, &acc->contact); 1501 1502 if (need_outbound) { 1503 acc->rfc5626_status = OUTBOUND_WANTED; 1504 1505 /* Need to use outbound, append the contact with 1506 * +sip.instance and reg-id parameters. 1507 */ 1508 pj_strcat(®_contact, &acc->rfc5626_regprm); 1509 pj_strcat(®_contact, &acc->rfc5626_instprm); 1510 } else { 1511 acc->rfc5626_status = OUTBOUND_NA; 1512 } 1513 1514 pj_strcat(®_contact, &acc->cfg.reg_contact_params); 1515 1516 acc->reg_contact = reg_contact; 1517 1518 PJ_LOG(4,(THIS_FILE, 1519 "Contact for acc %d updated: %.*s", 1520 acc->index, 1521 (int)acc->reg_contact.slen, 1522 acc->reg_contact.ptr)); 1523 1524 } else { 1525 /* Outbound is not needed/wanted for the account and there's 1526 * no custom registration Contact params. acc->reg_contact 1527 * is set to the same as acc->contact. 1528 */ 1529 acc->reg_contact = acc->contact; 1530 acc->rfc5626_status = OUTBOUND_NA; 1531 } 1509 1532 } 1510 1533 } -
pjproject/trunk/pjsip/src/pjsua2/account.cpp
r5410 r5455 44 44 NODE_READ_UNSIGNED (this_node, unregWaitMsec); 45 45 NODE_READ_UNSIGNED (this_node, proxyUse); 46 NODE_READ_STRING (this_node, contactParams); 46 47 47 48 readSipHeaders(this_node, "headers", headers); … … 62 63 NODE_WRITE_UNSIGNED (this_node, unregWaitMsec); 63 64 NODE_WRITE_UNSIGNED (this_node, proxyUse); 65 NODE_WRITE_STRING (this_node, contactParams); 64 66 65 67 writeSipHeaders(this_node, "headers", headers); … … 330 332 ret.unreg_timeout = regConfig.unregWaitMsec; 331 333 ret.reg_use_proxy = regConfig.proxyUse; 334 ret.reg_contact_params = str2Pj(regConfig.contactParams); 332 335 for (i=0; i<regConfig.headers.size(); ++i) { 333 336 pj_list_push_back(&ret.reg_hdr_list, ®Config.headers[i].toPj()); … … 464 467 regConfig.unregWaitMsec = prm.unreg_timeout; 465 468 regConfig.proxyUse = prm.reg_use_proxy; 469 regConfig.contactParams = pj2Str(prm.reg_contact_params); 466 470 regConfig.headers.clear(); 467 471 hdr = prm.reg_hdr_list.next;
Note: See TracChangeset
for help on using the changeset viewer.