git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@7049 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Brian West 2008-01-01 01:03:33 +00:00
parent 1c0c5a7704
commit 3d3a92bb03

View File

@ -697,30 +697,30 @@ static int sofia_presence_sub_callback(void *pArg, int argc, char **argv, char *
if (strcasecmp(answer_state, "resubscribe")) { if (strcasecmp(answer_state, "resubscribe")) {
if (!strcasecmp(state, "cs_hangup")) { if (!strcasecmp(state, "cs_hangup")) {
astate = "terminated"; astate = "terminated";
} else if (switch_strlen_zero(astate)) { } else if (switch_strlen_zero(astate)) {
astate = switch_str_nil(switch_event_get_header(helper->event, "answer-state")); astate = switch_str_nil(switch_event_get_header(helper->event, "answer-state"));
if (switch_strlen_zero(astate)) { if (switch_strlen_zero(astate)) {
astate = dft_state; astate = dft_state;
}
} }
}
if (!strcasecmp(event_status, "hold")) { if (!strcasecmp(event_status, "hold")) {
astate = "early";
}
if (!strcasecmp(astate, "answered")) {
astate = "confirmed";
}
if (!strcasecmp(astate, "ringing")) {
if (!strcasecmp(direction, "recipient")) {
astate = "early"; astate = "early";
} else { }
if (!strcasecmp(astate, "answered")) {
astate = "confirmed"; astate = "confirmed";
} }
}
if (!strcasecmp(astate, "ringing")) {
if (!strcasecmp(direction, "recipient")) {
astate = "early";
} else {
astate = "confirmed";
}
}
stream.write_function(&stream, "<dialog id=\"%s\" direction=\"%s\">\n", uuid, direction); stream.write_function(&stream, "<dialog id=\"%s\" direction=\"%s\">\n", uuid, direction);
stream.write_function(&stream, "<state>%s</state>\n", astate); stream.write_function(&stream, "<state>%s</state>\n", astate);
@ -760,9 +760,7 @@ static int sofia_presence_sub_callback(void *pArg, int argc, char **argv, char *
stream.write_function(&stream, "</remote>\n"); stream.write_function(&stream, "</remote>\n");
} }
} }
stream.write_function(&stream, "</dialog>\n"); stream.write_function(&stream, "</dialog>\n");
} }
stream.write_function(&stream, "</dialog-info>\n"); stream.write_function(&stream, "</dialog-info>\n");
@ -773,7 +771,6 @@ static int sofia_presence_sub_callback(void *pArg, int argc, char **argv, char *
if (astate && uuid && helper->stream.data) { if (astate && uuid && helper->stream.data) {
stream.write_function(&helper->stream, "update sip_dialogs set state='%s' where uuid='%s';\n", astate, uuid); stream.write_function(&helper->stream, "update sip_dialogs set state='%s' where uuid='%s';\n", astate, uuid);
} }
} else { } else {
pl = switch_mprintf("<?xml version='1.0' encoding='UTF-8'?>\r\n" pl = switch_mprintf("<?xml version='1.0' encoding='UTF-8'?>\r\n"
"<presence xmlns='urn:ietf:params:xml:ns:pidf'\r\n" "<presence xmlns='urn:ietf:params:xml:ns:pidf'\r\n"