Asterisk incoming message gives: 415 unsupported media type

二次信任 提交于 2019-12-04 14:47:07

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? */

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.

You might just use "text/plain" for the Content-Type and handle scaip+xml in your app by automatically detecting it (for example if the message begins with then you can know that it is scaip xml).

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!