6 * Copyright (C) 2010-2018 SIPE Project <http://sipe.sourceforge.net/>
7 * Copyright (C) 2009 pier11 <pier11@operamail.com>
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
26 * Documentation references:
28 * Microsoft DevNet: [MS-CONFIM]: Centralized Conference Control Protocol:
29 * Instant Messaging Extensions
30 * <http://msdn.microsoft.com/en-us/library/cc431500%28v=office.12%29.aspx>
44 #include "sipe-common.h"
46 #include "sip-transport.h"
47 #include "sipe-backend.h"
48 #include "sipe-buddy.h"
49 #include "sipe-chat.h"
50 #include "sipe-conf.h"
51 #include "sipe-core.h"
52 #include "sipe-core-private.h"
53 #include "sipe-appshare.h"
54 #include "sipe-dialog.h"
55 #include "sipe-http.h"
57 #include "sipe-media.h"
59 #include "sipe-session.h"
60 #include "sipe-subscriptions.h"
61 #include "sipe-user.h"
62 #include "sipe-utils.h"
66 * Invite counterparty to join conference.
67 * @param focus_uri (%s)
68 * @param subject (%s) of conference
70 #define SIPE_SEND_CONF_INVITE \
71 "<Conferencing version=\"2.0\">"\
72 "<focus-uri>%s</focus-uri>"\
73 "<subject>%s</subject>"\
74 "<im available=\"true\">"\
80 sipe_conf_check_for_lync_url(struct sipe_core_private
*sipe_private
,
83 static struct transaction
*
84 cccp_request(struct sipe_core_private
*sipe_private
, const gchar
*method
,
85 const gchar
*with
, struct sip_dialog
*dialog
,
86 TransCallback callback
, const gchar
*body
, ...)
92 gchar
*self
= sip_uri_self(sipe_private
);
96 struct transaction
*trans
;
98 headers
= g_strdup_printf(
99 "Supported: ms-sender\r\n"
101 "Content-Type: application/cccp+xml\r\n",
102 sipe_private
->contact
);
104 /* TODO: put request_id to queue to further compare with incoming one */
105 request
= g_strdup_printf(
106 "<?xml version=\"1.0\"?>"
107 "<request xmlns=\"urn:ietf:params:xml:ns:cccp\" "
108 "xmlns:mscp=\"http://schemas.microsoft.com/rtc/2005/08/cccpextensions\" "
117 sipe_private
->cccp_request_id
++,
121 va_start(args
, body
);
122 request_body
= g_strdup_vprintf(request
, args
);
127 trans
= sip_transport_request(sipe_private
,
137 g_free(request_body
);
143 process_conf_get_capabilities(SIPE_UNUSED_PARAMETER
struct sipe_core_private
*sipe_private
,
145 SIPE_UNUSED_PARAMETER
struct transaction
*trans
)
147 if (msg
->response
>= 400) {
148 SIPE_DEBUG_INFO_NOFORMAT("process_conf_get_capabilities: "
149 "getConferencingCapabilities failed.");
152 if (msg
->response
== 200) {
153 sipe_xml
*xn_response
= sipe_xml_parse(msg
->body
, msg
->bodylen
);
154 const sipe_xml
*node
;
155 gchar
*default_region
;
157 if (!sipe_strequal("success", sipe_xml_attribute(xn_response
, "code"))) {
161 node
= sipe_xml_child(xn_response
, "getConferencingCapabilities/mcu-types/mcuType");
162 for (;node
; node
= sipe_xml_twin(node
)) {
163 sipe_private
->conf_mcu_types
=
164 g_slist_append(sipe_private
->conf_mcu_types
,
165 sipe_xml_data(node
));
168 g_hash_table_remove_all(sipe_private
->access_numbers
);
169 node
= sipe_xml_child(xn_response
, "getConferencingCapabilities/pstn-bridging/access-numbers/region");
170 for (;node
; node
= sipe_xml_twin(node
)) {
171 gchar
*name
= g_strdup(sipe_xml_attribute(node
, "name"));
172 gchar
*number
= sipe_xml_data(sipe_xml_child(node
, "access-number/number"));
173 if (name
&& number
) {
174 g_hash_table_insert(sipe_private
->access_numbers
, name
, number
);
178 node
= sipe_xml_child(xn_response
, "getConferencingCapabilities/pstn-bridging/access-numbers/default-region");
179 default_region
= sipe_xml_data(node
);
180 if (default_region
) {
181 sipe_private
->default_access_number
=
182 g_hash_table_lookup(sipe_private
->access_numbers
, default_region
);
184 g_free(default_region
);
186 sipe_xml_free(xn_response
);
193 sipe_conf_get_capabilities(struct sipe_core_private
*sipe_private
)
195 cccp_request(sipe_private
, "SERVICE",
196 sipe_private
->focus_factory_uri
,
198 process_conf_get_capabilities
,
199 "<getConferencingCapabilities />");
203 sipe_conf_supports_mcu_type(struct sipe_core_private
*sipe_private
,
206 return g_slist_find_custom(sipe_private
->conf_mcu_types
, type
,
207 (GCompareFunc
)g_strcmp0
) != NULL
;
211 * Generates random GUID.
212 * This method is borrowed from pidgin's msnutils.c
217 return g_strdup_printf("%4X%4X-%4X-%4X-%4X-%4X%4X%4X",
218 rand() % 0xAAFF + 0x1111,
219 rand() % 0xAAFF + 0x1111,
220 rand() % 0xAAFF + 0x1111,
221 rand() % 0xAAFF + 0x1111,
222 rand() % 0xAAFF + 0x1111,
223 rand() % 0xAAFF + 0x1111,
224 rand() % 0xAAFF + 0x1111,
225 rand() % 0xAAFF + 0x1111);
228 /** Invite us to the focus callback */
230 process_invite_conf_focus_response(struct sipe_core_private
*sipe_private
,
232 SIPE_UNUSED_PARAMETER
struct transaction
*trans
)
234 struct sip_session
*session
= NULL
;
235 char *focus_uri
= parse_from(sipmsg_find_header(msg
, "To"));
237 session
= sipe_session_find_conference(sipe_private
, focus_uri
);
240 SIPE_DEBUG_INFO("process_invite_conf_focus_response: unable to find conf session with focus=%s", focus_uri
);
245 if (!session
->focus_dialog
) {
246 SIPE_DEBUG_INFO_NOFORMAT("process_invite_conf_focus_response: session's focus_dialog is NULL");
251 sipe_dialog_parse(session
->focus_dialog
, msg
, TRUE
);
253 if (msg
->response
>= 200) {
254 /* send ACK to focus */
255 session
->focus_dialog
->cseq
= 0;
256 sip_transport_ack(sipe_private
, session
->focus_dialog
);
257 session
->focus_dialog
->outgoing_invite
= NULL
;
258 session
->focus_dialog
->is_established
= TRUE
;
261 if (msg
->response
>= 400) {
262 gchar
*reason
= sipmsg_get_ms_diagnostics_reason(msg
);
264 SIPE_DEBUG_INFO_NOFORMAT("process_invite_conf_focus_response: INVITE response is not 200. Failed to join focus.");
265 sipe_backend_notify_error(SIPE_CORE_PUBLIC
,
266 _("Failed to join the conference"),
267 reason
? reason
: _("no reason given"));
270 sipe_session_remove(sipe_private
, session
);
273 } else if (msg
->response
== 200) {
274 sipe_xml
*xn_response
= sipe_xml_parse(msg
->body
, msg
->bodylen
);
275 const gchar
*code
= sipe_xml_attribute(xn_response
, "code");
276 if (sipe_strequal(code
, "success")) {
277 /* subscribe to focus */
278 sipe_subscribe_conference(sipe_private
,
279 session
->chat_session
->id
,
282 if (session
->is_call
)
283 sipe_core_media_connect_conference(SIPE_CORE_PUBLIC
,
284 session
->chat_session
);
287 sipe_xml_free(xn_response
);
295 parse_ocs_focus_uri(const gchar
*uri
)
297 const gchar
*confkey
;
303 // URI can have this prefix if it was typed in by the user
304 if (g_str_has_prefix(uri
, "meet:") || g_str_has_prefix(uri
, "conf:")) {
308 uri_len
= strlen(uri
);
310 if (!uri
|| !g_str_has_prefix(uri
, "sip:") ||
311 uri_len
== 4 || g_strstr_len(uri
, -1, "%")) {
315 confkey
= g_strstr_len(uri
, -1, "?");
317 /* TODO: Investigate how conf-key field should be used,
318 * ignoring for now */
319 uri_len
= confkey
- uri
;
322 return g_strndup(uri
, uri_len
);
326 extract_uri_from_html(const gchar
*body
,
328 guint prefix_skip_chars
)
331 const gchar
*start
= g_strstr_len(body
, -1, prefix
);
336 start
+= prefix_skip_chars
;
337 end
= strchr(start
, '"');
340 gchar
*html
= g_strndup(start
, end
- start
);
342 /* decode HTML entities */
343 gchar
*html_unescaped
= sipe_backend_markup_strip_html(html
);
346 if (!is_empty(html_unescaped
)) {
347 uri
= sipe_utils_uri_unescape(html_unescaped
);
350 g_free(html_unescaped
);
357 static void sipe_conf_lync_url_cb(struct sipe_core_private
*sipe_private
,
359 SIPE_UNUSED_PARAMETER GSList
*headers
,
361 gpointer callback_data
)
363 gchar
*uri
= callback_data
;
365 if (status
!= (guint
) SIPE_HTTP_STATUS_ABORTED
) {
366 gchar
*focus_uri
= NULL
;
370 * Extract focus URI from HTML, e.g.
372 * <a ... href="conf:sip:...ABCDEF%3Frequired..." ... >
374 gchar
*uri
= extract_uri_from_html(body
, "href=\"conf", 6);
375 focus_uri
= parse_ocs_focus_uri(uri
);
380 SIPE_DEBUG_INFO("sipe_conf_lync_url_cb: found focus URI"
383 sipe_conf_create(sipe_private
, NULL
, focus_uri
);
387 * If present, domainOwnerJoinLauncherUrl redirects to
388 * a page from where we still may extract the focus URI.
390 gchar
*launcher_url
= NULL
;
391 static const gchar
*launcher_url_prefix
[] = {
392 "var domainOwnerJoinLauncherUrl = \"",
393 "sb-data-domainOwnerJoinLauncherUrl=\"",
398 SIPE_DEBUG_INFO("sipe_conf_lync_url_cb: no focus URI "
399 "found from URL '%s'", uri
);
401 for (p
= launcher_url_prefix
; !launcher_url
&& *p
; ++p
) {
402 launcher_url
= extract_uri_from_html(body
,
408 sipe_conf_check_for_lync_url(sipe_private
, launcher_url
)) {
409 SIPE_DEBUG_INFO("sipe_conf_lync_url_cb: retrying with URL '%s'",
411 /* Ownership taken by sipe_conf_check_for_lync_url() */
416 error
= g_strdup_printf(_("Can't find a conference URI on this page:\n\n%s"),
419 sipe_backend_notify_error(SIPE_CORE_PUBLIC
,
420 _("Failed to join the conference"),
425 g_free(launcher_url
);
432 static gboolean
sipe_conf_check_for_lync_url(struct sipe_core_private
*sipe_private
,
435 struct sipe_http_request
*request
;
437 if (!(g_str_has_prefix(uri
, "https://") ||
438 g_str_has_prefix(uri
, "http://")))
441 /* URL points to a HTML page with the conference focus URI */
442 request
= sipe_http_request_get(sipe_private
,
445 sipe_conf_lync_url_cb
,
449 sipe_http_request_ready(request
);
456 static void sipe_conf_uri_error(struct sipe_core_private
*sipe_private
,
459 gchar
*error
= g_strdup_printf(_("\"%s\" is not a valid conference URI"),
461 sipe_backend_notify_error(SIPE_CORE_PUBLIC
,
462 _("Failed to join the conference"),
467 void sipe_core_conf_create(struct sipe_core_public
*sipe_public
,
469 const gchar
*organizer
,
470 const gchar
*meeting_id
)
472 struct sipe_core_private
*sipe_private
= SIPE_CORE_PRIVATE
;
474 /* SIP URI or HTTP URL */
476 gchar
*uri_ue
= sipe_utils_uri_unescape(uri
);
478 SIPE_DEBUG_INFO("sipe_core_conf_create: URI '%s' unescaped '%s'",
480 uri_ue
? uri_ue
: "<UNDEFINED>");
482 /* takes ownership of "uri_ue" if successful */
483 if (!sipe_conf_check_for_lync_url(sipe_private
, uri_ue
)) {
484 gchar
*focus_uri
= parse_ocs_focus_uri(uri_ue
);
487 sipe_conf_create(sipe_private
, NULL
, focus_uri
);
490 sipe_conf_uri_error(sipe_private
, uri
);
495 /* Organizer email and meeting ID */
496 } else if (organizer
&& meeting_id
) {
497 gchar
*tmp
= g_strdup_printf("sip:%s;gruu;opaque=app:conf:focus:id:%s",
498 organizer
, meeting_id
);
499 gchar
*focus_uri
= parse_ocs_focus_uri(tmp
);
501 SIPE_DEBUG_INFO("sipe_core_conf_create: organizer '%s' meeting ID '%s'",
506 sipe_conf_create(sipe_private
, NULL
, focus_uri
);
509 sipe_conf_uri_error(sipe_private
, tmp
);
513 sipe_backend_notify_error(SIPE_CORE_PUBLIC
,
514 _("Failed to join the conference"),
515 _("Incomplete conference information provided"));
519 /** Create new session with Focus URI */
521 sipe_conf_create(struct sipe_core_private
*sipe_private
,
522 struct sipe_chat_session
*chat_session
,
523 const gchar
*focus_uri
)
525 /* addUser request to the focus.
527 * focus_URI, from, endpoint_GUID
529 static const gchar CCCP_ADD_USER
[] =
531 "<conferenceKeys confEntity=\"%s\"/>"
532 "<ci:user xmlns:ci=\"urn:ietf:params:xml:ns:conference-info\" entity=\"%s\">"
534 "<ci:entry>attendee</ci:entry>"
536 "<ci:endpoint entity=\"{%s}\" "
537 "xmlns:msci=\"http://schemas.microsoft.com/rtc/2005/08/confinfoextensions\"/>"
542 struct sip_session
*session
= sipe_session_add_chat(sipe_private
,
547 session
->focus_dialog
= g_new0(struct sip_dialog
, 1);
548 session
->focus_dialog
->callid
= gencallid();
549 session
->focus_dialog
->with
= g_strdup(session
->chat_session
->id
);
550 session
->focus_dialog
->endpoint_GUID
= rand_guid();
551 session
->focus_dialog
->ourtag
= gentag();
553 self
= sip_uri_self(sipe_private
);
554 session
->focus_dialog
->outgoing_invite
=
555 cccp_request(sipe_private
, "INVITE",
556 session
->focus_dialog
->with
, session
->focus_dialog
,
557 process_invite_conf_focus_response
,
559 session
->focus_dialog
->with
, self
,
560 session
->focus_dialog
->endpoint_GUID
);
562 /* Rejoin existing session? */
564 SIPE_DEBUG_INFO("sipe_conf_create: rejoin '%s' (%s)",
567 sipe_backend_chat_rejoin(SIPE_CORE_PUBLIC
,
568 chat_session
->backend
,
570 chat_session
->title
);
577 /** Modify User Role */
579 sipe_conf_modify_user_role(struct sipe_core_private
*sipe_private
,
580 struct sip_session
*session
,
583 /* modifyUserRoles request to the focus. Makes user a leader.
588 static const gchar CCCP_MODIFY_USER_ROLES
[] =
590 "<userKeys confEntity=\"%s\" userEntity=\"%s\"/>"
591 "<user-roles xmlns=\"urn:ietf:params:xml:ns:conference-info\">"
592 "<entry>presenter</entry>"
594 "</modifyUserRoles>";
596 if (!session
->focus_dialog
|| !session
->focus_dialog
->is_established
) {
597 SIPE_DEBUG_INFO_NOFORMAT("sipe_conf_modify_user_role: no dialog with focus, exiting.");
601 cccp_request(sipe_private
, "INFO", session
->focus_dialog
->with
,
602 session
->focus_dialog
, NULL
,
603 CCCP_MODIFY_USER_ROLES
,
604 session
->focus_dialog
->with
, who
);
608 * Check conference lock status
610 sipe_chat_lock_status
sipe_core_chat_lock_status(struct sipe_core_public
*sipe_public
,
611 struct sipe_chat_session
*chat_session
)
613 struct sipe_core_private
*sipe_private
= SIPE_CORE_PRIVATE
;
614 sipe_chat_lock_status status
= SIPE_CHAT_LOCK_STATUS_NOT_ALLOWED
;
617 (chat_session
->type
== SIPE_CHAT_TYPE_CONFERENCE
)) {
618 struct sip_session
*session
= sipe_session_find_chat(sipe_private
,
621 gchar
*self
= sip_uri_self(sipe_private
);
623 /* Only operators are allowed to change the lock status */
624 if (sipe_backend_chat_is_operator(chat_session
->backend
, self
)) {
625 status
= session
->locked
?
626 SIPE_CHAT_LOCK_STATUS_LOCKED
:
627 SIPE_CHAT_LOCK_STATUS_UNLOCKED
;
638 * Modify Conference Lock
639 * Sends request to Focus.
640 * INFO method is a carrier of application/cccp+xml
643 sipe_core_chat_modify_lock(struct sipe_core_public
*sipe_public
,
644 struct sipe_chat_session
*chat_session
,
645 const gboolean locked
)
647 /* modifyConferenceLock request to the focus. Locks/unlocks conference.
650 * locked (%s) "true" or "false" values applicable
652 static const gchar CCCP_MODIFY_CONFERENCE_LOCK
[] =
653 "<modifyConferenceLock>"
654 "<conferenceKeys confEntity=\"%s\"/>"
655 "<locked>%s</locked>"
656 "</modifyConferenceLock>";
658 struct sipe_core_private
*sipe_private
= SIPE_CORE_PRIVATE
;
660 struct sip_session
*session
= sipe_session_find_chat(sipe_private
,
663 if (!session
) return;
664 if (!session
->focus_dialog
|| !session
->focus_dialog
->is_established
) {
665 SIPE_DEBUG_INFO_NOFORMAT("sipe_conf_modify_conference_lock: no dialog with focus, exiting.");
669 cccp_request(sipe_private
, "INFO", session
->focus_dialog
->with
,
670 session
->focus_dialog
, NULL
,
671 CCCP_MODIFY_CONFERENCE_LOCK
,
672 session
->focus_dialog
->with
,
673 locked
? "true" : "false");
676 /** Modify Delete User */
678 sipe_conf_delete_user(struct sipe_core_private
*sipe_private
,
679 struct sip_session
*session
,
682 /* deleteUser request to the focus. Removes a user from the conference.
687 static const gchar CCCP_DELETE_USER
[] =
689 "<userKeys confEntity=\"%s\" userEntity=\"%s\"/>"
692 if (!session
->focus_dialog
|| !session
->focus_dialog
->is_established
) {
693 SIPE_DEBUG_INFO_NOFORMAT("sipe_conf_delete_user: no dialog with focus, exiting.");
697 cccp_request(sipe_private
, "INFO", session
->focus_dialog
->with
,
698 session
->focus_dialog
, NULL
,
700 session
->focus_dialog
->with
, who
);
704 sipe_conf_announce_audio_mute_state(struct sipe_core_private
*sipe_private
,
705 struct sip_session
*session
,
708 // See [MS-CONFAV] 3.2.5.4 and 4.3
709 static const gchar CCCP_MODIFY_ENDPOINT_MEDIA
[] =
710 "<modifyEndpointMedia mscp:mcuUri=\"%s\""
711 " xmlns:mscp=\"http://schemas.microsoft.com/rtc/2005/08/cccpextensions\">"
712 "<mediaKeys confEntity=\"%s\" userEntity=\"%s\""
713 " endpointEntity=\"%s\" mediaId=\"%d\"/>"
715 " xmlns:ci=\"urn:ietf:params:xml:ns:conference-info\" id=\"%d\">"
716 "<ci:type>audio</ci:type>"
717 "<ci:status>%s</ci:status>"
718 "<media-ingress-filter"
719 " xmlns=\"http://schemas.microsoft.com/rtc/2005/08/confinfoextensions\">"
721 "</media-ingress-filter>"
723 "</modifyEndpointMedia>";
725 gchar
*mcu_uri
= sipe_conf_build_uri(session
->focus_dialog
->with
,
727 gchar
*self
= sip_uri_self(sipe_private
);
729 cccp_request(sipe_private
, "INFO", session
->focus_dialog
->with
,
730 session
->focus_dialog
, NULL
,
731 CCCP_MODIFY_ENDPOINT_MEDIA
,
732 mcu_uri
, session
->focus_dialog
->with
, self
,
733 session
->audio_video_entity
,
734 session
->audio_media_id
, session
->audio_media_id
,
735 is_muted
? "recvonly" : "sendrecv",
736 is_muted
? "block" : "unblock");
742 /** Invite counterparty to join conference callback */
744 process_invite_conf_response(struct sipe_core_private
*sipe_private
,
746 SIPE_UNUSED_PARAMETER
struct transaction
*trans
)
748 struct sip_dialog
*dialog
= g_new0(struct sip_dialog
, 1);
750 dialog
->callid
= g_strdup(sipmsg_find_header(msg
, "Call-ID"));
751 dialog
->cseq
= sipmsg_parse_cseq(msg
);
752 dialog
->with
= parse_from(sipmsg_find_header(msg
, "To"));
753 sipe_dialog_parse(dialog
, msg
, TRUE
);
755 if (msg
->response
>= 200) {
756 /* send ACK to counterparty */
758 sip_transport_ack(sipe_private
, dialog
);
759 dialog
->outgoing_invite
= NULL
;
760 dialog
->is_established
= TRUE
;
763 if (msg
->response
>= 400) {
764 SIPE_DEBUG_INFO("process_invite_conf_response: INVITE response is not 200. Failed to invite %s.", dialog
->with
);
765 /* @TODO notify user of failure to invite counterparty */
766 sipe_dialog_free(dialog
);
770 if (msg
->response
>= 200) {
771 struct sip_session
*session
= sipe_session_find_im(sipe_private
, dialog
->with
);
772 struct sip_dialog
*im_dialog
= sipe_dialog_find(session
, dialog
->with
);
774 /* close IM session to counterparty */
776 sip_transport_bye(sipe_private
, im_dialog
);
777 sipe_dialog_remove(session
, dialog
->with
);
781 sipe_dialog_free(dialog
);
786 * Invites counterparty to join conference.
789 sipe_invite_conf(struct sipe_core_private
*sipe_private
,
790 struct sip_session
*session
,
796 struct sip_dialog
*dialog
= NULL
;
798 /* It will be short lived special dialog.
799 * Will not be stored in session.
801 dialog
= g_new0(struct sip_dialog
, 1);
802 dialog
->callid
= gencallid();
803 dialog
->with
= g_strdup(who
);
804 dialog
->ourtag
= gentag();
806 contact
= get_contact(sipe_private
);
807 hdr
= g_strdup_printf(
808 "Supported: ms-sender\r\n"
810 "Content-Type: application/ms-conf-invite+xml\r\n",
814 body
= g_strdup_printf(
815 SIPE_SEND_CONF_INVITE
,
816 session
->chat_session
->id
,
817 session
->subject
? session
->subject
: ""
820 sip_transport_invite(sipe_private
,
824 process_invite_conf_response
);
826 sipe_dialog_free(dialog
);
831 /** Create conference callback */
833 process_conf_add_response(struct sipe_core_private
*sipe_private
,
835 struct transaction
*trans
)
837 if (msg
->response
>= 400) {
838 SIPE_DEBUG_INFO_NOFORMAT("process_conf_add_response: SERVICE response is not 200. Failed to create conference.");
839 /* @TODO notify user of failure to create conference */
842 if (msg
->response
== 200) {
843 sipe_xml
*xn_response
= sipe_xml_parse(msg
->body
, msg
->bodylen
);
844 if (sipe_strequal("success", sipe_xml_attribute(xn_response
, "code")))
846 gchar
*who
= trans
->payload
->data
;
847 const sipe_xml
*xn_conference_info
= sipe_xml_child(xn_response
, "addConference/conference-info");
848 struct sip_session
*session
= sipe_conf_create(sipe_private
,
850 sipe_xml_attribute(xn_conference_info
,
853 SIPE_DEBUG_INFO("process_conf_add_response: session->focus_uri=%s",
854 session
->chat_session
->id
);
856 session
->pending_invite_queue
= sipe_utils_slist_insert_unique_sorted(session
->pending_invite_queue
,
858 (GCompareFunc
)strcmp
,
861 sipe_xml_free(xn_response
);
868 * Creates conference.
871 sipe_conf_add(struct sipe_core_private
*sipe_private
,
874 gchar
*conference_id
;
875 struct transaction
*trans
;
876 time_t expiry
= time(NULL
) + 7*60*60; /* 7 hours */
879 /* addConference request to the focus factory.
881 * conference_id (%s) Ex.: 8386E6AEAAA41E4AA6627BA76D43B6D1
882 * expiry_time (%s) Ex.: 2009-07-13T17:57:09Z
883 * conference_view (%s) Ex.: <msci:entity-view entity="chat"/>
885 static const gchar CCCP_ADD_CONFERENCE
[] =
887 "<ci:conference-info xmlns:ci=\"urn:ietf:params:xml:ns:conference-info\" "
889 "xmlns:msci=\"http://schemas.microsoft.com/rtc/2005/08/confinfoextensions\">"
890 "<ci:conference-description>"
892 "<msci:conference-id>%s</msci:conference-id>"
893 "<msci:expiry-time>%s</msci:expiry-time>"
894 "<msci:admission-policy>openAuthenticated</msci:admission-policy>"
895 "</ci:conference-description>"
896 "<msci:conference-view>%s</msci:conference-view>"
897 "</ci:conference-info>"
900 static const gchar
*DESIRED_MCU_TYPES
[] = {
906 "applicationsharing",
911 GString
*conference_view
= g_string_new("");
914 for (type
= DESIRED_MCU_TYPES
; *type
; ++type
) {
915 if (sipe_conf_supports_mcu_type(sipe_private
, *type
)) {
916 g_string_append(conference_view
, "<msci:entity-view entity=\"");
917 g_string_append(conference_view
, *type
);
918 g_string_append(conference_view
, "\"/>");
922 expiry_time
= sipe_utils_time_to_str(expiry
);
923 conference_id
= genconfid();
924 trans
= cccp_request(sipe_private
, "SERVICE", sipe_private
->focus_factory_uri
,
925 NULL
, process_conf_add_response
,
927 conference_id
, expiry_time
, conference_view
->str
);
928 g_free(conference_id
);
930 g_string_free(conference_view
, TRUE
);
933 struct transaction_payload
*payload
= g_new0(struct transaction_payload
, 1);
935 payload
->destroy
= g_free
;
936 payload
->data
= g_strdup(who
);
937 trans
->payload
= payload
;
942 accept_incoming_invite_conf(struct sipe_core_private
*sipe_private
,
947 struct sip_session
*session
;
948 gchar
*newTag
= gentag();
949 const gchar
*oldHeader
= sipmsg_find_header(msg
, "To");
952 newHeader
= g_strdup_printf("%s;tag=%s", oldHeader
, newTag
);
954 sipmsg_remove_header_now(msg
, "To");
955 sipmsg_add_header_now(msg
, "To", newHeader
);
958 /* acknowledge invite */
959 sip_transport_response(sipe_private
, msg
, 200, "OK", NULL
);
961 /* add self to conf */
962 session
= sipe_conf_create(sipe_private
, NULL
, focus_uri
);
963 session
->is_call
= audio
;
966 struct conf_accept_ctx
{
969 struct sipe_user_ask_ctx
*ask_ctx
;
971 SipeUserAskCb accept_cb
;
972 SipeUserAskCb decline_cb
;
978 conf_accept_ctx_free(struct conf_accept_ctx
*ctx
)
980 g_return_if_fail(ctx
!= NULL
);
982 sipmsg_free(ctx
->msg
);
983 g_free(ctx
->focus_uri
);
988 conf_accept_cb(struct sipe_core_private
*sipe_private
, struct conf_accept_ctx
*ctx
)
990 accept_incoming_invite_conf(sipe_private
, ctx
->focus_uri
, TRUE
, ctx
->msg
);
994 conf_decline_cb(struct sipe_core_private
*sipe_private
, struct conf_accept_ctx
*ctx
)
996 sip_transport_response(sipe_private
,
998 603, "Decline", NULL
);
1002 sipe_conf_cancel_unaccepted(struct sipe_core_private
*sipe_private
,
1005 const gchar
*callid1
= msg
? sipmsg_find_header(msg
, "Call-ID") : NULL
;
1006 GSList
*it
= sipe_private
->sessions_to_accept
;
1008 struct conf_accept_ctx
*ctx
= it
->data
;
1009 const gchar
*callid2
= NULL
;
1011 if (msg
&& ctx
->msg
)
1012 callid2
= sipmsg_find_header(ctx
->msg
, "Call-ID");
1014 if (sipe_strequal(callid1
, callid2
)) {
1018 sip_transport_response(sipe_private
, ctx
->msg
,
1019 487, "Request Terminated", NULL
);
1022 sip_transport_response(sipe_private
, msg
, 200, "OK", NULL
);
1024 sipe_user_close_ask(ctx
->ask_ctx
);
1025 conf_accept_ctx_free(ctx
);
1030 sipe_private
->sessions_to_accept
=
1031 g_slist_delete_link(sipe_private
->sessions_to_accept
, tmp
);
1041 accept_invitation_cb(struct sipe_core_private
*sipe_private
, gpointer data
)
1043 struct conf_accept_ctx
*ctx
= data
;
1045 sipe_private
->sessions_to_accept
=
1046 g_slist_remove(sipe_private
->sessions_to_accept
, ctx
);
1048 if (ctx
->accept_cb
) {
1049 ctx
->accept_cb(sipe_private
, ctx
);
1052 conf_accept_ctx_free(ctx
);
1056 decline_invitation_cb(struct sipe_core_private
*sipe_private
, gpointer data
)
1058 struct conf_accept_ctx
*ctx
= data
;
1060 sipe_private
->sessions_to_accept
=
1061 g_slist_remove(sipe_private
->sessions_to_accept
, ctx
);
1063 if (ctx
->decline_cb
) {
1064 ctx
->decline_cb(sipe_private
, ctx
);
1067 conf_accept_ctx_free(ctx
);
1071 ask_accept_invitation(struct sipe_core_private
*sipe_private
,
1072 const gchar
*focus_uri
,
1073 const gchar
*question
,
1075 SipeUserAskCb accept_cb
,
1076 SipeUserAskCb decline_cb
,
1081 gchar
*question_str
;
1082 struct conf_accept_ctx
*ctx
;
1084 parts
= g_strsplit(focus_uri
, ";", 2);
1085 alias
= sipe_buddy_get_alias(sipe_private
, parts
[0]);
1087 question_str
= g_strdup_printf("%s %s", alias
? alias
: parts
[0], question
);
1092 ctx
= g_new0(struct conf_accept_ctx
, 1);
1093 sipe_private
->sessions_to_accept
=
1094 g_slist_append(sipe_private
->sessions_to_accept
, ctx
);
1096 ctx
->focus_uri
= g_strdup(focus_uri
);
1097 ctx
->msg
= msg
? sipmsg_copy(msg
) : NULL
;
1098 ctx
->accept_cb
= accept_cb
;
1099 ctx
->decline_cb
= decline_cb
;
1100 ctx
->user_data
= user_data
;
1101 ctx
->ask_ctx
= sipe_user_ask(sipe_private
, question_str
,
1102 _("Accept"), accept_invitation_cb
,
1103 _("Decline"), decline_invitation_cb
,
1106 g_free(question_str
);
1110 ask_accept_voice_conference(struct sipe_core_private
*sipe_private
,
1111 const gchar
*focus_uri
,
1113 SipeUserAskCb accept_cb
,
1114 SipeUserAskCb decline_cb
)
1117 const gchar
*novv_note
;
1122 novv_note
= _("\n\nAs this client was not compiled with voice call "
1123 "support, if you accept, you will be able to contact "
1124 "the other participants only via IM session.");
1127 question
= g_strdup_printf(_("wants to invite you "
1128 "to a conference call%s"), novv_note
);
1130 ask_accept_invitation(sipe_private
, focus_uri
, question
, msg
,
1131 accept_cb
, decline_cb
, NULL
);
1137 process_incoming_invite_conf(struct sipe_core_private
*sipe_private
,
1140 sipe_xml
*xn_conferencing
= sipe_xml_parse(msg
->body
, msg
->bodylen
);
1141 const sipe_xml
*xn_focus_uri
= sipe_xml_child(xn_conferencing
, "focus-uri");
1142 const sipe_xml
*xn_audio
= sipe_xml_child(xn_conferencing
, "audio");
1143 gchar
*focus_uri
= sipe_xml_data(xn_focus_uri
);
1144 gboolean audio
= sipe_strequal(sipe_xml_attribute(xn_audio
, "available"), "true");
1146 sipe_xml_free(xn_conferencing
);
1148 SIPE_DEBUG_INFO("We have received invitation to Conference. Focus URI=%s", focus_uri
);
1151 sip_transport_response(sipe_private
, msg
, 180, "Ringing", NULL
);
1152 ask_accept_voice_conference(sipe_private
, focus_uri
, msg
,
1153 (SipeUserAskCb
) conf_accept_cb
,
1154 (SipeUserAskCb
) conf_decline_cb
);
1157 accept_incoming_invite_conf(sipe_private
, focus_uri
, FALSE
, msg
);
1166 process_conference_av_endpoint(const sipe_xml
*endpoint
,
1167 const gchar
*user_uri
,
1168 const gchar
*self_uri
,
1169 struct sip_session
*session
)
1171 const sipe_xml
*media
;
1172 const gchar
*new_entity
;
1174 if (!sipe_strequal(user_uri
, self_uri
)) {
1175 /* We are interested only in our own endpoint data. */
1179 new_entity
= sipe_xml_attribute(endpoint
, "entity");
1180 if (!sipe_strequal(session
->audio_video_entity
, new_entity
)) {
1181 g_free(session
->audio_video_entity
);
1182 session
->audio_video_entity
= g_strdup(new_entity
);
1185 session
->audio_media_id
= 0;
1187 media
= sipe_xml_child(endpoint
, "media");
1188 for (; media
; media
= sipe_xml_twin(media
)) {
1189 gchar
*type
= sipe_xml_data(sipe_xml_child(media
, "type"));
1191 if (sipe_strequal(type
, "audio")) {
1192 session
->audio_media_id
=
1193 sipe_xml_int_attribute(media
, "id", 0);
1198 if (session
->audio_media_id
!= 0) {
1205 call_accept_cb(struct sipe_core_private
*sipe_private
, struct conf_accept_ctx
*ctx
)
1207 struct sip_session
*session
;
1208 session
= sipe_session_find_conference(sipe_private
, ctx
->focus_uri
);
1211 sipe_core_media_connect_conference(SIPE_CORE_PUBLIC
,
1212 session
->chat_session
);
1216 #ifdef HAVE_APPSHARE
1218 sipe_core_conf_get_appshare_role(struct sipe_core_public
*sipe_public
,
1219 struct sipe_chat_session
*chat_session
)
1223 struct sipe_media_call
*call
;
1225 mcu_uri
= sipe_conf_build_uri(chat_session
->id
, "applicationsharing");
1227 call
= sipe_media_call_find(SIPE_CORE_PRIVATE
, mcu_uri
);
1232 return sipe_appshare_get_role(call
);
1236 return SIPE_APPSHARE_ROLE_NONE
;
1240 process_conference_appshare_endpoint(const sipe_xml
*endpoint
)
1242 gboolean presentation_added
= FALSE
;
1243 const sipe_xml
*media
;
1245 for (media
= sipe_xml_child(endpoint
, "media");
1246 media
&& !presentation_added
;
1247 media
= sipe_xml_twin(media
)) {
1252 type
= sipe_xml_data(sipe_xml_child(media
, "type"));
1253 media_state
= sipe_xml_data(sipe_xml_child(media
, "media-state"));
1254 status
= sipe_xml_data(sipe_xml_child(media
, "status"));
1256 if (sipe_strequal(type
, "applicationsharing") &&
1257 sipe_strequal(media_state
, "connected") &&
1258 sipe_strequal(status
, "sendonly")) {
1259 presentation_added
= TRUE
;
1263 g_free(media_state
);
1267 return(presentation_added
);
1269 #endif // HAVE_APPSHARE
1273 sipe_process_conference(struct sipe_core_private
*sipe_private
,
1276 sipe_xml
*xn_conference_info
;
1277 const sipe_xml
*node
;
1278 const sipe_xml
*xn_subject
;
1279 const gchar
*focus_uri
;
1280 struct sip_session
*session
;
1281 gboolean just_joined
= FALSE
;
1283 gboolean audio_was_added
= FALSE
;
1284 #ifdef HAVE_APPSHARE
1285 gboolean presentation_was_added
= FALSE
;
1289 if (msg
->response
!= 0 && msg
->response
!= 200) return;
1291 if (msg
->bodylen
== 0 || msg
->body
== NULL
|| !sipe_strequal(sipmsg_find_header(msg
, "Event"), "conference")) return;
1293 xn_conference_info
= sipe_xml_parse(msg
->body
, msg
->bodylen
);
1294 if (!xn_conference_info
) return;
1296 focus_uri
= sipe_xml_attribute(xn_conference_info
, "entity");
1297 session
= sipe_session_find_conference(sipe_private
, focus_uri
);
1300 SIPE_DEBUG_INFO("sipe_process_conference: unable to find conf session with focus=%s", focus_uri
);
1304 if (!session
->chat_session
->backend
) {
1305 gchar
*self
= sip_uri_self(sipe_private
);
1308 session
->chat_session
->backend
= sipe_backend_chat_create(SIPE_CORE_PUBLIC
,
1309 session
->chat_session
,
1310 session
->chat_session
->title
,
1313 /* @TODO ask for full state (re-subscribe) if it was a partial one -
1314 * this is to obtain full list of conference participants.
1320 if ((xn_subject
= sipe_xml_child(xn_conference_info
, "conference-description/subject"))) {
1321 g_free(session
->subject
);
1322 session
->subject
= sipe_xml_data(xn_subject
);
1323 sipe_backend_chat_topic(session
->chat_session
->backend
, session
->subject
);
1324 SIPE_DEBUG_INFO("sipe_process_conference: subject=%s", session
->subject
? session
->subject
: "");
1328 if (!session
->im_mcu_uri
) {
1329 for (node
= sipe_xml_child(xn_conference_info
, "conference-description/conf-uris/entry");
1331 node
= sipe_xml_twin(node
))
1333 gchar
*purpose
= sipe_xml_data(sipe_xml_child(node
, "purpose"));
1335 if (sipe_strequal("chat", purpose
)) {
1337 session
->im_mcu_uri
= sipe_xml_data(sipe_xml_child(node
, "uri"));
1338 SIPE_DEBUG_INFO("sipe_process_conference: im_mcu_uri=%s", session
->im_mcu_uri
);
1346 if (!session
->chat_session
->organizer
) {
1347 node
= sipe_xml_child(xn_conference_info
, "conference-description/organizer/display-name");
1349 session
->chat_session
->organizer
= sipe_xml_data(node
);
1354 if (!session
->chat_session
->join_url
) {
1355 node
= sipe_xml_child(xn_conference_info
, "conference-description/join-url");
1357 session
->chat_session
->join_url
= sipe_xml_data(node
);
1361 /* dial-in conference id */
1362 if (!session
->chat_session
->dial_in_conf_id
) {
1363 node
= sipe_xml_child(xn_conference_info
, "conference-description/pstn-access/id");
1365 session
->chat_session
->dial_in_conf_id
= sipe_xml_data(node
);
1370 for (node
= sipe_xml_child(xn_conference_info
, "users/user"); node
; node
= sipe_xml_twin(node
)) {
1371 const gchar
*user_uri
= sipe_xml_attribute(node
, "entity");
1372 const gchar
*state
= sipe_xml_attribute(node
, "state");
1373 gchar
*role
= sipe_xml_data(sipe_xml_child(node
, "roles/entry"));
1374 gboolean is_operator
= sipe_strequal(role
, "presenter");
1375 gboolean is_in_im_mcu
= FALSE
;
1376 gchar
*self
= sip_uri_self(sipe_private
);
1378 if (sipe_strequal("deleted", state
)) {
1379 if (sipe_backend_chat_find(session
->chat_session
->backend
, user_uri
)) {
1380 sipe_backend_chat_remove(session
->chat_session
->backend
,
1385 const sipe_xml
*endpoint
;
1386 for (endpoint
= sipe_xml_child(node
, "endpoint"); endpoint
; endpoint
= sipe_xml_twin(endpoint
)) {
1387 const gchar
*session_type
;
1388 gchar
*status
= sipe_xml_data(sipe_xml_child(endpoint
, "status"));
1389 gboolean connected
= sipe_strequal("connected", status
);
1395 session_type
= sipe_xml_attribute(endpoint
, "session-type");
1397 if (sipe_strequal("chat", session_type
)) {
1398 is_in_im_mcu
= TRUE
;
1399 if (!sipe_backend_chat_find(session
->chat_session
->backend
, user_uri
)) {
1400 sipe_backend_chat_add(session
->chat_session
->backend
,
1402 !just_joined
&& g_ascii_strcasecmp(user_uri
, self
));
1405 sipe_backend_chat_operator(session
->chat_session
->backend
,
1408 } else if (sipe_strequal("audio-video", session_type
)) {
1410 if (!session
->is_call
)
1411 audio_was_added
= TRUE
;
1412 process_conference_av_endpoint(endpoint
,
1417 } else if (sipe_strequal("applicationsharing", session_type
)) {
1418 #ifdef HAVE_APPSHARE
1419 if (sipe_core_conf_get_appshare_role(SIPE_CORE_PUBLIC
,
1420 session
->chat_session
) == SIPE_APPSHARE_ROLE_NONE
&&
1421 !sipe_strequal(user_uri
, self
)) {
1422 presentation_was_added
= process_conference_appshare_endpoint(endpoint
);
1427 if (!is_in_im_mcu
) {
1428 if (sipe_backend_chat_find(session
->chat_session
->backend
, user_uri
)) {
1429 sipe_backend_chat_remove(session
->chat_session
->backend
,
1439 if (audio_was_added
) {
1440 session
->is_call
= TRUE
;
1441 ask_accept_voice_conference(sipe_private
, focus_uri
, NULL
,
1442 (SipeUserAskCb
) call_accept_cb
,
1445 #ifdef HAVE_APPSHARE
1446 if (presentation_was_added
) {
1447 sipe_core_appshare_connect_conference(SIPE_CORE_PUBLIC
,
1448 session
->chat_session
,
1454 /* entity-view, locked */
1455 for (node
= sipe_xml_child(xn_conference_info
, "conference-view/entity-view");
1457 node
= sipe_xml_twin(node
)) {
1459 const sipe_xml
*xn_type
= sipe_xml_child(node
, "entity-state/media/entry/type");
1461 if (xn_type
&& sipe_strequal("chat", (tmp
= sipe_xml_data(xn_type
)))) {
1462 const sipe_xml
*xn_locked
= sipe_xml_child(node
, "entity-state/locked");
1464 gchar
*locked
= sipe_xml_data(xn_locked
);
1465 gboolean prev_locked
= session
->locked
;
1466 session
->locked
= sipe_strequal(locked
, "true");
1467 if (prev_locked
&& !session
->locked
) {
1468 sipe_user_present_info(sipe_private
, session
,
1469 _("This conference is no longer locked. Additional participants can now join."));
1471 if (!prev_locked
&& session
->locked
) {
1472 sipe_user_present_info(sipe_private
, session
,
1473 _("This conference is locked. Nobody else can join the conference while it is locked."));
1476 SIPE_DEBUG_INFO("sipe_process_conference: session->locked=%s",
1477 session
->locked
? "TRUE" : "FALSE");
1483 sipe_xml_free(xn_conference_info
);
1485 if (session
->im_mcu_uri
) {
1486 struct sip_dialog
*dialog
= sipe_dialog_find(session
, session
->im_mcu_uri
);
1488 dialog
= sipe_dialog_add(session
);
1490 dialog
->callid
= g_strdup(session
->callid
);
1491 dialog
->with
= g_strdup(session
->im_mcu_uri
);
1493 /* send INVITE to IM MCU */
1494 sipe_im_invite(sipe_private
, session
, dialog
->with
, NULL
, NULL
, NULL
, FALSE
);
1498 sipe_process_pending_invite_queue(sipe_private
, session
);
1502 sipe_conf_immcu_closed(struct sipe_core_private
*sipe_private
,
1503 struct sip_session
*session
)
1505 sipe_user_present_info(sipe_private
, session
,
1506 _("You have been disconnected from this conference."));
1507 sipe_backend_chat_close(session
->chat_session
->backend
);
1511 conf_session_close(struct sipe_core_private
*sipe_private
,
1512 struct sip_session
*session
)
1515 /* unsubscribe from focus */
1516 sipe_subscribe_conference(sipe_private
,
1517 session
->chat_session
->id
, TRUE
);
1519 if (session
->focus_dialog
) {
1520 /* send BYE to focus */
1521 sip_transport_bye(sipe_private
, session
->focus_dialog
);
1527 sipe_process_imdn(struct sipe_core_private
*sipe_private
,
1530 gchar
*with
= parse_from(sipmsg_find_header(msg
, "From"));
1531 const gchar
*callid
= sipmsg_find_header(msg
, "Call-ID");
1532 static struct sip_session
*session
;
1534 const sipe_xml
*node
;
1538 session
= sipe_session_find_chat_or_im(sipe_private
, callid
, with
);
1540 SIPE_DEBUG_INFO("sipe_process_imdn: unable to find conf session with callid=%s", callid
);
1545 xn_imdn
= sipe_xml_parse(msg
->body
, msg
->bodylen
);
1546 message_id
= sipe_xml_data(sipe_xml_child(xn_imdn
, "message-id"));
1548 message
= g_hash_table_lookup(session
->conf_unconfirmed_messages
, message_id
);
1551 for (node
= sipe_xml_child(xn_imdn
, "recipient"); node
; node
= sipe_xml_twin(node
)) {
1552 gchar
*tmp
= parse_from(sipe_xml_attribute(node
, "uri"));
1553 gchar
*uri
= parse_from(tmp
);
1554 gchar
*status
= sipe_xml_data(sipe_xml_child(node
, "status"));
1555 guint error
= status
? g_ascii_strtoull(status
, NULL
, 10) : 0;
1556 /* default to error if missing or conversion failed */
1557 if ((error
== 0) || (error
>= 300))
1558 sipe_user_present_message_undelivered(sipe_private
,
1569 sipe_xml_free(xn_imdn
);
1571 g_hash_table_remove(session
->conf_unconfirmed_messages
, message_id
);
1572 SIPE_DEBUG_INFO("sipe_process_imdn: removed message %s from conf_unconfirmed_messages(count=%d)",
1573 message_id
, g_hash_table_size(session
->conf_unconfirmed_messages
));
1578 void sipe_core_conf_make_leader(struct sipe_core_public
*sipe_public
,
1580 const gchar
*buddy_name
)
1582 struct sipe_core_private
*sipe_private
= SIPE_CORE_PRIVATE
;
1583 struct sipe_chat_session
*chat_session
= parameter
;
1584 struct sip_session
*session
;
1586 SIPE_DEBUG_INFO("sipe_core_conf_make_leader: chat_title=%s",
1587 chat_session
->title
);
1589 session
= sipe_session_find_chat(sipe_private
, chat_session
);
1590 sipe_conf_modify_user_role(sipe_private
, session
, buddy_name
);
1593 void sipe_core_conf_remove_from(struct sipe_core_public
*sipe_public
,
1595 const gchar
*buddy_name
)
1597 struct sipe_core_private
*sipe_private
= SIPE_CORE_PRIVATE
;
1598 struct sipe_chat_session
*chat_session
= parameter
;
1599 struct sip_session
*session
;
1601 SIPE_DEBUG_INFO("sipe_core_conf_remove_from: chat_title=%s",
1602 chat_session
->title
);
1604 session
= sipe_session_find_chat(sipe_private
, chat_session
);
1605 sipe_conf_delete_user(sipe_private
, session
, buddy_name
);
1609 sipe_conf_build_uri(const gchar
*focus_uri
, const gchar
*session_type
)
1611 gchar
**parts
= g_strsplit(focus_uri
, ":focus:", 2);
1612 gchar
*result
= NULL
;
1614 if (g_strv_length(parts
) == 2) {
1615 result
= g_strconcat(parts
[0], ":", session_type
, ":", parts
[1],
1624 access_numbers_info(struct sipe_core_public
*sipe_public
)
1626 GString
*result
= g_string_new("");
1627 GList
*keys
= g_hash_table_get_keys(SIPE_CORE_PRIVATE
->access_numbers
);
1628 keys
= g_list_sort(keys
, (GCompareFunc
)g_strcmp0
);
1630 for (; keys
; keys
= g_list_delete_link(keys
, keys
)) {
1632 value
= g_hash_table_lookup(SIPE_CORE_PRIVATE
->access_numbers
,
1635 g_string_append(result
, keys
->data
);
1636 g_string_append(result
, " ");
1637 g_string_append(result
, value
);
1638 g_string_append(result
, "<br/>");
1641 return g_string_free(result
, FALSE
);
1645 sipe_core_conf_entry_info(struct sipe_core_public
*sipe_public
,
1646 struct sipe_chat_session
*chat_session
)
1648 gchar
*access_info
= access_numbers_info(sipe_public
);
1649 gchar
*result
= g_strdup_printf(
1650 "<b><font size=\"+1\">%s</font></b><br/>"
1651 "<b>%s:</b> %s<br/>"
1652 "<b>%s:</b> %s<br/>"
1657 "<b>%s:</b> %s<br/>"
1659 "<b><font size=\"+1\">%s</font></b><br/>"
1663 SIPE_CORE_PRIVATE
->default_access_number
? SIPE_CORE_PRIVATE
->default_access_number
: "",
1665 chat_session
->dial_in_conf_id
? chat_session
->dial_in_conf_id
: "",
1667 chat_session
->join_url
? chat_session
->join_url
: "",
1669 chat_session
->organizer
? chat_session
->organizer
: "",
1670 _("Alternative dial-in numbers"),
1673 g_free(access_info
);