add register-gateway variable to directory users to allow inbound reg to trigger an outbound one

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@5710 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Anthony Minessale committed 2007-09-18 17:31:36 +00:00
1 parent 5e0c3ee5b7
commit 16f584ef47
4 files changed
+118 -22

No files matched your search

+31 -1
View File
@@ -942,9 +942,11 @@ static const char *sofia_state_names[] = { "UNREGED",
"TRYING",
"REGISTER",
"REGED",
"UNREGISTER",
"FAILED",
"EXPIRED",
"NOREG" };
"NOREG",
NULL};
struct cb_helper {
sofia_profile_t *profile;
@@ -1169,6 +1171,34 @@ static switch_status_t cmd_profile(char **argv, int argc, switch_stream_handle_t
}
if (!strcasecmp(argv[1], "unregister")) {
char *gname = argv[2];
sofia_gateway_t *gateway_ptr;
if (switch_strlen_zero(gname)) {
stream->write_function(stream, "No gateway name provided!\n");
goto done;
}
if (!strcasecmp(gname, "all")) {
for (gateway_ptr = profile->gateways; gateway_ptr; gateway_ptr = gateway_ptr->next) {
gateway_ptr->retry = 0;
gateway_ptr->state = REG_STATE_UNREGISTER;
}
stream->write_function(stream, "+OK\n");
} else if ((gateway_ptr = sofia_reg_find_gateway(gname))) {
gateway_ptr->retry = 0;
gateway_ptr->state = REG_STATE_UNREGISTER;
stream->write_function(stream, "+OK\n");
sofia_reg_release_gateway(gateway_ptr);
} else {
stream->write_function(stream, "Invalid gateway!\n");
}
goto done;
}
if (!strcasecmp(argv[1], "stop") || !strcasecmp(argv[1], "restart")) {
int rsec = 3;
int diff = (int) (time(NULL) - profile->started);