diff options
author | Luigi Rizzo <rizzo@icir.org> | 2006-05-11 09:36:10 +0000 |
---|---|---|
committer | Luigi Rizzo <rizzo@icir.org> | 2006-05-11 09:36:10 +0000 |
commit | 5cd1ec4e1753d3086118fa902051eb8d61e5a8cb (patch) | |
tree | e375009cf8bbc8ad2de42eaf66d29bd72a811b8e /channels | |
parent | e08e646252264f66fe3cc11da9fc77e9cbf0666c (diff) |
cleanup init_resp with proper variable names and arguments.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@26802 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'channels')
-rw-r--r-- | channels/chan_sip.c | 22 |
1 files changed, 9 insertions, 13 deletions
diff --git a/channels/chan_sip.c b/channels/chan_sip.c index 9c109b425..90f8af722 100644 --- a/channels/chan_sip.c +++ b/channels/chan_sip.c @@ -1188,7 +1188,7 @@ static void extract_uri(struct sip_pvt *p, struct sip_request *req); static void initialize_initreq(struct sip_pvt *p, struct sip_request *req); static int init_req(struct sip_request *req, int sipmethod, const char *recip); static int reqprep(struct sip_request *req, struct sip_pvt *p, int sipmethod, int seqno, int newbranch); -static int init_resp(struct sip_request *req, const char *resp, struct sip_request *orig); +static int init_resp(struct sip_request *resp, const char *msg); static int respprep(struct sip_request *resp, struct sip_pvt *p, const char *msg, struct sip_request *req); static const struct sockaddr_in *sip_real_dst(const struct sip_pvt *p); static void build_via(struct sip_pvt *p); @@ -4381,18 +4381,15 @@ static void set_destination(struct sip_pvt *p, char *uri) } /*! \brief Initialize SIP response, based on SIP request */ -static int init_resp(struct sip_request *req, const char *resp, struct sip_request *orig) +static int init_resp(struct sip_request *resp, const char *msg) { /* Initialize a response */ - if (req->headers || req->len) { - ast_log(LOG_WARNING, "Request already initialized?!?\n"); - return -1; - } - req->method = SIP_RESPONSE; - req->header[req->headers] = req->data + req->len; - snprintf(req->header[req->headers], sizeof(req->data) - req->len, "SIP/2.0 %s\r\n", resp); - req->len += strlen(req->header[req->headers]); - req->headers++; + memset(resp, 0, sizeof(*resp)); + resp->method = SIP_RESPONSE; + resp->header[0] = resp->data; + snprintf(resp->header[0], sizeof(resp->data), "SIP/2.0 %s\r\n", msg); + resp->len = strlen(resp->header[0]); + resp->headers++; return 0; } @@ -4419,8 +4416,7 @@ static int respprep(struct sip_request *resp, struct sip_pvt *p, const char *msg char newto[256]; const char *ot; - memset(resp, 0, sizeof(*resp)); - init_resp(resp, msg, req); + init_resp(resp, msg); copy_via_headers(p, resp, req, "Via"); if (msg[0] == '2') copy_all_header(resp, req, "Record-Route"); |