pjsip_contact_hdr *contact;
pj_str_t tmp;
- if (pjsip_inv_end_session(session->inv_session, 302, NULL, &packet) != PJ_SUCCESS) {
+ if (pjsip_inv_end_session(session->inv_session, 302, NULL, &packet) != PJ_SUCCESS
+ || !packet) {
ast_log(LOG_WARNING, "Failed to redirect PJSIP session for channel %s\n",
ast_channel_name(session->channel));
message = AST_TRANSFER_FAILED;
ast_sip_session_add_datastore(session, datastore);
if (!(session->channel = chan_pjsip_new(session, AST_STATE_RING, session->exten, NULL, NULL, NULL, NULL))) {
- if (pjsip_inv_end_session(session->inv_session, 503, NULL, &packet) == PJ_SUCCESS) {
+ if (pjsip_inv_end_session(session->inv_session, 503, NULL, &packet) == PJ_SUCCESS
+ && packet) {
ast_sip_session_send_response(session, packet);
}
session->defer_terminate = 1;
ast_hangup(session->channel);
- if (pjsip_inv_end_session(session->inv_session, response, NULL, &packet) == PJ_SUCCESS) {
+ if (pjsip_inv_end_session(session->inv_session, response, NULL, &packet) == PJ_SUCCESS
+ && packet) {
ast_sip_session_send_response(session, packet);
}
} else {
}
if (tsx->status_code != 488) {
/* Other reinvite failures (except 488) result in destroying the session. */
- if (pjsip_inv_end_session(inv, 500, NULL, &tdata) == PJ_SUCCESS) {
+ if (pjsip_inv_end_session(inv, 500, NULL, &tdata) == PJ_SUCCESS
+ && tdata) {
ast_sip_session_send_request(session, tdata);
}
}
* a cancelled call. Our role is to immediately send a BYE to end the
* dialog.
*/
- if (pjsip_inv_end_session(inv, 500, NULL, &tdata) == PJ_SUCCESS) {
+ if (pjsip_inv_end_session(inv, 500, NULL, &tdata) == PJ_SUCCESS
+ && tdata) {
ast_sip_session_send_request(session, tdata);
}
}