Changeset 5833 for pjproject/trunk/pjsip/src/pjsua-lib/pjsua_acc.c
- Timestamp:
- Jul 23, 2018 7:15:08 AM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjsip/src/pjsua-lib/pjsua_acc.c
r5822 r5833 534 534 pjsua_acc_config cfg; 535 535 pjsua_transport_data *t = &pjsua_var.tpdata[tid]; 536 const char *beginquote, *endquote;537 536 char transport_param[32]; 538 537 char uri[PJSIP_MAX_URL_SIZE]; 538 char addr_buf[PJ_INET6_ADDRSTRLEN+10]; 539 539 pjsua_acc_id acc_id; 540 540 pj_status_t status; … … 551 551 /* Lower the priority of local account */ 552 552 --cfg.priority; 553 554 /* Enclose IPv6 address in square brackets */555 if (get_ip_addr_ver(&t->local_name.host) == 6) {556 beginquote = "[";557 endquote = "]";558 } else {559 beginquote = endquote = "";560 }561 553 562 554 /* Don't add transport parameter if it's UDP */ … … 570 562 571 563 /* Build URI for the account */ 572 pj_ansi_snprintf(uri, PJSIP_MAX_URL_SIZE, 573 "<sip:%s%.*s%s:%d%s>", 574 beginquote, 575 (int)t->local_name.host.slen, 576 t->local_name.host.ptr, 577 endquote, 578 t->local_name.port, 564 pj_ansi_snprintf(uri, PJSIP_MAX_URL_SIZE, 565 "<sip:%s%s>", 566 pj_addr_str_print(&t->local_name.host, t->local_name.port, 567 addr_buf, sizeof(addr_buf), 1), 579 568 transport_param); 580 569 … … 1611 1600 pj_str_t srv_ip; 1612 1601 pjsip_contact_hdr *contact_hdr; 1602 char host_addr_buf[PJ_INET6_ADDRSTRLEN+10]; 1603 char via_addr_buf[PJ_INET6_ADDRSTRLEN+10]; 1613 1604 const pj_str_t STR_CONTACT = { "Contact", 7 }; 1614 1605 … … 1777 1768 return PJ_FALSE; 1778 1769 } 1779 1770 pj_addr_str_print(&uri->host, uri->port, host_addr_buf, 1771 sizeof(host_addr_buf), 1); 1772 pj_addr_str_print(via_addr, rport, via_addr_buf, 1773 sizeof(via_addr_buf), 1); 1780 1774 PJ_LOG(3,(THIS_FILE, "IP address change detected for account %d " 1781 "(% .*s:%d --> %.*s:%d). Updating registration "1775 "(%s --> %s). Updating registration " 1782 1776 "(using method %d)", 1783 acc->index, 1784 (int)uri->host.slen, 1785 uri->host.ptr, 1786 uri->port, 1787 (int)via_addr->slen, 1788 via_addr->ptr, 1789 rport, 1790 contact_rewrite_method)); 1777 acc->index, host_addr_buf, via_addr_buf)); 1791 1778 1792 1779 pj_assert(contact_rewrite_method == PJSUA_CONTACT_REWRITE_UNREGISTER || … … 1817 1804 secure = pjsip_transport_get_flag_from_type(tp->key.type) & 1818 1805 PJSIP_TRANSPORT_SECURE; 1819 1820 1821 1822 1823 1824 1825 1826 1806 1807 /* Enclose IPv6 address in square brackets */ 1808 if (tp->key.type & PJSIP_TRANSPORT_IPV6) { 1809 beginquote = "["; 1810 endquote = "]"; 1811 } else { 1812 beginquote = endquote = ""; 1813 } 1827 1814 1828 1815 /* Don't add transport parameter if it's UDP */ … … 2134 2121 &delay); 2135 2122 if (status == PJ_SUCCESS) { 2123 char addr[PJ_INET6_ADDRSTRLEN+10]; 2124 pj_str_t input_str = pj_str(param->rdata->pkt_info.src_name); 2136 2125 acc->ka_timer.id = PJ_TRUE; 2126 2127 pj_addr_str_print(&input_str, param->rdata->pkt_info.src_port, 2128 addr, sizeof(addr), 1); 2137 2129 PJ_LOG(4,(THIS_FILE, "Keep-alive timer started for acc %d, " 2138 2130 "destination:%s:%d, interval:%ds", 2139 acc->index, 2140 param->rdata->pkt_info.src_name, 2141 param->rdata->pkt_info.src_port, 2142 acc->cfg.ka_interval)); 2131 acc->index, addr, acc->cfg.ka_interval)); 2143 2132 } else { 2144 2133 acc->ka_timer.id = PJ_FALSE;
Note: See TracChangeset
for help on using the changeset viewer.