Search code examples
c#backslashcisco-axl

C# API Request starts with a Backslash


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);

    [email protected](i => new { Description = i.description }).ToList();

    foreach (var row in [email protected]())
    {
        description = row.description;
    }
    return description;
});

Solution

  • 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...