Ejemplo n.º 1
0
/** MyH323EndPoint 
  * The fullAddress parameter is used directly in the MakeCall method so
  * the General form for the fullAddress argument is :
  * [alias@][transport$]host[:port]
  * default values:	alias = the same value as host.
  *					transport = ip.
  *					port = 1720.
  */
int MyH323EndPoint::MakeCall(const PString & dest, PString & token, unsigned int *callReference, unsigned int port, char *callerid, char *callername)
{
	PString fullAddress;
	MyH323Connection * connection;

	/* Determine whether we are using a gatekeeper or not. */
	if (GetGatekeeper() != NULL) {
		fullAddress = dest;
		if (h323debug)
			cout << " -- Making call to " << fullAddress << " using gatekeeper." << endl;
	} else {
			fullAddress = dest; /* host */
			if (h323debug)
				cout << " -- Making call to " << fullAddress << "." << endl;
	}

	if (!(connection = (MyH323Connection *)H323EndPoint::MakeCallLocked(fullAddress, token))) {
		if (h323debug)
			cout << "Error making call to \"" << fullAddress << '"' << endl;
		return 1;
	}
	
	*callReference = connection->GetCallReference();
	
	if (callerid)
		connection->SetLocalPartyName(PString(callerid));
	if (callername) {
                localAliasNames.RemoveAll();
		connection->SetLocalPartyName(PString(callername));
	        if (callerid)
                  localAliasNames.AppendString(PString(callerid));
        } else if (callerid) {
                localAliasNames.RemoveAll();
                connection->SetLocalPartyName(PString(callerid));
        }
        
        connection->AST_Outgoing = TRUE;

	connection->Unlock(); 	

	if (h323debug) {
		cout << "	-- " << GetLocalUserName() << " is calling host " << fullAddress << endl;
		cout << "	-- " << "Call token is " << (const char *)token << endl;
		cout << "	-- Call reference is " << *callReference << endl;
	}
	return 0;
}
/** The fullAddress parameter is used directly in the MakeCall method so
  * the General form for the fullAddress argument is :
  * [alias@][transport$]host[:port]
  * default values:	alias = the same value as host.
  *					transport = ip.
  *					port = 1720.
  */
int MyH323EndPoint::MakeCall(const PString & dest, PString & token, unsigned int *callReference, call_options_t *opts)
{
	PString fullAddress;
	MyH323Connection * connection;

	/* Determine whether we are using a gatekeeper or not. */
	if (GetGatekeeper()) {
		fullAddress = dest;
		if (h323debug) {
			cout << " -- Making call to " << fullAddress << " using gatekeeper." << endl;
		}
	} else {
		fullAddress = dest; 
		if (h323debug) {
			cout << " -- Making call to " << fullAddress << " without gatekeeper." << endl;
		}
	}
	if (!(connection = (MyH323Connection *)H323EndPoint::MakeCallLocked(fullAddress, token, opts))) {
		if (h323debug) {
			cout << "Error making call to \"" << fullAddress << '"' << endl;
		}
		return 1;
	}
	*callReference = connection->GetCallReference();	

	if (opts->cid_num) {
		connection->ast_cid_num = PString(opts->cid_num);
	}
	if (opts->cid_name) {
		connection->ast_cid_name = PString(opts->cid_name);
		connection->SetLocalPartyName(connection->ast_cid_name);
	}

	connection->dtmfCodec = (RTP_DataFrame::PayloadTypes)opts->dtmfcodec;

	if (h323debug) {
		cout << "\t-- " << GetLocalUserName() << " is calling host " << fullAddress << endl;
		cout << "\t-- Call token is " << (const char *)token << endl;
		cout << "\t-- Call reference is " << *callReference << endl;
		cout << "\t-- DTMF Payload is " << connection->dtmfCodec << endl;
	}
	connection->Unlock(); 	
	return 0;
}
Ejemplo n.º 3
0
bool EndPoint::init()
{
	PTRACE( 1, "Initializing endpoint" );

#ifdef ENTERPRISE
	if( !ldapQueried ) {
		PError << "LDAP was not queried successfuly." << endl;
		return false;
	}

	if( ldapAliases.IsEmpty() ) {
		PError << "Aliases were not fetched from LDAP." << endl;
		return false;
	}

	SetLocalUserName( ldapAliases[0] );
	for (int i = 1; i < ldapAliases.GetSize(); i++)
		AddAliasName( ldapAliases[i]);
	if( ldapAttrs.HasKey("h323IdentitydialedDigits") )
		AddAliasName( ldapAttrs.GetString("h323IdentitydialedDigits") );
#else

	if( args.HasOption('u')) {
		PStringArray aliases = args.GetOptionString('u').Lines();
		SetLocalUserName(aliases[0]);
		for (int i = 1; i < aliases.GetSize(); i++)
			AddAliasName(aliases[i]);
	}
	else {
		QStringList userAliases = ancaConf->readListEntry( USER_ALIASES );
		SetLocalUserName( userAliases[ 0 ].latin1() );
		for ( unsigned i = 1; i < userAliases.size(); i++ )
			AddAliasName( userAliases[ i ].latin1() );
	}
#endif

	bool disableFastStart = !ancaConf->readBoolEntry( FAST_START, FAST_START_DEFAULT );
	bool disableTunneling = !ancaConf->readBoolEntry( H245_TUNNELING, H245_TUNNELING_DEFAULT );
	bool disableH245InSetup = !ancaConf->readBoolEntry( H245_IN_SETUP, H245_IN_SETUP_DEFAULT );
	if( args.HasOption("fast-disable") )
		disableFastStart = true;
	if( args.HasOption("h245tunneldisable") )
		disableTunneling = true;
	if( args.HasOption("disable-h245-in-setup") )
		disableH245InSetup = true;

	DisableFastStart( disableFastStart );
	DisableH245Tunneling( disableTunneling );
	DisableH245inSetup( disableH245InSetup );


	// Codecs
	AudioPlugin *audioPlugin = (AudioPlugin*)pluginFactory->getPlugin(Plugin::Audio);
	if( audioPlugin ) {
		audioPlugin->addCapabilities();
	}

	VideoInPlugin *videoPlugin = (VideoInPlugin*)pluginFactory->getPlugin(Plugin::VideoIn);
	if( videoPlugin ) {
		videoPlugin->addCapabilities();
	}

	AddAllUserInputCapabilities( 0, 1 );

	PTRACE( 1, "Capabilities:\n" << setprecision( 2 ) << capabilities );

	ancaInfo->set( ADDRESS, ( const char * ) (GetLocalUserName() + "@" + PIPSocket::GetHostName()) );

	// Initialise the security info
	if( args.HasOption("password") ) {
		SetGatekeeperPassword( args.GetOptionString("password") );
		PTRACE( 1, "Enabling H.235 security access to gatekeeper." );
	}

	// Do not start H323 Listener
	if( args.HasOption("no-listenport") ) return true;

	// Start H323 Listener
	PIPSocket::Address addr = INADDR_ANY;
	WORD port = ancaConf->readIntEntry( PORT, PORT_DEFAULT );
	if (args.HasOption("listenport"))
		port = (WORD)args.GetOptionString("listenport").AsInteger();

	listener = new H323ListenerTCP( *this, addr, port );
	if ( listener == NULL || !StartListener( listener ) ) {
		PTRACE(1, "Unable to start H323 Listener at port " << port );
		if ( listener != NULL )
			delete listener;
		return false;
	}
	PTRACE( 1, "TCP listener started at port " << port );

	return true;
}
Ejemplo n.º 4
0
BOOL CMyPhoneEndPoint::Initialise(CMyPhoneDlg *dlg, CVideoDlg *vdlg)
{
	m_dialog = dlg;
        m_vdlg = vdlg;
	isIncomingCall = FALSE;

	SetAudioJitterDelay(50, config.GetInteger(JitterConfigKey, GetMaxAudioJitterDelay()));
	SetSoundChannelBufferDepth(config.GetInteger(BufferCountConfigKey, GetSoundChannelBufferDepth()));
	
	// UserInput mode
    // Backward compatibility configuration entry
    unsigned mode = H323Connection::SendUserInputAsString;
	m_fDtmfAsString=true;
    if (config.HasKey(DtmfAsStringConfigKey)) {
		if (!config.GetBoolean(DtmfAsStringConfigKey))
		{
			mode = H323Connection::SendUserInputAsTone;
			m_fDtmfAsString=false;
		}
		config.DeleteKey(DtmfAsStringConfigKey);
	}
	mode = config.GetInteger(UserInputModeConfigKey, mode);
	SetSendUserInputMode((H323Connection::SendUserInputModes)mode);

//        SetSoundChannelPlayDriver("WindowsMutimedia");
//        SetSoundChannelRecordDriver("WindowsMultimedia");
//        SetSoundChannelPlayDriver("DirectSound");
//        SetSoundChannelRecordDriver("DirectSound");
	
        PString soundPlayStr = config.GetString(SoundPlayConfigKey, GetSoundChannelPlayDevice());
        PStringArray soundPlayer = soundPlayStr.Tokenise('\t');
        BOOL fPlayerAvailable;
        if(soundPlayer.GetSize()==1)
        {  
         SetSoundChannelPlayDriver("WindowsMutimedia");
	 fPlayerAvailable = SetSoundChannelPlayDevice(soundPlayer[0]);
         PTRACE(1, "MyPhone\tSetSoundPlayer Driver:WindowsMultimedia, Device:" << soundPlayer[0]);
        }
        else
        {
         SetSoundChannelPlayDriver(soundPlayer[0]);
	 fPlayerAvailable = SetSoundChannelPlayDevice(soundPlayer[1]);
         PTRACE(1, "MyPhone\tSetSoundPlayer Driver:" << soundPlayer[0] << ", Device:" << soundPlayer[1]);
	}

        PString soundRecordStr = config.GetString(SoundRecordConfigKey, GetSoundChannelRecordDevice());
        PStringArray soundRecorder = soundRecordStr.Tokenise('\t');
        BOOL fRecorderAvailable;
        if(soundRecorder.GetSize()==1)
        {  
         SetSoundChannelRecordDriver("WindowsMutimedia");
	 fRecorderAvailable = SetSoundChannelRecordDevice(soundRecorder[0]);
         PTRACE(1, "MyPhone\tSetSoundRecorder Driver:WindowsMultimedia, Device:" << soundRecorder[0]);
        }
        else
        {
         SetSoundChannelRecordDriver(soundRecorder[0]);
	 fRecorderAvailable = SetSoundChannelRecordDevice(soundRecorder[1]);
         PTRACE(1, "MyPhone\tSetSoundRecorder Driver:" << soundRecorder[0] << ", Device:" << soundRecorder[1]);
	}

	m_fAECOn = config.GetBoolean(AECEnableConfigKey, FALSE);
	m_fAGCOn = config.GetInteger(AGCEnableConfigKey, FALSE);
	SetAECAlgo(m_fAECOn);
	agc = m_fAGCOn;
	             
	// set some oter settings from Config
	m_fNoFastStart =  config.GetBoolean(NoFastStartConfigKey, FALSE);
    DisableFastStart(m_fNoFastStart);
	m_fStrictSingleLine =  config.GetBoolean(StrictSingleLineConfigKey, FALSE);
    StrictSingleLine(m_fStrictSingleLine);

	m_fDoH245Tunnelling = !(config.GetBoolean(NoTunnelingConfigKey, FALSE));
    DisableH245Tunneling(!m_fDoH245Tunnelling);
	m_fSilenceOn = config.GetBoolean(SilenceDetectConfigKey, TRUE);
    SetSilenceDetectionMode(m_fSilenceOn
		? H323AudioCodec::AdaptiveSilenceDetection
		: H323AudioCodec::NoSilenceDetection);
    SetLocalUserName(config.GetString(UsernameConfigKey, GetLocalUserName()));
    SetInitialBandwidth((unsigned)(config.GetReal(BandwidthConfigKey, 10000)*20));
    SetRtpIpTypeofService(config.GetInteger(IpTosConfigKey, GetRtpIpTypeofService()));
	
	SetRtpIpPorts(config.GetInteger(RTPPortBaseConfigKey, GetRtpIpPortBase()),
		config.GetInteger(RTPPortMaxConfigKey,  GetRtpIpPortBase()));
	if(config.HasKey(RouterConfigKey))
		m_router = config.GetString(RouterConfigKey, m_router.AsString());
	
	m_fAutoAnswer = config.GetBoolean(AutoAnswerConfigKey, false);
	m_fAutoMute = config.GetBoolean(AutoMuteConfigKey, false);
	
    CString alias, aliases;
	aliases = CString((const char *)config.GetString(AliasConfigKey, _T("")));
	aliases.TrimLeft();
	int iPos=0;
    while ((iPos = aliases.Find(_T("|")))>0)  // loading user aliases
	{
		alias = aliases.Left(iPos);
		aliases.Delete(0,iPos+1);
		AddAliasName((LPCTSTR)alias);
	}
	
	// The order in which capabilities are added to the capability table
	// determines which one is selected by default.
	LoadCapabilities();
	
	PString interfaces = config.GetString(ListenerInterfaceConfigKey, "*");
	if(StartListeners(interfaces.Tokenise(',')))
	{
		m_dialog->OutputStatusStr((LPCTSTR)LoadStringLang(IDS_MPREADY1STR), S_SYSTEM, (const char *)strProgName);
		return true;
	}
	else
	{
		m_dialog->OutputStatusStr((LPCTSTR)LoadStringLang(IDS_ERRLSNSTR), S_SYSTEM, (const char *)strProgName, (const char *)interfaces);
		return false;
	}
}
Ejemplo n.º 5
0
lc::Settings::Settings( const QSettings &argSettings, QObject *argParent ) :
    QObject{ argParent },
    defaultReceiptIndex{ GetDefaultReceiptIndex( argSettings ) },
    browserCmd{ ReadSettingsItem( "browser_command",
                                  "Opening ORSEE in a browser will not work.",
                                  argSettings, true ) },
    dvipsCmd{ ReadSettingsItem( "dvips_command",
                                "Receipts creation will not work.",
                                argSettings, true ) },
    fileMngr{ ReadSettingsItem( "file_manager",
                                "The display of preprints will not work.",
                                argSettings, true ) },
    killallCmd{ ReadSettingsItem( "killall_command",
                                  "Killing 'zleaf.exe' instances will not work.",
                                  argSettings, true ) },
    latexCmd{ ReadSettingsItem( "latex_command",
                                "Receipts creation will not work.",
                                argSettings, true ) },
    lcInstDir{ ReadSettingsItem( "labcontrol_installation_directory",
                                 "Labcontrol will missbehave with high propability.",
                                 argSettings, true ) },
    localUserName{ GetLocalUserName() },
    localzLeafSize{ ReadSettingsItem( "local_zLeaf_size",
                               "Resolution of local zLeaf window",
                               argSettings, false ) },
    lprCmd{ ReadSettingsItem( "lpr_command",
                              "Receipts printing will not work.",
                              argSettings, true ) },
    netstatCmd{ ReadSettingsItem( "netstat_command",
                                  "Detection of active zLeaf connections will not work.",
                                  argSettings, true ) },
    netwBrdAddr{ ReadSettingsItem( "network_broadcast_address",
                                   "Booting the clients will not work.",
                                   argSettings, false ) },
    orseeUrl{ ReadSettingsItem( "orsee_url",
                                "Opening ORSEE in a browser will not work.",
                                argSettings, false ) },
    pingCmd{ ReadSettingsItem( "ping_command",
                               "Status updates for the clients will not work.",
                               argSettings, true ) },
    postscriptViewer{ ReadSettingsItem( "postscript_viewer",
                                        "Viewing the generated receipts postscript file will not work.",
                                        argSettings, true ) },
    ps2pdfCmd{ ReadSettingsItem( "ps2pdf_command",
                                 "Converting and viewing the generated receipts file will not work.",
                                 argSettings, true ) },
    pkeyPathRoot{ ReadSettingsItem( "pkey_path_root",
                                    "Administration actions concerning the clients will not be available.",
                                    argSettings, true ) },
    pkeyPathUser{ ReadSettingsItem( "pkey_path_user",
                                    "Many actions concerning the clients will not be available.",
                                    argSettings, true ) },
    rmCmd{ ReadSettingsItem( "rm_command",
                             "Cleanup of the zTree data target path will not work.",
                             argSettings, true ) },
    scpCmd{ ReadSettingsItem( "scp_command",
                              "Beaming files to the clients will not be possible.",
                              argSettings, true ) },
    serverIP{ ReadSettingsItem( "server_ip",
                                "Starting zLeaves and retrieving client help messages will not work.",
                                argSettings, false ) },
    sshCmd{ ReadSettingsItem( "ssh_command",
                              "All actions concerning the clients will not be possible.",
                              argSettings, true ) },
    tasksetCmd{ ReadSettingsItem( "taskset_command",
                                  "Running z-Leaves or z-Tree will be possible.",
                                  argSettings, true ) },
    termEmulCmd{ ReadSettingsItem( "terminal_emulator_command",
                                   "Conducting administrative tasks will not be possible.",
                                   argSettings, true ) },
    userNameOnClients{ ReadSettingsItem( "user_name_on_clients",
                                         "All actions concerning the clients performed by the experiment user will not work.",
                                         argSettings, false ) },
    vncViewer{ ReadSettingsItem( "vnc_viewer",
                                 "Viewing the clients' screens will not work.",
                                 argSettings, true ) },
    wakeonlanCmd{ ReadSettingsItem( "wakeonlan_command",
                                    "Booting the clients will not work.",
                                    argSettings, true ) },
    webcamDisplayCmd{ ReadSettingsItem( "webcam_command",
                                        "Displaying the laboratory's webcams will not work.",
                                        argSettings, true ) },
    webcams{ argSettings.value( "webcams", "" ).toString().split( '|', QString::SkipEmptyParts,
                                                                  Qt::CaseInsensitive ) },
    wineCmd{ ReadSettingsItem( "wine_command",
                               "Running z-Leaves or z-Tree will be possible.",
                               argSettings, true ) },
    wmctrlCmd{ ReadSettingsItem( "wmctrl_command",
                                 "Setting zTree's window title to its port number will not work.",
                                 argSettings, true ) },
    xsetCmd{ ReadSettingsItem( "xset_command",
                               "Deactivating the screen saver on the clients will not be possible.",
                               argSettings, true ) },
    zTreeInstDir{ ReadSettingsItem( "ztree_installation_directory",
                                    "zTree will not be available.",
                                    argSettings, true ) },
    restartCrashedSessionScript{ ReadSettingsItem( "restart_crashed_session_script",
                               "Script to be called after session crash",
                               argSettings, false ) },
    adminUsers{ GetAdminUsers( argSettings ) },
    installedLaTeXHeaders{ DetectInstalledLaTeXHeaders() },
    installedZTreeVersions{ DetectInstalledzTreeVersions() },
    clientHelpNotificationServerPort{ GetClientHelpNotificationServerPort( argSettings ) },
    chosenzTreePort{ GetInitialPort( argSettings ) },
    clients{ CreateClients( argSettings, pingCmd ) },
    localzLeafName{ ReadSettingsItem( "local_zLeaf_name",
                                      "The local zLeaf default name will default to 'local'.",
                                      argSettings, false ) },
    clIPsToClMap{ CreateClIPsToClMap( clients ) }
{
    // Let the local zLeaf name default to 'local' if none was given in the settings
    if ( localzLeafName.isEmpty() ) {
        qDebug() << "'local_zLeaf_name' was not set, defaulting to 'local'";
        localzLeafName = "local";
    }
    if ( webcams.isEmpty() ) {
        qDebug() << "'webcams' was not properly set. No stationary webcams will be available.";
    } else {
        qDebug() << "The following webcams where loaded:" << webcams;
    }
    qDebug() << "Detected z-Tree versions" << installedZTreeVersions;
}