📄 calllauncherconfigurationhandler.java
字号:
boolean deb=Boolean.valueOf (enableDebug.trim()).booleanValue(); if ( deb) { configurationMessage ("INFORMATION: the Debug feature is set"); configuration.enableDebug=deb; } else { configuration.enableDebug=false; configurationMessage ("INFORMATION: the Debug feature is not set"); } } catch(Exception e) { configuration.enableDebug=false; configurationMessage ("INFORMATION: the Debug feature is not set"); } } String serverLogFile=attrs.getValue("server_log"); if (serverLogFile==null || serverLogFile.trim().equals("")) { configurationMessage ("INFORMATION: the server message log file is not set"); } else { configuration.serverLogFile=serverLogFile.trim(); configurationMessage ("INFORMATION: the server message log file is: " + configuration.serverLogFile); } String badMessageLog=attrs.getValue("bad_message_log"); if (badMessageLog==null || badMessageLog.trim().equals("")) { configurationMessage ("INFORMATION: the bad message log file is not set"); } else { configuration.badMessageLogFile= badMessageLog.trim(); configurationMessage ("INFORMATION: the bad message log is: " + configuration.badMessageLogFile); } String debugLog=attrs.getValue("debug_log"); if (debugLog==null || debugLog.trim().equals("")) { configurationMessage ("INFORMATION: the debug log file is not set"); } else { configuration.debugLogFile=debugLog.trim(); configurationMessage ("INFORMATION: the debug log file is: " + configuration.debugLogFile); } String outputCallLauncher=attrs.getValue("output_launcher"); if (outputCallLauncher==null || outputCallLauncher.trim().equals("")) { configurationMessage ("INFORMATION: the output CallLauncher file is not set"); } else { configuration.outputCallLauncher=outputCallLauncher.trim(); configurationMessage ("INFORMATION: the output CallLauncher file is: " + configuration.outputCallLauncher); } } if (element.compareToIgnoreCase("CALLER_AGENT") ==0 ) { String userName=attrs.getValue("user_name"); if (userName==null || userName.trim().equals("")) { configurationMessage ("ERROR: the user_name of the agent tag is not set"); } Agent agent=new Agent(); agent.userName=userName; String hostName=attrs.getValue("host_name"); if (hostName==null || hostName.trim().equals("")) { configurationMessage ("ERROR: the host_name of the agent tag is not set"); } else { agent.hostName=hostName; } String identifier=attrs.getValue("identifier"); if (identifier==null || identifier.trim().equals("")) { configurationMessage ("ERROR: the identifier of the agent tag is not set"); } else { agent.identifier=identifier; } configuration.addCallerAgent(agent); configurationMessage ("INFORMATION: one caller agent added: "+agent.identifier); } if (element.compareToIgnoreCase("RTP_GATEWAY") ==0 ) { String enableRTPGateway=attrs.getValue("enable"); if (enableRTPGateway==null || enableRTPGateway.trim().equals("")) { configurationMessage ("INFORMATION: the RTP_GATEWAY is disabled"); configuration.enableRTPGateway=false; } else { try{ Boolean b=Boolean.valueOf (enableRTPGateway.trim()); if ( b.booleanValue() ) { configuration.enableRTPGateway=true; configurationMessage ("INFORMATION: the RTP_GATEWAY is enabled"); String minRTPHolePort=attrs.getValue("min_rtp_port"); if (minRTPHolePort==null || minRTPHolePort.trim().equals("")) { configurationMessage ("ERROR: the minRTPHolePort is not set"); configuration.minRTPHolePort=-1; } else { try{ configuration.minRTPHolePort=Integer.valueOf(minRTPHolePort).intValue(); } catch(Exception e) { configurationMessage ("ERROR: the minRTPHolePort is not valid"); configuration.minRTPHolePort=-1; } } String maxRTPHolePort=attrs.getValue("max_rtp_port"); if (maxRTPHolePort==null || maxRTPHolePort.trim().equals("")) { configurationMessage ("ERROR: the maxRTPHolePort is not set"); configuration.maxRTPHolePort=-1; } else { try{ configuration.maxRTPHolePort=Integer.valueOf(maxRTPHolePort).intValue(); } catch(Exception e) { configurationMessage ("ERROR: the maxRTPHolePort is not valid"); configuration.maxRTPHolePort=-1; } } } else { configuration.enableRTPGateway=false; configurationMessage ("INFORMATION: the RTP_GATEWAY is disabled"); } } catch(Exception e) { configuration.enableRTPGateway=false; configurationMessage ("INFORMATION: the RTP_GATEWAY is disabled"); } } } if (element.compareToIgnoreCase("REGISTRATIONS") ==0 ) { String expiresTimeString=attrs.getValue("expires_time"); if (expiresTimeString!=null && !expiresTimeString.trim().equals("") ) { try{ configuration.expiresTime= Integer.valueOf(expiresTimeString.trim()).intValue(); configurationMessage ("INFORMATION: expires time is set to:" +configuration.expiresTime); } catch(Exception e) { configurationMessage ("WARNING: expires time is set to default value:" +configuration.expiresTime); } } else { configurationMessage ("WARNING: expires time is set to default value:" +configuration.expiresTime); } String enableRegistrationsString=attrs.getValue("enable"); if (enableRegistrationsString==null) { configuration.enableRegistrations=false; configurationMessage ("INFORMATION: registration uploading feature is disabled"); } else { try{ Boolean b=Boolean.valueOf(enableRegistrationsString.trim()); if ( b.booleanValue()) { configuration.enableRegistrations=true; configurationMessage ("INFORMATION: Uploading static registrations"); } else { configuration.enableRegistrations=false; configurationMessage ("WARNING: No static registrations to upload" ); } String registrationsFile=attrs.getValue ("registrations_file"); if (registrationsFile==null) { configurationMessage ("WARNING: No registration file specified"); } else { configuration.registrationsFile= registrationsFile.trim(); } } catch(Exception e) { configuration.enableRegistrations=false; configurationMessage ("ERROR: Error uploading static registrations [" + e.getMessage() + "]" ); } } } } public void endElement(String namespaceURI, String sName, // simple name String qName // qualified name ) throws SAXException { String element=qName; if (element.compareToIgnoreCase("SIP_STACK") ==0 ) { } if (element.compareToIgnoreCase("LISTENING_POINT") ==0 ) { } if (element.compareToIgnoreCase("RMI") ==0 ) { } if (element.compareToIgnoreCase("DEBUG") ==0 ) { } } public void characters(char buf[], int offset, int len) throws SAXException { String str = new String(buf, offset, len); } }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -