Skip to content

Commit

Permalink
FS-3400 skypopen: patch FS-3400 from Ivan Trifonov, Getting skype bal…
Browse files Browse the repository at this point in the history
…ances vie freeswitch console (and event socket)
  • Loading branch information
gmaruzz committed Jul 12, 2011
1 parent fe5fcd1 commit eb9404d
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions src/mod/endpoints/mod_skypopen/mod_skypopen.c
Original file line number Diff line number Diff line change
Expand Up @@ -2431,6 +2431,8 @@ SWITCH_STANDARD_API(sk_function)
{
char *mycmd = NULL, *argv[10] = { 0 };
int argc = 0;
int tmp_i = 0;
char tmp_message[4096];

if (globals.sk_console)
stream->write_function(stream, "sk console is: |||%s|||\n", globals.sk_console->name);
Expand All @@ -2446,6 +2448,26 @@ SWITCH_STANDARD_API(sk_function)
goto end;
}


if (!strcasecmp(argv[0], "balances")) {
stream->write_function(stream, " Name \tBalance\tCurrency\n");
stream->write_function(stream, " ==== \t=======\t========\n");

for (tmp_i = 0; tmp_i < SKYPOPEN_MAX_INTERFACES; tmp_i++) {
if (strlen(globals.SKYPOPEN_INTERFACES[tmp_i].name)) {
skypopen_signaling_write(&globals.SKYPOPEN_INTERFACES[tmp_i], "GET PROFILE PSTN_BALANCE");
switch_sleep(10000);

strncpy(tmp_message, globals.SKYPOPEN_INTERFACES[tmp_i].message, sizeof(globals.SKYPOPEN_INTERFACES[tmp_i].message));

skypopen_signaling_write(&globals.SKYPOPEN_INTERFACES[tmp_i], "GET PROFILE PSTN_BALANCE_CURRENCY");
switch_sleep(10000);
if(strlen(tmp_message)>21 && strlen(globals.SKYPOPEN_INTERFACES[tmp_i].message) > 30)
stream->write_function(stream, " %s \t%s\t%s\n", globals.SKYPOPEN_INTERFACES[tmp_i].name, tmp_message+21, globals.SKYPOPEN_INTERFACES[tmp_i].message+30);
}
}
}

if (!strcasecmp(argv[0], "list")) {
int i;
int ib = 0;
Expand Down

0 comments on commit eb9404d

Please sign in to comment.