Ignore:
Timestamp:
Oct 5, 2007 9:12:26 AM (17 years ago)
Author:
bennylp
Message:

Ticket #391: Added framework to send and receive arbitrary requests within call in PJSUA-LIB, with samples to send/receive DTMF with INFO in pjsua application

File:
1 edited

Legend:

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

    r1471 r1477  
    16531653    if (status != PJ_SUCCESS) { 
    16541654        pjsua_perror(THIS_FILE, "Unable to send MESSAGE request", status); 
     1655        goto on_return; 
     1656    } 
     1657 
     1658on_return: 
     1659    pjsip_dlg_dec_lock(dlg); 
     1660    return status; 
     1661} 
     1662 
     1663 
     1664/* 
     1665 * Send arbitrary request. 
     1666 */ 
     1667PJ_DEF(pj_status_t) pjsua_call_send_request(pjsua_call_id call_id, 
     1668                                            const pj_str_t *method_str, 
     1669                                            const pjsua_msg_data *msg_data) 
     1670{ 
     1671    pjsua_call *call; 
     1672    pjsip_dialog *dlg; 
     1673    pjsip_method method; 
     1674    pjsip_tx_data *tdata; 
     1675    pj_status_t status; 
     1676 
     1677    PJ_ASSERT_RETURN(call_id>=0 && call_id<(int)pjsua_var.ua_cfg.max_calls, 
     1678                     PJ_EINVAL); 
     1679 
     1680    status = acquire_call("pjsua_call_send_request", call_id, &call, &dlg); 
     1681    if (status != PJ_SUCCESS) 
     1682        return status; 
     1683 
     1684    /* Init method */ 
     1685    pjsip_method_init_np(&method, (pj_str_t*)method_str); 
     1686 
     1687    /* Create request message. */ 
     1688    status = pjsip_dlg_create_request( call->inv->dlg, &method, -1, &tdata); 
     1689    if (status != PJ_SUCCESS) { 
     1690        pjsua_perror(THIS_FILE, "Unable to create request", status); 
     1691        goto on_return; 
     1692    } 
     1693 
     1694    /* Add additional headers etc */ 
     1695    pjsua_process_msg_data( tdata, msg_data); 
     1696 
     1697    /* Send the request. */ 
     1698    status = pjsip_dlg_send_request( call->inv->dlg, tdata, -1, NULL); 
     1699    if (status != PJ_SUCCESS) { 
     1700        pjsua_perror(THIS_FILE, "Unable to send request", status); 
    16551701        goto on_return; 
    16561702    } 
     
    28462892    PJSUA_LOCK(); 
    28472893 
     2894    /* Notify application callback first */ 
     2895    if (pjsua_var.ua_cfg.cb.on_call_tsx_state) { 
     2896        (*pjsua_var.ua_cfg.cb.on_call_tsx_state)(call->index, tsx, e); 
     2897    } 
     2898 
    28482899    if (tsx->role==PJSIP_ROLE_UAS && 
    28492900        tsx->state==PJSIP_TSX_STATE_TRYING && 
Note: See TracChangeset for help on using the changeset viewer.