Internal Server Error(500)

Discussion in '3CX Phone System - General' started by ShanA, Feb 28, 2018.

Tags:
Thread Status:
Not open for further replies.
  1. ShanA

    Joined:
    Feb 28, 2018
    Messages:
    4
    Likes Received:
    0
    Hello,

    I updated the server to the latest release this past weekend. Every thing seems to work but when I edit any phone extensions and save the changes it gives me the following error. We are using default templates for Yealink T46 and 48.

    Code:
    System.NullReferenceException: Object reference not set to an instance of an object.
       at TCX.Configuration.Templates.LocalPhoneDevice.SetDynamicOptionValue(BaseOption option, Object value)
       at ConfigurationManagementModel.CfgTemplateInfo.SetPhoneVlanInfo(PhoneDeviceVlanType type, LocalPhoneDevice phoneDevice, PhoneDeviceVlanInfo info)
       at ConfigurationManagementModel.CfgTemplateInfo.SaveInfoToPhoneDevice(PhoneDeviceInfo info, PhoneDevice phoneDevice, Extension extension)
       at ConfigurationManagementModel.PhoneDeviceInfoExtension.SetPhoneDeviceInfos(Extension ex, PhoneDeviceInfo[] infos, ICfgTemplateInfoProvider templateInfoProvider)
       at ConfigurationManagementModel.CfgExtensionEditor.Serialize_AfterSerialize(Object sender, SerializeEventArgs e)
       at ConfigurationManagementModel.PropertySerializer.FireAfterSerialize(ICfgItemInternal cfgItem, Boolean save)
       at ConfigurationManagementModel.PropertySerializer.Serialize(ICfgItemInternal cfgItem, SerializeParameters serializeParameters)
       at ConfigurationManagementModel.CfgItemBase.Save()
       at ManagementConsoleJS.Services.Editor.Save()
       at ManagementConsoleJS.Services.EditorService.SaveActiveObject(Int32 id)
       at ManagementConsoleJS.Controllers.EditController.Save(Int32 id)
       at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.d__12.MoveNext()
    --- End of stack trace from previous location where exception was thrown ---
       at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
       at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
       at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.d__10.MoveNext()
    --- End of stack trace from previous location where exception was thrown ---
       at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
       at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Rethrow(ActionExecutedContext context)
       at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
       at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.d__14.MoveNext()
    --- End of stack trace from previous location where exception was thrown ---
       at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
       at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
       at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.d__22.MoveNext()
    --- End of stack trace from previous location where exception was thrown ---
       at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
       at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.Rethrow(ResourceExecutedContext context)
       at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
       at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.d__17.MoveNext()
    --- End of stack trace from previous location where exception was thrown ---
       at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
       at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
       at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.d__15.MoveNext()
    --- End of stack trace from previous location where exception was thrown ---
       at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
       at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
       at Microsoft.AspNetCore.Builder.RouterMiddleware.d__4.MoveNext()
    --- End of stack trace from previous location where exception was thrown ---
       at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
       at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
       at ManagementConsoleJS.Middleware.ExceptionWrapperMiddleware.d__3.MoveNext()
     
  2. MikeyG.IT

    Joined:
    Oct 2, 2017
    Messages:
    34
    Likes Received:
    2
    Were there custom templates being used in the last version?
     
  3. ShanA

    Joined:
    Feb 28, 2018
    Messages:
    4
    Likes Received:
    0
    We do use custom template for only a few but this particular phone set did not use custom template in the old system.
     
  4. MikeyG.IT

    Joined:
    Oct 2, 2017
    Messages:
    34
    Likes Received:
    2
    I would try removing the phone from the provisioning section within the extension settings and re-adding, if that makes sense.
     
  5. YiannisH_3CX

    YiannisH_3CX Support Team
    Staff Member 3CX Support

    Joined:
    May 10, 2016
    Messages:
    4,349
    Likes Received:
    274
    Hello @MikeyG.IT

    If your custom templates have the same phone user agent then even if you remove and re add the phone to the extension you will face the same issue.
    When creating custom templates you need to make sure that the use agent of the phones in the custom templates is different from the default.
    If the values are the same on both templates then the management console will not be able to distinguish between the default and custom templates and you will end up with the error you are seeing. The correct way to implement custom templates is outlined in the guide below.
    https://www.3cx.com/docs/custom-ip-phone-templates/
     
  6. ShanA

    Joined:
    Feb 28, 2018
    Messages:
    4
    Likes Received:
    0
    The custom template have a different name than the default ones. Besides it was working fine prior to upgrading to the latest release.
     
  7. YiannisH_3CX

    YiannisH_3CX Support Team
    Staff Member 3CX Support

    Joined:
    May 10, 2016
    Messages:
    4,349
    Likes Received:
    274
    Open the custom template and check the model names in the template. Are they different from the default template?
    For example:
    2018-03-02_12h22_58.png
     
  8. ShanA

    Joined:
    Feb 28, 2018
    Messages:
    4
    Likes Received:
    0
    The custom template shows the following:

    <type>phone-template</type>
    <version>36097</version>
    <time>2014-03-20 09:00:00</time>
    <name>Yealink T46/48</name>
    <url>http://www.yealink.com</url>
    <models>
    <model ua="SIP-T46G">Yealink T46 CCAR</model>
    <model ua="SIP-T48G">Yealink T48 CCAR</model>
    </models>

    The default template shows:

    <models>
    <model ua="SIP-T19P_E2">Yealink T19P E2</model>
    <model ua="SIP-T19_E2">Yealink T19 E2</model>
    <model ua="SIP-T21P_E2">Yealink T21P E2</model>
    <model ua="SIP-T21_E2">Yealink T21 E2</model>
    <model ua="SIP-T23P">Yealink T23P</model>
    <model ua="SIP-T23G">Yealink T23G</model>
    <model ua="SIP-T27P">Yealink T27P</model>
    <model ua="SIP-T27G">Yealink T27G</model>
    <model ua="SIP-T29G">Yealink T29G</model>
    <model ua="SIP-T40P">Yealink T40P</model>
    <model ua="SIP-T40G">Yealink T40G</model>
    <model ua="SIP-T41S">Yealink T41S</model>
    <model ua="SIP-T41P">Yealink T41</model>
    <model ua="SIP-T42S">Yealink T42S</model>
    <model ua="SIP-T42G">Yealink T42</model>
    <model ua="SIP-T46S">Yealink T46S</model>
    <model ua="SIP-T46G">Yealink T46</model>
    <model ua="SIP-T48S">Yealink T48S</model>
    <model ua="SIP-T48G">Yealink T48</model>
    <model ua="SIP-T52S">Yealink T52S</model>
    <model ua="SIP-T54S">Yealink T54S</model>
    </models>
    Thanks
     
  9. Saqqara

    Saqqara Active Member

    Joined:
    Mar 12, 2014
    Messages:
    842
    Likes Received:
    125
  10. YiannisH_3CX

    YiannisH_3CX Support Team
    Staff Member 3CX Support

    Joined:
    May 10, 2016
    Messages:
    4,349
    Likes Received:
    274
    Since you are using the default templates you can remove the custom templates from the custom templates folder and see if that fixes your issue. If not we might need to take a closer look at the issue.
     
  11. theMightyMacBoy

    Joined:
    Mar 21, 2017
    Messages:
    31
    Likes Received:
    3
    Hi. I came here from a Google search. I removed all of my custom templates from the folder (I think we only used one or two on our 800 extensions, almost all are stock template) Once I removed them and restarted services the error went away. Had the error for stock templates and the two extensions with custom template. Will troubleshoot more, but thought I should put in what I found out. Cheers!
     
  12. YiannisH_3CX

    YiannisH_3CX Support Team
    Staff Member 3CX Support

    Joined:
    May 10, 2016
    Messages:
    4,349
    Likes Received:
    274
    Thank you for sharing your findings. Please note that in some cases custom templates use the same user agent for the phones as the defaults. In that case even if you select the default template from the management console the PBX sees 2 templates and can cause issues. So even if a miss-configured custom template is present in the folder it can still cause issues.
     
Thread Status:
Not open for further replies.