00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00056 #ifndef S_CSCF_DLG_STATE_H
00057 #define S_CSCF_DLG_STATE_H
00058
00059 #include "../../sr_module.h"
00060 #include "mod.h"
00061 #include "../../locking.h"
00062 #include "../tm/dlg.h"
00063
00065 enum s_dialog_method {
00066 DLG_METHOD_OTHER=0,
00067 DLG_METHOD_INVITE=1,
00068 DLG_METHOD_SUBSCRIBE=2
00069 };
00070
00072 #define DLG_METHOD_MAX DLG_METHOD_SUBSCRIBE
00073
00075 enum s_dialog_state {
00076 DLG_STATE_UNKNOWN=0,
00077 DLG_STATE_INITIAL=1,
00078 DLG_STATE_EARLY=2,
00079 DLG_STATE_CONFIRMED=3,
00080 DLG_STATE_TERMINATED_ONE_SIDE=4,
00081 DLG_STATE_TERMINATED=5
00082 };
00083
00085 enum s_dialog_direction {
00086 DLG_MOBILE_ORIGINATING=0,
00087 DLG_MOBILE_TERMINATING=1,
00088 DLG_MOBILE_UNKNOWN=2
00089 };
00090
00092 typedef struct _s_dialog {
00093 unsigned int hash;
00094 str call_id;
00095 enum s_dialog_direction direction;
00097 str aor;
00099 enum s_dialog_method method;
00100 str method_str;
00101 int first_cseq;
00102 int last_cseq;
00103 enum s_dialog_state state;
00104 time_t expires;
00105 time_t lr_session_expires;
00106 str refresher;
00107 unsigned char uac_supp_timer;
00109 str event;
00111 unsigned char is_releasing;
00114 dlg_t *dialog_c;
00115 dlg_t *dialog_s;
00117 struct _s_dialog *next;
00118 struct _s_dialog *prev;
00119 } s_dialog;
00120
00122 typedef struct {
00123 s_dialog *head;
00124 s_dialog *tail;
00125 gen_lock_t *lock;
00126 } s_dialog_hash_slot;
00127
00128
00129 inline unsigned int get_s_dialog_hash(str call_id);
00130
00131 int s_dialogs_init(int hash_size);
00132
00133 void s_dialogs_destroy();
00134
00135 inline void d_lock(unsigned int hash);
00136 inline void d_unlock(unsigned int hash);
00137
00138
00139 s_dialog* new_s_dialog(str call_id,str aor,enum s_dialog_direction dir);
00140 s_dialog* add_s_dialog(str call_id,str aor,enum s_dialog_direction dir);
00141 int is_s_dialog(str call_id,str aor,enum s_dialog_direction dir);
00142 int is_s_dialog_dir(str call_id,enum s_dialog_direction dir);
00143 s_dialog* get_s_dialog(str call_id,str aor);
00144 s_dialog* get_s_dialog_dir(str call_id,enum s_dialog_direction dir);
00145 s_dialog* get_s_dialog_dir_nolock(str call_id,enum s_dialog_direction dir);
00146 int terminate_s_dialog(s_dialog *d);
00147 void del_s_dialog(s_dialog *d);
00148 void free_s_dialog(s_dialog *d);
00149 void print_s_dialogs(int log_level);
00150 enum s_dialog_direction get_dialog_direction(char *direction);
00151
00152
00153 int S_is_in_dialog(struct sip_msg* msg, char* str1, char* str2);
00154
00155 int S_save_dialog(struct sip_msg* msg, char* str1, char* str2);
00156
00157 int S_update_dialog(struct sip_msg* msg, char* str1, char* str2);
00158
00159 int S_drop_dialog(struct sip_msg* msg, char* str1, char* str2);
00160
00161 int S_drop_all_dialogs(str aor);
00162
00163 int S_record_route(struct sip_msg *msg,char *user,char *str2);
00164
00165 int S_is_record_routed(struct sip_msg *msg,char *str1,char *str2);
00166
00167 void dialog_timer(unsigned int ticks, void* param);
00168
00169 int S_check_session_expires(struct sip_msg* msg, char* str1, char* str2);
00170
00171 int S_422_session_expires(struct sip_msg* msg, char* str1, char* str2);
00172
00173 #endif