|
|
@ -104,6 +104,14 @@ static void cli_incoming_list_totals(char* buffer, int len, struct callmaster* m |
|
|
g_list_free(list); |
|
|
g_list_free(list); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
static void cli_incoming_list_maxsessions(char* buffer, int len, struct callmaster* m, char* replybuffer, const char* outbufend) { |
|
|
|
|
|
int printlen=0; |
|
|
|
|
|
|
|
|
|
|
|
/* don't lock while reading the value */ |
|
|
|
|
|
printlen = snprintf(replybuffer,(outbufend-replybuffer), "Maximum sessions configured on rtpengine: %d\n", m->conf.max_sessions); |
|
|
|
|
|
ADJUSTLEN(printlen,outbufend,replybuffer); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
static void cli_incoming_list_callid(char* buffer, int len, struct callmaster* m, char* replybuffer, const char* outbufend) { |
|
|
static void cli_incoming_list_callid(char* buffer, int len, struct callmaster* m, char* replybuffer, const char* outbufend) { |
|
|
str callid; |
|
|
str callid; |
|
|
struct call* c=0; |
|
|
struct call* c=0; |
|
|
@ -262,6 +270,7 @@ static void cli_incoming_list(char* buffer, int len, struct callmaster* m, char* |
|
|
static const char* LIST_SESSIONS = "sessions"; |
|
|
static const char* LIST_SESSIONS = "sessions"; |
|
|
static const char* LIST_SESSION = "session"; |
|
|
static const char* LIST_SESSION = "session"; |
|
|
static const char* LIST_TOTALS = "totals"; |
|
|
static const char* LIST_TOTALS = "totals"; |
|
|
|
|
|
static const char* LIST_MAX_SESSIONS = "maxsessions"; |
|
|
|
|
|
|
|
|
if (len<=1) { |
|
|
if (len<=1) { |
|
|
printlen = snprintf(replybuffer, outbufend-replybuffer, "%s\n", "More parameters required."); |
|
|
printlen = snprintf(replybuffer, outbufend-replybuffer, "%s\n", "More parameters required."); |
|
|
@ -272,7 +281,7 @@ static void cli_incoming_list(char* buffer, int len, struct callmaster* m, char* |
|
|
|
|
|
|
|
|
if (len>=strlen(LIST_NUMSESSIONS) && strncmp(buffer,LIST_NUMSESSIONS,strlen(LIST_NUMSESSIONS)) == 0) { |
|
|
if (len>=strlen(LIST_NUMSESSIONS) && strncmp(buffer,LIST_NUMSESSIONS,strlen(LIST_NUMSESSIONS)) == 0) { |
|
|
rwlock_lock_r(&m->hashlock); |
|
|
rwlock_lock_r(&m->hashlock); |
|
|
printlen = snprintf(replybuffer, outbufend-replybuffer, "Current Sessions on rtpengine:%i\n", g_hash_table_size(m->callhash)); |
|
|
|
|
|
|
|
|
printlen = snprintf(replybuffer, outbufend-replybuffer, "Current sessions running on rtpengine: %i\n", g_hash_table_size(m->callhash)); |
|
|
ADJUSTLEN(printlen,outbufend,replybuffer); |
|
|
ADJUSTLEN(printlen,outbufend,replybuffer); |
|
|
rwlock_unlock_r(&m->hashlock); |
|
|
rwlock_unlock_r(&m->hashlock); |
|
|
} else if (len>=strlen(LIST_SESSIONS) && strncmp(buffer,LIST_SESSIONS,strlen(LIST_SESSIONS)) == 0) { |
|
|
} else if (len>=strlen(LIST_SESSIONS) && strncmp(buffer,LIST_SESSIONS,strlen(LIST_SESSIONS)) == 0) { |
|
|
@ -295,6 +304,8 @@ static void cli_incoming_list(char* buffer, int len, struct callmaster* m, char* |
|
|
cli_incoming_list_callid(buffer+strlen(LIST_SESSION), len-strlen(LIST_SESSION), m, replybuffer, outbufend); |
|
|
cli_incoming_list_callid(buffer+strlen(LIST_SESSION), len-strlen(LIST_SESSION), m, replybuffer, outbufend); |
|
|
} else if (len>=strlen(LIST_TOTALS) && strncmp(buffer,LIST_TOTALS,strlen(LIST_TOTALS)) == 0) { |
|
|
} else if (len>=strlen(LIST_TOTALS) && strncmp(buffer,LIST_TOTALS,strlen(LIST_TOTALS)) == 0) { |
|
|
cli_incoming_list_totals(buffer+strlen(LIST_TOTALS), len-strlen(LIST_TOTALS), m, replybuffer, outbufend); |
|
|
cli_incoming_list_totals(buffer+strlen(LIST_TOTALS), len-strlen(LIST_TOTALS), m, replybuffer, outbufend); |
|
|
|
|
|
} else if (len>=strlen(LIST_MAX_SESSIONS) && strncmp(buffer,LIST_MAX_SESSIONS,strlen(LIST_MAX_SESSIONS)) == 0) { |
|
|
|
|
|
cli_incoming_list_maxsessions(buffer+strlen(LIST_MAX_SESSIONS), len-strlen(LIST_MAX_SESSIONS), m, replybuffer, outbufend); |
|
|
} else { |
|
|
} else { |
|
|
printlen = snprintf(replybuffer, outbufend-replybuffer, "%s:%s\n", "Unknown 'list' command", buffer); |
|
|
printlen = snprintf(replybuffer, outbufend-replybuffer, "%s:%s\n", "Unknown 'list' command", buffer); |
|
|
ADJUSTLEN(printlen,outbufend,replybuffer); |
|
|
ADJUSTLEN(printlen,outbufend,replybuffer); |
|
|
|