Index: channels/chan_sip.c =================================================================== --- channels/chan_sip.c (revision 282301) +++ channels/chan_sip.c (working copy) @@ -275,6 +275,12 @@ #include "sip/include/dialog.h" #include "sip/include/dialplan_functions.h" +#define DEBUG 1 +#ifdef DEBUG +#define static_debug +#else +#define static_debug static +#endif /*** DOCUMENTATION @@ -1506,10 +1512,10 @@ static void build_contact(struct sip_pvt *p); /*------Request handling functions */ -static int handle_incoming(struct sip_pvt *p, struct sip_request *req, struct ast_sockaddr *addr, int *recount, int *nounlock); -static int handle_request_update(struct sip_pvt *p, struct sip_request *req); -static int handle_request_invite(struct sip_pvt *p, struct sip_request *req, int debug, int seqno, struct ast_sockaddr *addr, int *recount, const char *e, int *nounlock); -static int handle_request_refer(struct sip_pvt *p, struct sip_request *req, int debug, int seqno, int *nounlock); +static_debug int handle_incoming(struct sip_pvt *p, struct sip_request *req, struct ast_sockaddr *addr, int *recount, int *nounlock); +static_debug int handle_request_update(struct sip_pvt *p, struct sip_request *req); +static_debug int handle_request_invite(struct sip_pvt *p, struct sip_request *req, int debug, int seqno, struct ast_sockaddr *addr, int *recount, const char *e, int *nounlock); +static_debug int handle_request_refer(struct sip_pvt *p, struct sip_request *req, int debug, int seqno, int *nounlock); static int handle_request_bye(struct sip_pvt *p, struct sip_request *req); static int handle_request_register(struct sip_pvt *p, struct sip_request *req, struct ast_sockaddr *sin, const char *e); static int handle_request_cancel(struct sip_pvt *p, struct sip_request *req); @@ -1519,16 +1525,16 @@ static int handle_request_options(struct sip_pvt *p, struct sip_request *req); static int handle_invite_replaces(struct sip_pvt *p, struct sip_request *req, int debug, int seqno, struct ast_sockaddr *addr, int *nounlock); static int handle_request_notify(struct sip_pvt *p, struct sip_request *req, struct ast_sockaddr *addr, int seqno, const char *e); -static int local_attended_transfer(struct sip_pvt *transferer, struct sip_dual *current, struct sip_request *req, int seqno, int *nounlock); +static_debug int local_attended_transfer(struct sip_pvt *transferer, struct sip_dual *current, struct sip_request *req, int seqno, int *nounlock); /*------Response handling functions */ static void handle_response_publish(struct sip_pvt *p, int resp, const char *rest, struct sip_request *req, int seqno); -static void handle_response_invite(struct sip_pvt *p, int resp, const char *rest, struct sip_request *req, int seqno); +static_debug void handle_response_invite(struct sip_pvt *p, int resp, const char *rest, struct sip_request *req, int seqno); static void handle_response_notify(struct sip_pvt *p, int resp, const char *rest, struct sip_request *req, int seqno); static void handle_response_refer(struct sip_pvt *p, int resp, const char *rest, struct sip_request *req, int seqno); static void handle_response_subscribe(struct sip_pvt *p, int resp, const char *rest, struct sip_request *req, int seqno); static int handle_response_register(struct sip_pvt *p, int resp, const char *rest, struct sip_request *req, int seqno); -static void handle_response(struct sip_pvt *p, int resp, const char *rest, struct sip_request *req, int seqno); +static_debug void handle_response(struct sip_pvt *p, int resp, const char *rest, struct sip_request *req, int seqno); /*------ SRTP Support -------- */ static int setup_srtp(struct sip_srtp **srtp); @@ -18671,7 +18677,7 @@ } /*! \brief Handle SIP response to INVITE dialogue */ -static void handle_response_invite(struct sip_pvt *p, int resp, const char *rest, struct sip_request *req, int seqno) +static_debug void handle_response_invite(struct sip_pvt *p, int resp, const char *rest, struct sip_request *req, int seqno) { int outgoing = ast_test_flag(&p->flags[0], SIP_OUTGOING); int res = 0; @@ -19514,7 +19520,7 @@ /*! \brief Handle SIP response in dialogue \note only called by handle_incoming */ -static void handle_response(struct sip_pvt *p, int resp, const char *rest, struct sip_request *req, int seqno) +static_debug void handle_response(struct sip_pvt *p, int resp, const char *rest, struct sip_request *req, int seqno) { struct ast_channel *owner; int sipmethod; @@ -20705,7 +20711,7 @@ * * Actually updating the media session may be some future work. */ -static int handle_request_update(struct sip_pvt *p, struct sip_request *req) +static_debug int handle_request_update(struct sip_pvt *p, struct sip_request *req) { if (ast_strlen_zero(get_header(req, "X-Asterisk-rpid-update"))) { transmit_response(p, "501 Method Not Implemented", req); @@ -20743,7 +20749,7 @@ * plan but try to find the active call and masquerade * into it */ -static int handle_request_invite(struct sip_pvt *p, struct sip_request *req, int debug, int seqno, struct ast_sockaddr *addr, int *recount, const char *e, int *nounlock) +static_debug int handle_request_invite(struct sip_pvt *p, struct sip_request *req, int debug, int seqno, struct ast_sockaddr *addr, int *recount, const char *e, int *nounlock) { int res = 1; int gotdest; @@ -21596,7 +21602,7 @@ * If this function is successful, only the transferer pvt lock will remain on return. Setting nounlock indicates * to handle_request_do() that the pvt's owner it locked does not require an unlock. */ -static int local_attended_transfer(struct sip_pvt *transferer, struct sip_dual *current, struct sip_request *req, int seqno, int *nounlock) +static_debug int local_attended_transfer(struct sip_pvt *transferer, struct sip_dual *current, struct sip_request *req, int seqno, int *nounlock) { struct sip_dual target; /* Chan 1: Call from tranferer to Asterisk */ /* Chan 2: Call from Asterisk to target */ @@ -21837,7 +21843,7 @@ We can't destroy dialogs, since we want the call to continue. */ -static int handle_request_refer(struct sip_pvt *p, struct sip_request *req, int debug, int seqno, int *nounlock) +static_debug int handle_request_refer(struct sip_pvt *p, struct sip_request *req, int debug, int seqno, int *nounlock) { struct sip_dual current; /* Chan1: Call between asterisk and transferer */ /* Chan2: Call between asterisk and transferee */ @@ -23307,7 +23313,7 @@ /*! \brief Handle incoming SIP requests (methods) \note This is where all incoming requests go first */ /* called with p and p->owner locked */ -static int handle_incoming(struct sip_pvt *p, struct sip_request *req, struct ast_sockaddr *addr, int *recount, int *nounlock) +static_debug int handle_incoming(struct sip_pvt *p, struct sip_request *req, struct ast_sockaddr *addr, int *recount, int *nounlock) { /* Called with p->lock held, as well as p->owner->lock if appropriate, keeping things relatively static */ @@ -23559,7 +23565,8 @@ return res; } -static void process_request_queue(struct sip_pvt *p, int *recount, int *nounlock) +static_debug void process_request_queue(struct sip_pvt *p, int *recount, int *nounlock); +static_debug void process_request_queue(struct sip_pvt *p, int *recount, int *nounlock) { struct sip_request *req; @@ -23574,7 +23581,8 @@ } } -static int scheduler_process_request_queue(const void *data) +static_debug int scheduler_process_request_queue(const void *data); +static_debug int scheduler_process_request_queue(const void *data) { struct sip_pvt *p = (struct sip_pvt *) data; int recount = 0;