0

I'm fairly new to c# and programming. I made a little program for my company to automatically provide new telefons and patterns.

It worked fine until the phone extension/pattern got changed to start with \+43. Before the change it was just the extension (1013), now its \+435094941013.

It's a Cisco Unified Call Manager API/ Cisco AXL, but I didn't really find anything regarding this topic :(

I tried: string line = @"\+43...1013"; and string line = "\\+43...1013";

but I always get a null exception / nothing was found ...
when I manually change it back to the old format without the \+43 it works.

@edit:
The Request looks like this:

string inputline = "\\+435094941013"; // Works with just 1013
string description = "";           

var Lines1 = await axlClient.ExecuteAsync(async client =>
{
    var request = new ListLineReq
    {
        returnedTags = new LLine { description = string.Empty },
        searchCriteria = new ListLineReqSearchCriteria { pattern = inputline}
    };
    var response = await client.listLineAsync(request);

    response.listLineResponse1.@return.Select(i => new { Description = i.description }).ToList();

    foreach (var row in response.listLineResponse1.@return.ToList())
    {
        description = row.description;
    }
    return description;
});
Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
Philipp
  • 3
  • 2
  • So where do you get the null reference execption? Please provide more context. – Klaus Gütter Jun 22 '23 at 10:21
  • The prefix is probably not stored as part of the number. Just use the number without the prefix in the old style, using Substring() if necessary. – Peter Dongan Jun 22 '23 at 10:28
  • @KlausGütter hey, i edited my question, i hope it's a bit cleared now! – Philipp Jun 22 '23 at 10:56
  • @Peter i tryed just +43... and even just 43... but i still just get a null reference expection – Philipp Jun 22 '23 at 10:57
  • I mean without the whole prefix of \+43 – Peter Dongan Jun 22 '23 at 11:02
  • @Peter unfortunately still not working. i tryed \+43, +43, without \+43 ... i looks like the backslash is ignored or cut out that's why he can't find the extension – Philipp Jun 22 '23 at 11:25
  • Exception = null probably means that there was *no expection*. Difficult to tell without seeing more code, however. – Klaus Gütter Jun 22 '23 at 18:43
  • @KlausGütter Thanks for your help Klaus! I updatet my question and the code -> when i change the pattern back to 1013 via the webinterface and search for 1013 it works. when i change it back to \+435094941013 in the webinteface and try to search with the \+435094941013 string i get no results ... i hope i explained it understandable! – Philipp Jun 23 '23 at 07:58

1 Answers1

0

The underlying database for CUCM is Informix IDS, where AXL <listXXX> requests end up using SQL LIKE for matches. The supported wildcards are simply "_" (for single character) and "%" for any character(s). Your code input example seems to be using "..." as an 'any characters' wildcard - if so, that may be the issue.

Just at the HTTP/XML layer, <lineLine> seems to work for me (CUCM v14) using "%":

...
<searchCriteria>
    <pattern>\\+43%1013</pattern>
</searchCriteria>
...
-------------------------------------------
...
<ns:listLineResponse xmlns:ns="http://www.cisco.com/AXL/API/14.0">
  <return>
    <line uuid="{3D105C47-F16B-1FD3-2527-22A74C79028E}">
      <pattern>\+435094941013</pattern>
...

It's possible that some layer between your code and the raw XML sent to CUCM is doing something unexpected with reserved characters/escape characters/etc. - if you can view the actual XML being sent, that may provide some clues...

David Staudt
  • 361
  • 2
  • 2
  • working with wildcards resolved my problem! if i search for %+435094941013 (so % instead of \) it finally works!! thank you so much – Philipp Jun 26 '23 at 14:59