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 sipe_strcompare
) != 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 if (!(g_str_has_prefix(uri
, "https://") ||
434 g_str_has_prefix(uri
, "http://")))
437 /* URL points to a HTML page with the conference focus URI */
438 return(sipe_http_request_get(sipe_private
,
441 sipe_conf_lync_url_cb
,
446 static void sipe_conf_uri_error(struct sipe_core_private
*sipe_private
,
449 gchar
*error
= g_strdup_printf(_("\"%s\" is not a valid conference URI"),
451 sipe_backend_notify_error(SIPE_CORE_PUBLIC
,
452 _("Failed to join the conference"),
457 void sipe_core_conf_create(struct sipe_core_public
*sipe_public
,
459 const gchar
*organizer
,
460 const gchar
*meeting_id
)
462 struct sipe_core_private
*sipe_private
= SIPE_CORE_PRIVATE
;
464 /* SIP URI or HTTP URL */
466 gchar
*uri_ue
= sipe_utils_uri_unescape(uri
);
468 SIPE_DEBUG_INFO("sipe_core_conf_create: URI '%s' unescaped '%s'",
470 uri_ue
? uri_ue
: "<UNDEFINED>");
472 /* takes ownership of "uri_ue" if successful */
473 if (!sipe_conf_check_for_lync_url(sipe_private
, uri_ue
)) {
474 gchar
*focus_uri
= parse_ocs_focus_uri(uri_ue
);
477 sipe_conf_create(sipe_private
, NULL
, focus_uri
);
480 sipe_conf_uri_error(sipe_private
, uri
);
485 /* Organizer email and meeting ID */
486 } else if (organizer
&& meeting_id
) {
487 gchar
*tmp
= g_strdup_printf("sip:%s;gruu;opaque=app:conf:focus:id:%s",
488 organizer
, meeting_id
);
489 gchar
*focus_uri
= parse_ocs_focus_uri(tmp
);
491 SIPE_DEBUG_INFO("sipe_core_conf_create: organizer '%s' meeting ID '%s'",
496 sipe_conf_create(sipe_private
, NULL
, focus_uri
);
499 sipe_conf_uri_error(sipe_private
, tmp
);
503 sipe_backend_notify_error(SIPE_CORE_PUBLIC
,
504 _("Failed to join the conference"),
505 _("Incomplete conference information provided"));
509 /** Create new session with Focus URI */
511 sipe_conf_create(struct sipe_core_private
*sipe_private
,
512 struct sipe_chat_session
*chat_session
,
513 const gchar
*focus_uri
)
515 /* addUser request to the focus.
517 * focus_URI, from, endpoint_GUID
519 static const gchar CCCP_ADD_USER
[] =
521 "<conferenceKeys confEntity=\"%s\"/>"
522 "<ci:user xmlns:ci=\"urn:ietf:params:xml:ns:conference-info\" entity=\"%s\">"
524 "<ci:entry>attendee</ci:entry>"
526 "<ci:endpoint entity=\"{%s}\" "
527 "xmlns:msci=\"http://schemas.microsoft.com/rtc/2005/08/confinfoextensions\"/>"
532 struct sip_session
*session
= sipe_session_add_chat(sipe_private
,
537 session
->focus_dialog
= g_new0(struct sip_dialog
, 1);
538 session
->focus_dialog
->callid
= gencallid();
539 session
->focus_dialog
->with
= g_strdup(session
->chat_session
->id
);
540 session
->focus_dialog
->endpoint_GUID
= rand_guid();
541 session
->focus_dialog
->ourtag
= gentag();
543 self
= sip_uri_self(sipe_private
);
544 session
->focus_dialog
->outgoing_invite
=
545 cccp_request(sipe_private
, "INVITE",
546 session
->focus_dialog
->with
, session
->focus_dialog
,
547 process_invite_conf_focus_response
,
549 session
->focus_dialog
->with
, self
,
550 session
->focus_dialog
->endpoint_GUID
);
552 /* Rejoin existing session? */
554 SIPE_DEBUG_INFO("sipe_conf_create: rejoin '%s' (%s)",
557 sipe_backend_chat_rejoin(SIPE_CORE_PUBLIC
,
558 chat_session
->backend
,
560 chat_session
->title
);
567 /** Modify User Role */
569 sipe_conf_modify_user_role(struct sipe_core_private
*sipe_private
,
570 struct sip_session
*session
,
573 /* modifyUserRoles request to the focus. Makes user a leader.
578 static const gchar CCCP_MODIFY_USER_ROLES
[] =
580 "<userKeys confEntity=\"%s\" userEntity=\"%s\"/>"
581 "<user-roles xmlns=\"urn:ietf:params:xml:ns:conference-info\">"
582 "<entry>presenter</entry>"
584 "</modifyUserRoles>";
586 if (!session
->focus_dialog
|| !session
->focus_dialog
->is_established
) {
587 SIPE_DEBUG_INFO_NOFORMAT("sipe_conf_modify_user_role: no dialog with focus, exiting.");
591 cccp_request(sipe_private
, "INFO", session
->focus_dialog
->with
,
592 session
->focus_dialog
, NULL
,
593 CCCP_MODIFY_USER_ROLES
,
594 session
->focus_dialog
->with
, who
);
598 * Check conference lock status
600 sipe_chat_lock_status
sipe_core_chat_lock_status(struct sipe_core_public
*sipe_public
,
601 struct sipe_chat_session
*chat_session
)
603 struct sipe_core_private
*sipe_private
= SIPE_CORE_PRIVATE
;
604 sipe_chat_lock_status status
= SIPE_CHAT_LOCK_STATUS_NOT_ALLOWED
;
607 (chat_session
->type
== SIPE_CHAT_TYPE_CONFERENCE
)) {
608 struct sip_session
*session
= sipe_session_find_chat(sipe_private
,
611 gchar
*self
= sip_uri_self(sipe_private
);
613 /* Only operators are allowed to change the lock status */
614 if (sipe_backend_chat_is_operator(chat_session
->backend
, self
)) {
615 status
= session
->locked
?
616 SIPE_CHAT_LOCK_STATUS_LOCKED
:
617 SIPE_CHAT_LOCK_STATUS_UNLOCKED
;
628 * Modify Conference Lock
629 * Sends request to Focus.
630 * INFO method is a carrier of application/cccp+xml
633 sipe_core_chat_modify_lock(struct sipe_core_public
*sipe_public
,
634 struct sipe_chat_session
*chat_session
,
635 const gboolean locked
)
637 /* modifyConferenceLock request to the focus. Locks/unlocks conference.
640 * locked (%s) "true" or "false" values applicable
642 static const gchar CCCP_MODIFY_CONFERENCE_LOCK
[] =
643 "<modifyConferenceLock>"
644 "<conferenceKeys confEntity=\"%s\"/>"
645 "<locked>%s</locked>"
646 "</modifyConferenceLock>";
648 struct sipe_core_private
*sipe_private
= SIPE_CORE_PRIVATE
;
650 struct sip_session
*session
= sipe_session_find_chat(sipe_private
,
653 if (!session
) return;
654 if (!session
->focus_dialog
|| !session
->focus_dialog
->is_established
) {
655 SIPE_DEBUG_INFO_NOFORMAT("sipe_conf_modify_conference_lock: no dialog with focus, exiting.");
659 cccp_request(sipe_private
, "INFO", session
->focus_dialog
->with
,
660 session
->focus_dialog
, NULL
,
661 CCCP_MODIFY_CONFERENCE_LOCK
,
662 session
->focus_dialog
->with
,
663 locked
? "true" : "false");
666 /** Modify Delete User */
668 sipe_conf_delete_user(struct sipe_core_private
*sipe_private
,
669 struct sip_session
*session
,
672 /* deleteUser request to the focus. Removes a user from the conference.
677 static const gchar CCCP_DELETE_USER
[] =
679 "<userKeys confEntity=\"%s\" userEntity=\"%s\"/>"
682 if (!session
->focus_dialog
|| !session
->focus_dialog
->is_established
) {
683 SIPE_DEBUG_INFO_NOFORMAT("sipe_conf_delete_user: no dialog with focus, exiting.");
687 cccp_request(sipe_private
, "INFO", session
->focus_dialog
->with
,
688 session
->focus_dialog
, NULL
,
690 session
->focus_dialog
->with
, who
);
694 sipe_conf_announce_audio_mute_state(struct sipe_core_private
*sipe_private
,
695 struct sip_session
*session
,
698 // See [MS-CONFAV] 3.2.5.4 and 4.3
699 static const gchar CCCP_MODIFY_ENDPOINT_MEDIA
[] =
700 "<modifyEndpointMedia mscp:mcuUri=\"%s\""
701 " xmlns:mscp=\"http://schemas.microsoft.com/rtc/2005/08/cccpextensions\">"
702 "<mediaKeys confEntity=\"%s\" userEntity=\"%s\""
703 " endpointEntity=\"%s\" mediaId=\"%d\"/>"
705 " xmlns:ci=\"urn:ietf:params:xml:ns:conference-info\" id=\"%d\">"
706 "<ci:type>audio</ci:type>"
707 "<ci:status>%s</ci:status>"
708 "<media-ingress-filter"
709 " xmlns=\"http://schemas.microsoft.com/rtc/2005/08/confinfoextensions\">"
711 "</media-ingress-filter>"
713 "</modifyEndpointMedia>";
715 gchar
*mcu_uri
= sipe_conf_build_uri(session
->focus_dialog
->with
,
717 gchar
*self
= sip_uri_self(sipe_private
);
719 cccp_request(sipe_private
, "INFO", session
->focus_dialog
->with
,
720 session
->focus_dialog
, NULL
,
721 CCCP_MODIFY_ENDPOINT_MEDIA
,
722 mcu_uri
, session
->focus_dialog
->with
, self
,
723 session
->audio_video_entity
,
724 session
->audio_media_id
, session
->audio_media_id
,
725 is_muted
? "recvonly" : "sendrecv",
726 is_muted
? "block" : "unblock");
732 /** Invite counterparty to join conference callback */
734 process_invite_conf_response(struct sipe_core_private
*sipe_private
,
736 SIPE_UNUSED_PARAMETER
struct transaction
*trans
)
738 struct sip_dialog
*dialog
= g_new0(struct sip_dialog
, 1);
740 dialog
->callid
= g_strdup(sipmsg_find_header(msg
, "Call-ID"));
741 dialog
->cseq
= sipmsg_parse_cseq(msg
);
742 dialog
->with
= parse_from(sipmsg_find_header(msg
, "To"));
743 sipe_dialog_parse(dialog
, msg
, TRUE
);
745 if (msg
->response
>= 200) {
746 /* send ACK to counterparty */
748 sip_transport_ack(sipe_private
, dialog
);
749 dialog
->outgoing_invite
= NULL
;
750 dialog
->is_established
= TRUE
;
753 if (msg
->response
>= 400) {
754 SIPE_DEBUG_INFO("process_invite_conf_response: INVITE response is not 200. Failed to invite %s.", dialog
->with
);
755 /* @TODO notify user of failure to invite counterparty */
756 sipe_dialog_free(dialog
);
760 if (msg
->response
>= 200) {
761 struct sip_session
*session
= sipe_session_find_im(sipe_private
, dialog
->with
);
762 struct sip_dialog
*im_dialog
= sipe_dialog_find(session
, dialog
->with
);
764 /* close IM session to counterparty */
766 sip_transport_bye(sipe_private
, im_dialog
);
767 sipe_dialog_remove(session
, dialog
->with
);
771 sipe_dialog_free(dialog
);
776 * Invites counterparty to join conference.
779 sipe_invite_conf(struct sipe_core_private
*sipe_private
,
780 struct sip_session
*session
,
786 struct sip_dialog
*dialog
= NULL
;
788 /* It will be short lived special dialog.
789 * Will not be stored in session.
791 dialog
= g_new0(struct sip_dialog
, 1);
792 dialog
->callid
= gencallid();
793 dialog
->with
= g_strdup(who
);
794 dialog
->ourtag
= gentag();
796 contact
= get_contact(sipe_private
);
797 hdr
= g_strdup_printf(
798 "Supported: ms-sender\r\n"
800 "Content-Type: application/ms-conf-invite+xml\r\n",
804 body
= g_strdup_printf(
805 SIPE_SEND_CONF_INVITE
,
806 session
->chat_session
->id
,
807 session
->subject
? session
->subject
: ""
810 sip_transport_invite(sipe_private
,
814 process_invite_conf_response
);
816 sipe_dialog_free(dialog
);
821 /** Create conference callback */
823 process_conf_add_response(struct sipe_core_private
*sipe_private
,
825 struct transaction
*trans
)
827 if (msg
->response
>= 400) {
828 SIPE_DEBUG_INFO_NOFORMAT("process_conf_add_response: SERVICE response is not 200. Failed to create conference.");
829 /* @TODO notify user of failure to create conference */
832 if (msg
->response
== 200) {
833 sipe_xml
*xn_response
= sipe_xml_parse(msg
->body
, msg
->bodylen
);
834 if (sipe_strequal("success", sipe_xml_attribute(xn_response
, "code")))
836 gchar
*who
= trans
->payload
->data
;
837 const sipe_xml
*xn_conference_info
= sipe_xml_child(xn_response
, "addConference/conference-info");
838 struct sip_session
*session
= sipe_conf_create(sipe_private
,
840 sipe_xml_attribute(xn_conference_info
,
843 SIPE_DEBUG_INFO("process_conf_add_response: session->focus_uri=%s",
844 session
->chat_session
->id
);
846 session
->pending_invite_queue
= sipe_utils_slist_insert_unique_sorted(session
->pending_invite_queue
,
848 (GCompareFunc
)strcmp
,
851 sipe_xml_free(xn_response
);
858 * Creates conference.
861 sipe_conf_add(struct sipe_core_private
*sipe_private
,
864 gchar
*conference_id
;
865 struct transaction
*trans
;
866 time_t expiry
= time(NULL
) + 7*60*60; /* 7 hours */
869 /* addConference request to the focus factory.
871 * conference_id (%s) Ex.: 8386E6AEAAA41E4AA6627BA76D43B6D1
872 * expiry_time (%s) Ex.: 2009-07-13T17:57:09Z
873 * conference_view (%s) Ex.: <msci:entity-view entity="chat"/>
875 static const gchar CCCP_ADD_CONFERENCE
[] =
877 "<ci:conference-info xmlns:ci=\"urn:ietf:params:xml:ns:conference-info\" "
879 "xmlns:msci=\"http://schemas.microsoft.com/rtc/2005/08/confinfoextensions\">"
880 "<ci:conference-description>"
882 "<msci:conference-id>%s</msci:conference-id>"
883 "<msci:expiry-time>%s</msci:expiry-time>"
884 "<msci:admission-policy>openAuthenticated</msci:admission-policy>"
885 "</ci:conference-description>"
886 "<msci:conference-view>%s</msci:conference-view>"
887 "</ci:conference-info>"
890 static const gchar
*DESIRED_MCU_TYPES
[] = {
896 "applicationsharing",
901 GString
*conference_view
= g_string_new("");
904 for (type
= DESIRED_MCU_TYPES
; *type
; ++type
) {
905 if (sipe_conf_supports_mcu_type(sipe_private
, *type
)) {
906 g_string_append(conference_view
, "<msci:entity-view entity=\"");
907 g_string_append(conference_view
, *type
);
908 g_string_append(conference_view
, "\"/>");
912 expiry_time
= sipe_utils_time_to_str(expiry
);
913 conference_id
= genconfid();
914 trans
= cccp_request(sipe_private
, "SERVICE", sipe_private
->focus_factory_uri
,
915 NULL
, process_conf_add_response
,
917 conference_id
, expiry_time
, conference_view
->str
);
918 g_free(conference_id
);
920 g_string_free(conference_view
, TRUE
);
923 struct transaction_payload
*payload
= g_new0(struct transaction_payload
, 1);
925 payload
->destroy
= g_free
;
926 payload
->data
= g_strdup(who
);
927 trans
->payload
= payload
;
932 accept_incoming_invite_conf(struct sipe_core_private
*sipe_private
,
937 struct sip_session
*session
;
938 gchar
*newTag
= gentag();
939 const gchar
*oldHeader
= sipmsg_find_header(msg
, "To");
942 newHeader
= g_strdup_printf("%s;tag=%s", oldHeader
, newTag
);
944 sipmsg_remove_header_now(msg
, "To");
945 sipmsg_add_header_now(msg
, "To", newHeader
);
948 /* acknowledge invite */
949 sip_transport_response(sipe_private
, msg
, 200, "OK", NULL
);
951 /* add self to conf */
952 session
= sipe_conf_create(sipe_private
, NULL
, focus_uri
);
953 session
->is_call
= audio
;
956 struct conf_accept_ctx
{
959 struct sipe_user_ask_ctx
*ask_ctx
;
961 SipeUserAskCb accept_cb
;
962 SipeUserAskCb decline_cb
;
968 conf_accept_ctx_free(struct conf_accept_ctx
*ctx
)
970 g_return_if_fail(ctx
!= NULL
);
972 sipmsg_free(ctx
->msg
);
973 g_free(ctx
->focus_uri
);
978 conf_accept_cb(struct sipe_core_private
*sipe_private
, struct conf_accept_ctx
*ctx
)
980 accept_incoming_invite_conf(sipe_private
, ctx
->focus_uri
, TRUE
, ctx
->msg
);
984 conf_decline_cb(struct sipe_core_private
*sipe_private
, struct conf_accept_ctx
*ctx
)
986 sip_transport_response(sipe_private
,
988 603, "Decline", NULL
);
992 sipe_conf_cancel_unaccepted(struct sipe_core_private
*sipe_private
,
995 const gchar
*callid1
= msg
? sipmsg_find_header(msg
, "Call-ID") : NULL
;
996 GSList
*it
= sipe_private
->sessions_to_accept
;
998 struct conf_accept_ctx
*ctx
= it
->data
;
999 const gchar
*callid2
= NULL
;
1001 if (msg
&& ctx
->msg
)
1002 callid2
= sipmsg_find_header(ctx
->msg
, "Call-ID");
1004 if (sipe_strequal(callid1
, callid2
)) {
1008 sip_transport_response(sipe_private
, ctx
->msg
,
1009 487, "Request Terminated", NULL
);
1012 sip_transport_response(sipe_private
, msg
, 200, "OK", NULL
);
1014 sipe_user_close_ask(ctx
->ask_ctx
);
1015 conf_accept_ctx_free(ctx
);
1020 sipe_private
->sessions_to_accept
=
1021 g_slist_delete_link(sipe_private
->sessions_to_accept
, tmp
);
1031 accept_invitation_cb(struct sipe_core_private
*sipe_private
, gpointer data
)
1033 struct conf_accept_ctx
*ctx
= data
;
1035 sipe_private
->sessions_to_accept
=
1036 g_slist_remove(sipe_private
->sessions_to_accept
, ctx
);
1038 if (ctx
->accept_cb
) {
1039 ctx
->accept_cb(sipe_private
, ctx
);
1042 conf_accept_ctx_free(ctx
);
1046 decline_invitation_cb(struct sipe_core_private
*sipe_private
, gpointer data
)
1048 struct conf_accept_ctx
*ctx
= data
;
1050 sipe_private
->sessions_to_accept
=
1051 g_slist_remove(sipe_private
->sessions_to_accept
, ctx
);
1053 if (ctx
->decline_cb
) {
1054 ctx
->decline_cb(sipe_private
, ctx
);
1057 conf_accept_ctx_free(ctx
);
1061 ask_accept_invitation(struct sipe_core_private
*sipe_private
,
1062 const gchar
*focus_uri
,
1063 const gchar
*question
,
1065 SipeUserAskCb accept_cb
,
1066 SipeUserAskCb decline_cb
,
1071 gchar
*question_str
;
1072 struct conf_accept_ctx
*ctx
;
1074 parts
= g_strsplit(focus_uri
, ";", 2);
1075 alias
= sipe_buddy_get_alias(sipe_private
, parts
[0]);
1077 question_str
= g_strdup_printf("%s %s", alias
? alias
: parts
[0], question
);
1082 ctx
= g_new0(struct conf_accept_ctx
, 1);
1083 sipe_private
->sessions_to_accept
=
1084 g_slist_append(sipe_private
->sessions_to_accept
, ctx
);
1086 ctx
->focus_uri
= g_strdup(focus_uri
);
1087 ctx
->msg
= msg
? sipmsg_copy(msg
) : NULL
;
1088 ctx
->accept_cb
= accept_cb
;
1089 ctx
->decline_cb
= decline_cb
;
1090 ctx
->user_data
= user_data
;
1091 ctx
->ask_ctx
= sipe_user_ask(sipe_private
, question_str
,
1092 _("Accept"), accept_invitation_cb
,
1093 _("Decline"), decline_invitation_cb
,
1096 g_free(question_str
);
1100 ask_accept_voice_conference(struct sipe_core_private
*sipe_private
,
1101 const gchar
*focus_uri
,
1103 SipeUserAskCb accept_cb
,
1104 SipeUserAskCb decline_cb
)
1107 const gchar
*novv_note
;
1112 novv_note
= _("\n\nAs this client was not compiled with voice call "
1113 "support, if you accept, you will be able to contact "
1114 "the other participants only via IM session.");
1117 question
= g_strdup_printf(_("wants to invite you "
1118 "to a conference call%s"), novv_note
);
1120 ask_accept_invitation(sipe_private
, focus_uri
, question
, msg
,
1121 accept_cb
, decline_cb
, NULL
);
1127 process_incoming_invite_conf(struct sipe_core_private
*sipe_private
,
1130 sipe_xml
*xn_conferencing
= sipe_xml_parse(msg
->body
, msg
->bodylen
);
1131 const sipe_xml
*xn_focus_uri
= sipe_xml_child(xn_conferencing
, "focus-uri");
1132 const sipe_xml
*xn_audio
= sipe_xml_child(xn_conferencing
, "audio");
1133 gchar
*focus_uri
= sipe_xml_data(xn_focus_uri
);
1134 gboolean audio
= sipe_strequal(sipe_xml_attribute(xn_audio
, "available"), "true");
1136 sipe_xml_free(xn_conferencing
);
1138 SIPE_DEBUG_INFO("We have received invitation to Conference. Focus URI=%s", focus_uri
);
1141 sip_transport_response(sipe_private
, msg
, 180, "Ringing", NULL
);
1142 ask_accept_voice_conference(sipe_private
, focus_uri
, msg
,
1143 (SipeUserAskCb
) conf_accept_cb
,
1144 (SipeUserAskCb
) conf_decline_cb
);
1147 accept_incoming_invite_conf(sipe_private
, focus_uri
, FALSE
, msg
);
1156 process_conference_av_endpoint(const sipe_xml
*endpoint
,
1157 const gchar
*user_uri
,
1158 const gchar
*self_uri
,
1159 struct sip_session
*session
)
1161 const sipe_xml
*media
;
1162 const gchar
*new_entity
;
1164 if (!sipe_strequal(user_uri
, self_uri
)) {
1165 /* We are interested only in our own endpoint data. */
1169 new_entity
= sipe_xml_attribute(endpoint
, "entity");
1170 if (!sipe_strequal(session
->audio_video_entity
, new_entity
)) {
1171 g_free(session
->audio_video_entity
);
1172 session
->audio_video_entity
= g_strdup(new_entity
);
1175 session
->audio_media_id
= 0;
1177 media
= sipe_xml_child(endpoint
, "media");
1178 for (; media
; media
= sipe_xml_twin(media
)) {
1179 gchar
*type
= sipe_xml_data(sipe_xml_child(media
, "type"));
1181 if (sipe_strequal(type
, "audio")) {
1182 session
->audio_media_id
=
1183 sipe_xml_int_attribute(media
, "id", 0);
1188 if (session
->audio_media_id
!= 0) {
1195 call_accept_cb(struct sipe_core_private
*sipe_private
, struct conf_accept_ctx
*ctx
)
1197 struct sip_session
*session
;
1198 session
= sipe_session_find_conference(sipe_private
, ctx
->focus_uri
);
1201 sipe_core_media_connect_conference(SIPE_CORE_PUBLIC
,
1202 session
->chat_session
);
1206 #ifdef HAVE_APPSHARE
1208 sipe_core_conf_is_viewing_appshare(struct sipe_core_public
*sipe_public
,
1209 struct sipe_chat_session
*chat_session
)
1215 mcu_uri
= sipe_conf_build_uri(chat_session
->id
, "applicationsharing");
1216 calls
= g_hash_table_get_values(SIPE_CORE_PRIVATE
->media_calls
);
1218 for (; calls
; calls
= g_list_delete_link(calls
, calls
)) {
1219 struct sipe_media_call
*call
= calls
->data
;
1220 if (sipe_strequal(call
->with
, mcu_uri
)) {
1227 if (calls
!= NULL
) {
1237 process_conference_appshare_endpoint(const sipe_xml
*endpoint
)
1239 gboolean presentation_added
= FALSE
;
1240 const sipe_xml
*media
;
1242 for (media
= sipe_xml_child(endpoint
, "media");
1243 media
&& !presentation_added
;
1244 media
= sipe_xml_twin(media
)) {
1249 type
= sipe_xml_data(sipe_xml_child(media
, "type"));
1250 media_state
= sipe_xml_data(sipe_xml_child(media
, "media-state"));
1251 status
= sipe_xml_data(sipe_xml_child(media
, "status"));
1253 if (sipe_strequal(type
, "applicationsharing") &&
1254 sipe_strequal(media_state
, "connected") &&
1255 sipe_strequal(status
, "sendonly")) {
1256 presentation_added
= TRUE
;
1260 g_free(media_state
);
1264 return(presentation_added
);
1266 #endif // HAVE_APPSHARE
1270 sipe_process_conference(struct sipe_core_private
*sipe_private
,
1273 sipe_xml
*xn_conference_info
;
1274 const sipe_xml
*node
;
1275 const sipe_xml
*xn_subject
;
1276 const gchar
*focus_uri
;
1277 struct sip_session
*session
;
1278 gboolean just_joined
= FALSE
;
1280 gboolean audio_was_added
= FALSE
;
1281 #ifdef HAVE_APPSHARE
1282 gboolean presentation_was_added
= FALSE
;
1286 if (msg
->response
!= 0 && msg
->response
!= 200) return;
1288 if (msg
->bodylen
== 0 || msg
->body
== NULL
|| !sipe_strequal(sipmsg_find_header(msg
, "Event"), "conference")) return;
1290 xn_conference_info
= sipe_xml_parse(msg
->body
, msg
->bodylen
);
1291 if (!xn_conference_info
) return;
1293 focus_uri
= sipe_xml_attribute(xn_conference_info
, "entity");
1294 session
= sipe_session_find_conference(sipe_private
, focus_uri
);
1297 SIPE_DEBUG_INFO("sipe_process_conference: unable to find conf session with focus=%s", focus_uri
);
1301 if (!session
->chat_session
->backend
) {
1302 gchar
*self
= sip_uri_self(sipe_private
);
1305 session
->chat_session
->backend
= sipe_backend_chat_create(SIPE_CORE_PUBLIC
,
1306 session
->chat_session
,
1307 session
->chat_session
->title
,
1310 /* @TODO ask for full state (re-subscribe) if it was a partial one -
1311 * this is to obtain full list of conference participants.
1317 if ((xn_subject
= sipe_xml_child(xn_conference_info
, "conference-description/subject"))) {
1318 g_free(session
->subject
);
1319 session
->subject
= sipe_xml_data(xn_subject
);
1320 sipe_backend_chat_topic(session
->chat_session
->backend
, session
->subject
);
1321 SIPE_DEBUG_INFO("sipe_process_conference: subject=%s", session
->subject
? session
->subject
: "");
1325 if (!session
->im_mcu_uri
) {
1326 for (node
= sipe_xml_child(xn_conference_info
, "conference-description/conf-uris/entry");
1328 node
= sipe_xml_twin(node
))
1330 gchar
*purpose
= sipe_xml_data(sipe_xml_child(node
, "purpose"));
1332 if (sipe_strequal("chat", purpose
)) {
1334 session
->im_mcu_uri
= sipe_xml_data(sipe_xml_child(node
, "uri"));
1335 SIPE_DEBUG_INFO("sipe_process_conference: im_mcu_uri=%s", session
->im_mcu_uri
);
1343 if (!session
->chat_session
->organizer
) {
1344 node
= sipe_xml_child(xn_conference_info
, "conference-description/organizer/display-name");
1346 session
->chat_session
->organizer
= sipe_xml_data(node
);
1351 if (!session
->chat_session
->join_url
) {
1352 node
= sipe_xml_child(xn_conference_info
, "conference-description/join-url");
1354 session
->chat_session
->join_url
= sipe_xml_data(node
);
1358 /* dial-in conference id */
1359 if (!session
->chat_session
->dial_in_conf_id
) {
1360 node
= sipe_xml_child(xn_conference_info
, "conference-description/pstn-access/id");
1362 session
->chat_session
->dial_in_conf_id
= sipe_xml_data(node
);
1367 for (node
= sipe_xml_child(xn_conference_info
, "users/user"); node
; node
= sipe_xml_twin(node
)) {
1368 const gchar
*user_uri
= sipe_xml_attribute(node
, "entity");
1369 const gchar
*state
= sipe_xml_attribute(node
, "state");
1370 gchar
*role
= sipe_xml_data(sipe_xml_child(node
, "roles/entry"));
1371 gboolean is_operator
= sipe_strequal(role
, "presenter");
1372 gboolean is_in_im_mcu
= FALSE
;
1373 gchar
*self
= sip_uri_self(sipe_private
);
1375 if (sipe_strequal("deleted", state
)) {
1376 if (sipe_backend_chat_find(session
->chat_session
->backend
, user_uri
)) {
1377 sipe_backend_chat_remove(session
->chat_session
->backend
,
1382 const sipe_xml
*endpoint
;
1383 for (endpoint
= sipe_xml_child(node
, "endpoint"); endpoint
; endpoint
= sipe_xml_twin(endpoint
)) {
1384 const gchar
*session_type
;
1385 gchar
*status
= sipe_xml_data(sipe_xml_child(endpoint
, "status"));
1386 gboolean connected
= sipe_strequal("connected", status
);
1392 session_type
= sipe_xml_attribute(endpoint
, "session-type");
1394 if (sipe_strequal("chat", session_type
)) {
1395 is_in_im_mcu
= TRUE
;
1396 if (!sipe_backend_chat_find(session
->chat_session
->backend
, user_uri
)) {
1397 sipe_backend_chat_add(session
->chat_session
->backend
,
1399 !just_joined
&& g_ascii_strcasecmp(user_uri
, self
));
1402 sipe_backend_chat_operator(session
->chat_session
->backend
,
1405 } else if (sipe_strequal("audio-video", session_type
)) {
1407 if (!session
->is_call
)
1408 audio_was_added
= TRUE
;
1409 process_conference_av_endpoint(endpoint
,
1414 } else if (sipe_strequal("applicationsharing", session_type
)) {
1415 #ifdef HAVE_APPSHARE
1416 if (!sipe_core_conf_is_viewing_appshare(SIPE_CORE_PUBLIC
,
1417 session
->chat_session
)) {
1418 presentation_was_added
= process_conference_appshare_endpoint(endpoint
);
1423 if (!is_in_im_mcu
) {
1424 if (sipe_backend_chat_find(session
->chat_session
->backend
, user_uri
)) {
1425 sipe_backend_chat_remove(session
->chat_session
->backend
,
1435 if (audio_was_added
) {
1436 session
->is_call
= TRUE
;
1437 ask_accept_voice_conference(sipe_private
, focus_uri
, NULL
,
1438 (SipeUserAskCb
) call_accept_cb
,
1441 #ifdef HAVE_APPSHARE
1442 if (presentation_was_added
) {
1443 sipe_core_appshare_connect_conference(SIPE_CORE_PUBLIC
,
1444 session
->chat_session
,
1450 /* entity-view, locked */
1451 for (node
= sipe_xml_child(xn_conference_info
, "conference-view/entity-view");
1453 node
= sipe_xml_twin(node
)) {
1455 const sipe_xml
*xn_type
= sipe_xml_child(node
, "entity-state/media/entry/type");
1457 if (xn_type
&& sipe_strequal("chat", (tmp
= sipe_xml_data(xn_type
)))) {
1458 const sipe_xml
*xn_locked
= sipe_xml_child(node
, "entity-state/locked");
1460 gchar
*locked
= sipe_xml_data(xn_locked
);
1461 gboolean prev_locked
= session
->locked
;
1462 session
->locked
= sipe_strequal(locked
, "true");
1463 if (prev_locked
&& !session
->locked
) {
1464 sipe_user_present_info(sipe_private
, session
,
1465 _("This conference is no longer locked. Additional participants can now join."));
1467 if (!prev_locked
&& session
->locked
) {
1468 sipe_user_present_info(sipe_private
, session
,
1469 _("This conference is locked. Nobody else can join the conference while it is locked."));
1472 SIPE_DEBUG_INFO("sipe_process_conference: session->locked=%s",
1473 session
->locked
? "TRUE" : "FALSE");
1479 sipe_xml_free(xn_conference_info
);
1481 if (session
->im_mcu_uri
) {
1482 struct sip_dialog
*dialog
= sipe_dialog_find(session
, session
->im_mcu_uri
);
1484 dialog
= sipe_dialog_add(session
);
1486 dialog
->callid
= g_strdup(session
->callid
);
1487 dialog
->with
= g_strdup(session
->im_mcu_uri
);
1489 /* send INVITE to IM MCU */
1490 sipe_im_invite(sipe_private
, session
, dialog
->with
, NULL
, NULL
, NULL
, FALSE
);
1494 sipe_process_pending_invite_queue(sipe_private
, session
);
1498 sipe_conf_immcu_closed(struct sipe_core_private
*sipe_private
,
1499 struct sip_session
*session
)
1501 sipe_user_present_info(sipe_private
, session
,
1502 _("You have been disconnected from this conference."));
1503 sipe_backend_chat_close(session
->chat_session
->backend
);
1507 conf_session_close(struct sipe_core_private
*sipe_private
,
1508 struct sip_session
*session
)
1511 /* unsubscribe from focus */
1512 sipe_subscribe_conference(sipe_private
,
1513 session
->chat_session
->id
, TRUE
);
1515 if (session
->focus_dialog
) {
1516 /* send BYE to focus */
1517 sip_transport_bye(sipe_private
, session
->focus_dialog
);
1523 sipe_process_imdn(struct sipe_core_private
*sipe_private
,
1526 gchar
*with
= parse_from(sipmsg_find_header(msg
, "From"));
1527 const gchar
*callid
= sipmsg_find_header(msg
, "Call-ID");
1528 static struct sip_session
*session
;
1530 const sipe_xml
*node
;
1534 session
= sipe_session_find_chat_or_im(sipe_private
, callid
, with
);
1536 SIPE_DEBUG_INFO("sipe_process_imdn: unable to find conf session with callid=%s", callid
);
1541 xn_imdn
= sipe_xml_parse(msg
->body
, msg
->bodylen
);
1542 message_id
= sipe_xml_data(sipe_xml_child(xn_imdn
, "message-id"));
1544 message
= g_hash_table_lookup(session
->conf_unconfirmed_messages
, message_id
);
1547 for (node
= sipe_xml_child(xn_imdn
, "recipient"); node
; node
= sipe_xml_twin(node
)) {
1548 gchar
*tmp
= parse_from(sipe_xml_attribute(node
, "uri"));
1549 gchar
*uri
= parse_from(tmp
);
1550 gchar
*status
= sipe_xml_data(sipe_xml_child(node
, "status"));
1551 guint error
= status
? g_ascii_strtoull(status
, NULL
, 10) : 0;
1552 /* default to error if missing or conversion failed */
1553 if ((error
== 0) || (error
>= 300))
1554 sipe_user_present_message_undelivered(sipe_private
,
1565 sipe_xml_free(xn_imdn
);
1567 g_hash_table_remove(session
->conf_unconfirmed_messages
, message_id
);
1568 SIPE_DEBUG_INFO("sipe_process_imdn: removed message %s from conf_unconfirmed_messages(count=%d)",
1569 message_id
, g_hash_table_size(session
->conf_unconfirmed_messages
));
1574 void sipe_core_conf_make_leader(struct sipe_core_public
*sipe_public
,
1576 const gchar
*buddy_name
)
1578 struct sipe_core_private
*sipe_private
= SIPE_CORE_PRIVATE
;
1579 struct sipe_chat_session
*chat_session
= parameter
;
1580 struct sip_session
*session
;
1582 SIPE_DEBUG_INFO("sipe_core_conf_make_leader: chat_title=%s",
1583 chat_session
->title
);
1585 session
= sipe_session_find_chat(sipe_private
, chat_session
);
1586 sipe_conf_modify_user_role(sipe_private
, session
, buddy_name
);
1589 void sipe_core_conf_remove_from(struct sipe_core_public
*sipe_public
,
1591 const gchar
*buddy_name
)
1593 struct sipe_core_private
*sipe_private
= SIPE_CORE_PRIVATE
;
1594 struct sipe_chat_session
*chat_session
= parameter
;
1595 struct sip_session
*session
;
1597 SIPE_DEBUG_INFO("sipe_core_conf_remove_from: chat_title=%s",
1598 chat_session
->title
);
1600 session
= sipe_session_find_chat(sipe_private
, chat_session
);
1601 sipe_conf_delete_user(sipe_private
, session
, buddy_name
);
1605 sipe_conf_build_uri(const gchar
*focus_uri
, const gchar
*session_type
)
1607 gchar
**parts
= g_strsplit(focus_uri
, ":focus:", 2);
1608 gchar
*result
= NULL
;
1610 if (g_strv_length(parts
) == 2) {
1611 result
= g_strconcat(parts
[0], ":", session_type
, ":", parts
[1],
1620 access_numbers_info(struct sipe_core_public
*sipe_public
)
1622 GString
*result
= g_string_new("");
1624 #if GLIB_CHECK_VERSION(2,16,0)
1625 GList
*keys
= g_hash_table_get_keys(SIPE_CORE_PRIVATE
->access_numbers
);
1626 keys
= g_list_sort(keys
, (GCompareFunc
)g_strcmp0
);
1628 for (; keys
; keys
= g_list_delete_link(keys
, keys
)) {
1630 value
= g_hash_table_lookup(SIPE_CORE_PRIVATE
->access_numbers
,
1633 g_string_append(result
, keys
->data
);
1634 g_string_append(result
, " ");
1635 g_string_append(result
, value
);
1636 g_string_append(result
, "<br/>");
1639 (void)sipe_public
; /* keep compiler happy */
1642 return g_string_free(result
, FALSE
);
1646 sipe_core_conf_entry_info(struct sipe_core_public
*sipe_public
,
1647 struct sipe_chat_session
*chat_session
)
1649 gchar
*access_info
= access_numbers_info(sipe_public
);
1650 gchar
*result
= g_strdup_printf(
1651 "<b><font size=\"+1\">%s</font></b><br/>"
1652 "<b>%s:</b> %s<br/>"
1653 "<b>%s:</b> %s<br/>"
1658 "<b>%s:</b> %s<br/>"
1660 "<b><font size=\"+1\">%s</font></b><br/>"
1664 SIPE_CORE_PRIVATE
->default_access_number
? SIPE_CORE_PRIVATE
->default_access_number
: "",
1666 chat_session
->dial_in_conf_id
? chat_session
->dial_in_conf_id
: "",
1668 chat_session
->join_url
? chat_session
->join_url
: "",
1670 chat_session
->organizer
? chat_session
->organizer
: "",
1671 _("Alternative dial-in numbers"),
1674 g_free(access_info
);