Changeset 798


Ignore:
Timestamp:
Nov 11, 2006 4:46:34 PM (17 years ago)
Author:
bennylp
Message:

Committed what seems like what left uncommitted in previous commit (pjsua_app.c and pj/config.c)

Location:
pjproject/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjlib/src/pj/config.c

    r739 r798  
    2222 
    2323static const char *id = "config.c"; 
    24 const char *PJ_VERSION = "0.5.8"; 
     24const char *PJ_VERSION = "0.5.8.5"; 
    2525 
    2626PJ_DEF(void) pj_dump_config(void) 
  • pjproject/trunk/pjsip-apps/src/pjsua/pjsua_app.c

    r782 r798  
    8181//static pjsua_acc_id   current_acc; 
    8282#define current_acc     pjsua_acc_get_default() 
    83 static pjsua_call_id    current_call; 
     83static pjsua_call_id    current_call = PJSUA_INVALID_ID; 
    8484static pj_str_t         uri_arg; 
    8585 
     
    15681568 
    15691569/* 
     1570 * Notification that call is being replaced. 
     1571 */ 
     1572static 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/* 
    15701590 * Print buddy list. 
    15711591 */ 
     
    16631683    puts("|  [  Select previous dialog   +--------------------------+-------------------+"); 
    16641684    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("|                              | cc  Connect port         | dd  Dump detailed |"); 
     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 |"); 
    16681688    puts("|                              | cd  Disconnect port      | dc  Dump config   |"); 
    16691689    puts("|  S  Send arbitrary REQUEST   |                          |  f  Save config   |"); 
     
    16741694    i = pjsua_call_get_count(); 
    16751695    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    } 
    16761704} 
    16771705 
     
    22312259                pj_str_t STR_REFER_SUB = { "Refer-Sub", 9 }; 
    22322260                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); 
    22332267 
    22342268                ui_input_url("Transfer to URL", buf, sizeof(buf), &result); 
     
    22622296                    pjsua_call_xfer( current_call, &tmp, &msg_data); 
    22632297                } 
     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); 
    22642385            } 
    22652386            break; 
     
    25542675    app_config.cfg.cb.on_typing = &on_typing; 
    25552676    app_config.cfg.cb.on_call_transfer_status = &on_call_transfer_status; 
     2677    app_config.cfg.cb.on_call_replaced = &on_call_replaced; 
    25562678 
    25572679    /* Initialize pjsua */ 
Note: See TracChangeset for help on using the changeset viewer.