提交 0ea84c86 authored 作者: Anthony Minessale's avatar Anthony Minessale

presence update

上级 62206e3d
...@@ -522,7 +522,7 @@ static void actual_sofia_presence_event_handler(switch_event_t *event) ...@@ -522,7 +522,7 @@ static void actual_sofia_presence_event_handler(switch_event_t *event)
alt_event_type = "presence"; alt_event_type = "presence";
} }
if ((user = strdup(from))) { if (from && (user = strdup(from))) {
if ((host = strchr(user, '@'))) { if ((host = strchr(user, '@'))) {
char *p; char *p;
*host++ = '\0'; *host++ = '\0';
...@@ -1065,7 +1065,7 @@ static char *gen_pidf(char *user_agent, char *id, char *url, char *open, char *r ...@@ -1065,7 +1065,7 @@ static char *gen_pidf(char *user_agent, char *id, char *url, char *open, char *r
*ct = "application/xpidf+xml"; *ct = "application/xpidf+xml";
/* If unknown/none prpid is provided, just show the user as online. */ /* If unknown/none prpid is provided, just show the user as online. */
if (!prpid) { if (!prpid || !strcasecmp(prpid, "unknown")) {
prpid = "online"; prpid = "online";
} }
...@@ -1099,10 +1099,13 @@ static char *gen_pidf(char *user_agent, char *id, char *url, char *open, char *r ...@@ -1099,10 +1099,13 @@ static char *gen_pidf(char *user_agent, char *id, char *url, char *open, char *r
} }
if (!strncasecmp(status, "Registered", 10)) { if (!strncasecmp(status, "Registered", 10)) {
prpid = NULL;
status = "Available"; status = "Available";
} }
if (!strcasecmp(status, "Available")) {
prpid = NULL;
}
if (!strcasecmp(status, "Unregistered")) { if (!strcasecmp(status, "Unregistered")) {
prpid = NULL; prpid = NULL;
...@@ -1116,6 +1119,7 @@ static char *gen_pidf(char *user_agent, char *id, char *url, char *open, char *r ...@@ -1116,6 +1119,7 @@ static char *gen_pidf(char *user_agent, char *id, char *url, char *open, char *r
if (zstr(status) && !zstr(prpid)) { if (zstr(status) && !zstr(prpid)) {
status = "Available"; status = "Available";
prpid = NULL;
} }
if (prpid) { if (prpid) {
......
...@@ -1336,7 +1336,7 @@ uint8_t sofia_reg_handle_register(nua_t *nua, sofia_profile_t *profile, nua_hand ...@@ -1336,7 +1336,7 @@ uint8_t sofia_reg_handle_register(nua_t *nua, sofia_profile_t *profile, nua_hand
switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "proto", SOFIA_CHAT_PROTO); switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "proto", SOFIA_CHAT_PROTO);
switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "login", profile->name); switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "login", profile->name);
switch_event_add_header(s_event, SWITCH_STACK_BOTTOM, "from", "%s@%s", to_user, reg_host); switch_event_add_header(s_event, SWITCH_STACK_BOTTOM, "from", "%s@%s", to_user, reg_host);
switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "rpid", "online"); switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "rpid", "unknown");
switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "status", "Registered"); switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "status", "Registered");
switch_event_fire(&s_event); switch_event_fire(&s_event);
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论