Definition in file dlg_state.c.
#include <time.h>
#include "dlg_state.h"
#include "../tm/tm_load.h"
#include "../sl/sl_funcs.h"
#include "../../mem/shm_mem.h"
#include "../../parser/parse_rr.h"
#include "sip.h"
#include "release_call.h"
#include "ims_pm.h"
Go to the source code of this file.
Defines | |
| #define | strtotime(src, dest) |
| #define | FParam_INT(val) |
| #define | FParam_STRING(val) |
| #define | h_inc h+=v^(v>>3) |
Functions | |
| int | supports_extension (struct sip_msg *m, str *extension) |
| int | requires_extension (struct sip_msg *m, str *extension) |
| unsigned int | get_s_dialog_hash (str call_id) |
| Computes the hash for a string. | |
| int | s_dialogs_init (int hash_size) |
| Initialize the S-CSCF dialogs registrar. | |
| void | s_dialogs_destroy () |
| Destroy the registrar. | |
| void | d_lock (unsigned int hash) |
| Locks the required part of the hash table. | |
| void | d_unlock (unsigned int hash) |
| UnLocks the required part of the hash table. | |
| int | d_act_time () |
| Refresh the current dialog time. | |
| void | s_dialog_count_lock () |
| Locks the dialog counter variable. | |
| void | s_dialog_count_unlock () |
| UnLocks the dialog counter variable. | |
| int | s_dialog_count_increment () |
| Try to increment the dialog count. | |
| void | s_dialog_count_decrement () |
| Decrement the dialog count. | |
| s_dialog * | new_s_dialog (str call_id, str aor, enum s_dialog_direction dir) |
| Creates a new s_dialog structure. | |
| s_dialog * | add_s_dialog (str call_id, str aor, enum s_dialog_direction dir) |
| Creates and adds a dialog to the hash table. | |
| int | is_s_dialog (str call_id, str aor, enum s_dialog_direction dir) |
| Finds out if a dialog is in the hash table. | |
| int | is_s_dialog_dir (str call_id, enum s_dialog_direction dir) |
| Finds out if a dialog is in the hash table. | |
| s_dialog * | get_s_dialog (str call_id, str aor) |
| Finds and returns a dialog from the hash table. | |
| s_dialog * | get_s_dialog_dir (str call_id, enum s_dialog_direction dir) |
| Finds and returns a dialog from the hash table. | |
| s_dialog * | get_s_dialog_dir_nolock (str call_id, enum s_dialog_direction dir) |
| Finds and returns a dialog from the hash table. | |
| int | terminate_s_dialog (s_dialog *d) |
| Terminates a dialog - called before del_s_dialog to send out terminatination messages. | |
| void | del_s_dialog (s_dialog *d) |
| Deletes a dialog from the hash table. | |
| void | free_s_dialog (s_dialog *d) |
| Frees a dialog. | |
| void | print_s_dialogs (int log_level) |
| Prints the list of dialogs. | |
| enum s_dialog_direction | get_dialog_direction (char *direction) |
| Returns the s_dialog_direction from the direction string. | |
| static int | find_dialog_aor (struct sip_msg *msg, enum s_dialog_direction d, str *aor) |
| Finds the AOR for a dialog. | |
| static enum s_dialog_direction | find_dialog_route_dir (struct sip_msg *msg) |
| Find the dialog direction from the first Route header. | |
| int | S_is_in_dialog (struct sip_msg *msg, char *str1, char *str2) |
| Find out if a message is within a saved dialog. | |
| static enum s_dialog_method | get_dialog_method (str method) |
| Return s_dialog_method for a method string. | |
| int | S_422_session_expires (struct sip_msg *msg, char *str1, char *str2) |
| Send a 422 Session Interval Too Small. | |
| int | S_check_session_expires (struct sip_msg *msg, char *str1, char *str2) |
| Checks if Session-Expires value is over Min_SE local policy. | |
| int | S_save_dialog (struct sip_msg *msg, char *str1, char *str2) |
| Saves a dialog. | |
| int | update_dialog_on_reply (struct sip_msg *msg, s_dialog *d) |
| Updates dialog on reply message. | |
| int | S_update_dialog (struct sip_msg *msg, char *str1, char *str2) |
| Updates a dialog. | |
| int | S_drop_dialog (struct sip_msg *msg, char *str1, char *str2) |
| Drops and deletes a dialog. | |
| int | S_drop_all_dialogs (str aor) |
| Drop all dialogs belonging to one AOR. | |
| int | S_record_route (struct sip_msg *msg, char *str1, char *str2) |
| Record routes, with given user as parameter. | |
| int | S_is_record_routed (struct sip_msg *msg, char *str1, char *str2) |
| Check if we already did record-route. | |
| void | dialog_timer (unsigned int ticks, void *param) |
| The dialog timer looks for expired dialogs and removes them. | |
Variables | |
| tm_binds | tmb |
| Structure with pointers to tm funcs. | |
| int | s_dialogs_hash_size |
| size of the dialog hash table | |
| s_dialog_hash_slot * | s_dialogs = 0 |
| the hash table | |
| int | scscf_dialogs_expiration_time |
| default expiration time for dialogs | |
| int | scscf_dialogs_enable_release |
| if to enable dialog release | |
| str | scscf_name_str |
| fixed name of the S-CSCF | |
| str | scscf_record_route_mo |
| the record route header for Mobile Originating | |
| str | scscf_record_route_mt |
| the record route header for Mobile Terminating | |
| str | scscf_record_route_mo_uri |
| just the record route uri for Mobile Originating | |
| str | scscf_record_route_mt_uri |
| just the record route uri for Mobile Terminating | |
| time_t | d_time_now |
| dialogs current time | |
| int | scscf_min_se |
| Minimum session-expires accepted value. | |
| int(*) | sl_reply (struct sip_msg *_msg, char *_str1, char *_str2) |
| link to the stateless reply function in sl module | |
| int * | scscf_dialog_count |
| Counter for saved dialogs. | |
| int | scscf_max_dialog_count |
| Maximum number of dialogs. | |
| gen_lock_t * | scscf_dialog_count_lock |
| Lock for the dialog counter. | |
| static str | Reason = {"Reason: SIP ;cause=503 ;text=\"Session Time-out on S-CSCF\"\r\n",59} |
| str | s_OTHER = {"<OTHER>",7} |
| str | s_INVITE = {"INVITE",6} |
| str | s_SUBSCRIBE = {"SUBSCRIBE",9} |
| static fparam_t | fp_422 = FParam_INT(422) |
| static fparam_t | fp_se_small = FParam_STRING("Session Interval Too Small") |
| static str | s_refresher = {"refresher=", 10} |
| static str | str_ext_timer = {"timer", 5} |
| static str | str_min_se = {"Min-SE:",7} |
| static str | str_se = {"Session-Expires:",16} |
| static str | str_require = {"Require:",8} |
| static str | s_record_route_s = {"Record-Route: <",15} |
| static str | s_record_route_e = {";lr>\r\n",6} |
| #define strtotime | ( | src, | |||
| dest | ) |
Value:
{\
int i;\
(dest)=0;\
for(i=0;i<(src).len;i++)\
if ((src).s[i]>='0' && (src).s[i]<='9')\
(dest) = (dest)*10 + (src).s[i] -'0';\
}
Definition at line 90 of file dlg_state.c.
| #define FParam_INT | ( | val | ) |
Value:
{ \
.v = { \
.i = val \
},\
.type = FPARAM_INT, \
.orig = "int_value", \
};
Definition at line 99 of file dlg_state.c.
| #define FParam_STRING | ( | val | ) |
Value:
{ \
.v = { \
.str = STR_STATIC_INIT(val) \
},\
.type = FPARAM_STR, \
.orig = val, \
};
Definition at line 107 of file dlg_state.c.
| #define h_inc h+=v^(v>>3) |
| int supports_extension | ( | struct sip_msg * | m, | |
| str * | extension | |||
| ) |
| int requires_extension | ( | struct sip_msg * | m, | |
| str * | extension | |||
| ) |
| unsigned int get_s_dialog_hash | ( | str | call_id | ) | [inline] |
Computes the hash for a string.
| call_id | - the string to compute for |
Definition at line 121 of file dlg_state.c.
References h_inc, and s_dialogs_hash_size.
Referenced by bin_decode_s_dialog(), get_s_dialog(), get_s_dialog_dir(), get_s_dialog_dir_nolock(), is_s_dialog(), is_s_dialog_dir(), and new_s_dialog().
00122 { 00123 if (call_id.len==0) return 0; 00124 #define h_inc h+=v^(v>>3) 00125 char* p; 00126 register unsigned v; 00127 register unsigned h; 00128 00129 h=0; 00130 for (p=call_id.s; p<=(call_id.s+call_id.len-4); p+=4){ 00131 v=(*p<<24)+(p[1]<<16)+(p[2]<<8)+p[3]; 00132 h_inc; 00133 } 00134 v=0; 00135 for (;p<(call_id.s+call_id.len); p++) { 00136 v<<=8; 00137 v+=*p; 00138 } 00139 h_inc; 00140 00141 h=((h)+(h>>11))+((h>>13)+(h>>23)); 00142 return (h)%s_dialogs_hash_size; 00143 #undef h_inc 00144 }
| int s_dialogs_init | ( | int | hash_size | ) |
Initialize the S-CSCF dialogs registrar.
| hash_size | - size of the dialog hash table |
Definition at line 151 of file dlg_state.c.
References s_dialog_hash_slot::lock, M_NAME, s_dialogs, and s_dialogs_hash_size.
Referenced by mod_init().
00152 { 00153 int i; 00154 00155 s_dialogs_hash_size = hash_size; 00156 s_dialogs = shm_malloc(sizeof(s_dialog_hash_slot)*s_dialogs_hash_size); 00157 00158 if (!s_dialogs) return 0; 00159 00160 memset(s_dialogs,0,sizeof(s_dialog_hash_slot)*s_dialogs_hash_size); 00161 00162 for(i=0;i<s_dialogs_hash_size;i++){ 00163 s_dialogs[i].lock = lock_alloc(); 00164 if (!s_dialogs[i].lock){ 00165 LOG(L_ERR,"ERR:"M_NAME":d_hash_table_init(): Error creating lock\n"); 00166 return 0; 00167 } 00168 s_dialogs[i].lock = lock_init(s_dialogs[i].lock); 00169 } 00170 00171 return 1; 00172 }
| void s_dialogs_destroy | ( | ) |
Destroy the registrar.
Definition at line 177 of file dlg_state.c.
References d_lock(), d_unlock(), free_s_dialog(), s_dialog_hash_slot::head, _s_dialog::next, s_dialogs, and s_dialogs_hash_size.
Referenced by mod_destroy().
00178 { 00179 int i; 00180 s_dialog *d,*nd; 00181 for(i=0;i<s_dialogs_hash_size;i++){ 00182 d_lock(i); 00183 d = s_dialogs[i].head; 00184 while(d){ 00185 nd = d->next; 00186 free_s_dialog(d); 00187 d = nd; 00188 } 00189 d_unlock(i); 00190 lock_dealloc(s_dialogs[i].lock); 00191 } 00192 shm_free(s_dialogs); 00193 }
| void d_lock | ( | unsigned int | hash | ) | [inline] |
Locks the required part of the hash table.
| hash | - index of the slot to lock |
Definition at line 199 of file dlg_state.c.
References p_dialogs, and s_dialogs.
00200 { 00201 // LOG(L_CRIT,"GET %d\n",hash); 00202 lock_get(s_dialogs[(hash)].lock); 00203 // LOG(L_CRIT,"GOT %d\n",hash); 00204 }
| void d_unlock | ( | unsigned int | hash | ) | [inline] |
UnLocks the required part of the hash table.
| hash | - index of the slot to unlock |
Definition at line 210 of file dlg_state.c.
References p_dialogs, and s_dialogs.
00211 { 00212 lock_release(s_dialogs[(hash)].lock); 00213 // LOG(L_CRIT,"RELEASED %d\n",hash); 00214 }
| int d_act_time | ( | ) | [inline] |
Refresh the current dialog time.
Definition at line 220 of file dlg_state.c.
References d_time_now.
00221 { 00222 d_time_now=time(0); 00223 return d_time_now; 00224 }
| void s_dialog_count_lock | ( | ) | [inline] |
Locks the dialog counter variable.
Definition at line 233 of file dlg_state.c.
References scscf_dialog_count_lock.
Referenced by s_dialog_count_decrement(), and s_dialog_count_increment().
00234 { 00235 lock_get(scscf_dialog_count_lock); 00236 }
| void s_dialog_count_unlock | ( | ) | [inline] |
UnLocks the dialog counter variable.
Definition at line 241 of file dlg_state.c.
References scscf_dialog_count_lock.
Referenced by s_dialog_count_decrement(), and s_dialog_count_increment().
00242 { 00243 lock_release(scscf_dialog_count_lock); 00244 }
| int s_dialog_count_increment | ( | ) | [inline] |
Try to increment the dialog count.
Definition at line 251 of file dlg_state.c.
References M_NAME, s_dialog_count_lock(), s_dialog_count_unlock(), scscf_dialog_count, and scscf_max_dialog_count.
Referenced by new_s_dialog().
00252 { 00253 if (scscf_max_dialog_count<0) return 1; 00254 s_dialog_count_lock(); 00255 if (*scscf_dialog_count<scscf_max_dialog_count){ 00256 (*scscf_dialog_count)++; 00257 s_dialog_count_unlock(); 00258 return 1; 00259 } else { 00260 s_dialog_count_unlock(); 00261 return 0; 00262 } 00263 LOG(L_DBG,"DBG:"M_NAME":s_dialog_count_increment(): P-CSCF Dialog counter value is %d\n", *scscf_dialog_count); 00264 }
| void s_dialog_count_decrement | ( | ) | [inline] |
Decrement the dialog count.
Definition at line 269 of file dlg_state.c.
References M_NAME, s_dialog_count_lock(), s_dialog_count_unlock(), scscf_dialog_count, and scscf_max_dialog_count.
Referenced by free_s_dialog(), and new_s_dialog().
00270 { 00271 if (scscf_max_dialog_count<0) return ; 00272 s_dialog_count_lock(); 00273 (*scscf_dialog_count)--; 00274 s_dialog_count_unlock(); 00275 LOG(L_DBG,"DBG:"M_NAME":s_dialog_count_decrement(): P-CSCF Dialog counter value is %d\n", *scscf_dialog_count); 00276 }
| s_dialog* new_s_dialog | ( | str | call_id, | |
| str | aor, | |||
| enum s_dialog_direction | dir | |||
| ) |
Creates a new s_dialog structure.
Does not add the structure to the list
| call_id | - call_id of the dialog | |
| aor | - aor of the user | |
| dir | - the direction |
Definition at line 287 of file dlg_state.c.
References _s_dialog::aor, _s_dialog::call_id, _s_dialog::direction, get_s_dialog_hash(), _s_dialog::hash, _s_dialog::is_releasing, M_NAME, s_dialog_count_decrement(), s_dialog_count_increment(), and STR_SHM_DUP.
Referenced by add_s_dialog().
00288 { 00289 s_dialog *d; 00290 00291 if (!s_dialog_count_increment()) return 0; 00292 d = shm_malloc(sizeof(s_dialog)); 00293 if (!d) { 00294 LOG(L_ERR,"ERR:"M_NAME":new_s_dialog(): Unable to alloc %d bytes\n", 00295 sizeof(s_dialog)); 00296 goto error; 00297 } 00298 memset(d,0,sizeof(s_dialog)); 00299 00300 d->hash = get_s_dialog_hash(call_id); 00301 STR_SHM_DUP(d->call_id,call_id,"shm"); 00302 STR_SHM_DUP(d->aor,aor,"shm"); 00303 d->direction = dir; 00304 d->is_releasing = 0; 00305 return d; 00306 error: 00307 out_of_memory: 00308 if (d){ 00309 shm_free(d); 00310 } 00311 s_dialog_count_decrement(); 00312 return 0; 00313 }
| s_dialog* add_s_dialog | ( | str | call_id, | |
| str | aor, | |||
| enum s_dialog_direction | dir | |||
| ) |
Creates and adds a dialog to the hash table.
make sure that is_s_dialog(call_id) returns 0 or there will be unreachable duplicates!
| call_id | - call_id of the dialog | |
| aor | - aor of the user | |
| dir | - the direction |
Definition at line 324 of file dlg_state.c.
References d_lock(), _s_dialog::hash, s_dialog_hash_slot::head, new_s_dialog(), _s_dialog::next, _s_dialog::prev, s_dialogs, and s_dialog_hash_slot::tail.
Referenced by S_save_dialog().
00325 { 00326 s_dialog *d; 00327 00328 d = new_s_dialog(call_id,aor,dir); 00329 if (!d) return 0; 00330 00331 d_lock(d->hash); 00332 d->next = 0; 00333 d->prev = s_dialogs[d->hash].tail; 00334 if (d->prev) d->prev->next = d; 00335 s_dialogs[d->hash].tail = d; 00336 if (!s_dialogs[d->hash].head) s_dialogs[d->hash].head = d; 00337 00338 return d; 00339 }
| int is_s_dialog | ( | str | call_id, | |
| str | aor, | |||
| enum s_dialog_direction | dir | |||
| ) |
Finds out if a dialog is in the hash table.
| call_id | - call_id of the dialog | |
| aor | - aor of the user |
Definition at line 347 of file dlg_state.c.
References _s_dialog::aor, _s_dialog::call_id, d_lock(), d_unlock(), _s_dialog::direction, get_s_dialog_hash(), s_dialog_hash_slot::head, _s_dialog::next, and s_dialogs.
Referenced by S_save_dialog().
00348 { 00349 s_dialog *d=0; 00350 unsigned int hash = get_s_dialog_hash(call_id); 00351 00352 d_lock(hash); 00353 d = s_dialogs[hash].head; 00354 while(d){ 00355 if (d->direction == dir && 00356 d->aor.len == aor.len && 00357 d->call_id.len == call_id.len && 00358 strncasecmp(d->aor.s,aor.s,aor.len)==0 && 00359 strncasecmp(d->call_id.s,call_id.s,call_id.len)==0) { 00360 d_unlock(hash); 00361 return 1; 00362 } 00363 d = d->next; 00364 } 00365 d_unlock(hash); 00366 return 0; 00367 }
| int is_s_dialog_dir | ( | str | call_id, | |
| enum s_dialog_direction | dir | |||
| ) |
Finds out if a dialog is in the hash table.
| call_id | - call_id of the dialog | |
| dir | - the direction |
Definition at line 375 of file dlg_state.c.
References _s_dialog::call_id, d_lock(), d_unlock(), _s_dialog::direction, get_s_dialog_hash(), s_dialog_hash_slot::head, _s_dialog::next, and s_dialogs.
Referenced by S_is_in_dialog().
00376 { 00377 s_dialog *d=0; 00378 unsigned int hash = get_s_dialog_hash(call_id); 00379 00380 d_lock(hash); 00381 d = s_dialogs[hash].head; 00382 while(d){ 00383 if (d->direction == dir && 00384 d->call_id.len == call_id.len && 00385 strncasecmp(d->call_id.s,call_id.s,call_id.len)==0) { 00386 d_unlock(hash); 00387 return 1; 00388 } 00389 d = d->next; 00390 } 00391 d_unlock(hash); 00392 return 0; 00393 }
| s_dialog* get_s_dialog | ( | str | call_id, | |
| str | aor | |||
| ) |
Finds and returns a dialog from the hash table.
| call_id | - call_id of the dialog | |
| aor | - aor of the user |
Definition at line 402 of file dlg_state.c.
References _s_dialog::aor, _s_dialog::call_id, d_lock(), d_unlock(), get_s_dialog_hash(), s_dialog_hash_slot::head, _s_dialog::next, and s_dialogs.
00403 { 00404 s_dialog *d=0; 00405 unsigned int hash = get_s_dialog_hash(call_id); 00406 00407 d_lock(hash); 00408 d = s_dialogs[hash].head; 00409 while(d){ 00410 if (d->aor.len == aor.len && 00411 d->call_id.len == call_id.len && 00412 strncasecmp(d->aor.s,aor.s,aor.len)==0 && 00413 strncasecmp(d->call_id.s,call_id.s,call_id.len)==0) { 00414 return d; 00415 } 00416 d = d->next; 00417 } 00418 d_unlock(hash); 00419 return 0; 00420 }
| s_dialog* get_s_dialog_dir | ( | str | call_id, | |
| enum s_dialog_direction | dir | |||
| ) |
Finds and returns a dialog from the hash table.
| call_id | - call_id of the dialog | |
| dir | - the direction |
Definition at line 429 of file dlg_state.c.
References _s_dialog::call_id, d_lock(), d_unlock(), _s_dialog::direction, get_s_dialog_hash(), s_dialog_hash_slot::head, _s_dialog::next, and s_dialogs.
Referenced by confirmed_response(), release_call(), S_drop_dialog(), and S_update_dialog().
00430 { 00431 s_dialog *d=0; 00432 unsigned int hash = get_s_dialog_hash(call_id); 00433 00434 d_lock(hash); 00435 d = s_dialogs[hash].head; 00436 while(d){ 00437 if (d->direction == dir && 00438 d->call_id.len == call_id.len && 00439 strncasecmp(d->call_id.s,call_id.s,call_id.len)==0) { 00440 return d; 00441 } 00442 d = d->next; 00443 } 00444 d_unlock(hash); 00445 return 0; 00446 }
| s_dialog* get_s_dialog_dir_nolock | ( | str | call_id, | |
| enum s_dialog_direction | dir | |||
| ) |
Finds and returns a dialog from the hash table.
| call_id | - call_id of the dialog | |
| dir | - the direction |
Definition at line 455 of file dlg_state.c.
References _s_dialog::call_id, _s_dialog::direction, get_s_dialog_hash(), s_dialog_hash_slot::head, _s_dialog::next, and s_dialogs.
Referenced by release_call_s().
00456 { 00457 s_dialog *d=0; 00458 unsigned int hash = get_s_dialog_hash(call_id); 00459 00460 d = s_dialogs[hash].head; 00461 while(d){ 00462 if (d->direction == dir && 00463 d->call_id.len == call_id.len && 00464 strncasecmp(d->call_id.s,call_id.s,call_id.len)==0) { 00465 return d; 00466 } 00467 d = d->next; 00468 } 00469 return 0; 00470 }
| int terminate_s_dialog | ( | s_dialog * | d | ) |
Terminates a dialog - called before del_s_dialog to send out terminatination messages.
| d | - the dialog to terminate |
Definition at line 479 of file dlg_state.c.
References del_s_dialog(), DLG_METHOD_INVITE, DLG_METHOD_SUBSCRIBE, M_NAME, _s_dialog::method, Reason, release_call_s(), release_subscription(), and scscf_dialogs_enable_release.
Referenced by dialog_timer(), and S_drop_all_dialogs().
00480 { 00481 if (!scscf_dialogs_enable_release) return 0; 00482 switch (d->method){ 00483 case DLG_METHOD_INVITE: 00484 if (release_call_s(d,Reason)<=0){ 00485 //dialog has expired and not confirmed 00486 // or error releasing dialog 00487 del_s_dialog(d); 00488 } 00489 return 1; 00490 break; 00491 case DLG_METHOD_SUBSCRIBE: 00492 if (!release_subscription(d)){ 00493 //error releasing the subscription - just drop silently 00494 del_s_dialog(d); 00495 } 00496 return 1; 00497 break; 00498 default: 00499 LOG(L_ERR,"ERR:"M_NAME":terminate_s_dialog(): Not implemented yet for method[%d]!\n",d->method); 00500 return 0; 00501 } 00502 }
| void del_s_dialog | ( | s_dialog * | d | ) |
Deletes a dialog from the hash table.
| d | - the dialog to delete |
Definition at line 509 of file dlg_state.c.
References _s_dialog::call_id, _s_dialog::direction, free_s_dialog(), _s_dialog::hash, s_dialog_hash_slot::head, M_NAME, _s_dialog::next, _s_dialog::prev, s_dialogs, and s_dialog_hash_slot::tail.
Referenced by confirmed_response(), dialog_timer(), release_subscription(), S_drop_all_dialogs(), S_drop_dialog(), S_save_dialog(), and terminate_s_dialog().
00510 { 00511 LOG(L_INFO,"DBG:"M_NAME":del_s_dialog(): Deleting dialog <%.*s> DIR[%d]\n",d->call_id.len,d->call_id.s,d->direction); 00512 if (d->prev) d->prev->next = d->next; 00513 else s_dialogs[d->hash].head = d->next; 00514 if (d->next) d->next->prev = d->prev; 00515 else s_dialogs[d->hash].tail = d->prev; 00516 free_s_dialog(d); 00517 }
| void free_s_dialog | ( | s_dialog * | d | ) |
Frees a dialog.
| d | - the dialog to delete |
Definition at line 524 of file dlg_state.c.
References _s_dialog::aor, _s_dialog::call_id, _s_dialog::dialog_c, _s_dialog::dialog_s, _s_dialog::event, _s_dialog::method_str, _s_dialog::refresher, s_dialog_count_decrement(), and tmb.
Referenced by del_s_dialog(), and s_dialogs_destroy().
00525 { 00526 if (!d) return; 00527 if (d->call_id.s) shm_free(d->call_id.s); 00528 if (d->aor.s) shm_free(d->aor.s); 00529 if (d->method_str.s) shm_free(d->method_str.s); 00530 if (d->dialog_s) tmb.free_dlg(d->dialog_s); 00531 if (d->dialog_c) tmb.free_dlg(d->dialog_c); 00532 if (d->refresher.s) shm_free(d->refresher.s); 00533 if (d->event.s) shm_free(d->event.s); 00534 shm_free(d); 00535 s_dialog_count_decrement(); 00536 }
| void print_s_dialogs | ( | int | log_level | ) |
Prints the list of dialogs.
| log_level | - level to log at |
Definition at line 542 of file dlg_state.c.
References ANSI_BLUE, ANSI_GREEN, ANSI_MAGENTA, ANSI_RED, _s_dialog::aor, _s_dialog::call_id, d_act_time(), d_lock(), d_time_now, d_unlock(), _s_dialog::direction, _s_dialog::event, _s_dialog::expires, s_dialog_hash_slot::head, M_NAME, _s_dialog::method, _s_dialog::next, _s_dialog::refresher, s_dialogs, s_dialogs_hash_size, and _s_dialog::state.
Referenced by S_drop_dialog(), S_save_dialog(), and S_update_dialog().
00543 { 00544 s_dialog *d; 00545 int i; 00546 if (debug<log_level) return; /* to avoid useless calls when nothing will be printed */ 00547 d_act_time(); 00548 LOG(log_level,"INF:"M_NAME":---------- S-CSCF Dialog List begin --------------\n"); 00549 for(i=0;i<s_dialogs_hash_size;i++){ 00550 d_lock(i); 00551 d = s_dialogs[i].head; 00552 while(d){ 00553 LOG(log_level,"INF:"M_NAME":[%4d] Dir["ANSI_MAGENTA"%d"ANSI_GREEN 00554 "] Call-ID:<"ANSI_BLUE"%.*s"ANSI_GREEN 00555 "> AOR:<"ANSI_RED"%.*s"ANSI_GREEN 00556 ">\n",i, 00557 d->direction, 00558 d->call_id.len,d->call_id.s, 00559 d->aor.len,d->aor.s); 00560 LOG(log_level,"INF:"M_NAME":\t\tMethod:["ANSI_MAGENTA"%d"ANSI_GREEN 00561 "] State:["ANSI_MAGENTA"%d"ANSI_GREEN 00562 "] Exp:["ANSI_MAGENTA"%4d"ANSI_GREEN"] Ref:["ANSI_MAGENTA"%.*s"ANSI_GREEN"] Event:["ANSI_MAGENTA"%.*s"ANSI_GREEN"]\n", 00563 d->method, 00564 d->state, 00565 (int)(d->expires - d_time_now), 00566 d->refresher.len,d->refresher.s, 00567 d->event.len,d->event.s); 00568 00569 d = d->next; 00570 } 00571 d_unlock(i); 00572 } 00573 LOG(log_level,"INF:"M_NAME":---------- S-CSCF Dialog List end --------------\n"); 00574 }
| enum s_dialog_direction get_dialog_direction | ( | char * | direction | ) |
Returns the s_dialog_direction from the direction string.
| direction | - "orig" or "term" |
Definition at line 583 of file dlg_state.c.
References DLG_MOBILE_ORIGINATING, DLG_MOBILE_TERMINATING, DLG_MOBILE_UNKNOWN, and M_NAME.
00584 { 00585 switch(direction[0]){ 00586 case 'o': 00587 case 'O': 00588 case '0': 00589 return DLG_MOBILE_ORIGINATING; 00590 case 't': 00591 case 'T': 00592 case '1': 00593 return DLG_MOBILE_TERMINATING; 00594 default: 00595 LOG(L_CRIT,"ERR:"M_NAME":get_dialog_direction(): Unknown direction %s",direction);