From: Giovanni Maruzzelli Date: Tue, 12 Jul 2011 17:15:58 +0000 (-0500) Subject: FS-3400 skypopen: patch FS-3400 from Ivan Trifonov, Getting skype balances vie freesw... X-Git-Tag: v1.2-rc1~108^2^2~28 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=eb9404d745bf076457ed26bf44d2485440d91322;p=thirdparty%2Ffreeswitch.git FS-3400 skypopen: patch FS-3400 from Ivan Trifonov, Getting skype balances vie freeswitch console (and event socket) --- diff --git a/src/mod/endpoints/mod_skypopen/mod_skypopen.c b/src/mod/endpoints/mod_skypopen/mod_skypopen.c index f19f3c943f..fb6af40c80 100644 --- a/src/mod/endpoints/mod_skypopen/mod_skypopen.c +++ b/src/mod/endpoints/mod_skypopen/mod_skypopen.c @@ -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); @@ -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;