tweak
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@8522 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
parent
01c30675b9
commit
4909dc50ef
|
@ -1497,6 +1497,7 @@ SWITCH_STANDARD_API(sofia_contact_function)
|
||||||
char *p;
|
char *p;
|
||||||
sofia_profile_t *profile = NULL;
|
sofia_profile_t *profile = NULL;
|
||||||
const char *exclude_contact = NULL;
|
const char *exclude_contact = NULL;
|
||||||
|
char *reply = "";
|
||||||
|
|
||||||
if (!cmd) {
|
if (!cmd) {
|
||||||
stream->write_function(stream, "%s", "");
|
stream->write_function(stream, "%s", "");
|
||||||
|
@ -1543,11 +1544,13 @@ SWITCH_STANDARD_API(sofia_contact_function)
|
||||||
if (profile) {
|
if (profile) {
|
||||||
struct cb_helper cb;
|
struct cb_helper cb;
|
||||||
switch_stream_handle_t mystream = { 0 };
|
switch_stream_handle_t mystream = { 0 };
|
||||||
|
|
||||||
if (!domain || !strchr(domain, '.')) {
|
if (!domain || !strchr(domain, '.')) {
|
||||||
domain = profile->name;
|
domain = profile->name;
|
||||||
}
|
}
|
||||||
|
|
||||||
SWITCH_STANDARD_STREAM(mystream);
|
SWITCH_STANDARD_STREAM(mystream);
|
||||||
|
switch_assert(mystream.data);
|
||||||
cb.profile = profile;
|
cb.profile = profile;
|
||||||
cb.stream = &mystream;
|
cb.stream = &mystream;
|
||||||
|
|
||||||
|
@ -1561,19 +1564,20 @@ SWITCH_STANDARD_API(sofia_contact_function)
|
||||||
switch_assert(sql);
|
switch_assert(sql);
|
||||||
sofia_glue_execute_sql_callback(profile, SWITCH_FALSE, profile->ireg_mutex, sql, contact_callback, &cb);
|
sofia_glue_execute_sql_callback(profile, SWITCH_FALSE, profile->ireg_mutex, sql, contact_callback, &cb);
|
||||||
switch_safe_free(sql);
|
switch_safe_free(sql);
|
||||||
if (mystream.data) {
|
reply = (char *) mystream.data;
|
||||||
char *str = mystream.data;
|
if (!switch_strlen_zero(reply) && end_of(reply) == ',') {
|
||||||
*(str + (strlen(str) - 1)) = '\0';
|
end_of(reply) = '\0';
|
||||||
}
|
}
|
||||||
stream->write_function(stream, "%s", mystream.data);
|
stream->write_function(stream, "%s", reply);
|
||||||
|
reply = NULL;
|
||||||
switch_safe_free(mystream.data);
|
switch_safe_free(mystream.data);
|
||||||
goto end;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
stream->write_function(stream, "%s", "");
|
if (reply) {
|
||||||
|
stream->write_function(stream, "%s", reply);
|
||||||
|
}
|
||||||
|
|
||||||
end:
|
|
||||||
switch_safe_free(data);
|
switch_safe_free(data);
|
||||||
|
|
||||||
if (profile) {
|
if (profile) {
|
||||||
|
|
|
@ -704,9 +704,14 @@ uint8_t sofia_reg_handle_register(nua_t * nua, sofia_profile_t *profile, nua_han
|
||||||
|
|
||||||
if (regtype == REG_REGISTER) {
|
if (regtype == REG_REGISTER) {
|
||||||
char *new_contact = NULL;
|
char *new_contact = NULL;
|
||||||
|
char *p;
|
||||||
|
|
||||||
|
if ((p = strstr(contact_str, ";nat"))) {
|
||||||
|
*p = '\0';
|
||||||
|
}
|
||||||
|
|
||||||
if (exptime) {
|
if (exptime) {
|
||||||
if (nat_hack) {
|
if (is_nat || nat_hack) {
|
||||||
new_contact = switch_mprintf("%s;expires=%ld;received=\"%s:%d\"", contact_str, (long)exptime, network_ip, network_port);
|
new_contact = switch_mprintf("%s;expires=%ld;received=\"%s:%d\"", contact_str, (long)exptime, network_ip, network_port);
|
||||||
} else {
|
} else {
|
||||||
new_contact = switch_mprintf("%s;expires=%ld", contact_str, (long)exptime);
|
new_contact = switch_mprintf("%s;expires=%ld", contact_str, (long)exptime);
|
||||||
|
|
Loading…
Reference in New Issue