00001 
00002 #ifndef  __JBXL_SIP_TOOL_H_
00003 #define  __JBXL_SIP_TOOL_H_
00004 
00005 
00006 #include "protocol.h"
00007 
00008 
00049 #define  SIP_NOMAXFORWARDS      1000
00050 
00051 
00053 
00054 
00055 #define get_sip_header_list(b)      get_protocol_header_list((b), ':', TRUE, TRUE)
00056 #define restore_sip_header(l)       restore_protocol_header((l), ": ", ON, NULL)
00057 #define restore_sip_contents(l)     restore_protocol_contents((l))
00058 
00059 void    set_sip_contents(tList* ls, Buffer sdp);
00060 
00061 
00062 Buffer  get_sip_via_address(tList* lp, int no);
00063 void    insert_sip_via(tList* lp, char* host, unsigned short port, char* branch, int mode);
00064 void    del_sip_via(tList* lp, char* host, unsigned short port);
00065 
00066 void    insert_sip_record_route(tList* lp, char* host, unsigned short port, int mode);
00067 void    del_sip_record_route(tList* lp, char* host, unsigned short port);
00068 void    del_sip_record_route_all(tList* lp);
00069 
00070 void    replace_sip_contact(tList* lp, char* host, unsigned short port);
00071 Buffer  get_sip_contact_uri(tList* lp);
00072 Buffer  get_sip_domain(Buffer cturi);
00073 
00074 int     get_max_forwards(tList* lp);
00075 void    set_max_forwards(tList* lp, int nm);
00076 
00077 
00078 tList*  get_sdp_body_list(tList* lp);
00079 Buffer  restore_sdp_body (tList* ls);
00080 
00081 int     replace_sdp_invite_addr(tList*lp, tList* ls, char* host, unsigned short port, int del_candi);
00082 
00083 
00084 unsigned short  get_valid_rtp_pair_sockets(int min, int max, int* rtp, int* rtcp);
00085 
00086 
00087 Buffer  replace_sip_via(tList* lp, char* host, unsigned short port, int no);
00088 int     replace_sip_contact_dstipport(tList* lp, char* ipaddr, unsigned short port);
00089 
00090 #endif