星号传入消息给出:415不支持的媒体类型 [英] Asterisk incoming message gives: 415 unsupported media type

查看:225
本文介绍了星号传入消息给出:415不支持的媒体类型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我和我的项目组正在尝试使用星号设置PBX.我们设法使其仅与SIP呼叫一起使用,并且效果很好. 但是,一旦我们想尝试向其中添加XML消息,Asterisk无法识别它,并给出"415不支持的媒体类型".似乎该呼叫甚至无法通过它立即被拒绝.

Me and my project group are trying to set up a PBX with asterisk. We've managed to let it work with just SIP calls and that works perfect. But once we want to try add an XML message to it Asterisk doesn't recognize it and gives "415 Unsupported Media Type". It seems like the call isn't even making it through it is getting rejected immediately.

我们试图找到可以处理但未发现任何内容的代码.

We have tried to find the piece of code where this gets handled but didn't found anything.

发送到Asterisk的SIP消息如下:

The SIP message that is send to Asterisk looks like this:

Request-Line: MESSAGE sip:701@xxx.xxx.xxx.109 SIP/2.0
  Method: MESSAGE
  Request-URI: sip:701@xxx.xxx.xxx.109
  Via: SIP/2.0/UDP xxx.xxx.xxx.111:5060;branch=z9hG4bK-3f138a53
  To: <sip:701@xxx.xxx.xxx.109>
  From: <sip:702@xxx.xxx.xxx.111>;tag=7a82b127
  Call-ID: 54634d4f2e@xxx.xxx.xxx.111
  CSeq: 104 MESSAGE
  Max-Forwards: 70
  User-Agent: CareIP 7813409 v1.2.4.0
  Content-Type: application/scaip+xml
  Content-Length: 91
Message Body
  <mrq><ref>765745670002</ref<mty>ME</mty><cid>266786</cid><dty>0005</dty><stc>0010</stc></mrq

我们的问题是: 我们可以在代码或配置文件中的何处找到星号,以决定是否支持媒体类型"?

Our question(s) is/are: Where in the code or config files can we find where asterisk decides whether this is "media type" supported or not?

有人知道如何添加Asterisk不支持的媒体类型吗?

Does someone know how to add a media type that is not supported (yet) by Asterisk?

推荐答案

似乎已接受消息的Content-Type是硬编码的,因此您将无法在配置文件中执行此操作.如果您在channels \ chan_sip.c中查看函数receive_message(),您将看到以下几行:

It looks like the accepted Content-Type for a Message is hard-coded, so you won't be able to do this in a config file. If you look at the function receive_message() in channels\chan_sip.c, you will see the following lines:

    if (strncmp(content_type, "text/plain", strlen("text/plain"))) { /* No text/plain attachment */
    transmit_response(p, "415 Unsupported Media Type", req); /* Good enough, or? */

如果修改strncmp()还允许"application/scaip + xml"并重新编译,它将不再响应415 Unsupported Media Type错误,并且可以修改其余的receive_message()函数以适合您的需求.

If you modify the strncmp() to also allow "application/scaip+xml" and recompile, it will no longer respond with the 415 Unsupported Media Type error, and you can modify the rest of the receive_message() function to suit your needs.

这篇关于星号传入消息给出:415不支持的媒体类型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆