Asterisk 具有新功能

发布于 2024-08-29 04:12:58 字数 446 浏览 5 评论 0原文

我在 sql 表中创建了一个 write func odbc 列表记录文件:

[R]

dsn=connector

write=INSERT INTO ast_records (filename,caller,callee,dtime) VALUES
('${ARG1}','${ARG2}','${ARG3}','${ARG4}')

prefix=M

并将其设置在 dialplan 中:

exten => _0X.,n,Set(
M_R(${MIXMONITOR_FILENAME}\,${CUSER}\,${EXTEN}\,${DTIME})= )

当我执行它时,我收到错误:ast_func_write: M_R 函数未注册:

请注意:带有 windows

I created a write func odbc list records files in sql table:

[R]

dsn=connector

write=INSERT INTO ast_records (filename,caller,callee,dtime) VALUES
('${ARG1}','${ARG2}','${ARG3}','${ARG4}')

prefix=M

and set it in dialplan :

exten => _0X.,n,Set(
M_R(${MIXMONITOR_FILENAME}\,${CUSER}\,${EXTEN}\,${DTIME})= )

when I excute it I get an error : ast_func_write: M_R Function not registered:

note that : asterisk with windows

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

·深蓝 2024-09-05 04:12:58
  1. 我看到的第一件事是您错误地执行了对函数的调用...您需要分配值,而不是参数...尝试这个:

    func_odbc.conf:

    <前><代码>[R]
    dsn=连接器
    前缀=M
    writesql=INSERT INTO ast_records (文件名,调用者,被调用者,dtime) VALUES('${VAL1}','${VAL2}','${VAL3}','${VAL4}');

    拨号方案:

    扩展=> _0X.,1,设置(M_R()=${MIXMONITOR_FILENAME}\,${CUSER}\,${EXTEN}\,${DTIME})
    

    如果这对您没有帮助,请继续我的列表:)

  2. 确保 func_odbc.so 正在由 Asterisk 加载。 (来自 asterisk CLI:模块显示类似 func_odbc)...如果未加载,则无法“构建”您的自定义 odbc 查询函数。

  3. 确保您的 DSN 已在 /etc/odbc.ini 中配置 确保
  4. /etc/asterisk/res_odbc.conf 已正确配置
  5. 确保您使用正确的名称调用 DSN(我经常看到这种情况发生)
  6. 启用详细信息并在 Asterisk 日志记录中进行调试,重新加载记录器,核心集详细 5,核心集调试 5,然后再次尝试调用。当调用完成后,查看日志,您将看到更多有关发生的事情的输出...

关于 reluze 的答案...不是在这里叫您出来,但在这里使用 PHP AGI 是严重的矫枉过正。 func_odbc 函数工作得很好,为什么通过调用外部脚本(必须在 TOP 本身上使用解释程序)来产生更多开销和潜在的安全问题?

  1. First thing I saw was you were performing the call to the function incorrectly...you need to be assigning values, not arguments....try this:

    func_odbc.conf:

    [R]
    dsn=connector
    prefix=M
    writesql=INSERT INTO ast_records (filename,caller,callee,dtime) VALUES('${VAL1}','${VAL2}','${VAL3}','${VAL4}');
    

    dialplan:

    exten => _0X.,1,Set(M_R()=${MIXMONITOR_FILENAME}\,${CUSER}\,${EXTEN}\,${DTIME})
    

    If that doesn't help you, continue on in my list :)

  2. Make sure func_odbc.so is being loaded by Asterisk. (from the asterisk CLI: module show like func_odbc)... If it's not loaded, it can't "build" your custom odbc query function.

  3. Make sure your DSN is configured in /etc/odbc.ini
  4. Make sure that /etc/asterisk/res_odbc.conf is properly configured
  5. Make sure you're calling the DSN by the right name (I see it happen all the time)
  6. enable verbose and debug in your Asterisk logging, do a logger reload, core set verbose 5, core set debug 5, and then try the call again. when the call finishes, review the log, you'll see much more output regarding what happened...

Regarding the answer from recluze...Not to call you out here, but using a PHP AGI is serious overkill here. The func_odbc function works just fine, why create more overhead and potential security issues by calling an external script (which has to use a interpreter program on TOP itself)?

往事风中埋 2024-09-05 04:12:58

您应该将 func odbc 函数称为“ODBC_connector”。连接器应在 func_odbc.conf 文件 [连接器] 中使用。在拨号方案中应该这样调用。

exten=> _0x.,n,ODBC_connector(${arg1},${arg2})

you should call func odbc function as "ODBC_connector". connector should be use in the func_odbc.conf file [connector]. In the dialplan it should call like this.

exten=> _0x.,n,ODBC_connector(${arg1},${arg2})
憧憬巴黎街头的黎明 2024-09-05 04:12:58

我不太明白你想要使用的语法,但是如何使用 AGI(带有 php)来实现这一点。只需在 php 脚本中定义逻辑并从拨号计划中调用它,如下所示:

exten => _0X.,n,AGI(script-filename.php,${CUSER},${EXTEN},${DTIME})

I don't really understand the syntax you're trying to use but how about using AGI (with php) for this. Just define your logic in a php script and call it from your dialplan as:

exten => _0X.,n,AGI(script-filename.php,${CUSER},${EXTEN},${DTIME})
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文