mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-04-17 17:22:21 +00:00
make dingaling work with google voice inbound too
This commit is contained in:
parent
5ce37cbed8
commit
4ee68141d7
@ -2471,6 +2471,11 @@ int ldl_handle_running(ldl_handle_t *handle)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void ldl_session_set_gateway(ldl_session_t *session)
|
||||||
|
{
|
||||||
|
ldl_set_flag(session, LDL_FLAG_GATEWAY);
|
||||||
|
}
|
||||||
|
|
||||||
int ldl_session_gateway(ldl_session_t *session)
|
int ldl_session_gateway(ldl_session_t *session)
|
||||||
{
|
{
|
||||||
return ldl_test_flag(session, LDL_FLAG_GATEWAY) ? 1 : 0;
|
return ldl_test_flag(session, LDL_FLAG_GATEWAY) ? 1 : 0;
|
||||||
|
@ -593,6 +593,7 @@ ldl_status ldl_handle_init(ldl_handle_t **handle,
|
|||||||
void ldl_handle_run(ldl_handle_t *handle);
|
void ldl_handle_run(ldl_handle_t *handle);
|
||||||
|
|
||||||
int ldl_session_gateway(ldl_session_t *handle);
|
int ldl_session_gateway(ldl_session_t *handle);
|
||||||
|
void ldl_session_set_gateway(ldl_session_t *session);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief Stop a libDingaLing handle
|
\brief Stop a libDingaLing handle
|
||||||
|
@ -1002,7 +1002,7 @@ static int do_candidates(struct private_object *tech_pvt, int force)
|
|||||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG, "Send Candidate %s:%d [%s]\n", cand[0].address, cand[0].port,
|
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG, "Send Candidate %s:%d [%s]\n", cand[0].address, cand[0].port,
|
||||||
cand[0].username);
|
cand[0].username);
|
||||||
|
|
||||||
if (ldl_session_gateway(tech_pvt->dlsession)) {
|
if (ldl_session_gateway(tech_pvt->dlsession) && switch_test_flag(tech_pvt, TFLAG_OUTBOUND)) {
|
||||||
tech_pvt->cand_id = ldl_session_transport(tech_pvt->dlsession, cand, 1);
|
tech_pvt->cand_id = ldl_session_transport(tech_pvt->dlsession, cand, 1);
|
||||||
} else {
|
} else {
|
||||||
tech_pvt->cand_id = ldl_session_candidates(tech_pvt->dlsession, cand, 1);
|
tech_pvt->cand_id = ldl_session_candidates(tech_pvt->dlsession, cand, 1);
|
||||||
@ -2980,6 +2980,8 @@ static ldl_status handle_signalling(ldl_handle_t *handle, ldl_session_t *dlsessi
|
|||||||
tech_pvt->flags |= profile->flags;
|
tech_pvt->flags |= profile->flags;
|
||||||
channel = switch_core_session_get_channel(session);
|
channel = switch_core_session_get_channel(session);
|
||||||
switch_core_session_set_private(session, tech_pvt);
|
switch_core_session_set_private(session, tech_pvt);
|
||||||
|
tech_pvt->dlsession = dlsession;
|
||||||
|
|
||||||
tech_pvt->session = session;
|
tech_pvt->session = session;
|
||||||
tech_pvt->codec_index = -1;
|
tech_pvt->codec_index = -1;
|
||||||
tech_pvt->profile = profile;
|
tech_pvt->profile = profile;
|
||||||
@ -3025,6 +3027,24 @@ static ldl_status handle_signalling(ldl_handle_t *handle, ldl_session_t *dlsessi
|
|||||||
cid_num = tech_pvt->recip;
|
cid_num = tech_pvt->recip;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (switch_stristr("voice.google.com", from)) {
|
||||||
|
char *id = switch_core_session_strdup(session, from);
|
||||||
|
char *p;
|
||||||
|
|
||||||
|
if ((p = strchr(id, '@'))) {
|
||||||
|
*p++ = '\0';
|
||||||
|
cid_name = "Google Voice";
|
||||||
|
cid_num = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
ldl_session_set_gateway(dlsession);
|
||||||
|
|
||||||
|
do_candidates(tech_pvt, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* context of "_auto_" means set it to the domain */
|
/* context of "_auto_" means set it to the domain */
|
||||||
if (profile->context && !strcmp(profile->context, "_auto_")) {
|
if (profile->context && !strcmp(profile->context, "_auto_")) {
|
||||||
context = profile->name;
|
context = profile->name;
|
||||||
@ -3079,7 +3099,7 @@ static ldl_status handle_signalling(ldl_handle_t *handle, ldl_session_t *dlsessi
|
|||||||
}
|
}
|
||||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Creating a session for %s\n", ldl_session_get_id(dlsession));
|
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Creating a session for %s\n", ldl_session_get_id(dlsession));
|
||||||
ldl_session_set_private(dlsession, session);
|
ldl_session_set_private(dlsession, session);
|
||||||
tech_pvt->dlsession = dlsession;
|
|
||||||
switch_channel_set_name(channel, "DingaLing/new");
|
switch_channel_set_name(channel, "DingaLing/new");
|
||||||
switch_channel_set_state(channel, CS_INIT);
|
switch_channel_set_state(channel, CS_INIT);
|
||||||
if (switch_core_session_thread_launch(session) != SWITCH_STATUS_SUCCESS) {
|
if (switch_core_session_thread_launch(session) != SWITCH_STATUS_SUCCESS) {
|
||||||
@ -3230,6 +3250,7 @@ static ldl_status handle_signalling(ldl_handle_t *handle, ldl_session_t *dlsessi
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
@ -3259,7 +3280,15 @@ static ldl_status handle_signalling(ldl_handle_t *handle, ldl_session_t *dlsessi
|
|||||||
if (profile->acl_count) {
|
if (profile->acl_count) {
|
||||||
for (x = 0; x < len; x++) {
|
for (x = 0; x < len; x++) {
|
||||||
uint32_t y = 0;
|
uint32_t y = 0;
|
||||||
|
|
||||||
|
if (strcasecmp(candidates[x].protocol, "udp")) {
|
||||||
|
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "candidate %s:%d has an unsupported protocol!\n",
|
||||||
|
candidates[x].address, candidates[x].port);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
for (y = 0; y < profile->acl_count; y++) {
|
for (y = 0; y < profile->acl_count; y++) {
|
||||||
|
|
||||||
if (switch_check_network_list_ip(candidates[x].address, profile->acl[y])) {
|
if (switch_check_network_list_ip(candidates[x].address, profile->acl[y])) {
|
||||||
choice = x;
|
choice = x;
|
||||||
ok = 1;
|
ok = 1;
|
||||||
@ -3268,7 +3297,7 @@ static ldl_status handle_signalling(ldl_handle_t *handle, ldl_session_t *dlsessi
|
|||||||
if (ok) {
|
if (ok) {
|
||||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "candidate %s:%d PASS ACL %s\n",
|
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "candidate %s:%d PASS ACL %s\n",
|
||||||
candidates[x].address, candidates[x].port, profile->acl[y]);
|
candidates[x].address, candidates[x].port, profile->acl[y]);
|
||||||
break;
|
goto end_candidates;
|
||||||
} else {
|
} else {
|
||||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "candidate %s:%d FAIL ACL %s\n",
|
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "candidate %s:%d FAIL ACL %s\n",
|
||||||
candidates[x].address, candidates[x].port, profile->acl[y]);
|
candidates[x].address, candidates[x].port, profile->acl[y]);
|
||||||
@ -3311,6 +3340,8 @@ static ldl_status handle_signalling(ldl_handle_t *handle, ldl_session_t *dlsessi
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
end_candidates:
|
||||||
|
|
||||||
if (ok) {
|
if (ok) {
|
||||||
ldl_payload_t payloads[5];
|
ldl_payload_t payloads[5];
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user