add sofia profile <profile> gwlist up|down to list up or downed profiles for feeding into mod distributor to exclude dead gateways

This commit is contained in:
Anthony Minessale
2010-09-17 14:11:57 -05:00
parent 445731eea1
commit 0477cb67f5
3 changed files with 41 additions and 0 deletions
+22
View File
@@ -4267,6 +4267,28 @@ void sofia_glue_del_every_gateway(sofia_profile_t *profile)
}
void sofia_glue_gateway_list(sofia_profile_t *profile, switch_stream_handle_t *stream, int up)
{
sofia_gateway_t *gp = NULL;
char *r = (char *) stream->data;
switch_mutex_lock(mod_sofia_globals.hash_mutex);
for (gp = profile->gateways; gp; gp = gp->next) {
int reged = (gp->state == REG_STATE_REGED);
if (up ? reged : !reged) {
stream->write_function(stream, "%s ", gp->name);
}
}
if (r) {
end_of(r) = '\0';
}
switch_mutex_unlock(mod_sofia_globals.hash_mutex);
}
void sofia_glue_del_gateway(sofia_gateway_t *gp)
{
if (!gp->deleted) {