Implement ticket #336: custom presence status in NOTIFY/PUBLISH, supporting subset of RPID elements
git-svn-id: https://svn.pjsip.org/repos/pjproject/trunk@1424 74dad513-b988-da41-8d7b-12977e46ad98
This commit is contained in:
parent
fe04fb5a0f
commit
4461c7d500
|
@ -1,11 +1,11 @@
|
||||||
prj_platforms
|
prj_platforms
|
||||||
winscw
|
winscw
|
||||||
//armv5
|
//armv5
|
||||||
//gcce
|
gcce
|
||||||
|
|
||||||
prj_mmpfiles
|
prj_mmpfiles
|
||||||
pjlib.mmp
|
pjlib.mmp
|
||||||
pjlib_test.mmp
|
//pjlib_test.mmp
|
||||||
pjlib_util.mmp
|
pjlib_util.mmp
|
||||||
pjnath.mmp
|
pjnath.mmp
|
||||||
pjsdp.mmp
|
pjsdp.mmp
|
||||||
|
|
|
@ -41,6 +41,7 @@ SOURCE pidf.c
|
||||||
SOURCE presence.c
|
SOURCE presence.c
|
||||||
SOURCE presence_body.c
|
SOURCE presence_body.c
|
||||||
SOURCE publishc.c
|
SOURCE publishc.c
|
||||||
|
SOURCE rpid.c
|
||||||
SOURCE xpidf.c
|
SOURCE xpidf.c
|
||||||
|
|
||||||
SYSTEMINCLUDE ..\pjlib\include
|
SYSTEMINCLUDE ..\pjlib\include
|
||||||
|
|
|
@ -28,66 +28,69 @@ EXPORTS
|
||||||
pjpidf_tuple_set_id @ 27 NONAME
|
pjpidf_tuple_set_id @ 27 NONAME
|
||||||
pjpidf_tuple_set_timestamp @ 28 NONAME
|
pjpidf_tuple_set_timestamp @ 28 NONAME
|
||||||
pjpidf_tuple_set_timestamp_np @ 29 NONAME
|
pjpidf_tuple_set_timestamp_np @ 29 NONAME
|
||||||
pjsip_allow_events_hdr_create @ 30 NONAME
|
pjrpid_add_element @ 30 NONAME
|
||||||
pjsip_event_hdr_create @ 31 NONAME
|
pjrpid_element_dup @ 31 NONAME
|
||||||
pjsip_evsub_accept @ 32 NONAME
|
pjrpid_get_element @ 32 NONAME
|
||||||
pjsip_evsub_create_uac @ 33 NONAME
|
pjsip_allow_events_hdr_create @ 33 NONAME
|
||||||
pjsip_evsub_create_uas @ 34 NONAME
|
pjsip_event_hdr_create @ 34 NONAME
|
||||||
pjsip_evsub_current_notify @ 35 NONAME
|
pjsip_evsub_accept @ 35 NONAME
|
||||||
pjsip_evsub_get_allow_events_hdr @ 36 NONAME
|
pjsip_evsub_create_uac @ 36 NONAME
|
||||||
pjsip_evsub_get_mod_data @ 37 NONAME
|
pjsip_evsub_create_uas @ 37 NONAME
|
||||||
pjsip_evsub_get_state @ 38 NONAME
|
pjsip_evsub_current_notify @ 38 NONAME
|
||||||
pjsip_evsub_get_state_name @ 39 NONAME
|
pjsip_evsub_get_allow_events_hdr @ 39 NONAME
|
||||||
pjsip_evsub_init_module @ 40 NONAME
|
pjsip_evsub_get_mod_data @ 40 NONAME
|
||||||
pjsip_evsub_init_parser @ 41 NONAME
|
pjsip_evsub_get_state @ 41 NONAME
|
||||||
pjsip_evsub_initiate @ 42 NONAME
|
pjsip_evsub_get_state_name @ 42 NONAME
|
||||||
pjsip_evsub_instance @ 43 NONAME
|
pjsip_evsub_init_module @ 43 NONAME
|
||||||
pjsip_evsub_notify @ 44 NONAME
|
pjsip_evsub_init_parser @ 44 NONAME
|
||||||
pjsip_evsub_register_pkg @ 45 NONAME
|
pjsip_evsub_initiate @ 45 NONAME
|
||||||
pjsip_evsub_send_request @ 46 NONAME
|
pjsip_evsub_instance @ 46 NONAME
|
||||||
pjsip_evsub_set_mod_data @ 47 NONAME
|
pjsip_evsub_notify @ 47 NONAME
|
||||||
pjsip_evsub_terminate @ 48 NONAME
|
pjsip_evsub_register_pkg @ 48 NONAME
|
||||||
pjsip_get_notify_method @ 49 NONAME
|
pjsip_evsub_send_request @ 49 NONAME
|
||||||
pjsip_get_subscribe_method @ 50 NONAME
|
pjsip_evsub_set_mod_data @ 50 NONAME
|
||||||
pjsip_iscomposing_create_body @ 51 NONAME
|
pjsip_evsub_terminate @ 51 NONAME
|
||||||
pjsip_iscomposing_create_xml @ 52 NONAME
|
pjsip_get_notify_method @ 52 NONAME
|
||||||
pjsip_iscomposing_parse @ 53 NONAME
|
pjsip_get_subscribe_method @ 53 NONAME
|
||||||
pjsip_notify_method @ 54 NONAME
|
pjsip_iscomposing_create_body @ 54 NONAME
|
||||||
pjsip_pres_accept @ 55 NONAME
|
pjsip_iscomposing_create_xml @ 55 NONAME
|
||||||
pjsip_pres_create_pidf @ 56 NONAME
|
pjsip_iscomposing_parse @ 56 NONAME
|
||||||
pjsip_pres_create_uac @ 57 NONAME
|
pjsip_notify_method @ 57 NONAME
|
||||||
pjsip_pres_create_uas @ 58 NONAME
|
pjsip_pres_accept @ 58 NONAME
|
||||||
pjsip_pres_create_xpidf @ 59 NONAME
|
pjsip_pres_create_pidf @ 59 NONAME
|
||||||
pjsip_pres_current_notify @ 60 NONAME
|
pjsip_pres_create_uac @ 60 NONAME
|
||||||
pjsip_pres_get_status @ 61 NONAME
|
pjsip_pres_create_uas @ 61 NONAME
|
||||||
pjsip_pres_init_module @ 62 NONAME
|
pjsip_pres_create_xpidf @ 62 NONAME
|
||||||
pjsip_pres_initiate @ 63 NONAME
|
pjsip_pres_current_notify @ 63 NONAME
|
||||||
pjsip_pres_instance @ 64 NONAME
|
pjsip_pres_get_status @ 64 NONAME
|
||||||
pjsip_pres_notify @ 65 NONAME
|
pjsip_pres_init_module @ 65 NONAME
|
||||||
pjsip_pres_parse_pidf @ 66 NONAME
|
pjsip_pres_initiate @ 66 NONAME
|
||||||
pjsip_pres_parse_xpidf @ 67 NONAME
|
pjsip_pres_instance @ 67 NONAME
|
||||||
pjsip_pres_send_request @ 68 NONAME
|
pjsip_pres_notify @ 68 NONAME
|
||||||
pjsip_pres_set_status @ 69 NONAME
|
pjsip_pres_parse_pidf @ 69 NONAME
|
||||||
pjsip_pres_terminate @ 70 NONAME
|
pjsip_pres_parse_xpidf @ 70 NONAME
|
||||||
pjsip_publishc_create @ 71 NONAME
|
pjsip_pres_send_request @ 71 NONAME
|
||||||
pjsip_publishc_destroy @ 72 NONAME
|
pjsip_pres_set_status @ 72 NONAME
|
||||||
pjsip_publishc_get_pool @ 73 NONAME
|
pjsip_pres_terminate @ 73 NONAME
|
||||||
pjsip_publishc_init @ 74 NONAME
|
pjsip_publishc_create @ 74 NONAME
|
||||||
pjsip_publishc_init_module @ 75 NONAME
|
pjsip_publishc_destroy @ 75 NONAME
|
||||||
pjsip_publishc_publish @ 76 NONAME
|
pjsip_publishc_get_pool @ 76 NONAME
|
||||||
pjsip_publishc_send @ 77 NONAME
|
pjsip_publishc_init @ 77 NONAME
|
||||||
pjsip_publishc_set_credentials @ 78 NONAME
|
pjsip_publishc_init_module @ 78 NONAME
|
||||||
pjsip_publishc_set_route_set @ 79 NONAME
|
pjsip_publishc_publish @ 79 NONAME
|
||||||
pjsip_publishc_unpublish @ 80 NONAME
|
pjsip_publishc_send @ 80 NONAME
|
||||||
pjsip_publishc_update_expires @ 81 NONAME
|
pjsip_publishc_set_credentials @ 81 NONAME
|
||||||
pjsip_sub_state_hdr_create @ 82 NONAME
|
pjsip_publishc_set_route_set @ 82 NONAME
|
||||||
pjsip_subscribe_method @ 83 NONAME
|
pjsip_publishc_unpublish @ 83 NONAME
|
||||||
pjsip_tsx_get_evsub @ 84 NONAME
|
pjsip_publishc_update_expires @ 84 NONAME
|
||||||
pjsipsimple_strerror @ 85 NONAME
|
pjsip_sub_state_hdr_create @ 85 NONAME
|
||||||
pjxpidf_create @ 86 NONAME
|
pjsip_subscribe_method @ 86 NONAME
|
||||||
pjxpidf_get_status @ 87 NONAME
|
pjsip_tsx_get_evsub @ 87 NONAME
|
||||||
pjxpidf_get_uri @ 88 NONAME
|
pjsipsimple_strerror @ 88 NONAME
|
||||||
pjxpidf_parse @ 89 NONAME
|
pjxpidf_create @ 89 NONAME
|
||||||
pjxpidf_print @ 90 NONAME
|
pjxpidf_get_status @ 90 NONAME
|
||||||
pjxpidf_set_status @ 91 NONAME
|
pjxpidf_get_uri @ 91 NONAME
|
||||||
pjxpidf_set_uri @ 92 NONAME
|
pjxpidf_parse @ 92 NONAME
|
||||||
|
pjxpidf_print @ 93 NONAME
|
||||||
|
pjxpidf_set_status @ 94 NONAME
|
||||||
|
pjxpidf_set_uri @ 95 NONAME
|
||||||
|
|
|
@ -17,98 +17,99 @@ EXPORTS
|
||||||
pjsua_acc_modify @ 16 NONAME
|
pjsua_acc_modify @ 16 NONAME
|
||||||
pjsua_acc_set_default @ 17 NONAME
|
pjsua_acc_set_default @ 17 NONAME
|
||||||
pjsua_acc_set_online_status @ 18 NONAME
|
pjsua_acc_set_online_status @ 18 NONAME
|
||||||
pjsua_acc_set_registration @ 19 NONAME
|
pjsua_acc_set_online_status2 @ 19 NONAME
|
||||||
pjsua_acc_set_transport @ 20 NONAME
|
pjsua_acc_set_registration @ 20 NONAME
|
||||||
pjsua_buddy_add @ 21 NONAME
|
pjsua_acc_set_transport @ 21 NONAME
|
||||||
pjsua_buddy_config_default @ 22 NONAME
|
pjsua_buddy_add @ 22 NONAME
|
||||||
pjsua_buddy_del @ 23 NONAME
|
pjsua_buddy_config_default @ 23 NONAME
|
||||||
pjsua_buddy_get_info @ 24 NONAME
|
pjsua_buddy_del @ 24 NONAME
|
||||||
pjsua_buddy_is_valid @ 25 NONAME
|
pjsua_buddy_get_info @ 25 NONAME
|
||||||
pjsua_buddy_subscribe_pres @ 26 NONAME
|
pjsua_buddy_is_valid @ 26 NONAME
|
||||||
pjsua_call_answer @ 27 NONAME
|
pjsua_buddy_subscribe_pres @ 27 NONAME
|
||||||
pjsua_call_dial_dtmf @ 28 NONAME
|
pjsua_call_answer @ 28 NONAME
|
||||||
pjsua_call_dump @ 29 NONAME
|
pjsua_call_dial_dtmf @ 29 NONAME
|
||||||
pjsua_call_get_conf_port @ 30 NONAME
|
pjsua_call_dump @ 30 NONAME
|
||||||
pjsua_call_get_count @ 31 NONAME
|
pjsua_call_get_conf_port @ 31 NONAME
|
||||||
pjsua_call_get_info @ 32 NONAME
|
pjsua_call_get_count @ 32 NONAME
|
||||||
pjsua_call_get_max_count @ 33 NONAME
|
pjsua_call_get_info @ 33 NONAME
|
||||||
pjsua_call_get_user_data @ 34 NONAME
|
pjsua_call_get_max_count @ 34 NONAME
|
||||||
pjsua_call_hangup @ 35 NONAME
|
pjsua_call_get_user_data @ 35 NONAME
|
||||||
pjsua_call_hangup_all @ 36 NONAME
|
pjsua_call_hangup @ 36 NONAME
|
||||||
pjsua_call_has_media @ 37 NONAME
|
pjsua_call_hangup_all @ 37 NONAME
|
||||||
pjsua_call_is_active @ 38 NONAME
|
pjsua_call_has_media @ 38 NONAME
|
||||||
pjsua_call_make_call @ 39 NONAME
|
pjsua_call_is_active @ 39 NONAME
|
||||||
pjsua_call_reinvite @ 40 NONAME
|
pjsua_call_make_call @ 40 NONAME
|
||||||
pjsua_call_send_im @ 41 NONAME
|
pjsua_call_reinvite @ 41 NONAME
|
||||||
pjsua_call_send_typing_ind @ 42 NONAME
|
pjsua_call_send_im @ 42 NONAME
|
||||||
pjsua_call_set_hold @ 43 NONAME
|
pjsua_call_send_typing_ind @ 43 NONAME
|
||||||
pjsua_call_set_user_data @ 44 NONAME
|
pjsua_call_set_hold @ 44 NONAME
|
||||||
pjsua_call_xfer @ 45 NONAME
|
pjsua_call_set_user_data @ 45 NONAME
|
||||||
pjsua_call_xfer_replaces @ 46 NONAME
|
pjsua_call_xfer @ 46 NONAME
|
||||||
pjsua_codec_get_param @ 47 NONAME
|
pjsua_call_xfer_replaces @ 47 NONAME
|
||||||
pjsua_codec_set_param @ 48 NONAME
|
pjsua_codec_get_param @ 48 NONAME
|
||||||
pjsua_codec_set_priority @ 49 NONAME
|
pjsua_codec_set_param @ 49 NONAME
|
||||||
pjsua_conf_add_port @ 50 NONAME
|
pjsua_codec_set_priority @ 50 NONAME
|
||||||
pjsua_conf_adjust_rx_level @ 51 NONAME
|
pjsua_conf_add_port @ 51 NONAME
|
||||||
pjsua_conf_adjust_tx_level @ 52 NONAME
|
pjsua_conf_adjust_rx_level @ 52 NONAME
|
||||||
pjsua_conf_connect @ 53 NONAME
|
pjsua_conf_adjust_tx_level @ 53 NONAME
|
||||||
pjsua_conf_disconnect @ 54 NONAME
|
pjsua_conf_connect @ 54 NONAME
|
||||||
pjsua_conf_get_active_ports @ 55 NONAME
|
pjsua_conf_disconnect @ 55 NONAME
|
||||||
pjsua_conf_get_max_ports @ 56 NONAME
|
pjsua_conf_get_active_ports @ 56 NONAME
|
||||||
pjsua_conf_get_port_info @ 57 NONAME
|
pjsua_conf_get_max_ports @ 57 NONAME
|
||||||
pjsua_conf_get_signal_level @ 58 NONAME
|
pjsua_conf_get_port_info @ 58 NONAME
|
||||||
pjsua_conf_remove_port @ 59 NONAME
|
pjsua_conf_get_signal_level @ 59 NONAME
|
||||||
pjsua_config_default @ 60 NONAME
|
pjsua_conf_remove_port @ 60 NONAME
|
||||||
pjsua_config_dup @ 61 NONAME
|
pjsua_config_default @ 61 NONAME
|
||||||
pjsua_create @ 62 NONAME
|
pjsua_config_dup @ 62 NONAME
|
||||||
pjsua_destroy @ 63 NONAME
|
pjsua_create @ 63 NONAME
|
||||||
pjsua_dump @ 64 NONAME
|
pjsua_destroy @ 64 NONAME
|
||||||
pjsua_enum_accs @ 65 NONAME
|
pjsua_dump @ 65 NONAME
|
||||||
pjsua_enum_buddies @ 66 NONAME
|
pjsua_enum_accs @ 66 NONAME
|
||||||
pjsua_enum_calls @ 67 NONAME
|
pjsua_enum_buddies @ 67 NONAME
|
||||||
pjsua_enum_codecs @ 68 NONAME
|
pjsua_enum_calls @ 68 NONAME
|
||||||
pjsua_enum_conf_ports @ 69 NONAME
|
pjsua_enum_codecs @ 69 NONAME
|
||||||
pjsua_enum_snd_devs @ 70 NONAME
|
pjsua_enum_conf_ports @ 70 NONAME
|
||||||
pjsua_enum_transports @ 71 NONAME
|
pjsua_enum_snd_devs @ 71 NONAME
|
||||||
pjsua_get_buddy_count @ 72 NONAME
|
pjsua_enum_transports @ 72 NONAME
|
||||||
pjsua_get_ec_tail @ 73 NONAME
|
pjsua_get_buddy_count @ 73 NONAME
|
||||||
pjsua_get_pjmedia_endpt @ 74 NONAME
|
pjsua_get_ec_tail @ 74 NONAME
|
||||||
pjsua_get_pjsip_endpt @ 75 NONAME
|
pjsua_get_pjmedia_endpt @ 75 NONAME
|
||||||
pjsua_get_pool_factory @ 76 NONAME
|
pjsua_get_pjsip_endpt @ 76 NONAME
|
||||||
pjsua_get_snd_dev @ 77 NONAME
|
pjsua_get_pool_factory @ 77 NONAME
|
||||||
pjsua_handle_events @ 78 NONAME
|
pjsua_get_snd_dev @ 78 NONAME
|
||||||
pjsua_im_send @ 79 NONAME
|
pjsua_handle_events @ 79 NONAME
|
||||||
pjsua_im_typing @ 80 NONAME
|
pjsua_im_send @ 80 NONAME
|
||||||
pjsua_init @ 81 NONAME
|
pjsua_im_typing @ 81 NONAME
|
||||||
pjsua_logging_config_default @ 82 NONAME
|
pjsua_init @ 82 NONAME
|
||||||
pjsua_logging_config_dup @ 83 NONAME
|
pjsua_logging_config_default @ 83 NONAME
|
||||||
pjsua_media_config_default @ 84 NONAME
|
pjsua_logging_config_dup @ 84 NONAME
|
||||||
pjsua_media_transports_create @ 85 NONAME
|
pjsua_media_config_default @ 85 NONAME
|
||||||
pjsua_msg_data_init @ 86 NONAME
|
pjsua_media_transports_create @ 86 NONAME
|
||||||
pjsua_perror @ 87 NONAME
|
pjsua_msg_data_init @ 87 NONAME
|
||||||
pjsua_player_create @ 88 NONAME
|
pjsua_perror @ 88 NONAME
|
||||||
pjsua_player_destroy @ 89 NONAME
|
pjsua_player_create @ 89 NONAME
|
||||||
pjsua_player_get_conf_port @ 90 NONAME
|
pjsua_player_destroy @ 90 NONAME
|
||||||
pjsua_player_get_port @ 91 NONAME
|
pjsua_player_get_conf_port @ 91 NONAME
|
||||||
pjsua_player_set_pos @ 92 NONAME
|
pjsua_player_get_port @ 92 NONAME
|
||||||
pjsua_playlist_create @ 93 NONAME
|
pjsua_player_set_pos @ 93 NONAME
|
||||||
pjsua_pool_create @ 94 NONAME
|
pjsua_playlist_create @ 94 NONAME
|
||||||
pjsua_pres_dump @ 95 NONAME
|
pjsua_pool_create @ 95 NONAME
|
||||||
pjsua_reconfigure_logging @ 96 NONAME
|
pjsua_pres_dump @ 96 NONAME
|
||||||
pjsua_recorder_create @ 97 NONAME
|
pjsua_reconfigure_logging @ 97 NONAME
|
||||||
pjsua_recorder_destroy @ 98 NONAME
|
pjsua_recorder_create @ 98 NONAME
|
||||||
pjsua_recorder_get_conf_port @ 99 NONAME
|
pjsua_recorder_destroy @ 99 NONAME
|
||||||
pjsua_recorder_get_port @ 100 NONAME
|
pjsua_recorder_get_conf_port @ 100 NONAME
|
||||||
pjsua_set_ec @ 101 NONAME
|
pjsua_recorder_get_port @ 101 NONAME
|
||||||
pjsua_set_no_snd_dev @ 102 NONAME
|
pjsua_set_ec @ 102 NONAME
|
||||||
pjsua_set_null_snd_dev @ 103 NONAME
|
pjsua_set_no_snd_dev @ 103 NONAME
|
||||||
pjsua_set_snd_dev @ 104 NONAME
|
pjsua_set_null_snd_dev @ 104 NONAME
|
||||||
pjsua_start @ 105 NONAME
|
pjsua_set_snd_dev @ 105 NONAME
|
||||||
pjsua_transport_close @ 106 NONAME
|
pjsua_start @ 106 NONAME
|
||||||
pjsua_transport_config_default @ 107 NONAME
|
pjsua_transport_close @ 107 NONAME
|
||||||
pjsua_transport_config_dup @ 108 NONAME
|
pjsua_transport_config_default @ 108 NONAME
|
||||||
pjsua_transport_create @ 109 NONAME
|
pjsua_transport_config_dup @ 109 NONAME
|
||||||
pjsua_transport_get_info @ 110 NONAME
|
pjsua_transport_create @ 110 NONAME
|
||||||
pjsua_transport_register @ 111 NONAME
|
pjsua_transport_get_info @ 111 NONAME
|
||||||
pjsua_transport_set_enable @ 112 NONAME
|
pjsua_transport_register @ 112 NONAME
|
||||||
pjsua_verify_sip_url @ 113 NONAME
|
pjsua_transport_set_enable @ 113 NONAME
|
||||||
|
pjsua_verify_sip_url @ 114 NONAME
|
||||||
|
|
|
@ -1820,8 +1820,10 @@ static void print_buddy_list(void)
|
||||||
if (pjsua_buddy_get_info(ids[i], &info) != PJ_SUCCESS)
|
if (pjsua_buddy_get_info(ids[i], &info) != PJ_SUCCESS)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
printf(" [%2d] <%7s> %.*s\n",
|
printf(" [%2d] <%.*s> %.*s\n",
|
||||||
ids[i]+1, info.status_text.ptr,
|
ids[i]+1,
|
||||||
|
(int)info.status_text.slen,
|
||||||
|
info.status_text.ptr,
|
||||||
(int)info.uri.slen,
|
(int)info.uri.slen,
|
||||||
info.uri.ptr);
|
info.uri.ptr);
|
||||||
}
|
}
|
||||||
|
@ -1857,8 +1859,9 @@ static void print_acc_status(int acc_id)
|
||||||
|
|
||||||
printf(" %c[%2d] %.*s: %s\n", (acc_id==current_acc?'*':' '),
|
printf(" %c[%2d] %.*s: %s\n", (acc_id==current_acc?'*':' '),
|
||||||
acc_id, (int)info.acc_uri.slen, info.acc_uri.ptr, buf);
|
acc_id, (int)info.acc_uri.slen, info.acc_uri.ptr, buf);
|
||||||
printf(" Online status: %s\n",
|
printf(" Online status: %.*s\n",
|
||||||
(info.online_status ? "Online" : "Invisible"));
|
(int)info.online_status_text.slen,
|
||||||
|
info.online_status_text.ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1887,11 +1890,11 @@ static void keystroke_help(void)
|
||||||
puts("| | | |");
|
puts("| | | |");
|
||||||
puts("| m Make new call | +b Add new buddy .| +a Add new accnt |");
|
puts("| m Make new call | +b Add new buddy .| +a Add new accnt |");
|
||||||
puts("| M Make multiple calls | -b Delete buddy | -a Delete accnt. |");
|
puts("| M Make multiple calls | -b Delete buddy | -a Delete accnt. |");
|
||||||
puts("| a Answer call | !b Modify buddy | !a Modify accnt. |");
|
puts("| a Answer call | i Send IM | !a Modify accnt. |");
|
||||||
puts("| h Hangup call (ha=all) | i Send IM | rr (Re-)register |");
|
puts("| h Hangup call (ha=all) | s Subscribe presence | rr (Re-)register |");
|
||||||
puts("| H Hold call | s Subscribe presence | ru Unregister |");
|
puts("| H Hold call | u Unsubscribe presence | ru Unregister |");
|
||||||
puts("| v re-inVite (release hold) | u Unsubscribe presence | > Cycle next ac.|");
|
puts("| v re-inVite (release hold) | t ToGgle Online status | > Cycle next ac.|");
|
||||||
puts("| ] Select next dialog | t ToGgle Online status | < Cycle prev ac.|");
|
puts("| ] Select next dialog | T Set online status | < Cycle prev ac.|");
|
||||||
puts("| [ Select previous dialog +--------------------------+-------------------+");
|
puts("| [ Select previous dialog +--------------------------+-------------------+");
|
||||||
puts("| x Xfer call | Media Commands: | Status & Config: |");
|
puts("| x Xfer call | Media Commands: | Status & Config: |");
|
||||||
puts("| X Xfer with Replaces | | |");
|
puts("| X Xfer with Replaces | | |");
|
||||||
|
@ -2091,6 +2094,85 @@ static void send_request(char *cstr_method, const pj_str_t *dst_uri)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Change extended online status.
|
||||||
|
*/
|
||||||
|
static void change_online_status(void)
|
||||||
|
{
|
||||||
|
char menuin[32];
|
||||||
|
pj_bool_t online_status;
|
||||||
|
pjrpid_element elem;
|
||||||
|
int i, choice;
|
||||||
|
|
||||||
|
enum {
|
||||||
|
AVAILABLE, BUSY, OTP, IDLE, AWAY, BRB, OFFLINE, OPT_MAX
|
||||||
|
};
|
||||||
|
|
||||||
|
struct opt {
|
||||||
|
int id;
|
||||||
|
char *name;
|
||||||
|
} opts[] = {
|
||||||
|
{ AVAILABLE, "Available" },
|
||||||
|
{ BUSY, "Busy"},
|
||||||
|
{ OTP, "On the phone"},
|
||||||
|
{ IDLE, "Idle"},
|
||||||
|
{ AWAY, "Away"},
|
||||||
|
{ BRB, "Be right back"},
|
||||||
|
{ OFFLINE, "Offline"}
|
||||||
|
};
|
||||||
|
|
||||||
|
printf("\n"
|
||||||
|
"Choices:\n");
|
||||||
|
for (i=0; i<PJ_ARRAY_SIZE(opts); ++i) {
|
||||||
|
printf(" %d %s\n", opts[i].id+1, opts[i].name);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!simple_input("Select status", menuin, sizeof(menuin)))
|
||||||
|
return;
|
||||||
|
|
||||||
|
choice = atoi(menuin) - 1;
|
||||||
|
if (choice < 0 || choice >= OPT_MAX) {
|
||||||
|
puts("Invalid selection");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
pj_bzero(&elem, sizeof(elem));
|
||||||
|
elem.type = PJRPID_ELEMENT_TYPE_PERSON;
|
||||||
|
|
||||||
|
online_status = PJ_TRUE;
|
||||||
|
|
||||||
|
switch (choice) {
|
||||||
|
case AVAILABLE:
|
||||||
|
break;
|
||||||
|
case BUSY:
|
||||||
|
elem.activity = PJRPID_ACTIVITY_BUSY;
|
||||||
|
elem.note = pj_str("Busy");
|
||||||
|
break;
|
||||||
|
case OTP:
|
||||||
|
elem.activity = PJRPID_ACTIVITY_BUSY;
|
||||||
|
elem.note = pj_str("On the phone");
|
||||||
|
break;
|
||||||
|
case IDLE:
|
||||||
|
elem.activity = PJRPID_ACTIVITY_UNKNOWN;
|
||||||
|
elem.note = pj_str("Idle");
|
||||||
|
break;
|
||||||
|
case AWAY:
|
||||||
|
elem.activity = PJRPID_ACTIVITY_AWAY;
|
||||||
|
elem.note = pj_str("Away");
|
||||||
|
break;
|
||||||
|
case BRB:
|
||||||
|
elem.activity = PJRPID_ACTIVITY_UNKNOWN;
|
||||||
|
elem.note = pj_str("Be right back");
|
||||||
|
break;
|
||||||
|
case OFFLINE:
|
||||||
|
online_status = PJ_FALSE;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
pjsua_acc_set_online_status2(current_acc, online_status, &elem);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Main "user interface" loop.
|
* Main "user interface" loop.
|
||||||
*/
|
*/
|
||||||
|
@ -2802,6 +2884,10 @@ void console_app_main(const pj_str_t *uri_to_call)
|
||||||
(acc_info.online_status?"online":"offline"));
|
(acc_info.online_status?"online":"offline"));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 'T':
|
||||||
|
change_online_status();
|
||||||
|
break;
|
||||||
|
|
||||||
case 'c':
|
case 'c':
|
||||||
switch (menuin[1]) {
|
switch (menuin[1]) {
|
||||||
case 'l':
|
case 'l':
|
||||||
|
|
|
@ -62,7 +62,7 @@ export PJSIP_SIMPLE_SRCDIR = ../src/pjsip-simple
|
||||||
export PJSIP_SIMPLE_OBJS += $(OS_OBJS) $(M_OBJS) $(CC_OBJS) $(HOST_OBJS) \
|
export PJSIP_SIMPLE_OBJS += $(OS_OBJS) $(M_OBJS) $(CC_OBJS) $(HOST_OBJS) \
|
||||||
errno.o evsub.o evsub_msg.o iscomposing.o \
|
errno.o evsub.o evsub_msg.o iscomposing.o \
|
||||||
pidf.o presence.o presence_body.o publishc.o \
|
pidf.o presence.o presence_body.o publishc.o \
|
||||||
xpidf.o
|
rpid.o xpidf.o
|
||||||
export PJSIP_SIMPLE_CFLAGS += $(_CFLAGS)
|
export PJSIP_SIMPLE_CFLAGS += $(_CFLAGS)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -40,6 +40,7 @@ RSC=rc.exe
|
||||||
# PROP Output_Dir "./output/pjsip-simple-i386-win32-vc6-release"
|
# PROP Output_Dir "./output/pjsip-simple-i386-win32-vc6-release"
|
||||||
# PROP Intermediate_Dir "./output/pjsip-simple-i386-win32-vc6-release"
|
# PROP Intermediate_Dir "./output/pjsip-simple-i386-win32-vc6-release"
|
||||||
# PROP Target_Dir ""
|
# PROP Target_Dir ""
|
||||||
|
F90=df.exe
|
||||||
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c
|
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c
|
||||||
# ADD CPP /nologo /MD /W4 /GX /Zi /O2 /I "../include" /I "../../pjlib-util/include" /I "../../pjlib/include" /D "NDEBUG" /D PJ_WIN32=1 /D PJ_M_I386=1 /D "WIN32" /D "_MBCS" /D "_LIB" /YX /FD /c
|
# ADD CPP /nologo /MD /W4 /GX /Zi /O2 /I "../include" /I "../../pjlib-util/include" /I "../../pjlib/include" /D "NDEBUG" /D PJ_WIN32=1 /D PJ_M_I386=1 /D "WIN32" /D "_MBCS" /D "_LIB" /YX /FD /c
|
||||||
# ADD BASE RSC /l 0x409 /d "NDEBUG"
|
# ADD BASE RSC /l 0x409 /d "NDEBUG"
|
||||||
|
@ -63,6 +64,7 @@ LIB32=link.exe -lib
|
||||||
# PROP Output_Dir "./output/pjsip-simple-i386-win32-vc6-debug"
|
# PROP Output_Dir "./output/pjsip-simple-i386-win32-vc6-debug"
|
||||||
# PROP Intermediate_Dir "./output/pjsip-simple-i386-win32-vc6-debug"
|
# PROP Intermediate_Dir "./output/pjsip-simple-i386-win32-vc6-debug"
|
||||||
# PROP Target_Dir ""
|
# PROP Target_Dir ""
|
||||||
|
F90=df.exe
|
||||||
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c
|
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c
|
||||||
# ADD CPP /nologo /MTd /W4 /Gm /GX /ZI /Od /I "../include" /I "../../pjlib-util/include" /I "../../pjlib/include" /D "_DEBUG" /D PJ_WIN32=1 /D PJ_M_I386=1 /D "WIN32" /D "_MBCS" /D "_LIB" /FR /YX /FD /GZ /c
|
# ADD CPP /nologo /MTd /W4 /Gm /GX /ZI /Od /I "../include" /I "../../pjlib-util/include" /I "../../pjlib/include" /D "_DEBUG" /D PJ_WIN32=1 /D PJ_M_I386=1 /D "WIN32" /D "_MBCS" /D "_LIB" /FR /YX /FD /GZ /c
|
||||||
# ADD BASE RSC /l 0x409 /d "_DEBUG"
|
# ADD BASE RSC /l 0x409 /d "_DEBUG"
|
||||||
|
@ -117,6 +119,10 @@ SOURCE="..\src\pjsip-simple\publishc.c"
|
||||||
# End Source File
|
# End Source File
|
||||||
# Begin Source File
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE="..\src\pjsip-simple\rpid.c"
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
SOURCE="..\src\pjsip-simple\xpidf.c"
|
SOURCE="..\src\pjsip-simple\xpidf.c"
|
||||||
# End Source File
|
# End Source File
|
||||||
# End Group
|
# End Group
|
||||||
|
@ -157,6 +163,10 @@ SOURCE="..\include\pjsip-simple\publish.h"
|
||||||
# End Source File
|
# End Source File
|
||||||
# Begin Source File
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE="..\include\pjsip-simple\rpid.h"
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
SOURCE="..\include\pjsip-simple\types.h"
|
SOURCE="..\include\pjsip-simple\types.h"
|
||||||
# End Source File
|
# End Source File
|
||||||
# Begin Source File
|
# Begin Source File
|
||||||
|
|
|
@ -349,6 +349,10 @@
|
||||||
/>
|
/>
|
||||||
</FileConfiguration>
|
</FileConfiguration>
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\src\pjsip-simple\rpid.c"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\src\pjsip-simple\xpidf.c"
|
RelativePath="..\src\pjsip-simple\xpidf.c"
|
||||||
>
|
>
|
||||||
|
@ -408,6 +412,10 @@
|
||||||
RelativePath="..\include\pjsip-simple\publish.h"
|
RelativePath="..\include\pjsip-simple\publish.h"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\include\pjsip-simple\rpid.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\include\pjsip-simple\types.h"
|
RelativePath="..\include\pjsip-simple\types.h"
|
||||||
>
|
>
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -77,6 +77,11 @@ PJ_BEGIN_DECL
|
||||||
* Bad XPIDF Message
|
* Bad XPIDF Message
|
||||||
*/
|
*/
|
||||||
#define PJSIP_SIMPLE_EBADXPIDF (PJSIP_SIMPLE_ERRNO_START+25) /*270025*/
|
#define PJSIP_SIMPLE_EBADXPIDF (PJSIP_SIMPLE_ERRNO_START+25) /*270025*/
|
||||||
|
/**
|
||||||
|
* @hideinitializer
|
||||||
|
* Bad RPID Message
|
||||||
|
*/
|
||||||
|
#define PJSIP_SIMPLE_EBADRPID (PJSIP_SIMPLE_ERRNO_START+26) /*270026*/
|
||||||
|
|
||||||
|
|
||||||
/************************************************************
|
/************************************************************
|
||||||
|
|
|
@ -26,6 +26,7 @@
|
||||||
#include <pjsip-simple/evsub.h>
|
#include <pjsip-simple/evsub.h>
|
||||||
#include <pjsip-simple/pidf.h>
|
#include <pjsip-simple/pidf.h>
|
||||||
#include <pjsip-simple/xpidf.h>
|
#include <pjsip-simple/xpidf.h>
|
||||||
|
#include <pjsip-simple/rpid.h>
|
||||||
|
|
||||||
|
|
||||||
PJ_BEGIN_DECL
|
PJ_BEGIN_DECL
|
||||||
|
@ -73,6 +74,7 @@ PJ_DECL(pjsip_module*) pjsip_pres_instance(void);
|
||||||
*/
|
*/
|
||||||
#define PJSIP_PRES_STATUS_MAX_INFO 8
|
#define PJSIP_PRES_STATUS_MAX_INFO 8
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This structure describes presence status of a presentity.
|
* This structure describes presence status of a presentity.
|
||||||
*/
|
*/
|
||||||
|
@ -82,6 +84,8 @@ struct pjsip_pres_status
|
||||||
struct {
|
struct {
|
||||||
|
|
||||||
pj_bool_t basic_open; /**< Basic status/availability. */
|
pj_bool_t basic_open; /**< Basic status/availability. */
|
||||||
|
pjrpid_element rpid; /**< Optional RPID info. */
|
||||||
|
|
||||||
pj_str_t id; /**< Tuple id. */
|
pj_str_t id; /**< Tuple id. */
|
||||||
pj_str_t contact; /**< Optional contact address. */
|
pj_str_t contact; /**< Optional contact address. */
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,148 @@
|
||||||
|
/* $Id$ */
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2003-2007 Benny Prijono <benny@prijono.org>
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
*/
|
||||||
|
#ifndef __PJSIP_SIMPLE_RPID_H__
|
||||||
|
#define __PJSIP_SIMPLE_RPID_H__
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @file rpid.h
|
||||||
|
* @brief RPID: Rich Presence Extensions to the PIDF (RFC 4480)
|
||||||
|
*/
|
||||||
|
#include <pjsip-simple/types.h>
|
||||||
|
#include <pjsip-simple/pidf.h>
|
||||||
|
|
||||||
|
PJ_BEGIN_DECL
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @defgroup PJSIP_SIMPLE_RPID RPID/Rich Presence Extensions to PIDF (RFC 4480)
|
||||||
|
* @ingroup PJSIP_SIMPLE
|
||||||
|
* @brief RPID/Rich Presence Extensions to PIDF (RFC 4480)
|
||||||
|
* @{
|
||||||
|
*
|
||||||
|
* This file provides tools for managing subset of RPID elements into
|
||||||
|
* PIDF document.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This enumeration describes subset of standard activities as
|
||||||
|
* described by RFC 4880, RPID: Rich Presence Extensions to the
|
||||||
|
* Presence Information Data Format (PIDF).
|
||||||
|
*/
|
||||||
|
typedef enum pjrpid_activity
|
||||||
|
{
|
||||||
|
/** Activity is unknown. The activity would then be conceived
|
||||||
|
* in the "note" field.
|
||||||
|
*/
|
||||||
|
PJRPID_ACTIVITY_UNKNOWN,
|
||||||
|
|
||||||
|
/** The person is away */
|
||||||
|
PJRPID_ACTIVITY_AWAY,
|
||||||
|
|
||||||
|
/** The person is busy */
|
||||||
|
PJRPID_ACTIVITY_BUSY
|
||||||
|
|
||||||
|
} pjrpid_activity;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This enumeration describes types of RPID element.
|
||||||
|
*/
|
||||||
|
typedef enum pjrpid_element_type
|
||||||
|
{
|
||||||
|
/** RPID <person> element */
|
||||||
|
PJRPID_ELEMENT_TYPE_PERSON
|
||||||
|
|
||||||
|
} pjrpid_element_type;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This structure describes person information in RPID document.
|
||||||
|
*/
|
||||||
|
typedef struct pjrpid_element
|
||||||
|
{
|
||||||
|
/** Element type. */
|
||||||
|
pjrpid_element_type type;
|
||||||
|
|
||||||
|
/** Optional id to set on the element. */
|
||||||
|
pj_str_t id;
|
||||||
|
|
||||||
|
/** Activity type. */
|
||||||
|
pjrpid_activity activity;
|
||||||
|
|
||||||
|
/** Optional text describing the person/element. */
|
||||||
|
pj_str_t note;
|
||||||
|
|
||||||
|
} pjrpid_element;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Duplicate RPID element.
|
||||||
|
*
|
||||||
|
* @param pool Pool.
|
||||||
|
* @param dst Destination structure.
|
||||||
|
* @param src Source structure.
|
||||||
|
*/
|
||||||
|
PJ_DECL(void) pjrpid_element_dup(pj_pool_t *pool, pjrpid_element *dst,
|
||||||
|
const pjrpid_element *src);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add RPID element information into existing PIDF document. This will also
|
||||||
|
* add the appropriate XML namespace attributes into the presence's XML
|
||||||
|
* node, if the attributes are not already present, and also a <note> element
|
||||||
|
* to the first <tuple> element of the PIDF document.
|
||||||
|
*
|
||||||
|
* @param pres The PIDF presence document.
|
||||||
|
* @param pool Pool.
|
||||||
|
* @param options Currently unused, and must be zero.
|
||||||
|
* @param elem RPID element information to be added into the PIDF
|
||||||
|
* document.
|
||||||
|
*
|
||||||
|
* @return PJ_SUCCESS on success.
|
||||||
|
*/
|
||||||
|
PJ_DECL(pj_status_t) pjrpid_add_element(pjpidf_pres *pres,
|
||||||
|
pj_pool_t *pool,
|
||||||
|
unsigned options,
|
||||||
|
const pjrpid_element *elem);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get RPID element information from PIDF document, if any.
|
||||||
|
*
|
||||||
|
* @param pres The PIDF document containing RPID elements.
|
||||||
|
* @param pool Pool to duplicate the information.
|
||||||
|
* @param elem Structure to receive the element information.
|
||||||
|
*
|
||||||
|
* @return PJ_SUCCESS if the document does contain RPID element
|
||||||
|
* and the information has been parsed successfully.
|
||||||
|
*/
|
||||||
|
PJ_DECL(pj_status_t) pjrpid_get_element(const pjpidf_pres *pres,
|
||||||
|
pj_pool_t *pool,
|
||||||
|
pjrpid_element *elem);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
PJ_END_DECL
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* __PJSIP_SIMPLE_RPID_H__ */
|
||||||
|
|
|
@ -1917,6 +1917,16 @@ typedef struct pjsua_acc_info
|
||||||
*/
|
*/
|
||||||
pj_bool_t online_status;
|
pj_bool_t online_status;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Presence online status text.
|
||||||
|
*/
|
||||||
|
pj_str_t online_status_text;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Extended RPID online status information.
|
||||||
|
*/
|
||||||
|
pjrpid_element rpid;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Buffer that is used internally to store the status text.
|
* Buffer that is used internally to store the status text.
|
||||||
*/
|
*/
|
||||||
|
@ -2080,7 +2090,10 @@ PJ_DECL(pj_status_t) pjsua_acc_modify(pjsua_acc_id acc_id,
|
||||||
/**
|
/**
|
||||||
* Modify account's presence status to be advertised to remote/presence
|
* Modify account's presence status to be advertised to remote/presence
|
||||||
* subscribers. This would trigger the sending of outgoing NOTIFY request
|
* subscribers. This would trigger the sending of outgoing NOTIFY request
|
||||||
* if there are server side presence subscription for this account.
|
* if there are server side presence subscription for this account, and/or
|
||||||
|
* outgoing PUBLISH if presence publication is enabled for this account.
|
||||||
|
*
|
||||||
|
* @see pjsua_acc_set_online_status2()
|
||||||
*
|
*
|
||||||
* @param acc_id The account ID.
|
* @param acc_id The account ID.
|
||||||
* @param is_online True of false.
|
* @param is_online True of false.
|
||||||
|
@ -2095,6 +2108,24 @@ PJ_DECL(pj_status_t) pjsua_acc_modify(pjsua_acc_id acc_id,
|
||||||
PJ_DECL(pj_status_t) pjsua_acc_set_online_status(pjsua_acc_id acc_id,
|
PJ_DECL(pj_status_t) pjsua_acc_set_online_status(pjsua_acc_id acc_id,
|
||||||
pj_bool_t is_online);
|
pj_bool_t is_online);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Modify account's presence status to be advertised to remote/presence
|
||||||
|
* subscribers. This would trigger the sending of outgoing NOTIFY request
|
||||||
|
* if there are server side presence subscription for this account, and/or
|
||||||
|
* outgoing PUBLISH if presence publication is enabled for this account.
|
||||||
|
*
|
||||||
|
* @see pjsua_acc_set_online_status()
|
||||||
|
*
|
||||||
|
* @param acc_id The account ID.
|
||||||
|
* @param is_online True of false.
|
||||||
|
* @param pr Extended information in subset of RPID format
|
||||||
|
* which allows setting custom presence text.
|
||||||
|
*
|
||||||
|
* @return PJ_SUCCESS on success, or the appropriate error code.
|
||||||
|
*/
|
||||||
|
PJ_DECL(pj_status_t) pjsua_acc_set_online_status2(pjsua_acc_id acc_id,
|
||||||
|
pj_bool_t is_online,
|
||||||
|
const pjrpid_element *pr);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update registration or perform unregistration. If registration is
|
* Update registration or perform unregistration. If registration is
|
||||||
|
@ -2987,10 +3018,15 @@ typedef struct pjsua_buddy_info
|
||||||
*/
|
*/
|
||||||
pj_bool_t monitor_pres;
|
pj_bool_t monitor_pres;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Extended RPID information about the person.
|
||||||
|
*/
|
||||||
|
pjrpid_element rpid;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Internal buffer.
|
* Internal buffer.
|
||||||
*/
|
*/
|
||||||
char buf_[256];
|
char buf_[512];
|
||||||
|
|
||||||
} pjsua_buddy_info;
|
} pjsua_buddy_info;
|
||||||
|
|
||||||
|
|
|
@ -95,6 +95,7 @@ typedef struct pjsua_acc
|
||||||
pjsip_cred_info cred[PJSUA_ACC_MAX_PROXIES]; /**< Complete creds. */
|
pjsip_cred_info cred[PJSUA_ACC_MAX_PROXIES]; /**< Complete creds. */
|
||||||
|
|
||||||
pj_bool_t online_status; /**< Our online status. */
|
pj_bool_t online_status; /**< Our online status. */
|
||||||
|
pjrpid_element rpid; /**< RPID element information. */
|
||||||
pjsua_srv_pres pres_srv_list; /**< Server subscription list. */
|
pjsua_srv_pres pres_srv_list; /**< Server subscription list. */
|
||||||
pjsip_publishc *publish_sess; /**< Client publication session. */
|
pjsip_publishc *publish_sess; /**< Client publication session. */
|
||||||
pj_bool_t publish_state; /**< Last published online status */
|
pj_bool_t publish_state; /**< Last published online status */
|
||||||
|
@ -319,6 +320,11 @@ pj_status_t pjsua_pres_start(void);
|
||||||
*/
|
*/
|
||||||
void pjsua_pres_refresh(void);
|
void pjsua_pres_refresh(void);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Update server subscription (e.g. when our online status has changed)
|
||||||
|
*/
|
||||||
|
void pjsua_pres_update_acc(int acc_id, pj_bool_t force);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Shutdown presence.
|
* Shutdown presence.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -43,6 +43,7 @@ static const struct
|
||||||
{ PJSIP_SIMPLE_EBADCONTENT, "Bad Content-Type for presence" },
|
{ PJSIP_SIMPLE_EBADCONTENT, "Bad Content-Type for presence" },
|
||||||
{ PJSIP_SIMPLE_EBADPIDF, "Bad PIDF content for presence" },
|
{ PJSIP_SIMPLE_EBADPIDF, "Bad PIDF content for presence" },
|
||||||
{ PJSIP_SIMPLE_EBADXPIDF, "Bad XPIDF content for presence" },
|
{ PJSIP_SIMPLE_EBADXPIDF, "Bad XPIDF content for presence" },
|
||||||
|
{ PJSIP_SIMPLE_EBADRPID, "Invalid or bad RPID document"},
|
||||||
|
|
||||||
/* isComposing errors. */
|
/* isComposing errors. */
|
||||||
{ PJSIP_SIMPLE_EBADISCOMPOSE, "Bad isComposing indication/XML message" },
|
{ PJSIP_SIMPLE_EBADISCOMPOSE, "Bad isComposing indication/XML message" },
|
||||||
|
|
|
@ -390,6 +390,17 @@ PJ_DEF(pj_status_t) pjsip_pres_set_status( pjsip_evsub *sub,
|
||||||
pj_strdup(pres->dlg->pool,
|
pj_strdup(pres->dlg->pool,
|
||||||
&pres->status.info[i].contact,
|
&pres->status.info[i].contact,
|
||||||
&status->info[i].contact);
|
&status->info[i].contact);
|
||||||
|
|
||||||
|
/* Duplicate <person> */
|
||||||
|
pres->status.info[i].rpid.activity =
|
||||||
|
status->info[i].rpid.activity;
|
||||||
|
pj_strdup(pres->dlg->pool,
|
||||||
|
&pres->status.info[i].rpid.id,
|
||||||
|
&status->info[i].rpid.id);
|
||||||
|
pj_strdup(pres->dlg->pool,
|
||||||
|
&pres->status.info[i].rpid.note,
|
||||||
|
&status->info[i].rpid.note);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pres->status.info_cnt = status->info_cnt;
|
pres->status.info_cnt = status->info_cnt;
|
||||||
|
|
|
@ -101,6 +101,11 @@ PJ_DEF(pj_status_t) pjsip_pres_create_pidf( pj_pool_t *pool,
|
||||||
status->info[i].basic_open);
|
status->info[i].basic_open);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Create <person> (RPID) */
|
||||||
|
if (status->info_cnt) {
|
||||||
|
pjrpid_add_element(pidf, pool, 0, &status->info[0].rpid);
|
||||||
|
}
|
||||||
|
|
||||||
body = PJ_POOL_ZALLOC_T(pool, pjsip_msg_body);
|
body = PJ_POOL_ZALLOC_T(pool, pjsip_msg_body);
|
||||||
body->data = pidf;
|
body->data = pidf;
|
||||||
body->content_type.type = STR_APPLICATION;
|
body->content_type.type = STR_APPLICATION;
|
||||||
|
@ -196,6 +201,9 @@ PJ_DEF(pj_status_t) pjsip_pres_parse_pidf( pjsip_rx_data *rdata,
|
||||||
pres_status->info_cnt++;
|
pres_status->info_cnt++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Parse <person> (RPID) */
|
||||||
|
pjrpid_get_element(pidf, pool, &pres_status->info[0].rpid);
|
||||||
|
|
||||||
return PJ_SUCCESS;
|
return PJ_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,268 @@
|
||||||
|
/* $Id$ */
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2003-2007 Benny Prijono <benny@prijono.org>
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
*/
|
||||||
|
#include <pjsip-simple/rpid.h>
|
||||||
|
#include <pjsip-simple/errno.h>
|
||||||
|
#include <pj/assert.h>
|
||||||
|
#include <pj/guid.h>
|
||||||
|
#include <pj/string.h>
|
||||||
|
|
||||||
|
|
||||||
|
static const pj_str_t DM_NAME = {"xmlns:dm", 8};
|
||||||
|
static const pj_str_t DM_VAL = {"urn:ietf:params:xml:ns:pidf:data-model", 38};
|
||||||
|
static const pj_str_t RPID_NAME = {"xmlns:rpid", 10};
|
||||||
|
static const pj_str_t RPID_VAL = {"urn:ietf:params:xml:ns:pidf:rpid", 32};
|
||||||
|
|
||||||
|
static const pj_str_t DM_NOTE = {"dm:note", 7};
|
||||||
|
static const pj_str_t DM_PERSON = {"dm:person", 9};
|
||||||
|
static const pj_str_t ID = {"id", 2};
|
||||||
|
static const pj_str_t NOTE = {"note", 4};
|
||||||
|
static const pj_str_t RPID_ACTIVITIES = {"rpid:activities", 15};
|
||||||
|
static const pj_str_t RPID_AWAY = {"rpid:away", 9};
|
||||||
|
static const pj_str_t RPID_BUSY = {"rpid:busy", 9};
|
||||||
|
static const pj_str_t RPID_UNKNOWN = {"rpid:unknown", 12};
|
||||||
|
|
||||||
|
|
||||||
|
/* Duplicate RPID element */
|
||||||
|
PJ_DEF(void) pjrpid_element_dup(pj_pool_t *pool, pjrpid_element *dst,
|
||||||
|
const pjrpid_element *src)
|
||||||
|
{
|
||||||
|
pj_memcpy(dst, src, sizeof(pjrpid_element));
|
||||||
|
pj_strdup(pool, &dst->id, &src->id);
|
||||||
|
pj_strdup(pool, &dst->note, &src->note);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* Update RPID namespaces. */
|
||||||
|
static void update_namespaces(pjpidf_pres *pres,
|
||||||
|
pj_pool_t *pool)
|
||||||
|
{
|
||||||
|
/* Check if namespace is already present. */
|
||||||
|
if (pj_xml_find_attr(pres, &DM_NAME, NULL) != NULL)
|
||||||
|
return;
|
||||||
|
|
||||||
|
pj_xml_add_attr(pres, pj_xml_attr_new(pool, &DM_NAME, &DM_VAL));
|
||||||
|
pj_xml_add_attr(pres, pj_xml_attr_new(pool, &RPID_NAME, &RPID_VAL));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* Comparison function to find node name substring */
|
||||||
|
static pj_bool_t substring_match(const pj_xml_node *node,
|
||||||
|
const char *part_name,
|
||||||
|
int part_len)
|
||||||
|
{
|
||||||
|
pj_str_t end_name;
|
||||||
|
|
||||||
|
if (part_len < 1)
|
||||||
|
part_len = pj_ansi_strlen(part_name);
|
||||||
|
|
||||||
|
if (node->name.slen < part_len)
|
||||||
|
return PJ_FALSE;
|
||||||
|
|
||||||
|
end_name.ptr = node->name.ptr + (node->name.slen - part_len);
|
||||||
|
end_name.slen = part_len;
|
||||||
|
|
||||||
|
return pj_strnicmp2(&end_name, part_name, part_len)==0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Util to find child node with the specified substring */
|
||||||
|
static pj_xml_node *find_node(const pj_xml_node *parent,
|
||||||
|
const char *part_name)
|
||||||
|
{
|
||||||
|
const pj_xml_node *node = parent->node_head.next,
|
||||||
|
*head = (pj_xml_node*) &parent->node_head;
|
||||||
|
int part_len = pj_ansi_strlen(part_name);
|
||||||
|
|
||||||
|
while (node != head) {
|
||||||
|
if (substring_match(node, part_name, part_len))
|
||||||
|
return (pj_xml_node*) node;
|
||||||
|
|
||||||
|
node = node->next;
|
||||||
|
}
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Add RPID element into existing PIDF document.
|
||||||
|
*/
|
||||||
|
PJ_DEF(pj_status_t) pjrpid_add_element(pjpidf_pres *pres,
|
||||||
|
pj_pool_t *pool,
|
||||||
|
unsigned options,
|
||||||
|
const pjrpid_element *elem)
|
||||||
|
{
|
||||||
|
pj_xml_node *nd_person, *nd_activities, *nd_activity, *nd_note;
|
||||||
|
pj_xml_attr *attr;
|
||||||
|
|
||||||
|
PJ_ASSERT_RETURN(pres && pool && options==0 && elem, PJ_EINVAL);
|
||||||
|
|
||||||
|
PJ_UNUSED_ARG(options);
|
||||||
|
|
||||||
|
/* Check if we need to add RPID information into the PIDF document. */
|
||||||
|
if (elem->id.slen==0 &&
|
||||||
|
elem->activity==PJRPID_ACTIVITY_UNKNOWN &&
|
||||||
|
elem->note.slen==0)
|
||||||
|
{
|
||||||
|
/* No RPID information to be added. */
|
||||||
|
return PJ_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Add <note> to <tuple> */
|
||||||
|
if (elem->note.slen != 0) {
|
||||||
|
pj_xml_node *nd_tuple;
|
||||||
|
|
||||||
|
nd_tuple = find_node(pres, "tuple");
|
||||||
|
|
||||||
|
if (nd_tuple) {
|
||||||
|
nd_note = pj_xml_node_new(pool, &NOTE);
|
||||||
|
pj_strdup(pool, &nd_note->content, &elem->note);
|
||||||
|
pj_xml_add_node(nd_tuple, nd_note);
|
||||||
|
nd_note = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Update namespace */
|
||||||
|
update_namespaces(pres, pool);
|
||||||
|
|
||||||
|
/* Add <person> */
|
||||||
|
nd_person = pj_xml_node_new(pool, &DM_PERSON);
|
||||||
|
if (elem->id.slen != 0) {
|
||||||
|
attr = pj_xml_attr_new(pool, &ID, &elem->id);
|
||||||
|
} else {
|
||||||
|
pj_str_t person_id;
|
||||||
|
pj_create_unique_string(pool, &person_id);
|
||||||
|
attr = pj_xml_attr_new(pool, &ID, &person_id);
|
||||||
|
}
|
||||||
|
pj_xml_add_attr(nd_person, attr);
|
||||||
|
pj_xml_add_node(pres, nd_person);
|
||||||
|
|
||||||
|
/* Add <activities> */
|
||||||
|
nd_activities = pj_xml_node_new(pool, &RPID_ACTIVITIES);
|
||||||
|
pj_xml_add_node(nd_person, nd_activities);
|
||||||
|
|
||||||
|
/* Add the activity */
|
||||||
|
switch (elem->activity) {
|
||||||
|
case PJRPID_ACTIVITY_AWAY:
|
||||||
|
nd_activity = pj_xml_node_new(pool, &RPID_AWAY);
|
||||||
|
break;
|
||||||
|
case PJRPID_ACTIVITY_BUSY:
|
||||||
|
nd_activity = pj_xml_node_new(pool, &RPID_BUSY);
|
||||||
|
break;
|
||||||
|
case PJRPID_ACTIVITY_UNKNOWN:
|
||||||
|
default:
|
||||||
|
nd_activity = pj_xml_node_new(pool, &RPID_UNKNOWN);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
pj_xml_add_node(nd_activities, nd_activity);
|
||||||
|
|
||||||
|
/* Add custom text if required. */
|
||||||
|
if (elem->note.slen != 0) {
|
||||||
|
nd_note = pj_xml_node_new(pool, &DM_NOTE);
|
||||||
|
pj_strdup(pool, &nd_note->content, &elem->note);
|
||||||
|
pj_xml_add_node(nd_person, nd_note);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Done */
|
||||||
|
return PJ_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* Get <note> element from PIDF <tuple> element */
|
||||||
|
static pj_status_t get_tuple_note(const pjpidf_pres *pres,
|
||||||
|
pj_pool_t *pool,
|
||||||
|
pjrpid_element *elem)
|
||||||
|
{
|
||||||
|
const pj_xml_node *nd_tuple, *nd_note;
|
||||||
|
|
||||||
|
nd_tuple = find_node(pres, "tuple");
|
||||||
|
if (!nd_tuple)
|
||||||
|
return PJSIP_SIMPLE_EBADRPID;
|
||||||
|
|
||||||
|
nd_note = find_node(pres, "note");
|
||||||
|
if (nd_note) {
|
||||||
|
pj_strdup(pool, &elem->note, &nd_note->content);
|
||||||
|
return PJ_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
return PJSIP_SIMPLE_EBADRPID;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Get RPID element from PIDF document, if any.
|
||||||
|
*/
|
||||||
|
PJ_DEF(pj_status_t) pjrpid_get_element(const pjpidf_pres *pres,
|
||||||
|
pj_pool_t *pool,
|
||||||
|
pjrpid_element *elem)
|
||||||
|
{
|
||||||
|
const pj_xml_node *nd_person, *nd_activities, *nd_note = NULL;
|
||||||
|
const pj_xml_attr *attr;
|
||||||
|
|
||||||
|
/* Reset */
|
||||||
|
pj_bzero(elem, sizeof(*elem));
|
||||||
|
elem->activity = PJRPID_ACTIVITY_UNKNOWN;
|
||||||
|
|
||||||
|
/* Find <person> */
|
||||||
|
nd_person = find_node(pres, "person");
|
||||||
|
if (!nd_person) {
|
||||||
|
/* <person> not found, try to get <note> from <tuple> */
|
||||||
|
return get_tuple_note(pres, pool, elem);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Get element id attribute */
|
||||||
|
attr = pj_xml_find_attr((pj_xml_node*)nd_person, &ID, NULL);
|
||||||
|
if (attr)
|
||||||
|
pj_strdup(pool, &elem->id, &attr->value);
|
||||||
|
|
||||||
|
/* Get <activities> */
|
||||||
|
nd_activities = find_node(nd_person, "activities");
|
||||||
|
if (nd_activities) {
|
||||||
|
const pj_xml_node *nd_activity;
|
||||||
|
|
||||||
|
/* Try to get <note> from <activities> */
|
||||||
|
nd_note = find_node(nd_activities, "note");
|
||||||
|
|
||||||
|
/* Get the activity */
|
||||||
|
nd_activity = nd_activities->node_head.next;
|
||||||
|
if (nd_activity == nd_note)
|
||||||
|
nd_activity = nd_activity->next;
|
||||||
|
|
||||||
|
if (nd_activity != (pj_xml_node*) &nd_activities->node_head) {
|
||||||
|
if (substring_match(nd_activity, "busy", -1))
|
||||||
|
elem->activity = PJRPID_ACTIVITY_BUSY;
|
||||||
|
else if (substring_match(nd_activity, "away", -1))
|
||||||
|
elem->activity = PJRPID_ACTIVITY_AWAY;
|
||||||
|
else
|
||||||
|
elem->activity = PJRPID_ACTIVITY_UNKNOWN;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* If <note> is not found, get <note> from <person> */
|
||||||
|
if (nd_note == NULL)
|
||||||
|
nd_note = find_node(nd_person, "note");
|
||||||
|
|
||||||
|
if (nd_note) {
|
||||||
|
pj_strdup(pool, &elem->note, &nd_note->content);
|
||||||
|
} else {
|
||||||
|
get_tuple_note(pres, pool, elem);
|
||||||
|
}
|
||||||
|
|
||||||
|
return PJ_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -430,7 +430,26 @@ PJ_DEF(pj_status_t) pjsua_acc_set_online_status( pjsua_acc_id acc_id,
|
||||||
PJ_ASSERT_RETURN(pjsua_var.acc[acc_id].valid, PJ_EINVALIDOP);
|
PJ_ASSERT_RETURN(pjsua_var.acc[acc_id].valid, PJ_EINVALIDOP);
|
||||||
|
|
||||||
pjsua_var.acc[acc_id].online_status = is_online;
|
pjsua_var.acc[acc_id].online_status = is_online;
|
||||||
pjsua_pres_refresh();
|
pj_bzero(&pjsua_var.acc[acc_id].rpid, sizeof(pjrpid_element));
|
||||||
|
pjsua_pres_update_acc(acc_id, PJ_FALSE);
|
||||||
|
return PJ_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Set online status with extended information
|
||||||
|
*/
|
||||||
|
PJ_DEF(pj_status_t) pjsua_acc_set_online_status2( pjsua_acc_id acc_id,
|
||||||
|
pj_bool_t is_online,
|
||||||
|
const pjrpid_element *pr)
|
||||||
|
{
|
||||||
|
PJ_ASSERT_RETURN(acc_id>=0 && acc_id<(int)PJ_ARRAY_SIZE(pjsua_var.acc),
|
||||||
|
PJ_EINVAL);
|
||||||
|
PJ_ASSERT_RETURN(pjsua_var.acc[acc_id].valid, PJ_EINVALIDOP);
|
||||||
|
|
||||||
|
pjsua_var.acc[acc_id].online_status = is_online;
|
||||||
|
pjrpid_element_dup(pjsua_var.pool, &pjsua_var.acc[acc_id].rpid, pr);
|
||||||
|
pjsua_pres_update_acc(acc_id, PJ_TRUE);
|
||||||
return PJ_SUCCESS;
|
return PJ_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -689,7 +708,14 @@ PJ_DEF(pj_status_t) pjsua_acc_get_info( pjsua_acc_id acc_id,
|
||||||
info->acc_uri = acc_cfg->id;
|
info->acc_uri = acc_cfg->id;
|
||||||
info->has_registration = (acc->cfg.reg_uri.slen > 0);
|
info->has_registration = (acc->cfg.reg_uri.slen > 0);
|
||||||
info->online_status = acc->online_status;
|
info->online_status = acc->online_status;
|
||||||
|
pj_memcpy(&info->rpid, &acc->rpid, sizeof(pjrpid_element));
|
||||||
|
if (info->rpid.note.slen)
|
||||||
|
info->online_status_text = info->rpid.note;
|
||||||
|
else if (info->online_status)
|
||||||
|
info->online_status_text = pj_str("Online");
|
||||||
|
else
|
||||||
|
info->online_status_text = pj_str("Offline");
|
||||||
|
|
||||||
if (acc->reg_last_err) {
|
if (acc->reg_last_err) {
|
||||||
info->status = (pjsip_status_code) acc->reg_last_err;
|
info->status = (pjsip_status_code) acc->reg_last_err;
|
||||||
pj_strerror(acc->reg_last_err, info->buf_, sizeof(info->buf_));
|
pj_strerror(acc->reg_last_err, info->buf_, sizeof(info->buf_));
|
||||||
|
|
|
@ -113,7 +113,15 @@ PJ_DEF(pj_status_t) pjsua_buddy_get_info( pjsua_buddy_id buddy_id,
|
||||||
info->status_text = pj_str("?");
|
info->status_text = pj_str("?");
|
||||||
} else if (pjsua_var.buddy[buddy_id].status.info[0].basic_open) {
|
} else if (pjsua_var.buddy[buddy_id].status.info[0].basic_open) {
|
||||||
info->status = PJSUA_BUDDY_STATUS_ONLINE;
|
info->status = PJSUA_BUDDY_STATUS_ONLINE;
|
||||||
info->status_text = pj_str("Online");
|
|
||||||
|
/* copy RPID information */
|
||||||
|
info->rpid = buddy->status.info[0].rpid;
|
||||||
|
|
||||||
|
if (info->rpid.note.slen)
|
||||||
|
info->status_text = info->rpid.note;
|
||||||
|
else
|
||||||
|
info->status_text = pj_str("Online");
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
info->status = PJSUA_BUDDY_STATUS_OFFLINE;
|
info->status = PJSUA_BUDDY_STATUS_OFFLINE;
|
||||||
info->status_text = pj_str("Offline");
|
info->status_text = pj_str("Offline");
|
||||||
|
@ -652,6 +660,9 @@ static pj_status_t send_publish(int acc_id, pj_bool_t active)
|
||||||
pres_status.info_cnt = 1;
|
pres_status.info_cnt = 1;
|
||||||
pres_status.info[0].basic_open = acc->online_status;
|
pres_status.info[0].basic_open = acc->online_status;
|
||||||
pres_status.info[0].id = acc->cfg.pidf_tuple_id;
|
pres_status.info[0].id = acc->cfg.pidf_tuple_id;
|
||||||
|
/* .. including RPID information */
|
||||||
|
pj_memcpy(&pres_status.info[0].rpid, &acc->rpid,
|
||||||
|
sizeof(pjrpid_element));
|
||||||
|
|
||||||
/* Be careful not to send PIDF with presence entity ID containing
|
/* Be careful not to send PIDF with presence entity ID containing
|
||||||
* "<" character.
|
* "<" character.
|
||||||
|
@ -821,8 +832,8 @@ void pjsua_pres_delete_acc(int acc_id)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Refresh subscription (e.g. when our online status has changed) */
|
/* Update server subscription (e.g. when our online status has changed) */
|
||||||
static void refresh_server_subscription(int acc_id)
|
void pjsua_pres_update_acc(int acc_id, pj_bool_t force)
|
||||||
{
|
{
|
||||||
pjsua_acc *acc = &pjsua_var.acc[acc_id];
|
pjsua_acc *acc = &pjsua_var.acc[acc_id];
|
||||||
pjsua_acc_config *acc_cfg = &pjsua_var.acc[acc_id].cfg;
|
pjsua_acc_config *acc_cfg = &pjsua_var.acc[acc_id].cfg;
|
||||||
|
@ -836,8 +847,12 @@ static void refresh_server_subscription(int acc_id)
|
||||||
pjsip_tx_data *tdata;
|
pjsip_tx_data *tdata;
|
||||||
|
|
||||||
pjsip_pres_get_status(uapres->sub, &pres_status);
|
pjsip_pres_get_status(uapres->sub, &pres_status);
|
||||||
if (pres_status.info[0].basic_open != acc->online_status) {
|
if (force || pres_status.info[0].basic_open != acc->online_status) {
|
||||||
|
|
||||||
pres_status.info[0].basic_open = acc->online_status;
|
pres_status.info[0].basic_open = acc->online_status;
|
||||||
|
pj_memcpy(&pres_status.info[0].rpid, &acc->rpid,
|
||||||
|
sizeof(pjrpid_element));
|
||||||
|
|
||||||
pjsip_pres_set_status(uapres->sub, &pres_status);
|
pjsip_pres_set_status(uapres->sub, &pres_status);
|
||||||
|
|
||||||
if (pjsip_pres_current_notify(uapres->sub, &tdata)==PJ_SUCCESS) {
|
if (pjsip_pres_current_notify(uapres->sub, &tdata)==PJ_SUCCESS) {
|
||||||
|
@ -855,7 +870,7 @@ static void refresh_server_subscription(int acc_id)
|
||||||
* send the first PUBLISH.
|
* send the first PUBLISH.
|
||||||
*/
|
*/
|
||||||
if (acc_cfg->publish_enabled && acc->publish_sess) {
|
if (acc_cfg->publish_enabled && acc->publish_sess) {
|
||||||
if (acc->publish_state != acc->online_status) {
|
if (force || acc->publish_state != acc->online_status) {
|
||||||
send_publish(acc_id, PJ_TRUE);
|
send_publish(acc_id, PJ_TRUE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1251,7 +1266,7 @@ void pjsua_pres_refresh()
|
||||||
|
|
||||||
for (i=0; i<PJ_ARRAY_SIZE(pjsua_var.acc); ++i) {
|
for (i=0; i<PJ_ARRAY_SIZE(pjsua_var.acc); ++i) {
|
||||||
if (pjsua_var.acc[i].valid)
|
if (pjsua_var.acc[i].valid)
|
||||||
refresh_server_subscription(i);
|
pjsua_pres_update_acc(i, PJ_FALSE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue