[asterisk-commits] bweschke: branch bweschke/eventq-sanity-checks
r58786 - in /team/bweschke/eve...
asterisk-commits at lists.digium.com
asterisk-commits at lists.digium.com
Sun Mar 11 18:39:41 MST 2007
Author: bweschke
Date: Sun Mar 11 20:39:41 2007
New Revision: 58786
URL: http://svn.digium.com/view/asterisk?view=rev&rev=58786
Log:
Merged revisions 58474,58479,58510,58512,58584,58604,58638,58669,58705,58779,58783 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4
................
r58474 | russell | 2007-03-08 15:54:56 -0500 (Thu, 08 Mar 2007) | 3 lines
Refactor hold handling a bit so that it does not require keeping the call up
when a call is put on hold.
................
r58479 | tilghman | 2007-03-08 16:33:03 -0500 (Thu, 08 Mar 2007) | 2 lines
Fix segfault (Issue 9236)
................
r58510 | russell | 2007-03-08 17:06:54 -0500 (Thu, 08 Mar 2007) | 3 lines
Add a missing break statement so that handling the above event does not
incorrectly destroy the channel. (issue #9242, andrew)
................
r58512 | russell | 2007-03-08 17:15:15 -0500 (Thu, 08 Mar 2007) | 5 lines
Hang up the channel that put the call on hold in the event processing thread to
avoid a race condition. Also, if the station originated the call that it is
putting on hold, don't hang up the trunk if it was the only station on the call
and it is hanging up due to hold and not a normal hangup.
................
r58584 | file | 2007-03-09 15:49:47 -0500 (Fri, 09 Mar 2007) | 10 lines
Merged revisions 58579 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.2
........
r58579 | file | 2007-03-09 15:46:43 -0500 (Fri, 09 Mar 2007) | 2 lines
If we are unable to lookup the host in a c line we have to abort, otherwise the previous data is gone and we will (potentially) have no data when all is said and done.
........
................
r58604 | file | 2007-03-09 16:08:19 -0500 (Fri, 09 Mar 2007) | 2 lines
Fix spelling of unavailable in voicemail documentation. (issue #9248 reported by tensai)
................
r58638 | russell | 2007-03-09 18:59:10 -0500 (Fri, 09 Mar 2007) | 8 lines
Merge some updates to the SLA documentation. I plan to keep working on this
to explain all of the expected behavior with call handling, configuration
details for specific phones, and other things. However, I got tired of doing
it in plain text, so I switched to using LaTeX. I have included the PDF version.
I haven't been able to get a nice looking plain text version out of it yet, but
I'm not terribly concerned since this is supposed to be more of the manual,
while the plain text sample configuration file is the reference.
................
r58669 | russell | 2007-03-09 22:58:27 -0500 (Fri, 09 Mar 2007) | 2 lines
Make the compiler happy and initialize a variable.
................
r58705 | russell | 2007-03-10 13:11:11 -0500 (Sat, 10 Mar 2007) | 6 lines
Fix a few more places in chan_iax2 where the ast_frame used for receiving a
frame was not properly initialized.
- Interpolating a frame when the jitterbuffer is in use
- decrypting a frame when IAX2 encryption is on
- frames in an IAX2 trunk
................
r58779 | file | 2007-03-11 20:51:16 -0400 (Sun, 11 Mar 2007) | 2 lines
Add matchexterniplocally setting which only substitutes your externip/externhost setting if it matches the localnet setting. I know of at least two people who need opposite settings, so I made it an option! (issue #8821 reported by kokoskarokoska)
................
r58783 | file | 2007-03-11 21:21:12 -0400 (Sun, 11 Mar 2007) | 2 lines
Allow RFC2833 compensation to compensate for even stupider implementations by queueing up the end frame at the start, not the actual end. (issue #8963 reported by AndrewZ)
................
Added:
team/bweschke/eventq-sanity-checks/doc/sla.pdf (props changed)
- copied unchanged from r58783, branches/1.4/doc/sla.pdf
team/bweschke/eventq-sanity-checks/doc/sla.tex (props changed)
- copied unchanged from r58783, branches/1.4/doc/sla.tex
Removed:
team/bweschke/eventq-sanity-checks/doc/sla.txt
Modified:
team/bweschke/eventq-sanity-checks/ (props changed)
team/bweschke/eventq-sanity-checks/apps/app_meetme.c
team/bweschke/eventq-sanity-checks/apps/app_voicemail.c
team/bweschke/eventq-sanity-checks/channels/chan_iax2.c
team/bweschke/eventq-sanity-checks/channels/chan_sip.c
team/bweschke/eventq-sanity-checks/channels/chan_zap.c
team/bweschke/eventq-sanity-checks/configs/sip.conf.sample
team/bweschke/eventq-sanity-checks/main/rtp.c
team/bweschke/eventq-sanity-checks/res/res_odbc.c
Propchange: team/bweschke/eventq-sanity-checks/
------------------------------------------------------------------------------
Binary property 'branch-1.2-merged' - no diff available.
Propchange: team/bweschke/eventq-sanity-checks/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Sun Mar 11 20:39:41 2007
@@ -1,1 +1,1 @@
-/branches/1.4:1-58437
+/branches/1.4:1-58785
Modified: team/bweschke/eventq-sanity-checks/apps/app_meetme.c
URL: http://svn.digium.com/view/asterisk/team/bweschke/eventq-sanity-checks/apps/app_meetme.c?view=diff&rev=58786&r1=58785&r2=58786
==============================================================================
--- team/bweschke/eventq-sanity-checks/apps/app_meetme.c (original)
+++ team/bweschke/eventq-sanity-checks/apps/app_meetme.c Sun Mar 11 20:39:41 2007
@@ -65,6 +65,7 @@
#include "asterisk/astobj.h"
#include "asterisk/devicestate.h"
#include "asterisk/dial.h"
+#include "asterisk/causes.h"
#include "enter.h"
#include "leave.h"
@@ -366,6 +367,7 @@
SLA_TRUNK_STATE_RINGING,
SLA_TRUNK_STATE_UP,
SLA_TRUNK_STATE_ONHOLD,
+ SLA_TRUNK_STATE_ONHOLD_BYME,
};
enum sla_hold_access {
@@ -454,8 +456,6 @@
enum sla_event_type {
/*! A station has put the call on hold */
SLA_EVENT_HOLD,
- /*! A station has taken the call off of hold */
- SLA_EVENT_UNHOLD,
/*! The state of a dial has changed */
SLA_EVENT_DIAL_STATE,
/*! The state of a ringing trunk has changed */
@@ -1065,6 +1065,7 @@
S(SLA_TRUNK_STATE_RINGING)
S(SLA_TRUNK_STATE_UP)
S(SLA_TRUNK_STATE_ONHOLD)
+ S(SLA_TRUNK_STATE_ONHOLD_BYME)
}
return "Uknown State";
#undef S
@@ -1273,7 +1274,7 @@
}
/*! \brief Queue a SLA event from the conference */
-static void sla_queue_event_conf(enum sla_event_type type, const struct ast_channel *chan,
+static void sla_queue_event_conf(enum sla_event_type type, struct ast_channel *chan,
struct ast_conference *conf)
{
struct sla_station *station;
@@ -2094,8 +2095,6 @@
case AST_CONTROL_HOLD:
sla_queue_event_conf(SLA_EVENT_HOLD, chan, conf);
break;
- case AST_CONTROL_UNHOLD:
- sla_queue_event_conf(SLA_EVENT_UNHOLD, chan, conf);
default:
break;
}
@@ -3094,7 +3093,8 @@
return station;
}
-static int sla_check_station_hold_access(const struct sla_trunk *trunk)
+static int sla_check_station_hold_access(const struct sla_trunk *trunk,
+ const struct sla_station *station)
{
struct sla_station_ref *station_ref;
struct sla_trunk_ref *trunk_ref;
@@ -3102,9 +3102,9 @@
/* For each station that has this call on hold, check for private hold. */
AST_LIST_TRAVERSE(&trunk->stations, station_ref, entry) {
AST_LIST_TRAVERSE(&station_ref->station->trunks, trunk_ref, entry) {
- if (trunk_ref->trunk != trunk)
+ if (trunk_ref->trunk != trunk || station_ref->station == station)
continue;
- if (trunk_ref->state == SLA_TRUNK_STATE_ONHOLD && trunk_ref->chan &&
+ if (trunk_ref->state == SLA_TRUNK_STATE_ONHOLD_BYME &&
station_ref->station->hold_access == SLA_HOLD_PRIVATE)
return 1;
return 0;
@@ -3133,8 +3133,9 @@
if ( (trunk_ref->trunk->barge_disabled
&& trunk_ref->state != SLA_TRUNK_STATE_IDLE) ||
(trunk_ref->trunk->hold_stations
- && trunk_ref->trunk->hold_access == SLA_HOLD_PRIVATE) ||
- sla_check_station_hold_access(trunk_ref->trunk) )
+ && trunk_ref->trunk->hold_access == SLA_HOLD_PRIVATE
+ && trunk_ref->state != SLA_TRUNK_STATE_ONHOLD_BYME) ||
+ sla_check_station_hold_access(trunk_ref->trunk, station) )
trunk_ref = NULL;
break;
@@ -3169,14 +3170,15 @@
}
static void sla_change_trunk_state(const struct sla_trunk *trunk, enum sla_trunk_state state,
- enum sla_which_trunk_refs inactive_only)
+ enum sla_which_trunk_refs inactive_only, const struct sla_trunk_ref *exclude)
{
struct sla_station *station;
struct sla_trunk_ref *trunk_ref;
AST_LIST_TRAVERSE(&sla_stations, station, entry) {
AST_LIST_TRAVERSE(&station->trunks, trunk_ref, entry) {
- if (trunk_ref->trunk != trunk || (inactive_only ? trunk_ref->chan : 0))
+ if (trunk_ref->trunk != trunk || (inactive_only ? trunk_ref->chan : 0)
+ || trunk_ref == exclude)
continue;
trunk_ref->state = state;
ast_device_state_changed("SLA:%s_%s", station->name, trunk->name);
@@ -3222,10 +3224,11 @@
conf = NULL;
}
trunk_ref->chan = NULL;
- if (ast_atomic_dec_and_test((int *) &trunk_ref->trunk->active_stations)) {
+ if (ast_atomic_dec_and_test((int *) &trunk_ref->trunk->active_stations) &&
+ !trunk_ref->trunk->hold_stations) {
strncat(conf_name, "|K", sizeof(conf_name) - strlen(conf_name) - 1);
admin_exec(NULL, conf_name);
- sla_change_trunk_state(trunk_ref->trunk, SLA_TRUNK_STATE_IDLE, ALL_TRUNK_REFS);
+ sla_change_trunk_state(trunk_ref->trunk, SLA_TRUNK_STATE_IDLE, ALL_TRUNK_REFS, NULL);
}
ast_dial_join(station->dial);
@@ -3242,7 +3245,7 @@
snprintf(buf, sizeof(buf), "SLA_%s|K", ringing_trunk->trunk->name);
admin_exec(NULL, buf);
- sla_change_trunk_state(ringing_trunk->trunk, SLA_TRUNK_STATE_IDLE, ALL_TRUNK_REFS);
+ sla_change_trunk_state(ringing_trunk->trunk, SLA_TRUNK_STATE_IDLE, ALL_TRUNK_REFS, NULL);
while ((station_ref = AST_LIST_REMOVE_HEAD(&ringing_trunk->timed_out_stations, entry)))
free(station_ref);
@@ -3353,7 +3356,7 @@
struct sla_ringing_station *ringing_station;
AST_LIST_TRAVERSE_SAFE_BEGIN(&sla.ringing_stations, ringing_station, entry) {
- struct sla_trunk_ref *s_trunk_ref;
+ struct sla_trunk_ref *s_trunk_ref = NULL;
struct sla_ringing_trunk *ringing_trunk = NULL;
struct run_station_args args;
enum ast_dial_result dial_res;
@@ -3386,7 +3389,7 @@
s_trunk_ref->chan = ast_dial_answered(ringing_station->station->dial);
/* Actually answer the trunk */
ast_answer(ringing_trunk->trunk->chan);
- sla_change_trunk_state(ringing_trunk->trunk, SLA_TRUNK_STATE_UP, ALL_TRUNK_REFS);
+ sla_change_trunk_state(ringing_trunk->trunk, SLA_TRUNK_STATE_UP, ALL_TRUNK_REFS, NULL);
/* Now, start a thread that will connect this station to the trunk. The rest of
* the code here sets up the thread and ensures that it is able to save the arguments
* before they are no longer valid since they are allocated on the stack. */
@@ -3653,21 +3656,14 @@
static void sla_handle_hold_event(struct sla_event *event)
{
ast_atomic_fetchadd_int((int *) &event->trunk_ref->trunk->hold_stations, 1);
- event->trunk_ref->state = SLA_TRUNK_STATE_ONHOLD;
+ event->trunk_ref->state = SLA_TRUNK_STATE_ONHOLD_BYME;
ast_device_state_changed("SLA:%s_%s",
event->station->name, event->trunk_ref->trunk->name);
- sla_change_trunk_state(event->trunk_ref->trunk, SLA_TRUNK_STATE_ONHOLD, INACTIVE_TRUNK_REFS);
-}
-
-static void sla_handle_unhold_event(struct sla_event *event)
-{
- if (ast_atomic_dec_and_test((int *) &event->trunk_ref->trunk->hold_stations) == 1)
- sla_change_trunk_state(event->trunk_ref->trunk, SLA_TRUNK_STATE_UP, ALL_TRUNK_REFS);
- else {
- event->trunk_ref->state = SLA_TRUNK_STATE_UP;
- ast_device_state_changed("SLA:%s_%s",
- event->station->name, event->trunk_ref->trunk->name);
- }
+ sla_change_trunk_state(event->trunk_ref->trunk, SLA_TRUNK_STATE_ONHOLD,
+ INACTIVE_TRUNK_REFS, event->trunk_ref);
+
+ ast_softhangup(event->trunk_ref->chan, AST_CAUSE_NORMAL);
+ event->trunk_ref->chan = NULL;
}
/*! \brief Process trunk ring timeouts
@@ -3891,9 +3887,6 @@
switch (event->type) {
case SLA_EVENT_HOLD:
sla_handle_hold_event(event);
- break;
- case SLA_EVENT_UNHOLD:
- sla_handle_unhold_event(event);
break;
case SLA_EVENT_DIAL_STATE:
sla_handle_dial_state_event();
@@ -4036,7 +4029,6 @@
struct sla_station *station;
struct sla_trunk_ref *trunk_ref = NULL;
char conf_name[MAX_CONFNUM];
- int res;
struct ast_flags conf_flags = { 0 };
struct ast_conference *conf;
@@ -4066,9 +4058,9 @@
}
AST_RWLIST_RDLOCK(&sla_trunks);
- if (!ast_strlen_zero(trunk_name))
+ if (!ast_strlen_zero(trunk_name)) {
trunk_ref = sla_find_trunk_ref_byname(station, trunk_name);
- else
+ } else
trunk_ref = sla_choose_idle_trunk(station);
AST_RWLIST_UNLOCK(&sla_trunks);
@@ -4081,6 +4073,15 @@
}
pbx_builtin_setvar_helper(chan, "SLASTATION_STATUS", "CONGESTION");
return 0;
+ }
+
+ if (trunk_ref->state == SLA_TRUNK_STATE_ONHOLD_BYME) {
+ if (ast_atomic_dec_and_test((int *) &trunk_ref->trunk->hold_stations) == 1)
+ sla_change_trunk_state(trunk_ref->trunk, SLA_TRUNK_STATE_UP, ALL_TRUNK_REFS, NULL);
+ else {
+ trunk_ref->state = SLA_TRUNK_STATE_UP;
+ ast_device_state_changed("SLA:%s_%s", station->name, trunk_ref->trunk->name);
+ }
}
trunk_ref->chan = chan;
@@ -4096,7 +4097,7 @@
.cond_lock = &cond_lock,
.cond = &cond,
};
- sla_change_trunk_state(trunk_ref->trunk, SLA_TRUNK_STATE_UP, ALL_TRUNK_REFS);
+ sla_change_trunk_state(trunk_ref->trunk, SLA_TRUNK_STATE_UP, ALL_TRUNK_REFS, NULL);
/* Create a thread to dial the trunk and dump it into the conference.
* However, we want to wait until the trunk has been dialed and the
* conference is created before continuing on here. */
@@ -4116,7 +4117,7 @@
if (!trunk_ref->trunk->chan) {
ast_log(LOG_DEBUG, "Trunk didn't get created. chan: %lx\n", (long) trunk_ref->trunk->chan);
pbx_builtin_setvar_helper(chan, "SLASTATION_STATUS", "CONGESTION");
- sla_change_trunk_state(trunk_ref->trunk, SLA_TRUNK_STATE_IDLE, ALL_TRUNK_REFS);
+ sla_change_trunk_state(trunk_ref->trunk, SLA_TRUNK_STATE_IDLE, ALL_TRUNK_REFS, NULL);
trunk_ref->chan = NULL;
return 0;
}
@@ -4134,11 +4135,11 @@
conf = NULL;
}
trunk_ref->chan = NULL;
- res = ast_atomic_fetchadd_int((int *) &trunk_ref->trunk->active_stations, -1);
- if (res == 1) {
+ if (ast_atomic_dec_and_test((int *) &trunk_ref->trunk->active_stations) &&
+ !trunk_ref->trunk->hold_stations) {
strncat(conf_name, "|K", sizeof(conf_name) - strlen(conf_name) - 1);
admin_exec(NULL, conf_name);
- sla_change_trunk_state(trunk_ref->trunk, SLA_TRUNK_STATE_IDLE, ALL_TRUNK_REFS);
+ sla_change_trunk_state(trunk_ref->trunk, SLA_TRUNK_STATE_IDLE, ALL_TRUNK_REFS, NULL);
}
pbx_builtin_setvar_helper(chan, "SLASTATION_STATUS", "SUCCESS");
@@ -4168,7 +4169,7 @@
ringing_trunk->trunk = trunk;
ringing_trunk->ring_begin = ast_tvnow();
- sla_change_trunk_state(trunk, SLA_TRUNK_STATE_RINGING, 0);
+ sla_change_trunk_state(trunk, SLA_TRUNK_STATE_RINGING, ALL_TRUNK_REFS, NULL);
ast_mutex_lock(&sla.lock);
AST_LIST_INSERT_HEAD(&sla.ringing_trunks, ringing_trunk, entry);
@@ -4280,6 +4281,7 @@
res = AST_DEVICE_INUSE;
break;
case SLA_TRUNK_STATE_ONHOLD:
+ case SLA_TRUNK_STATE_ONHOLD_BYME:
res = AST_DEVICE_ONHOLD;
break;
}
Modified: team/bweschke/eventq-sanity-checks/apps/app_voicemail.c
URL: http://svn.digium.com/view/asterisk/team/bweschke/eventq-sanity-checks/apps/app_voicemail.c?view=diff&rev=58786&r1=58785&r2=58786
==============================================================================
--- team/bweschke/eventq-sanity-checks/apps/app_voicemail.c (original)
+++ team/bweschke/eventq-sanity-checks/apps/app_voicemail.c Sun Mar 11 20:39:41 2007
@@ -445,7 +445,7 @@
" message. The units are whole-number decibels (dB).\n"
" s - Skip the playback of instructions for leaving a message to the\n"
" calling party.\n"
-" u - Play the 'unavailble greeting.\n"
+" u - Play the 'unavailable greeting.\n"
" j - Jump to priority n+101 if the mailbox is not found or some other\n"
" error occurs.\n";
Modified: team/bweschke/eventq-sanity-checks/channels/chan_iax2.c
URL: http://svn.digium.com/view/asterisk/team/bweschke/eventq-sanity-checks/channels/chan_iax2.c?view=diff&rev=58786&r1=58785&r2=58786
==============================================================================
--- team/bweschke/eventq-sanity-checks/channels/chan_iax2.c (original)
+++ team/bweschke/eventq-sanity-checks/channels/chan_iax2.c Sun Mar 11 20:39:41 2007
@@ -2245,18 +2245,15 @@
break;
case JB_INTERP:
{
- struct ast_frame af;
+ struct ast_frame af = { 0, };
/* create an interpolation frame */
af.frametype = AST_FRAME_VOICE;
af.subclass = pvt->voiceformat;
- af.datalen = 0;
af.samples = frame.ms * 8;
- af.mallocd = 0;
af.src = "IAX2 JB interpolation";
- af.data = NULL;
af.delivery = ast_tvadd(pvt->rxcore, ast_samp2tv(next, 1000));
- af.offset=AST_FRIENDLY_OFFSET;
+ af.offset = AST_FRIENDLY_OFFSET;
/* queue the frame: For consistency, we would call __do_deliver here, but __do_deliver wants an iax_frame,
* which we'd need to malloc, and then it would free it. That seems like a drag */
@@ -3677,9 +3674,9 @@
{
int padding;
unsigned char *workspace;
+
workspace = alloca(*datalen);
- if (!workspace)
- return -1;
+ memset(f, 0, sizeof(*f));
if (ntohs(fh->scallno) & IAX_FLAG_FULL) {
struct ast_iax2_full_enc_hdr *efh = (struct ast_iax2_full_enc_hdr *)fh;
if (*datalen < 16 + sizeof(struct ast_iax2_full_hdr))
@@ -4522,15 +4519,14 @@
static int __send_command(struct chan_iax2_pvt *i, char type, int command, unsigned int ts, const unsigned char *data, int datalen, int seqno,
int now, int transfer, int final)
{
- struct ast_frame f;
+ struct ast_frame f = { 0, };
+
f.frametype = type;
f.subclass = command;
f.datalen = datalen;
- f.samples = 0;
- f.mallocd = 0;
- f.offset = 0;
- f.src = (char *)__FUNCTION__;
- f.data = (char *)data;
+ f.src = __FUNCTION__;
+ f.data = (void *) data;
+
return iax2_send(i, &f, ts, seqno, now, transfer, final);
}
@@ -6268,7 +6264,7 @@
struct ast_iax2_meta_trunk_mini *mtm;
struct iax_frame *fr;
struct iax_frame *cur;
- struct ast_frame f;
+ struct ast_frame f = { 0, };
struct ast_channel *c;
struct iax2_dpcache *dp;
struct iax2_peer *peer;
@@ -6372,6 +6368,7 @@
/* If it's a valid call, deliver the contents. If not, we
drop it, since we don't have a scallno to use for an INVAL */
/* Process as a mini frame */
+ memset(&f, 0, sizeof(f));
f.frametype = AST_FRAME_VOICE;
if (iaxs[fr->callno]) {
if (iaxs[fr->callno]->voiceformat > 0) {
@@ -6380,8 +6377,6 @@
if (f.datalen >= 0) {
if (f.datalen)
f.data = ptr;
- else
- f.data = NULL;
if(trunked_ts) {
fr->ts = (iaxs[fr->callno]->last & 0xFFFF0000L) | (trunked_ts & 0xffff);
} else
@@ -6390,13 +6385,8 @@
if (ast_test_flag(&iaxs[fr->callno]->state, IAX_STATE_STARTED)) {
/* Common things */
f.src = "IAX2";
- f.mallocd = 0;
- f.offset = 0;
if (f.datalen && (f.frametype == AST_FRAME_VOICE))
f.samples = ast_codec_get_samples(&f);
- else
- f.samples = 0;
- fr->outoforder = 0;
iax_frame_wrap(fr, &f);
duped_fr = iaxfrdup2(fr);
if (duped_fr) {
Modified: team/bweschke/eventq-sanity-checks/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/team/bweschke/eventq-sanity-checks/channels/chan_sip.c?view=diff&rev=58786&r1=58785&r2=58786
==============================================================================
--- team/bweschke/eventq-sanity-checks/channels/chan_sip.c (original)
+++ team/bweschke/eventq-sanity-checks/channels/chan_sip.c Sun Mar 11 20:39:41 2007
@@ -556,6 +556,8 @@
static int global_t1min; /*!< T1 roundtrip time minimum */
static int global_autoframing; /*!< Turn autoframing on or off. */
static enum transfermodes global_allowtransfer; /*!< SIP Refer restriction scheme */
+
+static int global_matchexterniplocally; /*!< Match externip/externhost setting against localnet setting */
/*! \brief Codecs that we support by default: */
static int global_capability = AST_FORMAT_ULAW | AST_FORMAT_ALAW | AST_FORMAT_GSM | AST_FORMAT_H263;
@@ -1781,7 +1783,7 @@
if (localaddr && externip.sin_addr.s_addr &&
(ast_apply_ha(localaddr, &theirs)) &&
- (!ast_apply_ha(localaddr, &ours))) {
+ (!global_matchexterniplocally || !ast_apply_ha(localaddr, &ours))) {
if (externexpire && time(NULL) >= externexpire) {
struct ast_hostent ahp;
struct hostent *hp;
@@ -4856,10 +4858,14 @@
} else {
/* XXX This could block for a long time, and block the main thread! XXX */
if (audio) {
- if ( !(hp = ast_gethostbyname(host, &audiohp)))
+ if ( !(hp = ast_gethostbyname(host, &audiohp))) {
ast_log(LOG_WARNING, "Unable to lookup RTP Audio host in secondary c= line, '%s'\n", c);
- } else if (!(vhp = ast_gethostbyname(host, &videohp)))
+ return -2;
+ }
+ } else if (!(vhp = ast_gethostbyname(host, &videohp))) {
ast_log(LOG_WARNING, "Unable to lookup RTP video host in secondary c= line, '%s'\n", c);
+ return -2;
+ }
}
}
@@ -16199,6 +16205,8 @@
global_relaxdtmf = FALSE;
global_callevents = FALSE;
global_t1min = DEFAULT_T1MIN;
+
+ global_matchexterniplocally = FALSE;
/* Copy the default jb config over global_jbconf */
memcpy(&global_jbconf, &default_jbconf, sizeof(struct ast_jb_conf));
@@ -16439,6 +16447,8 @@
default_maxcallbitrate = atoi(v->value);
if (default_maxcallbitrate < 0)
default_maxcallbitrate = DEFAULT_MAX_CALL_BITRATE;
+ } else if (!strcasecmp(v->name, "matchexterniplocally")) {
+ global_matchexterniplocally = ast_true(v->value);
}
}
Modified: team/bweschke/eventq-sanity-checks/channels/chan_zap.c
URL: http://svn.digium.com/view/asterisk/team/bweschke/eventq-sanity-checks/channels/chan_zap.c?view=diff&rev=58786&r1=58785&r2=58786
==============================================================================
--- team/bweschke/eventq-sanity-checks/channels/chan_zap.c (original)
+++ team/bweschke/eventq-sanity-checks/channels/chan_zap.c Sun Mar 11 20:39:41 2007
@@ -6703,6 +6703,7 @@
"polarity reversal on non-FXO (SIG_FXS) "
"interface %d\n", i->channel);
}
+ break;
case ZT_EVENT_REMOVED: /* destroy channel */
ast_log(LOG_NOTICE,
"Got ZT_EVENT_REMOVED. Destroying channel %d\n",
Modified: team/bweschke/eventq-sanity-checks/configs/sip.conf.sample
URL: http://svn.digium.com/view/asterisk/team/bweschke/eventq-sanity-checks/configs/sip.conf.sample?view=diff&rev=58786&r1=58785&r2=58786
==============================================================================
--- team/bweschke/eventq-sanity-checks/configs/sip.conf.sample (original)
+++ team/bweschke/eventq-sanity-checks/configs/sip.conf.sample Sun Mar 11 20:39:41 2007
@@ -135,6 +135,10 @@
; for Sipura and Grandstream ATAs, among others). This is
; contrary to the RFC3551 specification, the peer _should_
; be negotiating AAL2-G726-32 instead :-(
+
+;matchexterniplocally = yes ; Only substitute the externip or externhost setting if it matches
+ ; your localnet setting. Unless you have some sort of strange network
+ ; setup you will not need to enable this.
;
; If regcontext is specified, Asterisk will dynamically create and destroy a
Propchange: team/bweschke/eventq-sanity-checks/doc/sla.pdf
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Propchange: team/bweschke/eventq-sanity-checks/doc/sla.tex
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: team/bweschke/eventq-sanity-checks/doc/sla.tex
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Propchange: team/bweschke/eventq-sanity-checks/doc/sla.tex
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified: team/bweschke/eventq-sanity-checks/main/rtp.c
URL: http://svn.digium.com/view/asterisk/team/bweschke/eventq-sanity-checks/main/rtp.c?view=diff&rev=58786&r1=58785&r2=58786
==============================================================================
--- team/bweschke/eventq-sanity-checks/main/rtp.c (original)
+++ team/bweschke/eventq-sanity-checks/main/rtp.c Sun Mar 11 20:39:41 2007
@@ -138,7 +138,7 @@
/* DTMF Reception Variables */
char resp;
- unsigned int lasteventendseqn;
+ unsigned int lastevent;
int dtmfcount;
unsigned int dtmfsamples;
/* DTMF Transmission Variables */
@@ -705,7 +705,7 @@
* \param seqno
* \returns
*/
-static struct ast_frame *process_rfc2833(struct ast_rtp *rtp, unsigned char *data, int len, unsigned int seqno)
+static struct ast_frame *process_rfc2833(struct ast_rtp *rtp, unsigned char *data, int len, unsigned int seqno, unsigned int timestamp)
{
unsigned int event;
unsigned int event_end;
@@ -739,21 +739,23 @@
resp = 'X';
}
- if ((!(rtp->resp) && (!(event_end & 0x80))) || (rtp->resp && rtp->resp != resp)) {
- rtp->resp = resp;
- if (!ast_test_flag(rtp, FLAG_DTMF_COMPENSATE))
+ if (ast_test_flag(rtp, FLAG_DTMF_COMPENSATE)) {
+ if ((rtp->lastevent != timestamp) || (rtp->resp && rtp->resp != resp)) {
+ rtp->resp = resp;
+ f = send_dtmf(rtp, AST_FRAME_DTMF_END);
+ f->len = 0;
+ rtp->lastevent = timestamp;
+ }
+ } else {
+ if ((!(rtp->resp) && (!(event_end & 0x80))) || (rtp->resp && rtp->resp != resp)) {
+ rtp->resp = resp;
f = send_dtmf(rtp, AST_FRAME_DTMF_BEGIN);
- } else if (event_end & 0x80 && rtp->lasteventendseqn != seqno && rtp->resp) {
- f = send_dtmf(rtp, AST_FRAME_DTMF_END);
- f->len = ast_tvdiff_ms(ast_samp2tv(samples, 8000), ast_tv(0, 0)); /* XXX hard coded 8kHz */
- rtp->resp = 0;
- rtp->lasteventendseqn = seqno;
- } else if (ast_test_flag(rtp, FLAG_DTMF_COMPENSATE) && event_end & 0x80 && rtp->lasteventendseqn != seqno) {
- rtp->resp = resp;
- f = send_dtmf(rtp, AST_FRAME_DTMF_END);
- f->len = ast_tvdiff_ms(ast_samp2tv(samples, 8000), ast_tv(0, 0)); /* XXX hard coded 8kHz */
- rtp->resp = 0;
- rtp->lasteventendseqn = seqno;
+ } else if ((event_end & 0x80) && (rtp->lastevent != seqno) && rtp->resp) {
+ f = send_dtmf(rtp, AST_FRAME_DTMF_END);
+ f->len = ast_tvdiff_ms(ast_samp2tv(samples, 8000), ast_tv(0, 0)); /* XXX hard coded 8kHz */
+ rtp->resp = 0;
+ rtp->lastevent = seqno;
+ }
}
rtp->dtmfcount = dtmftimeout;
@@ -1240,12 +1242,12 @@
duration &= 0xFFFF;
ast_verbose("Got RTP RFC2833 from %s:%u (type %-2.2d, seq %-6.6u, ts %-6.6u, len %-6.6u, mark %d, event %08x, end %d, duration %-5.5d) \n", ast_inet_ntoa(sin.sin_addr), ntohs(sin.sin_port), payloadtype, seqno, timestamp, res - hdrlen, (mark?1:0), event, ((event_end & 0x80)?1:0), duration);
}
- f = process_rfc2833(rtp, rtp->rawdata + AST_FRIENDLY_OFFSET + hdrlen, res - hdrlen, seqno);
+ f = process_rfc2833(rtp, rtp->rawdata + AST_FRIENDLY_OFFSET + hdrlen, res - hdrlen, seqno, timestamp);
} else if (rtpPT.code == AST_RTP_CISCO_DTMF) {
/* It's really special -- process it the Cisco way */
- if (rtp->lasteventseqn <= seqno || (rtp->lasteventseqn >= 65530 && seqno <= 6)) {
+ if (rtp->lastevent <= seqno || (rtp->lastevent >= 65530 && seqno <= 6)) {
f = process_cisco_dtmf(rtp, rtp->rawdata + AST_FRIENDLY_OFFSET + hdrlen, res - hdrlen);
- rtp->lasteventseqn = seqno;
+ rtp->lastevent = seqno;
}
} else if (rtpPT.code == AST_RTP_CN) {
/* Comfort Noise */
@@ -2013,7 +2015,7 @@
rtp->lastividtimestamp = 0;
rtp->lastovidtimestamp = 0;
rtp->lasteventseqn = 0;
- rtp->lasteventendseqn = 0;
+ rtp->lastevent = 0;
rtp->lasttxformat = 0;
rtp->lastrxformat = 0;
rtp->dtmfcount = 0;
Modified: team/bweschke/eventq-sanity-checks/res/res_odbc.c
URL: http://svn.digium.com/view/asterisk/team/bweschke/eventq-sanity-checks/res/res_odbc.c?view=diff&rev=58786&r1=58785&r2=58786
==============================================================================
--- team/bweschke/eventq-sanity-checks/res/res_odbc.c (original)
+++ team/bweschke/eventq-sanity-checks/res/res_odbc.c Sun Mar 11 20:39:41 2007
@@ -96,7 +96,7 @@
if ((res != SQL_SUCCESS) && (res != SQL_SUCCESS_WITH_INFO) && (res != SQL_NO_DATA)) {
if (res == SQL_ERROR) {
SQLGetDiagField(SQL_HANDLE_STMT, stmt, 1, SQL_DIAG_NUMBER, &numfields, SQL_IS_INTEGER, &diagbytes);
- for (i=0; i< numfields + 1; i++) {
+ for (i = 0; i < numfields; i++) {
SQLGetDiagRec(SQL_HANDLE_STMT, stmt, i + 1, state, &nativeerror, diagnostic, sizeof(diagnostic), &diagbytes);
ast_log(LOG_WARNING, "SQL Execute returned an error %d: %s: %s (%d)\n", res, state, diagnostic, diagbytes);
if (i > 10) {
More information about the asterisk-commits
mailing list