[asterisk-commits] russell: branch russell/sla_rewrite r53685 -
/team/russell/sla_rewrite/apps/
asterisk-commits at lists.digium.com
asterisk-commits at lists.digium.com
Thu Feb 8 16:36:08 MST 2007
Author: russell
Date: Thu Feb 8 17:36:08 2007
New Revision: 53685
URL: http://svn.digium.com/view/asterisk?view=rev&rev=53685
Log:
- Let the channels created for dialing stations copy the callerid from the
inbound trunk channel so that the appropriate callerid is shown on the phone
(in some cases, anyway ...).
CallerID handling in this code will ultimately be quite complex, but that
story is for another day.
- Fix the case where a trunk is hung up before any station answers it so that
the stations stop ringing.
Modified:
team/russell/sla_rewrite/apps/app_meetme.c
Modified: team/russell/sla_rewrite/apps/app_meetme.c
URL: http://svn.digium.com/view/asterisk/team/russell/sla_rewrite/apps/app_meetme.c?view=diff&rev=53685&r1=53684&r2=53685
==============================================================================
--- team/russell/sla_rewrite/apps/app_meetme.c (original)
+++ team/russell/sla_rewrite/apps/app_meetme.c Thu Feb 8 17:36:08 2007
@@ -409,7 +409,11 @@
AST_LIST_ENTRY(sla_event) entry;
};
+/*!
+ * \brief A structure for data used by the sla thread
+ */
static struct sla {
+ /*! The SLA thread ID */
pthread_t thread;
ast_cond_t cond;
ast_mutex_t lock;
@@ -3097,7 +3101,7 @@
ast_dial_destroy(dial);
continue;
}
- if (ast_dial_run(dial, NULL, 1) != AST_DIAL_RESULT_TRYING) {
+ if (ast_dial_run(dial, trunk_ref->trunk->chan, 1) != AST_DIAL_RESULT_TRYING) {
ast_dial_destroy(dial);
if (!(failed_station = ast_calloc(1, sizeof(*failed_station))))
continue;
@@ -3158,7 +3162,7 @@
break;
}
if (!trunk_ref) {
- ast_log(LOG_WARNING, "Found no ringing trunk for station '%s' to answer!\n",
+ ast_log(LOG_DEBUG, "Found no ringing trunk for station '%s' to answer!\n",
station_ref->station->name);
break;
}
@@ -3198,8 +3202,6 @@
break;
}
AST_LIST_TRAVERSE_SAFE_END
- if (dial_res != AST_DIAL_RESULT_ANSWERED)
- continue;
/* Find stations that shouldn't be ringing anymore. */
AST_LIST_TRAVERSE_SAFE_BEGIN(&ringing_stations, station_ref, entry) {
AST_LIST_TRAVERSE(&station_ref->station->trunks, trunk_ref, entry) {
@@ -3419,7 +3421,8 @@
ast_atomic_fetchadd_int((int *) &trunk_ref->trunk->active_stations, 1);
snprintf(conf_name, sizeof(conf_name), "SLA_%s", trunk_ref->trunk->name);
- ast_set_flag(&conf_flags, CONFFLAG_QUIET | CONFFLAG_MARKEDEXIT | CONFFLAG_PASS_DTMF);
+ ast_set_flag(&conf_flags,
+ CONFFLAG_QUIET | CONFFLAG_MARKEDEXIT | CONFFLAG_PASS_DTMF | CONFFLAG_SLA_STATION);
station->chan = chan;
ast_answer(chan);
conf = build_conf(conf_name, "", "", 0, 0, 1);
@@ -3432,7 +3435,7 @@
admin_exec(NULL, conf_name);
change_trunk_state(trunk_ref->trunk, SLA_TRUNK_STATE_IDLE);
}
- ast_log(LOG_DEBUG, "Exit with success...\n");
+
pbx_builtin_setvar_helper(chan, "SLASTATION_STATUS", "SUCCESS");
return 0;
@@ -3503,6 +3506,21 @@
trunk->chan = NULL;
pbx_builtin_setvar_helper(chan, "SLATRUNK_STATUS", "SUCCESS");
+
+ /* Remove the entry from the list of ringing trunks if it is still there. */
+ ast_mutex_lock(&sla.lock);
+ AST_LIST_TRAVERSE_SAFE_BEGIN(&sla.ringing_trunks, trunk_ref, entry) {
+ if (trunk_ref->trunk == trunk) {
+ AST_LIST_REMOVE_CURRENT(&sla.ringing_trunks, entry);
+ break;
+ }
+ }
+ AST_LIST_TRAVERSE_SAFE_END
+ ast_mutex_unlock(&sla.lock);
+ if (trunk_ref) {
+ free(trunk_ref);
+ pbx_builtin_setvar_helper(chan, "SLATRUNK_STATUS", "UNANSWERED");
+ }
return 0;
}
More information about the asterisk-commits
mailing list