Damian Krzeminski wrote: > Matt White wrote: >> >> I'm working on adding support for the Yealink line of phones. >> >> >> Where can I find a list of all the objects I can query for my >> yealinkphone.java. For example, the acme example has >> >> >> line.setSettingValue(USER_ID_SETTING, info.getUserId()); >> >> line.setSettingValue(DISPLAY_NAME_SETTING, info.getDisplayName()); >> >> line.setSettingValue(PASSWORD_SETTING, info.getPassword()); >> >> line.setSettingValue(REGISTRATION_SERVER_SETTING, >> info.getRegistrationServer()); >> >> >> I'd like to prefill the config file with defaults like NTP server etc. >> >> >> >> I think i can probably get this finished up today if I know which >> property to get. >> >> >> -M >> > > Check what things are offered by DeviceDefaults. > > DeviceDefault.getNtpServer gets you NTP server address. > > I highly recommend getting the simplest plugin possible (which means only > line parameters so that phone can register), and then adding more > functionality (NTP, DNS, speed dials, phonebook, DST etc.). > > Send the patch and I'll can help you get it into mainline (integrate with > build etc.). Make sure to include reference config (ideally as a part of > unit test), since I don't have this phone. > > In case you didn't find it yet: > http://sipx-wiki.calivia.com/index.php/Adding_support_for_managed_phones > Damian >
Matt: I saw you posted a .zip file on users' list. Let's keep it here, new plugins belong to devel list. Please check out the attached patch. I integrated new yealink plugin into sipXconfig builds and I made some changes to profile generation. I added *beans.xml file (it was not in the .zip). It might need some other models defined, I just took one form yealink.com since I was not sure which one you are trying to support. Probably the biggest change that I made has to do with the 'path' parameter. This is not something that admin would ever configure (or so I think) and it seemed natural to define it as 'profileName' (profileName is a catch all property you can attach to any model settings and use during profile generation in whatever way it makes sense for your plug-in). Check it out: I think it simplified .xml files and the UI. What I need now is for someone to reconcile the profile that we are generating with the reference profile (MAC.cfg). You can do it by modelling more parameters or by hardcoding some of them in .vm file or by simplifying the reference profile by removing some unused params (or most probably by doing all 3 to certain degree). If you use Eclipse just run YealinkForTest as junit test. When you click on test result you'll see a side by side comparison view that shows you how what we generate differs from what is in MAC.cfg. It would also help if figure out how profiles with more than one account/line should be generated (it's not clear from the example where the line index is attached). Looks like you are pretty close. Looking forward to reviewing more code, Damian
From 96a213bc3b08ab2a2b321e50d6afee107b19e53e Mon Sep 17 00:00:00 2001 From: Damian Krzeminski <[email protected]> Date: Fri, 11 Dec 2009 22:36:17 -0500 Subject: [PATCH] Yealink plugin: Initial revision. --- sipXconfig/configure.ac | 1 + sipXconfig/plugins/Makefile.am | 3 +- sipXconfig/plugins/yealink/.classpath | 9 + sipXconfig/plugins/yealink/.project | 17 + sipXconfig/plugins/yealink/Makefile.am | 1 + sipXconfig/plugins/yealink/build.xml | 9 + sipXconfig/plugins/yealink/etc/setting.dtd | 1 + sipXconfig/plugins/yealink/etc/yealink/config.vm | 146 +++++ sipXconfig/plugins/yealink/etc/yealink/line.xml | 169 ++++++ sipXconfig/plugins/yealink/etc/yealink/phone.xml | 302 ++++++++++ .../sipxconfig/phone/yealink/YealinkPhone.java | 110 ++++ .../phone/yealink/YealinkPhoneDefaults.java | 20 + .../phone/yealink/yealink-models.beans.xml | 16 + .../sipfoundry/sipxconfig/phone/yealink/MAC.cfg | 574 ++++++++++++++++++++ .../sipxconfig/phone/yealink/YealinkPhoneTest.java | 41 ++ sipXconfig/sipxconfig.spec.in | 1 + 16 files changed, 1419 insertions(+), 1 deletions(-) create mode 100644 sipXconfig/plugins/yealink/.classpath create mode 100644 sipXconfig/plugins/yealink/.project create mode 100644 sipXconfig/plugins/yealink/Makefile.am create mode 100644 sipXconfig/plugins/yealink/build.xml create mode 120000 sipXconfig/plugins/yealink/etc/setting.dtd create mode 100644 sipXconfig/plugins/yealink/etc/yealink/config.vm create mode 100644 sipXconfig/plugins/yealink/etc/yealink/line.xml create mode 100644 sipXconfig/plugins/yealink/etc/yealink/phone.xml create mode 100644 sipXconfig/plugins/yealink/src/org/sipfoundry/sipxconfig/phone/yealink/YealinkPhone.java create mode 100644 sipXconfig/plugins/yealink/src/org/sipfoundry/sipxconfig/phone/yealink/YealinkPhoneDefaults.java create mode 100644 sipXconfig/plugins/yealink/src/org/sipfoundry/sipxconfig/phone/yealink/yealink-models.beans.xml create mode 100644 sipXconfig/plugins/yealink/test/org/sipfoundry/sipxconfig/phone/yealink/MAC.cfg create mode 100644 sipXconfig/plugins/yealink/test/org/sipfoundry/sipxconfig/phone/yealink/YealinkPhoneTest.java diff --git a/sipXconfig/configure.ac b/sipXconfig/configure.ac index 51f64af..a1b9c0e 100644 --- a/sipXconfig/configure.ac +++ b/sipXconfig/configure.ac @@ -128,6 +128,7 @@ AC_CONFIG_FILES([ plugins/openfire/Makefile plugins/polycom/Makefile plugins/snom/Makefile + plugins/yealink/Makefile ]) AC_OUTPUT diff --git a/sipXconfig/plugins/Makefile.am b/sipXconfig/plugins/Makefile.am index 9e0f556..2d79b43 100644 --- a/sipXconfig/plugins/Makefile.am +++ b/sipXconfig/plugins/Makefile.am @@ -15,7 +15,8 @@ SUBDIRS = \ cmcprov \ openfire \ polycom \ - snom + snom \ + yealink EXTRA_DIST = \ $(SUBDIRS) \ diff --git a/sipXconfig/plugins/yealink/.classpath b/sipXconfig/plugins/yealink/.classpath new file mode 100644 index 0000000..246b0a0 --- /dev/null +++ b/sipXconfig/plugins/yealink/.classpath @@ -0,0 +1,9 @@ +<?xml version="1.0" encoding="UTF-8"?> +<classpath> + <classpathentry kind="src" path="src"/> + <classpathentry kind="src" path="test"/> + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> + <classpathentry combineaccessrules="false" kind="src" path="/sipXconfig-neoconf"/> + <classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/> + <classpathentry kind="output" path="bin.eclipse"/> +</classpath> diff --git a/sipXconfig/plugins/yealink/.project b/sipXconfig/plugins/yealink/.project new file mode 100644 index 0000000..4b501e0 --- /dev/null +++ b/sipXconfig/plugins/yealink/.project @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="UTF-8"?> +<projectDescription> + <name>sipXconfig-plugins-yealink</name> + <comment></comment> + <projects> + </projects> + <buildSpec> + <buildCommand> + <name>org.eclipse.jdt.core.javabuilder</name> + <arguments> + </arguments> + </buildCommand> + </buildSpec> + <natures> + <nature>org.eclipse.jdt.core.javanature</nature> + </natures> +</projectDescription> diff --git a/sipXconfig/plugins/yealink/Makefile.am b/sipXconfig/plugins/yealink/Makefile.am new file mode 100644 index 0000000..1ea8b42 --- /dev/null +++ b/sipXconfig/plugins/yealink/Makefile.am @@ -0,0 +1 @@ +include $(top_srcdir)/ant-targets.am diff --git a/sipXconfig/plugins/yealink/build.xml b/sipXconfig/plugins/yealink/build.xml new file mode 100644 index 0000000..e21ce75 --- /dev/null +++ b/sipXconfig/plugins/yealink/build.xml @@ -0,0 +1,9 @@ +<project name="yealink" default="default"> + + <property name="project.dir" value="plugins/yealink" /> + <property name="plugin.models.dir" value="etc/yealink" /> + <property name="plugin.name" value="yealink-phones" /> + + <import file="../plugins.build.xml" /> + +</project> diff --git a/sipXconfig/plugins/yealink/etc/setting.dtd b/sipXconfig/plugins/yealink/etc/setting.dtd new file mode 120000 index 0000000..cc02017 --- /dev/null +++ b/sipXconfig/plugins/yealink/etc/setting.dtd @@ -0,0 +1 @@ +../../../neoconf/etc/setting.dtd \ No newline at end of file diff --git a/sipXconfig/plugins/yealink/etc/yealink/config.vm b/sipXconfig/plugins/yealink/etc/yealink/config.vm new file mode 100644 index 0000000..b2d43cb --- /dev/null +++ b/sipXconfig/plugins/yealink/etc/yealink/config.vm @@ -0,0 +1,146 @@ +## Velocity macros +## emit 'setting value' pair - skipping _ignored_ settings +#macro(emit_setting $s) +#if($s.ProfileName != '$ignore$') +${s.ProfileName} = $!{s.Value} +#end +#end +## emit setting line for every setting in the group +#macro(emit_group $g) +[ ${g.Name} ] +path = ${g.ProfileName} +#foreach ($s in $g.Values) +#emit_setting($s) +#end + +#end + +#foreach ($line in $phone.lines) +#set($line_index = $velocityCount - 1) +#foreach ($group in $line.Settings.Values) +[ ${group.Name} ] +path = ${group.ProfileName} +#foreach ($setting in $group.Values) +#emit_setting($setting) +#end + +#end +#end +#foreach ($group in $phone.Settings.Values) +#emit_group($group) +#end + +## remove the remaining values as they are added to phone.xml +[ Country ] +path = /config/voip/tone.ini +#The tones are defined by countries.If Country = Custom,the customized values will be used. +Country = + +[ Tone Param ] +path = /config/voip/tone.ini +dial = +ring = +busy = +congestion = +callwaiting = +dialrecall = +record = +info = +stutter = +message = +autoanswer = + +[ Default ] +path = /config/voip/tone.ini +dial = 1 +ring = 1 +busy = 1 +congestion = 1 +callwaiting = 1 +dialrecall = 1 +record = 1 +info = 1 +stutter = 1 +message = 1 +autoanswer = 1 + +[ AreaCode ] +path = /config/DialRule/areacode.cfg +code = +minlen = +maxlen = + +[ BlockOut ] +path = /config/DialRule/BlockOut.cfg +#Set Block Out number. +1 = +2 = +3 = +4 = +5 = +6 = +7 = +8 = +9 = +10 = + +[ RemotePhoneBook0 ] +path = /config/Setting/Setting.cfg +URL = +Name = + +[ RemotePhoneBook1 ] +path = /config/Setting/Setting.cfg +URL = +Name = + +[ RemotePhoneBook2 ] +path = /config/Setting/Setting.cfg +URL = +Name = + +[ RemotePhoneBook3 ] +path = /config/Setting/Setting.cfg +URL = +Name = + +[ RemotePhoneBook4 ] +path = /config/Setting/Setting.cfg +URL = +Name = + +[ Webserver Type ] +path = /config/Advanced/Advanced.cfg +WebType = + +[ Key0 ] +Path = /config/vpPhone/Ext38_00000000000001.cfg +DKtype = +Line = +Value = +type = +PickupValue = + +[ Key1 ] +Path = /config/vpPhone/Ext38_00000000000001.cfg +DKtype = +Line = +Value = +type = +PickupValue = + +[ Key0 ] +Path = /config/vpPhone/Ext38_00000000000002.cfg +DKtype = +Line = +Value = +type = +PickupValue = + +[ Key1 ] +Path = /config/vpPhone/Ext38_00000000000002.cfg +DKtype = +Line = +Value = +type = +PickupValue = \ No newline at end of file diff --git a/sipXconfig/plugins/yealink/etc/yealink/line.xml b/sipXconfig/plugins/yealink/etc/yealink/line.xml new file mode 100644 index 0000000..7b88e52 --- /dev/null +++ b/sipXconfig/plugins/yealink/etc/yealink/line.xml @@ -0,0 +1,169 @@ +<?xml version="1.0"?> +<!DOCTYPE model PUBLIC "-//SIPFoundry//sipXconfig//Model specification 2.0//EN" + "http://www.sipfoundry.org/sipXconfig/dtd/setting_2_0.dtd"> +<model> + <group name="account"> + <label>SIP Account</label> + <profileName>/config/voip/sipAccount0.cfg</profileName> + <setting name="Enable"> + <label>Enable Line</label> + <type> + <boolean /> + </type> + </setting> + <setting name="Label"> + <label>Label</label> + <type> + <string /> + </type> + </setting> + <setting name="DisplayName"> + <label>Display Name</label> + <type> + <string /> + </type> + </setting> + <setting name="AuthName" hidden="yes"> + <label>Authorization Name</label> + <type> + <string /> + </type> + </setting> + <setting name="UserName" hidden="yes"> + <label>User Name</label> + <type> + <string /> + </type> + </setting> + <setting name="password" hidden="yes"> + <label>Password</label> + <type> + <string /> + </type> + </setting> + <setting name="SIPServerHost"> + <label>Proxy Server</label> + <type> + <string /> + </type> + </setting> + <setting name="SIPServerPort"> + <label>Proxy Server Port</label> + <type> + <integer /> + </type> + <value>5060</value> + </setting> + <setting name="Transport"> + <label>TCP Transport</label> + <type> + <boolean /> + </type> + <value>0</value> + </setting> + <setting name="AnonymousCall"> + <label>Anonymous Calling</label> + <type> + <boolean /> + </type> + <value>0</value> + </setting> + <setting name="RejectAnonymousCall"> + <label>Reject Anonymous Calls</label> + <type> + <boolean /> + </type> + <value>0</value> + </setting> + <setting name="Expire"> + <label>Expire Time</label> + <type> + <integer min="60" max="3600" /> + </type> + <value>3600</value> + </setting> + <setting name="SIPListenPort"> + <label>Listening Port</label> + <type> + <integer /> + </type> + <value>5060</value> + </setting> + <setting name="SubscribeMWI"> + <label>Subscribe to MWI</label> + <type> + <boolean /> + </type> + <value>1</value> + </setting> + <setting name="SubscribeRegister"> + <label>Subscribe to Register</label> + <type> + <boolean /> + </type> + <value>0</value> + </setting> + <setting name="precondition"> + <label>enable Precondition</label> + <type> + <boolean /> + </type> + <value>0</value> + </setting> + <setting name="CIDSource"> + <label>Caller ID Header from PAI</label> + <type> + <boolean /> + </type> + <value>0</value> + </setting> + <setting name="Enable 100Rel"> + <label>100 Reliable Retransmission</label> + <type> + <boolean /> + </type> + <value>0</value> + </setting> + <setting name="VOICE_MAIL_NUM"> + <label>Voice Mail Number</label> + <type> + <string /> + </type> + </setting> + <setting name="WMI_SWITCH"> + <label>Enable WMI</label> + <type> + <boolean /> + </type> + <value>0</value> + </setting> + <setting name="EXPIRE_TIME"> + <label>Expire Time</label> + <type> + <integer min="60" max="3600" /> + </type> + <value>360</value> + </setting> + <setting name="SessionRefresher"> + <label>Session Refresher</label> + <type> + <boolean /> + </type> + <value>0</value> + </setting> + <setting name="dialoginfo_callpickup"> + <label>Dialog-Info Call Pickup</label> + <type> + <boolean /> + </type> + <value>0</value> + </setting> + <setting name="ShareLine"> + <label>Shared Line</label> + <type> + <boolean /> + </type> + <value>0</value> + </setting> + </group> +</model> diff --git a/sipXconfig/plugins/yealink/etc/yealink/phone.xml b/sipXconfig/plugins/yealink/etc/yealink/phone.xml new file mode 100644 index 0000000..de8f004 --- /dev/null +++ b/sipXconfig/plugins/yealink/etc/yealink/phone.xml @@ -0,0 +1,302 @@ +<?xml version="1.0"?> +<!DOCTYPE model PUBLIC "-//SIPFoundry//sipXconfig//Model specification 2.0//EN" + "http://www.sipfoundry.org/sipXconfig/dtd/setting_2_0.dtd"> +<model> + <group name="DTMF"> + <label>DTMF Settings</label> + <profileName>/config/voip/sipAccount0.cfg</profileName> + <setting name="DTMFInbandTransfer"> + <label>DTMF Inband Transfer</label> + <type> + <integer min="0" max="2" /> + </type> + <value>1</value> + </setting> + <setting name="InfoType"> + <label>How to INFO DTMF</label> + <type> + <integer min="0" max="3" /> + </type> + <value>0</value> + </setting> + <setting name="DTMFPayload"> + <label>DTMF Payload</label> + <type> + <integer min="96" max="255" /> + </type> + <value>101</value> + </setting> + </group> + <group name="NAT"> + <label>NAT Settings</label> + <profileName>/config/voip/sipAccount0.cfg</profileName> + <setting name="NATTraversal"> + <label>Enable NAT Traversal</label> + <type> + <boolean /> + </type> + <value>0</value> + </setting> + <setting name="STUNServer"> + <label>Enable NAT Traversal</label> + <type> + <string /> + </type> + </setting> + <setting name="STUNPort"> + <label>How to INFO DTMF</label> + <type> + <integer /> + </type> + <value>10000</value> + </setting> + <setting name="EnableUDPUpdate"> + <label>Enable UDP Update</label> + <type> + <boolean /> + </type> + <value>1</value> + </setting> + <setting name="UDPUpdateTime"> + <label>UDP Keep-alive Interval</label> + <type> + <integer min="1" max="90" /> + </type> + <value>30</value> + </setting> + <setting name="rport"> + <label>Enable Rport</label> + <type> + <boolean /> + </type> + <value>0</value> + </setting> + </group> + <group name="blf"> + <label>BLF Settings</label> + <profileName>/config/voip/sipAccount0.cfg</profileName> + <setting name="BLFList_URI"> + <label>BLF List URI</label> + <type> + <string /> + </type> + </setting> + <setting name="SubscribePeriod"> + <label>Subscribe Period</label> + <type> + <integer min="300" max="3600" /> + </type> + <value>1800</value> + </setting> + </group> + <group name="audio0"> + <label>PCMU Codec Settings</label> + <profileName>/config/voip/sipAccount0.cfg</profileName> + <setting name="enable"> + <label>Enable</label> + <type> + <boolean /> + </type> + <value>1</value> + </setting> + <setting name="PayloadType"> + <label>Payload Type</label> + <type> + <string /> + </type> + <value>PCMU</value> + </setting> + <setting name="priority"> + <label>Priority</label> + <type> + <integer /> + </type> + <value>0</value> + </setting> + <setting name="rtpmap"> + <label>RTP Map</label> + <type> + <integer /> + </type> + <value>0</value> + </setting> + </group> + <group name="audio1"> + <label>G729 Codec Settings</label> + <profileName>/config/voip/sipAccount0.cfg</profileName> + <setting name="enable"> + <label>Enable</label> + <type> + <boolean /> + </type> + <value>1</value> + </setting> + <setting name="PayloadType"> + <label>Payload Type</label> + <type> + <string /> + </type> + <value>G729</value> + </setting> + <setting name="priority"> + <label>Priority</label> + <type> + <integer /> + </type> + <value>1</value> + </setting> + <setting name="rtpmap"> + <label>RTP Map</label> + <type> + <integer /> + </type> + <value>18</value> + </setting> + </group> + <group name="audio2"> + <label>G722 Codec Settings</label> + <profileName>/config/voip/sipAccount0.cfg</profileName> + <setting name="enable"> + <label>Enable</label> + <type> + <boolean /> + </type> + <value>1</value> + </setting> + <setting name="PayloadType"> + <label>Payload Type</label> + <type> + <string /> + </type> + <value>G722</value> + </setting> + <setting name="priority"> + <label>Priority</label> + <type> + <integer /> + </type> + <value>3</value> + </setting> + <setting name="rtpmap"> + <label>RTP Map</label> + <type> + <integer /> + </type> + <value>9</value> + </setting> + </group> + <group name="VLAN"> + <label>VLAN Settings</label> + <profileName>/config/Network/Network.cfg</profileName> + <setting name="ISVLAN"> + <label>Enable VLAN</label> + <type> + <boolean /> + </type> + <value>0</value> + </setting> + <setting name="VID"> + <label>VLAN of Lan Port</label> + <type> + <integer /> + </type> + </setting> + <setting name="USRPRIORITY"> + <label>Lan VLAN Priority</label> + <type> + <integer min="0" max="7" /> + </type> + <value>7</value> + </setting> + <setting name="PC_PORT_VLAN_ENABLE"> + <label>PC Port VLAN Enable</label> + <type> + <boolean /> + </type> + <value>0</value> + </setting> + <setting name="PC_PORT_VID"> + <label>VLAN of PC Port</label> + <type> + <integer /> + </type> + </setting> + <setting name="PC_PORT_PRIORITY"> + <label>PC VLAN Priority</label> + <type> + <integer min="0" max="7" /> + </type> + <value>0</value> + </setting> + </group> + <group name="QOS"> + <label>QOS Settings</label> + <profileName>/config/Network/Network.cfg</profileName> + <setting name="SIGNALTOS"> + <label>SIP Priority</label> + <type> + <integer min="0" max="63" /> + </type> + <value>40</value> + </setting> + <setting name="RTPTOS"> + <label>Voice Priority</label> + <type> + <integer min="0" max="63" /> + </type> + <value>40</value> + </setting> + </group> + <group name="RTPPORT"> + <label>RTP Settings</label> + <profileName>/config/Network/Network.cfg</profileName> + <setting name="MaxRTPPort"> + <label>Voice Priority</label> + <type> + <integer min="0" max="65535" /> + </type> + <value>11800</value> + </setting> + <setting name="MinRTPPort"> + <label>SIP Priority</label> + <type> + <integer min="0" max="65535" /> + </type> + <value>11780</value> + </setting> + </group> + <group name="Lang"> + <label>Language Settings</label> + <profileName>/config/Setting/Setting.cfg</profileName> + <setting name="WebLanguage"> + <label>Web Language</label> + <type> + <enum> + <option> + <value>English</value> + </option> + <option> + <value>Turkish</value> + </option> + <option> + <value>Czech</value> + </option> + <option> + <value>Russian</value> + </option> + </enum> + </type> + <value>English</value> + </setting> + </group> + <group name="Message"> + <label>Voicemail Setting</label> + <profileName>/config/Features/Message.cfg</profileName> + <setting name="VoiceNumber0"> + <label>Path</label> + <type> + <string /> + </type> + </setting> + </group> +</model> diff --git a/sipXconfig/plugins/yealink/src/org/sipfoundry/sipxconfig/phone/yealink/YealinkPhone.java b/sipXconfig/plugins/yealink/src/org/sipfoundry/sipxconfig/phone/yealink/YealinkPhone.java new file mode 100644 index 0000000..90a2f9c --- /dev/null +++ b/sipXconfig/plugins/yealink/src/org/sipfoundry/sipxconfig/phone/yealink/YealinkPhone.java @@ -0,0 +1,110 @@ +/* + * + * + * Copyright (C) 2007 Pingtel Corp., certain elements licensed under a Contributor Agreement. + * Contributors retain copyright to elements licensed under a Contributor Agreement. + * Licensed to the User under the LGPL license. + * + * + */ +package org.sipfoundry.sipxconfig.phone.yealink; + +import org.sipfoundry.sipxconfig.common.User; +import org.sipfoundry.sipxconfig.device.DeviceDefaults; +import org.sipfoundry.sipxconfig.phone.Line; +import org.sipfoundry.sipxconfig.phone.LineInfo; +import org.sipfoundry.sipxconfig.phone.Phone; +import org.sipfoundry.sipxconfig.setting.SettingEntry; + +public class YealinkPhone extends Phone { + private static final String USER_ID_SETTING = "account/UserName"; + private static final String AUTH_USER_ID_SETTING = "account/AuthName"; + private static final String DISPLAY_NAME_SETTING = "account/DisplayName"; + private static final String PASSWORD_SETTING = "account/password"; + private static final String REGISTRATION_SERVER_SETTING = "account/SIPServerHost"; + + public YealinkPhone() { + } + + @Override + public void initializeLine(Line line) { + YealinkPhoneDefaults defaults = new YealinkPhoneDefaults(getPhoneContext().getPhoneDefaults()); + addDefaultBeanSettingHandler(defaults); + line.addDefaultBeanSettingHandler(new YealinkLineDefaults(line)); + } + + @Override + public String getProfileFilename() { + return getSerialNumber() + ".cfg"; + } + + public static class YealinkLineDefaults { + private final Line m_line; + + YealinkLineDefaults(Line line) { + m_line = line; + } + + @SettingEntry(path = USER_ID_SETTING) + public String getUserName() { + return m_line.getUserName(); + } + + @SettingEntry(path = AUTH_USER_ID_SETTING) + public String getAuthUserName() { + return m_line.getAuthenticationUserName(); + } + + @SettingEntry(path = DISPLAY_NAME_SETTING) + public String getDisplayName() { + String displayName = null; + User user = m_line.getUser(); + if (user != null) { + displayName = user.getDisplayName(); + } + return displayName; + } + + @SettingEntry(path = PASSWORD_SETTING) + public String getPassword() { + String password = null; + User user = m_line.getUser(); + if (user != null) { + password = user.getSipPassword(); + } + return password; + } + + @SettingEntry(path = REGISTRATION_SERVER_SETTING) + public String getRegistrationServer() { + DeviceDefaults defaults = m_line.getPhoneContext().getPhoneDefaults(); + return defaults.getDomainName(); + } + } + + /** + * Each subclass must decide how as much of this generic line information translates into its + * own setting model. + */ + @Override + protected void setLineInfo(Line line, LineInfo info) { + line.setSettingValue(USER_ID_SETTING, info.getUserId()); + line.setSettingValue(DISPLAY_NAME_SETTING, info.getDisplayName()); + line.setSettingValue(PASSWORD_SETTING, info.getPassword()); + line.setSettingValue(REGISTRATION_SERVER_SETTING, info.getRegistrationServer()); + } + + /** + * Each subclass must decide how as much of this generic line information can be constructed + * from its own setting model. + */ + @Override + protected LineInfo getLineInfo(Line line) { + LineInfo info = new LineInfo(); + info.setDisplayName(line.getSettingValue(DISPLAY_NAME_SETTING)); + info.setUserId(line.getSettingValue(USER_ID_SETTING)); + info.setPassword(line.getSettingValue(PASSWORD_SETTING)); + info.setRegistrationServer(line.getSettingValue(REGISTRATION_SERVER_SETTING)); + return info; + } +} diff --git a/sipXconfig/plugins/yealink/src/org/sipfoundry/sipxconfig/phone/yealink/YealinkPhoneDefaults.java b/sipXconfig/plugins/yealink/src/org/sipfoundry/sipxconfig/phone/yealink/YealinkPhoneDefaults.java new file mode 100644 index 0000000..f2d5611 --- /dev/null +++ b/sipXconfig/plugins/yealink/src/org/sipfoundry/sipxconfig/phone/yealink/YealinkPhoneDefaults.java @@ -0,0 +1,20 @@ +/* + * + * + * Copyright (C) 2007 Pingtel Corp., certain elements licensed under a Contributor Agreement. + * Contributors retain copyright to elements licensed under a Contributor Agreement. + * Licensed to the User under the LGPL license. + * + * + */ +package org.sipfoundry.sipxconfig.phone.yealink; + +import org.sipfoundry.sipxconfig.device.DeviceDefaults; + +public class YealinkPhoneDefaults { + private final DeviceDefaults m_defaults; + + YealinkPhoneDefaults(DeviceDefaults defaults) { + m_defaults = defaults; + } +} diff --git a/sipXconfig/plugins/yealink/src/org/sipfoundry/sipxconfig/phone/yealink/yealink-models.beans.xml b/sipXconfig/plugins/yealink/src/org/sipfoundry/sipxconfig/phone/yealink/yealink-models.beans.xml new file mode 100644 index 0000000..fed8b8d --- /dev/null +++ b/sipXconfig/plugins/yealink/src/org/sipfoundry/sipxconfig/phone/yealink/yealink-models.beans.xml @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" + "http://www.springframework.org/dtd/spring-beans.dtd"> +<beans> + <!-- models --> + <bean id="yealinkT28P" parent="abstractPhoneModel"> + <property name="label" value="Yealink T28P" /> + <property name="beanId" value="yealink" /> + <property name="maxLineCount" value="6" /> + <property name="profileTemplate" value="yealink/config.vm" /> + <property name="vendor" value="Yealink"/> + </bean> + <!-- implementation --> + <bean id="yealink" class="org.sipfoundry.sipxconfig.phone.yealink.YealinkPhone" singleton="false" parent="abstractPhone"> + </bean> +</beans> diff --git a/sipXconfig/plugins/yealink/test/org/sipfoundry/sipxconfig/phone/yealink/MAC.cfg b/sipXconfig/plugins/yealink/test/org/sipfoundry/sipxconfig/phone/yealink/MAC.cfg new file mode 100644 index 0000000..6aa1516 --- /dev/null +++ b/sipXconfig/plugins/yealink/test/org/sipfoundry/sipxconfig/phone/yealink/MAC.cfg @@ -0,0 +1,574 @@ + +[ account ] +path = /config/voip/sipAccount0.cfg +Enable = +Label = +DisplayName = Joe User +AuthName = juser/0004f200e06b +UserName = juser +password = 1234 +SIPServerHost = sipfoundry.org +SIPServerPort = 5060 +UseOutboundProxy = 0 +OutboundHost = +OutboundPort = 5060 +Transport = 0 +BakOutboundHost = +BakOutboundPort = 5060 +proxy-require = +AnonymousCall = 0 +RejectAnonymousCall = 0 +Expire = 3600 +SIPListenPort = 5060 +Enable 100Rel = 0 +precondition = 0 +SubsribeRegister = 0 +SubsribeMWI = 0 +CIDSource = 0 +EnableSessionTimer = 0 +SessionExpires = +SessionRefresher = 0 +EnableUserEqualPhone = 0 +srtp_encryption = 0 +ptime = 0 +ShareLine = +dialoginfo_callpickup = + +[ DTMF ] +path = /config/voip/sipAccount0.cfg +DTMFInbandTransfer = 1 +InfoType = 0 +DTMFPayload = 101 + +[ NAT ] +path = /config/voip/sipAccount0.cfg +NATTraversal = 0 +STUNServer = +STUNPort = 10000 +EnableUDPUpdate = 1 +UDPUpdateTime = 30 +rport = 0 + +[ ADVANCED ] +path = /config/voip/sipAccount0.cfg +default_t1 = 0.5 +default_t2 = 4 +default_t4 = 5 + +[blf] +path = /config/voip/sipAccount0.cfg +SubscribePeriod = 1800 +BLFList_URI = + +[ audio0 ] +path = /config/voip/sipAccount0.cfg +enable = 1 +PayloadType = PCMU +priority = 1 +rtpmap = 0 + +[ audio1 ] +path = /config/voip/sipAccount0.cfg +enable = 1 +PayloadType = PCMA +priority = 2 +rtpmap = 8 + +[ audio2 ] +path = /config/voip/sipAccount0.cfg +enable = 0 +PayloadType = G723_53 +priority = 0 +rtpmap = 4 + +[ audio3 ] +path = /config/voip/sipAccount0.cfg +enable = 0 +PayloadType = G723_63 +priority = 0 +rtpmap = 4 + +[ audio4 ] +path = /config/voip/sipAccount0.cfg +enable = 1 +PayloadType = G729 +priority = 3 +rtpmap = 18 + + +[ audio5 ] +path = /config/voip/sipAccount0.cfg +enable = 1 +PayloadType = G722 +priority = 4 +rtpmap = 9 + +[ audio7 ] +path = /config/voip/sipAccount0.cfg +enable = 0 +PayloadType = G726-16 +priority = 0 +rtpmap = 112 + +[ audio8 ] +path = /config/voip/sipAccount0.cfg +enable = 0 +PayloadType = G726-24 +priority = 0 +rtpmap = 102 + +[ audio9 ] +path = /config/voip/sipAccount0.cfg +enable = 0 +PayloadType = G726-32 +priority = 0 +rtpmap = 2 + +[ audio10 ] +path = /config/voip/sipAccount0.cfg +enable = 0 +PayloadType = G726-40 +priority = 0 +rtpmap = 104 + +[ WAN ] +path = /config/Network/Network.cfg +#WANType:0:DHCP,1:PPPoE,2:StaticIP +WANType = 0 +WANStaticIP = +WANSubnetMask = +WANDefaultGateway = + +[ DNS ] +path = /config/Network/Network.cfg +PrimaryDNS = +SecondaryDNS = + +[ PPPoE ] +path = /config/Network/Network.cfg +PPPoEUser = +PPPoEPWD = + +[ LAN ] +path = /config/Network/Network.cfg +#LANTYPE:0:Router, 1:Bridge +LANTYPE = 1 +RouterIP = 10.0.0.1 +LANSubnetMask = 255.255.255.0 +EnableDHCP = 1 +DHCPStartIP = 10.0.0.10 +DHCPEndIP = 10.0.0.100 + +[ VLAN ] +path = /config/Network/Network.cfg +#ISVLAN,VID and USRPRIORITY are used for VLAN on LAN port +#PC_PORT_VLAN_ENABLE,PC_PORT_VID and PC_PORT_PRIORITY are used for PC port +ISVLAN = 0 +VID = 0 +USRPRIORITY = 0 +PC_PORT_VLAN_ENABLE = 0 +PC_PORT_VID = 0 +PC_PORT_PRIORITY = 0 + +[ QOS ] +path = /config/Network/Network.cfg +SIGNALTOS = 40 +RTPTOS = 40 + +[ RTPPORT ] +path = /config/Network/Network.cfg +MaxRTPPort = 11800 +MinRTPPort = 11780 + +[ SYSLOG ] +path = /config/Network/Network.cfg +#specify the server for syslog storage +SyslogdIP = + +[ Lang ] +path = /config/Setting/Setting.cfg +#WebLanguage is the setting of language on web management +WebLanguage = + +[ Time ] +path = /config/Setting/Setting.cfg +TimeZone = +8 +TimeServer1 = cn.pool.ntp.org +TimeServer2 = cn.pool.ntp.org +Interval = 1000 +#Set daylight saving time.SummerTime 0 means disable,1 means enable +SummerTime = 0 +StartTime = +EndTime = + +[ PhoneSetting ] +path = /config/Setting/Setting.cfg +InterDigitTime = 4 +FlashHookTimer = 1 +Lock = 0 +Ringtype = Ring1.wav +Contrast = 2 +BackLight = 2 +BacklightTime = 30 +ProductName = + +[ AlertInfo0 ] +path = /config/Setting/Setting.cfg +Text = +Ringer = + +[ AlertInfo1 ] +path = /config/Setting/Setting.cfg +Text = +Ringer = + +[ AlertInfo2 ] +path = /config/Setting/Setting.cfg +Text = +Ringer = + +[ AlertInfo3 ] +path = /config/Setting/Setting.cfg +Text = +Ringer = + +[ AlertInfo4 ] +path = /config/Setting/Setting.cfg +Text = +Ringer = + +[ AlertInfo5 ] +path = /config/Setting/Setting.cfg +Text = +Ringer = + +[ AlertInfo6 ] +path = /config/Setting/Setting.cfg +Text = +Ringer = + +[ AlertInfo7 ] +path = /config/Setting/Setting.cfg +Text = +Ringer = + +[ AlertInfo8 ] +path = /config/Setting/Setting.cfg +Text = +Ringer = + +[ AlertInfo9 ] +path = /config/Setting/Setting.cfg +Text = +Ringer = + +[ Forward ] +path = /config/Features/Forward.cfg +Type = 0 +AlwaysForward = +BusyForward = +NoAnswerForward = +AfterRingTimes = 10 +Active = 0 +BusyNoAnswerForward = +BusyNoAfterRingTimes = 10 + +[ Features ] +path = /config/Features/Phone.cfg +Call_Waiting = 1 +Hotlinenumber = +BusyToneDelay = + +[ PoundSend ] +path = /config/Features/Phone.cfg +#Set # key or * key as send. #:1 and *:2 +Enable = 1 + +[ AutoAnswer ] +path = /config/Features/Phone.cfg +Enable = 0 + +[ Emergency ] +path = /config/Features/Phone.cfg +Num = + +[ memory1 ] +path = /config/vpPhone/vpPhone.ini +#Line means the line taken in use.0 stands for auto,1 stands for line1...except for one condition when type is blf(DKtype:16),0 stands for line1,1 stands for line2... +#DKtype defines the type of the key,ranging from 0 to 17 +#DKtype 0:N/A 1:Conference 2:Forward 3:Transfer +#DKtype 4:Hold 5:DND 6:Redial 7:Call Return +#DKtype 8:SMS 9:Call Pickup 10:Call Park 11:Custom +#DKtype 12:Voicemail 13:SpeedDial 14:Intercom 15:Line(for line key only) +#DKtype 16:BLF 17:URL 18:Group Listening 19:Public Hold + 20:Private Hold + +#Set Memory key1 +type = +Line = +Value = +PickupValue = +DKtype = + +[ memory2 ] +path = /config/vpPhone/vpPhone.ini +#Set Memory key2 +type = +Line = +Value = +PickupValue = +DKtype = + +[ memory3 ] +path = /config/vpPhone/vpPhone.ini +#Set Memory key3 +type = +Line = +Value = +PickupValue = +DKtype = + +[ memory4 ] +path = /config/vpPhone/vpPhone.ini +#Set Memory key4 +type = +Line = +Value = +PickupValue = +DKtype = + +[ memory5 ] +path = /config/vpPhone/vpPhone.ini +#Set Memory key5 +type = +Line = +Value = +PickupValue = +DKtype = + +[ memory6 ] +path = /config/vpPhone/vpPhone.ini +#Set Memory key6 +type = +Line = +Value = +PickupValue = +DKtype = + +[ memory7 ] +path = /config/vpPhone/vpPhone.ini +#Set Memory key7 +type = +Line = +Value = +PickupValue = +DKtype = + +[ memory8 ] +path = /config/vpPhone/vpPhone.ini +#Set Memory key8 +type = +Line = +Value = +PickupValue = +DKtype = + +[ memory9 ] +path = /config/vpPhone/vpPhone.ini +#Set Memory key9 +type = +Line = +Value = +PickupValue = +DKtype = + +[ memory10 ] +path = /config/vpPhone/vpPhone.ini +#Set Memory key10 +type = +Line = +Value = +PickupValue = +DKtype = + +[ memory11 ] +path = /config/vpPhone/vpPhone.ini +#from memory11 to memory 16 are settings for 6 line keys of T28 +#DKtype value is the same as it is defined for memory keys.Except for one that the line keys cannot be set to blf(DKtype:16). +#Set line key1 +DKtype = +Line = +Value = + +[ memory12 ] +path = /config/vpPhone/vpPhone.ini +#Set line key2 +DKtype = +Line = +Value = + +[ memory13 ] +path = /config/vpPhone/vpPhone.ini +#Set line key2 +DKtype = +Line = +Value = + +[ memory14 ] +path = /config/vpPhone/vpPhone.ini +#Set line key2 +DKtype = +Line = +Value = + +[ memory15 ] +path = /config/vpPhone/vpPhone.ini +#Set line key2 +DKtype = +Line = +Value = + +[ memory16 ] +path = /config/vpPhone/vpPhone.ini +#Set line key2 +DKtype = +Line = +Value = + +[ Profile ] +path = /config/vpm.cfg +VAD = 0 +CNG = 1 +ECHO = 1 +SIDE_TONE = -3 + +[ Jitter ] +path = /config/vpm.cfg +Adaptive = 1 +Min = 0 +Max = 300 +Nominal = 120 + +[ Message ] +path = /config/Features/Message.cfg +#Set voicemail number for each account +VoiceNumber0 = +VoiceNumber1 = +VoiceNumber2 = +VoiceNumber3 = +VoiceNumber4 = +VoiceNumber5 = + +[ Country ] +path = /config/voip/tone.ini +#The tones are defined by countries.If Country = Custom,the customized values will be used. +Country = + +[ Tone Param ] +path = /config/voip/tone.ini +dial = +ring = +busy = +congestion = +callwaiting = +dialrecall = +record = +info = +stutter = +message = +autoanswer = + +[ Default ] +path = /config/voip/tone.ini +dial = 1 +ring = 1 +busy = 1 +congestion = 1 +callwaiting = 1 +dialrecall = 1 +record = 1 +info = 1 +stutter = 1 +message = 1 +autoanswer = 1 + +[ AreaCode ] +path = /config/DialRule/areacode.cfg +code = +minlen = +maxlen = + +[ BlockOut ] +path = /config/DialRule/BlockOut.cfg +#Set Block Out number. +1 = +2 = +3 = +4 = +5 = +6 = +7 = +8 = +9 = +10 = + +[ RemotePhoneBook0 ] +path = /config/Setting/Setting.cfg +URL = +Name = + +[ RemotePhoneBook1 ] +path = /config/Setting/Setting.cfg +URL = +Name = + +[ RemotePhoneBook2 ] +path = /config/Setting/Setting.cfg +URL = +Name = + +[ RemotePhoneBook3 ] +path = /config/Setting/Setting.cfg +URL = +Name = + +[ RemotePhoneBook4 ] +path = /config/Setting/Setting.cfg +URL = +Name = + +[ Webserver Type ] +path = /config/Advanced/Advanced.cfg +WebType = + +[ Key0 ] +Path = /config/vpPhone/Ext38_00000000000001.cfg +DKtype = +Line = +Value = +type = +PickupValue = + +[ Key1 ] +Path = /config/vpPhone/Ext38_00000000000001.cfg +DKtype = +Line = +Value = +type = +PickupValue = + +[ Key0 ] +Path = /config/vpPhone/Ext38_00000000000002.cfg +DKtype = +Line = +Value = +type = +PickupValue = + +[ Key1 ] +Path = /config/vpPhone/Ext38_00000000000002.cfg +DKtype = +Line = +Value = +type = +PickupValue = \ No newline at end of file diff --git a/sipXconfig/plugins/yealink/test/org/sipfoundry/sipxconfig/phone/yealink/YealinkPhoneTest.java b/sipXconfig/plugins/yealink/test/org/sipfoundry/sipxconfig/phone/yealink/YealinkPhoneTest.java new file mode 100644 index 0000000..552435a --- /dev/null +++ b/sipXconfig/plugins/yealink/test/org/sipfoundry/sipxconfig/phone/yealink/YealinkPhoneTest.java @@ -0,0 +1,41 @@ +/* + * + * + * Copyright (C) 2007 Pingtel Corp., certain elements licensed under a Contributor Agreement. + * Contributors retain copyright to elements licensed under a Contributor Agreement. + * Licensed to the User under the LGPL license. + * + * + */ +package org.sipfoundry.sipxconfig.phone.yealink; + +import java.io.InputStream; + +import junit.framework.TestCase; +import org.apache.commons.io.IOUtils; +import org.sipfoundry.sipxconfig.TestHelper; +import org.sipfoundry.sipxconfig.device.MemoryProfileLocation; +import org.sipfoundry.sipxconfig.phone.PhoneModel; +import org.sipfoundry.sipxconfig.phone.PhoneTestDriver; + +public class YealinkPhoneTest extends TestCase { + + public void testGenerateTypicalProfile() throws Exception { + + YealinkPhone phone = new YealinkPhone(); + PhoneModel model = new PhoneModel("yealink"); + model.setProfileTemplate("yealink/config.vm"); + phone.setModel(model); + // call this to inject dummy data + PhoneTestDriver.supplyTestData(phone); + MemoryProfileLocation location = TestHelper.setVelocityProfileGenerator(phone); + + phone.generateProfiles(location); + + InputStream expectedProfile = getClass().getResourceAsStream("MAC.cfg"); + String expected = IOUtils.toString(expectedProfile); + expectedProfile.close(); + + assertEquals(expected, location.toString()); + } +} diff --git a/sipXconfig/sipxconfig.spec.in b/sipXconfig/sipxconfig.spec.in index be30f47..e6c95f2 100644 --- a/sipXconfig/sipxconfig.spec.in +++ b/sipXconfig/sipxconfig.spec.in @@ -322,6 +322,7 @@ rm -rf $RPM_BUILD_ROOT %config(noreplace) %{sipxpbxconf}/openfire/* %config(noreplace) %{sipxpbxconf}/sipxrest/* %config(noreplace) %{sipxpbxconf}/sipxprovision/* +%config(noreplace) %{sipxpbxconf}/yealink/* %define audiocodesdir %{_localstatedir}/sipxdata/audiocodes %dir %attr(775,@SIPXPBXUSER@,@SIPXPBXGROUP@) %{audiocodesdir} -- 1.6.0.6
_______________________________________________ sipx-dev mailing list [email protected] List Archive: http://list.sipfoundry.org/archive/sipx-dev Unsubscribe: http://list.sipfoundry.org/mailman/listinfo/sipx-dev sipXecs IP PBX -- http://www.sipfoundry.org/
