Example #1
0
void get_and_register_SDP_to_cloud(struct ice_trans_s* icetrans, ice_option_t opt, char *usrid)
{
    static char buffer[2048];
    int len;


    if (icetrans->icest == NULL) {
        PJ_LOG(1,(THIS_FILE, "Error: No ICE instance, create it first"));
        return;
    }

    PJ_LOG(4, (__FUNCTION__, "General info"));
    PJ_LOG(4, (__FUNCTION__,"---------------"));
    PJ_LOG(4, (__FUNCTION__,"Component count    : %d\n", opt.comp_cnt));
    PJ_LOG(4, (__FUNCTION__,"Status             : "));
    if (pj_ice_strans_sess_is_complete(icetrans->icest))
        puts("negotiation complete");
    else if (pj_ice_strans_sess_is_running(icetrans->icest))
        puts("negotiation is in progress");
    else if (pj_ice_strans_has_sess(icetrans->icest))
        puts("session ready");
    else
        puts("session not created");

    if (!pj_ice_strans_has_sess(icetrans->icest)) {
        puts("Create the session first to see more info");
        return;
    }

    printf("Negotiated comp_cnt: %d\n",
           pj_ice_strans_get_running_comp_cnt(icetrans->icest));
    printf("Role               : %s\n",
           pj_ice_strans_get_role(icetrans->icest)==PJ_ICE_SESS_ROLE_CONTROLLED ?
               "controlled" : "controlling");


    len = extract_sdp_to_xml(icetrans, buffer, 2048, opt, usrid);
    if (len < 0)
        err_exit("not enough buffer to show ICE status", -len, icetrans);

    // Register this local SDP to cloud
    char full_url[256];
    //printf("[DEBUG] %s, %d  \n", __FUNCTION__, __LINE__ );

    strcpy(full_url, gUrl); // plus URL
    strcpy(&full_url[strlen(full_url)], "/peer/registerPeer"); // plus API
    http_post_request(full_url, buffer);




    PJ_LOG(4, (__FUNCTION__,"Local SDP (paste this to remote host):\n"
           "--------------------------------------\n"
           "%s\n", buffer));
}
Example #2
0
void Cmeetphonemeet::OnNMClickListMember(NMHDR *pNMHDR, LRESULT *pResult)
{
	LPNMITEMACTIVATE pNMItemActivate = reinterpret_cast<LPNMITEMACTIVATE>(pNMHDR);
	if(pNMItemActivate->iItem!=-1 && (pNMItemActivate->iSubItem == 3 || pNMItemActivate->iSubItem == 4 || pNMItemActivate->iSubItem == 5) )
	{
		LinphoneCore *lc = theApp.GetCore();
		MemberData *memberData = (MemberData *)m_hListMember.GetItemData(pNMItemActivate->iItem);
		CString strFormData;
		Json::Value response;
		strFormData.Format(_T("uid=%s&partId=%d&num=0"), m_sConfUID, memberData->memberId);

		if(pNMItemActivate->iSubItem == 3)
		{	
			strFormData.Format(_T("uid=%s&id=%d&num=0"), m_sConfUID, memberData->memberId);
			CString restMethod("/mcuWeb/controller/setMosaicSlot");
			if( http_post_request(restMethod, strFormData, response) )
			{
			}
		}

		if(pNMItemActivate->iSubItem == 4)
		{	
			CString restMethod("/mcuWeb/controller/setAudioMute");
			if( http_post_request(restMethod, strFormData, response) )
			{
				memberData->muted = !memberData->muted;
				int image_pos = memberData->muted ? 3 : 1;
				m_hListMember.SetItem(pNMItemActivate->iItem, pNMItemActivate->iSubItem, LVIF_IMAGE, NULL, image_pos, LVIS_SELECTED, LVIS_SELECTED, NULL );
			}
		}
	
		if(pNMItemActivate->iSubItem == 5)
		{
			CString restMethod("/mcuWeb/controller/removeParticipant");
			if(http_post_request(restMethod, strFormData, response))
			{
			}	
		}
	}
	*pResult = 0;
}