diff options
author | markster <markster@f38db490-d61c-443f-a65b-d21fe96a405b> | 2003-04-06 04:54:04 +0000 |
---|---|---|
committer | markster <markster@f38db490-d61c-443f-a65b-d21fe96a405b> | 2003-04-06 04:54:04 +0000 |
commit | 9648a4c12568e54b9ed32ff5b186dd76d37144e1 (patch) | |
tree | 9b8eb31980d385718b4d7a522dda516796d55103 /channels | |
parent | a05904b01f59ab760c5419354e42ee27aa9c2349 (diff) |
Add "From" to register
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@756 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channels')
-rwxr-xr-x | channels/chan_sip.c | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/channels/chan_sip.c b/channels/chan_sip.c index a69d11783..e54c1bae3 100755 --- a/channels/chan_sip.c +++ b/channels/chan_sip.c @@ -1980,6 +1980,27 @@ static int transmit_response_reliable(struct sip_pvt *p, char *msg, struct sip_r return __transmit_response(p, msg, req, 1); } +static void append_date(struct sip_request *req) +{ + char tmpdat[256]; + struct tm tm; + time_t t; + time(&t); + gmtime_r(&t, &tm); + strftime(tmpdat, sizeof(tmpdat), "%a, %d %b %Y %T GMT", &tm); + add_header(req, "Date", tmpdat); +} + +static int transmit_response_with_date(struct sip_pvt *p, char *msg, struct sip_request *req) +{ + struct sip_request resp; + respprep(&resp, p, msg, req); + append_date(&resp); + add_header(&resp, "Content-Length", "0"); + add_blank_header(&resp); + return send_response(p, &resp, 0, 0); +} + static int transmit_response_with_allow(struct sip_pvt *p, char *msg, struct sip_request *req) { struct sip_request resp; @@ -2770,7 +2791,7 @@ static int register_verify(struct sip_pvt *p, struct sockaddr_in *sin, struct si ast_log(LOG_WARNING, "Failed to parse contact info\n"); } else { /* Say OK and ask subsystem to retransmit msg counter */ - transmit_response(p, "200 OK", req); + transmit_response_with_date(p, "200 OK", req); peer->lastmsgssent = -1; res = 0; } @@ -4178,7 +4199,7 @@ static void *do_monitor(void *data) restartsearch: sip = iflist; while(sip) { - if (sip->needdestroy) { + if (sip->needdestroy && !sip->packets) { __sip_destroy(sip, 1); goto restartsearch; } |