improve sofia_glue_get_url_from_contact and its usage. Should fix MODENDP-33.
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@6075 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
parent
795aa33028
commit
6b74f05af6
|
@ -1572,6 +1572,12 @@ char *sofia_glue_get_url_from_contact(char *buf, uint8_t to_dup)
|
||||||
}
|
}
|
||||||
|
|
||||||
*e = '\0';
|
*e = '\0';
|
||||||
|
} else {
|
||||||
|
if (to_dup) {
|
||||||
|
url = strdup(buf);
|
||||||
|
} else {
|
||||||
|
url = buf;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return url;
|
return url;
|
||||||
|
|
|
@ -530,16 +530,10 @@ static int sofia_presence_sub_callback(void *pArg, int argc, char **argv, char *
|
||||||
char *sub_to_user = argv[3];
|
char *sub_to_user = argv[3];
|
||||||
char *sub_to_host = argv[4];
|
char *sub_to_host = argv[4];
|
||||||
char *event = argv[5];
|
char *event = argv[5];
|
||||||
char *contact = argv[6];
|
|
||||||
char *call_id = argv[7];
|
char *call_id = argv[7];
|
||||||
//char *full_from = argv[8];
|
|
||||||
//char *full_via = argv[9];
|
|
||||||
//char *expires = argv[10];
|
|
||||||
|
|
||||||
nua_handle_t *nh;
|
nua_handle_t *nh;
|
||||||
char *to;
|
char *to;
|
||||||
char *open;
|
char *open;
|
||||||
char *tmp;
|
|
||||||
char *prpid;
|
char *prpid;
|
||||||
int done = 0;
|
int done = 0;
|
||||||
|
|
||||||
|
@ -605,10 +599,6 @@ static int sofia_presence_sub_callback(void *pArg, int argc, char **argv, char *
|
||||||
id, profile->url, open, status, prpid,
|
id, profile->url, open, status, prpid,
|
||||||
open, rpid, note);
|
open, rpid, note);
|
||||||
|
|
||||||
|
|
||||||
tmp = contact;
|
|
||||||
contact = sofia_glue_get_url_from_contact(tmp, 0);
|
|
||||||
|
|
||||||
nua_notify(nh,
|
nua_notify(nh,
|
||||||
SIPTAG_SUBSCRIPTION_STATE_STR("active;expires=3600"),
|
SIPTAG_SUBSCRIPTION_STATE_STR("active;expires=3600"),
|
||||||
SIPTAG_EVENT_STR(event), SIPTAG_CONTENT_TYPE_STR("application/pidf+xml"), SIPTAG_PAYLOAD_STR(pl), TAG_END());
|
SIPTAG_EVENT_STR(event), SIPTAG_CONTENT_TYPE_STR("application/pidf+xml"), SIPTAG_PAYLOAD_STR(pl), TAG_END());
|
||||||
|
@ -635,7 +625,7 @@ static int sofia_presence_mwi_callback(void *pArg, int argc, char **argv, char *
|
||||||
char *sub_to_user = argv[3];
|
char *sub_to_user = argv[3];
|
||||||
char *sub_to_host = argv[4];
|
char *sub_to_host = argv[4];
|
||||||
char *event = argv[5];
|
char *event = argv[5];
|
||||||
char *contact = argv[6];
|
//char *contact = argv[6];
|
||||||
char *call_id = argv[7];
|
char *call_id = argv[7];
|
||||||
//char *full_from = argv[8];
|
//char *full_from = argv[8];
|
||||||
//char *full_via = argv[9];
|
//char *full_via = argv[9];
|
||||||
|
@ -643,7 +633,7 @@ static int sofia_presence_mwi_callback(void *pArg, int argc, char **argv, char *
|
||||||
char *body = argv[11];
|
char *body = argv[11];
|
||||||
char *exp;
|
char *exp;
|
||||||
sofia_profile_t *profile = NULL;
|
sofia_profile_t *profile = NULL;
|
||||||
char *tmp, *id = NULL;
|
char *id = NULL;
|
||||||
nua_handle_t *nh;
|
nua_handle_t *nh;
|
||||||
int expire_sec = atoi(expires);
|
int expire_sec = atoi(expires);
|
||||||
|
|
||||||
|
@ -664,9 +654,6 @@ static int sofia_presence_mwi_callback(void *pArg, int argc, char **argv, char *
|
||||||
}
|
}
|
||||||
exp = switch_mprintf("active;expires=%ld", expire_sec);
|
exp = switch_mprintf("active;expires=%ld", expire_sec);
|
||||||
|
|
||||||
tmp = contact;
|
|
||||||
contact = sofia_glue_get_url_from_contact(tmp, 0);
|
|
||||||
|
|
||||||
nua_notify(nh,
|
nua_notify(nh,
|
||||||
SIPTAG_SUBSCRIPTION_STATE_STR(exp),
|
SIPTAG_SUBSCRIPTION_STATE_STR(exp),
|
||||||
SIPTAG_EVENT_STR(event), SIPTAG_CONTENT_TYPE_STR("application/simple-message-summary"), SIPTAG_PAYLOAD_STR(body), TAG_END());
|
SIPTAG_EVENT_STR(event), SIPTAG_CONTENT_TYPE_STR("application/simple-message-summary"), SIPTAG_PAYLOAD_STR(body), TAG_END());
|
||||||
|
|
|
@ -156,18 +156,17 @@ int sofia_reg_nat_callback(void *pArg, int argc, char **argv, char **columnNames
|
||||||
{
|
{
|
||||||
sofia_profile_t *profile = (sofia_profile_t *) pArg;
|
sofia_profile_t *profile = (sofia_profile_t *) pArg;
|
||||||
nua_handle_t *nh;
|
nua_handle_t *nh;
|
||||||
char *contact;
|
char *contact = NULL;
|
||||||
char to[128] = "";
|
char to[128] = "";
|
||||||
|
|
||||||
snprintf(to, sizeof(to), "%s@%s", argv[1], argv[2]);
|
snprintf(to, sizeof(to), "%s@%s", argv[1], argv[2]);
|
||||||
contact = sofia_glue_get_url_from_contact(argv[3], 1);
|
contact = sofia_glue_get_url_from_contact(argv[3], 1);
|
||||||
|
|
||||||
nh = nua_handle(profile->nua, NULL, SIPTAG_FROM_STR(profile->url), SIPTAG_TO_STR(to), NUTAG_URL(contact), SIPTAG_CONTACT_STR(profile->url), TAG_END());
|
nh = nua_handle(profile->nua, NULL, SIPTAG_FROM_STR(profile->url), SIPTAG_TO_STR(to), NUTAG_URL(contact), SIPTAG_CONTACT_STR(profile->url), TAG_END());
|
||||||
|
|
||||||
//nua_message(nh, SIPTAG_CONTENT_TYPE_STR("text/plain"),
|
|
||||||
//SIPTAG_PAYLOAD_STR("You suffer from Connectile Dysfunction.\nYou should use stun....\n"), TAG_END());
|
|
||||||
|
|
||||||
nua_options(nh, TAG_END());
|
nua_options(nh, TAG_END());
|
||||||
|
|
||||||
|
switch_safe_free(contact);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue