memset(handle, 0, sizeof(*handle));
- if ((!(flags & MCAST_SEND) && !(flags & MCAST_RECV)) || !(handle->sock = socket(AF_INET, SOCK_DGRAM, 0))) {
+ if ((!(flags & MCAST_SEND) && !(flags & MCAST_RECV)) || (handle->sock = socket(AF_INET, SOCK_DGRAM, 0)) <= 0 ) {
return -1;
}
handle->send_addr.sin_addr.s_addr = inet_addr(host);
handle->send_addr.sin_port = htons(port);
- setsockopt(handle->sock, SOL_SOCKET, SO_REUSEADDR, &one, sizeof(one));
+ if ( setsockopt(handle->sock, SOL_SOCKET, SO_REUSEADDR, &one, sizeof(one)) != 0 ) {
+ close(handle->sock);
+ return -1;
+ }
if ((flags & MCAST_RECV)) {
handle->ttl = 255;
}
- setsockopt(handle->sock, IPPROTO_IP, IP_MULTICAST_TTL, &handle->ttl, sizeof(handle->ttl));
+ if ( setsockopt(handle->sock, IPPROTO_IP, IP_MULTICAST_TTL, &handle->ttl, sizeof(handle->ttl)) != 0 ) {
+ return -1;
+ }
handle->ready = 1;
return r;
}
- if (jsock->uuid_str) {
+ if (!zstr(jsock->uuid_str)) {
cJSON *result = cJSON_GetObjectItem(*json, "result");
if (result) {
tech_pvt = switch_core_session_get_private_class(session, SWITCH_PVT_SECONDARY);
b_tech_pvt = switch_core_session_get_private_class(b_session, SWITCH_PVT_SECONDARY);
+ switch_assert(b_tech_pvt);
+ switch_assert(tech_pvt);
+
switch_channel_set_variable(tech_pvt->channel, "refer_uuid", switch_core_session_get_uuid(b_tech_pvt->session));
switch_channel_set_variable(b_tech_pvt->channel, "transfer_disposition", "replaced");
result = SWITCH_TRUE;
- if (b_tech_pvt) {
- switch_channel_hangup(b_tech_pvt->channel, SWITCH_CAUSE_NORMAL_CLEARING);
- }
+ switch_channel_hangup(b_tech_pvt->channel, SWITCH_CAUSE_NORMAL_CLEARING);
} else {
result = SWITCH_FALSE;
}
err = 1; goto cleanup;
}
- if (!(call_id = cJSON_GetObjectCstr(dialog, "callID"))) {
- cJSON_AddItemToObject(obj, "message", cJSON_CreateString("CallID missing"));
- err = 1; goto cleanup;
- }
-
if (!(sdp = cJSON_GetObjectCstr(params, "sdp"))) {
cJSON_AddItemToObject(obj, "message", cJSON_CreateString("SDP missing"));
err = 1; goto cleanup;
if (jsock->profile->mcast_pub.sock > -1) {
if ((json_text = cJSON_PrintUnformatted(params))) {
- mcast_socket_send(&jsock->profile->mcast_pub, json_text, strlen(json_text) + 1);
-
+ if ( mcast_socket_send(&jsock->profile->mcast_pub, json_text, strlen(json_text) + 1) < 0 ) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "multicast socket send error!\n");
+ }
free(json_text);
json_text = NULL;
die("Socket Error!\n");
}
- setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, &reuse_addr, sizeof(reuse_addr));
+ if ( setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, &reuse_addr, sizeof(reuse_addr)) < 0 ) {
+ die("Socket setsockopt Error!\n");
+ }
memset(&addr, 0, sizeof(addr));
addr.sin_family = AF_INET;
}
}
- if (!r->in_thread || !r->running) {
+ if (r && (!r->in_thread || !r->running)) {
r = NULL;
}
- if (switch_thread_rwlock_tryrdlock(r->rwlock) != SWITCH_STATUS_SUCCESS) {
+ if (r && switch_thread_rwlock_tryrdlock(r->rwlock) != SWITCH_STATUS_SUCCESS) {
r = NULL;
}
switch_mutex_unlock(globals.mutex);
}
if (zstr(profile->inbound_codec_string)) {
- profile->outbound_codec_string = profile->outbound_codec_string;
+ profile->inbound_codec_string = profile->outbound_codec_string;
}
if (zstr(profile->timer_name)) {
static switch_bool_t json_commit(cJSON *json, const char *name, switch_mutex_t *mutex)
{
- char *ascii = cJSON_PrintUnformatted(json);
+ char *ascii;
char *sql;
char del_sql[128] = "";
switch_cache_db_handle_t *dbh;