Changeset 798
- Timestamp:
- Nov 11, 2006 4:46:34 PM (18 years ago)
- Location:
- pjproject/trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjlib/src/pj/config.c
r739 r798 22 22 23 23 static const char *id = "config.c"; 24 const char *PJ_VERSION = "0.5.8 ";24 const char *PJ_VERSION = "0.5.8.5"; 25 25 26 26 PJ_DEF(void) pj_dump_config(void) -
pjproject/trunk/pjsip-apps/src/pjsua/pjsua_app.c
r782 r798 81 81 //static pjsua_acc_id current_acc; 82 82 #define current_acc pjsua_acc_get_default() 83 static pjsua_call_id current_call ;83 static pjsua_call_id current_call = PJSUA_INVALID_ID; 84 84 static pj_str_t uri_arg; 85 85 … … 1568 1568 1569 1569 /* 1570 * Notification that call is being replaced. 1571 */ 1572 static void on_call_replaced(pjsua_call_id old_call_id, 1573 pjsua_call_id new_call_id) 1574 { 1575 pjsua_call_info old_ci, new_ci; 1576 1577 pjsua_call_get_info(old_call_id, &old_ci); 1578 pjsua_call_get_info(new_call_id, &new_ci); 1579 1580 PJ_LOG(3,(THIS_FILE, "Call %d with %.*s is being replaced by " 1581 "call %d with %.*s", 1582 old_call_id, 1583 (int)old_ci.remote_info.slen, old_ci.remote_info.ptr, 1584 new_call_id, 1585 (int)new_ci.remote_info.slen, new_ci.remote_info.ptr)); 1586 } 1587 1588 1589 /* 1570 1590 * Print buddy list. 1571 1591 */ … … 1663 1683 puts("| [ Select previous dialog +--------------------------+-------------------+"); 1664 1684 puts("| x Xfer call | Media Commands: | Status & Config: |"); 1665 puts("| # Send DTMF string| | |");1666 puts("| dq Dump curr. call quality| cl List ports | d Dump status |");1667 puts("| 1685 puts("| X Xfer with Replaces | | |"); 1686 puts("| # Send DTMF string | cl List ports | d Dump status |"); 1687 puts("| dq Dump curr. call quality | cc Connect port | dd Dump detailed |"); 1668 1688 puts("| | cd Disconnect port | dc Dump config |"); 1669 1689 puts("| S Send arbitrary REQUEST | | f Save config |"); … … 1674 1694 i = pjsua_call_get_count(); 1675 1695 printf("You have %d active call%s\n", i, (i>1?"s":"")); 1696 1697 if (current_call != PJSUA_INVALID_ID) { 1698 pjsua_call_info ci; 1699 if (pjsua_call_get_info(current_call, &ci)==PJ_SUCCESS) 1700 printf("Current call id=%d to %.*s [%.*s]\n", current_call, 1701 (int)ci.remote_info.slen, ci.remote_info.ptr, 1702 (int)ci.state_text.slen, ci.state_text.ptr); 1703 } 1676 1704 } 1677 1705 … … 2231 2259 pj_str_t STR_REFER_SUB = { "Refer-Sub", 9 }; 2232 2260 pj_str_t STR_FALSE = { "false", 5 }; 2261 pjsua_call_info ci; 2262 2263 pjsua_call_get_info(current_call, &ci); 2264 printf("Transfering current call [%d] %.*s\n", 2265 current_call, 2266 (int)ci.remote_info.slen, ci.remote_info.ptr); 2233 2267 2234 2268 ui_input_url("Transfer to URL", buf, sizeof(buf), &result); … … 2262 2296 pjsua_call_xfer( current_call, &tmp, &msg_data); 2263 2297 } 2298 } 2299 break; 2300 2301 case 'X': 2302 /* 2303 * Transfer call with replaces. 2304 */ 2305 if (current_call == -1) { 2306 2307 PJ_LOG(3,(THIS_FILE, "No current call")); 2308 2309 } else { 2310 int call = current_call; 2311 int dst_call; 2312 pjsua_msg_data msg_data; 2313 pjsip_generic_string_hdr refer_sub; 2314 pj_str_t STR_REFER_SUB = { "Refer-Sub", 9 }; 2315 pj_str_t STR_FALSE = { "false", 5 }; 2316 pjsua_call_id ids[PJSUA_MAX_CALLS]; 2317 pjsua_call_info ci; 2318 unsigned i, count; 2319 2320 count = PJ_ARRAY_SIZE(ids); 2321 pjsua_enum_calls(ids, &count); 2322 2323 if (count <= 1) { 2324 puts("There are no other calls"); 2325 continue; 2326 } 2327 2328 pjsua_call_get_info(current_call, &ci); 2329 printf("Transfer call [%d] %.*s to one of the following:\n", 2330 current_call, 2331 (int)ci.remote_info.slen, ci.remote_info.ptr); 2332 2333 for (i=0; i<count; ++i) { 2334 pjsua_call_info call_info; 2335 2336 if (ids[i] == call) 2337 continue; 2338 2339 pjsua_call_get_info(ids[i], &call_info); 2340 printf("%d %.*s [%.*s]\n", 2341 ids[i], 2342 (int)call_info.remote_info.slen, 2343 call_info.remote_info.ptr, 2344 (int)call_info.state_text.slen, 2345 call_info.state_text.ptr); 2346 } 2347 2348 if (!simple_input("Enter call number to be replaced", 2349 buf, sizeof(buf))) 2350 continue; 2351 2352 dst_call = my_atoi(buf); 2353 2354 /* Check if call is still there. */ 2355 2356 if (call != current_call) { 2357 puts("Call has been disconnected"); 2358 continue; 2359 } 2360 2361 /* Check that destination call is valid. */ 2362 if (dst_call == call) { 2363 puts("Destination call number must not be the same " 2364 "as the call being transfered"); 2365 continue; 2366 } 2367 if (dst_call >= PJSUA_MAX_CALLS) { 2368 puts("Invalid destination call number"); 2369 continue; 2370 } 2371 if (!pjsua_call_is_active(dst_call)) { 2372 puts("Invalid destination call number"); 2373 continue; 2374 } 2375 2376 pjsua_msg_data_init(&msg_data); 2377 if (app_config.no_refersub) { 2378 /* Add Refer-Sub: false in outgoing REFER request */ 2379 pjsip_generic_string_hdr_init2(&refer_sub, &STR_REFER_SUB, 2380 &STR_FALSE); 2381 pj_list_push_back(&msg_data.hdr_list, &refer_sub); 2382 } 2383 2384 pjsua_call_xfer_replaces(call, dst_call, 0, &msg_data); 2264 2385 } 2265 2386 break; … … 2554 2675 app_config.cfg.cb.on_typing = &on_typing; 2555 2676 app_config.cfg.cb.on_call_transfer_status = &on_call_transfer_status; 2677 app_config.cfg.cb.on_call_replaced = &on_call_replaced; 2556 2678 2557 2679 /* Initialize pjsua */
Note: See TracChangeset
for help on using the changeset viewer.