6 * Copyright (C) 2010-2017 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-dialog.h"
54 #include "sipe-http.h"
57 #include "sipe-session.h"
58 #include "sipe-subscriptions.h"
59 #include "sipe-user.h"
60 #include "sipe-utils.h"
64 * Invite counterparty to join conference.
65 * @param focus_uri (%s)
66 * @param subject (%s) of conference
68 #define SIPE_SEND_CONF_INVITE \
69 "<Conferencing version=\"2.0\">"\
70 "<focus-uri>%s</focus-uri>"\
71 "<subject>%s</subject>"\
72 "<im available=\"true\">"\
78 sipe_conf_check_for_lync_url(struct sipe_core_private
*sipe_private
,
81 static struct transaction
*
82 cccp_request(struct sipe_core_private
*sipe_private
, const gchar
*method
,
83 const gchar
*with
, struct sip_dialog
*dialog
,
84 TransCallback callback
, const gchar
*body
, ...)
90 gchar
*self
= sip_uri_self(sipe_private
);
94 struct transaction
*trans
;
96 headers
= g_strdup_printf(
97 "Supported: ms-sender\r\n"
99 "Content-Type: application/cccp+xml\r\n",
100 sipe_private
->contact
);
102 /* TODO: put request_id to queue to further compare with incoming one */
103 request
= g_strdup_printf(
104 "<?xml version=\"1.0\"?>"
105 "<request xmlns=\"urn:ietf:params:xml:ns:cccp\" "
106 "xmlns:mscp=\"http://schemas.microsoft.com/rtc/2005/08/cccpextensions\" "
115 sipe_private
->cccp_request_id
++,
119 va_start(args
, body
);
120 request_body
= g_strdup_vprintf(request
, args
);
125 trans
= sip_transport_request(sipe_private
,
135 g_free(request_body
);
141 process_conf_get_capabilities(SIPE_UNUSED_PARAMETER
struct sipe_core_private
*sipe_private
,
143 SIPE_UNUSED_PARAMETER
struct transaction
*trans
)
145 if (msg
->response
>= 400) {
146 SIPE_DEBUG_INFO_NOFORMAT("process_conf_get_capabilities: "
147 "getConferencingCapabilities failed.");
150 if (msg
->response
== 200) {
151 sipe_xml
*xn_response
= sipe_xml_parse(msg
->body
, msg
->bodylen
);
152 const sipe_xml
*node
;
153 gchar
*default_region
;
155 if (!sipe_strequal("success", sipe_xml_attribute(xn_response
, "code"))) {
159 node
= sipe_xml_child(xn_response
, "getConferencingCapabilities/mcu-types/mcuType");
160 for (;node
; node
= sipe_xml_twin(node
)) {
161 sipe_private
->conf_mcu_types
=
162 g_slist_append(sipe_private
->conf_mcu_types
,
163 sipe_xml_data(node
));
166 g_hash_table_remove_all(sipe_private
->access_numbers
);
167 node
= sipe_xml_child(xn_response
, "getConferencingCapabilities/pstn-bridging/access-numbers/region");
168 for (;node
; node
= sipe_xml_twin(node
)) {
169 gchar
*name
= g_strdup(sipe_xml_attribute(node
, "name"));
170 gchar
*number
= sipe_xml_data(sipe_xml_child(node
, "access-number/number"));
171 if (name
&& number
) {
172 g_hash_table_insert(sipe_private
->access_numbers
, name
, number
);
176 node
= sipe_xml_child(xn_response
, "getConferencingCapabilities/pstn-bridging/access-numbers/default-region");
177 default_region
= sipe_xml_data(node
);
178 if (default_region
) {
179 sipe_private
->default_access_number
=
180 g_hash_table_lookup(sipe_private
->access_numbers
, default_region
);
182 g_free(default_region
);
184 sipe_xml_free(xn_response
);
191 sipe_conf_get_capabilities(struct sipe_core_private
*sipe_private
)
193 cccp_request(sipe_private
, "SERVICE",
194 sipe_private
->focus_factory_uri
,
196 process_conf_get_capabilities
,
197 "<getConferencingCapabilities />");
201 sipe_conf_supports_mcu_type(struct sipe_core_private
*sipe_private
,
204 return g_slist_find_custom(sipe_private
->conf_mcu_types
, type
,
205 (GCompareFunc
)g_strcmp0
) != NULL
;
209 * Generates random GUID.
210 * This method is borrowed from pidgin's msnutils.c
215 return g_strdup_printf("%4X%4X-%4X-%4X-%4X-%4X%4X%4X",
216 rand() % 0xAAFF + 0x1111,
217 rand() % 0xAAFF + 0x1111,
218 rand() % 0xAAFF + 0x1111,
219 rand() % 0xAAFF + 0x1111,
220 rand() % 0xAAFF + 0x1111,
221 rand() % 0xAAFF + 0x1111,
222 rand() % 0xAAFF + 0x1111,
223 rand() % 0xAAFF + 0x1111);
226 /** Invite us to the focus callback */
228 process_invite_conf_focus_response(struct sipe_core_private
*sipe_private
,
230 SIPE_UNUSED_PARAMETER
struct transaction
*trans
)
232 struct sip_session
*session
= NULL
;
233 char *focus_uri
= parse_from(sipmsg_find_header(msg
, "To"));
235 session
= sipe_session_find_conference(sipe_private
, focus_uri
);
238 SIPE_DEBUG_INFO("process_invite_conf_focus_response: unable to find conf session with focus=%s", focus_uri
);
243 if (!session
->focus_dialog
) {
244 SIPE_DEBUG_INFO_NOFORMAT("process_invite_conf_focus_response: session's focus_dialog is NULL");
249 sipe_dialog_parse(session
->focus_dialog
, msg
, TRUE
);
251 if (msg
->response
>= 200) {
252 /* send ACK to focus */
253 session
->focus_dialog
->cseq
= 0;
254 sip_transport_ack(sipe_private
, session
->focus_dialog
);
255 session
->focus_dialog
->outgoing_invite
= NULL
;
256 session
->focus_dialog
->is_established
= TRUE
;
259 if (msg
->response
>= 400) {
260 gchar
*reason
= sipmsg_get_ms_diagnostics_reason(msg
);
262 SIPE_DEBUG_INFO_NOFORMAT("process_invite_conf_focus_response: INVITE response is not 200. Failed to join focus.");
263 sipe_backend_notify_error(SIPE_CORE_PUBLIC
,
264 _("Failed to join the conference"),
265 reason
? reason
: _("no reason given"));
268 sipe_session_remove(sipe_private
, session
);
271 } else if (msg
->response
== 200) {
272 sipe_xml
*xn_response
= sipe_xml_parse(msg
->body
, msg
->bodylen
);
273 const gchar
*code
= sipe_xml_attribute(xn_response
, "code");
274 if (sipe_strequal(code
, "success")) {
275 /* subscribe to focus */
276 sipe_subscribe_conference(sipe_private
,
277 session
->chat_session
->id
,
280 if (session
->is_call
)
281 sipe_core_media_connect_conference(SIPE_CORE_PUBLIC
,
282 session
->chat_session
);
285 sipe_xml_free(xn_response
);
293 parse_ocs_focus_uri(const gchar
*uri
)
295 const gchar
*confkey
;
301 // URI can have this prefix if it was typed in by the user
302 if (g_str_has_prefix(uri
, "meet:") || g_str_has_prefix(uri
, "conf:")) {
306 uri_len
= strlen(uri
);
308 if (!uri
|| !g_str_has_prefix(uri
, "sip:") ||
309 uri_len
== 4 || g_strstr_len(uri
, -1, "%")) {
313 confkey
= g_strstr_len(uri
, -1, "?");
315 /* TODO: Investigate how conf-key field should be used,
316 * ignoring for now */
317 uri_len
= confkey
- uri
;
320 return g_strndup(uri
, uri_len
);
324 extract_uri_from_html(const gchar
*body
,
326 guint prefix_skip_chars
)
329 const gchar
*start
= g_strstr_len(body
, -1, prefix
);
334 start
+= prefix_skip_chars
;
335 end
= strchr(start
, '"');
338 gchar
*html
= g_strndup(start
, end
- start
);
340 /* decode HTML entities */
341 gchar
*html_unescaped
= sipe_backend_markup_strip_html(html
);
344 if (!is_empty(html_unescaped
)) {
345 uri
= sipe_utils_uri_unescape(html_unescaped
);
348 g_free(html_unescaped
);
355 static void sipe_conf_lync_url_cb(struct sipe_core_private
*sipe_private
,
357 SIPE_UNUSED_PARAMETER GSList
*headers
,
359 gpointer callback_data
)
361 gchar
*uri
= callback_data
;
363 if (status
!= (guint
) SIPE_HTTP_STATUS_ABORTED
) {
364 gchar
*focus_uri
= NULL
;
368 * Extract focus URI from HTML, e.g.
370 * <a ... href="conf:sip:...ABCDEF%3Frequired..." ... >
372 gchar
*uri
= extract_uri_from_html(body
, "href=\"conf", 6);
373 focus_uri
= parse_ocs_focus_uri(uri
);
378 SIPE_DEBUG_INFO("sipe_conf_lync_url_cb: found focus URI"
381 sipe_conf_create(sipe_private
, NULL
, focus_uri
);
385 * If present, domainOwnerJoinLauncherUrl redirects to
386 * a page from where we still may extract the focus URI.
388 gchar
*launcher_url
= NULL
;
389 static const gchar
*launcher_url_prefix
[] = {
390 "var domainOwnerJoinLauncherUrl = \"",
391 "sb-data-domainOwnerJoinLauncherUrl=\"",
396 SIPE_DEBUG_INFO("sipe_conf_lync_url_cb: no focus URI "
397 "found from URL '%s'", uri
);
399 for (p
= launcher_url_prefix
; !launcher_url
&& *p
; ++p
) {
400 launcher_url
= extract_uri_from_html(body
,
406 sipe_conf_check_for_lync_url(sipe_private
, launcher_url
)) {
407 SIPE_DEBUG_INFO("sipe_conf_lync_url_cb: retrying with URL '%s'",
409 /* Ownership taken by sipe_conf_check_for_lync_url() */
414 error
= g_strdup_printf(_("Can't find a conference URI on this page:\n\n%s"),
417 sipe_backend_notify_error(SIPE_CORE_PUBLIC
,
418 _("Failed to join the conference"),
423 g_free(launcher_url
);
430 static gboolean
sipe_conf_check_for_lync_url(struct sipe_core_private
*sipe_private
,
433 struct sipe_http_request
*request
;
435 if (!(g_str_has_prefix(uri
, "https://") ||
436 g_str_has_prefix(uri
, "http://")))
439 /* URL points to a HTML page with the conference focus URI */
440 request
= sipe_http_request_get(sipe_private
,
443 sipe_conf_lync_url_cb
,
447 sipe_http_request_ready(request
);
454 static void sipe_conf_uri_error(struct sipe_core_private
*sipe_private
,
457 gchar
*error
= g_strdup_printf(_("\"%s\" is not a valid conference URI"),
459 sipe_backend_notify_error(SIPE_CORE_PUBLIC
,
460 _("Failed to join the conference"),
465 void sipe_core_conf_create(struct sipe_core_public
*sipe_public
,
467 const gchar
*organizer
,
468 const gchar
*meeting_id
)
470 struct sipe_core_private
*sipe_private
= SIPE_CORE_PRIVATE
;
472 /* SIP URI or HTTP URL */
474 gchar
*uri_ue
= sipe_utils_uri_unescape(uri
);
476 SIPE_DEBUG_INFO("sipe_core_conf_create: URI '%s' unescaped '%s'",
478 uri_ue
? uri_ue
: "<UNDEFINED>");
480 /* takes ownership of "uri_ue" if successful */
481 if (!sipe_conf_check_for_lync_url(sipe_private
, uri_ue
)) {
482 gchar
*focus_uri
= parse_ocs_focus_uri(uri_ue
);
485 sipe_conf_create(sipe_private
, NULL
, focus_uri
);
488 sipe_conf_uri_error(sipe_private
, uri
);
493 /* Organizer email and meeting ID */
494 } else if (organizer
&& meeting_id
) {
495 gchar
*tmp
= g_strdup_printf("sip:%s;gruu;opaque=app:conf:focus:id:%s",
496 organizer
, meeting_id
);
497 gchar
*focus_uri
= parse_ocs_focus_uri(tmp
);
499 SIPE_DEBUG_INFO("sipe_core_conf_create: organizer '%s' meeting ID '%s'",
504 sipe_conf_create(sipe_private
, NULL
, focus_uri
);
507 sipe_conf_uri_error(sipe_private
, tmp
);
511 sipe_backend_notify_error(SIPE_CORE_PUBLIC
,
512 _("Failed to join the conference"),
513 _("Incomplete conference information provided"));
517 /** Create new session with Focus URI */
519 sipe_conf_create(struct sipe_core_private
*sipe_private
,
520 struct sipe_chat_session
*chat_session
,
521 const gchar
*focus_uri
)
523 /* addUser request to the focus.
525 * focus_URI, from, endpoint_GUID
527 static const gchar CCCP_ADD_USER
[] =
529 "<conferenceKeys confEntity=\"%s\"/>"
530 "<ci:user xmlns:ci=\"urn:ietf:params:xml:ns:conference-info\" entity=\"%s\">"
532 "<ci:entry>attendee</ci:entry>"
534 "<ci:endpoint entity=\"{%s}\" "
535 "xmlns:msci=\"http://schemas.microsoft.com/rtc/2005/08/confinfoextensions\"/>"
540 struct sip_session
*session
= sipe_session_add_chat(sipe_private
,
545 session
->focus_dialog
= g_new0(struct sip_dialog
, 1);
546 session
->focus_dialog
->callid
= gencallid();
547 session
->focus_dialog
->with
= g_strdup(session
->chat_session
->id
);
548 session
->focus_dialog
->endpoint_GUID
= rand_guid();
549 session
->focus_dialog
->ourtag
= gentag();
551 self
= sip_uri_self(sipe_private
);
552 session
->focus_dialog
->outgoing_invite
=
553 cccp_request(sipe_private
, "INVITE",
554 session
->focus_dialog
->with
, session
->focus_dialog
,
555 process_invite_conf_focus_response
,
557 session
->focus_dialog
->with
, self
,
558 session
->focus_dialog
->endpoint_GUID
);
560 /* Rejoin existing session? */
562 SIPE_DEBUG_INFO("sipe_conf_create: rejoin '%s' (%s)",
565 sipe_backend_chat_rejoin(SIPE_CORE_PUBLIC
,
566 chat_session
->backend
,
568 chat_session
->title
);
575 /** Modify User Role */
577 sipe_conf_modify_user_role(struct sipe_core_private
*sipe_private
,
578 struct sip_session
*session
,
581 /* modifyUserRoles request to the focus. Makes user a leader.
586 static const gchar CCCP_MODIFY_USER_ROLES
[] =
588 "<userKeys confEntity=\"%s\" userEntity=\"%s\"/>"
589 "<user-roles xmlns=\"urn:ietf:params:xml:ns:conference-info\">"
590 "<entry>presenter</entry>"
592 "</modifyUserRoles>";
594 if (!session
->focus_dialog
|| !session
->focus_dialog
->is_established
) {
595 SIPE_DEBUG_INFO_NOFORMAT("sipe_conf_modify_user_role: no dialog with focus, exiting.");
599 cccp_request(sipe_private
, "INFO", session
->focus_dialog
->with
,
600 session
->focus_dialog
, NULL
,
601 CCCP_MODIFY_USER_ROLES
,
602 session
->focus_dialog
->with
, who
);
606 * Check conference lock status
608 sipe_chat_lock_status
sipe_core_chat_lock_status(struct sipe_core_public
*sipe_public
,
609 struct sipe_chat_session
*chat_session
)
611 struct sipe_core_private
*sipe_private
= SIPE_CORE_PRIVATE
;
612 sipe_chat_lock_status status
= SIPE_CHAT_LOCK_STATUS_NOT_ALLOWED
;
615 (chat_session
->type
== SIPE_CHAT_TYPE_CONFERENCE
)) {
616 struct sip_session
*session
= sipe_session_find_chat(sipe_private
,
619 gchar
*self
= sip_uri_self(sipe_private
);
621 /* Only operators are allowed to change the lock status */
622 if (sipe_backend_chat_is_operator(chat_session
->backend
, self
)) {
623 status
= session
->locked
?
624 SIPE_CHAT_LOCK_STATUS_LOCKED
:
625 SIPE_CHAT_LOCK_STATUS_UNLOCKED
;
636 * Modify Conference Lock
637 * Sends request to Focus.
638 * INFO method is a carrier of application/cccp+xml
641 sipe_core_chat_modify_lock(struct sipe_core_public
*sipe_public
,
642 struct sipe_chat_session
*chat_session
,
643 const gboolean locked
)
645 /* modifyConferenceLock request to the focus. Locks/unlocks conference.
648 * locked (%s) "true" or "false" values applicable
650 static const gchar CCCP_MODIFY_CONFERENCE_LOCK
[] =
651 "<modifyConferenceLock>"
652 "<conferenceKeys confEntity=\"%s\"/>"
653 "<locked>%s</locked>"
654 "</modifyConferenceLock>";
656 struct sipe_core_private
*sipe_private
= SIPE_CORE_PRIVATE
;
658 struct sip_session
*session
= sipe_session_find_chat(sipe_private
,
661 if (!session
) return;
662 if (!session
->focus_dialog
|| !session
->focus_dialog
->is_established
) {
663 SIPE_DEBUG_INFO_NOFORMAT("sipe_conf_modify_conference_lock: no dialog with focus, exiting.");
667 cccp_request(sipe_private
, "INFO", session
->focus_dialog
->with
,
668 session
->focus_dialog
, NULL
,
669 CCCP_MODIFY_CONFERENCE_LOCK
,
670 session
->focus_dialog
->with
,
671 locked
? "true" : "false");
674 /** Modify Delete User */
676 sipe_conf_delete_user(struct sipe_core_private
*sipe_private
,
677 struct sip_session
*session
,
680 /* deleteUser request to the focus. Removes a user from the conference.
685 static const gchar CCCP_DELETE_USER
[] =
687 "<userKeys confEntity=\"%s\" userEntity=\"%s\"/>"
690 if (!session
->focus_dialog
|| !session
->focus_dialog
->is_established
) {
691 SIPE_DEBUG_INFO_NOFORMAT("sipe_conf_delete_user: no dialog with focus, exiting.");
695 cccp_request(sipe_private
, "INFO", session
->focus_dialog
->with
,
696 session
->focus_dialog
, NULL
,
698 session
->focus_dialog
->with
, who
);
702 sipe_conf_announce_audio_mute_state(struct sipe_core_private
*sipe_private
,
703 struct sip_session
*session
,
706 // See [MS-CONFAV] 3.2.5.4 and 4.3
707 static const gchar CCCP_MODIFY_ENDPOINT_MEDIA
[] =
708 "<modifyEndpointMedia mscp:mcuUri=\"%s\""
709 " xmlns:mscp=\"http://schemas.microsoft.com/rtc/2005/08/cccpextensions\">"
710 "<mediaKeys confEntity=\"%s\" userEntity=\"%s\""
711 " endpointEntity=\"%s\" mediaId=\"%d\"/>"
713 " xmlns:ci=\"urn:ietf:params:xml:ns:conference-info\" id=\"%d\">"
714 "<ci:type>audio</ci:type>"
715 "<ci:status>%s</ci:status>"
716 "<media-ingress-filter"
717 " xmlns=\"http://schemas.microsoft.com/rtc/2005/08/confinfoextensions\">"
719 "</media-ingress-filter>"
721 "</modifyEndpointMedia>";
723 gchar
*mcu_uri
= sipe_conf_build_uri(session
->focus_dialog
->with
,
725 gchar
*self
= sip_uri_self(sipe_private
);
727 cccp_request(sipe_private
, "INFO", session
->focus_dialog
->with
,
728 session
->focus_dialog
, NULL
,
729 CCCP_MODIFY_ENDPOINT_MEDIA
,
730 mcu_uri
, session
->focus_dialog
->with
, self
,
731 session
->audio_video_entity
,
732 session
->audio_media_id
, session
->audio_media_id
,
733 is_muted
? "recvonly" : "sendrecv",
734 is_muted
? "block" : "unblock");
740 /** Invite counterparty to join conference callback */
742 process_invite_conf_response(struct sipe_core_private
*sipe_private
,
744 SIPE_UNUSED_PARAMETER
struct transaction
*trans
)
746 struct sip_dialog
*dialog
= g_new0(struct sip_dialog
, 1);
748 dialog
->callid
= g_strdup(sipmsg_find_header(msg
, "Call-ID"));
749 dialog
->cseq
= sipmsg_parse_cseq(msg
);
750 dialog
->with
= parse_from(sipmsg_find_header(msg
, "To"));
751 sipe_dialog_parse(dialog
, msg
, TRUE
);
753 if (msg
->response
>= 200) {
754 /* send ACK to counterparty */
756 sip_transport_ack(sipe_private
, dialog
);
757 dialog
->outgoing_invite
= NULL
;
758 dialog
->is_established
= TRUE
;
761 if (msg
->response
>= 400) {
762 SIPE_DEBUG_INFO("process_invite_conf_response: INVITE response is not 200. Failed to invite %s.", dialog
->with
);
763 /* @TODO notify user of failure to invite counterparty */
764 sipe_dialog_free(dialog
);
768 if (msg
->response
>= 200) {
769 struct sip_session
*session
= sipe_session_find_im(sipe_private
, dialog
->with
);
770 struct sip_dialog
*im_dialog
= sipe_dialog_find(session
, dialog
->with
);
772 /* close IM session to counterparty */
774 sip_transport_bye(sipe_private
, im_dialog
);
775 sipe_dialog_remove(session
, dialog
->with
);
779 sipe_dialog_free(dialog
);
784 * Invites counterparty to join conference.
787 sipe_invite_conf(struct sipe_core_private
*sipe_private
,
788 struct sip_session
*session
,
794 struct sip_dialog
*dialog
= NULL
;
796 /* It will be short lived special dialog.
797 * Will not be stored in session.
799 dialog
= g_new0(struct sip_dialog
, 1);
800 dialog
->callid
= gencallid();
801 dialog
->with
= g_strdup(who
);
802 dialog
->ourtag
= gentag();
804 contact
= get_contact(sipe_private
);
805 hdr
= g_strdup_printf(
806 "Supported: ms-sender\r\n"
808 "Content-Type: application/ms-conf-invite+xml\r\n",
812 body
= g_strdup_printf(
813 SIPE_SEND_CONF_INVITE
,
814 session
->chat_session
->id
,
815 session
->subject
? session
->subject
: ""
818 sip_transport_invite(sipe_private
,
822 process_invite_conf_response
);
824 sipe_dialog_free(dialog
);
829 /** Create conference callback */
831 process_conf_add_response(struct sipe_core_private
*sipe_private
,
833 struct transaction
*trans
)
835 if (msg
->response
>= 400) {
836 SIPE_DEBUG_INFO_NOFORMAT("process_conf_add_response: SERVICE response is not 200. Failed to create conference.");
837 /* @TODO notify user of failure to create conference */
840 if (msg
->response
== 200) {
841 sipe_xml
*xn_response
= sipe_xml_parse(msg
->body
, msg
->bodylen
);
842 if (sipe_strequal("success", sipe_xml_attribute(xn_response
, "code")))
844 gchar
*who
= trans
->payload
->data
;
845 const sipe_xml
*xn_conference_info
= sipe_xml_child(xn_response
, "addConference/conference-info");
846 struct sip_session
*session
= sipe_conf_create(sipe_private
,
848 sipe_xml_attribute(xn_conference_info
,
851 SIPE_DEBUG_INFO("process_conf_add_response: session->focus_uri=%s",
852 session
->chat_session
->id
);
854 session
->pending_invite_queue
= sipe_utils_slist_insert_unique_sorted(session
->pending_invite_queue
,
856 (GCompareFunc
)strcmp
,
859 sipe_xml_free(xn_response
);
866 * Creates conference.
869 sipe_conf_add(struct sipe_core_private
*sipe_private
,
872 gchar
*conference_id
;
873 struct transaction
*trans
;
874 time_t expiry
= time(NULL
) + 7*60*60; /* 7 hours */
877 /* addConference request to the focus factory.
879 * conference_id (%s) Ex.: 8386E6AEAAA41E4AA6627BA76D43B6D1
880 * expiry_time (%s) Ex.: 2009-07-13T17:57:09Z
881 * conference_view (%s) Ex.: <msci:entity-view entity="chat"/>
883 static const gchar CCCP_ADD_CONFERENCE
[] =
885 "<ci:conference-info xmlns:ci=\"urn:ietf:params:xml:ns:conference-info\" "
887 "xmlns:msci=\"http://schemas.microsoft.com/rtc/2005/08/confinfoextensions\">"
888 "<ci:conference-description>"
890 "<msci:conference-id>%s</msci:conference-id>"
891 "<msci:expiry-time>%s</msci:expiry-time>"
892 "<msci:admission-policy>openAuthenticated</msci:admission-policy>"
893 "</ci:conference-description>"
894 "<msci:conference-view>%s</msci:conference-view>"
895 "</ci:conference-info>"
898 static const gchar
*DESIRED_MCU_TYPES
[] = {
904 "applicationsharing",
909 GString
*conference_view
= g_string_new("");
912 for (type
= DESIRED_MCU_TYPES
; *type
; ++type
) {
913 if (sipe_conf_supports_mcu_type(sipe_private
, *type
)) {
914 g_string_append(conference_view
, "<msci:entity-view entity=\"");
915 g_string_append(conference_view
, *type
);
916 g_string_append(conference_view
, "\"/>");
920 expiry_time
= sipe_utils_time_to_str(expiry
);
921 conference_id
= genconfid();
922 trans
= cccp_request(sipe_private
, "SERVICE", sipe_private
->focus_factory_uri
,
923 NULL
, process_conf_add_response
,
925 conference_id
, expiry_time
, conference_view
->str
);
926 g_free(conference_id
);
928 g_string_free(conference_view
, TRUE
);
931 struct transaction_payload
*payload
= g_new0(struct transaction_payload
, 1);
933 payload
->destroy
= g_free
;
934 payload
->data
= g_strdup(who
);
935 trans
->payload
= payload
;
940 accept_incoming_invite_conf(struct sipe_core_private
*sipe_private
,
945 struct sip_session
*session
;
946 gchar
*newTag
= gentag();
947 const gchar
*oldHeader
= sipmsg_find_header(msg
, "To");
950 newHeader
= g_strdup_printf("%s;tag=%s", oldHeader
, newTag
);
952 sipmsg_remove_header_now(msg
, "To");
953 sipmsg_add_header_now(msg
, "To", newHeader
);
956 /* acknowledge invite */
957 sip_transport_response(sipe_private
, msg
, 200, "OK", NULL
);
959 /* add self to conf */
960 session
= sipe_conf_create(sipe_private
, NULL
, focus_uri
);
961 session
->is_call
= audio
;
964 struct conf_accept_ctx
{
967 struct sipe_user_ask_ctx
*ask_ctx
;
969 SipeUserAskCb accept_cb
;
970 SipeUserAskCb decline_cb
;
976 conf_accept_ctx_free(struct conf_accept_ctx
*ctx
)
978 g_return_if_fail(ctx
!= NULL
);
980 sipmsg_free(ctx
->msg
);
981 g_free(ctx
->focus_uri
);
986 conf_accept_cb(struct sipe_core_private
*sipe_private
, struct conf_accept_ctx
*ctx
)
988 accept_incoming_invite_conf(sipe_private
, ctx
->focus_uri
, TRUE
, ctx
->msg
);
992 conf_decline_cb(struct sipe_core_private
*sipe_private
, struct conf_accept_ctx
*ctx
)
994 sip_transport_response(sipe_private
,
996 603, "Decline", NULL
);
1000 sipe_conf_cancel_unaccepted(struct sipe_core_private
*sipe_private
,
1003 const gchar
*callid1
= msg
? sipmsg_find_header(msg
, "Call-ID") : NULL
;
1004 GSList
*it
= sipe_private
->sessions_to_accept
;
1006 struct conf_accept_ctx
*ctx
= it
->data
;
1007 const gchar
*callid2
= NULL
;
1009 if (msg
&& ctx
->msg
)
1010 callid2
= sipmsg_find_header(ctx
->msg
, "Call-ID");
1012 if (sipe_strequal(callid1
, callid2
)) {
1016 sip_transport_response(sipe_private
, ctx
->msg
,
1017 487, "Request Terminated", NULL
);
1020 sip_transport_response(sipe_private
, msg
, 200, "OK", NULL
);
1022 sipe_user_close_ask(ctx
->ask_ctx
);
1023 conf_accept_ctx_free(ctx
);
1028 sipe_private
->sessions_to_accept
=
1029 g_slist_delete_link(sipe_private
->sessions_to_accept
, tmp
);
1039 accept_invitation_cb(struct sipe_core_private
*sipe_private
, gpointer data
)
1041 struct conf_accept_ctx
*ctx
= data
;
1043 sipe_private
->sessions_to_accept
=
1044 g_slist_remove(sipe_private
->sessions_to_accept
, ctx
);
1046 if (ctx
->accept_cb
) {
1047 ctx
->accept_cb(sipe_private
, ctx
);
1050 conf_accept_ctx_free(ctx
);
1054 decline_invitation_cb(struct sipe_core_private
*sipe_private
, gpointer data
)
1056 struct conf_accept_ctx
*ctx
= data
;
1058 sipe_private
->sessions_to_accept
=
1059 g_slist_remove(sipe_private
->sessions_to_accept
, ctx
);
1061 if (ctx
->decline_cb
) {
1062 ctx
->decline_cb(sipe_private
, ctx
);
1065 conf_accept_ctx_free(ctx
);
1069 ask_accept_invitation(struct sipe_core_private
*sipe_private
,
1070 const gchar
*focus_uri
,
1071 const gchar
*question
,
1073 SipeUserAskCb accept_cb
,
1074 SipeUserAskCb decline_cb
,
1079 gchar
*question_str
;
1080 struct conf_accept_ctx
*ctx
;
1082 parts
= g_strsplit(focus_uri
, ";", 2);
1083 alias
= sipe_buddy_get_alias(sipe_private
, parts
[0]);
1085 question_str
= g_strdup_printf("%s %s", alias
? alias
: parts
[0], question
);
1090 ctx
= g_new0(struct conf_accept_ctx
, 1);
1091 sipe_private
->sessions_to_accept
=
1092 g_slist_append(sipe_private
->sessions_to_accept
, ctx
);
1094 ctx
->focus_uri
= g_strdup(focus_uri
);
1095 ctx
->msg
= msg
? sipmsg_copy(msg
) : NULL
;
1096 ctx
->accept_cb
= accept_cb
;
1097 ctx
->decline_cb
= decline_cb
;
1098 ctx
->user_data
= user_data
;
1099 ctx
->ask_ctx
= sipe_user_ask(sipe_private
, question_str
,
1100 _("Accept"), accept_invitation_cb
,
1101 _("Decline"), decline_invitation_cb
,
1104 g_free(question_str
);
1108 ask_accept_voice_conference(struct sipe_core_private
*sipe_private
,
1109 const gchar
*focus_uri
,
1111 SipeUserAskCb accept_cb
,
1112 SipeUserAskCb decline_cb
)
1115 const gchar
*novv_note
;
1120 novv_note
= _("\n\nAs this client was not compiled with voice call "
1121 "support, if you accept, you will be able to contact "
1122 "the other participants only via IM session.");
1125 question
= g_strdup_printf(_("wants to invite you "
1126 "to a conference call%s"), novv_note
);
1128 ask_accept_invitation(sipe_private
, focus_uri
, question
, msg
,
1129 accept_cb
, decline_cb
, NULL
);
1135 process_incoming_invite_conf(struct sipe_core_private
*sipe_private
,
1138 sipe_xml
*xn_conferencing
= sipe_xml_parse(msg
->body
, msg
->bodylen
);
1139 const sipe_xml
*xn_focus_uri
= sipe_xml_child(xn_conferencing
, "focus-uri");
1140 const sipe_xml
*xn_audio
= sipe_xml_child(xn_conferencing
, "audio");
1141 gchar
*focus_uri
= sipe_xml_data(xn_focus_uri
);
1142 gboolean audio
= sipe_strequal(sipe_xml_attribute(xn_audio
, "available"), "true");
1144 sipe_xml_free(xn_conferencing
);
1146 SIPE_DEBUG_INFO("We have received invitation to Conference. Focus URI=%s", focus_uri
);
1149 sip_transport_response(sipe_private
, msg
, 180, "Ringing", NULL
);
1150 ask_accept_voice_conference(sipe_private
, focus_uri
, msg
,
1151 (SipeUserAskCb
) conf_accept_cb
,
1152 (SipeUserAskCb
) conf_decline_cb
);
1155 accept_incoming_invite_conf(sipe_private
, focus_uri
, FALSE
, msg
);
1164 process_conference_av_endpoint(const sipe_xml
*endpoint
,
1165 const gchar
*user_uri
,
1166 const gchar
*self_uri
,
1167 struct sip_session
*session
)
1169 const sipe_xml
*media
;
1170 const gchar
*new_entity
;
1172 if (!sipe_strequal(user_uri
, self_uri
)) {
1173 /* We are interested only in our own endpoint data. */
1177 new_entity
= sipe_xml_attribute(endpoint
, "entity");
1178 if (!sipe_strequal(session
->audio_video_entity
, new_entity
)) {
1179 g_free(session
->audio_video_entity
);
1180 session
->audio_video_entity
= g_strdup(new_entity
);
1183 session
->audio_media_id
= 0;
1185 media
= sipe_xml_child(endpoint
, "media");
1186 for (; media
; media
= sipe_xml_twin(media
)) {
1187 gchar
*type
= sipe_xml_data(sipe_xml_child(media
, "type"));
1189 if (sipe_strequal(type
, "audio")) {
1190 session
->audio_media_id
=
1191 sipe_xml_int_attribute(media
, "id", 0);
1196 if (session
->audio_media_id
!= 0) {
1203 call_accept_cb(struct sipe_core_private
*sipe_private
, struct conf_accept_ctx
*ctx
)
1205 struct sip_session
*session
;
1206 session
= sipe_session_find_conference(sipe_private
, ctx
->focus_uri
);
1209 sipe_core_media_connect_conference(SIPE_CORE_PUBLIC
,
1210 session
->chat_session
);
1214 #ifdef HAVE_APPSHARE
1216 sipe_core_conf_is_viewing_appshare(struct sipe_core_public
*sipe_public
,
1217 struct sipe_chat_session
*chat_session
)
1223 mcu_uri
= sipe_conf_build_uri(chat_session
->id
, "applicationsharing");
1224 calls
= g_hash_table_get_values(SIPE_CORE_PRIVATE
->media_calls
);
1226 for (; calls
; calls
= g_list_delete_link(calls
, calls
)) {
1227 struct sipe_media_call
*call
= calls
->data
;
1228 if (sipe_strequal(call
->with
, mcu_uri
)) {
1235 if (calls
!= NULL
) {
1245 process_conference_appshare_endpoint(const sipe_xml
*endpoint
)
1247 gboolean presentation_added
= FALSE
;
1248 const sipe_xml
*media
;
1250 for (media
= sipe_xml_child(endpoint
, "media");
1251 media
&& !presentation_added
;
1252 media
= sipe_xml_twin(media
)) {
1257 type
= sipe_xml_data(sipe_xml_child(media
, "type"));
1258 media_state
= sipe_xml_data(sipe_xml_child(media
, "media-state"));
1259 status
= sipe_xml_data(sipe_xml_child(media
, "status"));
1261 if (sipe_strequal(type
, "applicationsharing") &&
1262 sipe_strequal(media_state
, "connected") &&
1263 sipe_strequal(status
, "sendonly")) {
1264 presentation_added
= TRUE
;
1268 g_free(media_state
);
1272 return(presentation_added
);
1274 #endif // HAVE_APPSHARE
1278 sipe_process_conference(struct sipe_core_private
*sipe_private
,
1281 sipe_xml
*xn_conference_info
;
1282 const sipe_xml
*node
;
1283 const sipe_xml
*xn_subject
;
1284 const gchar
*focus_uri
;
1285 struct sip_session
*session
;
1286 gboolean just_joined
= FALSE
;
1288 gboolean audio_was_added
= FALSE
;
1289 #ifdef HAVE_APPSHARE
1290 gboolean presentation_was_added
= FALSE
;
1294 if (msg
->response
!= 0 && msg
->response
!= 200) return;
1296 if (msg
->bodylen
== 0 || msg
->body
== NULL
|| !sipe_strequal(sipmsg_find_header(msg
, "Event"), "conference")) return;
1298 xn_conference_info
= sipe_xml_parse(msg
->body
, msg
->bodylen
);
1299 if (!xn_conference_info
) return;
1301 focus_uri
= sipe_xml_attribute(xn_conference_info
, "entity");
1302 session
= sipe_session_find_conference(sipe_private
, focus_uri
);
1305 SIPE_DEBUG_INFO("sipe_process_conference: unable to find conf session with focus=%s", focus_uri
);
1309 if (!session
->chat_session
->backend
) {
1310 gchar
*self
= sip_uri_self(sipe_private
);
1313 session
->chat_session
->backend
= sipe_backend_chat_create(SIPE_CORE_PUBLIC
,
1314 session
->chat_session
,
1315 session
->chat_session
->title
,
1318 /* @TODO ask for full state (re-subscribe) if it was a partial one -
1319 * this is to obtain full list of conference participants.
1325 if ((xn_subject
= sipe_xml_child(xn_conference_info
, "conference-description/subject"))) {
1326 g_free(session
->subject
);
1327 session
->subject
= sipe_xml_data(xn_subject
);
1328 sipe_backend_chat_topic(session
->chat_session
->backend
, session
->subject
);
1329 SIPE_DEBUG_INFO("sipe_process_conference: subject=%s", session
->subject
? session
->subject
: "");
1333 if (!session
->im_mcu_uri
) {
1334 for (node
= sipe_xml_child(xn_conference_info
, "conference-description/conf-uris/entry");
1336 node
= sipe_xml_twin(node
))
1338 gchar
*purpose
= sipe_xml_data(sipe_xml_child(node
, "purpose"));
1340 if (sipe_strequal("chat", purpose
)) {
1342 session
->im_mcu_uri
= sipe_xml_data(sipe_xml_child(node
, "uri"));
1343 SIPE_DEBUG_INFO("sipe_process_conference: im_mcu_uri=%s", session
->im_mcu_uri
);
1351 if (!session
->chat_session
->organizer
) {
1352 node
= sipe_xml_child(xn_conference_info
, "conference-description/organizer/display-name");
1354 session
->chat_session
->organizer
= sipe_xml_data(node
);
1359 if (!session
->chat_session
->join_url
) {
1360 node
= sipe_xml_child(xn_conference_info
, "conference-description/join-url");
1362 session
->chat_session
->join_url
= sipe_xml_data(node
);
1366 /* dial-in conference id */
1367 if (!session
->chat_session
->dial_in_conf_id
) {
1368 node
= sipe_xml_child(xn_conference_info
, "conference-description/pstn-access/id");
1370 session
->chat_session
->dial_in_conf_id
= sipe_xml_data(node
);
1375 for (node
= sipe_xml_child(xn_conference_info
, "users/user"); node
; node
= sipe_xml_twin(node
)) {
1376 const gchar
*user_uri
= sipe_xml_attribute(node
, "entity");
1377 const gchar
*state
= sipe_xml_attribute(node
, "state");
1378 gchar
*role
= sipe_xml_data(sipe_xml_child(node
, "roles/entry"));
1379 gboolean is_operator
= sipe_strequal(role
, "presenter");
1380 gboolean is_in_im_mcu
= FALSE
;
1381 gchar
*self
= sip_uri_self(sipe_private
);
1383 if (sipe_strequal("deleted", state
)) {
1384 if (sipe_backend_chat_find(session
->chat_session
->backend
, user_uri
)) {
1385 sipe_backend_chat_remove(session
->chat_session
->backend
,
1390 const sipe_xml
*endpoint
;
1391 for (endpoint
= sipe_xml_child(node
, "endpoint"); endpoint
; endpoint
= sipe_xml_twin(endpoint
)) {
1392 const gchar
*session_type
;
1393 gchar
*status
= sipe_xml_data(sipe_xml_child(endpoint
, "status"));
1394 gboolean connected
= sipe_strequal("connected", status
);
1400 session_type
= sipe_xml_attribute(endpoint
, "session-type");
1402 if (sipe_strequal("chat", session_type
)) {
1403 is_in_im_mcu
= TRUE
;
1404 if (!sipe_backend_chat_find(session
->chat_session
->backend
, user_uri
)) {
1405 sipe_backend_chat_add(session
->chat_session
->backend
,
1407 !just_joined
&& g_ascii_strcasecmp(user_uri
, self
));
1410 sipe_backend_chat_operator(session
->chat_session
->backend
,
1413 } else if (sipe_strequal("audio-video", session_type
)) {
1415 if (!session
->is_call
)
1416 audio_was_added
= TRUE
;
1417 process_conference_av_endpoint(endpoint
,
1422 } else if (sipe_strequal("applicationsharing", session_type
)) {
1423 #ifdef HAVE_APPSHARE
1424 if (!sipe_core_conf_is_viewing_appshare(SIPE_CORE_PUBLIC
,
1425 session
->chat_session
)) {
1426 presentation_was_added
= process_conference_appshare_endpoint(endpoint
);
1431 if (!is_in_im_mcu
) {
1432 if (sipe_backend_chat_find(session
->chat_session
->backend
, user_uri
)) {
1433 sipe_backend_chat_remove(session
->chat_session
->backend
,
1443 if (audio_was_added
) {
1444 session
->is_call
= TRUE
;
1445 ask_accept_voice_conference(sipe_private
, focus_uri
, NULL
,
1446 (SipeUserAskCb
) call_accept_cb
,
1449 #ifdef HAVE_APPSHARE
1450 if (presentation_was_added
) {
1451 sipe_core_appshare_connect_conference(SIPE_CORE_PUBLIC
,
1452 session
->chat_session
,
1458 /* entity-view, locked */
1459 for (node
= sipe_xml_child(xn_conference_info
, "conference-view/entity-view");
1461 node
= sipe_xml_twin(node
)) {
1463 const sipe_xml
*xn_type
= sipe_xml_child(node
, "entity-state/media/entry/type");
1465 if (xn_type
&& sipe_strequal("chat", (tmp
= sipe_xml_data(xn_type
)))) {
1466 const sipe_xml
*xn_locked
= sipe_xml_child(node
, "entity-state/locked");
1468 gchar
*locked
= sipe_xml_data(xn_locked
);
1469 gboolean prev_locked
= session
->locked
;
1470 session
->locked
= sipe_strequal(locked
, "true");
1471 if (prev_locked
&& !session
->locked
) {
1472 sipe_user_present_info(sipe_private
, session
,
1473 _("This conference is no longer locked. Additional participants can now join."));
1475 if (!prev_locked
&& session
->locked
) {
1476 sipe_user_present_info(sipe_private
, session
,
1477 _("This conference is locked. Nobody else can join the conference while it is locked."));
1480 SIPE_DEBUG_INFO("sipe_process_conference: session->locked=%s",
1481 session
->locked
? "TRUE" : "FALSE");
1487 sipe_xml_free(xn_conference_info
);
1489 if (session
->im_mcu_uri
) {
1490 struct sip_dialog
*dialog
= sipe_dialog_find(session
, session
->im_mcu_uri
);
1492 dialog
= sipe_dialog_add(session
);
1494 dialog
->callid
= g_strdup(session
->callid
);
1495 dialog
->with
= g_strdup(session
->im_mcu_uri
);
1497 /* send INVITE to IM MCU */
1498 sipe_im_invite(sipe_private
, session
, dialog
->with
, NULL
, NULL
, NULL
, FALSE
);
1502 sipe_process_pending_invite_queue(sipe_private
, session
);
1506 sipe_conf_immcu_closed(struct sipe_core_private
*sipe_private
,
1507 struct sip_session
*session
)
1509 sipe_user_present_info(sipe_private
, session
,
1510 _("You have been disconnected from this conference."));
1511 sipe_backend_chat_close(session
->chat_session
->backend
);
1515 conf_session_close(struct sipe_core_private
*sipe_private
,
1516 struct sip_session
*session
)
1519 /* unsubscribe from focus */
1520 sipe_subscribe_conference(sipe_private
,
1521 session
->chat_session
->id
, TRUE
);
1523 if (session
->focus_dialog
) {
1524 /* send BYE to focus */
1525 sip_transport_bye(sipe_private
, session
->focus_dialog
);
1531 sipe_process_imdn(struct sipe_core_private
*sipe_private
,
1534 gchar
*with
= parse_from(sipmsg_find_header(msg
, "From"));
1535 const gchar
*callid
= sipmsg_find_header(msg
, "Call-ID");
1536 static struct sip_session
*session
;
1538 const sipe_xml
*node
;
1542 session
= sipe_session_find_chat_or_im(sipe_private
, callid
, with
);
1544 SIPE_DEBUG_INFO("sipe_process_imdn: unable to find conf session with callid=%s", callid
);
1549 xn_imdn
= sipe_xml_parse(msg
->body
, msg
->bodylen
);
1550 message_id
= sipe_xml_data(sipe_xml_child(xn_imdn
, "message-id"));
1552 message
= g_hash_table_lookup(session
->conf_unconfirmed_messages
, message_id
);
1555 for (node
= sipe_xml_child(xn_imdn
, "recipient"); node
; node
= sipe_xml_twin(node
)) {
1556 gchar
*tmp
= parse_from(sipe_xml_attribute(node
, "uri"));
1557 gchar
*uri
= parse_from(tmp
);
1558 gchar
*status
= sipe_xml_data(sipe_xml_child(node
, "status"));
1559 guint error
= status
? g_ascii_strtoull(status
, NULL
, 10) : 0;
1560 /* default to error if missing or conversion failed */
1561 if ((error
== 0) || (error
>= 300))
1562 sipe_user_present_message_undelivered(sipe_private
,
1573 sipe_xml_free(xn_imdn
);
1575 g_hash_table_remove(session
->conf_unconfirmed_messages
, message_id
);
1576 SIPE_DEBUG_INFO("sipe_process_imdn: removed message %s from conf_unconfirmed_messages(count=%d)",
1577 message_id
, g_hash_table_size(session
->conf_unconfirmed_messages
));
1582 void sipe_core_conf_make_leader(struct sipe_core_public
*sipe_public
,
1584 const gchar
*buddy_name
)
1586 struct sipe_core_private
*sipe_private
= SIPE_CORE_PRIVATE
;
1587 struct sipe_chat_session
*chat_session
= parameter
;
1588 struct sip_session
*session
;
1590 SIPE_DEBUG_INFO("sipe_core_conf_make_leader: chat_title=%s",
1591 chat_session
->title
);
1593 session
= sipe_session_find_chat(sipe_private
, chat_session
);
1594 sipe_conf_modify_user_role(sipe_private
, session
, buddy_name
);
1597 void sipe_core_conf_remove_from(struct sipe_core_public
*sipe_public
,
1599 const gchar
*buddy_name
)
1601 struct sipe_core_private
*sipe_private
= SIPE_CORE_PRIVATE
;
1602 struct sipe_chat_session
*chat_session
= parameter
;
1603 struct sip_session
*session
;
1605 SIPE_DEBUG_INFO("sipe_core_conf_remove_from: chat_title=%s",
1606 chat_session
->title
);
1608 session
= sipe_session_find_chat(sipe_private
, chat_session
);
1609 sipe_conf_delete_user(sipe_private
, session
, buddy_name
);
1613 sipe_conf_build_uri(const gchar
*focus_uri
, const gchar
*session_type
)
1615 gchar
**parts
= g_strsplit(focus_uri
, ":focus:", 2);
1616 gchar
*result
= NULL
;
1618 if (g_strv_length(parts
) == 2) {
1619 result
= g_strconcat(parts
[0], ":", session_type
, ":", parts
[1],
1628 access_numbers_info(struct sipe_core_public
*sipe_public
)
1630 GString
*result
= g_string_new("");
1631 GList
*keys
= g_hash_table_get_keys(SIPE_CORE_PRIVATE
->access_numbers
);
1632 keys
= g_list_sort(keys
, (GCompareFunc
)g_strcmp0
);
1634 for (; keys
; keys
= g_list_delete_link(keys
, keys
)) {
1636 value
= g_hash_table_lookup(SIPE_CORE_PRIVATE
->access_numbers
,
1639 g_string_append(result
, keys
->data
);
1640 g_string_append(result
, " ");
1641 g_string_append(result
, value
);
1642 g_string_append(result
, "<br/>");
1645 return g_string_free(result
, FALSE
);
1649 sipe_core_conf_entry_info(struct sipe_core_public
*sipe_public
,
1650 struct sipe_chat_session
*chat_session
)
1652 gchar
*access_info
= access_numbers_info(sipe_public
);
1653 gchar
*result
= g_strdup_printf(
1654 "<b><font size=\"+1\">%s</font></b><br/>"
1655 "<b>%s:</b> %s<br/>"
1656 "<b>%s:</b> %s<br/>"
1661 "<b>%s:</b> %s<br/>"
1663 "<b><font size=\"+1\">%s</font></b><br/>"
1667 SIPE_CORE_PRIVATE
->default_access_number
? SIPE_CORE_PRIVATE
->default_access_number
: "",
1669 chat_session
->dial_in_conf_id
? chat_session
->dial_in_conf_id
: "",
1671 chat_session
->join_url
? chat_session
->join_url
: "",
1673 chat_session
->organizer
? chat_session
->organizer
: "",
1674 _("Alternative dial-in numbers"),
1677 g_free(access_info
);