git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@4807 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Anthony Minessale 2007-03-30 16:41:12 +00:00
parent 33efc5eeb5
commit 5e23936fa6
5 changed files with 102 additions and 30 deletions

View File

@ -180,6 +180,60 @@ switch_mutex_unlock(obj->flag_mutex);
*/
#define switch_safe_free(it) if (it) {free(it);it=NULL;}
/*!
\brief Test if one string is inside another with extra case checking
\param s the inner string
\param q the big string
\return SWITCH_TRUE or SWITCH_FALSE
*/
static inline switch_bool_t switch_strstr(char *s, char *q)
{
char *p, *S = NULL, *Q = NULL;
switch_bool_t tf = SWITCH_FALSE;
if (strstr(s, q)) {
return SWITCH_TRUE;
}
S = strdup(s);
assert(S != NULL);
for (p = S; p && *p; p++) {
*p = (char)toupper(*p);
}
if (strstr(S, q)) {
tf = SWITCH_TRUE;
goto done;
}
Q = strdup(q);
assert(Q != NULL);
for (p = Q; p && *p; p++) {
*p = (char)toupper(*p);
}
if (strstr(s, Q)) {
tf = SWITCH_TRUE;
goto done;
}
if (strstr(S, Q)) {
tf = SWITCH_TRUE;
goto done;
}
done:
switch_safe_free(S);
switch_safe_free(Q);
return tf;
}
/*!
\brief Test for NULL or zero length string
\param s the string to test

View File

@ -154,10 +154,9 @@ static switch_status_t switch_g729_decode(switch_codec_t *codec,
}
if (encoded_data_len % 2 == 0) {
if (encoded_data_len % 12 == 0) {
if (encoded_data_len == 2 || encoded_data_len % 12 == 0) {
return SWITCH_STATUS_BREAK;
//divisor = 12;
//plen = 10;

View File

@ -1,13 +1,20 @@
BASE=../../../..
DING_DIR=$(BASE)/libs/libdingaling
DINGLA=$(DING_DIR)/libdingaling.la
LOCAL_CFLAGS = `$(BASE)/libs/apr/apr-1-config --cflags --cppflags --includes`
LOCAL_CFLAGS += `$(BASE)/libs/apr-util/apu-1-config --includes`
LOCAL_CFLAGS=-I$(DING_DIR)/src
LOCAL_LIBADD=$(DINGLA)
IKS_DIR=$(BASE)/libs/iksemel
IKS_LA=$(IKS_DIR)/src/libiksemel.la
DING_DIR=$(BASE)/libs/libdingaling
LOCAL_CFLAGS += -I$(DING_DIR)/src -I$(BASE)/libs/iksemel/include
LOCAL_OBJS=$(DING_DIR)/src/libdingaling.o $(IKS_LA)
include $(BASE)/build/modmake.rules
$(DINGLA): $(DING_DIR) $(DING_DIR)/.update
cd $(DING_DIR) && $(MAKE)
$(TOUCH_TARGET)
$(IKS_LA): $(IKS_DIR) $(IKS_DIR)/.update
@cd $(IKS_DIR) && $(MAKE)
@$(TOUCH_TARGET)

View File

@ -2167,28 +2167,31 @@ static ldl_status handle_signalling(ldl_handle_t * handle, ldl_session_t * dlses
break;
case LDL_SIGNAL_SUBSCRIBE:
if ((sql = switch_mprintf("delete from subscriptions where sub_from='%q' and sub_to='%q';\n"
"insert into subscriptions values('%q','%q','%q','%q');\n", from, to, from, to, msg, subject))) {
execute_sql(profile->dbname, sql, profile->mutex);
switch_core_db_free(sql);
}
if (is_special(to)) {
ldl_handle_send_presence(profile->handle, to, from, NULL, NULL, "Click To Call");
}
#if 0
if (is_special(to)) {
if (switch_event_create(&event, SWITCH_EVENT_PRESENCE_IN) == SWITCH_STATUS_SUCCESS) {
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "proto", MDL_CHAT_PROTO);
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "login", "%s", profile->login);
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "from", "%s", to);
//switch_event_add_header(event, SWITCH_STACK_BOTTOM, "rpid", "unknown");
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "status", "Click To Call");
switch_event_fire(&event);
if (profile->user_flags & LDL_FLAG_COMPONENT && ldl_jid_domcmp(from, to)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Attempt to add presence from/to our own domain [%s][%s]\n", from, to);
} else {
if ((sql = switch_mprintf("delete from subscriptions where sub_from='%q' and sub_to='%q';\n"
"insert into subscriptions values('%q','%q','%q','%q');\n", from, to, from, to, msg, subject))) {
execute_sql(profile->dbname, sql, profile->mutex);
switch_core_db_free(sql);
}
if (is_special(to)) {
ldl_handle_send_presence(profile->handle, to, from, NULL, NULL, "Click To Call");
}
#if 0
if (is_special(to)) {
if (switch_event_create(&event, SWITCH_EVENT_PRESENCE_IN) == SWITCH_STATUS_SUCCESS) {
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "proto", MDL_CHAT_PROTO);
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "login", "%s", profile->login);
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "from", "%s", to);
//switch_event_add_header(event, SWITCH_STACK_BOTTOM, "rpid", "unknown");
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "status", "Click To Call");
switch_event_fire(&event);
}
}
}
#endif
}
break;
case LDL_SIGNAL_ROSTER:
if (switch_event_create(&event, SWITCH_EVENT_ROSTER) == SWITCH_STATUS_SUCCESS) {

View File

@ -133,6 +133,15 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_read_frame(switch_core_sessi
case SWITCH_STATUS_NOOP:
status = SWITCH_STATUS_SUCCESS;
break;
case SWITCH_STATUS_BREAK:
memset(session->raw_read_frame.data, 255, read_frame->codec->implementation->bytes_per_frame);
session->raw_read_frame.datalen = read_frame->codec->implementation->bytes_per_frame;
session->raw_read_frame.samples = session->raw_read_frame.datalen / sizeof(int16_t);
session->raw_read_frame.timestamp = read_frame->timestamp;
session->raw_read_frame.rate = read_frame->rate;
read_frame = &session->raw_read_frame;
status = SWITCH_STATUS_SUCCESS;
break;
default:
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Codec %s decoder error!\n", session->read_codec->codec_interface->interface_name);
goto done;