/** * Given a call-id, locate if its terminating,orginating or both * release the dialog involved and drop the dialog * @param callid - the Call-ID to release * @param reason - the Reason header to include in messages * @returns 0 on error, 1 on success */ int release_call(str callid,str reason) { s_dialog *d=0; unsigned int hash; int res = 0; d = get_s_dialog_dir(callid,DLG_MOBILE_ORIGINATING); if (d) { hash = d->hash; if (release_call_s(d,reason)>0) res = 1; goto done; } d = get_s_dialog_dir(callid,DLG_MOBILE_TERMINATING); if (d) { hash = d->hash; if (release_call_s(d,reason)>0) res = 1; goto done; } /*Neither ORGINATING nor TERMINATING is UNKNOWN!*/ /*or doesn't exist*/ /*drop it silently?*/ /*treat it as ORIGINATING or TERMINATING?*/ done: if (d) d_unlock(hash); return res; }
/** * Terminates a dialog - called before del_s_dialog to send out terminatination messages. * @param d - the dialog to terminate * @returns - 1 if the requests were sent and the dialog will be deleted, 0 on error (you will have to delete the * dialog yourself!) */ int terminate_s_dialog(s_dialog *d) { switch (d->method){ case DLG_METHOD_INVITE: if (release_call_s(d)==-1){ //dialog has expired and not confirmed del_s_dialog(d); } return 1; break; case DLG_METHOD_SUBSCRIBE: LOG(L_ERR,"ERR:"M_NAME":terminate_s_dialog(): Not implemented yet for SUBSCRIBE dialogs!\n"); return 0; break; default: LOG(L_ERR,"ERR:"M_NAME":terminate_s_dialog(): Not implemented yet for method[%d]!\n",d->method); return 0; } }
/** * Terminates a dialog - called before del_s_dialog to send out terminatination messages. * @param d - the dialog to terminate * @returns - 1 if the requests were sent and the dialog will be deleted, 0 on error (you will have to delete the * dialog yourself!) */ int terminate_s_dialog(s_dialog *d) { if (!scscf_dialogs_enable_release) return 0; switch (d->method){ case DLG_METHOD_INVITE: if (release_call_s(d,Reason)<=0){ //dialog has expired and not confirmed // or error releasing dialog del_s_dialog(d); } return 1; break; case DLG_METHOD_SUBSCRIBE: if (!release_subscription(d)){ //error releasing the subscription - just drop silently del_s_dialog(d); } return 1; break; default: LOG(L_ERR,"ERR:"M_NAME":terminate_s_dialog(): Not implemented yet for method[%d]!\n",d->method); return 0; } }