#include "../tm/tm_load.h"
#include "dlg_state.h"
#include "../dialog/dlg_mod.h"
#include "sip.h"
Go to the source code of this file.
Defines | |
| #define | MAX_TIMES_TO_TRY_TO_RELEASE 5 |
Enumerations | |
| enum | release_call_situation { RELEASE_CALL_EARLY = 0, RELEASE_CALL_WEIRD = 1 } |
Functions | |
| int | P_release_call_onreply (struct sip_msg *msg, char *str1, char *str2) |
| Releases a call from the on reply route block called with any reply to an INVITE useful in cases of rejecting a call when you are processing the SDP or handling QoS things - the sip message being processed - the first parameter "orig" or "term" - [optional] the Reason header that you want to go to the messages. | |
| int | release_call (str callid, int reason_code, str reason_text) |
| Given a call-id, locate if its terminating,orginating or both release the dialog involved and drop the dialog. | |
| int | release_call_p (p_dialog *d, int reason_code, str reason_text) |
| Releases a dialog either confirmed or early the dialog is given with a lock on the hash! | |
| #define MAX_TIMES_TO_TRY_TO_RELEASE 5 |
Definition at line 74 of file release_call.h.
Referenced by release_call_confirmed(), release_call_previous(), release_call_s(), and release_subscription().
Definition at line 64 of file release_call.h.
00064 { 00065 RELEASE_CALL_EARLY=0, 00066 RELEASE_CALL_WEIRD=1 00067 /*Weird state is the technical name of the state in which a 00068 * sip session is when the callee has already sent a 200 OK for INVITE 00069 * and the caller hasn't yet recieved this response 00070 * In Weird state the session can only be released by sending an ACK followed 00071 * by a BYE to the callee and a reply >400 to the caller 00072 * a CANCEL wouldn't be understood by the callee!*/ 00073 };
| int P_release_call_onreply | ( | struct sip_msg * | msg, | |
| char * | str1, | |||
| char * | str2 | |||
| ) |
Releases a call from the on reply route block called with any reply to an INVITE useful in cases of rejecting a call when you are processing the SDP or handling QoS things - the sip message being processed - the first parameter "orig" or "term" - [optional] the Reason header that you want to go to the messages.
Definition at line 426 of file release_call.c.
References _488_text_s, cscf_get_call_id(), CSCF_RETURN_BREAK, CSCF_RETURN_FALSE, CSCF_RETURN_TRUE, d_unlock(), DLG_MOBILE_ORIGINATING, DLG_MOBILE_TERMINATING, get_p_dialog_dir(), _p_dialog::hash, is_p_dialog_dir(), M_NAME, NULL, RELEASE_CALL_EARLY, release_call_previous(), and RELEASE_CALL_WEIRD.
00427 { 00428 enum p_dialog_direction dir; 00429 p_dialog *d=NULL; 00430 str callid; 00431 struct hdr_field *h1; 00432 str reason={NULL,0}; 00433 00434 if (str2) { 00435 reason.s=str2; 00436 reason.len=strlen(str2); 00437 } else 00438 reason = _488_text_s; 00439 00440 00441 dir= (str1[0]=='o' || str1[0]=='O' || str1[0]=='0')? DLG_MOBILE_ORIGINATING : DLG_MOBILE_TERMINATING; 00442 00443 if (msg->first_line.type== SIP_REQUEST) 00444 { 00445 LOG(L_ERR,"ERR: P_release_call_on_reply called with a request\n"); 00446 return CSCF_RETURN_FALSE; 00447 } 00448 00449 callid=cscf_get_call_id(msg,&h1); 00450 if (is_p_dialog_dir(callid,dir)) { 00451 d=get_p_dialog_dir(callid,dir); 00452 if (msg->first_line.u.reply.statuscode > 199) 00453 { 00454 release_call_previous(d,RELEASE_CALL_WEIRD,488,reason); 00455 d_unlock(d->hash); 00456 return CSCF_RETURN_TRUE; 00457 } else { 00458 release_call_previous(d,RELEASE_CALL_EARLY,488,reason); 00459 d_unlock(d->hash); 00460 return CSCF_RETURN_TRUE; 00461 } 00462 } else { 00463 LOG(L_ERR,"ERR:"M_NAME "P_release_call_onreply : unable to find dialog\n"); 00464 return CSCF_RETURN_BREAK; 00465 } 00466 00467 }
| int release_call | ( | str | callid, | |
| int | reason_code, | |||
| str | reason_text | |||
| ) |
Given a call-id, locate if its terminating,orginating or both release the dialog involved and drop the dialog.
| callid | - the Call-ID to release | |
| reason | - the Reason header to include in messages |
Definition at line 386 of file release_call.c.
References d_unlock(), DLG_MOBILE_ORIGINATING, DLG_MOBILE_TERMINATING, get_p_dialog_dir(), _p_dialog::hash, and release_call_p().
00387 { 00388 p_dialog *d=0; 00389 unsigned int hash; 00390 int res = 0; 00391 00392 d = get_p_dialog_dir(callid,DLG_MOBILE_ORIGINATING); 00393 if (d) { 00394 hash = d->hash; 00395 if (release_call_p(d,reason_code,reason_text)>0) res = 1; 00396 goto done; 00397 } 00398 d = get_p_dialog_dir(callid,DLG_MOBILE_TERMINATING); 00399 if (d) { 00400 hash = d->hash; 00401 if (release_call_p(d,reason_code,reason_text)>0) res = 1; 00402 goto done; 00403 } 00404 00405 /*Neither ORGINATING nor TERMINATING is UNKNOWN!*/ 00406 /*or doesn't exist*/ 00407 /*drop it silently?*/ 00408 /*treat it as ORIGINATING or TERMINATING?*/ 00409 done: 00410 if (d) d_unlock(hash); 00411 return 0; 00412 }
| int release_call_p | ( | p_dialog * | d, | |
| int | reason_code, | |||
| str | reason_text | |||
| ) |
Releases a dialog either confirmed or early the dialog is given with a lock on the hash!
| d | - p_dialog to release | |
| reason | - Reason header to include in messages |
Definition at line 370 of file release_call.c.
References DLG_STATE_CONFIRMED, release_call_confirmed(), release_call_early(), and _p_dialog::state.
Referenced by release_call(), and terminate_p_dialog().
00371 { 00372 if (d->state>=DLG_STATE_CONFIRMED) 00373 return(release_call_confirmed(d,reason_code,reason_text)); 00374 else 00375 return(release_call_early(d,reason_code,reason_text)); 00376 }
1.5.2