[OpenSIPS-Users] Opensips-cp 8.3.0 HTTP/1.1 400 Bad Request..

Ovidiu Sas osas at voipembedded.com
Wed Nov 4 04:46:21 EST 2020


Hello Mario,

If you have CP working fine, you don't really need mi_html.
If you want to have it as an alternative, load the module and set a
new root path:
modparam("mi_html", "root", "opensips_mi")
Then you should be able to access the embedded management interface
via http://[OPENSIPS_HTTPD_IP]:[OPENSIPS_HTTPD_PORT]/opensips_mi

This interface has nothing to do with CP. It's an alternative to
opensipsctl, opensips-cli or CP (for dispatching management commands
to opensips). The module was written to provide easy access to mi
commands using a web browser (using the embedded web server from
opensips - no need to use a dedicated web server).

The old name of the module was mi_http and was renamed to mi_html.
The old mi_json was renamed to mi_http.
No more mi_json, welcome mi_html and mi_http was "rebranded":
mi_json [v<=2.4.x] -> mi_http [v>=3.0.x]
mi_http [v<=2.4.x] -> mi_html [v>=3.0.x]
This created some confusion when migrating from pre 2.4.x to post
3.0.x opensips versions.
Clear as mud? :)

Hope this helps,
Ovidiu

On Tue, Nov 3, 2020 at 4:59 PM Mario San Vicente <mrsanvicente at gmail.com> wrote:
>
> Hello Răzvan /  Ovidiu,
>
> After disabling mi_html, my CP is working fine, i will be enabling more modules on it.   Thanks for your help!
>
> Ovidiu,   It would be good to have both portals running,but  i am not getting to work the following comment:
> "If you want to keep mi_html, then set a different root path: #modparam("mi_html", "root", "osips_mi")  ", any other hint?
>
> Thank you!
>
>
>
>
>
> On Tue, Nov 3, 2020 at 8:22 AM Ovidiu Sas <osas at voipembedded.com> wrote:
>>
>> Hello Mario,
>>
>> It seems that you have both mi_http and mi_html modules loaded.
>> By default, both modules have the root path set to mi and one of the
>> modules is stealing the root path from the other.
>> In your case, when you hit http://x.x.x.x:8888/mi , you are hitting a
>> standalone management interface that is not part of opensips-cp. It's
>> an alternative way to run mi commands through a web interface.
>>
>> If you want to have only opensips-cp, then umload mi_html.
>> If you want to keep mi_html, then set a different root path:
>> #modparam("mi_html", "root", "osips_mi")
>>
>> Hope this helps,
>> Ovidiu
>>
>> On Sat, Oct 31, 2020 at 1:58 PM Mario San Vicente
>> <mrsanvicente at gmail.com> wrote:
>> >
>> > Hello  Răzvan ,
>> > I was wrong with my diagnosis, cause i stopped receiving the http / 400 error.  But when trying to monitor calls i see that the portal is not reflecting the real info, i tested dialogs and rtpproxy.
>> > I do see the json reply on a trace, but it is not updated on the portal:
>> >
>> > T 127.0.0.1:47632 -> 127.0.0.1:8888 [AP] #137
>> >   POST /mi HTTP/1.1..Host: 127.0.0.1:8888..Accept: */*..Content-Type: application/json..Content-Length: 49....{"jsonrpc":"2.0","id":1,"method":"rtpproxy_
>> >   show"}"id......._";i#4
>> > #
>> > T 127.0.0.1:8888 -> 127.0.0.1:47632 [A] #138
>> >   ......._..k#)...
>> > #
>> > T 127.0.0.1:8888 -> 127.0.0.1:47632 [AP] #139
>> >   HTTP/1.1 200 OK..Content-Length: 136..Content-Type: application/json..Date: Sat, 31 Oct 2020 17:34:22 GMT....{"jsonrpc":"2.0","result":[{"Set":0,"Nodes
>> >   ":[{"url":"udp:localhost:2123","index":0,"disabled":0,"weight":1,"recheck_ticks":0}]}],"id":1}.........._..k#4
>> > --------------------------------
>> > T 127.0.0.1:47644 -> 127.0.0.1:8888 [AP] #204
>> >   POST /mi HTTP/1.1..Host: 127.0.0.1:8888..Accept: */*..Content-Type: application/json..Content-Length: 78....{"jsonrpc":"2.0","id":1,"method":"dlg_list"
>> >   ,"params":{"index":0,"counter":20}}............._J.
>> > #
>> > T 127.0.0.1:8888 -> 127.0.0.1:47644 [A] #205
>> >   @......_........
>> > #
>> > T 127.0.0.1:8888 -> 127.0.0.1:47644 [AP] #206
>> >   HTTP/1.1 200 OK..Content-Length: 58..Content-Type: application/json..Date: Sat, 31 Oct 2020 17:42:14 GMT....{"jsonrpc":"2.0","result":{"count":0,"Dialo
>> >   gs":[]},"id":1}........._4...4.
>> >
>> > Aside notes:
>> > When enabling this line #modparam("mi_http", "root", "opensips_mi") , i can see the mi portal.  http://x.x.x.x:8888/mi , which has lots of aditional info,  but i have to disable it to get the json response and just get an http response pointing to the mi interface:
>> > T 127.0.0.1:8888 -> 127.0.0.1:47654 [AP] #256
>> >   HTTP/1.1 200 OK..Content-Length: 1886..Content-Type: text/html..Date: Sat, 31 Oct 2020 17:55:45 GMT....<html><head><title>OpenSIPS Management Interface
>> >   </title><style type="text/css">body{margin:0;}body,p,div,td,th,tr,form,ol,ul,li,input,textarea,select,a{font-family:"lucida grande",verdana,geneva,aria
>> >   l,helvetica,sans-serif;font-size:14px;}a:hover{text-decoration:none;}a{text-decoration:underline;}.foot{padding-top:40px;font-size:10px;color:#333333;}
>> >   .foot a{font-size:10px;color:#000000;}table.center{margin-left:auto;margin-right:auto;}</style><meta http-equiv="Expires" content="0"><meta http-equiv=
>> >   "Pragma" content="no-cache"><link rel="icon" type="image/png" href="https://opensips.org/favicon.png"></head>.<body alink="#000000" bgcolor="#ffffff" l
>> >   ink="#000000" text="#000000" vlink="#000000"><table cellspacing="0" cellpadding="5" width="100%%" border="0"><tr bgcolor="#BBDDFF"><td colspan=2 valign
>> >   ="top" align="left" bgcolor="#EFF7FF" width="100%%"><br/><h2 align="center">OpenSIPS MI HTML Interface</h2><p align="center">OpenSIPS (3.1.0-dev (x86_6
>> >   4/linux)) is running since <i>Sat Oct 31 11:55:35 2020</i></p><br/></td></tr></table>.<center>.<table border="0" cellpadding="3" cellspacing="0"><tbody
>> >   ><tr>.<td><a href='/mi/statistics'>statistics</a><td>.<td><a href='/mi/core'>core</a><td>.<td><a href='/mi/blacklists'>blacklists</a><td>.<td><a href='
>> >   /mi/httpd'>httpd</a><td>.<td><a href='/mi/tm'>tm</a><td>.<td><a href='/mi/usrloc'>usrloc</a><td>.<td><a href='/mi/dialog'>dialog</a><td>.<td><a href='/
>> >   mi/nathelper'>nathelper</a><td>.<td><a href='/mi/rtpproxy'>rtpproxy</a><td>.<td><a href='/mi/db_text'>db_text</a><td>.<td><a href='/mi/drouting'>drouti
>> >   ng</a><td>.</tr></tbody></table>..</center>.<div align="center" class="foot" style="margin:20px auto"><span style='margin-left:5px;'></span><a href="ht
>> >   tps://opensips.org">OpenSIPS web site</a><br/>Copyright © 2011-2015 <a href="http://www.voipembedded.com/">VoIP Embedded, Inc.</a>. All rights res
>> >   erved.</div></body></html>.......!.._X.t.4
>> >
>> > Thank in advace.
>> >
>> >
>> > On Fri, Oct 30, 2020 at 8:45 PM Mario San Vicente <mrsanvicente at gmail.com> wrote:
>> >>
>> >> Hello  Răzvan ,
>> >>
>> >> Thanks alot, that made the trick.
>> >>
>> >> I will check if something is not matching with the monit page cause that is not working ,  but that's another story.
>> >>
>> >> Best regards.
>> >> Mario
>> >>
>> >>
>> >>
>> >>
>> >>
>> >> On Thu, Oct 29, 2020 at 3:49 AM Răzvan Crainea <razvan at opensips.org> wrote:
>> >>>
>> >>> As I see in your logs, OpenSIPS CP uses the `json` URL path for querying
>> >>> MI, whereas the default root path is `mi`[1]. Either change the `root`
>> >>> to `json`, or modify your OpenSIPS CP boxes config to `mi`.
>> >>>
>> >>> [1] https://opensips.org/docs/modules/3.1.x/mi_http.html#param_root
>> >>>
>> >>> Best regards,
>> >>>
>> >>> Răzvan Crainea
>> >>> OpenSIPS Core Developer
>> >>> http://www.opensips-solutions.com
>> >>>
>> >>> On 10/28/20 11:23 PM, Mario San Vicente wrote:
>> >>> >    Thanks for the answer Johan,
>> >>> >
>> >>> > But i see that; the *mi_json* module has been renamed to
>> >>> > *mi_http* module.  and so: failed to load module mi_json.so
>> >>> > https://www.opensips.org/Documentation/Migration-2-4-0-to-3-0-0
>> >>> >
>> >>> > I am using opensips 3.1
>> >>> > I have this modules:
>> >>> >
>> >>> > loadmodule "httpd.so"
>> >>> > modparam("httpd", "port", 8888)
>> >>> > #### MI_HTTP module
>> >>> > loadmodule "json.so"
>> >>> > #loadmodule "mi_json.so"
>> >>> > loadmodule "mi_http.so"
>> >>> >
>> >>> > Any other clue?
>> >>> >
>> >>> > Thank you
>> >>> >
>> >>> >
>> >>> > _______________________________________________
>> >>> > Users mailing list
>> >>> > Users at lists.opensips.org
>> >>> > http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>> >>> >
>> >>>
>> >>> _______________________________________________
>> >>> Users mailing list
>> >>> Users at lists.opensips.org
>> >>> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>> >>
>> >>
>> >>
>> >> --
>> >> Mario San Vicente
>> >> Cheers!
>> >
>> >
>> >
>> > --
>> > Mario San Vicente
>> > Cheers!
>> > _______________________________________________
>> > Users mailing list
>> > Users at lists.opensips.org
>> > http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>>
>>
>>
>> --
>> VoIP Embedded, Inc.
>> http://www.voipembedded.com
>>
>> _______________________________________________
>> Users mailing list
>> Users at lists.opensips.org
>> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>
>
>
> --
> Mario San Vicente
> Cheers!
> _______________________________________________
> Users mailing list
> Users at lists.opensips.org
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users



-- 
VoIP Embedded, Inc.
http://www.voipembedded.com



More information about the Users mailing list