diff options
Diffstat (limited to 'net-misc/asterisk/files/1.2.0/asterisk-1.2.17-ASA-2007-011.patch')
-rw-r--r-- | net-misc/asterisk/files/1.2.0/asterisk-1.2.17-ASA-2007-011.patch | 317 |
1 files changed, 0 insertions, 317 deletions
diff --git a/net-misc/asterisk/files/1.2.0/asterisk-1.2.17-ASA-2007-011.patch b/net-misc/asterisk/files/1.2.0/asterisk-1.2.17-ASA-2007-011.patch deleted file mode 100644 index 5587de8f747b..000000000000 --- a/net-misc/asterisk/files/1.2.0/asterisk-1.2.17-ASA-2007-011.patch +++ /dev/null @@ -1,317 +0,0 @@ ---- asterisk-1.2.17/channels/chan_sip.c 2007-03-13 08:45:52.000000000 -0300 -+++ asterisk-1.2.18/channels/chan_sip.c 2007-04-24 13:05:06.000000000 -0300 -@@ -50,7 +50,7 @@ - - #include "asterisk.h" - --ASTERISK_FILE_VERSION(__FILE__, "$Revision: 1.1 $") -+ASTERISK_FILE_VERSION(__FILE__, "$Revision: 1.1 $") - - #include "asterisk/lock.h" - #include "asterisk/channel.h" -@@ -4168,7 +4168,8 @@ - add_header(resp, "To", ot); - copy_header(resp, req, "Call-ID"); - copy_header(resp, req, "CSeq"); -- add_header(resp, "User-Agent", default_useragent); -+ if (!ast_strlen_zero(default_useragent)) -+ add_header(resp, "User-Agent", default_useragent); - add_header(resp, "Allow", ALLOWED_METHODS); - if (msg[0] == '2' && (p->method == SIP_SUBSCRIBE || p->method == SIP_REGISTER)) { - /* For registration responses, we also need expiry and -@@ -4281,7 +4282,8 @@ - copy_header(req, orig, "Call-ID"); - add_header(req, "CSeq", tmp); - -- add_header(req, "User-Agent", default_useragent); -+ if (!ast_strlen_zero(default_useragent)) -+ add_header(req, "User-Agent", default_useragent); - add_header(req, "Max-Forwards", DEFAULT_MAX_FORWARDS); - - if (p->rpid) -@@ -5058,7 +5060,8 @@ - add_header(req, "Contact", p->our_contact); - add_header(req, "Call-ID", p->callid); - add_header(req, "CSeq", tmp); -- add_header(req, "User-Agent", default_useragent); -+ if (!ast_strlen_zero(default_useragent)) -+ add_header(req, "User-Agent", default_useragent); - add_header(req, "Max-Forwards", DEFAULT_MAX_FORWARDS); - if (p->rpid) - add_header(req, "Remote-Party-ID", p->rpid); -@@ -5399,7 +5402,7 @@ - add_header(&req, "Subscription-state", "terminated;reason=noresource"); - add_header(&req, "Content-Type", "message/sipfrag;version=2.0"); - -- strcpy(tmp, "SIP/2.0 200 OK"); -+ strcpy(tmp, "SIP/2.0 200 OK\r\n"); - add_header_contentLength(&req, strlen(tmp)); - add_line(&req, tmp); - -@@ -5671,7 +5674,8 @@ - add_header(&req, "To", to); - add_header(&req, "Call-ID", p->callid); - add_header(&req, "CSeq", tmp); -- add_header(&req, "User-Agent", default_useragent); -+ if (!ast_strlen_zero(default_useragent)) -+ add_header(&req, "User-Agent", default_useragent); - add_header(&req, "Max-Forwards", DEFAULT_MAX_FORWARDS); - - -@@ -7334,6 +7338,7 @@ - p->noncodeccapability |= AST_RTP_DTMF; - else - p->noncodeccapability &= ~AST_RTP_DTMF; -+ p->jointnoncodeccapability = p->noncodeccapability; - } - if (user && debug) - ast_verbose("Found user '%s'\n", user->name); -@@ -7443,6 +7448,7 @@ - p->noncodeccapability |= AST_RTP_DTMF; - else - p->noncodeccapability &= ~AST_RTP_DTMF; -+ p->jointnoncodeccapability = p->noncodeccapability; - } - ASTOBJ_UNREF(peer,sip_destroy_peer); - } else { -@@ -8107,7 +8113,6 @@ - /*! \brief manager_sip_show_peer: Show SIP peers in the manager API ---*/ - static int manager_sip_show_peer( struct mansession *s, struct message *m ) - { -- char *id = astman_get_header(m,"ActionID"); - char *a[4]; - char *peer; - int ret; -@@ -8122,8 +8127,6 @@ - a[2] = "peer"; - a[3] = peer; - -- if (!ast_strlen_zero(id)) -- ast_cli(s->fd, "ActionID: %s\r\n",id); - ret = _sip_show_peer(1, s->fd, s, m, 4, a ); - ast_cli( s->fd, "\r\n\r\n" ); - return ret; -@@ -8155,9 +8158,13 @@ - load_realtime = (argc == 5 && !strcmp(argv[4], "load")) ? 1 : 0; - peer = find_peer(argv[3], NULL, load_realtime); - if (s) { /* Manager */ -- if (peer) -+ if (peer) { -+ char *id = astman_get_header(m,"ActionID"); -+ - ast_cli(s->fd, "Response: Success\r\n"); -- else { -+ if (!ast_strlen_zero(id)) -+ ast_cli(s->fd, "ActionID: %s\r\n",id); -+ } else { - snprintf (cbuf, sizeof(cbuf), "Peer %s not found.\n", argv[3]); - astman_send_error(s, m, cbuf); - return 0; -@@ -8264,7 +8271,7 @@ - print_group(fd, peer->pickupgroup, 1); - ast_cli(fd, "VoiceMailbox: %s\r\n", peer->mailbox); - ast_cli(fd, "LastMsgsSent: %d\r\n", peer->lastmsgssent); -- ast_cli(fd, "Call limit: %d\r\n", peer->call_limit); -+ ast_cli(fd, "Call-limit: %d\r\n", peer->call_limit); - ast_cli(fd, "Dynamic: %s\r\n", (ast_test_flag(&peer->flags_page2, SIP_PAGE2_DYNAMIC)?"Y":"N")); - ast_cli(fd, "Callerid: %s\r\n", ast_callerid_merge(cbuf, sizeof(cbuf), peer->cid_name, peer->cid_num, "")); - ast_cli(fd, "RegExpire: %ld seconds\r\n", ast_sched_when(sched,peer->expire)); -@@ -10196,13 +10203,15 @@ - if ((resp >= 300) && (resp < 700)) { - if ((option_verbose > 2) && (resp != 487)) - ast_verbose(VERBOSE_PREFIX_3 "Got SIP response %d \"%s\" back from %s\n", resp, rest, ast_inet_ntoa(iabuf, sizeof(iabuf), p->sa.sin_addr)); -- if (p->rtp) { -- /* Immediately stop RTP */ -- ast_rtp_stop(p->rtp); -- } -- if (p->vrtp) { -- /* Immediately stop VRTP */ -- ast_rtp_stop(p->vrtp); -+ if (sipmethod == SIP_INVITE) { -+ if (p->rtp) { -+ /* Immediately stop RTP */ -+ ast_rtp_stop(p->rtp); -+ } -+ if (p->vrtp) { -+ /* Immediately stop VRTP */ -+ ast_rtp_stop(p->vrtp); -+ } - } - /* XXX Locking issues?? XXX */ - switch(resp) { -@@ -10246,7 +10255,8 @@ - /* ACK on invite */ - if (sipmethod == SIP_INVITE) - transmit_request(p, SIP_ACK, seqno, 0, 0); -- ast_set_flag(p, SIP_ALREADYGONE); -+ if (sipmethod != SIP_MESSAGE && sipmethod != SIP_INFO) -+ ast_set_flag(p, SIP_ALREADYGONE); - if (!p->owner) - ast_set_flag(p, SIP_NEEDDESTROY); - } else if ((resp >= 100) && (resp < 200)) { -@@ -11060,6 +11070,10 @@ - ast_copy_string(p->context, p->subscribecontext, sizeof(p->context)); - else if (ast_strlen_zero(p->context)) - strcpy(p->context, default_context); -+ -+ /* Get full contact header - this needs to be used as a request URI in NOTIFY's */ -+ parse_ok_contact(p, req); -+ - /* Get destination right away */ - build_contact(p); - if (gotdest) { -@@ -11295,16 +11309,16 @@ - /* ignore means "don't do anything with it" but still have to - respond appropriately */ - ignore=1; -- } -- -- e = ast_skip_blanks(e); -- if (sscanf(e, "%d %n", &respid, &len) != 1) { -- ast_log(LOG_WARNING, "Invalid response: '%s'\n", e); -- } else { -- /* More SIP ridiculousness, we have to ignore bogus contacts in 100 etc responses */ -- if ((respid == 200) || ((respid >= 300) && (respid <= 399))) -- extract_uri(p, req); -- handle_response(p, respid, e + len, req, ignore, seqno); -+ } else if (e) { -+ e = ast_skip_blanks(e); -+ if (sscanf(e, "%d %n", &respid, &len) != 1) { -+ ast_log(LOG_WARNING, "Invalid response: '%s'\n", e); -+ } else { -+ /* More SIP ridiculousness, we have to ignore bogus contacts in 100 etc responses */ -+ if ((respid == 200) || ((respid >= 300) && (respid <= 399))) -+ extract_uri(p, req); -+ handle_response(p, respid, e + len, req, ignore, seqno); -+ } - } - return 0; - } -@@ -11496,17 +11510,20 @@ - /* Go ahead and lock the owner if it has one -- we may need it */ - if (p->owner && ast_mutex_trylock(&p->owner->lock)) { - ast_log(LOG_DEBUG, "Failed to grab lock, trying again...\n"); -- ast_mutex_unlock(&p->lock); -- ast_mutex_unlock(&netlock); -- /* Sleep for a very short amount of time */ -- usleep(1); -- if (--lockretry) -+ if (--lockretry) { -+ ast_mutex_unlock(&p->lock); -+ ast_mutex_unlock(&netlock); -+ usleep(1); - goto retrylock; -+ } - } - if (!lockretry) { -- ast_log(LOG_ERROR, "We could NOT get the channel lock for %s - Call ID %s! \n", p->owner->name, p->callid); -+ if (p->owner) -+ ast_log(LOG_ERROR, "We could NOT get the channel lock for %s - Call ID %s! \n", p->owner->name, p->callid); - ast_log(LOG_ERROR, "SIP MESSAGE JUST IGNORED: %s \n", req.data); - ast_log(LOG_ERROR, "BAD! BAD! BAD!\n"); -+ ast_mutex_unlock(&p->lock); -+ ast_mutex_unlock(&netlock); - return 1; - } - memcpy(&p->recv, &sin, sizeof(p->recv)); -@@ -11986,20 +12003,17 @@ - /*! \brief handle_common_options: Handle flag-type options common to users and peers ---*/ - static int handle_common_options(struct ast_flags *flags, struct ast_flags *mask, struct ast_variable *v) - { -- int res = 0; -+ int res = 1; - - if (!strcasecmp(v->name, "trustrpid")) { - ast_set_flag(mask, SIP_TRUSTRPID); - ast_set2_flag(flags, ast_true(v->value), SIP_TRUSTRPID); -- res = 1; - } else if (!strcasecmp(v->name, "sendrpid")) { - ast_set_flag(mask, SIP_SENDRPID); - ast_set2_flag(flags, ast_true(v->value), SIP_SENDRPID); -- res = 1; - } else if (!strcasecmp(v->name, "useclientcode")) { - ast_set_flag(mask, SIP_USECLIENTCODE); - ast_set2_flag(flags, ast_true(v->value), SIP_USECLIENTCODE); -- res = 1; - } else if (!strcasecmp(v->name, "dtmfmode")) { - ast_set_flag(mask, SIP_DTMF); - ast_clear_flag(flags, SIP_DTMF); -@@ -12086,8 +12100,8 @@ - } else if (!strcasecmp(v->name, "promiscredir")) { - ast_set_flag(mask, SIP_PROMISCREDIR); - ast_set2_flag(flags, ast_true(v->value), SIP_PROMISCREDIR); -- res = 1; -- } -+ } else -+ res = 0; - - return res; - } -@@ -12344,9 +12358,9 @@ - if (user->callingpres == -1) - user->callingpres = atoi(v->value); - } -- /*else if (strcasecmp(v->name,"type")) -- * ast_log(LOG_WARNING, "Ignoring %s\n", v->name); -- */ -+ /* We can't just report unknown options here because this may be a -+ * type=friend entry. All user options are valid for a peer, but not -+ * the other way around. */ - v = v->next; - } - ast_copy_flags(user, &userflags, mask.flags); -@@ -12414,7 +12428,7 @@ - - if (peer) { - /* Already in the list, remove it and it will be added back (or FREE'd) */ -- found++; -+ found = 1; - } else { - peer = malloc(sizeof(*peer)); - if (peer) { -@@ -12513,10 +12527,9 @@ - ast_log(LOG_WARNING, "You can't have a dynamic outbound proxy, you big silly head at line %d.\n", v->lineno); - } else { - /* They'll register with us */ -- ast_set_flag(&peer->flags_page2, SIP_PAGE2_DYNAMIC); -- if (!found) { -- /* Initialize stuff iff we're not found, otherwise -- we keep going with what we had */ -+ if (!found || !ast_test_flag(&peer->flags_page2, SIP_PAGE2_DYNAMIC)) { -+ /* Initialize stuff if this is a new peer, or if it used to be -+ * non-dynamic before the reload. */ - memset(&peer->addr.sin_addr, 0, 4); - if (peer->addr.sin_port) { - /* If we've already got a port, make it the default rather than absolute */ -@@ -12524,6 +12537,7 @@ - peer->addr.sin_port = 0; - } - } -+ ast_set_flag(&peer->flags_page2, SIP_PAGE2_DYNAMIC); - } - } else { - /* Non-dynamic. Make sure we become that way if we're not */ -@@ -12630,10 +12644,7 @@ - peer->maxms = 0; - } - } -- /* else if (strcasecmp(v->name,"type")) -- * ast_log(LOG_WARNING, "Ignoring %s\n", v->name); -- */ -- v=v->next; -+ v = v->next; - } - if (!ast_test_flag((&global_flags_page2), SIP_PAGE2_IGNOREREGEXPIRE) && ast_test_flag(&peer->flags_page2, SIP_PAGE2_DYNAMIC) && realtime) { - time_t nowtime; -@@ -12929,10 +12940,7 @@ - } else if (!strcasecmp(v->name, "callevents")) { - callevents = ast_true(v->value); - } -- /* else if (strcasecmp(v->name,"type")) -- * ast_log(LOG_WARNING, "Ignoring %s\n", v->name); -- */ -- v = v->next; -+ v = v->next; - } - - if (!allow_external_domains && AST_LIST_EMPTY(&domain_list)) { |