diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.c b/src/mod/endpoints/mod_sofia/mod_sofia.c index ff16c8018d..f3d4af40e9 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.c +++ b/src/mod/endpoints/mod_sofia/mod_sofia.c @@ -1214,7 +1214,7 @@ static int hangup_cause_to_sip(switch_call_cause_t cause) { case SWITCH_CAUSE_ORIGINATOR_CANCEL: return 487; default: - return 500; + return 480; } } @@ -3938,6 +3938,7 @@ static void sip_i_invite(nua_t *nua, char *req_user, *req_host, *req_port; char *contact_user, *contact_host, *contact_port; char *via_rport, *via_host, *via_port; + char *from_port; char uri[1024]; if (!(tech_pvt = (private_object_t *) switch_core_session_alloc(session, sizeof(private_object_t)))) { @@ -4017,10 +4018,16 @@ static void sip_i_invite(nua_t *nua, switch_channel_set_variable(channel, "sip_from_user_stripped", (char *)from->a_url->url_user); } switch_channel_set_variable(channel, "sip_from_host", (char *) from->a_url->url_host); - switch_channel_set_variable(channel, "sip_from_port", (char *) from->a_url->url_port); + + + if (!(from_port = (char *) from->a_url->url_port)) { + from_port = "5060"; + } + + switch_channel_set_variable(channel, "sip_from_port", from_port); - snprintf(uri, sizeof(uri), "%s@%s:%s", (char *) from->a_url->url_user, (char *) from->a_url->url_host, (char *) from->a_url->url_port); + snprintf(uri, sizeof(uri), "%s@%s:%s", (char *) from->a_url->url_user, (char *) from->a_url->url_host, from_port); switch_channel_set_variable(channel, "sip_from_uri", uri); diff --git a/src/switch_channel.c b/src/switch_channel.c index 2a3fa1d047..b8b98d4e1f 100644 --- a/src/switch_channel.c +++ b/src/switch_channel.c @@ -1114,7 +1114,7 @@ SWITCH_DECLARE(char *) switch_channel_expand_variables(switch_channel_t *channel size_t sp = 0, len = 0, olen = 0, vtype = 0, br = 0, cpos, block = 128; char *sub_val = NULL, *func_val = NULL; - if (!strchr(in, '$') && !strchr(in, '^')) { + if (!strchr(in, '$')) { return in; } @@ -1130,7 +1130,7 @@ SWITCH_DECLARE(char *) switch_channel_expand_variables(switch_channel_t *channel if (*p == '$') { vtype = 1; } - if (*p == '^') { + if (*(p+1) != '{') { vtype = 2; } @@ -1219,7 +1219,7 @@ SWITCH_DECLARE(char *) switch_channel_expand_variables(switch_channel_t *channel len++; } - if (*p == '$' || *p == '^') { + if (*p == '$') { p--; } else { *c++ = *p; diff --git a/src/switch_core.c b/src/switch_core.c index fb50166e65..0f7f1a2357 100644 --- a/src/switch_core.c +++ b/src/switch_core.c @@ -2651,7 +2651,7 @@ static void switch_core_standard_on_ring(switch_core_session_t *session) return; } else { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "No Dialplan, Aborting\n"); - switch_channel_hangup(session->channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER); + switch_channel_hangup(session->channel, SWITCH_CAUSE_NO_ROUTE_DESTINATION); } } }