英文:
C# API Request starts with a Backslash
问题
我对C#和编程相对不太熟悉。我为我的公司制作了一个小程序,可以自动提供新的电话和模式。
直到电话分机/模式更改为以**\+43**开头之前,它都运行正常。在更改之前,只是分机号码(1013),现在是\+435094941013。
这是一个Cisco Unified Call Manager API/ Cisco AXL的问题,但我没有在这个主题上找到任何相关信息
我尝试过:
string line = @"\+43...1013";
和
string line = "\\+43...1013";
但我总是得到一个空异常/没有找到任何内容...
当我手动更改回旧格式,没有**\+43**时,它可以正常工作。
@编辑:
请求看起来像这样:
string inputline = "\\+435094941013"; // 只使用 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;
});
英文:
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;
});
答案1
得分: 0
CUCM底层数据库使用Informix IDS,其中AXL <listXXX>
请求最终使用SQL LIKE 进行匹配。支持的通配符只是 "_
"(代表单个字符)和 "%
"(代表任意字符)。您的代码示例似乎使用 "...
" 作为 '任意字符' 通配符 - 如果是这样,那可能是问题所在。
仅在HTTP/XML层,<lineLine>
对我来说(在CUCM v14中)似乎可以使用 "%
":
...
<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>
...
有可能在您的代码和发送到CUCM的原始XML之间的某个层次中,有一些与保留字符/转义字符等相关的意外操作 - 如果您可以查看实际发送的XML,可能会提供一些线索...
英文:
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...
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论