Ticket #817: pjsip-2421-sip_inv-on_rx_reinvite.patch
File pjsip-2421-sip_inv-on_rx_reinvite.patch, 2.9 KB (added by bennylp, 14 years ago) |
---|
-
pjsip/include/pjsip-ua/sip_inv.h
161 161 const pjmedia_sdp_session *offer); 162 162 163 163 /** 164 * This callback is optional, and is called when the invite session has 165 * received a re-INVITe from the peer. It overrides the on_rx_offer 166 * callback and works only for re-INVITEs. It allows more fine-grained 167 * control over the response to a re-INVITE, e.g. sending a provisional 168 * response first. Since UPDATE requests need to be answered immediately, 169 * any SDP offer received wihtin an UPDATE request still gets sent to 170 * on_rx_offer. Application may send a reply using the 171 * #pjsip_inv_initial_answer() and #pjsip_inv_answer() functions, as with 172 * the initial INVITE. 173 * 174 * @param inv The invite session. 175 * @param offer Remote offer. 176 * @param rdata The received re-INVITE request. 177 */ 178 void (*on_rx_reinvite)(pjsip_inv_session *inv, 179 const pjmedia_sdp_session *offer, pjsip_rx_data *rdata); 180 181 /** 164 182 * This callback is optional, and it is used to ask the application 165 183 * to create a fresh offer, when the invite session has received 166 184 * re-INVITE without offer. This offer then will be sent in the … … 602 620 pjsip_tx_data **p_tdata); 603 621 604 622 /** 605 * Create a response message to the initial INVITE request. This function 606 * can only be called for the initial INVITE request, as subsequent 607 * re-INVITE request will be answered automatically. 623 * Create a response message to an INVITE request. 608 624 * 609 625 * @param inv The UAS invite session. 610 626 * @param st_code The st_code contains the status code to be sent, -
pjsip/src/pjsip-ua/sip_inv.c
1568 1568 1569 1569 /* Inform application about remote offer. */ 1570 1570 1571 if (mod_inv.cb.on_rx_offer && inv->notify) { 1571 if (mod_inv.cb.on_rx_reinvite && inv->notify && 1572 msg->type == PJSIP_REQUEST_MSG && 1573 msg->line.req.method.id == PJSIP_INVITE_METHOD) { 1574 (*mod_inv.cb.on_rx_reinvite)(inv, rem_sdp, rdata); 1575 } 1576 else if (mod_inv.cb.on_rx_offer && inv->notify) { 1572 1577 1573 1578 (*mod_inv.cb.on_rx_offer)(inv, rem_sdp); 1574 1579 … … 1764 1769 1765 1770 /* 1766 1771 * Answer initial INVITE 1767 * Re-INVITE will be answered automatically, and will not use this function.1768 1772 */ 1769 1773 PJ_DEF(pj_status_t) pjsip_inv_answer( pjsip_inv_session *inv, 1770 1774 int st_code, … … 3596 3600 return; 3597 3601 } 3598 3602 3603 if (rdata->msg_info.msg->body != NULL && mod_inv.cb.on_rx_reinvite 3604 && inv->notify) { 3605 return; 3606 } 3607 3608 3599 3609 /* Create 2xx ANSWER */ 3600 3610 status = pjsip_dlg_create_response(dlg, rdata, 200, NULL, &tdata); 3601 3611 if (status != PJ_SUCCESS)