Thanks Gang. I didn't realize that we don't handle BYE on early stage. Let me put this in my queue for now. cheers Benny On Wed, Jan 21, 2009 at 8:29 AM, Gang Liu <gangban.lau at gmail.com> wrote: > 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) > > _______________________________________________ > Visit our blog: http://blog.pjsip.org > > pjsip mailing list > pjsip at lists.pjsip.org > http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org > > -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.pjsip.org/pipermail/pjsip_lists.pjsip.org/attachments/20090126/8bc8da3e/attachment.html>