Ignore:
Timestamp:
Oct 4, 2007 6:17:58 AM (17 years ago)
Author:
bennylp
Message:

Ticket #389: Added new commands in pjsua to change codec priorities and send UPDATE

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjsip/src/pjsua-lib/pjsua_call.c

    r1469 r1471  
    12721272    if (status != PJ_SUCCESS) { 
    12731273        pjsua_perror(THIS_FILE, "Unable to send re-INVITE", status); 
     1274        pjsip_dlg_dec_lock(dlg); 
     1275        return status; 
     1276    } 
     1277 
     1278    pjsip_dlg_dec_lock(dlg); 
     1279 
     1280    return PJ_SUCCESS; 
     1281} 
     1282 
     1283 
     1284/* 
     1285 * Send UPDATE request. 
     1286 */ 
     1287PJ_DEF(pj_status_t) pjsua_call_update( pjsua_call_id call_id, 
     1288                                       unsigned options, 
     1289                                       const pjsua_msg_data *msg_data) 
     1290{ 
     1291    pjmedia_sdp_session *sdp; 
     1292    pjsip_tx_data *tdata; 
     1293    pjsua_call *call; 
     1294    pjsip_dialog *dlg; 
     1295    pj_status_t status; 
     1296 
     1297    PJ_UNUSED_ARG(options); 
     1298 
     1299    PJ_ASSERT_RETURN(call_id>=0 && call_id<(int)pjsua_var.ua_cfg.max_calls, 
     1300                     PJ_EINVAL); 
     1301 
     1302    status = acquire_call("pjsua_call_update()", call_id, &call, &dlg); 
     1303    if (status != PJ_SUCCESS) 
     1304        return status; 
     1305 
     1306    /* Init media channel */ 
     1307    status = pjsua_media_channel_init(call->index, PJSIP_ROLE_UAC); 
     1308    if (status != PJ_SUCCESS) { 
     1309        pjsua_perror(THIS_FILE, "Error initializing media channel", status); 
     1310        pjsip_dlg_dec_lock(dlg); 
     1311        return PJSIP_ESESSIONSTATE; 
     1312    } 
     1313 
     1314    /* Create SDP */ 
     1315    status = pjsua_media_channel_create_sdp(call->index, call->inv->pool, &sdp); 
     1316    if (status != PJ_SUCCESS) { 
     1317        pjsua_perror(THIS_FILE, "Unable to get SDP from media endpoint",  
     1318                     status); 
     1319        pjsip_dlg_dec_lock(dlg); 
     1320        return status; 
     1321    } 
     1322 
     1323    /* Create re-INVITE with new offer */ 
     1324    status = pjsip_inv_update(call->inv, NULL, sdp, &tdata); 
     1325    if (status != PJ_SUCCESS) { 
     1326        pjsua_perror(THIS_FILE, "Unable to create UPDATE request", status); 
     1327        pjsip_dlg_dec_lock(dlg); 
     1328        return status; 
     1329    } 
     1330 
     1331    /* Add additional headers etc */ 
     1332    pjsua_process_msg_data( tdata, msg_data); 
     1333 
     1334    /* Send the request */ 
     1335    status = pjsip_inv_send_msg( call->inv, tdata); 
     1336    if (status != PJ_SUCCESS) { 
     1337        pjsua_perror(THIS_FILE, "Unable to send UPDAT Erequest", status); 
    12741338        pjsip_dlg_dec_lock(dlg); 
    12751339        return status; 
Note: See TracChangeset for help on using the changeset viewer.