- Joined
- Jun 21, 2021
- Messages
- 18
- Reaction score
- 5
I was looking for ways to check if the user's input is a valid extension or not (if the extension exists or not) and if the extension was registered or not (is it logged in on any soft/desktop phone or Mobile App).
I found some code here on the forums to do that, But since I am not a developer myself, I was struggling trying to use this code.
For example, this method:
I tried using it this way

But received the following error
I was looking for pointers on how I would use this method (including Execute C# code component config ie: Method Name, Input parameters)
As well as this code to check the entered extension registration status:
Thanks in advance.
I found some code here on the forums to do that, But since I am not a developer myself, I was struggling trying to use this code.
For example, this method:
C#:
PhoneSystem.Root.GetDNByNumber()
C#:
public bool CheckValidExt(string UserInput)
{
DN dn = PhoneSystem.Root.GetDNByNumber(UserInput);
return (dn != null);
}

But received the following error
C#:
2024/03/27 15:59:27.643|12660|0006|Err|ScriptRunner.ScriptRunner-----
:[31013..31026)E: (610,27)-(610,40): Error CS0161: 'Main.CheckValidExtC682329230ECCComponent.CheckValidExt(string)': not all code paths return a value
private object CheckValidExt(string UserInput)
^^^^^^^^^^^^^
:[31077..31083)E: (612,12)-(612,18): Error CS0106: The modifier 'public' is not valid for this item
public bool CheckValidExt(string UserInput)
^^^^^^
:[31089..31102)W: (612,24)-(612,37): Warning CS8321: The local function 'CheckValidExt' is declared but never used
public bool CheckValidExt(string UserInput)
^^^^^^^^^^^^^
-------FAILED to compile---------
As well as this code to check the entered extension registration status:
C#:
return ((Extension)PhoneSystem.Root.GetDNByNumber(extensionNumber)).IsRegistered;
Thanks in advance.