Asterisk And Hyper-V

Home » Asterisk Users » Asterisk And Hyper-V

Hi all!
Does anybody have experience with asterisk on Hyper-V? My test setup with Ubuntu 16 and asterisk 13.1 (ubuntu repo) shows sound distortion. I have analyzed the RTP flow with wireshark and I see high skew and delta values when the traffic leaves the hypervisor, however everything is okay when a capture is taken from a VM itself. I have read that there can be timing problems with Hyper-V. I have tried to disable time sync with the machine and tried different clocksources. I have also tried to change asterisk timing interface to dahdi (dummy) – nothing helped so far. Hyper-V version is 12p2. Does anybody have a working setup with Hyper-V?

9 thoughts on - Asterisk And Hyper-V

  • Hi, Kseniya!

    I have three installations of Asterisk (as FreePBX but I think it is not important). They work fine.

    I have made some settings in Asterisk and Hyper-V:

    Asterisk: timing interface – timerfd.

    Hyper-V:

    1. Virtual Machine => Network Adapter => Hardware Acceleration =>
    Virtual Machine Queue – Disable it;
    2. Virtual Machine => Processor => Virtual Machine Reserve (percentage)
    – set at least 25% (if you have 4 virtual cores for your Asterisk).
    You can try to set reserve more or less then 25% – test it and,
    please, send email here;
    3. Virtual Machine => Integration Services => Time synchronisation –
    enable it.

    This settings helped me.

    Also check your Linux Kernel version – it must be 3.10 or newer. I saw very bad “timing test” results on kernel 2.6.32.

  • Thank you for a quick answer, Dmitry!

    We have tried the settings you suggested but nothing helped. The machine is running 4.4.0-104 kernel, 4 cores, Intel(R) Xeon(R) CPU E5-2620 v3 @
    2.40GHz, clocksource is hyperv_clocksource_tsc_page, timing module is res_timing_timerfd.so. We have also tried to set 50% Reserve – no luck :(.

    пн, 18 дек. 2017 г. в 10:49, Dmitriy Ermakov :

  • Dmitry, are you using CentOS? What kernel version are you using? I will try with the same to see if it can be also a kernel-related issue.

    пн, 18 дек. 2017 г. в 11:35, Kseniya Blashchuk :

  • I am using CentOS 6, kernel 3.10 from elrepo.org kernels
    (3.10.102-1.el6.elrepo.x86_64). Asterisk version is 11.21.2 and Asterisk 13.X.X (I can’t get it’s version now).

    Is it possible that your network switches’ interfaces which are connected to Hyper-V Server are 100% busy?
    It is possible that my installation works well because my Hyper-V server is not high-load server so it has plenty free CPU, Disk, Memory, Network resources to give them to Asterisk VM.

    Kseniya, could you try to reserve 100% of virtual CPUs for Asterisk VM
    (just to test this configuration)?

    I am sorry I don’t have free hardware and time to test your Ubuntu 16, asterisk 13.1, kernel 4.4.0-104 configuration(

  • To be honest we are a bit afraid to set 100% )), but we have tried to set
    90% – no luck. I have also tested with 4.8 and 4.11 kernels – same results. I will try with CentOS 6 and kernel 3.10 to check if something changes. VSwitch shows 1-2% load on the interfaces, and this host is not overloaded at all, so I don’t think the VM has some lack of resources.

    пн, 18 дек. 2017 г. в 13:07, Dmitriy Ermakov :

  • No problem, I will try to test with CentOS if I have time

    пн, 18 дек. 2017 г. в 13:33, Dmitriy Ermakov :

  • What indication do you have that the problem is with the kernel or within the system?

    If you call from Asterisk to itself (with no networking involved), is there still distortion?

    Consider making a conference of several local channels (Echo, Playback, and whatever), and record whatever channel.

    Ubuntu has a “lowlatency” kernel. Does it matter if you use that variant?

  • I am not sure if the problem is within the system or within a hypervisor or a vswitch. My test is quite simple – when the traffic is captured from a VM
    interface, everything is fine, and there is no sound distortion; but when the traffic is captured from the hypervisor host interface, wireshark shows crazy delta and skew values for RTP stream, and the sound is already distorted. The host and the vswitch are not loaded, so this makes me think that the clock differs somehow on the VM or something like that. Good idea about recording – I will try. I’ll try with lowlatency kernel as well.

    ср, 20 дек. 2017 г. в 14:42, Tzafrir Cohen :