mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-06-30 04:49:39 +00:00
Merge branch 'master' into v1.4
This commit is contained in:
commit
2d89eca611
@ -4,7 +4,7 @@
|
|||||||
#applications/mod_blacklist
|
#applications/mod_blacklist
|
||||||
#applications/mod_callcenter
|
#applications/mod_callcenter
|
||||||
#applications/mod_cidlookup
|
#applications/mod_cidlookup
|
||||||
applications/mod_cluechoo
|
#applications/mod_cluechoo
|
||||||
applications/mod_commands
|
applications/mod_commands
|
||||||
applications/mod_conference
|
applications/mod_conference
|
||||||
#applications/mod_curl
|
#applications/mod_curl
|
||||||
|
@ -60,7 +60,7 @@
|
|||||||
<!--<load module="mod_easyroute"/>-->
|
<!--<load module="mod_easyroute"/>-->
|
||||||
<load module="mod_esf"/>
|
<load module="mod_esf"/>
|
||||||
<load module="mod_fsv"/>
|
<load module="mod_fsv"/>
|
||||||
<load module="mod_cluechoo"/>
|
<!--<load module="mod_cluechoo"/>-->
|
||||||
<load module="mod_valet_parking"/>
|
<load module="mod_valet_parking"/>
|
||||||
<!--<load module="mod_fsk"/>-->
|
<!--<load module="mod_fsk"/>-->
|
||||||
<!--<load module="mod_spy"/>-->
|
<!--<load module="mod_spy"/>-->
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
<!-- http://wiki.freeswitch.org/wiki/Sofia_Configuration_Files -->
|
<!-- http://wiki.freeswitch.org/wiki/Sofia_Configuration_Files -->
|
||||||
<!-- This profile is only for outbound registrations to providers -->
|
<!-- This profile is only for outbound registrations to providers -->
|
||||||
<gateways>
|
<gateways>
|
||||||
<X-PRE-PROCESS cmd="include" data="external/*.xml"/>
|
<X-PRE-PROCESS cmd="include" data="external-ipv6/*.xml"/>
|
||||||
</gateways>
|
</gateways>
|
||||||
|
|
||||||
<aliases>
|
<aliases>
|
||||||
|
@ -33,5 +33,9 @@
|
|||||||
<!--send an options ping every x seconds, failure will unregister and/or mark it down-->
|
<!--send an options ping every x seconds, failure will unregister and/or mark it down-->
|
||||||
<!--<param name="ping" value="25"/>-->
|
<!--<param name="ping" value="25"/>-->
|
||||||
<!--<param name="cid-type" value="rpid"/>-->
|
<!--<param name="cid-type" value="rpid"/>-->
|
||||||
|
<!--rfc5626 : Abilitazione rfc5626 ///-->
|
||||||
|
<!--<param name="rfc-5626" value="true"/>-->
|
||||||
|
<!--rfc5626 : extra sip params to send in the contact-->
|
||||||
|
<!--<param name="reg-id" value="1"/>-->
|
||||||
<!--</gateway>-->
|
<!--</gateway>-->
|
||||||
</include>
|
</include>
|
@ -28,11 +28,14 @@
|
|||||||
<!--<param name="caller-id-in-from" value="false"/>-->
|
<!--<param name="caller-id-in-from" value="false"/>-->
|
||||||
<!--extra sip params to send in the contact-->
|
<!--extra sip params to send in the contact-->
|
||||||
<!--<param name="contact-params" value=""/>-->
|
<!--<param name="contact-params" value=""/>-->
|
||||||
|
<!-- Put the extension in the contact -->
|
||||||
|
<!--<param name="extension-in-contact" value="true"/>-->
|
||||||
<!--send an options ping every x seconds, failure will unregister and/or mark it down-->
|
<!--send an options ping every x seconds, failure will unregister and/or mark it down-->
|
||||||
<!--<param name="ping" value="25"/>-->
|
<!--<param name="ping" value="25"/>-->
|
||||||
<!--</gateway>-->
|
<!--<param name="cid-type" value="rpid"/>-->
|
||||||
<!--rfc5626 : Abilitazione rfc5626 ///-->
|
<!--rfc5626 : Abilitazione rfc5626 ///-->
|
||||||
<!--<param name="rfc-5626" value="true"/>-->
|
<!--<param name="rfc-5626" value="true"/>-->
|
||||||
<!--rfc5626 : extra sip params to send in the contact-->
|
<!--rfc5626 : extra sip params to send in the contact-->
|
||||||
<!--<param name="reg-id" value="1"/>-->
|
<!--<param name="reg-id" value="1"/>-->
|
||||||
|
<!--</gateway>-->
|
||||||
</include>
|
</include>
|
||||||
|
@ -15,7 +15,6 @@
|
|||||||
</aliases>
|
</aliases>
|
||||||
<!-- Outbound Registrations -->
|
<!-- Outbound Registrations -->
|
||||||
<gateways>
|
<gateways>
|
||||||
<X-PRE-PROCESS cmd="include" data="internal/*.xml"/>
|
|
||||||
</gateways>
|
</gateways>
|
||||||
|
|
||||||
<domains>
|
<domains>
|
||||||
|
@ -342,7 +342,7 @@ if test "$ax_cv_c_compiler_vendor" = "gnu"; then
|
|||||||
saved_CFLAGS="$CFLAGS"
|
saved_CFLAGS="$CFLAGS"
|
||||||
AC_CACHE_CHECK([whether compiler supports -Wno-unused-result],
|
AC_CACHE_CHECK([whether compiler supports -Wno-unused-result],
|
||||||
[ac_cv_gcc_supports_w_no_unused_result], [
|
[ac_cv_gcc_supports_w_no_unused_result], [
|
||||||
CFLAGS="$CFLAGS -Wno-unused-result"
|
CFLAGS="$CFLAGS -Wno-unused-result -Wno-error=unused-result"
|
||||||
AC_TRY_COMPILE([],[return 0;],
|
AC_TRY_COMPILE([],[return 0;],
|
||||||
[ac_cv_gcc_supports_w_no_unused_result=yes],
|
[ac_cv_gcc_supports_w_no_unused_result=yes],
|
||||||
[ac_cv_gcc_supports_w_no_unused_result=no])])
|
[ac_cv_gcc_supports_w_no_unused_result=no])])
|
||||||
|
3
debian/bootstrap.sh
vendored
3
debian/bootstrap.sh
vendored
@ -15,6 +15,7 @@ avoid_mods=(
|
|||||||
applications/mod_osp
|
applications/mod_osp
|
||||||
applications/mod_rad_auth
|
applications/mod_rad_auth
|
||||||
applications/mod_skel
|
applications/mod_skel
|
||||||
|
applications/mod_cluechoo
|
||||||
asr_tts/mod_cepstral
|
asr_tts/mod_cepstral
|
||||||
codecs/mod_com_g729
|
codecs/mod_com_g729
|
||||||
codecs/mod_ilbc
|
codecs/mod_ilbc
|
||||||
@ -433,7 +434,6 @@ Depends: \${misc:Depends}, freeswitch (= \${binary:Version}),
|
|||||||
freeswitch-mod-voicemail (= \${binary:Version}),
|
freeswitch-mod-voicemail (= \${binary:Version}),
|
||||||
freeswitch-mod-esf (= \${binary:Version}),
|
freeswitch-mod-esf (= \${binary:Version}),
|
||||||
freeswitch-mod-fsv (= \${binary:Version}),
|
freeswitch-mod-fsv (= \${binary:Version}),
|
||||||
freeswitch-mod-cluechoo (= \${binary:Version}),
|
|
||||||
freeswitch-mod-valet-parking (= \${binary:Version}),
|
freeswitch-mod-valet-parking (= \${binary:Version}),
|
||||||
freeswitch-mod-httapi (= \${binary:Version}),
|
freeswitch-mod-httapi (= \${binary:Version}),
|
||||||
freeswitch-mod-dialplan-xml (= \${binary:Version}),
|
freeswitch-mod-dialplan-xml (= \${binary:Version}),
|
||||||
@ -564,7 +564,6 @@ Recommends:
|
|||||||
freeswitch-mod-blacklist (= \${binary:Version}),
|
freeswitch-mod-blacklist (= \${binary:Version}),
|
||||||
freeswitch-mod-callcenter (= \${binary:Version}),
|
freeswitch-mod-callcenter (= \${binary:Version}),
|
||||||
freeswitch-mod-cidlookup (= \${binary:Version}),
|
freeswitch-mod-cidlookup (= \${binary:Version}),
|
||||||
freeswitch-mod-cluechoo (= \${binary:Version}),
|
|
||||||
freeswitch-mod-commands (= \${binary:Version}),
|
freeswitch-mod-commands (= \${binary:Version}),
|
||||||
freeswitch-mod-conference (= \${binary:Version}),
|
freeswitch-mod-conference (= \${binary:Version}),
|
||||||
freeswitch-mod-curl (= \${binary:Version}),
|
freeswitch-mod-curl (= \${binary:Version}),
|
||||||
|
@ -31,7 +31,7 @@ PROJECT_NAME = "FreeSWITCH API Documentation"
|
|||||||
# This could be handy for archiving the generated documentation or
|
# This could be handy for archiving the generated documentation or
|
||||||
# if some version control system is used.
|
# if some version control system is used.
|
||||||
|
|
||||||
PROJECT_NUMBER = 1.0.6
|
PROJECT_NUMBER = 1.5.14b
|
||||||
|
|
||||||
# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
|
# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
|
||||||
# base path where the generated documentation will be put.
|
# base path where the generated documentation will be put.
|
||||||
|
@ -38,12 +38,12 @@ Create a Pull Request
|
|||||||
---------------------
|
---------------------
|
||||||
|
|
||||||
# navigate to the FreeSWITCH JIRA
|
# navigate to the FreeSWITCH JIRA
|
||||||
chromium http://jira.freeswitch.org/
|
chromium https://jira.freeswitch.org/
|
||||||
|
|
||||||
# create an account in JIRA and create a new issue
|
# create an account in JIRA and create a new issue
|
||||||
|
|
||||||
# navigate to FreeSWITCH Stash
|
# navigate to FreeSWITCH Stash
|
||||||
chromium http://stash.freeswitch.org/
|
chromium https://stash.freeswitch.org/
|
||||||
|
|
||||||
# create an account in Stash; create a forked FS repository; read
|
# create an account in Stash; create a forked FS repository; read
|
||||||
# the details here:
|
# the details here:
|
||||||
@ -156,6 +156,26 @@ submitting the commits to us. Random "update branch to master" merges
|
|||||||
make our history hard to understand and make it more difficult to
|
make our history hard to understand and make it more difficult to
|
||||||
isolate regressions with `git-bisect`.
|
isolate regressions with `git-bisect`.
|
||||||
|
|
||||||
|
New Module Checklist
|
||||||
|
--------------------
|
||||||
|
|
||||||
|
When proposing a new module:
|
||||||
|
|
||||||
|
* Add a `Makefile.am` for the module
|
||||||
|
* Add the module to the FS `configure.ac`
|
||||||
|
* Add the module to `build/modules.conf.in` (commented out)
|
||||||
|
* Describe the module in as much detail as possible in the comments
|
||||||
|
at the top of the module
|
||||||
|
* Add our whitespace footer to the module files; ensure the \*.[ch]
|
||||||
|
module files use tabs for indentation and are free of trailing
|
||||||
|
whitespace (e.g. in Emacs, run `M-x whitespace-mode`, then `M-x
|
||||||
|
whitespace-cleanup`)
|
||||||
|
* Remove any unused code left over from debugging
|
||||||
|
* Ensure symbols not meant to be exported are declared `static`
|
||||||
|
* Don't add any files to `conf/vanilla`
|
||||||
|
* Write a commit message body describing the module, why it's useful,
|
||||||
|
what it does, how it works, and any parts not yet implemented
|
||||||
|
|
||||||
Do As We Say...
|
Do As We Say...
|
||||||
---------------
|
---------------
|
||||||
|
|
||||||
@ -194,4 +214,4 @@ Finally, feel free to join us in our weekly conference call. Many of
|
|||||||
the core developers are often on the call and you'll have an
|
the core developers are often on the call and you'll have an
|
||||||
opportunity at the beginning or end of the call to ask your questions:
|
opportunity at the beginning or end of the call to ask your questions:
|
||||||
|
|
||||||
> http://wiki.freeswitch.org/wiki/Weekly_Conference_Call
|
> https://wiki.freeswitch.org/wiki/Weekly_Conference_Call
|
||||||
|
@ -5,8 +5,8 @@ Here is how I did it.
|
|||||||
wget http://www.openssl.org/contrib/ssl.ca-0.1.tar.gz
|
wget http://www.openssl.org/contrib/ssl.ca-0.1.tar.gz
|
||||||
tar zxfv ssl.ca-0.1.tar.gz
|
tar zxfv ssl.ca-0.1.tar.gz
|
||||||
cd ssl.ca-0.1/
|
cd ssl.ca-0.1/
|
||||||
perl -i -pe 's/md5/sha1/g' *.sh
|
perl -i -pe 's/md5/sha2/g' *.sh
|
||||||
perl -i -pe 's/1024/2048/g' *.sh
|
perl -i -pe 's/1024/4096/g' *.sh
|
||||||
./new-root-ca.sh
|
./new-root-ca.sh
|
||||||
./new-server-cert.sh self.bkw.org
|
./new-server-cert.sh self.bkw.org
|
||||||
./sign-server-cert.sh self.bkw.org
|
./sign-server-cert.sh self.bkw.org
|
||||||
|
@ -61,6 +61,7 @@ typedef struct {
|
|||||||
int log_uuid;
|
int log_uuid;
|
||||||
int log_uuid_length;
|
int log_uuid_length;
|
||||||
int quiet;
|
int quiet;
|
||||||
|
int use_history_file;
|
||||||
int batch_mode;
|
int batch_mode;
|
||||||
char prompt_color[12];
|
char prompt_color[12];
|
||||||
char input_text_color[12];
|
char input_text_color[12];
|
||||||
@ -1222,6 +1223,7 @@ static void read_config(const char *dft_cfile, const char *cfile) {
|
|||||||
esl_set_string(profiles[pcount].prompt_color, prompt_color);
|
esl_set_string(profiles[pcount].prompt_color, prompt_color);
|
||||||
esl_set_string(profiles[pcount].input_text_color, input_text_color);
|
esl_set_string(profiles[pcount].input_text_color, input_text_color);
|
||||||
esl_set_string(profiles[pcount].output_text_color, output_text_color);
|
esl_set_string(profiles[pcount].output_text_color, output_text_color);
|
||||||
|
profiles[pcount].use_history_file = 1;
|
||||||
esl_log(ESL_LOG_DEBUG, "Found Profile [%s]\n", profiles[pcount].name);
|
esl_log(ESL_LOG_DEBUG, "Found Profile [%s]\n", profiles[pcount].name);
|
||||||
pcount++;
|
pcount++;
|
||||||
}
|
}
|
||||||
@ -1257,6 +1259,8 @@ static void read_config(const char *dft_cfile, const char *cfile) {
|
|||||||
}
|
}
|
||||||
} else if(!strcasecmp(var, "quiet")) {
|
} else if(!strcasecmp(var, "quiet")) {
|
||||||
profiles[pcount-1].quiet = esl_true(val);
|
profiles[pcount-1].quiet = esl_true(val);
|
||||||
|
} else if(!strcasecmp(var, "no-history-file")) {
|
||||||
|
profiles[pcount-1].use_history_file = !esl_true(val);
|
||||||
} else if(!strcasecmp(var, "prompt-color")) {
|
} else if(!strcasecmp(var, "prompt-color")) {
|
||||||
esl_set_string(profiles[pcount-1].prompt_color, match_color(val));
|
esl_set_string(profiles[pcount-1].prompt_color, match_color(val));
|
||||||
} else if(!strcasecmp(var, "input-text-color")) {
|
} else if(!strcasecmp(var, "input-text-color")) {
|
||||||
@ -1298,6 +1302,8 @@ int main(int argc, char *argv[])
|
|||||||
const char *line = NULL;
|
const char *line = NULL;
|
||||||
char cmd_str[1024] = "";
|
char cmd_str[1024] = "";
|
||||||
cli_profile_t *profile = NULL;
|
cli_profile_t *profile = NULL;
|
||||||
|
int argv_use_history_file = 1;
|
||||||
|
int use_history_file = 0;
|
||||||
#ifndef WIN32
|
#ifndef WIN32
|
||||||
char hfile[512] = "/tmp/fs_cli_history";
|
char hfile[512] = "/tmp/fs_cli_history";
|
||||||
char cfile[512] = "/etc/fs_cli.conf";
|
char cfile[512] = "/etc/fs_cli.conf";
|
||||||
@ -1324,6 +1330,7 @@ int main(int argc, char *argv[])
|
|||||||
{"log-uuid-short", 0, 0, 'S'},
|
{"log-uuid-short", 0, 0, 'S'},
|
||||||
{"quiet", 0, 0, 'q'},
|
{"quiet", 0, 0, 'q'},
|
||||||
{"batchmode", 0, 0, 'b'},
|
{"batchmode", 0, 0, 'b'},
|
||||||
|
{"no-history-file", 0, 0, 'Q'},
|
||||||
{"retry", 0, 0, 'r'},
|
{"retry", 0, 0, 'r'},
|
||||||
{"interrupt", 0, 0, 'i'},
|
{"interrupt", 0, 0, 'i'},
|
||||||
{"reconnect", 0, 0, 'R'},
|
{"reconnect", 0, 0, 'R'},
|
||||||
@ -1381,6 +1388,7 @@ int main(int argc, char *argv[])
|
|||||||
esl_set_string(internal_profile.prompt_color, prompt_color);
|
esl_set_string(internal_profile.prompt_color, prompt_color);
|
||||||
esl_set_string(internal_profile.input_text_color, input_text_color);
|
esl_set_string(internal_profile.input_text_color, input_text_color);
|
||||||
esl_set_string(internal_profile.output_text_color, output_text_color);
|
esl_set_string(internal_profile.output_text_color, output_text_color);
|
||||||
|
internal_profile.use_history_file = 1;
|
||||||
if (home) {
|
if (home) {
|
||||||
snprintf(hfile, sizeof(hfile), "%s/.fs_cli_history", home);
|
snprintf(hfile, sizeof(hfile), "%s/.fs_cli_history", home);
|
||||||
snprintf(cfile, sizeof(cfile), "%s/.fs_cli_conf", home);
|
snprintf(cfile, sizeof(cfile), "%s/.fs_cli_conf", home);
|
||||||
@ -1395,7 +1403,7 @@ int main(int argc, char *argv[])
|
|||||||
esl_global_set_default_logger(6); /* default debug level to 6 (info) */
|
esl_global_set_default_logger(6); /* default debug level to 6 (info) */
|
||||||
for(;;) {
|
for(;;) {
|
||||||
int option_index = 0;
|
int option_index = 0;
|
||||||
opt = getopt_long(argc, argv, "H:P:u:p:d:x:l:USt:T:qrRhib?n", options, &option_index);
|
opt = getopt_long(argc, argv, "H:P:u:p:d:x:l:USt:T:qQrRhib?n", options, &option_index);
|
||||||
if (opt == -1) break;
|
if (opt == -1) break;
|
||||||
switch (opt) {
|
switch (opt) {
|
||||||
case 'H':
|
case 'H':
|
||||||
@ -1450,6 +1458,9 @@ int main(int argc, char *argv[])
|
|||||||
case 'b':
|
case 'b':
|
||||||
argv_batch = 1;
|
argv_batch = 1;
|
||||||
break;
|
break;
|
||||||
|
case 'Q':
|
||||||
|
argv_use_history_file = 0;
|
||||||
|
break;
|
||||||
case 'i':
|
case 'i':
|
||||||
allow_ctl_c = 1;
|
allow_ctl_c = 1;
|
||||||
break;
|
break;
|
||||||
@ -1505,6 +1516,9 @@ int main(int argc, char *argv[])
|
|||||||
profile->batch_mode = 1;
|
profile->batch_mode = 1;
|
||||||
feature_level=0;
|
feature_level=0;
|
||||||
}
|
}
|
||||||
|
if (argv_use_history_file && profile->use_history_file) {
|
||||||
|
use_history_file = 1;
|
||||||
|
}
|
||||||
if (*argv_loglevel) {
|
if (*argv_loglevel) {
|
||||||
esl_set_string(profile->loglevel, argv_loglevel);
|
esl_set_string(profile->loglevel, argv_loglevel);
|
||||||
profile->quiet = 0;
|
profile->quiet = 0;
|
||||||
@ -1658,7 +1672,7 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
history(myhistory, &ev, H_SETSIZE, 800);
|
history(myhistory, &ev, H_SETSIZE, 800);
|
||||||
el_set(el, EL_HIST, history, myhistory);
|
el_set(el, EL_HIST, history, myhistory);
|
||||||
history(myhistory, &ev, H_LOAD, hfile);
|
if (use_history_file) history(myhistory, &ev, H_LOAD, hfile);
|
||||||
el_source(el, NULL);
|
el_source(el, NULL);
|
||||||
#endif
|
#endif
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
@ -1712,7 +1726,7 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
#ifdef HAVE_LIBEDIT
|
#ifdef HAVE_LIBEDIT
|
||||||
done:
|
done:
|
||||||
history(myhistory, &ev, H_SAVE, hfile);
|
if (use_history_file) history(myhistory, &ev, H_SAVE, hfile);
|
||||||
history_end(myhistory);
|
history_end(myhistory);
|
||||||
el_end(el);
|
el_end(el);
|
||||||
#endif
|
#endif
|
||||||
|
@ -1 +1 @@
|
|||||||
Sat Aug 16 01:34:24 CDT 2014
|
Thu Sep 25 21:43:53 CDT 2014
|
||||||
|
@ -475,7 +475,7 @@ int tport_ws_init_secondary(tport_t *self, int socket, int accepted,
|
|||||||
|
|
||||||
memset(&wstp->ws, 0, sizeof(wstp->ws));
|
memset(&wstp->ws, 0, sizeof(wstp->ws));
|
||||||
|
|
||||||
if (ws_init(&wstp->ws, socket, wstp->ws_secure ? wspri->ssl_ctx : NULL, 0, 0) < 0) {
|
if (ws_init(&wstp->ws, socket, wstp->ws_secure ? wspri->ssl_ctx : NULL, 0, 0, 0) < 0) {
|
||||||
ws_destroy(&wstp->ws);
|
ws_destroy(&wstp->ws);
|
||||||
wstp->ws_initialized = -1;
|
wstp->ws_initialized = -1;
|
||||||
return *return_reason = "WS_INIT", -1;
|
return *return_reason = "WS_INIT", -1;
|
||||||
|
@ -1,11 +1,6 @@
|
|||||||
#include "ws.h"
|
#include "ws.h"
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
|
||||||
/* warning C4706: assignment within conditional expression*/
|
|
||||||
#pragma warning(disable: 4706)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef _MSC_VER
|
#ifndef _MSC_VER
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#endif
|
#endif
|
||||||
@ -16,6 +11,11 @@
|
|||||||
#define ms_sleep(x) Sleep( x );
|
#define ms_sleep(x) Sleep( x );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
/* warning C4706: assignment within conditional expression*/
|
||||||
|
#pragma warning(disable: 4706)
|
||||||
|
#endif
|
||||||
|
|
||||||
#define WS_BLOCK 1
|
#define WS_BLOCK 1
|
||||||
#define WS_NOBLOCK 0
|
#define WS_NOBLOCK 0
|
||||||
|
|
||||||
@ -246,7 +246,6 @@ int ws_handshake(wsh_t *wsh)
|
|||||||
char version[5] = "";
|
char version[5] = "";
|
||||||
char proto[256] = "";
|
char proto[256] = "";
|
||||||
char proto_buf[384] = "";
|
char proto_buf[384] = "";
|
||||||
char uri[256] = "";
|
|
||||||
char input[256] = "";
|
char input[256] = "";
|
||||||
unsigned char output[SHA1_HASH_SIZE] = "";
|
unsigned char output[SHA1_HASH_SIZE] = "";
|
||||||
char b64[256] = "";
|
char b64[256] = "";
|
||||||
@ -269,7 +268,7 @@ int ws_handshake(wsh_t *wsh)
|
|||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
|
|
||||||
*(wsh->buffer+bytes) = '\0';
|
*(wsh->buffer + wsh->datalen) = '\0';
|
||||||
|
|
||||||
if (strncasecmp(wsh->buffer, "GET ", 4)) {
|
if (strncasecmp(wsh->buffer, "GET ", 4)) {
|
||||||
goto err;
|
goto err;
|
||||||
@ -282,7 +281,9 @@ int ws_handshake(wsh_t *wsh)
|
|||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
|
|
||||||
strncpy(uri, p, e-p);
|
wsh->uri = malloc((e-p) + 1);
|
||||||
|
strncpy(wsh->uri, p, e-p);
|
||||||
|
*(wsh->uri + (e-p)) = '\0';
|
||||||
|
|
||||||
cheezy_get_var(wsh->buffer, "Sec-WebSocket-Key", key, sizeof(key));
|
cheezy_get_var(wsh->buffer, "Sec-WebSocket-Key", key, sizeof(key));
|
||||||
cheezy_get_var(wsh->buffer, "Sec-WebSocket-Version", version, sizeof(version));
|
cheezy_get_var(wsh->buffer, "Sec-WebSocket-Version", version, sizeof(version));
|
||||||
@ -317,15 +318,15 @@ int ws_handshake(wsh_t *wsh)
|
|||||||
|
|
||||||
err:
|
err:
|
||||||
|
|
||||||
snprintf(respond, sizeof(respond), "HTTP/1.1 400 Bad Request\r\n"
|
if (!wsh->stay_open) {
|
||||||
"Sec-WebSocket-Version: 13\r\n\r\n");
|
|
||||||
|
|
||||||
//printf("ERR:\n%s\n", respond);
|
snprintf(respond, sizeof(respond), "HTTP/1.1 400 Bad Request\r\n"
|
||||||
|
"Sec-WebSocket-Version: 13\r\n\r\n");
|
||||||
|
|
||||||
|
ws_raw_write(wsh, respond, strlen(respond));
|
||||||
|
|
||||||
ws_raw_write(wsh, respond, strlen(respond));
|
ws_close(wsh, WS_NONE);
|
||||||
|
}
|
||||||
ws_close(wsh, WS_NONE);
|
|
||||||
|
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
@ -336,12 +337,13 @@ ssize_t ws_raw_read(wsh_t *wsh, void *data, size_t bytes, int block)
|
|||||||
ssize_t r;
|
ssize_t r;
|
||||||
int err = 0;
|
int err = 0;
|
||||||
|
|
||||||
|
wsh->x++;
|
||||||
|
if (wsh->x > 250) ms_sleep(1);
|
||||||
|
|
||||||
if (wsh->ssl) {
|
if (wsh->ssl) {
|
||||||
do {
|
do {
|
||||||
r = SSL_read(wsh->ssl, data, bytes);
|
r = SSL_read(wsh->ssl, data, bytes);
|
||||||
|
|
||||||
ms_sleep(10);
|
|
||||||
|
|
||||||
if (r == -1) {
|
if (r == -1) {
|
||||||
err = SSL_get_error(wsh->ssl, r);
|
err = SSL_get_error(wsh->ssl, r);
|
||||||
|
|
||||||
@ -349,6 +351,8 @@ ssize_t ws_raw_read(wsh_t *wsh, void *data, size_t bytes, int block)
|
|||||||
r = -2;
|
r = -2;
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (block) ms_sleep(10);
|
||||||
}
|
}
|
||||||
|
|
||||||
} while (r == -1 && err == SSL_ERROR_WANT_READ && wsh->x < 100);
|
} while (r == -1 && err == SSL_ERROR_WANT_READ && wsh->x < 100);
|
||||||
@ -358,10 +362,17 @@ ssize_t ws_raw_read(wsh_t *wsh, void *data, size_t bytes, int block)
|
|||||||
|
|
||||||
do {
|
do {
|
||||||
r = recv(wsh->sock, data, bytes, 0);
|
r = recv(wsh->sock, data, bytes, 0);
|
||||||
ms_sleep(10);
|
if (r == -1) {
|
||||||
|
if (!block && xp_is_blocking(xp_errno())) {
|
||||||
|
r = -2;
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (block) ms_sleep(10);
|
||||||
|
}
|
||||||
} while (r == -1 && xp_is_blocking(xp_errno()) && wsh->x < 100);
|
} while (r == -1 && xp_is_blocking(xp_errno()) && wsh->x < 100);
|
||||||
|
|
||||||
if (wsh->x >= 100) {
|
if (wsh->x >= 1000 || (block && wsh->x >= 100)) {
|
||||||
r = -1;
|
r = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -543,7 +554,7 @@ static int establish_logical_layer(wsh_t *wsh)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int ws_init(wsh_t *wsh, ws_socket_t sock, SSL_CTX *ssl_ctx, int close_sock, int block)
|
int ws_init(wsh_t *wsh, ws_socket_t sock, SSL_CTX *ssl_ctx, int close_sock, int block, int stay_open)
|
||||||
{
|
{
|
||||||
memset(wsh, 0, sizeof(*wsh));
|
memset(wsh, 0, sizeof(*wsh));
|
||||||
|
|
||||||
@ -551,6 +562,7 @@ int ws_init(wsh_t *wsh, ws_socket_t sock, SSL_CTX *ssl_ctx, int close_sock, int
|
|||||||
wsh->block = block;
|
wsh->block = block;
|
||||||
wsh->sanity = 5000;
|
wsh->sanity = 5000;
|
||||||
wsh->ssl_ctx = ssl_ctx;
|
wsh->ssl_ctx = ssl_ctx;
|
||||||
|
wsh->stay_open = stay_open;
|
||||||
|
|
||||||
if (!ssl_ctx) {
|
if (!ssl_ctx) {
|
||||||
ssl_ctx = ws_globals.ssl_ctx;
|
ssl_ctx = ws_globals.ssl_ctx;
|
||||||
@ -619,6 +631,11 @@ ssize_t ws_close(wsh_t *wsh, int16_t reason)
|
|||||||
|
|
||||||
wsh->down = 1;
|
wsh->down = 1;
|
||||||
|
|
||||||
|
if (wsh->uri) {
|
||||||
|
free(wsh->uri);
|
||||||
|
wsh->uri = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
if (reason && wsh->sock != ws_sock_invalid) {
|
if (reason && wsh->sock != ws_sock_invalid) {
|
||||||
uint16_t *u16;
|
uint16_t *u16;
|
||||||
uint8_t fr[4] = {WSOC_CLOSE | 0x80, 2, 0};
|
uint8_t fr[4] = {WSOC_CLOSE | 0x80, 2, 0};
|
||||||
|
@ -72,6 +72,7 @@ typedef struct wsh_s {
|
|||||||
ws_socket_t sock;
|
ws_socket_t sock;
|
||||||
char buffer[65536];
|
char buffer[65536];
|
||||||
char wbuffer[65536];
|
char wbuffer[65536];
|
||||||
|
char *uri;
|
||||||
size_t buflen;
|
size_t buflen;
|
||||||
ssize_t datalen;
|
ssize_t datalen;
|
||||||
ssize_t wdatalen;
|
ssize_t wdatalen;
|
||||||
@ -88,6 +89,7 @@ typedef struct wsh_s {
|
|||||||
int sanity;
|
int sanity;
|
||||||
int secure_established;
|
int secure_established;
|
||||||
int logical_established;
|
int logical_established;
|
||||||
|
int stay_open;
|
||||||
int x;
|
int x;
|
||||||
void *write_buffer;
|
void *write_buffer;
|
||||||
size_t write_buffer_len;
|
size_t write_buffer_len;
|
||||||
@ -101,7 +103,7 @@ ssize_t ws_raw_read(wsh_t *wsh, void *data, size_t bytes, int block);
|
|||||||
ssize_t ws_raw_write(wsh_t *wsh, void *data, size_t bytes);
|
ssize_t ws_raw_write(wsh_t *wsh, void *data, size_t bytes);
|
||||||
ssize_t ws_read_frame(wsh_t *wsh, ws_opcode_t *oc, uint8_t **data);
|
ssize_t ws_read_frame(wsh_t *wsh, ws_opcode_t *oc, uint8_t **data);
|
||||||
ssize_t ws_write_frame(wsh_t *wsh, ws_opcode_t oc, void *data, size_t bytes);
|
ssize_t ws_write_frame(wsh_t *wsh, ws_opcode_t oc, void *data, size_t bytes);
|
||||||
int ws_init(wsh_t *wsh, ws_socket_t sock, SSL_CTX *ssl_ctx, int close_sock, int block);
|
int ws_init(wsh_t *wsh, ws_socket_t sock, SSL_CTX *ssl_ctx, int close_sock, int block, int stay_open);
|
||||||
ssize_t ws_close(wsh_t *wsh, int16_t reason);
|
ssize_t ws_close(wsh_t *wsh, int16_t reason);
|
||||||
void ws_destroy(wsh_t *wsh);
|
void ws_destroy(wsh_t *wsh);
|
||||||
void init_ssl(void);
|
void init_ssl(void);
|
||||||
|
@ -1406,8 +1406,8 @@ SWITCH_DECLARE(switch_interval_time_t) switch_interval_time_from_timeval(struct
|
|||||||
SWITCH_DECLARE(switch_status_t) switch_socket_create_pollfd(switch_pollfd_t **pollfd, switch_socket_t *sock, int16_t flags, void *client_data, switch_memory_pool_t *pool);
|
SWITCH_DECLARE(switch_status_t) switch_socket_create_pollfd(switch_pollfd_t **pollfd, switch_socket_t *sock, int16_t flags, void *client_data, switch_memory_pool_t *pool);
|
||||||
SWITCH_DECLARE(switch_status_t) switch_match_glob(const char *pattern, switch_array_header_t ** result, switch_memory_pool_t *pool);
|
SWITCH_DECLARE(switch_status_t) switch_match_glob(const char *pattern, switch_array_header_t ** result, switch_memory_pool_t *pool);
|
||||||
SWITCH_DECLARE(switch_status_t) switch_os_sock_get(switch_os_socket_t *thesock, switch_socket_t *sock);
|
SWITCH_DECLARE(switch_status_t) switch_os_sock_get(switch_os_socket_t *thesock, switch_socket_t *sock);
|
||||||
SWITCH_DECLARE(switch_status_t) switch_socket_addr_get(switch_sockaddr_t ** sa, switch_bool_t remote, switch_socket_t *sock);
|
|
||||||
SWITCH_DECLARE(switch_status_t) switch_os_sock_put(switch_socket_t **sock, switch_os_socket_t *thesock, switch_memory_pool_t *pool);
|
SWITCH_DECLARE(switch_status_t) switch_os_sock_put(switch_socket_t **sock, switch_os_socket_t *thesock, switch_memory_pool_t *pool);
|
||||||
|
SWITCH_DECLARE(switch_status_t) switch_socket_addr_get(switch_sockaddr_t ** sa, switch_bool_t remote, switch_socket_t *sock);
|
||||||
/**
|
/**
|
||||||
* Create an anonymous pipe.
|
* Create an anonymous pipe.
|
||||||
* @param in The file descriptor to use as input to the pipe.
|
* @param in The file descriptor to use as input to the pipe.
|
||||||
|
@ -192,6 +192,7 @@ SWITCH_STANDARD_API(snom_command_api_function)
|
|||||||
curl_easy_setopt(curl_handle, CURLOPT_USERAGENT, "freeswitch-curl/1.0");
|
curl_easy_setopt(curl_handle, CURLOPT_USERAGENT, "freeswitch-curl/1.0");
|
||||||
curl_easy_setopt(curl_handle, CURLOPT_FOLLOWLOCATION, 1);
|
curl_easy_setopt(curl_handle, CURLOPT_FOLLOWLOCATION, 1);
|
||||||
curl_easy_setopt(curl_handle, CURLOPT_MAXREDIRS, 15);
|
curl_easy_setopt(curl_handle, CURLOPT_MAXREDIRS, 15);
|
||||||
|
curl_easy_setopt(curl_handle, CURLOPT_NOSIGNAL, 1);
|
||||||
|
|
||||||
if (argc == 5) {
|
if (argc == 5) {
|
||||||
userpwd = switch_mprintf("%s:%s",argv[3],argv[4]);
|
userpwd = switch_mprintf("%s:%s",argv[3],argv[4]);
|
||||||
|
@ -117,9 +117,9 @@ static void translate_number(char *number, char *profile, char **translated, swi
|
|||||||
translate_rule_t *hi = NULL;
|
translate_rule_t *hi = NULL;
|
||||||
translate_rule_t *rule = NULL;
|
translate_rule_t *rule = NULL;
|
||||||
switch_regex_t *re = NULL;
|
switch_regex_t *re = NULL;
|
||||||
int proceed = 0, ovector[30], subbedlen = 0;
|
int proceed = 0, ovector[30];
|
||||||
char *substituted = NULL, *subbed = NULL, *session_malloc = NULL;
|
char *substituted = NULL, *subbed = NULL;
|
||||||
uint32_t len = 1024;
|
uint32_t len = 0;
|
||||||
|
|
||||||
if (!profile) {
|
if (!profile) {
|
||||||
profile = "US";
|
profile = "US";
|
||||||
@ -136,8 +136,8 @@ static void translate_number(char *number, char *profile, char **translated, swi
|
|||||||
for (rule = hi; rule; rule = rule->next) {
|
for (rule = hi; rule; rule = rule->next) {
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s =~ /%s/\n", number, rule->regex);
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s =~ /%s/\n", number, rule->regex);
|
||||||
if ((proceed = switch_regex_perform(number, rule->regex, &re, ovector, sizeof(ovector) / sizeof(ovector[0])))) {
|
if ((proceed = switch_regex_perform(number, rule->regex, &re, ovector, sizeof(ovector) / sizeof(ovector[0])))) {
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s matched %s, replacing with %s\n", number, rule->regex, rule->replace);
|
len = (uint32_t) (strlen(number) + strlen(rule->replace) + 10) * proceed;
|
||||||
if (!(substituted = switch_core_session_alloc(session, len))) {
|
if (!(substituted = malloc(len))) {
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Memory Error!\n");
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Memory Error!\n");
|
||||||
switch_regex_safe_free(re);
|
switch_regex_safe_free(re);
|
||||||
goto end;
|
goto end;
|
||||||
@ -154,16 +154,11 @@ static void translate_number(char *number, char *profile, char **translated, swi
|
|||||||
subbed = switch_event_expand_headers(event, substituted);
|
subbed = switch_event_expand_headers(event, substituted);
|
||||||
}
|
}
|
||||||
|
|
||||||
subbedlen = strlen(subbed) + 1;
|
substituted = switch_core_session_strdup(session, subbed);
|
||||||
session_malloc = (char *)switch_core_session_alloc(session, subbedlen);
|
|
||||||
memset(session_malloc, 0, subbedlen);
|
if (subbed != substituted) {
|
||||||
strncpy(session_malloc, subbed, subbedlen);
|
|
||||||
if (subbed != substituted)
|
|
||||||
{
|
|
||||||
switch_safe_free(subbed);
|
switch_safe_free(subbed);
|
||||||
}
|
}
|
||||||
|
|
||||||
substituted = session_malloc;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
@ -445,10 +445,21 @@ struct private_object {
|
|||||||
int roaming_registered;
|
int roaming_registered;
|
||||||
int not_registered;
|
int not_registered;
|
||||||
int got_signal;
|
int got_signal;
|
||||||
|
int signal_strength;
|
||||||
char imei[128];
|
char imei[128];
|
||||||
int requesting_imei;
|
int requesting_imei;
|
||||||
char imsi[128];
|
char imsi[128];
|
||||||
int requesting_imsi;
|
int requesting_imsi;
|
||||||
|
char operator_name[128];
|
||||||
|
int requesting_operator_name;
|
||||||
|
char subscriber_number[128];
|
||||||
|
int requesting_subscriber_number;
|
||||||
|
char device_mfg[128];
|
||||||
|
int requesting_device_mfg;
|
||||||
|
char device_model[128];
|
||||||
|
int requesting_device_model;
|
||||||
|
char device_firmware[128];
|
||||||
|
int requesting_device_firmware;
|
||||||
int network_creg_not_supported;
|
int network_creg_not_supported;
|
||||||
char creg[128];
|
char creg[128];
|
||||||
|
|
||||||
|
@ -330,17 +330,29 @@ int gsmopen_serial_config_AT(private_t *tech_pvt)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* phone manufacturer */
|
/* phone manufacturer */
|
||||||
|
tech_pvt->requesting_device_mfg = 1;
|
||||||
res = gsmopen_serial_write_AT_ack(tech_pvt, "AT+CGMI");
|
res = gsmopen_serial_write_AT_ack(tech_pvt, "AT+CGMI");
|
||||||
|
tech_pvt->requesting_device_mfg = 0;
|
||||||
if (res) {
|
if (res) {
|
||||||
DEBUGA_GSMOPEN("AT+CGMI failed\n", GSMOPEN_P_LOG);
|
DEBUGA_GSMOPEN("AT+CGMI failed\n", GSMOPEN_P_LOG);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* phone model */
|
/* phone model */
|
||||||
|
tech_pvt->requesting_device_model = 1;
|
||||||
res = gsmopen_serial_write_AT_ack(tech_pvt, "AT+CGMM");
|
res = gsmopen_serial_write_AT_ack(tech_pvt, "AT+CGMM");
|
||||||
|
tech_pvt->requesting_device_model = 0;
|
||||||
if (res) {
|
if (res) {
|
||||||
DEBUGA_GSMOPEN("AT+CGMM failed\n", GSMOPEN_P_LOG);
|
DEBUGA_GSMOPEN("AT+CGMM failed\n", GSMOPEN_P_LOG);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* phone firmware */
|
||||||
|
tech_pvt->requesting_device_firmware = 1;
|
||||||
|
res = gsmopen_serial_write_AT_ack(tech_pvt, "AT+CGMR");
|
||||||
|
tech_pvt->requesting_device_firmware = 0;
|
||||||
|
if (res) {
|
||||||
|
DEBUGA_GSMOPEN("AT+CGMR failed\n", GSMOPEN_P_LOG);
|
||||||
|
}
|
||||||
|
|
||||||
/* signal network registration with a +CREG unsolicited msg */
|
/* signal network registration with a +CREG unsolicited msg */
|
||||||
res = gsmopen_serial_write_AT_ack(tech_pvt, "AT+CREG=1");
|
res = gsmopen_serial_write_AT_ack(tech_pvt, "AT+CREG=1");
|
||||||
if (res) {
|
if (res) {
|
||||||
@ -358,6 +370,23 @@ int gsmopen_serial_config_AT(private_t *tech_pvt)
|
|||||||
if (res) {
|
if (res) {
|
||||||
DEBUGA_GSMOPEN("AT+CSQ failed\n", GSMOPEN_P_LOG);
|
DEBUGA_GSMOPEN("AT+CSQ failed\n", GSMOPEN_P_LOG);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* operator name */
|
||||||
|
tech_pvt->requesting_operator_name = 1;
|
||||||
|
res = gsmopen_serial_write_AT_ack(tech_pvt, "AT+COPS?");
|
||||||
|
tech_pvt->requesting_operator_name = 0;
|
||||||
|
if (res) {
|
||||||
|
DEBUGA_GSMOPEN("AT+COPS? failed\n", GSMOPEN_P_LOG);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* subscriber number */
|
||||||
|
tech_pvt->requesting_subscriber_number = 1;
|
||||||
|
res = gsmopen_serial_write_AT_ack(tech_pvt, "AT+CNUM");
|
||||||
|
tech_pvt->requesting_subscriber_number = 0;
|
||||||
|
if (res) {
|
||||||
|
DEBUGA_GSMOPEN("AT+CNUM failed, continue\n", GSMOPEN_P_LOG);
|
||||||
|
}
|
||||||
|
|
||||||
/* IMEI */
|
/* IMEI */
|
||||||
tech_pvt->requesting_imei = 1;
|
tech_pvt->requesting_imei = 1;
|
||||||
res = gsmopen_serial_write_AT_ack(tech_pvt, "AT+GSN");
|
res = gsmopen_serial_write_AT_ack(tech_pvt, "AT+GSN");
|
||||||
@ -967,6 +996,12 @@ int gsmopen_serial_read_AT(private_t *tech_pvt, int look_for_ack, int timeout_us
|
|||||||
tech_pvt->got_signal = 2;
|
tech_pvt->got_signal = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (signal_quality == 99) {
|
||||||
|
tech_pvt->signal_strength = 0;
|
||||||
|
} else {
|
||||||
|
tech_pvt->signal_strength = (signal_quality * 2) - 113; /* RSSI [dBm] = reported_value * 2 - 113dB */
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -1006,6 +1041,58 @@ int gsmopen_serial_read_AT(private_t *tech_pvt, int look_for_ack, int timeout_us
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ((strncmp(tech_pvt->line_array.result[i], "+COPS:", 6) == 0)) {
|
||||||
|
int mode, format, rat, err;
|
||||||
|
char oper[128] = "";
|
||||||
|
mode = format = rat = err = 0;
|
||||||
|
|
||||||
|
err = sscanf(&tech_pvt->line_array.result[i][6], "%d,%d,%*[\"]%[^\"]%*[\"],%d", &mode, &format, &oper, &rat);
|
||||||
|
if (err < 3) {
|
||||||
|
DEBUGA_GSMOPEN("|%s| is not formatted as: |+COPS: xx,yy,ssss,nn|\n", GSMOPEN_P_LOG, tech_pvt->line_array.result[i]);
|
||||||
|
} else if (option_debug > 1) {
|
||||||
|
DEBUGA_GSMOPEN("|%s| +COPS: : Mode %d, Format %d, Operator %s, Rat %d\n", GSMOPEN_P_LOG, tech_pvt->line_array.result[i], mode, format, oper, rat);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* if we are requesting the operator name, copy it over */
|
||||||
|
if (tech_pvt->requesting_operator_name)
|
||||||
|
strncpy(tech_pvt->operator_name, oper, sizeof(tech_pvt->operator_name));
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((strncmp(tech_pvt->line_array.result[i], "+CNUM:", 6) == 0) || (strncmp(tech_pvt->line_array.result[i], "ERROR+CNUM:", 11) == 0)) {
|
||||||
|
int skip_chars, err, type;
|
||||||
|
char number[128] = "";
|
||||||
|
char *in_ptr, *out_ptr;
|
||||||
|
|
||||||
|
skip_chars = err = type = 0;
|
||||||
|
in_ptr = out_ptr = number;
|
||||||
|
|
||||||
|
/* +CNUM or ERROR+CNUM ? */
|
||||||
|
if ((strncmp(tech_pvt->line_array.result[i], "+CNUM:", 6) == 0))
|
||||||
|
skip_chars = 7;
|
||||||
|
else
|
||||||
|
skip_chars = 12;
|
||||||
|
|
||||||
|
err = sscanf(&tech_pvt->line_array.result[i][skip_chars], "%*[^,],%[^,],%d", &number, &type);
|
||||||
|
|
||||||
|
/* Remove any double quotes */
|
||||||
|
while (*in_ptr) {
|
||||||
|
if (*in_ptr != '\"') *out_ptr++ = *in_ptr;
|
||||||
|
in_ptr++;
|
||||||
|
}
|
||||||
|
*out_ptr = '\0';
|
||||||
|
|
||||||
|
if (err < 2) {
|
||||||
|
DEBUGA_GSMOPEN("|%s| is not formatted as: |+CNUM: \"Name\", \"+39025458068\", 145|\n", GSMOPEN_P_LOG, tech_pvt->line_array.result[i]);
|
||||||
|
} else if (option_debug) {
|
||||||
|
DEBUGA_GSMOPEN("|%s| +CNUM: Subscriber number = %s, Type = %d\n", GSMOPEN_P_LOG, tech_pvt->line_array.result[i], number, type);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Copy only the first number listed if there are more then one */
|
||||||
|
if (tech_pvt->requesting_subscriber_number && !strlen(tech_pvt->subscriber_number))
|
||||||
|
strncpy(tech_pvt->subscriber_number, number, sizeof(tech_pvt->subscriber_number));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
if ((strncmp(tech_pvt->line_array.result[i], "+CMGW:", 6) == 0)) {
|
if ((strncmp(tech_pvt->line_array.result[i], "+CMGW:", 6) == 0)) {
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
@ -1154,45 +1241,43 @@ int gsmopen_serial_read_AT(private_t *tech_pvt, int look_for_ack, int timeout_us
|
|||||||
tech_pvt->unread_sms_msg_id = pos;
|
tech_pvt->unread_sms_msg_id = pos;
|
||||||
gsmopen_sleep(1000);
|
gsmopen_sleep(1000);
|
||||||
|
|
||||||
if (tech_pvt->unread_sms_msg_id) {
|
char at_command[256];
|
||||||
char at_command[256];
|
|
||||||
|
|
||||||
if (tech_pvt->no_ucs2 == 0) {
|
if (tech_pvt->no_ucs2 == 0) {
|
||||||
int res = gsmopen_serial_write_AT_ack(tech_pvt, "AT+CSCS=\"UCS2\"");
|
int res = gsmopen_serial_write_AT_ack(tech_pvt, "AT+CSCS=\"UCS2\"");
|
||||||
if (res) {
|
|
||||||
ERRORA("AT+CSCS=\"UCS2\" (set TE messages to ucs2) didn't get OK from the phone, continuing\n", GSMOPEN_P_LOG);
|
|
||||||
//memset(tech_pvt->sms_message, 0, sizeof(tech_pvt->sms_message));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
memset(at_command, 0, sizeof(at_command));
|
|
||||||
sprintf(at_command, "AT+CMGR=%d", tech_pvt->unread_sms_msg_id);
|
|
||||||
memset(tech_pvt->sms_message, 0, sizeof(tech_pvt->sms_message));
|
|
||||||
|
|
||||||
tech_pvt->reading_sms_msg = 1;
|
|
||||||
int res = gsmopen_serial_write_AT_ack(tech_pvt, at_command);
|
|
||||||
tech_pvt->reading_sms_msg = 0;
|
|
||||||
if (res) {
|
if (res) {
|
||||||
ERRORA("AT+CMGR (read SMS) didn't get OK from the phone, message sent was:|||%s|||\n", GSMOPEN_P_LOG, at_command);
|
ERRORA("AT+CSCS=\"UCS2\" (set TE messages to ucs2) didn't get OK from the phone, continuing\n", GSMOPEN_P_LOG);
|
||||||
|
//memset(tech_pvt->sms_message, 0, sizeof(tech_pvt->sms_message));
|
||||||
}
|
}
|
||||||
memset(at_command, 0, sizeof(at_command));
|
}
|
||||||
sprintf(at_command, "AT+CMGD=%d", tech_pvt->unread_sms_msg_id); /* delete the message */
|
|
||||||
tech_pvt->unread_sms_msg_id = 0;
|
memset(at_command, 0, sizeof(at_command));
|
||||||
res = gsmopen_serial_write_AT_ack(tech_pvt, at_command);
|
sprintf(at_command, "AT+CMGR=%d", tech_pvt->unread_sms_msg_id);
|
||||||
|
memset(tech_pvt->sms_message, 0, sizeof(tech_pvt->sms_message));
|
||||||
|
|
||||||
|
tech_pvt->reading_sms_msg = 1;
|
||||||
|
int res = gsmopen_serial_write_AT_ack(tech_pvt, at_command);
|
||||||
|
tech_pvt->reading_sms_msg = 0;
|
||||||
|
if (res) {
|
||||||
|
ERRORA("AT+CMGR (read SMS) didn't get OK from the phone, message sent was:|||%s|||\n", GSMOPEN_P_LOG, at_command);
|
||||||
|
}
|
||||||
|
memset(at_command, 0, sizeof(at_command));
|
||||||
|
sprintf(at_command, "AT+CMGD=%d", tech_pvt->unread_sms_msg_id); /* delete the message */
|
||||||
|
tech_pvt->unread_sms_msg_id = 0;
|
||||||
|
res = gsmopen_serial_write_AT_ack(tech_pvt, at_command);
|
||||||
|
if (res) {
|
||||||
|
ERRORA("AT+CMGD (Delete SMS) didn't get OK from the phone, message sent was:|||%s|||\n", GSMOPEN_P_LOG, at_command);
|
||||||
|
}
|
||||||
|
|
||||||
|
res = sms_incoming(tech_pvt);
|
||||||
|
|
||||||
|
if (tech_pvt->phone_callflow == CALLFLOW_CALL_IDLE && tech_pvt->interface_state == GSMOPEN_STATE_DOWN && tech_pvt->owner == NULL) {
|
||||||
|
/* we're not in a call, neither calling */
|
||||||
|
res = gsmopen_serial_write_AT_ack(tech_pvt, "AT+CKPD=\"EEE\"");
|
||||||
if (res) {
|
if (res) {
|
||||||
ERRORA("AT+CMGD (Delete SMS) didn't get OK from the phone, message sent was:|||%s|||\n", GSMOPEN_P_LOG, at_command);
|
DEBUGA_GSMOPEN("AT+CKPD=\"EEE\" (cellphone screen back to user) didn't get OK from the phone\n", GSMOPEN_P_LOG);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
res = sms_incoming(tech_pvt);
|
|
||||||
|
|
||||||
if (tech_pvt->phone_callflow == CALLFLOW_CALL_IDLE && tech_pvt->interface_state == GSMOPEN_STATE_DOWN && tech_pvt->owner == NULL) {
|
|
||||||
/* we're not in a call, neither calling */
|
|
||||||
res = gsmopen_serial_write_AT_ack(tech_pvt, "AT+CKPD=\"EEE\"");
|
|
||||||
if (res) {
|
|
||||||
DEBUGA_GSMOPEN("AT+CKPD=\"EEE\" (cellphone screen back to user) didn't get OK from the phone\n", GSMOPEN_P_LOG);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} //unread_msg_id
|
|
||||||
|
|
||||||
} //CMTI well formatted
|
} //CMTI well formatted
|
||||||
|
|
||||||
@ -1613,13 +1698,33 @@ int gsmopen_serial_read_AT(private_t *tech_pvt, int look_for_ack, int timeout_us
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* if we are requesting IMSI, put the line into the imei buffer if the line is not "OK" or "ERROR" */
|
/* if we are requesting IMSI, put the line into the imsi buffer if the line is not "OK" or "ERROR" */
|
||||||
if (tech_pvt->requesting_imsi && at_ack == -1) {
|
if (tech_pvt->requesting_imsi && at_ack == -1) {
|
||||||
if (strlen(tech_pvt->line_array.result[i])) { /* we are reading the IMSI */
|
if (strlen(tech_pvt->line_array.result[i])) { /* we are reading the IMSI */
|
||||||
strncpy(tech_pvt->imsi, tech_pvt->line_array.result[i], sizeof(tech_pvt->imsi));
|
strncpy(tech_pvt->imsi, tech_pvt->line_array.result[i], sizeof(tech_pvt->imsi));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* if we are requesting device manufacturer, model or firmware version,
|
||||||
|
* put the line into the buffer if the line is not "OK" or "ERROR" */
|
||||||
|
if (tech_pvt->requesting_device_mfg && at_ack == -1) {
|
||||||
|
if (strlen(tech_pvt->line_array.result[i])) {
|
||||||
|
strncpy(tech_pvt->device_mfg, tech_pvt->line_array.result[i], sizeof(tech_pvt->device_mfg));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (tech_pvt->requesting_device_model && at_ack == -1) {
|
||||||
|
if (strlen(tech_pvt->line_array.result[i])) {
|
||||||
|
strncpy(tech_pvt->device_model, tech_pvt->line_array.result[i], sizeof(tech_pvt->device_model));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (tech_pvt->requesting_device_firmware && at_ack == -1) {
|
||||||
|
if (strlen(tech_pvt->line_array.result[i])) {
|
||||||
|
strncpy(tech_pvt->device_firmware, tech_pvt->line_array.result[i], sizeof(tech_pvt->device_firmware));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* if we are reading an sms message from memory, put the line into the sms buffer if the line is not "OK" or "ERROR" */
|
/* if we are reading an sms message from memory, put the line into the sms buffer if the line is not "OK" or "ERROR" */
|
||||||
if (tech_pvt->reading_sms_msg > 1 && at_ack == -1) {
|
if (tech_pvt->reading_sms_msg > 1 && at_ack == -1) {
|
||||||
|
@ -1694,14 +1694,15 @@ static switch_status_t load_config(int reload_type)
|
|||||||
switch_sleep(100000);
|
switch_sleep(100000);
|
||||||
WARNINGA("STARTED interface_id=%u\n", GSMOPEN_P_LOG, interface_id);
|
WARNINGA("STARTED interface_id=%u\n", GSMOPEN_P_LOG, interface_id);
|
||||||
|
|
||||||
|
/* How many real intterfaces */
|
||||||
|
globals.real_interfaces++;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
for (i = 0; i < GSMOPEN_MAX_INTERFACES; i++) {
|
for (i = 0; i < GSMOPEN_MAX_INTERFACES; i++) {
|
||||||
if (strlen(globals.GSMOPEN_INTERFACES[i].name)) {
|
if (strlen(globals.GSMOPEN_INTERFACES[i].name)) {
|
||||||
/* How many real intterfaces */
|
|
||||||
globals.real_interfaces++;
|
|
||||||
|
|
||||||
tech_pvt = &globals.GSMOPEN_INTERFACES[i];
|
tech_pvt = &globals.GSMOPEN_INTERFACES[i];
|
||||||
|
|
||||||
@ -2224,8 +2225,8 @@ SWITCH_STANDARD_API(gsm_function)
|
|||||||
unsigned int ob_failed = 0;
|
unsigned int ob_failed = 0;
|
||||||
char next_flag_char = ' ';
|
char next_flag_char = ' ';
|
||||||
|
|
||||||
stream->write_function(stream, "F ID\t Name \tIB (F/T) OB (F/T)\tState\tCallFlw\t\tUUID\n");
|
stream->write_function(stream, "F ID Name Operator IMEI IB (F/T) OB (F/T) State CallFlw UUID\n");
|
||||||
stream->write_function(stream, "= ====\t ======== \t======= =======\t======\t============\t======\n");
|
stream->write_function(stream, "= == ========== ================ =============== ========= ========= ======= =============== ====\n");
|
||||||
|
|
||||||
for (i = 0; i < GSMOPEN_MAX_INTERFACES; i++) {
|
for (i = 0; i < GSMOPEN_MAX_INTERFACES; i++) {
|
||||||
|
|
||||||
@ -2238,9 +2239,11 @@ SWITCH_STANDARD_API(gsm_function)
|
|||||||
|
|
||||||
|
|
||||||
stream->write_function(stream,
|
stream->write_function(stream,
|
||||||
"%c %d\t[%6s]\t%3u/%u\t%6u/%u\t%s\t%s\t%s\n",
|
"%c %-2d %-10s %-16.16s %-15s %4u/%-4u %4u/%-4u %-7s %-15s %s\n",
|
||||||
next_flag_char,
|
next_flag_char,
|
||||||
i, globals.GSMOPEN_INTERFACES[i].name,
|
i, globals.GSMOPEN_INTERFACES[i].name,
|
||||||
|
globals.GSMOPEN_INTERFACES[i].operator_name,
|
||||||
|
globals.GSMOPEN_INTERFACES[i].imei,
|
||||||
globals.GSMOPEN_INTERFACES[i].ib_failed_calls,
|
globals.GSMOPEN_INTERFACES[i].ib_failed_calls,
|
||||||
globals.GSMOPEN_INTERFACES[i].ib_calls,
|
globals.GSMOPEN_INTERFACES[i].ib_calls,
|
||||||
globals.GSMOPEN_INTERFACES[i].ob_failed_calls,
|
globals.GSMOPEN_INTERFACES[i].ob_failed_calls,
|
||||||
@ -2420,8 +2423,15 @@ SWITCH_STANDARD_API(gsmopen_dump_function)
|
|||||||
}
|
}
|
||||||
snprintf(value, sizeof(value) - 1, "%d", tech_pvt->got_signal);
|
snprintf(value, sizeof(value) - 1, "%d", tech_pvt->got_signal);
|
||||||
stream->write_function(stream, "got_signal = %s\n", value);
|
stream->write_function(stream, "got_signal = %s\n", value);
|
||||||
|
snprintf(value, sizeof(value) - 1, "%d", tech_pvt->signal_strength);
|
||||||
|
stream->write_function(stream, "signal_strength = %s\n", value);
|
||||||
snprintf(value, sizeof(value) - 1, "%d", tech_pvt->running);
|
snprintf(value, sizeof(value) - 1, "%d", tech_pvt->running);
|
||||||
stream->write_function(stream, "running = %s\n", value);
|
stream->write_function(stream, "running = %s\n", value);
|
||||||
|
stream->write_function(stream, "subscriber_number = %s\n", tech_pvt->subscriber_number);
|
||||||
|
stream->write_function(stream, "device_manufacturer = %s\n", tech_pvt->device_mfg);
|
||||||
|
stream->write_function(stream, "device_model = %s\n", tech_pvt->device_model);
|
||||||
|
stream->write_function(stream, "device_firmware = %s\n", tech_pvt->device_firmware);
|
||||||
|
stream->write_function(stream, "operator = %s\n", tech_pvt->operator_name);
|
||||||
stream->write_function(stream, "imei = %s\n", tech_pvt->imei);
|
stream->write_function(stream, "imei = %s\n", tech_pvt->imei);
|
||||||
stream->write_function(stream, "imsi = %s\n", tech_pvt->imsi);
|
stream->write_function(stream, "imsi = %s\n", tech_pvt->imsi);
|
||||||
snprintf(value, sizeof(value) - 1, "%d", tech_pvt->controldev_dead);
|
snprintf(value, sizeof(value) - 1, "%d", tech_pvt->controldev_dead);
|
||||||
@ -2478,8 +2488,15 @@ SWITCH_STANDARD_API(gsmopen_dump_function)
|
|||||||
}
|
}
|
||||||
snprintf(value, sizeof(value) - 1, "%d", tech_pvt->got_signal);
|
snprintf(value, sizeof(value) - 1, "%d", tech_pvt->got_signal);
|
||||||
stream->write_function(stream, "got_signal = %s\n", value);
|
stream->write_function(stream, "got_signal = %s\n", value);
|
||||||
|
snprintf(value, sizeof(value) - 1, "%d", tech_pvt->signal_strength);
|
||||||
|
stream->write_function(stream, "signal_strength = %s\n", value);
|
||||||
snprintf(value, sizeof(value) - 1, "%d", tech_pvt->running);
|
snprintf(value, sizeof(value) - 1, "%d", tech_pvt->running);
|
||||||
stream->write_function(stream, "running = %s\n", value);
|
stream->write_function(stream, "running = %s\n", value);
|
||||||
|
stream->write_function(stream, "subscriber_number = %s\n", tech_pvt->subscriber_number);
|
||||||
|
stream->write_function(stream, "device_manufacturer = %s\n", tech_pvt->device_mfg);
|
||||||
|
stream->write_function(stream, "device_model = %s\n", tech_pvt->device_model);
|
||||||
|
stream->write_function(stream, "device_firmware = %s\n", tech_pvt->device_firmware);
|
||||||
|
stream->write_function(stream, "operator = %s\n", tech_pvt->operator_name);
|
||||||
stream->write_function(stream, "imei = %s\n", tech_pvt->imei);
|
stream->write_function(stream, "imei = %s\n", tech_pvt->imei);
|
||||||
stream->write_function(stream, "imsi = %s\n", tech_pvt->imsi);
|
stream->write_function(stream, "imsi = %s\n", tech_pvt->imsi);
|
||||||
snprintf(value, sizeof(value) - 1, "%d", tech_pvt->controldev_dead);
|
snprintf(value, sizeof(value) - 1, "%d", tech_pvt->controldev_dead);
|
||||||
@ -2807,8 +2824,15 @@ int dump_event_full(private_t *tech_pvt, int is_alarm, int alarm_code, const cha
|
|||||||
}
|
}
|
||||||
snprintf(value, sizeof(value) - 1, "%d", tech_pvt->got_signal);
|
snprintf(value, sizeof(value) - 1, "%d", tech_pvt->got_signal);
|
||||||
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "got_signal", value);
|
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "got_signal", value);
|
||||||
|
snprintf(value, sizeof(value) - 1, "%d", tech_pvt->signal_strength);
|
||||||
|
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "signal_strength", value);
|
||||||
snprintf(value, sizeof(value) - 1, "%d", tech_pvt->running);
|
snprintf(value, sizeof(value) - 1, "%d", tech_pvt->running);
|
||||||
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "running", value);
|
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "running", value);
|
||||||
|
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "subscriber_number", tech_pvt->subscriber_number);
|
||||||
|
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "device_manufacturer", tech_pvt->device_mfg);
|
||||||
|
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "device_model", tech_pvt->device_model);
|
||||||
|
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "device_firmware", tech_pvt->device_firmware);
|
||||||
|
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "operator", tech_pvt->operator_name);
|
||||||
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "imei", tech_pvt->imei);
|
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "imei", tech_pvt->imei);
|
||||||
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "imsi", tech_pvt->imsi);
|
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "imsi", tech_pvt->imsi);
|
||||||
snprintf(value, sizeof(value) - 1, "%d", tech_pvt->controldev_dead);
|
snprintf(value, sizeof(value) - 1, "%d", tech_pvt->controldev_dead);
|
||||||
|
@ -11,6 +11,11 @@
|
|||||||
#define ms_sleep(x) Sleep( x );
|
#define ms_sleep(x) Sleep( x );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
/* warning C4706: assignment within conditional expression*/
|
||||||
|
#pragma warning(disable: 4706)
|
||||||
|
#endif
|
||||||
|
|
||||||
#define WS_BLOCK 1
|
#define WS_BLOCK 1
|
||||||
#define WS_NOBLOCK 0
|
#define WS_NOBLOCK 0
|
||||||
|
|
||||||
@ -241,7 +246,6 @@ int ws_handshake(wsh_t *wsh)
|
|||||||
char version[5] = "";
|
char version[5] = "";
|
||||||
char proto[256] = "";
|
char proto[256] = "";
|
||||||
char proto_buf[384] = "";
|
char proto_buf[384] = "";
|
||||||
char uri[256] = "";
|
|
||||||
char input[256] = "";
|
char input[256] = "";
|
||||||
unsigned char output[SHA1_HASH_SIZE] = "";
|
unsigned char output[SHA1_HASH_SIZE] = "";
|
||||||
char b64[256] = "";
|
char b64[256] = "";
|
||||||
@ -277,7 +281,9 @@ int ws_handshake(wsh_t *wsh)
|
|||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
|
|
||||||
strncpy(uri, p, e-p);
|
wsh->uri = malloc((e-p) + 1);
|
||||||
|
strncpy(wsh->uri, p, e-p);
|
||||||
|
*(wsh->uri + (e-p)) = '\0';
|
||||||
|
|
||||||
cheezy_get_var(wsh->buffer, "Sec-WebSocket-Key", key, sizeof(key));
|
cheezy_get_var(wsh->buffer, "Sec-WebSocket-Key", key, sizeof(key));
|
||||||
cheezy_get_var(wsh->buffer, "Sec-WebSocket-Version", version, sizeof(version));
|
cheezy_get_var(wsh->buffer, "Sec-WebSocket-Version", version, sizeof(version));
|
||||||
@ -331,12 +337,13 @@ ssize_t ws_raw_read(wsh_t *wsh, void *data, size_t bytes, int block)
|
|||||||
ssize_t r;
|
ssize_t r;
|
||||||
int err = 0;
|
int err = 0;
|
||||||
|
|
||||||
|
wsh->x++;
|
||||||
|
if (wsh->x > 250) ms_sleep(1);
|
||||||
|
|
||||||
if (wsh->ssl) {
|
if (wsh->ssl) {
|
||||||
do {
|
do {
|
||||||
r = SSL_read(wsh->ssl, data, bytes);
|
r = SSL_read(wsh->ssl, data, bytes);
|
||||||
|
|
||||||
ms_sleep(10);
|
|
||||||
|
|
||||||
if (r == -1) {
|
if (r == -1) {
|
||||||
err = SSL_get_error(wsh->ssl, r);
|
err = SSL_get_error(wsh->ssl, r);
|
||||||
|
|
||||||
@ -344,6 +351,8 @@ ssize_t ws_raw_read(wsh_t *wsh, void *data, size_t bytes, int block)
|
|||||||
r = -2;
|
r = -2;
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (block) ms_sleep(10);
|
||||||
}
|
}
|
||||||
|
|
||||||
} while (r == -1 && err == SSL_ERROR_WANT_READ && wsh->x < 100);
|
} while (r == -1 && err == SSL_ERROR_WANT_READ && wsh->x < 100);
|
||||||
@ -353,10 +362,17 @@ ssize_t ws_raw_read(wsh_t *wsh, void *data, size_t bytes, int block)
|
|||||||
|
|
||||||
do {
|
do {
|
||||||
r = recv(wsh->sock, data, bytes, 0);
|
r = recv(wsh->sock, data, bytes, 0);
|
||||||
ms_sleep(10);
|
if (r == -1) {
|
||||||
|
if (!block && xp_is_blocking(xp_errno())) {
|
||||||
|
r = -2;
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (block) ms_sleep(10);
|
||||||
|
}
|
||||||
} while (r == -1 && xp_is_blocking(xp_errno()) && wsh->x < 100);
|
} while (r == -1 && xp_is_blocking(xp_errno()) && wsh->x < 100);
|
||||||
|
|
||||||
if (wsh->x >= 100) {
|
if (wsh->x >= 1000 || (block && wsh->x >= 100)) {
|
||||||
r = -1;
|
r = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -615,6 +631,11 @@ ssize_t ws_close(wsh_t *wsh, int16_t reason)
|
|||||||
|
|
||||||
wsh->down = 1;
|
wsh->down = 1;
|
||||||
|
|
||||||
|
if (wsh->uri) {
|
||||||
|
free(wsh->uri);
|
||||||
|
wsh->uri = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
if (reason && wsh->sock != ws_sock_invalid) {
|
if (reason && wsh->sock != ws_sock_invalid) {
|
||||||
uint16_t *u16;
|
uint16_t *u16;
|
||||||
uint8_t fr[4] = {WSOC_CLOSE | 0x80, 2, 0};
|
uint8_t fr[4] = {WSOC_CLOSE | 0x80, 2, 0};
|
||||||
|
@ -72,6 +72,7 @@ typedef struct wsh_s {
|
|||||||
ws_socket_t sock;
|
ws_socket_t sock;
|
||||||
char buffer[65536];
|
char buffer[65536];
|
||||||
char wbuffer[65536];
|
char wbuffer[65536];
|
||||||
|
char *uri;
|
||||||
size_t buflen;
|
size_t buflen;
|
||||||
ssize_t datalen;
|
ssize_t datalen;
|
||||||
ssize_t wdatalen;
|
ssize_t wdatalen;
|
||||||
|
@ -236,13 +236,14 @@ static switch_xml_t lua_fetch(const char *section,
|
|||||||
{
|
{
|
||||||
|
|
||||||
switch_xml_t xml = NULL;
|
switch_xml_t xml = NULL;
|
||||||
|
char *mycmd = NULL;
|
||||||
|
|
||||||
if (!zstr(globals.xml_handler)) {
|
if (!zstr(globals.xml_handler)) {
|
||||||
lua_State *L = lua_init();
|
lua_State *L = lua_init();
|
||||||
char *mycmd = strdup(globals.xml_handler);
|
|
||||||
const char *str;
|
const char *str;
|
||||||
int error;
|
int error;
|
||||||
|
|
||||||
|
mycmd = strdup(globals.xml_handler);
|
||||||
switch_assert(mycmd);
|
switch_assert(mycmd);
|
||||||
|
|
||||||
lua_newtable(L);
|
lua_newtable(L);
|
||||||
@ -267,7 +268,7 @@ static switch_xml_t lua_fetch(const char *section,
|
|||||||
|
|
||||||
if((error = lua_parse_and_execute(L, mycmd))){
|
if((error = lua_parse_and_execute(L, mycmd))){
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "LUA script parse/execute error!\n");
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "LUA script parse/execute error!\n");
|
||||||
return NULL;
|
goto end;
|
||||||
}
|
}
|
||||||
|
|
||||||
lua_getglobal(L, "XML_STRING");
|
lua_getglobal(L, "XML_STRING");
|
||||||
@ -285,9 +286,13 @@ static switch_xml_t lua_fetch(const char *section,
|
|||||||
}
|
}
|
||||||
|
|
||||||
lua_uninit(L);
|
lua_uninit(L);
|
||||||
free(mycmd);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
end:
|
||||||
|
|
||||||
|
switch_safe_free(mycmd);
|
||||||
|
|
||||||
return xml;
|
return xml;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -237,6 +237,7 @@ JS_GLOBAL_FUNCTION_IMPL_STATIC(FetchURLFile)
|
|||||||
if ((config_data.fileHandle = open(filename, O_CREAT | O_RDWR | O_TRUNC, S_IRUSR | S_IWUSR)) > -1) {
|
if ((config_data.fileHandle = open(filename, O_CREAT | O_RDWR | O_TRUNC, S_IRUSR | S_IWUSR)) > -1) {
|
||||||
switch_curl_easy_setopt(curl_handle, CURLOPT_URL, url);
|
switch_curl_easy_setopt(curl_handle, CURLOPT_URL, url);
|
||||||
switch_curl_easy_setopt(curl_handle, CURLOPT_FOLLOWLOCATION, 1);
|
switch_curl_easy_setopt(curl_handle, CURLOPT_FOLLOWLOCATION, 1);
|
||||||
|
switch_curl_easy_setopt(curl_handle, CURLOPT_NOSIGNAL, 1);
|
||||||
switch_curl_easy_setopt(curl_handle, CURLOPT_MAXREDIRS, 10);
|
switch_curl_easy_setopt(curl_handle, CURLOPT_MAXREDIRS, 10);
|
||||||
switch_curl_easy_setopt(curl_handle, CURLOPT_WRITEFUNCTION, FSGlobal::FileCallback);
|
switch_curl_easy_setopt(curl_handle, CURLOPT_WRITEFUNCTION, FSGlobal::FileCallback);
|
||||||
switch_curl_easy_setopt(curl_handle, CURLOPT_WRITEDATA, (void *) &config_data);
|
switch_curl_easy_setopt(curl_handle, CURLOPT_WRITEDATA, (void *) &config_data);
|
||||||
@ -293,6 +294,7 @@ JS_GLOBAL_FUNCTION_IMPL_STATIC(FetchURL)
|
|||||||
|
|
||||||
switch_curl_easy_setopt(curl_handle, CURLOPT_URL, url);
|
switch_curl_easy_setopt(curl_handle, CURLOPT_URL, url);
|
||||||
switch_curl_easy_setopt(curl_handle, CURLOPT_FOLLOWLOCATION, 1);
|
switch_curl_easy_setopt(curl_handle, CURLOPT_FOLLOWLOCATION, 1);
|
||||||
|
switch_curl_easy_setopt(curl_handle, CURLOPT_NOSIGNAL, 1);
|
||||||
switch_curl_easy_setopt(curl_handle, CURLOPT_MAXREDIRS, 10);
|
switch_curl_easy_setopt(curl_handle, CURLOPT_MAXREDIRS, 10);
|
||||||
switch_curl_easy_setopt(curl_handle, CURLOPT_WRITEFUNCTION, FSGlobal::FetchUrlCallback);
|
switch_curl_easy_setopt(curl_handle, CURLOPT_WRITEFUNCTION, FSGlobal::FetchUrlCallback);
|
||||||
switch_curl_easy_setopt(curl_handle, CURLOPT_WRITEDATA, (void *) &config_data);
|
switch_curl_easy_setopt(curl_handle, CURLOPT_WRITEDATA, (void *) &config_data);
|
||||||
|
@ -11,11 +11,13 @@
|
|||||||
<param name="server-host" value="192.168.0.69"/>
|
<param name="server-host" value="192.168.0.69"/>
|
||||||
<param name="server-port" value="12201"/>
|
<param name="server-port" value="12201"/>
|
||||||
<param name="loglevel" value="warning"/>
|
<param name="loglevel" value="warning"/>
|
||||||
|
<!-- Uncomment if using logstash w/ gelf.rb -->
|
||||||
|
<!--param name="send-uncompressed-header" value="true"/-->
|
||||||
|
|
||||||
<!-- fields to add to every log associated w/ a session -->
|
<!-- fields to add to every log associated w/ a session -->
|
||||||
<fields>
|
<fields>
|
||||||
<!-- for example: channel variable "customer_account_number" will be the data source for the customer field in graylog2 -->
|
<!-- for example: channel variable "customer_account_number" will be the data source for the customer field in graylog2 -->
|
||||||
<field name="customer" variable="customer_account_number"/>
|
<!--field name="customer" variable="customer_account_number"/-->
|
||||||
</fields>
|
</fields>
|
||||||
</settings>
|
</settings>
|
||||||
</configuration>
|
</configuration>
|
||||||
|
@ -36,6 +36,10 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_graylog2_load);
|
|||||||
SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_graylog2_shutdown);
|
SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_graylog2_shutdown);
|
||||||
SWITCH_MODULE_DEFINITION(mod_graylog2, mod_graylog2_load, mod_graylog2_shutdown, NULL);
|
SWITCH_MODULE_DEFINITION(mod_graylog2, mod_graylog2_load, mod_graylog2_shutdown, NULL);
|
||||||
|
|
||||||
|
#define MAX_GELF_LOG_LEN 8192
|
||||||
|
#define UNCOMPRESSED_MAGIC "\037\074"
|
||||||
|
#define UNCOMPRESSED_MAGIC_LEN 2
|
||||||
|
|
||||||
static struct {
|
static struct {
|
||||||
/** memory pool for this module */
|
/** memory pool for this module */
|
||||||
switch_memory_pool_t *pool;
|
switch_memory_pool_t *pool;
|
||||||
@ -53,6 +57,8 @@ static struct {
|
|||||||
switch_queue_t *log_queue;
|
switch_queue_t *log_queue;
|
||||||
/** Fields to automatically add to session logs */
|
/** Fields to automatically add to session logs */
|
||||||
switch_event_t *session_fields;
|
switch_event_t *session_fields;
|
||||||
|
/** If true, byte header for uncompressed GELF is sent. Might be required if using logstash */
|
||||||
|
int send_uncompressed_header;
|
||||||
} globals;
|
} globals;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -227,10 +233,19 @@ static void *SWITCH_THREAD_FUNC deliver_graylog2_thread(switch_thread_t *thread,
|
|||||||
if (switch_queue_pop(globals.log_queue, (void *)&log) == SWITCH_STATUS_SUCCESS) {
|
if (switch_queue_pop(globals.log_queue, (void *)&log) == SWITCH_STATUS_SUCCESS) {
|
||||||
if (!zstr(log)) {
|
if (!zstr(log)) {
|
||||||
switch_size_t len = strlen(log);
|
switch_size_t len = strlen(log);
|
||||||
if (len <= 8192) {
|
switch_size_t max_len = globals.send_uncompressed_header ? MAX_GELF_LOG_LEN - UNCOMPRESSED_MAGIC_LEN : MAX_GELF_LOG_LEN;
|
||||||
switch_socket_send_nonblock(graylog2_sock, (void *)log, &len);
|
if (len <= max_len) {
|
||||||
|
if (globals.send_uncompressed_header) {
|
||||||
|
char buf[MAX_GELF_LOG_LEN];
|
||||||
|
memcpy(buf, UNCOMPRESSED_MAGIC, UNCOMPRESSED_MAGIC_LEN);
|
||||||
|
memcpy(buf + UNCOMPRESSED_MAGIC_LEN, log, len);
|
||||||
|
len += UNCOMPRESSED_MAGIC_LEN;
|
||||||
|
switch_socket_send_nonblock(graylog2_sock, (void *)buf, &len);
|
||||||
|
} else {
|
||||||
|
switch_socket_send_nonblock(graylog2_sock, (void *)log, &len);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Skipping log with length > 8192 bytes\n");
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Skipping large log\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
switch_safe_free(log);
|
switch_safe_free(log);
|
||||||
@ -313,6 +328,7 @@ static switch_status_t do_config(void)
|
|||||||
globals.log_level = SWITCH_LOG_WARNING;
|
globals.log_level = SWITCH_LOG_WARNING;
|
||||||
globals.server_host = "127.0.0.1";
|
globals.server_host = "127.0.0.1";
|
||||||
globals.server_port = 12201;
|
globals.server_port = 12201;
|
||||||
|
globals.send_uncompressed_header = 0;
|
||||||
|
|
||||||
if ((settings = switch_xml_child(cfg, "settings"))) {
|
if ((settings = switch_xml_child(cfg, "settings"))) {
|
||||||
switch_xml_t param;
|
switch_xml_t param;
|
||||||
@ -353,6 +369,9 @@ static switch_status_t do_config(void)
|
|||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "\"%s\" = \"%s\"\n", name, value);
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "\"%s\" = \"%s\"\n", name, value);
|
||||||
globals.log_level = log_level;
|
globals.log_level = log_level;
|
||||||
}
|
}
|
||||||
|
} else if (!strcasecmp(name, "send-uncompressed-header")) {
|
||||||
|
globals.send_uncompressed_header = switch_true(value);
|
||||||
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "\"%s\" = \"%s\"\n", name, value);
|
||||||
} else {
|
} else {
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Ignoring unknown param: \"%s\"\n", name);
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Ignoring unknown param: \"%s\"\n", name);
|
||||||
}
|
}
|
||||||
|
@ -653,16 +653,16 @@ SWITCH_DECLARE(switch_interval_time_t) switch_interval_time_from_timeval(struct
|
|||||||
|
|
||||||
/* socket stubs */
|
/* socket stubs */
|
||||||
|
|
||||||
SWITCH_DECLARE(switch_status_t) switch_os_sock_put(switch_socket_t **sock, switch_os_socket_t *thesock, switch_memory_pool_t *pool)
|
|
||||||
{
|
|
||||||
return apr_os_sock_put(sock, thesock, pool);
|
|
||||||
}
|
|
||||||
|
|
||||||
SWITCH_DECLARE(switch_status_t) switch_os_sock_get(switch_os_socket_t *thesock, switch_socket_t *sock)
|
SWITCH_DECLARE(switch_status_t) switch_os_sock_get(switch_os_socket_t *thesock, switch_socket_t *sock)
|
||||||
{
|
{
|
||||||
return apr_os_sock_get(thesock, sock);
|
return apr_os_sock_get(thesock, sock);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SWITCH_DECLARE(switch_status_t) switch_os_sock_put(switch_socket_t **sock, switch_os_socket_t *thesock, switch_memory_pool_t *pool)
|
||||||
|
{
|
||||||
|
return apr_os_sock_put(sock, thesock, pool);
|
||||||
|
}
|
||||||
|
|
||||||
SWITCH_DECLARE(switch_status_t) switch_socket_addr_get(switch_sockaddr_t ** sa, switch_bool_t remote, switch_socket_t *sock)
|
SWITCH_DECLARE(switch_status_t) switch_socket_addr_get(switch_sockaddr_t ** sa, switch_bool_t remote, switch_socket_t *sock)
|
||||||
{
|
{
|
||||||
return apr_socket_addr_get(sa, (apr_interface_e) remote, sock);
|
return apr_socket_addr_get(sa, (apr_interface_e) remote, sock);
|
||||||
|
@ -4203,7 +4203,11 @@ SWITCH_DECLARE(switch_status_t) switch_channel_get_variables(switch_channel_t *c
|
|||||||
{
|
{
|
||||||
switch_status_t status;
|
switch_status_t status;
|
||||||
switch_mutex_lock(channel->profile_mutex);
|
switch_mutex_lock(channel->profile_mutex);
|
||||||
status = switch_event_dup(event, channel->variables);
|
if (channel->variables) {
|
||||||
|
status = switch_event_dup(event, channel->variables);
|
||||||
|
} else {
|
||||||
|
status = switch_event_create(event, SWITCH_EVENT_CHANNEL_DATA);
|
||||||
|
}
|
||||||
switch_mutex_unlock(channel->profile_mutex);
|
switch_mutex_unlock(channel->profile_mutex);
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
@ -1410,7 +1410,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_write_frame(switch_core_sess
|
|||||||
switch_time_t tdiff = diff;
|
switch_time_t tdiff = diff;
|
||||||
|
|
||||||
while(tdiff > 1) {
|
while(tdiff > 1) {
|
||||||
switch_buffer_write(bp->raw_read_buffer, fill_data, len);
|
switch_buffer_write(bp->raw_write_buffer, fill_data, len);
|
||||||
tdiff--;
|
tdiff--;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3434,7 +3434,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_process_fh(switch_core_session_t *ses
|
|||||||
}
|
}
|
||||||
|
|
||||||
samps = step * (fhp->native_rate / 1000);
|
samps = step * (fhp->native_rate / 1000);
|
||||||
target = (int32_t)fhp->pos + samps;
|
target = (int32_t)fhp->offset_pos + samps;
|
||||||
|
|
||||||
if (target < 0) {
|
if (target < 0) {
|
||||||
target = 0;
|
target = 0;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user