mirror of
https://github.com/signalwire/freeswitch.git
synced 2026-10-15 15:54:13 +00:00
keep presence up to date
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@13166 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
1 parent
580b7818a3
commit
b9dea85eb7
3 files changed
+31
-9
No files matched your search
@@ -634,11 +634,15 @@ static void actual_sofia_presence_event_handler(switch_event_t *event)
|
||||
event->event_id == SWITCH_EVENT_PRESENCE_IN ? "IN" : "OUT", profile->name);
|
||||
}
|
||||
|
||||
if (mod_sofia_globals.debug_presence > 1) {
|
||||
if (mod_sofia_globals.debug_presence) {
|
||||
char *buf;
|
||||
switch_event_serialize(event, &buf, SWITCH_FALSE);
|
||||
switch_assert(buf);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "DUMP PRESENCE SQL:\n%s\nEVENT DUMP:\n%s\n", sql, buf);
|
||||
if (mod_sofia_globals.debug_presence > 1) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "DUMP PRESENCE SQL:\n%s\nEVENT DUMP:\n%s\n", sql, buf);
|
||||
} else {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "EVENT DUMP:\n%s\n", buf);
|
||||
}
|
||||
free(buf);
|
||||
}
|
||||
|
||||
@@ -946,16 +950,18 @@ static char *translate_rpid(char *in)
|
||||
|
||||
static char *gen_pidf(char *user_agent, char *id, char *url, char *open, char *rpid, char *prpid, char *status, const char **ct)
|
||||
{
|
||||
char *ret = NULL;
|
||||
|
||||
if (switch_stristr("polycom", user_agent)) {
|
||||
*ct = "application/xpidf+xml";
|
||||
|
||||
|
||||
/* of course!, lets make a big deal over dashes. Now the stupidity is complete. */
|
||||
|
||||
if (!strcmp(prpid, "on-the-phone")) {
|
||||
prpid = "onthephone";
|
||||
}
|
||||
|
||||
return switch_mprintf(
|
||||
ret = switch_mprintf(
|
||||
"<?xml version=\"1.0\"?>\n"
|
||||
"<!DOCTYPE presence PUBLIC \"-//IETF//DTD RFCxxxx XPIDF 1.0//EN\" \"xpidf.dtd\">\n"
|
||||
"<presence>\n"
|
||||
@@ -973,7 +979,7 @@ static char *gen_pidf(char *user_agent, char *id, char *url, char *open, char *r
|
||||
);
|
||||
} else {
|
||||
*ct = "application/pidf+xml";
|
||||
return switch_mprintf(
|
||||
ret = switch_mprintf(
|
||||
"<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?> \n"
|
||||
"<presence xmlns='urn:ietf:params:xml:ns:pidf' \n"
|
||||
"xmlns:dm='urn:ietf:params:xml:ns:pidf:data-model' \n"
|
||||
@@ -993,6 +999,9 @@ static char *gen_pidf(char *user_agent, char *id, char *url, char *open, char *r
|
||||
" </dm:person>\n"
|
||||
"</presence>", id, open, prpid, status);
|
||||
}
|
||||
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int sofia_presence_sub_callback(void *pArg, int argc, char **argv, char **columnNames)
|
||||
@@ -1305,6 +1314,12 @@ static int sofia_presence_sub_callback(void *pArg, int argc, char **argv, char *
|
||||
}
|
||||
}
|
||||
|
||||
if (mod_sofia_globals.debug_presence > 0 && pl) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "send payload:\n%s\n", pl);
|
||||
}
|
||||
|
||||
|
||||
|
||||
nua_notify(nh,
|
||||
TAG_IF(*expires_str, SIPTAG_EXPIRES_STR(expires_str)),
|
||||
SIPTAG_SUBSCRIPTION_STATE_STR(sstr),
|
||||
|
||||
Reference in new issue
Block a user