Data Structures | Functions | Variables

ring.c File Reference

SIP-utils :: Only allow one 183 message per call-id

More...

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>
#include "../../parser/msg_parser.h"
#include "../../dprint.h"
#include "../../error.h"
#include "../../ut.h"
#include "../../mem/mem.h"
#include "../../mem/shm_mem.h"
#include "../../timer.h"
#include "../../locking.h"
#include "../../md5.h"
#include "config.h"
#include "ring.h"
Include dependency graph for ring.c:

Go to the source code of this file.

Data Structures

Functions

Variables


Detailed Description

UTILS :: Ringing functionality

In a parallel forking scenario you may get several 183s with SDP. You don't want that your customers hear more than one ringtone or answer machine in parallel on the phone. So its necessary to drop the 183 in these cases and send a 180 instead.

Definition in file ring.c.


Function Documentation

static int contains ( str  callid  )  [static]
Parameters:
callid Call-ID that is searched
Returns:
1 when callid could be found, 0 when not found

Definition at line 227 of file ring.c.

References ring_record_t::callid, hash(), _str::len, remove_timeout(), and _str::s.

Referenced by ring_filter(), and ring_insert_callid().

Here is the call graph for this function:

Here is the caller graph for this function:

static int conv183 ( struct sip_msg msg  )  [static]
Parameters:
msg SIP message

Definition at line 247 of file ring.c.

References sip_msg::buf, sip_msg::first_line, sip_msg::len, and sip_msg::unparsed.

Referenced by ring_filter().

Here is the caller graph for this function:

static unsigned int hash ( char *  buf,
int  len 
) [static]
Parameters:
buf hashed buffer
len length of buffer
Returns:
hash value, can be 0

Definition at line 152 of file ring.c.

References MD5Final(), MD5Init(), and MD5Update().

Referenced by contains(), insert(), pv_mcd_key_check(), and update_route_data_recursor().

Here is the call graph for this function:

Here is the caller graph for this function:

static void insert ( str  callid  )  [static]
Parameters:
callid Call-ID string

Definition at line 195 of file ring.c.

References ring_record_t::callid, hash(), hashtable, _str::len, remove_timeout(), _str::s, and ring_record_t::time.

Referenced by db_cluster_insert(), and ring_insert_callid().

Here is the call graph for this function:

Here is the caller graph for this function:

static void remove_timeout ( unsigned int  index  )  [static]
Parameters:
index array index that should expired

Definition at line 175 of file ring.c.

References ring_record_t::callid, hashtable, and ring_record_t::time.

Referenced by contains(), and insert().

Here is the caller graph for this function:

int ring_filter ( struct sip_msg msg,
unsigned int  flags,
void *  bar 
)
Parameters:
msg SIP message
flags unused
bar unused
Returns:
1 on success, -1 on failure

Definition at line 342 of file ring.c.

References hdr_field::body, contains(), conv183(), sip_msg::first_line, _str::len, and _str::s.

Here is the call graph for this function:

int ring_fixup ( void **  param,
int  param_no 
)
Parameters:
param unused
param_no unused
Returns:
0

Definition at line 375 of file ring.c.

int ring_insert_callid ( struct sip_msg msg,
char *  unused1,
char *  unused2 
)

Inserts callid of message into hashtable. Any 183 messages with this callid that occur in the next ring_timeout seconds, will be converted to 180.

Parameters:
msg SIP message
unused1 unused
unused2 unused
Returns:
1 on success, -1 otherwise

Definition at line 90 of file ring.c.

References hdr_field::body, contains(), and insert().

Here is the call graph for this function: