[asterisk-commits] may: branch may/chan_ooh323_evo r315048 - in /team/may/chan_ooh323_evo: ./ ch...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Sat Apr 23 12:48:40 CDT 2011
Author: may
Date: Sat Apr 23 12:48:35 2011
New Revision: 315048
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=315048
Log:
Merged revisions 315002 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk
................
r315002 | alecdavis | 2011-04-23 03:01:38 +0400 (Sat, 23 Apr 2011) | 17 lines
Merged revisions 315001 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.8
........
r315001 | alecdavis | 2011-04-23 10:59:18 +1200 (Sat, 23 Apr 2011) | 12 lines
chan_dahdi: Can't return to normal ring after distinctive ring on FXS
clear a previous distinctivering pattern before each new call
(closes issue #18985)
Reported by: bromont
Patches:
bug18985.diff.txt uploaded by alecdavis (license 585)
Tested by: alecdavis, bromont
........
................
Modified:
team/may/chan_ooh323_evo/ (props changed)
team/may/chan_ooh323_evo/channels/chan_dahdi.c
team/may/chan_ooh323_evo/channels/chan_sip.c
team/may/chan_ooh323_evo/codecs/codec_ilbc.c
team/may/chan_ooh323_evo/codecs/ex_ilbc.h
team/may/chan_ooh323_evo/include/asterisk/format_cap.h
team/may/chan_ooh323_evo/main/app.c
team/may/chan_ooh323_evo/main/ccss.c
team/may/chan_ooh323_evo/main/channel.c
team/may/chan_ooh323_evo/main/features.c
team/may/chan_ooh323_evo/main/format_cap.c
team/may/chan_ooh323_evo/main/logger.c
team/may/chan_ooh323_evo/main/manager.c
team/may/chan_ooh323_evo/main/say.c
team/may/chan_ooh323_evo/main/taskprocessor.c
team/may/chan_ooh323_evo/res/ais/evt.c
team/may/chan_ooh323_evo/res/res_config_ldap.c
team/may/chan_ooh323_evo/res/res_http_post.c
team/may/chan_ooh323_evo/res/res_jabber.c
team/may/chan_ooh323_evo/res/res_musiconhold.c
team/may/chan_ooh323_evo/res/res_rtp_asterisk.c
team/may/chan_ooh323_evo/res/res_smdi.c
Propchange: team/may/chan_ooh323_evo/
------------------------------------------------------------------------------
Binary property 'branch-1.8-merged' - no diff available.
Propchange: team/may/chan_ooh323_evo/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Sat Apr 23 12:48:35 2011
@@ -1,1 +1,1 @@
-/trunk:1-315001
+/trunk:1-315047
Modified: team/may/chan_ooh323_evo/channels/chan_dahdi.c
URL: http://svnview.digium.com/svn/asterisk/team/may/chan_ooh323_evo/channels/chan_dahdi.c?view=diff&rev=315048&r1=315047&r2=315048
==============================================================================
--- team/may/chan_ooh323_evo/channels/chan_dahdi.c (original)
+++ team/may/chan_ooh323_evo/channels/chan_dahdi.c Sat Apr 23 12:48:35 2011
@@ -13513,6 +13513,7 @@
}
}
+ p->distinctivering = 0;
/* Make special notes */
switch (start.opt) {
case '\0':
Modified: team/may/chan_ooh323_evo/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/team/may/chan_ooh323_evo/channels/chan_sip.c?view=diff&rev=315048&r1=315047&r2=315048
==============================================================================
--- team/may/chan_ooh323_evo/channels/chan_sip.c (original)
+++ team/may/chan_ooh323_evo/channels/chan_sip.c Sat Apr 23 12:48:35 2011
@@ -1618,7 +1618,7 @@
static int sip_cc_agent_init(struct ast_cc_agent *agent, struct ast_channel *chan);
static int sip_cc_agent_start_offer_timer(struct ast_cc_agent *agent);
static int sip_cc_agent_stop_offer_timer(struct ast_cc_agent *agent);
-static void sip_cc_agent_ack(struct ast_cc_agent *agent);
+static void sip_cc_agent_respond(struct ast_cc_agent *agent, enum ast_cc_agent_response_reason reason);
static int sip_cc_agent_status_request(struct ast_cc_agent *agent);
static int sip_cc_agent_start_monitoring(struct ast_cc_agent *agent);
static int sip_cc_agent_recall(struct ast_cc_agent *agent);
@@ -1629,7 +1629,7 @@
.init = sip_cc_agent_init,
.start_offer_timer = sip_cc_agent_start_offer_timer,
.stop_offer_timer = sip_cc_agent_stop_offer_timer,
- .ack = sip_cc_agent_ack,
+ .respond = sip_cc_agent_respond,
.status_request = sip_cc_agent_status_request,
.start_monitoring = sip_cc_agent_start_monitoring,
.callee_available = sip_cc_agent_recall,
@@ -1730,14 +1730,30 @@
return 0;
}
-static void sip_cc_agent_ack(struct ast_cc_agent *agent)
+static void sip_cc_agent_respond(struct ast_cc_agent *agent, enum ast_cc_agent_response_reason reason)
{
struct sip_cc_agent_pvt *agent_pvt = agent->private_data;
sip_pvt_lock(agent_pvt->subscribe_pvt);
ast_set_flag(&agent_pvt->subscribe_pvt->flags[1], SIP_PAGE2_DIALOG_ESTABLISHED);
- transmit_response(agent_pvt->subscribe_pvt, "200 OK", &agent_pvt->subscribe_pvt->initreq);
- transmit_cc_notify(agent, agent_pvt->subscribe_pvt, CC_QUEUED);
+ if (reason == AST_CC_AGENT_RESPONSE_SUCCESS || !ast_strlen_zero(agent_pvt->notify_uri)) {
+ /* The second half of this if statement may be a bit hard to grasp,
+ * so here's an explanation. When a subscription comes into
+ * chan_sip, as long as it is not malformed, it will be passed
+ * to the CC core. If the core senses an out-of-order state transition,
+ * then the core will call this callback with the "reason" set to a
+ * failure condition.
+ * However, an out-of-order state transition will occur during a resubscription
+ * for CC. In such a case, we can see that we have already generated a notify_uri
+ * and so we can detect that this isn't a *real* failure. Rather, it is just
+ * something the core doesn't recognize as a legitimate SIP state transition.
+ * Thus we respond with happiness and flowers.
+ */
+ transmit_response(agent_pvt->subscribe_pvt, "200 OK", &agent_pvt->subscribe_pvt->initreq);
+ transmit_cc_notify(agent, agent_pvt->subscribe_pvt, CC_QUEUED);
+ } else {
+ transmit_response(agent_pvt->subscribe_pvt, "500 Internal Error", &agent_pvt->subscribe_pvt->initreq);
+ }
sip_pvt_unlock(agent_pvt->subscribe_pvt);
agent_pvt->is_available = TRUE;
}
@@ -2712,14 +2728,15 @@
ao2_lock(me);
if (!(packet = AST_LIST_REMOVE_HEAD(&me->packet_q, entry))) {
ast_log(LOG_WARNING, "TCPTLS thread alert_pipe indicated packet should be sent, but frame_q is empty");
- } else if (ast_tcptls_server_write(tcptls_session, ast_str_buffer(packet->data), packet->len) == -1) {
- ast_log(LOG_WARNING, "Failure to write to tcp/tls socket\n");
}
+ ao2_unlock(me);
if (packet) {
+ if (ast_tcptls_server_write(tcptls_session, ast_str_buffer(packet->data), packet->len) == -1) {
+ ast_log(LOG_WARNING, "Failure to write to tcp/tls socket\n");
+ }
ao2_t_ref(packet, -1, "tcptls packet sent, this is no longer needed");
}
- ao2_unlock(me);
break;
default:
ast_log(LOG_ERROR, "Unknown tcptls thread alert '%d'\n", alert);
@@ -3261,9 +3278,9 @@
if (res == -1) {
switch (errno) {
- case EBADF: /* Bad file descriptor - seems like this is generated when the host exist, but doesn't accept the UDP packet */
- case EHOSTUNREACH: /* Host can't be reached */
- case ENETDOWN: /* Interface down */
+ case EBADF: /* Bad file descriptor - seems like this is generated when the host exist, but doesn't accept the UDP packet */
+ case EHOSTUNREACH: /* Host can't be reached */
+ case ENETDOWN: /* Interface down */
case ENETUNREACH: /* Network failure */
case ECONNREFUSED: /* ICMP port unreachable */
res = XMIT_ERROR; /* Don't bother with trying to transmit again */
@@ -4307,8 +4324,8 @@
if (!p->pendinginvite) { /* We are up, and have no outstanding invite */
transmit_reinvite_with_sdp(p, FALSE, FALSE);
} else if (!ast_test_flag(&p->flags[0], SIP_PENDINGBYE)) {
- ast_set_flag(&p->flags[0], SIP_NEEDREINVITE);
- }
+ ast_set_flag(&p->flags[0], SIP_NEEDREINVITE);
+ }
break;
default:
ast_log(LOG_WARNING, "Don't know how to send URI when state is %d!\n", chan->_state);
@@ -4343,7 +4360,7 @@
if (debug)
ast_verbose("Sending text %s on %s\n", text, ast->name);
transmit_message_with_text(dialog, text);
- return 0;
+ return 0;
}
/*! \brief Update peer object in realtime storage
@@ -4473,18 +4490,17 @@
dialog_unlink_all(peer->call, TRUE, TRUE);
peer->call = dialog_unref(peer->call, "peer->call is being unset");
}
-
if (peer->mwipvt) { /* We have an active subscription, delete it */
dialog_unlink_all(peer->mwipvt, TRUE, TRUE);
peer->mwipvt = dialog_unref(peer->mwipvt, "unreffing peer->mwipvt");
}
-
+
if (peer->chanvars) {
ast_variables_destroy(peer->chanvars);
peer->chanvars = NULL;
}
-
+
register_peer_exten(peer, FALSE);
ast_free_ha(peer->ha);
ast_free_ha(peer->directmediaha);
@@ -5013,7 +5029,7 @@
ast_copy_flags(&dialog->flags[0], &peer->flags[0], SIP_FLAGS_TO_COPY);
ast_copy_flags(&dialog->flags[1], &peer->flags[1], SIP_PAGE2_FLAGS_TO_COPY);
ast_copy_flags(&dialog->flags[2], &peer->flags[2], SIP_PAGE3_FLAGS_TO_COPY);
- ast_format_cap_append(dialog->caps, peer->caps);
+ ast_format_cap_copy(dialog->caps, peer->caps);
dialog->prefs = peer->prefs;
if (ast_test_flag(&dialog->flags[1], SIP_PAGE2_T38SUPPORT)) {
/* t38pt_udptl was enabled in the peer and not in [general] */
@@ -5421,9 +5437,9 @@
reg->call = dialog_unref(reg->call, "unref reg->call");
/* reg->call = sip_destroy(reg->call); */
}
- AST_SCHED_DEL(sched, reg->expire);
+ AST_SCHED_DEL(sched, reg->expire);
AST_SCHED_DEL(sched, reg->timeout);
-
+
ast_string_field_free_memory(reg);
ast_atomic_fetchadd_int(®objs, -1);
ast_dnsmgr_release(reg->dnsmgr);
@@ -5931,7 +5947,7 @@
return "488 Not Acceptable Here";
case AST_CAUSE_INTERWORKING: /* Unspecified Interworking issues */
return "500 Network error";
-
+
case AST_CAUSE_NOTDEFINED:
default:
ast_debug(1, "AST hangup cause %d (no match found in SIP)\n", cause);
@@ -6180,7 +6196,7 @@
ast_log(LOG_NOTICE, "Ignoring ${SIP_CODEC} variable because it is not shared by both ends.\n");
} else
ast_log(LOG_NOTICE, "Ignoring ${SIP_CODEC} variable because of unrecognized/not configured codec (check allow/disallow in sip.conf): %s\n", codec);
- return;
+ return;
}
/*! \brief sip_answer: Answer SIP call , send 200 OK on Invite
@@ -6192,7 +6208,7 @@
sip_pvt_lock(p);
if (ast->_state != AST_STATE_UP) {
- try_suggested_sip_codec(p);
+ try_suggested_sip_codec(p);
ast_setstate(ast, AST_STATE_UP);
ast_debug(1, "SIP answering channel: %s\n", ast->name);
@@ -6738,14 +6754,14 @@
needvideo = 1;
else if (!ast_format_cap_is_empty(i->prefcaps))
needvideo = ast_format_cap_has_type(i->prefcaps, AST_FORMAT_TYPE_VIDEO); /* Outbound call */
- else
+ else
needvideo = ast_format_cap_has_type(i->jointcaps, AST_FORMAT_TYPE_VIDEO); /* Inbound call */
}
if (i->trtp) {
if (!ast_format_cap_is_empty(i->prefcaps))
needtext = ast_format_cap_has_type(i->prefcaps, AST_FORMAT_TYPE_TEXT); /* Outbound call */
- else
+ else
needtext = ast_format_cap_has_type(i->jointcaps, AST_FORMAT_TYPE_TEXT); /* Inbound call */
}
@@ -7135,7 +7151,7 @@
}
}
}
-
+
return f;
}
@@ -7399,7 +7415,7 @@
/* Assign default music on hold class */
ast_string_field_set(p, mohinterpret, default_mohinterpret);
ast_string_field_set(p, mohsuggest, default_mohsuggest);
- ast_format_cap_append(p->caps, sip_cfg.caps);
+ ast_format_cap_copy(p->caps, sip_cfg.caps);
p->allowtransfer = sip_cfg.allowtransfer;
if ((ast_test_flag(&p->flags[0], SIP_DTMF) == SIP_DTMF_RFC2833) ||
(ast_test_flag(&p->flags[0], SIP_DTMF) == SIP_DTMF_AUTO))
@@ -7417,7 +7433,7 @@
/* Add to active dialog list */
ao2_t_link(dialogs, p, "link pvt into dialogs table");
-
+
ast_debug(1, "Allocating new SIP dialog for %s - %s (%s)\n", callid ? callid : p->callid, sip_methods[intended_method].text, p->rtp ? "With RTP" : "No RTP");
return p;
}
@@ -8611,7 +8627,7 @@
}
ast_debug(3, "Processing session-level SDP %c=%s... %s\n", type, value, (processed == TRUE)? "OK." : "UNSUPPORTED.");
- }
+ }
@@ -9055,11 +9071,10 @@
}
ast_debug(4, "We have an owner, now see if we need to change this call\n");
-
- if (!(ast_format_cap_has_joint(p->owner->nativeformats, p->jointcaps)) && ast_format_cap_has_type(p->jointcaps, AST_FORMAT_TYPE_AUDIO)) {
+ if (ast_format_cap_has_type(p->jointcaps, AST_FORMAT_TYPE_AUDIO)) {
if (debug) {
char s1[SIPBUFSIZE], s2[SIPBUFSIZE];
- ast_debug(1, "Oooh, we need to change our audio formats since our peer supports only %s and not %s\n",
+ ast_debug(1, "Setting native formats after processing SDP. peer joint formats %s, old nativeformats %s\n",
ast_getformatname_multiple(s1, SIPBUFSIZE, p->jointcaps),
ast_getformatname_multiple(s2, SIPBUFSIZE, p->owner->nativeformats));
}
@@ -9067,13 +9082,13 @@
ast_codec_choose(&p->prefs, p->jointcaps, 1, &tmp_fmt);
ast_format_cap_set(p->owner->nativeformats, &tmp_fmt);
- ast_format_cap_joint_copy(p->caps, vpeercapability, p->owner->nativeformats);
- ast_format_cap_joint_copy(p->caps, tpeercapability, p->owner->nativeformats);
+ ast_format_cap_joint_append(p->caps, vpeercapability, p->owner->nativeformats);
+ ast_format_cap_joint_append(p->caps, tpeercapability, p->owner->nativeformats);
ast_set_read_format(p->owner, &p->owner->readformat);
ast_set_write_format(p->owner, &p->owner->writeformat);
}
-
+
if (ast_test_flag(&p->flags[1], SIP_PAGE2_CALL_ONHOLD) && (!ast_sockaddr_isnull(sa) || !ast_sockaddr_isnull(vsa) || !ast_sockaddr_isnull(tsa) || !ast_sockaddr_isnull(isa)) && (!sendonly || sendonly == -1)) {
ast_queue_control(p->owner, AST_CONTROL_UNHOLD);
/* Activate a re-invite */
@@ -9279,13 +9294,12 @@
ast_verbose("Discarded description format %s for ID %d\n", mimeSubtype, codec);
}
} else if (sscanf(a, "fmtp: %30u %63s", &codec, fmtp_string) == 2) {
- struct ast_rtp_payload_type payload;
-
- payload = ast_rtp_codecs_payload_lookup(newaudiortp, codec);
- if (payload.format.id && payload.asterisk_format) {
+ struct ast_format *format;
+
+ if ((format = ast_rtp_codecs_get_payload_format(newaudiortp, codec))) {
unsigned int bit_rate;
- switch ((int) payload.format.id) {
+ switch ((int) format->id) {
case AST_FORMAT_SIREN7:
if (sscanf(fmtp_string, "bitrate=%30u", &bit_rate) == 1) {
if (bit_rate != 32000) {
@@ -9315,6 +9329,21 @@
found = TRUE;
}
}
+ break;
+ case AST_FORMAT_SILK:
+ {
+ int val = 0;
+ if (sscanf(fmtp_string, "maxaveragebitrate=%30u", &val) == 1) {
+ ast_format_append(format, SILK_ATTR_KEY_MAX_BITRATE, val, AST_FORMAT_ATTR_END);
+ }
+ if (sscanf(fmtp_string, "usedtx=%30u", &val) == 1) {
+ ast_format_append(format, SILK_ATTR_KEY_DTX, val ? 1 : 0, AST_FORMAT_ATTR_END);
+ }
+ if (sscanf(fmtp_string, "useinbandfec=%30u", &val) == 1) {
+ ast_format_append(format, SILK_ATTR_KEY_FEC, val ? 1 : 0, AST_FORMAT_ATTR_END);
+ }
+ break;
+ }
}
}
}
@@ -10006,14 +10035,14 @@
int is_outbound = ast_test_flag(&p->flags[0], SIP_OUTGOING); /* Session direction */
memset(req, 0, sizeof(struct sip_request));
-
+
snprintf(p->lastmsg, sizeof(p->lastmsg), "Tx: %s", sip_methods[sipmethod].text);
-
+
if (!seqno) {
p->ocseq++;
seqno = p->ocseq;
}
-
+
/* A CANCEL must have the same branch as the INVITE that it is canceling. */
if (sipmethod == SIP_CANCEL) {
p->branch = p->invite_branch;
@@ -10033,7 +10062,7 @@
if (sipdebug)
ast_debug(1, "Strict routing enforced for session %s\n", p->callid);
}
-
+
if (sipmethod == SIP_CANCEL)
c = REQ_OFFSET_TO_STR(&p->initreq, rlPart2); /* Use original URI */
else if (sipmethod == SIP_ACK) {
@@ -10041,8 +10070,8 @@
(we only have the contacturi on INVITEs) */
if (!ast_strlen_zero(p->okcontacturi))
c = is_strict ? p->route->hop : p->okcontacturi;
- else
- c = REQ_OFFSET_TO_STR(&p->initreq, rlPart2);
+ else
+ c = REQ_OFFSET_TO_STR(&p->initreq, rlPart2);
} else if (!ast_strlen_zero(p->okcontacturi))
c = is_strict ? p->route->hop : p->okcontacturi; /* Use for BYE or REINVITE */
else if (!ast_strlen_zero(p->uri))
@@ -10675,6 +10704,20 @@
/* Indicate that we only expect 64Kbps */
ast_str_append(a_buf, 0, "a=fmtp:%d bitrate=64000\r\n", rtp_code);
break;
+ case AST_FORMAT_SILK:
+ {
+ int val = 0;
+ if (!ast_format_get_value(format, SILK_ATTR_KEY_MAX_BITRATE, &val) && val > 5000 && val < 40000) {
+ ast_str_append(a_buf, 0, "a=fmtp:%d maxaveragebitrate=%u\r\n", rtp_code, val);
+ }
+ if (!ast_format_get_value(format, SILK_ATTR_KEY_DTX, &val)) {
+ ast_str_append(a_buf, 0, "a=fmtp:%d usedtx=%u\r\n", rtp_code, val ? 1 : 0);
+ }
+ if (!ast_format_get_value(format, SILK_ATTR_KEY_FEC, &val)) {
+ ast_str_append(a_buf, 0, "a=fmtp:%d useinbandfec=%u\r\n", rtp_code, val ? 1 : 0);
+ }
+ break;
+ }
}
if (fmt.cur_ms && (fmt.cur_ms < *min_packet_size))
@@ -11309,7 +11352,7 @@
{
struct sip_request resp;
int seqno;
-
+
if (sscanf(get_header(req, "CSeq"), "%30d ", &seqno) != 1) {
ast_log(LOG_WARNING, "Unable to get seqno from '%s'\n", get_header(req, "CSeq"));
return -1;
@@ -11908,17 +11951,17 @@
/* Strip of the starting " (if it's there) */
if (*headdup == '"') {
- headdup++;
+ headdup++;
}
if ((content = strchr(headdup, ':'))) {
*content++ = '\0';
content = ast_skip_blanks(content); /* Skip white space */
/* Strip the ending " (if it's there) */
- end = content + strlen(content) -1;
+ end = content + strlen(content) -1;
if (*end == '"') {
*end = '\0';
}
-
+
add_header(&req, headdup, content);
if (sipdebug) {
ast_debug(1, "Adding SIP Header \"%s\" with content :%s: \n", headdup, content);
@@ -12910,7 +12953,7 @@
if (!ast_strlen_zero(global_useragent))
add_header(&req, "User-Agent", global_useragent);
- if (auth) { /* Add auth header */
+ if (auth) { /* Add auth header */
add_header(&req, authheader, auth);
} else if (!ast_strlen_zero(r->nonce)) {
char digest[1024];
@@ -12989,7 +13032,7 @@
static int transmit_refer(struct sip_pvt *p, const char *dest)
{
struct sip_request req = {
- .headers = 0,
+ .headers = 0,
};
char from[256];
const char *of;
@@ -13718,7 +13761,7 @@
/* We only want to create the route set the first time this is called */
p->route_persistent = 1;
-
+
/* Build a tailq, then assign it to p->route when done.
* If backwards, we add entries from the head so they end up
* in reverse order. However, we do need to maintain a correct
@@ -14967,7 +15010,7 @@
}
/* Search dialogs and find the match */
-
+
sip_pvt_ptr = ao2_t_find(dialogs, &tmp_dialog, OBJ_POINTER, "ao2_find of dialog in dialogs table");
if (sip_pvt_ptr) {
/* Go ahead and lock it (and its owner) before returning */
@@ -15020,7 +15063,7 @@
return NULL;
}
}
-
+
if (totag)
ast_debug(4, "Matched %s call - their tag is %s Our tag is %s\n",
sip_pvt_ptr->outgoing_call == TRUE ? "OUTGOING": "INCOMING",
@@ -15145,7 +15188,7 @@
}
ast_copy_string(referdata->replaces_callid_totag, ptr, sizeof(referdata->replaces_callid_totag));
}
-
+
if (from) {
ptr = from + 9;
if ((to = strchr(ptr, '&'))) {
@@ -15156,14 +15199,22 @@
}
ast_copy_string(referdata->replaces_callid_fromtag, ptr, sizeof(referdata->replaces_callid_fromtag));
}
-
+
+ if (!strcmp(referdata->replaces_callid, transferer->callid) &&
+ (!sip_cfg.pedanticsipchecking ||
+ (!strcmp(referdata->replaces_callid_fromtag, transferer->theirtag) &&
+ !strcmp(referdata->replaces_callid_totag, transferer->tag)))) {
+ ast_log(LOG_WARNING, "Got an attempt to replace own Call-ID on %s\n", transferer->callid);
+ return -4;
+ }
+
if (!sip_cfg.pedanticsipchecking) {
ast_debug(2, "Attended transfer: Will use Replace-Call-ID : %s (No check of from/to tags)\n", referdata->replaces_callid );
} else {
ast_debug(2, "Attended transfer: Will use Replace-Call-ID : %s F-tag: %s T-tag: %s\n", referdata->replaces_callid, referdata->replaces_callid_fromtag ? referdata->replaces_callid_fromtag : "<none>", referdata->replaces_callid_totag ? referdata->replaces_callid_totag : "<none>" );
}
}
-
+
if ((ptr = strchr(refer_to, '@'))) { /* Separate domain */
char *urioption = NULL, *domain;
int bracket = 0;
@@ -16475,7 +16526,7 @@
sip_pvt_unlock(dialog);
return 0;
}
-
+
if (dialog->vrtp && ast_rtp_instance_get_bridged(dialog->vrtp)) {
ast_debug(2, "Bridge still active. Delaying destroy of SIP dialog '%s' Method: %s\n", dialog->callid, sip_methods[dialog->method].text);
sip_pvt_unlock(dialog);
@@ -18529,16 +18580,16 @@
memset(digest, 0, sizeof(digest));
if (reply_digest(p, req, header, SIP_REGISTER, digest, sizeof(digest))) {
/* There's nothing to use for authentication */
- /* No digest challenge in request */
- if (sip_debug_test_pvt(p) && p->registry)
- ast_verbose("No authentication challenge, sending blank registration to domain/host name %s\n", p->registry->hostname);
- /* No old challenge */
+ /* No digest challenge in request */
+ if (sip_debug_test_pvt(p) && p->registry)
+ ast_verbose("No authentication challenge, sending blank registration to domain/host name %s\n", p->registry->hostname);
+ /* No old challenge */
return -1;
}
if (p->do_history)
append_history(p, "RegistryAuth", "Try: %d", p->authtries);
- if (sip_debug_test_pvt(p) && p->registry)
- ast_verbose("Responding to challenge, registration to domain/host name %s\n", p->registry->hostname);
+ if (sip_debug_test_pvt(p) && p->registry)
+ ast_verbose("Responding to challenge, registration to domain/host name %s\n", p->registry->hostname);
return transmit_register(p->registry, SIP_REGISTER, digest, respheader);
}
@@ -18668,28 +18719,30 @@
snprintf(cnonce, sizeof(cnonce), "%08lx", ast_random());
- /* Check if we have separate auth credentials */
- if(!(auth = find_realm_authentication(p->peerauth, p->realm))) /* Start with peer list */
- auth = find_realm_authentication(authl, p->realm); /* If not, global list */
-
- if (auth) {
+ /* Check if we have separate auth credentials */
+ if(!(auth = find_realm_authentication(p->peerauth, p->realm))) /* Start with peer list */
+ auth = find_realm_authentication(authl, p->realm); /* If not, global list */
+
+ if (auth) {
ast_debug(3, "use realm [%s] from peer [%s][%s]\n", auth->username, p->peername, p->username);
- username = auth->username;
- secret = auth->secret;
- md5secret = auth->md5secret;
+ username = auth->username;
+ secret = auth->secret;
+ md5secret = auth->md5secret;
if (sipdebug)
- ast_debug(1, "Using realm %s authentication for call %s\n", p->realm, p->callid);
- } else {
- /* No authentication, use peer or register= config */
- username = p->authname;
- secret = p->peersecret;
- md5secret = p->peermd5secret;
- }
+ ast_debug(1, "Using realm %s authentication for call %s\n", p->realm, p->callid);
+ } else {
+ /* No authentication, use peer or register= config */
+ username = p->authname;
+ secret = p->relatedpeer
+ && !ast_strlen_zero(p->relatedpeer->remotesecret)
+ ? p->relatedpeer->remotesecret : p->peersecret;
+ md5secret = p->peermd5secret;
+ }
if (ast_strlen_zero(username)) /* We have no authentication */
return -1;
- /* Calculate SIP digest response */
- snprintf(a1, sizeof(a1), "%s:%s:%s", username, p->realm, secret);
+ /* Calculate SIP digest response */
+ snprintf(a1, sizeof(a1), "%s:%s:%s", username, p->realm, secret);
snprintf(a2, sizeof(a2), "%s:%s", sip_methods[method].text, uri);
if (!ast_strlen_zero(md5secret))
ast_copy_string(a1_hash, md5secret, sizeof(a1_hash));
@@ -19173,7 +19226,7 @@
/* Perhaps there is an SD change INVITE outstanding */
transmit_request_with_auth(p, SIP_BYE, 0, XMIT_RELIABLE, TRUE);
}
- ast_clear_flag(&p->flags[0], SIP_PENDINGBYE);
+ ast_clear_flag(&p->flags[0], SIP_PENDINGBYE);
sip_scheddestroy(p, DEFAULT_TRANS_TIMEOUT);
} else if (ast_test_flag(&p->flags[0], SIP_NEEDREINVITE)) {
/* if we can't REINVITE, hold it for later */
@@ -19183,7 +19236,7 @@
ast_debug(2, "Sending pending reinvite on '%s'\n", p->callid);
/* Didn't get to reinvite yet, so do it now */
transmit_reinvite_with_sdp(p, (p->t38.state == T38_LOCAL_REINVITE ? TRUE : FALSE), FALSE);
- ast_clear_flag(&p->flags[0], SIP_NEEDREINVITE);
+ ast_clear_flag(&p->flags[0], SIP_NEEDREINVITE);
}
}
}
@@ -20037,7 +20090,7 @@
pvt_set_needdestroy(p, "received erroneous 200 response");
return 0;
}
-
+
r->regstate = REG_STATE_REGISTERED;
r->regtime = ast_tvnow(); /* Reset time of last successful registration */
manager_event(EVENT_FLAG_SYSTEM, "Registry", "ChannelType: SIP\r\nDomain: %s\r\nStatus: %s\r\n", r->hostname, regstate2str(r->regstate));
@@ -20053,7 +20106,7 @@
/* Let this one hang around until we have all the responses */
sip_scheddestroy(p, DEFAULT_TRANS_TIMEOUT);
/* p->needdestroy = 1; */
-
+
/* set us up for re-registering
* figure out how long we got registered for
* according to section 6.13 of RFC, contact headers override
@@ -20611,7 +20664,7 @@
break;
default: /* Errors without handlers */
if ((resp >= 100) && (resp < 200)) {
- if (sipmethod == SIP_INVITE) { /* re-invite */
+ if (sipmethod == SIP_INVITE) { /* re-invite */
if (!req->ignore && sip_cancel_destroy(p))
ast_log(LOG_WARNING, "Unable to cancel SIP destruction. Expect bad things.\n");
}
@@ -20678,7 +20731,6 @@
}
res = ast_park_call(transferee, transferer, 0, d->parkexten, &ext);
-
#ifdef WHEN_WE_KNOW_THAT_THE_CLIENT_SUPPORTS_MESSAGE
if (!res) {
@@ -20825,14 +20877,14 @@
static int attempt_transfer(struct sip_dual *transferer, struct sip_dual *target)
{
int res = 0;
- struct ast_channel *peera = NULL,
+ struct ast_channel *peera = NULL,
*peerb = NULL,
*peerc = NULL,
*peerd = NULL;
/* We will try to connect the transferee with the target and hangup
- all channels to the transferer */
+ all channels to the transferer */
ast_debug(4, "Sip transfer:--------------------\n");
if (transferer->chan1)
ast_debug(4, "-- Transferer to PBX channel: %s State %s\n", transferer->chan1->name, ast_state2str(transferer->chan1->_state));
@@ -20867,7 +20919,7 @@
if (peera && peerb && peerc && (peerb != peerc)) {
ast_quiet_chan(peera); /* Stop generators */
- ast_quiet_chan(peerb);
+ ast_quiet_chan(peerb);
ast_quiet_chan(peerc);
if (peerd)
ast_quiet_chan(peerd);
@@ -20986,7 +21038,7 @@
*sep++ = '\0';
eventid = sep;
}
-
+
if (sipdebug)
ast_debug(2, "Got NOTIFY Event: %s\n", event);
@@ -21006,7 +21058,7 @@
We are getting notifications on a call that we transfered
We should hangup when we are getting a 200 OK in a sipfrag
Check if we have an owner of this event */
-
+
/* Check the content type */
if (strncasecmp(get_header(req, "Content-Type"), "message/sipfrag", strlen("message/sipfrag"))) {
/* We need a sipfrag */
@@ -22647,7 +22699,7 @@
transmit_response(p, "202 Accepted", req);
append_history(p, "Xfer", "Refer failed. Bad extension.");
transmit_notify_with_sipfrag(p, seqno, "404 Not found", TRUE);
- ast_clear_flag(&p->flags[0], SIP_GOTREFER);
+ ast_clear_flag(&p->flags[0], SIP_GOTREFER);
if (req->debug)
ast_debug(1, "SIP transfer to bad extension: %s\n", p->refer->refer_to);
break;
@@ -22885,7 +22937,7 @@
if (p->owner)
p->owner->hangupcause = AST_CAUSE_NORMAL_CLEARING;
append_history(p, "Xfer", "Refer succeeded.");
- ast_clear_flag(&p->flags[0], SIP_GOTREFER);
+ ast_clear_flag(&p->flags[0], SIP_GOTREFER);
/* Do not hangup call, the other side do that when we say 200 OK */
/* We could possibly implement a timer here, auto congestion */
res = 0;
@@ -22896,7 +22948,7 @@
/* Failure of some kind */
p->refer->status = REFER_FAILED;
transmit_notify_with_sipfrag(p, seqno, "503 Service Unavailable", TRUE);
- ast_clear_flag(&p->flags[0], SIP_GOTREFER);
+ ast_clear_flag(&p->flags[0], SIP_GOTREFER);
res = -1;
}
@@ -23701,12 +23753,12 @@
int resubscribe = (p->subscribed != NONE) && !req->ignore;
char *temp, *event;
- if (p->initreq.headers) {
+ if (p->initreq.headers) {
/* We already have a dialog */
if (p->initreq.method != SIP_SUBSCRIBE) {
/* This is a SUBSCRIBE within another SIP dialog, which we do not support */
/* For transfers, this could happen, but since we haven't seen it happening, let us just refuse this */
- transmit_response(p, "403 Forbidden (within dialog)", req);
+ transmit_response(p, "403 Forbidden (within dialog)", req);
/* Do not destroy session, since we will break the call if we do */
ast_debug(1, "Got a subscription within the context of another call, can't handle that - %s (Method %s)\n", p->callid, sip_methods[p->initreq.method].text);
return 0;
@@ -23722,7 +23774,7 @@
if so, we don't have to check peer settings after auth, which saves a lot of processing
*/
if (!sip_cfg.allowsubscribe) {
- transmit_response(p, "403 Forbidden (policy)", req);
+ transmit_response(p, "403 Forbidden (policy)", req);
pvt_set_needdestroy(p, "forbidden");
return 0;
}
@@ -23763,7 +23815,7 @@
if ( (strchr(eventheader, ';'))) {
event = ast_strdupa(eventheader); /* Since eventheader is a const, we can't change it */
- temp = strchr(event, ';');
+ temp = strchr(event, ';');
*temp = '\0'; /* Remove any options for now */
/* We might need to use them later :-) */
} else
@@ -23915,7 +23967,7 @@
while (!found_supported && !ast_strlen_zero(acceptheader)) {
found_supported = strcmp(acceptheader, "application/simple-message-summary") ? 0 : 1;
if (!found_supported && (option_debug > 2)) {
- ast_log(LOG_DEBUG, "Received SIP mailbox subscription for unknown format: %s\n", acceptheader);
+ ast_debug(1, "Received SIP mailbox subscription for unknown format: %s\n", acceptheader);
}
acceptheader = __get_header(req, "Accept", &start);
}
@@ -24228,8 +24280,7 @@
/* New SIP request coming in
(could be new request in existing SIP dialog as well...)
- */
-
+ */
p->method = req->method; /* Find out which SIP method they are using */
ast_debug(4, "**** Received %s (%d) - Command in SIP %s\n", sip_methods[p->method].text, sip_methods[p->method].id, cmd);
@@ -24497,7 +24548,7 @@
/* Request failed */
ast_debug(1, "SIP message could not be handled, bad request: %-70.70s\n", p->callid[0] ? p->callid : "<no callid>");
}
-
+
if (recount) {
ast_update_use_count();
}
@@ -25453,7 +25504,7 @@
if ((p = find_peer(host, NULL, FALSE, FINDALLDEVICES, TRUE, 0))) {
if (!(ast_sockaddr_isnull(&p->addr) && ast_sockaddr_isnull(&p->defaddr))) {
/* we have an address for the peer */
-
+
/* Check status in this order
- Hold
- Ringing
@@ -25666,7 +25717,7 @@
ao2_t_unlink(dialogs, p, "About to change the callid -- remove the old name");
build_callid_pvt(p);
ao2_t_link(dialogs, p, "Linking in under new name");
-
+
/* We have an extension to call, don't use the full contact here */
/* This to enable dialing registered peers with extension dialling,
like SIP/peername/extension
@@ -25951,7 +26002,7 @@
AST_LIST_INSERT_TAIL(&domain_list, d, list);
AST_LIST_UNLOCK(&domain_list);
- if (sipdebug)
+ if (sipdebug)
ast_debug(1, "Added local SIP domain '%s'\n", domain);
return 1;
@@ -25970,7 +26021,7 @@
if (len && !ast_strlen_zero(d->context))
ast_copy_string(context, d->context, len);
-
+
result = 1;
break;
}
@@ -26205,7 +26256,6 @@
AST_LIST_TRAVERSE(&peer->mailboxes, mailbox, entry) {
if (!strcmp(mailbox->mailbox, mbox) && !strcmp(S_OR(mailbox->context, ""), S_OR(context, ""))) {
duplicate = 1;
- mailbox->delme = 0;
break;
}
}
@@ -27199,7 +27249,7 @@
sip_cfg.allowguest = ast_true(v->value) ? 1 : 0;
} else if (!strcasecmp(v->name, "realm")) {
ast_copy_string(sip_cfg.realm, v->value, sizeof(sip_cfg.realm));
- } else if (!strcasecmp(v->name, "domainsasrealm")) {
+ } else if (!strcasecmp(v->name, "domainsasrealm")) {
sip_cfg.domainsasrealm = ast_true(v->value);
} else if (!strcasecmp(v->name, "useragent")) {
ast_copy_string(global_useragent, v->value, sizeof(global_useragent));
@@ -27803,7 +27853,7 @@
STANDARD_TLS_PORT);
}
ast_tcptls_server_start(&sip_tls_desc);
- if (default_tls_cfg.enabled && sip_tls_desc.accept_fd == -1) {
+ if (default_tls_cfg.enabled && sip_tls_desc.accept_fd == -1) {
ast_log(LOG_ERROR, "TLS Server start failed. Not listening on TLS socket.\n");
sip_tls_desc.tls_cfg = NULL;
}
@@ -28029,12 +28079,25 @@
static int sip_set_udptl_peer(struct ast_channel *chan, struct ast_udptl *udptl)
{
struct sip_pvt *p;
-
+
p = chan->tech_pvt;
if (!p) {
return -1;
}
+ /*
+ * Lock both the pvt and it's owner safely.
+ */
sip_pvt_lock(p);
+ while (p->owner && ast_channel_trylock(p->owner)) {
+ sip_pvt_unlock(p);
+ usleep(1);
+ sip_pvt_lock(p);
+ }
+
+ if (!p->owner) {
+ sip_pvt_unlock(p);
+ return 0;
+ }
if (udptl) {
ast_udptl_get_peer(udptl, &p->udptlredirip);
} else {
@@ -28053,6 +28116,7 @@
}
/* Reset lastrtprx timer */
p->lastrtprx = p->lastrtptx = time(NULL);
+ ast_channel_unlock(p->owner);
sip_pvt_unlock(p);
return 0;
}
@@ -28170,9 +28234,24 @@
return 0;
}
+ /*
+ * Lock both the pvt and it's owner safely.
+ */
sip_pvt_lock(p);
+ while (p->owner && ast_channel_trylock(p->owner)) {
+ sip_pvt_unlock(p);
+ usleep(1);
+ sip_pvt_lock(p);
+ }
+
+ if (!p->owner) {
+ sip_pvt_unlock(p);
+ return 0;
+ }
+
if (p->alreadygone) {
/* If we're destroyed, don't bother */
+ ast_channel_unlock(p->owner);
sip_pvt_unlock(p);
return 0;
}
@@ -28181,6 +28260,7 @@
that are known to be behind a NAT, then stop the process now
*/
if (nat_active && !ast_test_flag(&p->flags[0], SIP_DIRECT_MEDIA_NAT)) {
+ ast_channel_unlock(p->owner);
sip_pvt_unlock(p);
return 0;
}
@@ -28223,6 +28303,7 @@
}
/* Reset lastrtprx timer */
p->lastrtprx = p->lastrtptx = time(NULL);
+ ast_channel_unlock(p->owner);
sip_pvt_unlock(p);
return 0;
}
@@ -28345,7 +28426,7 @@
{
struct ast_var_t *newvariable;
struct varshead *headp;
- int removeall = 0;
+ int removeall = 0;
char *inbuf = (char *) data;
if (ast_strlen_zero(inbuf)) {
@@ -28564,7 +28645,7 @@
static int sip_do_reload(enum channelreloadreason reason)
{
time_t start_poke, end_poke;
-
+
reload_config(reason);
ast_sched_dump(sched);
@@ -28583,7 +28664,7 @@
sip_send_all_mwi_subscriptions();
end_poke = time(0);
-
+
ast_debug(4, "do_reload finished. peer poke/prune reg contact time = %d sec.\n", (int)(end_poke-start_poke));
ast_debug(4, "--------------- SIP reload done\n");
@@ -28594,7 +28675,7 @@
/*! \brief Force reload of module from cli */
static char *sip_reload(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
{
-
+
switch (cmd) {
case CLI_INIT:
e->command = "sip reload";
Modified: team/may/chan_ooh323_evo/codecs/codec_ilbc.c
URL: http://svnview.digium.com/svn/asterisk/team/may/chan_ooh323_evo/codecs/codec_ilbc.c?view=diff&rev=315048&r1=315047&r2=315048
==============================================================================
--- team/may/chan_ooh323_evo/codecs/codec_ilbc.c (original)
+++ team/may/chan_ooh323_evo/codecs/codec_ilbc.c Sat Apr 23 12:48:35 2011
@@ -89,7 +89,7 @@
float tmpf[ILBC_SAMPLES];
if (!f->data.ptr && f->datalen) {
- ast_log(LOG_DEBUG, "issue 16070, ILIB ERROR. data = NULL datalen = %d src = %s\n", f->datalen, f->src ? f->src : "no src set");
+ ast_debug(1, "issue 16070, ILIB ERROR. data = NULL datalen = %d src = %s\n", f->datalen, f->src ? f->src : "no src set");
f->datalen = 0;
}
@@ -104,12 +104,12 @@
ast_log(LOG_WARNING, "Huh? An ilbc frame that isn't a multiple of 50 bytes long from %s (%d)?\n", f->src, f->datalen);
return -1;
}
-
+
for (x=0; x < f->datalen ; x += ILBC_FRAME_LEN) {
- if (pvt->samples + ILBC_SAMPLES > BUFFER_SAMPLES) {
+ if (pvt->samples + ILBC_SAMPLES > BUFFER_SAMPLES) {
ast_log(LOG_WARNING, "Out of buffer space\n");
return -1;
- }
+ }
iLBC_decode(tmpf, plc_mode ? f->data.ptr + x : NULL, &tmp->dec, plc_mode);
for ( i=0; i < ILBC_SAMPLES; i++)
dst[pvt->samples + i] = tmpf[i];
@@ -198,8 +198,8 @@
{
int res;
- ast_format_set(&ilibctolin.src_format, AST_FORMAT_ILBC, 0);
- ast_format_set(&ilibctolin.dst_format, AST_FORMAT_SLINEAR, 0);
+ ast_format_set(&ilbctolin.src_format, AST_FORMAT_ILBC, 0);
+ ast_format_set(&ilbctolin.dst_format, AST_FORMAT_SLINEAR, 0);
ast_format_set(&lintoilbc.src_format, AST_FORMAT_SLINEAR, 0);
ast_format_set(&lintoilbc.dst_format, AST_FORMAT_ILBC, 0);
Modified: team/may/chan_ooh323_evo/codecs/ex_ilbc.h
URL: http://svnview.digium.com/svn/asterisk/team/may/chan_ooh323_evo/codecs/ex_ilbc.h?view=diff&rev=315048&r1=315047&r2=315048
==============================================================================
--- team/may/chan_ooh323_evo/codecs/ex_ilbc.h (original)
+++ team/may/chan_ooh323_evo/codecs/ex_ilbc.h Sat Apr 23 12:48:35 2011
@@ -19,7 +19,6 @@
{
static struct ast_frame f = {
.frametype = AST_FRAME_VOICE,
- .subclass.codec = AST_FORMAT_ILBC,
.datalen = sizeof(ex_ilbc),
/* All frames are 30 ms long */
.samples = ILBC_SAMPLES,
@@ -29,5 +28,6 @@
.data.ptr = ex_ilbc,
};
+ ast_format_set(&f.subclass.format, AST_FORMAT_ILBC, 0);
return &f;
}
Modified: team/may/chan_ooh323_evo/include/asterisk/format_cap.h
URL: http://svnview.digium.com/svn/asterisk/team/may/chan_ooh323_evo/include/asterisk/format_cap.h?view=diff&rev=315048&r1=315047&r2=315048
==============================================================================
--- team/may/chan_ooh323_evo/include/asterisk/format_cap.h (original)
+++ team/may/chan_ooh323_evo/include/asterisk/format_cap.h Sat Apr 23 12:48:35 2011
@@ -207,6 +207,14 @@
* \retval 0, joint capabilities do not exist
*/
int ast_format_cap_joint_copy(const struct ast_format_cap *cap1, const struct ast_format_cap *cap2, struct ast_format_cap *result);
+
+/*!
+ * \brief Get joint capability structure, append into result capabilities structure
+ *
+ * \retval 1, joint capabilities exist
+ * \retval 0, joint capabilities do not exist
+ */
+int ast_format_cap_joint_append(const struct ast_format_cap *cap1, const struct ast_format_cap *cap2, struct ast_format_cap *result);
/*!
* \brief Find out if capability structures have any joint capabilities without
Modified: team/may/chan_ooh323_evo/main/app.c
URL: http://svnview.digium.com/svn/asterisk/team/may/chan_ooh323_evo/main/app.c?view=diff&rev=315048&r1=315047&r2=315048
==============================================================================
--- team/may/chan_ooh323_evo/main/app.c (original)
+++ team/may/chan_ooh323_evo/main/app.c Sat Apr 23 12:48:35 2011
@@ -1481,9 +1481,9 @@
snprintf(s, strlen(path) + 19, "%s/lock", path);
unlink(s);
path_lock_destroy(p);
- ast_log(LOG_DEBUG, "Unlocked path '%s'\n", path);
+ ast_debug(1, "Unlocked path '%s'\n", path);
} else {
- ast_log(LOG_DEBUG, "Failed to unlock path '%s': "
+ ast_debug(1, "Failed to unlock path '%s': "
"lock not found\n", path);
}
Modified: team/may/chan_ooh323_evo/main/ccss.c
URL: http://svnview.digium.com/svn/asterisk/team/may/chan_ooh323_evo/main/ccss.c?view=diff&rev=315048&r1=315047&r2=315048
==============================================================================
--- team/may/chan_ooh323_evo/main/ccss.c (original)
+++ team/may/chan_ooh323_evo/main/ccss.c Sat Apr 23 12:48:35 2011
@@ -2640,6 +2640,21 @@
return NULL;
}
ast_format_cap_destroy(tmp_cap);
+
[... 1415 lines stripped ...]
More information about the asterisk-commits
mailing list