sorry for send email in html format. regards, Gang --- ../trunk/pjsip/src/pjsip-ua/sip_inv.c 2009-01-21 15:50:04.000000000 +0800 +++ trunk/pjsip/src/pjsip-ua/sip_inv.c 2009-01-21 15:55:21.000000000 +0800 @@ -3312,6 +3312,52 @@ inv_respond_incoming_cancel(inv, tsx, e->body.tsx_state.src.rdata); + } else if (inv->role == PJSIP_ROLE_UAS && + tsx->role == PJSIP_ROLE_UAS && + tsx->method.id == PJSIP_BYE_METHOD && + tsx->state < PJSIP_TSX_STATE_COMPLETED && + e->body.tsx_state.type == PJSIP_EVENT_RX_MSG ) + { + + /* RFC 3261 Section 15 */ + /* The caller's UA MAY send a BYE for either + * confirmed or early dialogs, and the callee's UA MAY send a BYE on + * confirmed dialogs, but MUST NOT send a BYE on early dialogs. + */ + /* + * Handle incoming BYE request. + */ + + inv_respond_incoming_bye(inv, tsx, e->body.tsx_state.src.rdata, e); + + if (inv->invite_tsx) + { + pjsip_transaction *invite_tsx; + + pj_mutex_lock(inv->invite_tsx->mutex); + + invite_tsx = inv->invite_tsx; + + if (invite_tsx->status_code < 200) + { + pjsip_tx_data *tdata; + pj_status_t status; + + pj_assert(invite_tsx->last_tx != NULL); + + tdata = invite_tsx->last_tx; + + status = pjsip_dlg_modify_response(inv->dlg, tdata, 487, NULL); + if (status == PJ_SUCCESS) + { + /* Remove the message body */ + tdata->msg->body = NULL; + pjsip_dlg_send_response(inv->dlg, invite_tsx, tdata); + } + } + pj_mutex_unlock(invite_tsx->mutex); + } + } else if (tsx->role == PJSIP_ROLE_UAS && tsx->state == PJSIP_TSX_STATE_TRYING && pjsip_method_cmp(&tsx->method, &pjsip_update_method)==0) -------------- next part -------------- A non-text attachment was scrubbed... Name: patch Type: application/octet-stream Size: 2176 bytes Desc: not available URL: <http://lists.pjsip.org/pipermail/pjsip_lists.pjsip.org/attachments/20090121/c1667955/attachment.obj>