diff --git a/lib/installer-exclude/libjitsi.jar b/lib/installer-exclude/libjitsi.jar index 111e7c682..cca7e3ae3 100644 Binary files a/lib/installer-exclude/libjitsi.jar and b/lib/installer-exclude/libjitsi.jar differ diff --git a/resources/languages/resources.properties b/resources/languages/resources.properties index f6684859c..47c1d75d6 100644 --- a/resources/languages/resources.properties +++ b/resources/languages/resources.properties @@ -1104,6 +1104,9 @@ plugin.sipaccregwizz.KEEP_ALIVE=Keep alive plugin.sipaccregwizz.KEEP_ALIVE_METHOD=Keep alive method plugin.sipaccregwizz.KEEP_ALIVE_INTERVAL=Keep alive interval plugin.sipaccregwizz.KEEP_ALIVE_INTERVAL_INFO=Between 1 and 3600 seconds +plugin.sipaccregwizz.DTMF_MINIMAL_TONE_DURATION=Minimal RTP DTMF tone duration (ms) +plugin.sipaccregwizz.DTMF_MINIMAL_TONE_DURATION_INFO=Default RTP DTMF duration is 70 ms +plugin.sipaccregwizz.DTMF=DTMF plugin.sipaccregwizz.DTMF_METHOD=DTMF method plugin.sipaccregwizz.DTMF_AUTO=Auto: Choose automatically between RTP and Inband (no SIP INFO) plugin.sipaccregwizz.DTMF_RTP=RTP ( RFC2833 / RFC 4733 ) diff --git a/src/net/java/sip/communicator/impl/protocol/jabber/OperationSetDTMFJabberImpl.java b/src/net/java/sip/communicator/impl/protocol/jabber/OperationSetDTMFJabberImpl.java index bf0024b7a..000751f1c 100644 --- a/src/net/java/sip/communicator/impl/protocol/jabber/OperationSetDTMFJabberImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/jabber/OperationSetDTMFJabberImpl.java @@ -12,10 +12,12 @@ import net.java.sip.communicator.service.protocol.OperationFailedException; import net.java.sip.communicator.util.*; +import org.jitsi.service.configuration.*; import org.jitsi.service.neomedia.*; import org.jitsi.service.neomedia.codec.*; import org.jitsi.service.neomedia.format.*; import org.jitsi.service.protocol.*; +import org.jitsi.util.StringUtils; // Disambiguation /** * Class responsible for sending a DTMF Tone using using rfc4733 or Inband. @@ -36,6 +38,11 @@ public class OperationSetDTMFJabberImpl */ private DTMFMethod dtmfMethod; + /** + * The minimal tone duration. + */ + private int minimalToneDuration; + /** * Constructor. * @@ -44,6 +51,7 @@ public class OperationSetDTMFJabberImpl public OperationSetDTMFJabberImpl(ProtocolProviderServiceJabberImpl pps) { this.dtmfMethod = this.getDTMFMethod(pps); + this.minimalToneDuration = this.getMinimalToneDuration(pps); } /** @@ -99,7 +107,7 @@ public synchronized void startSendingDTMF(CallPeer callPeer, DTMFTone tone) } ((AudioMediaStream)cp.getMediaHandler().getStream(MediaType.AUDIO)) - .startSendingDTMF(tone, cpDTMFMethod); + .startSendingDTMF(tone, cpDTMFMethod, minimalToneDuration); } /** @@ -208,4 +216,39 @@ else if(dtmfString.equals("RTP_DTMF")) return DTMFMethod.INBAND_DTMF; } } + + /** + * Gets the minimal DTMF tone duration for this account. + * + * @param pps the Jabber Protocol provider service + * + * @return The minimal DTMF tone duration for this account. + */ + private int getMinimalToneDuration(ProtocolProviderServiceJabberImpl pps) + { + AccountID accountID = pps.getAccountID(); + String minimalToneDurationString + = accountID.getAccountPropertyString("DTMF_MINIMAL_TONE_DURATION"); + int minimalToneDuration + = OperationSetDTMF.DEFAULT_DTMF_MINIMAL_TONE_DURATION; + // Check if there is a specific value for this account. + if(!StringUtils.isNullOrEmpty(minimalToneDurationString)) + { + minimalToneDuration = Integer.valueOf(minimalToneDurationString); + } + // Else look at the globl property. + else + { + ConfigurationService cfg + = JabberActivator.getConfigurationService(); + // Check if there is a custom value for the minimal tone duration. + if(cfg != null) + { + minimalToneDuration = cfg.getInt( + OperationSetDTMF.PROP_MINIMAL_RTP_DTMF_TONE_DURATION, + minimalToneDuration); + } + } + return minimalToneDuration; + } } diff --git a/src/net/java/sip/communicator/impl/protocol/sip/OperationSetDTMFSipImpl.java b/src/net/java/sip/communicator/impl/protocol/sip/OperationSetDTMFSipImpl.java index ca591b122..34f3a9d56 100644 --- a/src/net/java/sip/communicator/impl/protocol/sip/OperationSetDTMFSipImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/sip/OperationSetDTMFSipImpl.java @@ -13,10 +13,12 @@ import net.java.sip.communicator.service.protocol.OperationFailedException; import net.java.sip.communicator.util.*; +import org.jitsi.service.configuration.*; import org.jitsi.service.neomedia.*; import org.jitsi.service.neomedia.codec.*; import org.jitsi.service.neomedia.format.*; import org.jitsi.service.protocol.*; +import org.jitsi.util.StringUtils; // Disambiguation /** * Class responsible for sending a DTMF Tone using SIP INFO or using rfc4733. @@ -43,6 +45,11 @@ public class OperationSetDTMFSipImpl */ private final DTMFInfo dtmfModeInfo; + /** + * The minimal tone duration. + */ + private int minimalToneDuration; + /** * Constructor. * @@ -51,6 +58,7 @@ public class OperationSetDTMFSipImpl public OperationSetDTMFSipImpl(ProtocolProviderServiceSipImpl pps) { this.dtmfMethod = this.getDTMFMethod(pps); + this.minimalToneDuration = this.getMinimalToneDuration(pps); dtmfModeInfo = new DTMFInfo(pps); } @@ -116,7 +124,7 @@ public synchronized void startSendingDTMF(CallPeer callPeer, DTMFTone tone) } ((AudioMediaStream)cp.getMediaHandler().getStream(MediaType.AUDIO)) - .startSendingDTMF(tone, cpDTMFMethod); + .startSendingDTMF(tone, cpDTMFMethod, minimalToneDuration); } } @@ -250,4 +258,38 @@ else if(dtmfString.equals("SIP_INFO_DTMF")) return DTMFMethod.INBAND_DTMF; } } + + /** + * Gets the minimal DTMF tone duration for this account. + * + * @param pps the SIP Protocol provider service + * + * @return The minimal DTMF tone duration for this account. + */ + private int getMinimalToneDuration(ProtocolProviderServiceSipImpl pps) + { + AccountID accountID = pps.getAccountID(); + String minimalToneDurationString + = accountID.getAccountPropertyString("DTMF_MINIMAL_TONE_DURATION"); + int minimalToneDuration + = OperationSetDTMF.DEFAULT_DTMF_MINIMAL_TONE_DURATION; + // Check if there is a specific value for this account. + if(!StringUtils.isNullOrEmpty(minimalToneDurationString)) + { + minimalToneDuration = Integer.valueOf(minimalToneDurationString); + } + // Else look at the globl property. + else + { + ConfigurationService cfg = SipActivator.getConfigurationService(); + // Check if there is a custom value for the minimal tone duration. + if(cfg != null) + { + minimalToneDuration = cfg.getInt( + OperationSetDTMF.PROP_MINIMAL_RTP_DTMF_TONE_DURATION, + minimalToneDuration); + } + } + return minimalToneDuration; + } } diff --git a/src/net/java/sip/communicator/plugin/jabberaccregwizz/ConnectionPanel.java b/src/net/java/sip/communicator/plugin/jabberaccregwizz/ConnectionPanel.java index 099d34cfe..910a09c45 100644 --- a/src/net/java/sip/communicator/plugin/jabberaccregwizz/ConnectionPanel.java +++ b/src/net/java/sip/communicator/plugin/jabberaccregwizz/ConnectionPanel.java @@ -100,6 +100,11 @@ public class ConnectionPanel "plugin.sipaccregwizz.DTMF_INBAND") }); + /** + * The text field used to change the DTMF minimal tone duration. + */ + private JTextField dtmfMinimalToneDurationValue = new JTextField(); + private final JabberAccountRegistrationForm parentForm; /** @@ -234,14 +239,64 @@ public void actionPerformed(ActionEvent e) */ private Component createDTMFPanel() { - JPanel dtmfPanel = new TransparentPanel(new BorderLayout(10, 10)); + JPanel emptyLabelPanel = new TransparentPanel(); + + // Labels. + JPanel dtmfLabels = new TransparentPanel(new GridLayout(0, 1, 5, 5)); JLabel dtmfMethodLabel = new JLabel( Resources.getString("plugin.sipaccregwizz.DTMF_METHOD")); - dtmfPanel.add(dtmfMethodLabel, BorderLayout.WEST); - + JLabel minimalDTMFToneDurationLabel = new JLabel( + Resources.getString( + "plugin.sipaccregwizz.DTMF_MINIMAL_TONE_DURATION")); + dtmfLabels.add(dtmfMethodLabel); + dtmfLabels.add(minimalDTMFToneDurationLabel); + dtmfLabels.add(emptyLabelPanel); + + // Values + JPanel dtmfValues = new TransparentPanel(new GridLayout(0, 1, 5, 5)); + dtmfMethodBox.addItemListener(new ItemListener() + { + public void itemStateChanged(ItemEvent e) + { + boolean isEnabled = false; + String selectedItem + = (String) dtmfMethodBox.getSelectedItem(); + if(selectedItem != null + && (selectedItem.equals(Resources.getString( + "plugin.sipaccregwizz.DTMF_AUTO")) + || selectedItem.equals(Resources.getString( + "plugin.sipaccregwizz.DTMF_RTP"))) + ) + { + isEnabled = true; + } + dtmfMinimalToneDurationValue.setEnabled(isEnabled); + } + }); dtmfMethodBox.setSelectedItem( - parentForm.getRegistration().getDefaultDTMFMethod()); - dtmfPanel.add(dtmfMethodBox, BorderLayout.CENTER); + parentForm.getRegistration().getDefaultDTMFMethod()); + dtmfMinimalToneDurationValue.setText( + JabberAccountRegistration.DEFAULT_MINIMAL_DTMF_TONE_DURATION); + JLabel dtmfMinimalToneDurationExampleLabel = new JLabel( + Resources.getString( + "plugin.sipaccregwizz.DTMF_MINIMAL_TONE_DURATION_INFO")); + dtmfMinimalToneDurationExampleLabel.setForeground(Color.GRAY); + dtmfMinimalToneDurationExampleLabel.setFont( + dtmfMinimalToneDurationExampleLabel.getFont().deriveFont(8)); + dtmfMinimalToneDurationExampleLabel.setMaximumSize( + new Dimension(40, 35)); + dtmfMinimalToneDurationExampleLabel.setBorder( + BorderFactory.createEmptyBorder(0, 0, 8, 0)); + dtmfValues.add(dtmfMethodBox); + dtmfValues.add(dtmfMinimalToneDurationValue); + dtmfValues.add(dtmfMinimalToneDurationExampleLabel); + + // DTMF panel + JPanel dtmfPanel = new TransparentPanel(new BorderLayout(10, 10)); + dtmfPanel.setBorder(BorderFactory.createTitledBorder( + Resources.getString("plugin.sipaccregwizz.DTMF"))); + dtmfPanel.add(dtmfLabels, BorderLayout.WEST); + dtmfPanel.add(dtmfValues, BorderLayout.CENTER); return dtmfPanel; } @@ -515,6 +570,26 @@ else if(dtmfMethod.equals("INBAND_DTMF")) } } + /** + * Returns the minimal DTMF tone duration. + * + * @return The minimal DTMF tone duration. + */ + String getDtmfMinimalToneDuration() + { + return dtmfMinimalToneDurationValue.getText(); + } + + /** + * Sets the minimal DTMF tone duration + * + * @param dtmfMinimalToneDuration + */ + void setDtmfMinimalToneDuration(String dtmfMinimalToneDuration) + { + dtmfMinimalToneDurationValue.setText(dtmfMinimalToneDuration); + } + /** * Sets the serverOverridden property. * @param isServerOverridden true to indicate that the server is diff --git a/src/net/java/sip/communicator/plugin/jabberaccregwizz/JabberAccountRegistration.java b/src/net/java/sip/communicator/plugin/jabberaccregwizz/JabberAccountRegistration.java index 4e77f9c66..8744f40b0 100755 --- a/src/net/java/sip/communicator/plugin/jabberaccregwizz/JabberAccountRegistration.java +++ b/src/net/java/sip/communicator/plugin/jabberaccregwizz/JabberAccountRegistration.java @@ -47,8 +47,17 @@ public class JabberAccountRegistration */ public static final boolean DEFAULT_RESOURCE_AUTOGEN = true; + /** + * The default value for DTMF method. + */ private String defaultDTMFMethod = "AUTO_DTMF"; + /** + * The default value of minimale DTMF tone duration. + */ + public static String DEFAULT_MINIMAL_DTMF_TONE_DURATION = Integer.toString( + OperationSetDTMF.DEFAULT_DTMF_MINIMAL_TONE_DURATION); + /** * The user identifier. */ @@ -208,6 +217,11 @@ public class JabberAccountRegistration */ private String dtmfMethod = null; + /** + * The minimal DTMF tone duration set. + */ + private String dtmfMinimalToneDuration = DEFAULT_MINIMAL_DTMF_TONE_DURATION; + /** * Initializes a new JabberAccountRegistration. */ @@ -865,6 +879,26 @@ public void setDefaultDTMFMethod(String defaultDTMFMethod) this.defaultDTMFMethod = defaultDTMFMethod; } + /** + * Returns the minimal DTMF tone duration. + * + * @return The minimal DTMF tone duration. + */ + public String getDtmfMinimalToneDuration() + { + return dtmfMinimalToneDuration; + } + + /** + * Sets the minimal DTMF tone duration. + * + * @param dtmfMinimalToneDuration The minimal DTMF tone duration to set. + */ + public void setDtmfMinimalToneDuration(String dtmfMinimalToneDuration) + { + this.dtmfMinimalToneDuration = dtmfMinimalToneDuration; + } + /** * Sets the method used for RTP/SAVP indication. */ diff --git a/src/net/java/sip/communicator/plugin/jabberaccregwizz/JabberAccountRegistrationForm.java b/src/net/java/sip/communicator/plugin/jabberaccregwizz/JabberAccountRegistrationForm.java index 48e4dbce6..d9f04eaff 100644 --- a/src/net/java/sip/communicator/plugin/jabberaccregwizz/JabberAccountRegistrationForm.java +++ b/src/net/java/sip/communicator/plugin/jabberaccregwizz/JabberAccountRegistrationForm.java @@ -16,6 +16,8 @@ import net.java.sip.communicator.service.credentialsstorage.*; import net.java.sip.communicator.service.protocol.*; +import org.jitsi.util.*; + /** * The JabberAccountRegistrationForm. * @@ -312,6 +314,8 @@ public boolean commitPage(JabberAccountRegistration registration) registration.setPriority(Integer.parseInt(priority)); registration.setDTMFMethod(connectionPanel.getDTMFMethod()); + registration.setDtmfMinimalToneDuration( + connectionPanel.getDtmfMinimalToneDuration()); securityPanel.commitPanel(registration); @@ -436,6 +440,10 @@ public void loadAccount(AccountID accountID) connectionPanel.setDTMFMethod( accountID.getAccountPropertyString("DTMF_METHOD")); + String dtmfMinimalToneDuration = + accountID.getAccountPropertyString("DTMF_MINIMAL_TONE_DURATION"); + if(!StringUtils.isNullOrEmpty(dtmfMinimalToneDuration)) + connectionPanel.setDtmfMinimalToneDuration(dtmfMinimalToneDuration); securityPanel.loadAccount(accountID); diff --git a/src/net/java/sip/communicator/plugin/jabberaccregwizz/JabberAccountRegistrationWizard.java b/src/net/java/sip/communicator/plugin/jabberaccregwizz/JabberAccountRegistrationWizard.java index 4e1b19509..e2019333f 100644 --- a/src/net/java/sip/communicator/plugin/jabberaccregwizz/JabberAccountRegistrationWizard.java +++ b/src/net/java/sip/communicator/plugin/jabberaccregwizz/JabberAccountRegistrationWizard.java @@ -196,6 +196,11 @@ public Iterator> getSummary() Resources.getString("plugin.sipaccregwizz.DTMF_METHOD"), registration.getDTMFMethod()); + summaryTable.put( + Resources.getString( + "plugin.sipaccregwizz.DTMF_MINIMAL_TONE_DURATION"), + registration.getDtmfMinimalToneDuration()); + return summaryTable.entrySet().iterator(); } @@ -444,6 +449,10 @@ protected ProtocolProviderService installAccount( accountProperties.put("DTMF_METHOD", registration.getDefaultDTMFMethod()); + accountProperties.put( + ProtocolProviderFactory.DTMF_MINIMAL_TONE_DURATION, + registration.getDtmfMinimalToneDuration()); + accountProperties.put(ProtocolProviderFactory.DEFAULT_ENCRYPTION, Boolean.toString(registration.isDefaultEncryption())); diff --git a/src/net/java/sip/communicator/plugin/sipaccregwizz/ConnectionPanel.java b/src/net/java/sip/communicator/plugin/sipaccregwizz/ConnectionPanel.java index 91f58fecb..a5602ad86 100644 --- a/src/net/java/sip/communicator/plugin/sipaccregwizz/ConnectionPanel.java +++ b/src/net/java/sip/communicator/plugin/sipaccregwizz/ConnectionPanel.java @@ -72,6 +72,11 @@ public class ConnectionPanel "plugin.sipaccregwizz.DTMF_INBAND") }); + /** + * The text field used to change the DTMF minimal tone duration. + */ + private JTextField dtmfMinimalToneDurationValue = new JTextField(); + private final JCheckBox mwiCheckBox; private boolean isServerOverridden = false; @@ -376,14 +381,64 @@ private Component createKeepAlivePanel() */ private Component createDTMFPanel() { - JPanel dtmfPanel = new TransparentPanel(new BorderLayout(10, 10)); + JPanel emptyLabelPanel = new TransparentPanel(); + + // Labels. + JPanel dtmfLabels = new TransparentPanel(new GridLayout(0, 1, 5, 5)); JLabel dtmfMethodLabel = new JLabel( Resources.getString("plugin.sipaccregwizz.DTMF_METHOD")); - dtmfPanel.add(dtmfMethodLabel, BorderLayout.WEST); - + JLabel minimalDTMFToneDurationLabel = new JLabel( + Resources.getString( + "plugin.sipaccregwizz.DTMF_MINIMAL_TONE_DURATION")); + dtmfLabels.add(dtmfMethodLabel); + dtmfLabels.add(minimalDTMFToneDurationLabel); + dtmfLabels.add(emptyLabelPanel); + + // Values + JPanel dtmfValues = new TransparentPanel(new GridLayout(0, 1, 5, 5)); + dtmfMethodBox.addItemListener(new ItemListener() + { + public void itemStateChanged(ItemEvent e) + { + boolean isEnabled = false; + String selectedItem + = (String) dtmfMethodBox.getSelectedItem(); + if(selectedItem != null + && (selectedItem.equals(Resources.getString( + "plugin.sipaccregwizz.DTMF_AUTO")) + || selectedItem.equals(Resources.getString( + "plugin.sipaccregwizz.DTMF_RTP"))) + ) + { + isEnabled = true; + } + dtmfMinimalToneDurationValue.setEnabled(isEnabled); + } + }); dtmfMethodBox.setSelectedItem( regform.getRegistration().getDefaultDTMFMethod()); - dtmfPanel.add(dtmfMethodBox, BorderLayout.CENTER); + dtmfMinimalToneDurationValue + .setText(SIPAccountRegistration.DEFAULT_MINIMAL_DTMF_TONE_DURATION); + JLabel dtmfMinimalToneDurationExampleLabel = new JLabel( + Resources.getString( + "plugin.sipaccregwizz.DTMF_MINIMAL_TONE_DURATION_INFO")); + dtmfMinimalToneDurationExampleLabel.setForeground(Color.GRAY); + dtmfMinimalToneDurationExampleLabel.setFont( + dtmfMinimalToneDurationExampleLabel.getFont().deriveFont(8)); + dtmfMinimalToneDurationExampleLabel.setMaximumSize( + new Dimension(40, 35)); + dtmfMinimalToneDurationExampleLabel.setBorder( + BorderFactory.createEmptyBorder(0, 0, 8, 0)); + dtmfValues.add(dtmfMethodBox); + dtmfValues.add(dtmfMinimalToneDurationValue); + dtmfValues.add(dtmfMinimalToneDurationExampleLabel); + + // DTMF panel + JPanel dtmfPanel = new TransparentPanel(new BorderLayout(10, 10)); + dtmfPanel.setBorder(BorderFactory.createTitledBorder( + Resources.getString("plugin.sipaccregwizz.DTMF"))); + dtmfPanel.add(dtmfLabels, BorderLayout.WEST); + dtmfPanel.add(dtmfValues, BorderLayout.CENTER); return dtmfPanel; } @@ -647,6 +702,25 @@ else if(dtmfMethod.equals("INBAND_DTMF")) } } + /** + * Returns the minimal DTMF tone duration. + * + * @return The minimal DTMF tone duration. + */ + String getDtmfMinimalToneDuration() + { + return dtmfMinimalToneDurationValue.getText(); + } + + /** + * Sets the keep alive interval + * @param keepAliveInterval the keep alive interval + */ + void setKeepAliveInterval(String keepAliveInterval) + { + keepAliveIntervalValue.setText(keepAliveInterval); + } + /** * Returns the voicemail URI. * @return the voicemail URI. @@ -702,12 +776,13 @@ void setMessageWaitingIndications(boolean enabled) } /** - * Sets the keep alive interval - * @param keepAliveInterval the keep alive interval + * Sets the minimal DTMF tone duration + * + * @param dtmfMinimalToneDuration */ - void setKeepAliveInterval(String keepAliveInterval) + void setDtmfMinimalToneDuration(String dtmfMinimalToneDuration) { - keepAliveIntervalValue.setText(keepAliveInterval); + dtmfMinimalToneDurationValue.setText(dtmfMinimalToneDuration); } /** diff --git a/src/net/java/sip/communicator/plugin/sipaccregwizz/SIPAccountRegistration.java b/src/net/java/sip/communicator/plugin/sipaccregwizz/SIPAccountRegistration.java index 9f6bf0302..0ae70b752 100644 --- a/src/net/java/sip/communicator/plugin/sipaccregwizz/SIPAccountRegistration.java +++ b/src/net/java/sip/communicator/plugin/sipaccregwizz/SIPAccountRegistration.java @@ -7,6 +7,7 @@ import java.util.*; +import net.java.sip.communicator.service.protocol.*; import net.java.sip.communicator.util.wizard.*; /** * The SIPAccountRegistration is used to store all user input data @@ -32,8 +33,17 @@ public class SIPAccountRegistration public static String DEFAULT_KEEP_ALIVE_INTERVAL = "25"; + /** + * The default value for DTMF method. + */ private String defaultDTMFMethod = "AUTO_DTMF"; + /** + * The default value of minimale DTMF tone duration. + */ + public static String DEFAULT_MINIMAL_DTMF_TONE_DURATION = Integer.toString( + OperationSetDTMF.DEFAULT_DTMF_MINIMAL_TONE_DURATION); + private String id; private String password; @@ -84,8 +94,16 @@ public class SIPAccountRegistration private String keepAliveInterval = DEFAULT_KEEP_ALIVE_INTERVAL; + /** + * DTMF method. + */ private String dtmfMethod = null; + /** + * The minimal DTMF tone duration set. + */ + private String dtmfMinimalToneDuration = DEFAULT_MINIMAL_DTMF_TONE_DURATION; + private String defaultDomain = null; private boolean xCapEnable = false; @@ -573,6 +591,26 @@ public void setDTMFMethod(String dtmfMethod) this.dtmfMethod = dtmfMethod; } + /** + * Returns the minimal DTMF tone duration. + * + * @return The minimal DTMF tone duration. + */ + public String getDtmfMinimalToneDuration() + { + return dtmfMinimalToneDuration; + } + + /** + * Sets the minimal DTMF tone duration. + * + * @param dtmfMinimalToneDuration The minimal DTMF tone duration to set. + */ + public void setDtmfMinimalToneDuration(String dtmfMinimalToneDuration) + { + this.dtmfMinimalToneDuration = dtmfMinimalToneDuration; + } + /** * Gets the method used for RTP/SAVP indication. * diff --git a/src/net/java/sip/communicator/plugin/sipaccregwizz/SIPAccountRegistrationForm.java b/src/net/java/sip/communicator/plugin/sipaccregwizz/SIPAccountRegistrationForm.java index fd28f0990..d404fdae3 100644 --- a/src/net/java/sip/communicator/plugin/sipaccregwizz/SIPAccountRegistrationForm.java +++ b/src/net/java/sip/communicator/plugin/sipaccregwizz/SIPAccountRegistrationForm.java @@ -301,6 +301,8 @@ public boolean commitPage(SIPAccountRegistration registration) registration.setDTMFMethod( connectionPanel.getDTMFMethod()); + registration.setDtmfMinimalToneDuration( + connectionPanel.getDtmfMinimalToneDuration()); SIPAccRegWizzActivator.getUIService().getAccountRegWizardContainer() .setBackButtonEnabled(true); @@ -393,6 +395,8 @@ public void loadAccount(AccountID accountID) String dtmfMethod = accountID.getAccountPropertyString("DTMF_METHOD"); + String dtmfMinimalToneDuration = + accountID.getAccountPropertyString("DTMF_MINIMAL_TONE_DURATION"); String voicemailURI = accountID.getAccountPropertyString( ProtocolProviderFactory.VOICEMAIL_URI); @@ -460,6 +464,8 @@ public void loadAccount(AccountID accountID) connectionPanel.setKeepAliveInterval(keepAliveInterval); connectionPanel.setDTMFMethod(dtmfMethod); + if(!StringUtils.isNullOrEmpty(dtmfMinimalToneDuration)) + connectionPanel.setDtmfMinimalToneDuration(dtmfMinimalToneDuration); boolean mwiEnabled = accountID.getAccountPropertyBoolean( ProtocolProviderFactory.VOICEMAIL_ENABLED, true); diff --git a/src/net/java/sip/communicator/plugin/sipaccregwizz/SIPAccountRegistrationWizard.java b/src/net/java/sip/communicator/plugin/sipaccregwizz/SIPAccountRegistrationWizard.java index ee0165944..7c607f96a 100644 --- a/src/net/java/sip/communicator/plugin/sipaccregwizz/SIPAccountRegistrationWizard.java +++ b/src/net/java/sip/communicator/plugin/sipaccregwizz/SIPAccountRegistrationWizard.java @@ -266,6 +266,10 @@ public Iterator> getSummary() summaryTable.put( Resources.getString("plugin.sipaccregwizz.DTMF_METHOD"), registration.getDTMFMethod()); + summaryTable.put( + Resources.getString( + "plugin.sipaccregwizz.DTMF_MINIMAL_TONE_DURATION"), + registration.getDtmfMinimalToneDuration()); if (registration.isXCapEnable() || registration.isXiVOEnable()) { @@ -509,6 +513,10 @@ else if(serverAddress == null && else accountProperties.put("DTMF_METHOD", registration.getDefaultDTMFMethod()); + + accountProperties.put( + ProtocolProviderFactory.DTMF_MINIMAL_TONE_DURATION, + registration.getDtmfMinimalToneDuration()); accountProperties.put(ProtocolProviderFactory.OVERRIDE_ENCODINGS, Boolean.toString(registration.isOverrideEncodings())); diff --git a/src/net/java/sip/communicator/service/protocol/OperationSetDTMF.java b/src/net/java/sip/communicator/service/protocol/OperationSetDTMF.java index d39449b72..3d70a21c5 100644 --- a/src/net/java/sip/communicator/service/protocol/OperationSetDTMF.java +++ b/src/net/java/sip/communicator/service/protocol/OperationSetDTMF.java @@ -17,6 +17,19 @@ public interface OperationSetDTMF extends OperationSet { + /** + * The minimal tone duration value for RFC4733 is 70 ms. + */ + public static final int DEFAULT_DTMF_MINIMAL_TONE_DURATION = 70; + + /** + * The name of the ConfigurationService int property + * which indicates the minimal duration for a DTMF tone. + * The default value is 70 ms. + */ + public static final String PROP_MINIMAL_RTP_DTMF_TONE_DURATION = + "net.java.sip.communicator.service.protocol.minimalRtpDtmfToneDuration"; + /** * Sends the DTMFTone tone to callPeer. * diff --git a/src/net/java/sip/communicator/service/protocol/ProtocolProviderFactory.java b/src/net/java/sip/communicator/service/protocol/ProtocolProviderFactory.java index 305842669..aa553713c 100644 --- a/src/net/java/sip/communicator/service/protocol/ProtocolProviderFactory.java +++ b/src/net/java/sip/communicator/service/protocol/ProtocolProviderFactory.java @@ -441,6 +441,12 @@ public abstract class ProtocolProviderFactory */ public static final String KEEP_ALIVE_INTERVAL = "KEEP_ALIVE_INTERVAL"; + /** + * The minimal DTMF tone duration. + */ + public static final String DTMF_MINIMAL_TONE_DURATION + = "DTMF_MINIMAL_TONE_DURATION"; + /** * Paranoia mode when turned on requires all calls to be secure and * indicated as such.