Changeset 5185


Ignore:
Timestamp:
Oct 2, 2015 2:08:17 AM (9 years ago)
Author:
nanang
Message:

Close #1892: Add pjsua/pjsua2 callback on_call_tx_offer()/Call::onCallTxOffer() to notify incoming re-INVITE without offer.

Location:
pjproject/trunk/pjsip
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjsip/include/pjsua-lib/pjsua.h

    r5131 r5185  
    910910                             pjsip_status_code *code, 
    911911                             pjsua_call_setting *opt); 
     912 
     913 
     914    /** 
     915    * Notify application when call has received INVITE with no SDP offer. 
     916    * Application can update the call setting (e.g: add audio/video), or 
     917    * enable/disable codecs, or update other media session settings from 
     918    * within the callback, however, as mandated by the standard (RFC3261 
     919    * section 14.2), it must ensure that the update overlaps with the 
     920    * existing media session (in codecs, transports, or other parameters) 
     921    * that require support from the peer, this is to avoid the need for 
     922    * the peer to reject the offer. 
     923    * 
     924    * When this callback is not defined, the default behavior is to send 
     925    * SDP offer using current active media session (with all enabled codecs 
     926    * on each media type). 
     927    * 
     928    * @param call_id    The call index. 
     929    * @param reserved   Reserved param, currently not used. 
     930    * @param opt        The current call setting, application can update 
     931    *                   this setting for generating the offer. 
     932    */ 
     933    void (*on_call_tx_offer)(pjsua_call_id call_id, 
     934                             void *reserved, 
     935                             pjsua_call_setting *opt); 
     936 
    912937 
    913938    /** 
  • pjproject/trunk/pjsip/include/pjsua2/call.hpp

    r5165 r5185  
    852852 
    853853/** 
     854 * This structure contains parameters for Call::onCallTxOffer() callback. 
     855 */ 
     856struct OnCallTxOfferParam 
     857{ 
     858    /** 
     859     * The current call setting, application can update this setting for 
     860     * generating the offer. Note that application should maintain any 
     861     * active media to avoid the need for the peer to reject the offer. 
     862     */ 
     863    CallSetting         opt; 
     864}; 
     865 
     866/** 
    854867 * This structure contains parameters for Call::onCallRedirected() callback. 
    855868 */ 
     
    16011614     */ 
    16021615    virtual void onCallRxOffer(OnCallRxOfferParam &prm) 
     1616    { PJ_UNUSED_ARG(prm); } 
     1617     
     1618    /** 
     1619     * Notify application when call has received INVITE with no SDP offer. 
     1620     * Application can update the call setting (e.g: add audio/video), or 
     1621     * enable/disable codecs, or update other media session settings from 
     1622     * within the callback, however, as mandated by the standard (RFC3261 
     1623     * section 14.2), it must ensure that the update overlaps with the 
     1624     * existing media session (in codecs, transports, or other parameters) 
     1625     * that require support from the peer, this is to avoid the need for 
     1626     * the peer to reject the offer. 
     1627     * 
     1628     * When this callback is not implemented, the default behavior is to send 
     1629     * SDP offer using current active media session (with all enabled codecs 
     1630     * on each media type). 
     1631     * 
     1632     * @param prm       Callback parameter. 
     1633     */ 
     1634    virtual void onCallTxOffer(OnCallTxOfferParam &prm) 
    16031635    { PJ_UNUSED_ARG(prm); } 
    16041636     
  • pjproject/trunk/pjsip/include/pjsua2/endpoint.hpp

    r5165 r5185  
    13591359                                 pjsip_status_code *code, 
    13601360                                 pjsua_call_setting *opt); 
     1361    static void on_call_tx_offer(pjsua_call_id call_id, 
     1362                                 void *reserved, 
     1363                                 pjsua_call_setting *opt); 
    13611364    static pjsip_redirect_op on_call_redirected(pjsua_call_id call_id, 
    13621365                                                const pjsip_uri *target, 
  • pjproject/trunk/pjsip/src/pjsua-lib/pjsua_call.c

    r5170 r5185  
    41824182#endif 
    41834183 
     4184    if (pjsua_var.ua_cfg.cb.on_call_tx_offer) { 
     4185        cleanup_call_setting_flag(&call->opt); 
     4186        (*pjsua_var.ua_cfg.cb.on_call_tx_offer)(call->index, NULL, 
     4187                                                &call->opt); 
     4188    } 
     4189 
    41844190    /* We may need to re-initialize media before creating SDP */ 
    4185     if (call->med_prov_cnt == 0) { 
     4191    if (call->med_prov_cnt == 0 || pjsua_var.ua_cfg.cb.on_call_tx_offer) { 
    41864192        status = apply_call_setting(call, &call->opt, NULL); 
    41874193        if (status != PJ_SUCCESS) 
  • pjproject/trunk/pjsip/src/pjsua2/endpoint.cpp

    r5167 r5185  
    10741074} 
    10751075 
     1076void Endpoint::on_call_tx_offer(pjsua_call_id call_id, 
     1077                                void *reserved, 
     1078                                pjsua_call_setting *opt) 
     1079{ 
     1080    PJ_UNUSED_ARG(reserved); 
     1081 
     1082    Call *call = Call::lookup(call_id); 
     1083    if (!call) { 
     1084        return; 
     1085    } 
     1086 
     1087    OnCallTxOfferParam prm; 
     1088    prm.opt.fromPj(*opt); 
     1089 
     1090    call->onCallTxOffer(prm); 
     1091 
     1092    *opt = prm.opt.toPj(); 
     1093} 
     1094 
    10761095pjsip_redirect_op Endpoint::on_call_redirected(pjsua_call_id call_id, 
    10771096                                               const pjsip_uri *target, 
     
    12731292    ua_cfg.cb.on_call_replaced          = &Endpoint::on_call_replaced; 
    12741293    ua_cfg.cb.on_call_rx_offer          = &Endpoint::on_call_rx_offer; 
     1294    ua_cfg.cb.on_call_tx_offer          = &Endpoint::on_call_tx_offer; 
    12751295    ua_cfg.cb.on_call_redirected        = &Endpoint::on_call_redirected; 
    12761296    ua_cfg.cb.on_call_media_transport_state = 
Note: See TracChangeset for help on using the changeset viewer.